MATLAB: How to plot the region for two inequalities graphplot I'm looking to plot the two inequalities for the formula: abs(x+y+x.^2<3) and abs(y+x+y.^2<3) with them both being on the same plot. How would I go about doing this please? Or any other similar example is fine. Thanks in advance Best Answer Here's how to numerically evaluate the conditions and visualize them.v = -5:0.01:5; % plotting range from -5 to 5[x y] = meshgrid(v); % get 2-D mesh for x and ycond1 = x+y+x.^2 < 3; % check conditions for these valuescond2 = y+x+y.^2 < 3;cond1 = double(cond1); % convert to double for plottingcond2 = double(cond2);cond1(cond1 == 0) = NaN; % set the 0s to NaN so they are not plottedcond2(cond2 == 0) = NaN;cond = cond1.*cond2; % multiply the two condaces to keep only the common pointssurf(x,y,cond)view(0,90) % change to top view Related SolutionsMATLAB: How to plot a sym function with constant function such as x=2(vertical line) & y=3(horizontal line) syms x yeqn=yeqn1=xfplot(subs(eqn,y,3))hold onfplot(subs(eqn1,x,2)) MATLAB: How can i plot the line in different colours Just plot three different lines and give them each a colour rather than plotting them in a single instruction. You can also put the numbers into the vector without requiring a for loop too e.g.cond1 = x < -1;cond2 = x >= -1 & x <= 2;cond3 = x > 2;y( cond1 ) = x( cond1 ) + 2;y( cond2 ) = x( cond2 ).^2;y( cond3 ) = -2 * x( cond3 ) + 8;figure;plot( x( cond1 ), y( cond1 ), 'r' )hold onplot( x( cond2 ), y( cond2 ), 'g' )plot( x( cond3 ), y( cond3 ), 'b' ) Related QuestionI have a system of 3 linear equations with 2 variables. I can solve it by substitution but not with linsolve.How to write an if statement that returns which of the conditions is metHow to assign ‘null values’ to certain ranges of an equation based on a criteriaUsing ‘fsolve’Correlation between two row matrices
Best Answer