Question: Matlab code: I have two vectors like X=[ 0 1 2 3]; y=[ 0 1 2 3]; [X,Y]=meshgrid(x,y); Z=[ -1 2 3 4, -4 5

Matlab code:

I have two vectors like

X=[ 0 1 2 3];

y=[ 0 1 2 3];

[X,Y]=meshgrid(x,y);

Z=[ -1 2 3 4, -4 5 6 7; 4 -5 -6 3; 1 2 -3 4];

surf(X,Y,Z);

view(2);

I would like to plot the positive values of Z using red points and negative values of Z using blue points.

maybe we can add in the code If Z>0 we plot the point using red color and if Z<0 we plot the point using blue color But how Can I code these previous lines, so that I get in my figure xaxis = X y axis =Y and some blue and red points only in my figure at position defined by (X(i),Y(j))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!