Académique Documents
Professionnel Documents
Culture Documents
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.
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:-