フィルターのクリア

Having issue with this secant method code

1 回表示 (過去 30 日間)
ray sanchez
ray sanchez 2015 年 4 月 28 日
編集済み: ray sanchez 2015 年 4 月 28 日
It's having an issue with the second line when it asks to enter the function. any help appreciated
clear all; close all;
a=input('What is the function? ' );
f=inline(a)
x(1)=input('What is your first guess? ');
x(2)=input('What is your second guess? ');
tol=input('What is the tolerance? ');
iteration=0;
i=2;
eps = 1e10;
while (abs(eps) > tol)
x(i+1)=x(i)-f(x(i))*(x(i)-x(i-1))/(f(x(i))-f(x(i-1)));
eps = x(i+1)-x(i);
i = i+1;
x(i)
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by