Clear Filters
Clear Filters

problems using newtons method

1 view (last 30 days)
justin simmons
justin simmons on 19 Feb 2017
Edited: justin simmons on 19 Feb 2017
x = -2;
Tol = 0.0000001;
count = 0;
dx=1;
f=-13;
fprintf('step x dx f(x)\n')
fprintf('---- ----------- --------- ----------\n')
fprintf('%3i %12.8f %12.8f %12.8f\n',count,x,dx,f)
xVec=x;fVec=f;
while (dx > Tol || abs(f)>Tol)
count = count + 1;
fprime = cosx-x;
xnew = x - (f/fprime);
dx=abs(x-xnew);
x = xnew;
f = cosx-x;
fprintf('%3i %12.8f %12.8f %12.8f\n',count,x,dx,f)
end
this is what i was have. how can i fix this?

Answers (1)

Walter Roberson
Walter Roberson on 19 Feb 2017
You could define cox and cost

Categories

Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!