solving non linear third order algebaric expressions using newton rapson method or any other method!!!

1 ビュー (過去 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;

回答 (1 件)

Kye Taylor
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
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!

Translated by