displacing iterations of a signal

1 回表示 (過去 30 日間)
Alexis Thompson
Alexis Thompson 2020 年 7 月 2 日
編集済み: Star Strider 2020 年 7 月 3 日
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.
  1 件のコメント
dpb
dpb 2020 年 7 月 2 日
Consider waterfall

サインインしてコメントする。

回答 (2 件)

Star Strider
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 —
.

Image Analyst
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)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by