modified newton's method

12 ビュー (過去 30 日間)
Robin
Robin 2011 年 11 月 30 日
I am new to matlab. How do apply a formula to an equation? EX. formula: x(sub n)=x(sub n-1) - m (f(xsub n-1)/ f'(xsub n-1) to eqn f(x) = x^3 -3x^2 + 4 = 0

回答 (1 件)

bym
bym 2011 年 12 月 1 日
one way is to use anonymous functions:
f = @(x) x^3-3*x^2+4;
fprime = @(x) 3*x^2-6*x;
then use a for loop to perform the iteration
x = zeros(10,1);
x(1)=.1
for i = 1:9
x(i+1) = x(i)-f(x(i))./fprime(x(i));
end

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by