Hi. I want to generate time-varying frequency signal.
I have frequency data per every time sample.
For example, for a 1 second time duration signal with a sampling frequency of 100 Hz, I have 100 frequency values.
The picture above is showing the frequency data per time sample that I actually have. It is a signal of 0.85 seconds sampled at 100 kHz.
I want to get a spectrogram by making sound data from this value, but something goes wrong.
Down below is the code I made and the result. I'm not sure where I went wrong in the code.
Signal = cos(2*pi*Freq.*Time) + 1j*sin(2*pi*Freq.*Time);
[s,ff,ttt] = spectrogram(y,1024,800,1024,fs);
axes1 = axes('Parent',X);
set(axes1,'YDir','normal');
axis([ttt(1) ttt(end) 4e3 17e3]);xlabel('sec');ylabel('Hz');
The above spectrogram figure is the result of the generated spectrogram. As you can see, the signal was generated a lot different from the frequency data I had.
Please help. Thanks.