How to plot the graph of Greatest Integer Function ?

조회 수: 11 (최근 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 CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by