MATLAB Experiment 10

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

MATLAB EXPERIMENT-10

-PRASHANT MEHLAWAT
16BCE0910

Write the MATLAB program to verify the Stroke’s Theorem for vector field and visualize it.

Choose at least 2 Example by your choice and visualize it.

1. Verify stokes' Theorem. Let S to be the portion of the hyperbolic paraboloid


that is contained in the cylinder , oriented by the upward normal
n, F=zi+xj+yk .

ANS.

CODE-
clc
clearvars
syms x y z r t
F=[z x y];

S=[r*cos(t) r*sin(t) r^2*cos(t)*sin(t)]


R=subs(S,r,2)

Ft=subs(F,[x,y,z],R);
drt=diff(R,t);
Fdr=dot(Ft,drt);
LHS=int(Fdr,t,0,2*pi)

curlF=curl(F,[x,y,z])
ndS=simplify(cross(diff(S,r),diff(S,t)))
RHS=int(int(dot(curlF,ndS),r,0,2),t,0,2*pi)
SCREENSHOT-
2. Verify stokes' Theorem for F=(2x-y)i-yz2 j+y2z k where S is the upper half surface
of the surface of the sphere x2+y2+z2=1 and C is its boundary.

ANS.

CODE-
clc
clearvars
syms x y z r t
F=[2*x-y y*z*z -y^2*z]

S=[r*cos(t) r*sin(t) r^2*cos(t)*sin(t)]


R=subs(S,r,1)

Ft=subs(F,[x,y,z],R);
drt=diff(R,t);
Fdr=dot(Ft,drt);
LHS=int(Fdr,t,0,2*pi)

curlF=curl(F,[x,y,z])
ndS=simplify(cross(diff(S,r),diff(S,t)))
RHS=int(int(dot(curlF,ndS),r,0,1),t,0,2*pi)
SCREENSHOT-

You might also like