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!