I have a sine wave whose frequency is changing in irergular intervals from 50HZ to 55HZ and back to 50HZ.i need to extract the frequency information from the sin wave I need to plot the frequency vs time in a graph..
1 次查看(过去 30 天)
显示 更早的评论
Hi, I have a sin wave whose frequency is changing in irregular intervals from 0 to 10 sec the frequency is 50 HZ sec.From 10 sec to 25 HZ the frequency is 55HZ, its again becoming 50HZ from 25 sec to 30 sec. I need to extract the frequency information (not spectrum analysis) from sin wave itself,that from what time to till what time 50 HZ,55 HZ is persisting and at what time onwards 50 Hz is again coming and persisting,just a frequency (y axis) vs time(x axis) plot, means suppose a 50 Hz frequency is exciting from 0 to 10 sec i need to plot a straight line in 50 HZ till 10 sec and if the frequency is changing to 55 HZ from 10 sec to 25 sec i need to see that change in my graph and again going back to 55 HZ at 25 sec.i tried lots of methodS..Its showing error, and its not plotting correctly, Can any one help me in this issue?
0 个评论
采纳的回答
Wayne King
2012-7-29
In this simple example, you can use the short-time Fourier transform to do this. You're really after something called the instantaneous frequency, which is not a trivial thing to estimate in most cases.
Fs = 1000;
t = 0:1/Fs:30-(1/Fs);
x = cos(2*pi*50*t).*(t<=10)+cos(2*pi*55*t).*(t>10 & t<=25)+...
cos(2*pi*50*t).*(t>25 & t<30);
plot(t,x)
[y,f,T,p] = spectrogram(x,250,200,200,Fs);
preduced = p(11:12,:);
subplot(211)
plot(T,preduced(1,:))
title('50-Hz Component')
subplot(212)
plot(T,preduced(2,:))
title('55-Hz Component');
xlabel('Seconds')
4 个评论
Bjorn Gustavsson
2012-7-31
Well time-frequency analysis is not my core field of work, so my expertise in the more technical details is vague, but there is a good matlab toolbox for time-frequency analysis (with good documentation!) that I've used:
There they describe the hows and ifs about instantaneous frequency. In short w(t) is defined as the time derivative of the instantaneous phase. The instantaneous phase (and amplitude) you get by way of the Hilbert transform. But have a look at the time-frequency toolbox.
HTH,
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!