solving non linear third order algebaric expressions using newton rapson method or any other method!!!
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Kye Taylor
2013년 4월 30일
편집: Kye Taylor
2013년 4월 30일
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
cr
2013년 4월 30일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!