0% found this document useful (0 votes)
2 views39 pages

Calculus For Engineers Lab Report

This lab report outlines assignments and MATLAB exercises for a Calculus for Engineers course, including topics such as plotting curves, Lagrange multipliers, derivatives, and solid problems. It provides specific MATLAB code snippets for calculating areas between curves, finding maxima and minima, solving differential equations, and visualizing solid regions. The report also includes assignment dates and a structured approach to various mathematical concepts relevant to engineering.

Uploaded by

tarlanavikas12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views39 pages

Calculus For Engineers Lab Report

This lab report outlines assignments and MATLAB exercises for a Calculus for Engineers course, including topics such as plotting curves, Lagrange multipliers, derivatives, and solid problems. It provides specific MATLAB code snippets for calculating areas between curves, finding maxima and minima, solving differential equations, and visualizing solid regions. The report also includes assignment dates and a structured approach to various mathematical concepts relevant to engineering.

Uploaded by

tarlanavikas12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 39

LAB REPORT(MANUAL)

MAT1001: CALCULUS FOR ENGINEERS LAB


ASSIGNMENT (Table of Content)
Sr No. Contents Date
1 MATLAB ONRAMP CERTIFICATE 11th Oct 2023
2 PLOTTING(CARDIOID) 25th Oct 2023
3 LAGRANGE MULTIPLIER 08th Nov 2023
4 DERIVATIVES 29th Nov 2023
5 VIEW SOLID PROBLEMS 20th Dec 2023
6 LINE INTEGRAL 10th Jan 2024

1
2.PLOTTING
CARDIOD

2
%find the area of the region bounded below by the line %y =
x^2+3*x and above by the curve y=2x-x^2 + 1 clc clear all syms x y
plot_range=[-1,1]

plot_range = 1×2
-1 1

f1 = x^2+3*x

f1 =

y = 2*x - x^2 + 1, f2 = y

y
=
f2 =

range=[-2,0]
range = 1×2
-2 0

ezplot(f1)
hold on
ezplot(f2)
r1 = sort(double(solve(f1-f2)))
r1 = 2×1
-1.0000
0.5000

area=int(f1-f2,r1(1),r1(2))
area =

range = (r1(1):0.1:r1(2))

range = 1×16
-1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000

a = subs(f1,range)
a =

b = subs(f2, range)

b =

3
1

