How to plot the graph of Greatest Integer Function ?

5 ビュー (過去 30 日間)
Vipul Sharma
Vipul Sharma 2016 年 6 月 8 日
回答済み: Sumit 2023 年 10 月 10 日
I was trying to plot greatest integer function by using floor command and stem (to show discontinuity) but what i am getting is,please help me out!!!
I used the code
x=linspace(1,10,10) y=floor(x); stem(x,y)
  2 件のコメント
Jos (10584)
Jos (10584) 2016 年 6 月 8 日
What did you expect to see?
Eric Strobel
Eric Strobel 2021 年 1 月 17 日
This is close, I got this using the code below:
Dots are right, lines are going wrong way.
Code:
syms y
>> y=floor(x); x=linspace(1,10,10); stem(x,y)

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

回答 (4 件)

Jos (10584)
Jos (10584) 2016 年 6 月 8 日
x=linspace(1,10,10)
y=floor(x) % ARE THESE VALUES AS EXPECTED??
stairs(x,y) % rather than stem
  1 件のコメント
Vipul Sharma
Vipul Sharma 2016 年 6 月 8 日
Sorry brother,but this is showing a continuous graph whereas the greatest integer function is a discontinuous function,sorry but this plot is wrong

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


Vipul Sharma
Vipul Sharma 2016 年 6 月 8 日
Sorry brother,but this is showing a continuous graph whereas the greatest integer function is a discontinuous function,sorry but this plot is wrong

Vipul Sharma
Vipul Sharma 2016 年 6 月 8 日

Sumit
Sumit 2023 年 10 月 10 日
x=1:0.001:10;
y=floor(x);
plot(x,y,'.');

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by