MATLAB: Hello, have to plot an ineqality and when the solution of the inequality is true matlab has to plot the line at -0.6 instead of 1. what function or code is used in this situation

inequalityplot

x=-1:0.1:2;
y1=0.5+((x.*exp(-0.4.*(x.^2))).*sin(x.*2));
plot(x,y1,'-b');
hold on
x=-3:0.1:0;
y2=10.*cos(-x+pi./2).*sinh((0.4).*x)./[(x+5).*(x-1)];
plot(x,y2,':r')
x=-3:0.1:2;
y3=(0.1*x.^2)+0.2.*x+1;
plot(x,y3,'--g');
h=(0.5+((x.*exp(-0.4.*(x.^2))).*sin(x.*2)))>((0.1*x.^2)+0.2.*x+1);
plot(x,h)
legend('0.5+((x.*exp(-0.4.*(x.^2))).*sin(x.*2))','10.*cos(-x+pi./2).*sinh((0.4).*x)./[(x+5).*(x-1)]','(0.1*x.^2)+0.2.*x+1');
title('plot of various f(x)');
xlabel('x values');
ylabel('f(x)')
this is the code. if you run it, when h is true the value given is 1 i would like it to be -0.6

Best Answer

Add
h=-0.6*h
plot(x,h)