作者zupo (外派越南工作者)
标题Re: [讨论] 三元二次(?)方程式求解
时间Mon Nov 4 22:54:53 2013
※ 引述《ding94xu04 (错误示范)》之铭言:
: 这是一个作业...
: 不过我怎麽算都是发散的解
: x^2+y^2+z=5.2
: exp(x)+y+z^2=2.44
: x^2-y^3+2*z=8.5828136
: 题目如上
: 我是利用Newton-Raphson method
: 其初始值为 x=1 y=1.7 z=1.189
: 问题是这样的
: 在第一步选择 f1 f2 f3时不知道要怎麽取
: 有算到一组解出来,然後自己按计算机代回会发现方程式不合
: 请问要怎麽选f1 f2 f3??
: 谢谢各位解答了!!
题目其实是很复杂的,又有加上指数隐含数
用牛顿法有点困难
-------------------------------------------
function pttex135
% x(1) = x; x(2) = y;x(3) = z;
f = fsolve(@pttex123,[1 1.7 1.189])
%
figure(1)
ezsurfc(@(x,y)myfun1(x,y))
hold on
ezsurfc(@(x,y)myfun2(x,y))
hold on
ezsurfc(@(x,y)myfun3(x,y))
hold on
function f = pttex123(x)
f(1) = x(1).^2 + x(2).^2 + x(3) - 5.2;
f(2) = exp(x(1)) + x(2) + x(3).^2 - 2.44;
f(3) = x(1).^2 - x(2).^3 + 2.*x(3) - 8.5828136;
function z1 = myfun1(x,y)
z1 = 5.2 -x^2-y^2;
function z2 = myfun2(x,y)
z2 = (2.44-exp(x)-y)^(1/2);
function z3 = myfun3(x,y)
z3 = (y^3-x^2+8.5828136)/2;
--------------------------------------------------
初始值条件 x = 0 y = 0 z = 0
x = 1 y = 3 z = 5
x = 1 y = 1.7 z =1.189
>> pttex135
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
f =
-0.88202 -1.5878 1.901
>> pttex135
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
f =
1.0042 -1.7296 1.2
先看一下有问题再讨论
--
1.MATLAB programming 2.ASPEN process simulation package
3.FORTRN programming 4.Advance Engineering Mathematics
5.Process Control Theory
6.Chemical Engineering Basic Theory(Kinetic.thermodynamics.transport)
7.Numerical Method and Analysis
8.MATLAB Toolbox.Simulink system basic design
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 113.186.203.69