matlab excced,好心虫友,帮忙看看这个matlab程序那里出错了 - 程序语言 - 小木虫 - 学术 科研 互动社区...

我再把我现在的程序发一遍完整的,这样子不会乱。

m文件:

function g4=f(beta0,x1,x2,T,R)

g1=beta0(1);

g2=beta0(2);

g3=beta0(3);

g4=beta0(4);

g4=exp(x2.*x2.*((((g(1)./(R.*T)).*(exp(-g(3).*g(1)./(R.*T))).^2)./((x1+(exp(-g(3).*g(1)./(R.*T))).*x2).^2))+(((g(2)./(R.*T)).*(exp(-g(3).*g(2)./(R.*T))).^2)./((x2+(exp(-g(3).*g(2)./(R.*T))).*x1).^2))))

程序代码:

x1=[0.01525        0.02059        0.02685        0.03417        0.04221        0.04958];

x2=[0.98475        0.97941        0.97315        0.96583        0.95779        0.95042];

T=[298.15        303.15        308.15        313.15        318.15        323.15];

R=[8.314 8.314 8.314 8.314 8.314 8.314];

beta0=[1,1,0.3,1];

[g,resnorm]=lsqcurvefit(@f,beta0,x1,x2,T,R)

运行后输出:

Warning: Length of lower bounds is > length(x); ignoring extra bounds.

> In checkbounds at 27

In optim\private\lsqncommon at 39

In lsqcurvefit at 149

In Untitled2 at 6

Warning: Length of upper bounds is > length(x); ignoring extra bounds.

> In checkbounds at 37

In optim\private\lsqncommon at 39

In lsqcurvefit at 149

In Untitled2 at 6

Exiting due to infeasibility:  4 lower bounds exceed the corresponding upper bounds.

g =

1.0000    1.0000    0.3000    1.0000

resnorm =

[]

就是初始值定义什么就出什么。

或者这个应该怎么写呢,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值