Frequency domain response from time domain response using PSD
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hii all,
I used FFT in Matlab to convert time domain wave elevation to frequency domain JONSWAP spectrum. But the spectrum is supposed to be in smooth curve but I am getting unwanted peaks and noise. Please help me to get the spectrum smooth. I am attaching the matlab script below and the spectrum obtained and what I am supposed to get.
clear;
clc;
Wave1= xlsread('WaveElev_Time_LC1.xlsx');
Wave=Wave1(:,2);
figure();
plot(Wave1(:,1),Wave);
title("Wave elevation in Time Domain");
xlabel('Time(s)','linewidth',3);
ylabel('Wave Elevation(m)','linewidth',3);
xlim([0 3600]);
Ns=length(Wave);
fs=1/0.0125;
fft_Wave=fft(Wave);
fft_Wave = fft_Wave(1:Ns/2+1);
psdx = (1/(fs*Ns)) * abs(fft_Wave).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:fs/Ns:fs/2;
y = smooth(freq, psdx);
figure();
plot(freq,y,'linewidth',2);
xlim([0 0.2])
1 comentario
Mathieu NOE
el 1 de Mzo. de 2022
hello
try with smoothdata , I would suggest with gaussian window
adapt the window length to get the desired amount of smootihing
Respuestas (1)
Balavignesh
el 11 de En. de 2024
Hi Mohammed,
As per my understanding, you are encountering spectral leakage and noise in your Fast Fourier Transform (FFT) output, which is common when dealing with finite or non-periodic signals. I would suggest you apply a window using 'hann' function to the time-domain signal before performing 'FFT' to obtain a smoother spectrum. The windowing process helps reduce spectral leakagge by tapering the beginning and end of the time-domain signal to zero.
The following code snippet may help you understand this:
% Creating a window
window = hann(Ns);
% Applying window function to the wave
Wave_windowed = Wave.*window;
% Performing fft
fft_Wave=fft(Wave_windowed);
fft_Wave = fft_Wave(1:Ns/2+1);
Kindly refer to the following documentation links to have more information on:
0 comentarios
Ver también
Categorías
Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!