How to get the exact amplitudes of an irregular wave?

30 views (last 30 days)
I have time and displacement data of an irregular wave, and generated the amplitude spectrum by fft but the spectrum is very peaky it has lot of amplitudes (figure2). I need to extract the exact amplitude from that spectrum. For eg: given fig 1 has two peak amplitudes i need to get those amplitude at one time. If there was only one peak then it is easy to check by giving max command but for multiple peaks i dont know how to get that.
After fft i got the below figure, how to i get the exact amplitude values from the below figure?. Is there is any other way to extract the amplitudes?
The code i used for irregular sinwave to get the amplitude is,
T=time
X=Displacement
L = length(T);
nfft = 2^nextpow2(L);
f = Fs/2*linspace(0,1,nfft/2+1);
xfft = fft(X,nfft)/L;
xfftwant = 2*xfft(1:length(xfft)/2+1);
plot(f,abs(xfftwant ))

Accepted Answer

Star Strider
Star Strider on 15 Aug 2020
The second figure displays broadband noise. The easiest way to deal with that would be to denoise the original time-domain signal, either using the smoothdata function, the Wavelet Toolbox functions, or the Signal Processing Toolbox sgolayfilt function. The reason is that denoising the time-domain signal may be the easiest, since that allows interactive visual determination of the smoothed signal and the original signal. Then take the fft of the denoised signal to get the spectrum you want.
With broadband noise, frequency-selective filters will not work.
  19 Comments
Martin Thomas
Martin Thomas on 27 Aug 2020
hey one last doubt, fft result has more values than we need how to trim that values.? how to identify?
Star Strider
Star Strider on 27 Aug 2020
I am not certain what you want to do. I would not change the fft call to produce fewer points, although that is an option using the optional second argument to the fft function. Depending on what you want, you can just trim the end of the ‘FTD2rs’ matrix, or decimate it, for example as:
FTD2rsd = FTD2rs(1:10:end,:);
to keep only every tenth value. Change the ‘step’ value (10 here) to produce different results and different row-length ‘FTD2rsd’ variables. There are other possibilities as well, such as interpolating it to a new frequency vector, using linspace to define the interopolation vector and interp1 to do the actual interpolation. The choice is yours.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!