# wrong code at matlab - meshgrid and 3d plot

• Jun 29th 2009, 12:53 AM
winterelf
wrong code at matlab - meshgrid and 3d plot
hi all ,
got a problem with my code and i'm using matlab.

T0=11;
x =-60:.1:60;
y=-60:.1:60;

[X,Y]=meshgrid(x,y);
S=(X)+(Y.*j);
H=(T0./(S.^2))*(exp(S./T0)+exp(-S./T0)-2);
surf (X, Y , abs(H));

the problam is that it gives me a graph that is black! no colors... and i know that the default is random colors but i get only black from some reason.
the other problem is that i suppose to write y=-100:0.1:100; and not -60:0.1:60; but it will not work if i try value 100. i have no idea how to fix it
• Jun 29th 2009, 08:59 PM
CaptainBlack
Quote:

Originally Posted by winterelf
hi all ,
got a problem with my code and i'm using matlab.

T0=11;
x =-60:.1:60;
y=-60:.1:60;

[X,Y]=meshgrid(x,y);
S=(X)+(Y.*j);
H=(T0./(S.^2))*(exp(S./T0)+exp(-S./T0)-2);
surf (X, Y , abs(H));

the problam is that it gives me a graph that is black! no colors... and i know that the default is random colors but i get only black from some reason.
the other problem is that i suppose to write y=-100:0.1:100; and not -60:0.1:60; but it will not work if i try value 100. i have no idea how to fix it

Try it with a much sparser grid.

CB
• Jun 30th 2009, 12:17 AM
winterelf
thanks, i found the prolem :)