Hello. I have what I believe is a very simple problem, that I just can't wrap my head around.
I want to plot a sine-curve and a square plot that changes between 0 and 1 as the sinus curve goes between positive and negative value. Here is my code:
x=[0:0.1:3*pi];y=sin(x);T = zeros(1,length(x));for i=1:length(x) if(sin(i) > 0) T(i) = 1; else T(i) = -1; endendplot(x, y, x, T, 'r');
Best Answer