CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Spectrogram (https://www.cfd-online.com/Forums/main/239613-spectrogram.html)

zese November 15, 2021 12:40

Spectrogram
 
Hi,

Is there anyone who have done the Spectrogram on numerical unsteady pressure or velocity signal?

How I can make a better resolution for low frequencies and skip high frequencies.

Best regards,

LuckyTran November 15, 2021 13:16

Bin your signal. You'll lose the lowest frequencies at the expense of resolution. And you increase sample size for highest resolutions and get better statistics.

FMDenaro November 15, 2021 14:13

Quote:

Originally Posted by zese (Post 816594)
Hi,

Is there anyone who have done the Spectrogram on numerical unsteady pressure or velocity signal?

How I can make a better resolution for low frequencies and skip high frequencies.

Best regards,


Do you want to build a map in the (k,t) plane of the spectal content, right?



But I don't fully understand your question, you can filter out high frequencies but the low frequencies should be already well resolved.
Could you detail what you are doing in the simulation of your flow problem?

zese November 17, 2021 01:56

3 Attachment(s)
Quote:

Originally Posted by FMDenaro (Post 816601)
Do you want to build a map in the (k,t) plane of the spectal content, right?



But I don't fully understand your question, you can filter out high frequencies but the low frequencies should be already well resolved.
Could you detail what you are doing in the simulation of your flow problem?

[QUOTE=FMDenaro;816601]Do you want to build a map in the (k,t) plane of the spectal content, right?

Dear

I have the time varying pressure data as the attach. the time step for numerical simulation was 0.00054 so I set the sample time as this value. the number of total samples are about 14000 and there are two frequencies which are important for me, 18 and 2.5 Hz. when I plot spectrogram the range of frequency is 0-950 when I decrease it the plot has no resolution and it is not clear. the pictures are attached.
Fs = 1/DT;
[S,F,T,P] = spectrogram(X,500,300,500,Fs);
surf(T,F,10*log10(abs(P)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time (s)');
ylabel('Frequency (Hz)');

how I can filter out other frequencies except 2.5 and 18?

I showed the pictures of spectrogram in attached files for both initial and the other zoom below 50 Hz

FMDenaro November 17, 2021 03:59

[QUOTE=zese;816713]
Quote:

Originally Posted by FMDenaro (Post 816601)
Do you want to build a map in the (k,t) plane of the spectal content, right?

Dear

I have the time varying pressure data as the attach. the time step for numerical simulation was 0.00054 so I set the sample time as this value. the number of total samples are about 14000 and there are two frequencies which are important for me, 18 and 2.5 Hz. when I plot spectrogram the range of frequency is 0-950 when I decrease it the plot has no resolution and it is not clear. the pictures are attached.
Fs = 1/DT;
[S,F,T,P] = spectrogram(X,500,300,500,Fs);
surf(T,F,10*log10(abs(P)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time (s)');
ylabel('Frequency (Hz)');

how I can filter out other frequencies except 2.5 and 18?

I showed the pictures of spectrogram in attached files for both initial and the other zoom below 50 Hz




Your case becomes statistically steady after about t=4.5. You should pick your values after that time, you see the signal is periodic. That is you could sample some interval of periodicity and perform the FFT, then take the averaging.

zese November 17, 2021 04:11

[QUOTE=FMDenaro;816718]
Quote:

Originally Posted by zese (Post 816713)




Your case becomes statistically steady after about t=4.5. You should pick your values after that time, you see the signal is periodic. That is you could sample some interval of periodicity and perform the FFT, then take the averaging.

I know I did already FFT but I wanted to see when in time these frequencies are created. so I did some transient simulation by changing flow rate from BEP to PL of turbine.

FMDenaro November 17, 2021 05:11

[QUOTE=zese;816720]
Quote:

Originally Posted by FMDenaro (Post 816718)

I know I did already FFT but I wanted to see when in time these frequencies are created. so I did some transient simulation by changing flow rate from BEP to PL of turbine.


Try to pickup your signal in the range of time from 1.5 to 4, then subtract the linear slope in such a way to consider only the fluctuations.

LuckyTran November 17, 2021 14:07

You really don't need to worry about statistics when using the spectrogram. Subtracting out this linear background component is like setting the FFT coefficients to zero from 0 thru 0.22 Hz.

I don't have experience with your signal to tell you why you do not get more distinct bands like you expect except to tell you to play with it more.

I personally don't use the spectrogram function in matlab for making spectrograms plots, I like better the Constant Q transform method (for cultural reasons). However, theoretically they are the same except the bin-widths are varying in the constant Q transform whereas the frequency bins are constant width when you use an FFT.

But if there was a strong response at 2.5 and 18 Hz in your system, you would be able to see their envelopes in the temporal signal. And I'm not sure I see any envelope for any frequency. I would recommend running some test cases using the same background linear signal, with numerically/artificially added sinusoidal functions with periodic frequencies of 2.6 and 18 Hz so you can see what the spectrogram ought to look like. And then convince yourself that your signal does not look anything like this.

FMDenaro November 17, 2021 14:47

I have no direct experience in the spectogram function in matlab. But if the goal is to get the onset of the frequency pattern appearing after t=4.5 I would first perform the simple FFT of the previous linear windows. Clearly, using only the fluctuating part of the signal. This is the first check I would do.

Then we can check for the proper method to find the times of the onset of such frequencies.

LuckyTran November 17, 2021 15:26

I'm sorry, I didn't realize we were looking at the frequency response after ~4 seconds (I was only looking at the ramp). Actually you can clearly see two envelopes. The lower frequency one is around 2 Hz.

But having a signal length of only 2 or so seconds is not very many samples and it will be hard to get any meaningful resolution of this in a spectrogram. Can we not sample longer....? Maybe it's just spectral leakage from not having a long enough signal.


All times are GMT -4. The time now is 10:32.