bbarker
Civil/Environmental
- Oct 30, 2002
- 1
I am a student, and we have put together a small script to calculate the roots of an equation using newton raphson itteration in Matlab - all well and good. However, I decided it would be nice if you could change the function from the terminal, rather than changing the code each time you wanted to solve a new problem.
The problem is, the way most people will enter an equation is in symbolic notation (e.g x^2 +3). On top of this, I need to differentiate my function, (i.e obtain 2x from the above). The diff function will do this, but only (it seems) if fed a symbolic equation.
However, I need the equation in the form
x.^2 +3 - note the x. for element operations - or else my program fails spectacularly
Is there any way I can convert from symbolic notation to this?
Thanks
Ben
The problem is, the way most people will enter an equation is in symbolic notation (e.g x^2 +3). On top of this, I need to differentiate my function, (i.e obtain 2x from the above). The diff function will do this, but only (it seems) if fed a symbolic equation.
However, I need the equation in the form
x.^2 +3 - note the x. for element operations - or else my program fails spectacularly
Is there any way I can convert from symbolic notation to this?
Thanks
Ben