displacing iterations of a signal
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
What do I add to the code after plot(stim) so that each iteration is displaced from one anohter on the x axis? Each iteration of the signal is represented with a different color on the plot.
Antworten (2)
Star Strider
am 3 Jul. 2020
Bearbeitet: Star Strider
am 3 Jul. 2020
I am not certain what you want to do. If you want the different waveforms to appear consecutively, plot them against an independent variable vector and then offset that vector.
Try simething like this:
t = linspace(0, 100, 101);
y1 = sin(2*pi*t*5/max(t));
y2 = cos(2*pi*t*10/max(t));
figure
subplot(3,1,1)
plot(y1) % Plot Together Without Indepdent Variable
hold on
plot(y2)
hold off
title('Plot Together Without Indepdent Variable')
subplot(3,1,2)
plot(t, y1) % Plot Together With Indepdent Variable
hold on
plot(t,y2)
hold off
title('Plot Together With Indepdent Variable')
subplot(3,1,3)
plot(t, y1) % Plot Consecutively With Indepdent Variable
hold on
plot(t+t(end), y2)
hold off
title('Plot Consecutively With Indepdent Variable')
EDIT — (3 Jul 2020 at 19:57)
Added plot image —
.
0 Kommentare
Image Analyst
am 3 Jul. 2020
In your loop, you can just create an x that gets shifted on each iteration
stim = ......
x = 5000 * i + (1 : length(stim)); % Shifts over by 5000 for each i
plot(x, stim)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!