How to plot digital sequence in MATLAB
2 次查看(过去 30 天)
显示 更早的评论
I have to plot following digital sequence in MATLAB: a^n * u[n]. a is just a constant. How do I do this?
Thanks
0 个评论
采纳的回答
David Hill
2022-5-24
n=1:length(u);
a=1.7;
plot(n,a.^n.*u);%assuming u is a vector
3 个评论
Allen
2022-5-24
You can also plot this using a bar plot vs. a line plot.
bar(n,a.^n.*u)
Walter Roberson
2022-5-25
stem()
Note: u[n] is not a vector as such: it indicates the unit step function.
更多回答(1 个)
Walter Roberson
2022-5-24
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!