I believe my issue is finding the correct bin where the amplitude and phase would fall into, is there a general way to do that if you supposidly do not know the information before hand ?(i.e frequency,amplitude...)
Info
This question is closed. Reopen it to edit or answer.
Why do I get the wrong phase after I apply FFT to my sinusoidal?
1 view (last 30 days)
Show older comments
I have a function x = A0*(1+sin(w*t + phi)); all the variable are known. The time vector is provided also. When I take a vector of the solution x do an fft on it, I get the wrong phi that I started with. For example, my phi = 45, I get back 180. Here is what i have so far:
x=[.....];
t=[.....];
m=ceil(log2(length(x)));
fft_A=fft(x,2^m);
fft_A = 2*fft_A/length(x);
%Find the phase angle
FT_power2 = abs(fft_A).^2;
FT_phase2= ((unwrap(angle(fft_A))))*(180/pi);
[c2,i2] = max(FT_power2);
phase = (FT_phase2(i2))
What am I doing wrong? thank you.
PS: I understand that I have a DC offset of A0 but I am not sure how to deal with it and what to expect.
2 Comments
Matt J
on 27 Feb 2013
You asked effectively the same question here (and received answers)
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!