フィルターのクリア

Unwrapped phase of signal

12 ビュー (過去 30 日間)
Athira Surendran
Athira Surendran 2017 年 6 月 8 日
コメント済み: Adam 2017 年 6 月 9 日
Hi all,
I've a set of amplitude-time data. I need to find the unwrapped phase of it and then plot cosine of unwrapped phase against frequency. This is the part of the code I tried. But the unwrapped phase values seems to be either 0 or pi (which is wrong i think). Can someone help me? (Amplitude data is attached for reference).
[m, n]= size(amp); % amp- amplitude data
t=linspace(0,5000,n); % time
Fs=2000000;
for i=1:m
L = n;
NFFT = 2^nextpow2(L);
UT = fft(amp(i,:),NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2);
ft = UT(1:NFFT/2);
mag(i,:) = 2*abs(ft);
end;
% unwrapped phase of signal
for i=1:m
g(i,:)=unwrap(angle(mag(i,:)));
figure
plot(f,cos(g(i,:)))
end;

採用された回答

Adam
Adam 2017 年 6 月 8 日
編集済み: Adam 2017 年 6 月 8 日
Why are you bothering to unwrap the phase if you are just going to take the cosine of it? It will be exactly the same as for the wrapped phase. Do you use the unwrapped phase for anything else?
To answer the question about 0 or pi though, you are trying to take an angle of a magnitude value. You need to take the angle of the complex result - i.e. ft in your case, not mag which is the result of an abs operation. A real result will only ever have a phase angle of 0 or pi because it has no imaginary part to it.
  2 件のコメント
Athira Surendran
Athira Surendran 2017 年 6 月 9 日
Hi Adam, I'm not using unwrapped phase for anything else. Since I'm taking cosine of it I can just go for angle instead of unwrap right?
Now I understood why I was getting only pi or 0. Thanks a lot for the explanation. That resolved most of my doubts I guess... :)
Adam
Adam 2017 年 6 月 9 日
Yes, phase unwrapping is just a way to be able to see gradual phase changes more easily without having the discontinuities when you flip from pi to -pi. Taking the cosine is the same though whichever you use because the actual angle is still the same.

サインインしてコメントする。

その他の回答 (0 件)

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by