Gradient
This presentation is the property of its rightful owner.
Sponsored Links
1 / 8

Gradient & PowerPoint PPT Presentation


  • 159 Views
  • Uploaded on
  • Presentation posted in: General

Mathematical Modeling and Simulation Using MATLAB. Gradient &. Prof. Muhammad Saeed. Gradient I: x =-2:0.2:2; y = x .* exp(-x.^2); px = gradient(y,.2); quiver(x,px). Gradient II: [x,y] = meshgrid(-2:0.2:2); z = x .* exp(-x.^2 - y.^2); [px,py] = gradient(z,.2,.2);

Download Presentation

Gradient &

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Gradient

Mathematical Modeling and Simulation

Using

MATLAB

Gradient&

Prof. Muhammad Saeed


Gradient

  • Gradient I:

    • x =-2:0.2:2;

    • y = x .* exp(-x.^2);

    • px = gradient(y,.2);

    • quiver(x,px)


Gradient

  • Gradient II:

    • [x,y] = meshgrid(-2:0.2:2);

    • z = x .* exp(-x.^2 - y.^2);

    • [px,py] = gradient(z,.2,.2);

    • contour(x,y,z), hold on, quiver(x,y,px,py), hold off


Gradient

  • Gradient II:

    • [x,y] = meshgrid(-2:0.2:2);

    • u = x .* exp(-x.^2 - y.^2);

    • [gx,gy] = gradient(u,.2,.2);

    • contour(x,y,u), hold on, quiver(x,y,gx,gy), hold off


Gradient

[x,y] = meshgrid(-4:4,-3:3);

u = x.*x+y.*y;

V =

4 4 4 4 4 4 4 4 4

4 4 4 4 4 4 4 4 4

4 4 4 4 4 4 4 4 4

4 4 4 4 4 4 4 4 4

4 4 4 4 4 4 4 4 4

4 4 4 4 4 4 4 4 4

4 4 4 4 4 4 4 4 4

v = 4*del2(u)


Gradient

[x,y,z] = meshgrid(-3:3,-3:3,-3:3);

u = x.*x + y.*y + z.*z;

v = 6*del2(u)


Gradient

v(:,:,1) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

v(:,:,2) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

v(:,:,5) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

v(:,:,6) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

v(:,:,3) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

v(:,:,4) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

v(:,:,7) =

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6

6 6 6 6 6 6 6


Gradient

End


  • Login