Frequency domain response from time domain response using PSD
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Mathieu NOE
2022년 3월 1일
hello
try with smoothdata , I would suggest with gaussian window
adapt the window length to get the desired amount of smootihing
답변 (1개)
Balavignesh
2024년 1월 11일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!