MATLAB: How to plot sin(x) for sin(x)>0, and 0 for sin(x)<=0

plot

Hello. I tried to use if statements but nothing worked.. Any piece of advice of how I should approach it? Thank you

Best Answer

syms y(x)
y=piecewise(sin(x)>0,sin(x),sin(x)<=0,0)
fplot(y,[-3*pi 3*pi])