I want to simply plot a function with two different styles before and after a specific value. For example, for -2*pi<= x <0 with line width of 1 and for 0<= x <=2*pi with line width 2. I have written
for x=-2*pi:0.1:2*pi
y = sin(x);
if x < 0
plot(x,y,'LineWidth',1)
grid on
hold
else
plot(x,y,'LineWidth',2)
grid on
hold
end
end
But it doesn't work