MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB数学相关] 符号积分方程组求解的讨论 (https://www.labfans.com/bbs/showthread.php?t=9020)

zhouhao163 2009-06-18 20:01

符号积分方程组求解的讨论
 
1 个附件
原方程组见附件。
当方程个数为三时,编程如下:
函数的M文件为:
function En=fentropy(u)
c=u;
En=zeros(3,1);
syms x;
En(1)=int(exp(c(1)+c(2)*x+c(3)*x^2),'x',0,1)-1;
En(2)=int(x*exp(c(1)+c(2)*x+c(3)*x^2),'x',0,1)-0.87791;
En(3)=int(x^2*exp(c(1)+c(2)*x+c(3)*x^2),'x',0,1)-0.77161;
调用程序如下:
clear,clc;
u=10*ones(3,1);
c=fsolve(@fentropy,u)
不到两分钟可以解出c=[-433.1652; 992.7220; -565.3877]

当方程个数为四时,编程如下:
函数的M文件为:
function En=fentropy(u)
c=u;
En=zeros(4,1);
syms x;
En(1)=int(exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-1;
En(2)=int(x*exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-0.87791;
En(3)=int(x^2*exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-0.77161;
En(4)=int(x^3*exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-0.67894;
调用程序如下:
clear,clc;
u=10*ones(4,1);
c=fsolve(@fentropy,u)

运行二十分钟后出错:
??? The following error occurred converting from sym to
double:
Error using ==> sym.double at 25
DOUBLE cannot convert the input expression into a double
array.
If the input expression contains a symbolic variable, use the
VPA function instead.
Error in ==> fentropy at 5
En(1)=int(exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-1;
Error in ==> trustnleqn at 225
F = feval(funfcn{3},x,varargin{:});
Error in ==> fsolve at 297
[x,FVAL,JACOB,EXITFLAG,OUTPUT,msg]=...
Error in ==> maxentropy at 3
c=fsolve(@fentropy,u)

请教各路武林高手,带积分(积分后没有确定表达式)的方程组求解,
有没有更好的编程方法?当方程增至五、六时,计算量非常大,如何处理?
望赐教!!!

未注册 2010-04-06 20:03

回复: 符号积分方程组求解的讨论
 
怎么看不到图片啊?11111111
[QUOTE=zhouhao163;29597]原方程组见附件。
当方程个数为三时,编程如下:
函数的M文件为:
function En=fentropy(u)
c=u;
En=zeros(3,1);
syms x;
En(1)=int(exp(c(1)+c(2)*x+c(3)*x^2),'x',0,1)-1;
En(2)=int(x*exp(c(1)+c(2)*x+c(3)*x^2),'x',0,1)-0.87791;
En(3)=int(x^2*exp(c(1)+c(2)*x+c(3)*x^2),'x',0,1)-0.77161;
调用程序如下:
clear,clc;
u=10*ones(3,1);
c=fsolve(@fentropy,u)
不到两分钟可以解出c=[-433.1652; 992.7220; -565.3877]

当方程个数为四时,编程如下:
函数的M文件为:
function En=fentropy(u)
c=u;
En=zeros(4,1);
syms x;
En(1)=int(exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-1;
En(2)=int(x*exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-0.87791;
En(3)=int(x^2*exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-0.77161;
En(4)=int(x^3*exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-0.67894;
调用程序如下:
clear,clc;
u=10*ones(4,1);
c=fsolve(@fentropy,u)

运行二十分钟后出错:
??? The following error occurred converting from sym to
double:
Error using ==> sym.double at 25
DOUBLE cannot convert the input expression into a double
array.
If the input expression contains a symbolic variable, use the
VPA function instead.
Error in ==> fentropy at 5
En(1)=int(exp(c(1)+c(2)*x+c(3)*x^2+c(4)*x^3),'x',0,1)-1;
Error in ==> trustnleqn at 225
F = feval(funfcn{3},x,varargin{:});
Error in ==> fsolve at 297
[x,FVAL,JACOB,EXITFLAG,OUTPUT,msg]=...
Error in ==> maxentropy at 3
c=fsolve(@fentropy,u)

请教各路武林高手,带积分(积分后没有确定表达式)的方程组求解,
有没有更好的编程方法?当方程增至五、六时,计算量非常大,如何处理?
望赐教!!![/QUOTE]


所有时间均为北京时间。现在的时间是 04:49

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.