25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
469B

  1. function [phase,magnitude] = phamag(wave1,wave2,length,frequency,T)
  2. %PHAMAG Summary of this function goes here
  3. % Detailed explanation goes here
  4. wave = [wave1;wave2];
  5. Fs = 1/T;
  6. n = 2^nextpow2(length);
  7. X = fft(wave,n,2)/n;
  8. idx = round(frequency*n/Fs)
  9. phase = mod(angle(X(1,idx))-angle(X(2,idx))+pi,2*pi)-pi;
  10. magnitude = X;
  11. for i=1:2
  12. subplot(2,1,i)
  13. plot(0:(Fs/n):(Fs/2-Fs/n),abs(X(i,1:n/2)))
  14. title(['Row ',num2str(i), ' in the Frequency Domain'])
  15. end
  16. end