gradient & mathematical modeling and simulation using matlab prof. muhammad saeed

8
Gradient & 2 hematical Modeling and Simulati Using MATLAB Prof. Muhammad Saeed

Upload: rebecca-kirk

Post on 27-Mar-2015

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

Gradient & 2

Mathematical Modeling and Simulation Using

MATLAB

Prof. Muhammad Saeed

Page 2: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

Gradient I:x =-2:0.2:2;y = x .* exp(-x.^2);px = gradient(y,.2);quiver(x,px)

-5 0 5 10 15 20 250

0.5

1

1.5

2

2.5

3

Page 3: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

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

Page 4: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

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

Page 5: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

:2

[x,y] = meshgrid(-4:4,-3:3);u = x.*x+y.*y;

v = 4*del2(u)

V =4 4 4 4 4 4 4 4 44 4 4 4 4 4 4 4 44 4 4 4 4 4 4 4 44 4 4 4 4 4 4 4 44 4 4 4 4 4 4 4 44 4 4 4 4 4 4 4 44 4 4 4 4 4 4 4 4

Page 6: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

:2

,6

1

6 2

2

2

2

2

22

z

u

y

u

x

uul

[x,y,z] = meshgrid(-3:3,-3:3,-3:3);u = x.*x + y.*y + z.*z;v = 6*del2(u)

222 zyxu

Page 7: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

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(:,:,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(:,:,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(:,:,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

Page 8: Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed

End