Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Matlab codes and maths notes for calculus, Assignments of Mathematics

It contains solved examples of matlab codes as well as maths textbook notes helpful for ug calculus

Typology: Assignments

2020/2021

Uploaded on 03/31/2021

Sweta_thanu
Sweta_thanu 🇮🇳

1 document

1 / 67

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name: T.Sweta
Reg No. : 20BEC1116
INDEX
S.No DATE LAB NO. TITLE
1 23.09.202
0
1 Introduction to MATLAB
through Matrices
2 30.09.202
0
2 Plotting and visualizing
general functions, rates of
change of functions/tangent
lines.
3 14.10.202
0
3 Application of derivatives
and extremum of a single
variable function
4 21.10.202
0
4 Definite Integrals and it’s
application
5 28.10.202
0
5 Laplace Transform and
Inverse Laplace Transform
6 11.11.202
0
6 Limits and continuity
7 18.11.202
0
7 Applications of partial
derivatives
8 02.11.202
0
8 Extreme values of function
9 16.12.202 9 Lagrange’s multiplier
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43

Partial preview of the text

Download Matlab codes and maths notes for calculus and more Assignments Mathematics in PDF only on Docsity!

Name: T.Sweta

Reg No. : 20BEC

INDEX

S.No DATE LAB NO. TITLE

1 Introduction to MATLAB

through Matrices

2 Plotting and visualizing

general functions, rates of

change of functions/tangent

lines.

3 Application of derivatives

and extremum of a single

variable function

4 Definite Integrals and it’s

application

5 Laplace Transform and

Inverse Laplace Transform

6 Limits and continuity

7 Applications of partial

derivatives

8 Extreme values of function

9 16.12.202 9 Lagrange’s multiplier

0 method

LAB NO. 01

TITLE:

Introduction to MATLAB through Matrices

MATLAB CODE:

% Matrix operations

clc

clear all

% create a row vector [or an array]

rv=[1 2 3 4 5]

% sum of elements of a vector

sv=sum(rv)

% Transpose of rv [column vector]

rvt=transpose(rv)

cv1=rv'

% create a column vector

cv2=[1;2;3;4;5]

% length and size of a vector

lrv=length(rv);

srv=size(rv);

% create a 2x2 matrix A

A=[1 2;3 4]

% length and size of a matrix

lrv=length(A);

srv=size(A);

% determinant of A

dA=det(A)

% inverse of A

E=inv(A)

x4=linspace(0,6,4)

OUTPUT: rv = 1 2 3 4 5 sv = 15 rvt = 1 2 3 4 5 cv1 = 1 2 3 4 5 cv2 = 1 2 3 4 5 A = 1 2 3 4

dA =

E = -2.0000 1. 1.5000 -0. rA = 2 lA = 1 0 3 4 uA = 1 2 0 4 B = 4 5 8 12 C = 5 7 11 16 D1 = 20 29 44 63 D2 = 4 10 24 48

2 1 14 13 x = 1 2 3 y = 4 5 6 dp = 32 cp = -3 6 - x1 = 0 1 2 3 4 5 x2 = 0 1 2 3 4 5 x3 = 0 2 4 6 x4 = 0 2 4 6

Problem Statement: Define f(x)=x^3 directly Code: clc clear all syms x f=x^ v3=subs(f,x,3) x0=1:5; v4=subs(f,x,x0) OUTPUT: f = x^ v3 = 27 v4 = [1, 8, 27, 64, 125]

Problem Statement: Define f(x)=x^3 using anonymous function (without any named identifier) Code: clc clear all f=@(x) (x.^3); v5=f(3) x0=1:5; v6=f(x0) OUTPUT: v5 = 27 v6 = 1 8 27 64 125 Problem Statement %(iv) Define f(x,y)=x^2+y^2 using anonymous function Code clc clear all f=@(x,y) (x.^2+y.^2); v7=f(1,2) x0=[1 2 3]; y0=[4 5 6]; v8=f(x0,y0)

Output

v7 = 5 v8 =

f=x^2+y^2; end function [g] = udfname2(x,y,z) g=x^2+y^2+z^2; end Output fpt = 5 fpts = [26, 40, 58, 80] gpt = 14 Problem statement % Solving system of linear equations, say, 4x+5y=7,7x+8y= CODE: clc clear all A=[4 5;7 8] b=[7 21]' x=A\b Output A = 4 5 7 8 b = 7

21 x =

-11.

Problem statement: %2.Multiple plots in a Figure window (using command hold on) CODE: clc clear all x=linspace(0,2pi,50); plot(x,sin(x),'r') hold on plot(x,cos(x),'g.') plot(x,cos(2x),'b-+') legend('sin(x)','cos(x)','cos(2x)') OUTPUT:

Problem statement: %3.Multiple plots in a Figure window (without command hold on) CODE: clc clear all x=linspace(0,2pi,50); plot(x,sin(x),'r',x,cos(x),'g-.',x,cos(2x),'b-+') legend('sin(x)','cos(x)','cos(2x)') OUTPUT:

Problem Statement: %5.Graph of a curve through ezplot command CODE: clc clear all syms x f=sin(2x)+cos(3x); % default domain {for sin, cos [-2pi.2pi]} D=[0 pi]; ezplot(f,D) OUTPUT:

Problem statement: %6.Plot a curve in space CODE: clc clear all t=linspace(0,2pi,50); x=cos(t);y=sin(t);z=sin(5t); plot3(x,y,z,'b.-','markersize',7) xlabel('x-axis') ylabel('y-axis') zlabel('z-axis') title('Curve in space') OUTPUT: