# frequency vs time plot in matlab

#### ashish.eeiitm

Joined Dec 18, 2009
5
hi
i have a sine wave with a varying frequency term, as in the f is 10 for a particular time interval and zero everywhere else.
I want to plot the frequency vs time.

any help on how to do the same using matlab/simulink.

I tried using fft but i'm sure of it's working. Just used the code given in matlab help file

#### ashish.eeiitm

Joined Dec 18, 2009
5

I'll tell the complete problem just in case it helps. I have a signal with frequency 193THz - 11.3GHz -100MHz in a certain section. The rest of the section has 193THz - 11.3GHz. I need to isolate this 100MHz and to do so I superimposed it with 193 THz and then with a 11GHz after passing through low pass filters respectively. Now when I did an FFT on the resultant signal I got two peaks one at 0 and the other at 11GHz. I used the simulink filter design block and used the coefficients as the filter in my matlab code - donno if this is right but seems like the second filter is not working. I also tried using the mkfilter function but it gives me a steady state variable and conv ss object with the signal gives an error.
Any assistance as to how to proceed further pleaseee!

#### Nanophotonics

Joined Apr 2, 2009
383
Sorry, I'm a bit rusty with Matlab.

Post your code, maybe someone will help.

#### guitarguy12387

Joined Apr 10, 2008
359
Try plotting with fftshift() and see if that gives you what you're looking for

#### ashish.eeiitm

Joined Dec 18, 2009
5
tried that - doesn't help much. thanks anyway.
I'm using simulink blockset to design low pass filter with pass band 15000 and stop band 20000. I multiplied two sinusoids one with a freq of say 193550 and the other with 193550-11303-100. The output should contain 11303-100 component and 387100-11303-100 which should be filtered out when passed through the above signal. I used the filter(b,a,X) function where b is the num exported from simulink and a the denominator has coefficients all 1 and length equal to the numerator.

Now I multiplied this resultant signal with another sinusoid of frequency 11303 and passed it through a filter with passband 1500 and stop band 2000. The output should be a sinusoid with frequency 100. FFT of this signal should give two peaks - one at 0 and the other at 100. But I'm getting peaks at 0 and 11303.

I donno if my implementation of filter is right or not? Matlab help is clearly not helping me much. any help is appreciated. thanks in advance.