Coding Assgnment 1

You might also like

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

1) --> [n,res] = newtonraphson('x+log(x)','1+(1/x)',0.7,0.

0001)
n =3
res = 0.56714328945514

2)--> A=[2,3,0
2,0,3
0,1,1]
A=
230
203
011

--> b=[800
650
350]

b=
800
650
350
x=gausselim(A,b)
x=
100
200
150

3)a)i) --> x_nodes = [0 1.5 3 4]


x_nodes =
0

1.5000

3.0000

4.0000

--> y_nodes = [ 3 6.4817 22.0855 56.5482]


y_nodes =
3.0000

6.4817 22.0855 56.5482

--> x_eval=1
--> y_eval = IntpNatCspline(x_nodes,y_nodes,x_eval)
y_eval =
5.1915
a)ii) --> x=[0 1.5 3 4];

--> y=[3 6.4817 22.0855 56.5982];


--> xi=1;
--> [a,y]=IntpNewton(x,y,xi)
a=
3.0000

2.3211

2.6938

y=
5.7118

b)

--> X=[0,1.5,3,4];
--> Y=[3,6.4817,22.0855,56.5982];
--> x=3.5;
--> y=IntpLagrange(X,Y,x)

1.7376

Lagrange Coefficient 1 = 0.02777777777778

Lagrange Coefficient 2 = 0.15555555555556

Lagrange Coefficient 3 = 0.77777777777778

Lagrange Coefficient 4 = 0.35000000000000

y = 36.06205000000000

Engineering Mathematics 4
Assignment 1

Name

: Muhamad Arif Bin Samsuddin

Lecturer Name

: Dr Ismail

AD110173

You might also like