You are on page 1of 12

Practical-1

WAP to perform conversion of coordinate system.


A) Cartesian to cylindrical and vice versa
B) cylindrical to sphrical and vice versa
C) Spherical to Cartesian and vice versa

Practical-2
Design MATLAB programs to calculate electric field intensity due to
line, surface and volume charge density

Practical-3
Design MATLAB programs to calculate electric flux density due to line,
surface and volume charge density

Practical-5
Aim:- A) Calculate the 2-D gradient of e(-x2-y2) on a grid.
B) Calculate the 2-D gradient of e(-x2-y2) on a grid.
Clc;
Clear all;
Close all;
v = -2:0.2:2;
[x,y] = meshgrid(v);
z = x .* exp(-x.^2 - y.^2);
[px,py] = gradient(z,.2,.2);
contour(v,v,z)
hold on
quiver(v,v,px,py)
hold off

Conclusion:-

Practical-6
Aim:-Design MATLAB programs for divergence operation.
A)Divergence of vector volume data as slice planes, using color to
indicate divergence.
B) Find the divergence of the vector field V(x,y,z) = (x, 2y2, 3z3) with
respect to vector X = (x,y,z) in Cartesian coordinates
Explanation:divergence(V,X) returns the divergence of vector field V with respect to
the vector X in Cartesian coordinates. Vectors V and X must have the
same length.

div = divergence(X,Y,Z,U,V,W) computes the divergence of a 3-D


vector field having vector components U, V, W.
The arrays X, Y, and Z, which define the coordinates for the vector
components U, V, and W, must be monotonic, but do not need to be
uniformly spaced. X, Y, and Z must have the same number of elements.
div = divergence(U,V,W) assumes X, Y, and Z are determined by the
expression
[X Y Z] = meshgrid(1:n,1:m,1:p), where [m,n,p] = size(U).
div = divergence(X,Y,U,V) computes the divergence of a 2-D vector
field U, V.The arrays X and Y, which define the coordinates
for U and V, must be monotonic, but do not need to be uniformly
spaced. X and Y must have the same number of elements, as if produced
by meshgrid.

div = divergence(U,V) assumes X and Y are


expression.

A)
MATLAB Coding
Clc;
Clear all;
Close all;
load wind
div = divergence(x,y,z,u,v,w);
h = slice(x,y,z,div,[90 134],59,0);
colormap jet
shading interp
daspect([1 1 1])
axis tight
camlight
set([h(1),h(2)],'ambientstrength',.6)

determined

by

the

B)
Clc;
Clear all;
Close all;
syms x y z
divergence([x, 2*y^2, 3*z^3], [x, y, z])
ans =
9*z^2 + 4*y + 1
Conclusion:-

Practical-7
Aim:-Design MATLAB programs for curl operation
A)Compute the curl of this vector field with respect to
vector X = (x, y, z) in Cartesian coordinates:.
B) Compute the curl of the gradient of this scalar function. The curl
of the gradient of any scalar function is the vector of 0s:
C) Use colored slice planes to display the curl angular velocity at
specified locations in the vector field.

A)
Clc;
Clear all;
Close all;
syms x y z
curl([x^3*y^2*z, y^3*z^2*x, z^3*x^2*y], [x, y, z])
ans =
x^2*z^3 - 2*x*y^3*z
x^3*y^2 - 2*x*y*z^3
- 2*x^3*y*z + y^3*z^2
B)
syms x y z
f = x^2 + y^2 + z^2;
curl(gradient(f, [x, y, z]), [x, y, z])
ans =
0
0
0

c)
load wind
cav = curl(x,y,z,u,v,w);
h = slice(x,y,z,cav,[90 134],59,0);
shading interp
daspect([1 1 1]);
axis tight
colormap hot(16)
camlight
set([h(1),h(2)],'ambientstrength',.6)

Conclusion:-

You might also like