MATLAB Answers

How to plot fft outputs in frequency domain?

15 views (last 30 days)
Hi all,
I have attached the m-file for information about my question.
I have time-history acceleration data named BodyAccel_y in the workspace. I converted it to frequency domain by using fft in MATLAB.
However, as I noticed, the outputs are complex numbers.
I would like to plot the output data on Y-axis against their individual frequencies in X-axis.
I am new to this subject. I would appreciate any guidance/suggestion/instruction provided for this matter.
Thank you.

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 3 Jul 2020
You have to generate the frequency values based on the sampling you have and use abs of the result of fft.

  1 Comment

Chutiphon Moranon
Chutiphon Moranon on 3 Jul 2020
Thank so much. I have followed the instructions in that link. It is really helpful.

Sign in to comment.

More Answers (1)

Arham jain
Arham jain on 3 Jul 2020
if you want to plot the magnitude use
Y = abs(fft(BodyAccel_y));
if you want to plot phase use
Y = angle(fft(BodyAccel_y));

  1 Comment

Chutiphon Moranon
Chutiphon Moranon on 3 Jul 2020
Thank you so much. Your reply is helpful.

Sign in to comment.