my plot won't show graph

1 view (last 30 days)
Shahadat Hossain
Shahadat Hossain on 23 Aug 2021
Commented: Adam Danz on 30 Aug 2021
t=12:0.01:12;
x=sin(t);
plot(t,x)

Accepted Answer

Adam Danz
Adam Danz on 23 Aug 2021
Edited: Adam Danz on 27 Aug 2021
That's because there's only 1 point and it takes >=2 points to form a line. By default, plot() does not show markers, only lines.
The reason there is only 1 point is because there is only 1 value in t:
t=12:0.01:12
t = 12
x=sin(t);
plot(t,x, 'o-')
  2 Comments
Shahadat Hossain
Shahadat Hossain on 28 Aug 2021
thanks a lot adam i am student currently studying signal system and trying to understand matlab
Adam Danz
Adam Danz on 30 Aug 2021
Happy to help.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!