| @@ -1,17 +1,19 @@ | |||||
| function [phase,magnitude] = phamag(wave1,wave2,frequency,T,length) | |||||
| function [phase,magnitude] = phamag(wave1,wave2,length,frequency,T) | |||||
| %PHAMAG Summary of this function goes here | %PHAMAG Summary of this function goes here | ||||
| % Detailed explanation goes here | % Detailed explanation goes here | ||||
| wave = [wave1;wave2]; | wave = [wave1;wave2]; | ||||
| fft1 = fft(wave); | |||||
| Fs = 1/T; | |||||
| n = 2^nextpow2(length); | |||||
| X = fft(wave,n,2)/n; | |||||
| idx = round(frequency*n/Fs) | |||||
| phase = mod(angle(X(1,idx))-angle(X(2,idx))+pi,2*pi)-pi; | |||||
| magnitude = X; | |||||
| for i=1:2 | |||||
| subplot(2,1,i) | |||||
| plot(0:(Fs/n):(Fs/2-Fs/n),abs(X(i,1:n/2))) | |||||
| title(['Row ',num2str(i), ' in the Frequency Domain']) | |||||
| end | |||||
| function g = phasefft(wave,length,T) | |||||
| f = fft(wave); | |||||
| g = abs(f(1:length/2+1)/length); | |||||
| figure; | |||||
| plot(f) | |||||
| end | |||||
| end | end | ||||