frequency obtained by cftool is 10 times less than what I should get
1 view (last 30 days)
Show older comments
Hi everyone, I am using fourier series for one of my application. I was getting wrong result, so I decided to check the fit(t,variable,'fourier1') for small application. I used the following code to generate a cos wave
%%Angular Frequency
omega=0.65;
%%Time specifications:
Fs = 10; % samples per second
dt = 1/Fs; % seconds per sample
StopTime =200*omega/pi; % seconds
t = (0:dt:StopTime-dt)'; % seconds
%%Sine wave:
x = cos(omega*t);
% Plot the signal versus time:
figure;
plot(t,x);
I used this cos wave in cftool and fit function. both gave me results as in figure.
as you can see, in result I got w=omega=0.065 whereas The original signal was having angular frequency as 0.65;
I have tried this for other frequency too and result is always 10 times less. What am i doing wrong ?
2 Comments
David Goodmanson
on 15 May 2017
Hi Kunal, I don't have access to cftool but this gives the impression that some part of the calculation is not getting the message that your time array has spacing of 1e-1. If it were assumed instead that the spacing is 1, then the calculated omega is down by a factor of 10. If you change Fs to 20, does the answer change by that same factor?
Answers (1)
John D'Errico
on 14 May 2017
Decent starting values are critical to finding a good estimate. If you provide no starting values at all, then you get an arbitrary result, often something that will not make you happy.
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!