How to plot digital sequence in MATLAB

I have to plot following digital sequence in MATLAB: a^n * u[n]. a is just a constant. How do I do this?
Thanks

 採用された回答

David Hill
David Hill 2022 年 5 月 24 日

0 投票

n=1:length(u);
a=1.7;
plot(n,a.^n.*u);%assuming u is a vector

3 件のコメント

Tommy P
Tommy P 2022 年 5 月 24 日
Is it possible to show this as a discrete spectrum? instead of a line, more someting like this as lay-out?
Allen
Allen 2022 年 5 月 24 日
You can also plot this using a bar plot vs. a line plot.
bar(n,a.^n.*u)
Walter Roberson
Walter Roberson 2022 年 5 月 25 日
stem()
Note: u[n] is not a vector as such: it indicates the unit step function.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 5 月 24 日

0 投票

If you are certain that all of your values are finite, then you can replace u[n] by (n>=0)
If you have negative infinite values then it is not obvious that multiplying by the unit step function is well defined.

カテゴリ

製品

リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by