Newton Raphson on MATLAB

1 view (last 30 days)
Türker Demiröz
Türker Demiröz on 19 Feb 2021
Answered: Jemima Pulipati on 23 Feb 2021
Hello Community. Here im trying to find the rho_a using the Newton Raphson Method. But im new to MATLAB and can't figure it out by myself.
Here's my Code;
clc; clear all
f_o =0.527;
f_i = 0.506;
Z = 8;
D_w = 10.32;
rho_0 = (f_i+f_o-1)*D_w;
F_a =2600;
alpha_no = 7.61;
C_delta = 7.14*10^5;
LHS=F_a/(Z*C_delta*rho_0^3/2);
syms rho_a
f = @(rho_a) ((sin(alpha_no)+rho_a)/((cos(alpha_no)^2+(sin(alpha_no)+rho_a)^2))^1/2)*(((cos(alpha_no)^2+(sin(alpha_no)+rho_a)^2))^1/2)-1^3/2;
fd = diff(f(rho_a));
rho_a = 10^-6;
for i=1:100000
rho_a = rho_a - f./fd;
f=rho_a;
if abs(f-LHS/LHS)<=10^-4
break
end
end

Answers (1)

Jemima Pulipati
Jemima Pulipati on 23 Feb 2021
Hello,
From my understanding, you want to implement the Newton Raphson method in MATLAB.
The following answer from the community might be of relevance to you.
The following file exchange submission might also help you.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!