ezplot(f1)
hold on
ezplot(f2)
fplot(f1, [-3,3], 'r', 'LineWidth',1.5)
fplot(f2, [-3,3], 'b', 'LineWidth',1.5)
fill([range, fliplr(range)],[a, fliplr(b)], [0,1,0],
'LineStyle','none') xlabel('x') ylabel('y')
title('area by curves')
legend('shaded area', 'y = x^2+3*x', 'y=2x-x^2 +
1') hold on

%find the area of the region bounded below by the


line
%y = x^2+6 and above by the curve y = x^2 - 2*x +
2
%with the range [-
3,3] clc clear all
syms x y range=[-
3,3]
range = 1×2
-3 3

f1 = -x^2+6

4
f1 =

y = x^2 - 2*x + 2, f2 = y

y
=
f2 =

r1 = sort(double(solve(f1-f2)))
r1 = 2×1
-1
2

area= nt(f1-f2,r1(1),r1(2))
i
area =

range = (r1(1):0.1:r1(2))
range = 1×31
-1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000

a = subs(f1,range)
a =

b = subs(f2, range)

b =

ezplot(f1)
hold on
ezplot(f2)
fplot(f1,[-3,3], 'b', 'LineWidth'
,1.5)
fplot(f2,[-3,3], 'r', 'LineWidth'
,1.5)

xlabel('x')
ylabel('y')
title('area by curves')
legend('shaded area', 'y = x^2+3*x', 'y=2x-x^2 + 1')

fill([range,fliplr(range)],[a,fliplr(b)],[1,0,1], 'LineStyle'
,'none')
hold on

5
%find the area enclosed by the leminiscale r^2 = 4 cos
2*theta clc clear all syms r theta
r = 2*sqrt(cos(2*theta))

r =

ezpolar(r,[0,2*pi])
Warning: Imaginary parts of complex X and/or Y arguments ignored

title('lemini scale')

6
1

%find the area enclosed by cardiod r = a(1+cos(theta)) clc clear


all syms r theta a = 5

a = 5

r = a*(1+cos(theta))

r =

ezpolar(r,[0,2*pi])
title('cardiod')fill(r.*)

7
Error using fill
Not enough input arguments.

8
3. LAGRANGE
MULTIPLIER
METHOD

9
1.
%Write a programme to find maximum and minimum between 2 numbers
clc clear all syms a b
a=input('enter 1st value')

a =3

b=input('enter 2nd value')

b =5

minimum=min(a,b)

minimum = 3

maximum=max(a,b)

maximum = 5

x=minimum + " is less than " + maximum

x = "3 is less than 5"

disp(x)

3 is less than 5

2.(a)
THREE VARIABLES MAX
%fprintf('%d is biggest number ',a)
clc clear all syms a b
a=input('enter 1st value')

a =4

b=input('enter 2nd value')

b =5

c=input('enter 3rd value')

c =6

minimum=min(min(a,b),c)
minimum = 4

maximum=max(max(a,b),c)

maximum = 6

fprintf('%d is smallest number',minimum)

4 is smallest number

2.(b) THREE VARIABLES


MINIMUM clc clear all syms a b
a=input('enter 1st value')
a =4

b=input('enter 2nd value')

b =5

c=input('enter 3rd value')

c =6

if a>b && a>c fprintf('%d is largest number of %d, %d and %d',a,b,c)


elseif b>a && b>c fprintf('%d is largest number of %d, %d and %d',b,a,c)
elseif c>b && c>a fprintf('%d is largest number of %d, %d and %d',c,a,b)
end

6 is largest number of 4 and 5

if a<b && a<c


fprintf('%d is smallest number of %d, %d and %d',a,b,c) elseif b<a && b<c
fprintf('%d is smallest number of %d, %d and %d',b,a,c) elseif c<b && c<a
fprintf('%d is smallest number of %d, %d and %d',c,a,b) end

4 is smallest number of 5 and 6

3.
%differentiation clc clear
all syms x y f=x^3
+3*x*y^2 - 3*x

f=

fx=diff(f,x)

fx =

fy=diff(f,y)
fy =

[xc,yc]=solve([fx,fy],[x,y])

xc =

yc =

fxx=diff(fx,x); fyy=diff(fy,y);
fxy=diff(fx,y); r=subs(fxx,{x,y},{xc,yc});
D=fxx*fyy-fxy^2;
D=subs(D,{x,y},{xc,yc}); c=1; for i=1:length(D) if D(i)>0 if r(i)>0
fprintf('(%f,%f) is a point of minima\n',xc(i),yc(i)); elseif r(i)<0
fprintf('(%f,%f) is a point of maxima\n',xc(i),yc(i)); end elseif D(i)<0
fprintf('At (%f,%f) is a saddle point\n',xc(i),yc(i)); ezsurf(f,[-1.5,1.5,-
1.5,1.5]); end end

(-1.000000,0.000000) is a point of maxima (1.000000,0.000000) is a point of


minima
At (0.000000,-1.000000) is a saddle point
At (0.000000,1.000000) is a saddle point
4.
%FIND THE MAXIMUM MINIMUM VALUE OF 2x+4y subject to the constraint
%x^2+y^2=4 and visualize the coordiante axis.
%Lagrange's method: g(x,y,z)=0 and gradient(f(x,y))=l*gradient(g(x,y)) clc clear close syms x
yl
f=input('enter the function of variable x and y:')

f =

g=input('enter the constraint of variable x and y:')

g =

F=f+l*g

F=

Fx=diff(F,x);
Fy=diff(F,y);
[l,u,v]=solve(Fx==0,Fy==0,g,[l,x,y])

l=

u =
v =

F_val=subs(F,{x,y},{u,v})

F_val =

[maxv, i]=max(F_val)

maxv = i=
2

[minv, j]=min(F_val)

minv = j=1

figure(1);fsurf(f); hold on f=subs(f,


{x,y},{u,v}); scatter3(u,v,f,'g*','filled');
5.
%A space probe in the shape of a sphere of radius one enters Earth
%atmosphere and its surface begins to heat. The temperature at the
%point(x,y,z) on the probes's surface is T(x,y,z)=400xyz^2. Find the
%hottest point on the probe's surface. clc clear all close syms x y z l
f=input("ENTER THE FUNCTION f OF VARIABLE x AND y AND z:")

f =

g=input("ENTER THE FUNCTION g OF VARIABLE x AND y AND z:")

g =

F=f+l*g

F=

Fx=diff(F,x);
Fy=diff(F,y);
Fz=diff(F,z);
[l,u,v,w]=solve(Fx==0,Fy==0,Fz==0,g,[l,x,y,z])

l=
u=

v=

w=
F_val=subs(F,{x,y,z},{u,v,w})

F_val =

[maxv i]=max(F_val)

maxv =
50 i = 5

[minv j]=min(F_val)

minv = j=6
4. DERIVATIVES
%derivative
%Solve the differential equation y’=x if y(0)=0
syms y(x)
ode=diff(y,x)==x
ode(x) =

con=y(0)==0

con =

ysol(x)=dsolve(ode,con)

ysol(x) =

%Solve the differential equation y'=ycos(x)-yx , if y(0)=1


syms y(x)
ode = diff(y,x)==y*cos(x)-y*x

ode(x) =

con=y(0)==1

con =

ysol(x)=dsolve(ode,con)

ysol(x) =

%Solve the differential equation


%y'=(2xy-sin(x)-3y2ex)/(6yex-x2), if y(0)=2
syms y(x)
ode=diff(y,x)==(2*x*y-sin(x)-3*y^2*exp(x))/(6*y*exp(x)-x^2)

ode(x) =

con=y(0)==2

con =

1
ysol(x)=dsolve(ode,con)
ysol(x) =

%Solve the differential equation


%y''-2y'-3y=0
syms y(x)
ode=diff(y,x,2)-2*diff(y,x,1)-3*y==0
ode(x) =

ysol(x)=dsolve(ode)
ysol(x) =

%A moving body is opposed by a force per unit mass of


%c*x and resistance per unit mass of value bv^2,where x
%and v are the displacement and velocity of the particle
%at that instant . Find the velocity of the particle in
%terms of the displacement , if it starts from the rest.

clc clear
all syms b
c v(x)
ode = v*diff(v,x) == -c*x - b*v^2
ode(x) =

con=v(0)==0

con =

vsol(x) = dsolve(ode,con)

vsol(x) =

2
%A resistance of 100 ohm, an inductor of 0.5
henry %are connected in series with a battery of
20V.
%find the current in the circuit at t=0.5 sec,if i=0
%at t=0

syms i(t)
R=100;L=0.5;V=20; ode =
L*diff(i,t)==(V-i*R)
ode(t) =

con=i(0)==0

con =

isol(t) = dsolve(ode,con)
isol(t) =

3
5. VIEW SOLID PROBLEMS

4
%Find the volume of the region D enclosed by the surfaces z=x^2 + 3y^2 and
%z= 8 - x^2 - y^2

clc clear all


syms x y z z1 =
x^2 + 3*y^2

z1 =

z2 = 8 - x^2 - y^2

z2 =

ry = solve(z1-z2,y)

ry =

ylim1 = ry(1)

ylim1 =

ylim2 = ry(2)

ylim2 =

rx = solve(ry(1),x)

rx =

xlim1 = rx(1)

xlim1 =

5
xlim2 = rx(2)

xlim2 =

volume =
vpaintegral(vpaintegral(vpaintegral(1,z,z1,z2),y,ylim1,ylim2),x,xlim1,xlim2)

volume =

viewSolid(z,z2,z1,y,ylim1,ylim2,x,xlim1,xlim2)

%Find the volum,centre of mass ,moment of inertia of region bounded by z=


4-x^2 - y^2 and
%z= x^2 + y^2 whose density is d = 1+x
clc close all
clear all syms
x y z z1 = x^2
+ y^2

z1 =

6
z2 = 4- x^2 - y^2

z2 =

d = 1 + x

d =

ry = solve(z1-z2,y)

ry =

ylim1 = ry(1)

ylim1 =

ylim2 = ry(2)

ylim2 =

rx = solve(ry(1),x)

rx =

xlim1 = rx(1)

xlim1 =

xlim2 = rx(2)

xlim2 =

volume =
vpaintegral(vpaintegral(vpaintegral(1,z,z1,z2),y,ylim1,ylim2),x,xlim2,xlim1)

volume =

mass =
vpaintegral(vpaintegral(vpaintegral(d,z,z1,z2),y,ylim1,ylim2),x,xlim1,xlim2)

mass =

7
viewSolid(z,z2,z1,y,ylim1,ylim2,x,xlim1,xlim2)

Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored


Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored Warning:
Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored Warning:
Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored
Warning: Imaginary parts of complex X, Y, and/or Z arguments ignored

8
9
6.LINE INTEGRALS

10
ind the line integral off (x,y,z) = 2xy +sqrt(z) over the helix r(t) = cos(t) +sin(t) +t , o<t<pi

clc clear
all syms x y
z t
F = 2*x*y + sqrt(z)

F =

T = [cos(t); sin(t); t]; DR1 = diff(T,t)

DR1 =

F1 = subs(F,[x,y,z,], [T(1), T(2), T(3)]);


DR2 = DR1.*DR1;
NF = sum(DR2); NF1 = sqrt(NF);
NF2 = F1*NF1

NF2 =

I = vpa(int(NF2,t,0,pi))

I =

%Plotting the helix


t = 0:pi/50:2*pi;
figure;
plot3(cos(t), sin(t), t)
grid on
axis square

11
Q2 Evaluate integral of CF.dr , where F(x,y,z) = z*i +xy j -y2 k along the curve C given by r(t) = t^2 i t j
sqrt(t) k , 0< t< 1
clc clear
all syms x y
z t
F = [z x*y -y^2]

F =

C = [t^2; t; sqrt(t)]

C =

DR1 = diff(C,t)

DR1 =

12
F1 = subs(F,[x,y,z,], [C(1), C(2), C(3)]);
DR2 = DR1.*DR1;
NF = sum(DR2); NF1 = sqrt(NF);
NF2 = F1*NF1

NF2 =

I = vpa(int(NF2,t,0,1))

I =

t = 0:1/100:1;
figure;
plot3(t.^2, t, sqrt(t))
grid on
axis square
hold on
p = inline(vectorize(F(1)),'x','y','z')
p =

Inline function:
p(x,y,z) = z

q = inline(vectorize(F(2)),'x','y','z')

q =

Inline function:
q(x,y,z) = x.*y

r = inline(vectorize(F(3)),'x','y','z')

r =

Inline function:
r(x,y,z) = -y.^2

x = linspace(0,2*pi,10);
y =x

y = 1×10
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869

13
z =x

z = 1×10
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869

[x,y,z] = meshgrid(x,y,z);
u = p(x,y,z);
v = q(x,y,z);
w = r(x,y,z);
quiver3(x,y,z,u,v,w,1.5)

Find the mass of a thin wire lying along the curve r(t) = sqrt(2t) + sqrt(2t) + (4-t^2) 0<t<1 , if the density
is 3t

clc clear
all syms x y
z t F = 3*t

F =

T = [sqrt(2).*t;sqrt(2).*t;(4-t^2)]

T =

14
DR1 = diff(T,t)

DR1 =

F1 = subs(F,[x,y,z],[T(1),T(2),T(3)])

F1 =

DR2 = DR1.*DR1

DR2 =

NF = sum(DR2)

NF =

NF1 = sqrt(NF)

NF1 =

NF2 = F1.*NF1

NF2 =

I= vpa(int(NF2,t,0,1))

I =

t = 0:1/50:1

t = 1×51
0 0.0200 0.0400 0.0600 0.0800 0.1000 0.1200 0.1400

15
figure plot3(sqrt(2).*t,sqrt(2).*t,(4-t.^2))
grid on
axis square

FInd the circulation of the field F = (x-y)i+xj around the circle r(t) = cos(t)i +sin(t) j , 0<t<1
clc clear
all syms x
y t
F = [(x-y) x]

F =

C = [cos(t) sin(t)]

C =

DR1 = diff(C,t)

DR1 =

F1 = subs(F,[x,y,],[C(1),C(2)]);
DR2 = DR1.*DR1

DR2 =

16
NF = sum(DR2);
NF1 = sqrt(NF);
NF2 = F1*NF1;
I = vpa(int(NF2,t,0,1))

I =

t = 0:1/100:2*pi

t = 1×629
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700

figure
plot(cos(t),sin(t))
grid on
axis square
hold on
p = inline(vectorize(F(1)),'x','y')
p =

Inline function:
p(x,y) = x - y

q = inline(vectorize(F(2)),'x','y')

q =

Inline function:
q(x,y) = x

x = linspace(0,2*pi,10)

x = 1×10
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869

y =x

y = 1×10
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869

[x,y] = meshgrid(x,y);
u = p(x,y); v =
q(x,y);
quiver(x,y,u,v)

17
find the flux of F = (x-y)i+xj across the circle x2 + y2 = 1 in the xy plane
clc clear
all syms x
y t
F = [(x-y) x]

F =

C = [x^2 y^2]

C =

DR1 = diff(C,t)

DR1 =

F1 = subs(F,[x,y,],[C(1),C(2)]);
DR2 = DR1.*DR1

DR2 =

NF = sum(DR2); NF1 = sqrt(NF); NF2 = F1*NF1;


I = vpa(int(NF2,t,0,1))

18
I =

t = 0:1/100:2*pi

t = 1×629
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700

figure
plot(cos(t),sin(t))
grid on
axis square
hold on
p = inline(vectorize(F(1)),'x','y')
p =

Inline function:
p(x,y) = x - y

q = inline(vectorize(F(2)),'x','y')

q =

Inline function:
q(x,y) = x

x = linspace(0,2*pi,10)

x = 1×10
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869

y =x

y = 1×10
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869

[x,y] = meshgrid(x,y);
u = p(x,y); v =
q(x,y);
quiver(x,y,u,v)

19
20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy