MATLAB Answers

How can I make the wave in the negative part disappear?

1 view (last 30 days)
Ans Flew
Ans Flew on 2 Mar 2020
Commented: Ans Flew on 3 Mar 2020
t= linspace(0,6,100);
y=sin(pi*t);
plot(t,y)

  1 Comment

Ans Flew
Ans Flew on 3 Mar 2020
I want it to be from 0 to 6 and the number of digits 100 and not 5000

Sign in to comment.

Accepted Answer

Stephan
Stephan on 2 Mar 2020
Edited: Stephan on 2 Mar 2020
More resolution for the values + logical indexing:
t= linspace(0,6,5000);
y=sin(pi*t);
plot(t(y>=0),y(y>=0))

  0 Comments

Sign in to comment.

More Answers (0)