0% found this document useful (0 votes)
154 views

Numerical Analysis: MATLAB Practical (Autumn 2020) B.E. III Semester Thapar Institute of Engineering & Technology Patiala

The document is an assignment submission from a student named Aarohan Verma with roll number 101903497 in group COE19. It contains code implementing the fixed point iteration method to solve various equations numerically and find their roots. For each equation given in Question 2 and 3, it provides the initial guess, the root found, and number of iterations required for convergence.

Uploaded by

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

Numerical Analysis: MATLAB Practical (Autumn 2020) B.E. III Semester Thapar Institute of Engineering & Technology Patiala

The document is an assignment submission from a student named Aarohan Verma with roll number 101903497 in group COE19. It contains code implementing the fixed point iteration method to solve various equations numerically and find their roots. For each equation given in Question 2 and 3, it provides the initial guess, the root found, and number of iterations required for convergence.

Uploaded by

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

NUMERICAL ANALYSIS

MATLAB Practical (Autumn 2020)


B.E. III Semester
Thapar Institute of Engineering & Technology Patiala

Name: Aarohan Verma


Roll No.: 101903497
Group: COE19
Instructor: Mrs. Mamta Gulati
ASSIGNMENT 5-
Fixed Point Iteration Method
Q2.
Code:
%Aarohan Verma
%101903497
%2COE19
clear all
clc
g= @(x) x-x^3-4*x^2+10;
%g= @(x) ((10/x)-4*x)^(1/2);
%g= @(x) 0.5*((10-x^3)^(1/2));
%g= @(x) (10/(4+x))^(1/2);
%g= @(x) x-((x^3+4*x^2-10)/(3*x^2+8*x));
a=1;
i=1;
b=2;
e=0.001;
N=100;
x0=(a+b)/2;
while i<=N
x1=g(x0);
if(abs(x1-x0)<=e)
break;
end
i=i+1; x0=x1;
end
if (i>=N)
fprintf("Not Convergent!");
end
fprintf("\nFixed point is %d",x1);
fprintf("\nIteration is %d",i)
QUESTION g(x) INITIAL GUESS ROOT & NO. OF
NO. ITERATIONS
Q2. x-x3-4x2+10 x0 = (a+b)/2 = 1.5 Not convergent
i=1 Fixed point is NaN
N = 100
Iteration is 101
x0 = (a+b)/2 = 1.5 Not convergent Fixed point is
10
√ − 4𝑥 i=1 2.2748 - 3.6088i
𝑥 N = 100

Iteration is 101
0.5*√10 − 𝑥 3 x0 = (a+b)/2 = 1.5 Fixed point is 1.3654
i=1
N = 100 Iteration is 10

x0 = (a+b)/2 = 1.5 Fixed point is 1.3653


10
√ i=1
4+𝑥 N = 100 Iteration is 4

x0 = (a+b)/2 = 1.5 Fixed point is 1.3652


𝑥 3 +4𝑥 2 − 10 i=1
x- 3𝑥 2 +8x N = 100 Iteration is 3

Q3. (atan(4*x) + n*π) x0=1 Smallest root is


i=1 1.3931 (n==0)

Second smallest root


is 4.6588 (n==1)
Q4. 1/ π *(- π + asin(x/2)) x0=1 Fixed point is
i=1 -1.2055
e = 0.01
Iteration is 5
3.
Code:
%Aarohan Verma
%101903497
%2COE19
clc
clear all
e=0.001;
i=1;
n=0;
N=1000;
x0=1;
while n<2
g=@(x)(atan(4*x) + n*pi);
while i<=N
x1=g(x0);
if(abs(x1-x0)<=e)
if n==0
fprintf("Smallest root is %d",x1);
else
fprintf("\nSecond smallest root is %d",
x1);
end
break;
end
i=i+1;
x0=x1;
end
if (i>=N)
disp("Not Convergent 1")
end
n=n + 1;
end
Screenshot:

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