













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














I hereby declare that the project work entitled “MATLAB” is a general concept of
mathematical problems, original work done by me, and this project work is
submitted in the requirements for the award of the degree of Bachelor Second
Semester. The results enrolled in the report have not been submitted to any other
university or institute for the award of degree of BCA. I attest that all data presented
in this report is accurate and was obtained through experimentation conducted by
me or under my direct supervision.
Furthermore, I confirm that all sources used in the preparation of this report have
been appropriately cited and referenced in accordance with the guidelines provided
by the instructor. Any assistance received from individuals or sources has been
acknowledged in this report.
I understand that any act of academic misconduct, including plagiarism, will not be
tolerated and may result in severe penalties, including but not limited to, loss of
marks or course failure.
I take full responsibility for the content of this report and acknowledge that I have
read and understood the guidelines provided by the instructor.
Signed: Mahendra Singh Mahara
Date: April 30 , 2023
logged in the Command History. In the Command History, you can view
previously run statements, and copy and execute selected statements.
directory reference point. Any file you want to run must be in the current
directory or on the search path.
(named arrays) built up during a MATLAB session and stored in memory.
M-files.
Command Window
workspac
e
Command History
Current Directory Browser
of MATLAB help topics and returning those that contains a key word you
specify.
This command doesn’t open built-in function like, sqrt. See also type
Command.
command window, and more off disables paging of the output in the
MATLAB command window.
results.
indicate that the statement continues on the next line.
For example:
S= sqrt (225) *30 /...
(20*sqrt (100)
for answer), to store the last results of a calculation.
Command Window.
statement will appear in green color.
1.3 Derivative of Exponential
a) f= e
x
b) f= x
9
c) f= sin x d) f= tan x e) f= cos x
f) f= log x g) f= log 10
x h) f= sin x
2
i) f= cos(3x
2
+2x+1)
j) f= e
x
/sin x
RESULT:
y = exp(x)
ans = exp(x)
y = x^
ans = 9*x^
y = sin(x)
ans = cos(x)
y=tan(x)
ans = 1+tan(x)^
y = cos(x)
ans = - sin(x)
y = log(x)
ans = 1/x
y = log(x)/log(10)
ans = 1/x/log(10)
y = sin(x)^
ans = 2sin(x)cos(x)
y = cos(3x^2+2x+1)
ans = - sin(3x^2+2x+1)(6x+2)
y = exp(x)/sin(x)
ans = exp(x)/sin(x)-exp(x)/sin(x)^2*cos(x)
1.4 Maxima and Minima of curve
a) f(x) = 2x
3
+3x
2
Output:
g = 6x^2+6x- 12
s = 1 - 2
Ans = 10
Ans = 37
1.5 Solving Differential Equation
a) solve first order of equation: y’= 5y
b) solve second order of equation: y”-y=0, y(0)= - 1, y’(0)= 2
2.1 Integration
i) F= x
n
ii) F= sin nt
2.2 Finding the Definite Integral Using MATLAB:
Output:
Ans=
Calculate the area between the x-axis. the curve y= x
3
x=1 and x=2.
Output:
The required area is ∫
2
1
3
F(x)=x
2
cos(x) for - 4 ≤x≤9.
Output:
Output:
3.1 Solving the Higher order of equation in MATLAB
Solve: (x-3)
2
(x-7) =
Output:
4. 1 Solving System of equation in MATLAB
Solve the equations: 5x+9y=5, 3x-6y=4.
Output:
4.2 Trapezoidal Rule using MATLAB.
Evaluate the integral x
4
within limit by using - 3 to 3 Trapezoidal rule
Solution:
Let n= 6
so, Y(x)= x
4
. Here a = - 3 and b = 3 therefore (b-a) = 6.
Also, h= (b-a)/n=6/6=
Output:
Answer= (½)[(81+81)+2(16+1+0+1+16)]
Ans= 115
4.4 Newton-Raphson Method in MATLAB.
Find the real root of the equation: cos(x)-3x+1 using NR method.
Output:
4.5 Gauss-Seidel Method
Find the root of following equation,
20x+y-2z=
3x+20y-z=- 18
2x_3y+20z=
Solution:
We start approximation by x0=y0=z0=0.
Let the given eq
n
in the form,
X= (1/20) (17-y+2z) -----------------(i)
Y= (1/20) (- 18 - 3x+z) ----------------(ii)
Z= (1/20) (25-2x+3y) ----------------(iii)
Result:
In[13]:= Limit[(x^8-256)/(x-2), x→ 2]
Out[13]= 1024
c) Lim (x^2+7x+3)/(9x^2+7x+2)
x → ∞
Solution:
In[15]:= Limit[(x^2+7x+3)(9x^2+7x+2), x→∞]
Out[15]= 1 9
d) Lim (Sqrt(x-1)- Sqrt(x))
x → ∞
Solution:
In[16]:= Limit[Sqrt[x-1]-Sqrt[x], x→∞]
Out[16]= 0
e) Lim (Sin x/x)
x → 0
Solution:
In[18]:= Limit[Sin[x]/x, x→ 0]
Out[18]= 1
f) Lim (sin4x/Sin5x)
x → 0
Solution:
In[19]:= Limit[Sin[4x]/Sin[5x], x→ 0]
Out[19]= 4 5
g) Lim tan(3x) - 2x/(3x-sin2x)
x → 0
Solution:
In[21]:= Limit[(Tan[3x]-2x)/(3x-Sin[2x]), x→ 0]
Out[21]= 1
h) Lim (sinx-cos)/(x- π/4)
x → π/
Solution:
In[22]:= Limit[Sin[x]-Cos[x])/(x-π/4), x→π/4]
Out[22]= 2
i) Draw the graph of x^2 (-3<=x<=3)
In[24]:= Plot[x ^ 2,{x,-3, 3}]
j) Draw the graph of 6-2x-x^2 (-3<=x<=3)
ln[25]:= Plot[6- 2 x-x^ 2,{x,-5, 3}]
5
2