Error using secant method.

11 次查看(过去 30 天)
Natalie Spalding
Natalie Spalding 2021-2-22
Given:
Why is this question also not giving any output at all? I've tried basing it off others that do work, but can't see where I'm going wrong.
%% Problem 3c. Secant Method(Needs Work)
clear all
clc
R=15/2;
v=500;
h=8;
i=1;
hold=0;
while(1)
fh=(pi^R*h^2-pi/(3*h^3-v));
fhold=((pi^R*hold^2-pi)/(3*hold^3-v));
hnew=h-(fh*(h-hold))/(fh-hold)
err=abs((hnew-h)/hnew);
if err<(1*10^(-8)),break,end
hold=h
h=hnew;
i=1+1;
end
i
h

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by