matlab3

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 20 40 60 80 100 0 10 20 30 -1 -0.5 0 0.5 1  With this change >> mesh(sin(X+Y).*cos(X-Y)) >>

Upload: tanzid-sultan

Post on 05-Oct-2015

214 views

Category:

Documents


0 download

DESCRIPTION

Matlab Tutorial 3

TRANSCRIPT

  • >> 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)) >>

    020

    4060

    80100

    0

    10

    20

    30-1

    -0.5

    0

    0.5

    1

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

  • 020

    4060

    80100

    0

    10

    20

    30-1

    -0.5

    0

    0.5

    1

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

  • 050

    100150

    200250

    0

    100

    200

    3000

    0.1

    0.2

    0.3

    0.4

    0.5

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

  • 050

    100150

    200250

    0

    100

    200

    300-0.4

    -0.2

    0

    0.2

    0.4

    >> 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); >>

  • -4-2

    02

    4

    -4

    -2

    0

    2

    4-0.5

    0

    0.5