Error using secant method.

11 views (last 30 days)
Natalie Spalding
Natalie Spalding on 22 Feb 2021
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

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!