Newton Raphson question code and answer plz urgent

1 view (last 30 days)
f1(x1, x2) = 10x1sinx2 + 2 = 0
f2(x1, x2) = 10x1^2 10x1cosx2 + 1 = 0
need to find x1 and x2 5 iterations
at 0 x1 and x2 = 1 and 0 respectively
i've looked for some codes...but just hard to understand..wish they asked me to do it by hand lol...not very good with matlab.
Need to know by tomorrow afternoon latest :(
Thanks to anyone that helps!
  4 Comments
Carlos Mallqui
Carlos Mallqui on 26 Apr 2012
sorry about the urgent..don't have to take it that way either..in a sense it is urgent...but not obligating anyone to respond to me...only if they have time to help would be awesome....if not well..thats fine too i understand people have many things to do.
below i added somethings..
Walter Roberson
Walter Roberson on 26 Apr 2012
That makes it "time sensitive" rather than "urgent".

Sign in to comment.

Answers (1)

Carlos Mallqui
Carlos Mallqui on 26 Apr 2012
sorry about the urgent..don't have to take it that way either..in a sense it is urgent...but not obligating anyone to respond to me...only if they have time to help would be awesome....if not well..thats fine too i understand people have many things to do.
clear, clc
x = [1;1];
nit=10;
for i=1:nit
f(:,i) = [x(1)*x(1)-x(2)-1; x(2)*x(2)-x(1)-1];
delta = 4*x(1)*x(2)-1;
Jinv = (1/delta)*[ 2*x(2) 1; 1 2*x(1)];
dx(:,i) = -Jinv*f(:,i);
x(:,i+1) = x(:,i) + dx(:,i);
end
numofit = (0:nit);
output = [numofit x];
fprintf(\n nofit \t x(1) \t x(2) \n);
fprintf(-------------------------------\n);
fprintf(%7.0f \t %7.4f \t %7.4f\n’,output’);
that is the equation posted as a guide...to solve this other problem
f1(x1, x2) = x1^2x2 − 1 = 0
f2(x1, x2) = x2^2x1 − 1 = 0
where initial conditions are [1, 1]
I just wanted to know how would i apply it in my case with the other equations...im really not good with the commands..
if anyone can help me out I will appreciate it :)
thnaks
  3 Comments
Geoff
Geoff on 26 Apr 2012
then please edit your answer, highlight the code and press the 'code' button.
Carlos Mallqui
Carlos Mallqui on 26 Apr 2012
done already fixed it thanks....now it can be seen properly..but still this code is not for the actual problem i wanna solve..but it was the example used

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!