17 views (last 30 days)

Aquatris
on 12 Sep 2018

You put all of the signals you want in a matrix (each column is a different partition of the signal);

data = rand(60000,1); % replace with your data

y = [];

for i = 1:120

y(:,i) = data((i-1)*500+1:(i)*500);;

end

% perform the fft as;

L = 500;

Y = fft(y);

P2 = abs(Y/L);

P1 = P2(1:L/2+1,:);

P1(2:end-1,:) = 2*P1(2:end-1,:);

% obtain frequency matrix;

Fs = 1e3; % sampling frequency

f = Fs*(0:(L/2))/L;

% plot frequency domain

figure(1)

semilogy(f,P1)

% plot time domain

figure(2)

plot([1:L]/Fs,y)

Make sure you understand what is done in each step and if you have questions, feel free to ask.

Aquatris
on 16 Sep 2018

Opportunities for recent engineering grads.

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

Start Hunting!
## 2 Comments

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/418709-plotting-fft-of-several-data-sets-signals-of-same-length-in-the-same-graph#comment_609507

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/418709-plotting-fft-of-several-data-sets-signals-of-same-length-in-the-same-graph#comment_609507

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/418709-plotting-fft-of-several-data-sets-signals-of-same-length-in-the-same-graph#comment_609515

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/418709-plotting-fft-of-several-data-sets-signals-of-same-length-in-the-same-graph#comment_609515

Sign in to comment.