digital signal related question(fft,pspectrum)

11 views (last 30 days)
Hi
I have a dsp related question but i dont know if this is the right place to ask it.
I have real life measurements from a device in timedomain with a length of approximatley 14-15seconds. During this time the device was off and after a couple of seconds turned on. I use the function pspectrum in matlab to plot the spectrogram of this signal wich hive me this:
The first two seconds the device was off, between 2 and 4 seconds you see the start-up transients and after 4 seonds we are in steady state. Clearly we can see a component on 200Hz and 400Hz. If i plot the spectrum amplitude-frequency domain at timepoint 8seconds i get the following spectrum:
The top spectrum is when the device is turned off and the bottom spectrum is when the device is in steady state. So even here you can see the components on 200Hz and 400Hz showing up. So i am interested in these components. But this is where my problem comes. What i want is to extract the amplitude AND the phase of those components. unfortunately the function pspectrum cant calculate the phase of the components, so this is my idea.
I know that after 4seconds these 2 components are always in the signal. If i use the fft function over the whole time domain signal i will have amplitude loss because for the first 4 seconds the components are'nt in the signal. So i extract the time domain signal from 13seconds to 14 seconds(because the amplitude is the highest in this time slot) so i have a time domain signal of 1 second. For this time domain signal i use a the function fft in matlab so i can calculate the amplitude and phase of the components. I expect the same amplitude-frequency plot like that from the figure above, but instead when using regular fft over 1 second of data i get following spectrum.
As you can see when calculating the spectrum using regular fft i expected to see a dominant frequency at 200Hz and a smaller one on 400Hz but instead i get a whole lot more components that are dominant in the spectrum. As i dont have enough expercience with dsp i dont quite know how this comes. Is there anyone who can help me with this or explain how this comes?
I appreciate any kind of help
Thanks in advance

Accepted Answer

Star Strider
Star Strider on 27 Jul 2020
If you only want to isolate those two frequencies, use the bandpass function to design filters for each frequency. (That group of functions were introduced in R2018a. If you have an earlier version, bandpass filters are straightforward to design in MATLAB. I will help you design them, if you want.)
  4 Comments
Sören Gevaert
Sören Gevaert on 28 Jul 2020
Edited: Sören Gevaert on 28 Jul 2020
Thank you for the clear explenation :) the reason i use pspectrum is that i can see the spectrogram(time-frequency domain). I have a time domain signal as follows:
This a measuerment on a car where the first seconds the car is turned off and after a couple seconds turned on. You can see that with the big spikes. After like 5seconds the car is in steady state. When you watch the spectrogram that i posted in my first post you can see this in time-frequency domain(with pspectrum). On this spectrogram you can see a component on 200Hz and 400Hz appear. I know when you calculate the spectrum with fft over the whole time domain you will have power loss(so amplitude will be smaller of 200Hz and 400Hz) because these components are not in the signal for the first 5 seconds. So what i am trying to do, is to devide the time signal where only these 2 components are in the signal. In this case from approximately 5 seconds till the end and calculate the spectrum with fft.
Thats why i find it so strange, because when you use psepctrum to calculate te spectrogram as follows:
xTable1 = timetable(seconds(time),channelAinV);
pspectrum(xTable1,'spectrogram', ...
'FrequencyLimits', [0 450],'FrequencyResolution',1);
title('Spectrogram');
it uses short-time fourier transform to calculate the spectrum so i think that if signals other than 200Hz and 400Hz are in the signal it also would have seen it? But from 5 seconds it only sees frequencys 200Hz and 400Hz when the car is in steady state with 200Hz the dominant one. But when you calculate with fft from lets say 10 to 11seconds it sees even higher peaks than the peak on 200Hz. So i understand that you see more components cause of the resolution, but i didnt expect to see higher amplitudes on other frequencys because the spectrogram didnt showed these frequencys?
I hope my explenation is somehow clear :)
Thanks in advance!
Star Strider
Star Strider on 28 Jul 2020
I am lost with respect to the result you want. Filtering the time-domain data should give you the frequencies that you want as output. You can then analyse them.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!