displacing iterations of a signal
1 次查看(过去 30 天)
显示 更早的评论
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.
回答(2 个)
Star Strider
2020-7-3
编辑:Star Strider
2020-7-3
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 个评论
Image Analyst
2020-7-3
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!