Hello I have 2 vectors:
A which is 1x32000
B which is 1x2000
I need to plot them with a different step so they match, in other words i need for B to plot a value once for every 16 values of A.
Whenever I do:
hold on
plot (s)
stem (fn)
hold off
One would basically end after 2000 steps and the other one after 32000 however I would like for both of them to end at 32000 is there a way to do so?

 採用された回答

Walter Roberson
Walter Roberson 2018 年 12 月 20 日

2 投票

t32 = linspace(0,2,32000+1); t32(end) = []; %remove time 2 exactly
t8 = linspace(0,2,800+1); t8(end) = []; %remove time 2 exactly
s = sin(t32*pi*50); %one signal
fn = sin(t8*pi*23) + cos(t8*pi*17); %another signal
plot(t32, s);
hold on
stem(t8, fn);
hold off

1 件のコメント

Jan Vaculik
Jan Vaculik 2018 年 12 月 21 日
Thank you, exactly what I needed.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by