Newton Raphson on MATLAB

1 次查看(过去 30 天)
Türker Demiröz
Türker Demiröz 2021-2-19
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

回答(1 个)

Jemima Pulipati
Jemima Pulipati 2021-2-23
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!

Translated by