Plotting a sequence using stem()

2 ビュー (過去 30 日間)
Bruno Silva
Bruno Silva 2017 年 10 月 5 日
回答済み: Star Strider 2017 年 10 月 5 日
How can one plot this sequence using the command stem? I have tried a lot of combinations of this, but I guess I don't quite grasp the concept of computing elementwise:
My code (which doesn't work):
x = linspace(1,50,50) % I'm computing the first 50 terms
y = sqrt((3+2*x.^2)/(8*x.^2+x))
stem(y)
Thank you.

採用された回答

Star Strider
Star Strider 2017 年 10 月 5 日
You need to vectorise the division as well:
y = sqrt((3+2*x.^2)./(8*x.^2+x));
and ideally plot both your independent and dependent variables:
stem(x, y)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetworks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by