Sie sind auf Seite 1von 5

>> clear

%drawing 3-d graphs and surfaces


>> [X Y]=meshgrid(-4:0.5:4,-1:0.1:1); an attempt to 3-d
>> mesh(sin(X).*cos(Y))
>>

0.5

-0.5

-1
30
100

20

80
60

10

40
20
0

With this change


>> mesh(sin(X+Y).*cos(X-Y))
>>

0.5

-0.5

-1
30
100

20

80
60

10

40
0

>> x=-0.5:0.005:0.5;
>> y=x;
>> [X Y]=meshgrid(x,y);
>> mesh(X.^2+Y.^2)
>>

20
0

0.5
0.4
0.3
0.2
0.1
0
300
250

200

200
150

100

100
0

>> mesh(X.^2-Y.^2)
>>

50
0

0.4

0.2

-0.2

-0.4
300
250

200

200
150

100

100
0

>> x=-3:0.25:3;
>> y=-3:0.25:3;
>> [X Y] =meshgrid(x,y);
>> Z=X.*exp(-X.^2+-Y.^2);
>> s1=surf(X,Y,Z);
>>

50
0

0.5

-0.5
4
2

4
2

-2

-2
-4

-4

Das könnte Ihnen auch gefallen