# how do you plot fft of each sensor for both test

1 visualizzazione (ultimi 30 giorni)
zeshan chishti il 16 Nov 2020
Commentato: zeshan chishti il 25 Nov 2020
subplot(3,2,1);
x= t1 (:,1); % time in test 1
sin = t1 (:,2); % sensor 1 in test 1
plot (x,sin)
title('test 1 sensor 1 against time')
xlabel('time')
ylabel('Sesnor1')
subplot(3,2,3);
x1= t1 (:,1);
sin1 = t1 (:,3);
plot (x1,sin1)
title('test 1 sensor 2 against time')
xlabel('time')
ylabel('Sesnor2')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(3,2,2);
x2= t2 (:,1);
sin2 = t2 (:,2);
plot (x2,sin2)
title('test 2 sensor 1 against time')
xlabel('time')
ylabel('Sesnor1')
subplot(3,2,4);
x3= t2 (:,1);
sin3 = t2 (:,3);
plot (x3,sin3)
title('test 2 sensor 2 against time')
xlabel('time')
ylabel('Sesnor2')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Hrishikesh Borate il 17 Nov 2020
Hi,
I understand that you want to calculate and plot FFT for each sensor for both the tests. According to the code shared, these values are stored in variables: sin, sin1, sin2, sin3.
You can use the fft function for the same.
##### 2 CommentiMostra NessunoNascondi Nessuno
zeshan chishti il 17 Nov 2020
so take fft of sin1 and so on? i.e
y= fft (sin1);
Hrishikesh Borate il 18 Nov 2020
Yes, correct.

Accedi per commentare.

### Più risposte (1)

Peter Perkins il 19 Nov 2020
Zeshan, you have all your data in a numeric array, t1. I strongly recommend that you convert that to a timetable. Then your plot is simple. I don't know what units your times are in, but something like
tt = array2timetable(t1(:,2:end),'RowTimes',seconds(t1(:,1));
stackedplot(tt)
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
zeshan chishti il 25 Nov 2020
thanks peter that helpped alot

Accedi per commentare.

### Categorie

Scopri di più su Time Series Events in Help Center e File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by