24小时热门版块排行榜    

CyRhmU.jpeg
南方科技大学公共卫生及应急管理学院2026级博士研究生招生报考通知(长期有效)
查看: 1679  |  回复: 9
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zhangluyoa

银虫 (初入文坛)

[求助] 求解扩散方程问题

有一个方程如图
源码是
function AA
D0=3.55e-19;
options=optimset('tolx',1e-9);
[D,resnorm,residual,exitflag,output,lambda,jacobian] = lsqnonlin(@fei,D0,[],[],options)

function F=fei(D)
C0=0.687;
d=0.02;
Ceq=20;
t=60;
C=4.136;
m=1-(C0-C)/(C0-Ceq);
s=[];
k=0:1000;
s=sum(8./(pi*(2*k+1)).^2.*exp(-D*(pi*(2*k+1)).^2*t*60/(d^2)));
s
F=sum((m-s').^2);


而得到的结果怎么也不对 如下
得到的D值怎么都是跟赋的D0值是一样的额
s =

    0.9998


s =

    0.2158


s =

   Inf


s =

    0.2447


s =

   Inf


s =

    0.2161

Optimization terminated: norm of the current step is less
than OPTIONS.TolX.

D =

  3.5500e-019


resnorm =

    0.0010


residual =

    0.0318


exitflag =

     2


output =

    firstorderopt: 7.1546e+005
       iterations: 2
        funcCount: 6
     cgiterations: 1
        algorithm: 'large-scale: trust-region reflective Newton'
          message: [1x77 char]


lambda =

    lower: 0
    upper: 0


jacobian =

   (1,1)     2.2480e+007
到底怎么弄得,小弟是菜鸟,希望有高手跟好心人帮我5555
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
臭水沟: 金币+3, 谢谢交流~~ 2012-04-04 11:15:22
zhangluyoa: 金币+4, 有帮助 2012-04-11 16:35:41
CODE:
D0=3.55e-6;
options=optimset('tolx',1e-9);
[D,resnorm,residual,exitflag,output,lambda,jacobian] = lsqnonlin(@fei,D0,[],[],options)

function F=fei(D)
C0=0.687;
d=0.02;
Ceq=20;
t=60;
C=4.136;
m=1-(C0-C)/(C0-Ceq);
s=[];
k=0:5000;
s=sum(8./(pi*(2*k+1)).^2.*exp(-D*(pi*(2*k+1)).^2[color=red]*t[/color]/(d^2)));
F=sum((m-s').^2);

Local minimum possible.

lsqnonlin stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.




D =

  5.0774e-008


resnorm =

  1.1370e-007


residual =

  3.3720e-004


exitflag =

     3


output =

    firstorderopt: 39.0251
       iterations: 13
        funcCount: 28
     cgiterations: 0
        algorithm: 'large-scale: trust-region reflective Newton'
          message: [1x458 char]


lambda =

    lower: 0
    upper: 0


jacobian =

   (1,1)     1.1573e+005
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
6楼2012-04-03 17:56:51
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 10 个回答

ya634984094

铜虫 (小有名气)

感谢参与,应助指数 +1
臭水沟: 应助指数-1, 非应助贴请不要选择“应助回帖”~ 2012-04-03 14:47:18
你这是用uds编的输出吗??
2楼2012-04-03 10:54:59
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhangluyoa

银虫 (初入文坛)

引用回帖:
2楼: Originally posted by ya634984094 at 2012-04-03 10:54:59:
你这是用uds编的输出吗??

什么是ubs啊,用的是matlab,我是菜鸟
3楼2012-04-03 11:35:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ya634984094

铜虫 (小有名气)

【答案】应助回帖


臭水沟: 金币+1, 谢谢交流~~ 2012-04-04 11:15:14
引用回帖:
3楼: Originally posted by zhangluyoa at 2012-04-03 11:35:39:
什么是ubs啊,用的是matlab,我是菜鸟

呃~~matlab我不是很熟,uds是fluent用来求解方程的~~
4楼2012-04-03 12:34:11
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见