solving non linear third order algebaric expressions using newton rapson method or any other method!!!
4 views (last 30 days)
Show older comments
hii..the two equations mentioned below are non linear third order algebraic equations. i tried to solve using f solve but it didnt work!!i think this equations can be solved mathematically using newton raphson method!!but i am new to matlab.. plz help me out in solving this equations
syms q0 q1
f(1)= 4.97*q0-.570e-16*q1-.660e-1*(.158*q0^2+.141*q1^2)*q0-.228e-2*(-.927e-14*q0^2+.257e-15*q1^2)*q1;
f(2)=.291e-15*q0+.484*q1-.978e-19*(.158*q0^2+.141*q1^2)*q0+.170e-19*(-.927e-14*q0^2+.257e-15*q1^2)*q1;
0 Comments
Answers (1)
Kye Taylor
on 30 Apr 2013
Edited: Kye Taylor
on 30 Apr 2013
The fsolve function needs a function handle as input. So create a file with the command
edit yourFun.m
and paste this code in there
function f = yourFun(q)
q0 = q(1);
q1 = q(2);
f(1) = 4.97*q0-.570e-16*q1-.660e-1*(.158*q0^2+.141*q1^2)*q0-.228e-2*(-.927e-14*q0^2+.257e-15*q1^2)*q1;
f(2) = .291e-15*q0+.484*q1-.978e-19*(.158*q0^2+.141*q1^2)*q0+.170e-19*(-.927e-14*q0^2+.257e-15*q1^2)*q1;
The above code defines a function (hopefully you're familiar with that, if not create another post). The fsolve function dictates the form of the interface to the the function: one input, where each component represent a scalar variable in your system; and one vector output. You can see the documentation on fsolve for more detail by typing
doc fsolve
Then, from the command window type
fsolve(@yourFun,[1;2])
That said, I'm not sure you want to really trust the results.. what are you trying to do exactly? You're dealing with such small numbers defining coefficients of the nonlinear functions that I'd be skeptical of any conclusions.
2 Comments
cr
on 30 Apr 2013
You can tell the 'other program' to write the output eqns to a file which can be read by matlab as text strings. Then replace the last two statements from Kye's code with eval of those strings.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!