# Separate a time signal for each frequency

15 views (last 30 days)
Erik Nilsson on 26 Oct 2020 at 11:01
Answered: Star Strider on 26 Oct 2020 at 11:58
I have a signal with acceleration over time and the auto spectrum (acceleration over frequency) for the same signal. The time signal is 1 second long and the auto spectrum goes up to 3200 Hz with an intervall of 1 Hz. I want to write a code so that I get a time signal for each frequency. Is this possible and which functions should I use? The code below displays 9 different time signals. The auto spectrum is not in this code.
I have tried to do this using the spectrogram function but can't make it work. I can display the draft of my code below. Is this the right function or how can I do this better? Please help me to solve this. When using the spectrogram function, the time signal goes up to 1,26 seconds even though my measurements only goes up to 1 second... And I want to have acceleration over time for each frequency, not the Power/frequency as I get with this code.
A = table2array(T);
Time=A(1:length(A),1);
Signal1=A(1:length(A),2);
Signal2=A(1:length(A),3);
Signal3=A(1:length(A),4);
Signal4=A(1:length(A),5);
Signal5=A(1:length(A),6);
Signal6=A(1:length(A),7);
Signal7=A(1:length(A),8);
Signal8=A(1:length(A),9);
Signal9=A(1:length(A),10);
%FFT
Fs = 6400; % Sampling frequency
[s,w,t]=spectrogram(A(1:length(A),9),kaiser(256,1),220,512,Fs,'yaxis');
spectrogram(A(1:length(A),9),kaiser(256,1),220,512,Fs,'yaxis');

Star Strider on 26 Oct 2020 at 11:58
The pspectrum function (introduced in R2017b) with the 'spectrogram' type may be what you want. It produces a spectrogram plot and spectrogram output (if you ask it to), however with completely different units and resolution than the spectrogram function that you are currently using.