Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Newton Raphson for nxn system using symbolic toolbox
Posted:
Nov 1, 2011 6:20 AM
|
|
Hello
I have already implemented the Newton Raphson method for a system of n equations. However in my implementation I have to give the function and its Jacobian (written as a function) as a input variable.
Now I want to use the symbolic toolbox in order not to calculate the Jacobian myself. My basic problem is later to evaluate that expression, since I don't know before hand the size of the system. While this is not a problem for an "ordinary" function which uses vectors it seems to be a problem for symbolic expression.
Here is an example trying to use vectors clear all syms x y e=[x y] f1=sin(e(1)-e(2)) e(1)=1 e(2)=-1 eval(f1)
But this does not work! It gives sin(x+y)
While of course x=1 y=-1 eval(f1) works and gives f1= 0.9093 but of course for a nxn system I don't know before hand the size of the system and how many variables I have to set to numerical values before evaluating the expression f1.
Can anybody help me?
thanks
Uwe Brauer
|
|
|
|