FFT of a Superposition signal

5 views (last 30 days)
Ram Prasadh Narayanan
Ram Prasadh Narayanan on 11 Aug 2022
Edited: Benjamin Thompson on 11 Aug 2022
Hi,
I have a superposition signal waveform, which I am importing as a txt file, attaching the file. I would like to get the frequency components of the signal. This should be an easy code with just calling the fft function. But I am not able to see the frequency points. May be I am missing something. Could someone please help?
clc;close all
x1 = importdata('Plot-try-matlab-1.txt');
time = x1(:,1);
N = length(x1);
n = 2^nextpow2(N);
Y = fft(x1,n);
plot(Y);
Thanks for the help.

Answers (1)

Benjamin Thompson
Benjamin Thompson on 11 Aug 2022
Edited: Benjamin Thompson on 11 Aug 2022
Try this, and see this article on usage of the FFT to understand how to interpret the results and assign results to frequencies. Your time data does not make sense so I just plot results on a range of 1:n for frequency.
clc;close all
x1 = importdata('Plot-try-matlab-1.txt');
time = x1(:,1);
N = length(x1);
n = 2^nextpow2(N);
Y = fft(x1(:,2),n);
plot(1:n, abs(Y));
https://www.mathworks.com/help/matlab/math/fourier-transforms.html
https://www.mathworks.com/help/matlab/math/fourier-transforms.html

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!