How do I make a stem plot in MATLAB?

How do I make an input sequence named n with a step of 1, ranging from -10 to 10?
Once I do that, how then do I make a stem plot of a function of n.
Then how to label both the x and y axes and add titles?

 採用された回答

Paulo Silva
Paulo Silva 2011 年 2 月 18 日

2 投票

n=-10:10;
a=0*n;
a(n>=0)=1;
stem(a)
xlabel('this is the x label')
ylabel('this is the y label')
title('this is the title')

その他の回答 (1 件)

RAMA ARAVINTH
RAMA ARAVINTH 2021 年 6 月 24 日

1 投票

n=-10:10;
a=0*n;
a(n>=0)=1;
stem(a)
xlabel('this is the x label')
ylabel('this is the y label')
title('this is the title')

カテゴリ

ヘルプ センター および File ExchangeLabels and Annotations についてさらに検索

タグ

質問済み:

2011 年 2 月 18 日

回答済み:

2021 年 6 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by