24小时热门版块排行榜    

查看: 412  |  回复: 0

shijipei

铜虫 (初入文坛)

[求助] 悬赏金币求助matlab自定义函数拟合曲线

自定义一个函数去拟合曲线,运行了总是报错,
??? Error using ==> times
Matrix dimensions must agree.

Error in ==> dig at 14
a21=5140.*h1.*exp(k12.*xdata);
求助高手指点下

ydata1=[0 10 20 30 40 50 60 70 80 90 100];
ydata2=[0 0.07 0.15 0.25 0.35 0.49 0.59 0.72 0.91 1.14 1.47];
x0=[1/10 0.08 1/20];
options=[]; % default settings
options(1)=1; % tabular display some intermediate results
options(2)=1.e-4; % controls the accuracy of x at the solution
options(3)=1.e-4; % controls the accuracy of f at the solution
options(5)=1; % Gauss-Newton algorithum which is faster when residual is small
options(14)=10000; % maximum number of function evaluations
x=leastsq('dig',x0,options,[],ydata1,ydata2);

function [ y1 ] = dig(tor,k12,kv)
k21=0.816*k12;
A20=11000;
d=0.14*tor;g=k12/(k12+k21);h1=k21/(k12+k21);
a21=5140.*h1.*exp(k12.*xdata)*exp(d*xdata);
a22=(4685.*g-455.*h1).*exp(kv.*xdata);
y1 = a21+a22;
回复此楼

» 猜你喜欢

希望在这里可以学到更多知识,大家多指教哦。
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

找到一些相关的精华帖子,希望有用哦~

科研从小木虫开始,人人为我,我为人人
相关版块跳转 我要订阅楼主 shijipei 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 0856求调剂 +3 刘梦微 2026-03-15 3/150 2026-03-16 10:00 by houyaoxu
[考研] 东南大学364求调剂 +4 JasonYuiui 2026-03-15 4/200 2026-03-16 08:36 by Linda Hu
[考研] 梁成伟老师课题组欢迎你的加入 +6 一鸭鸭哟 2026-03-14 7/350 2026-03-15 22:12 by Winj1e
[考研] 材料工程专硕274一志愿211求调剂 +5 薛云鹏 2026-03-15 5/250 2026-03-15 20:38 by Logic2024
[考博] 东华理工大学化材专业26届硕士博士申请 +6 zlingli 2026-03-13 6/300 2026-03-15 20:00 by ryzcf
[考研] 274求调剂 +4 时间点 2026-03-13 4/200 2026-03-15 15:29 by Rambo13
[考研] 311求调剂 +3 26研0 2026-03-15 3/150 2026-03-15 09:12 by JourneyLucky
[考研] 297一志愿上交085600求调剂 +5 指尖八千里 2026-03-14 5/250 2026-03-14 17:26 by a不易
[考研] 308 085701 四六级已过求调剂 +7 温乔乔乔乔 2026-03-12 14/700 2026-03-14 10:49 by JourneyLucky
[考研] 266求调剂 +4 学员97LZgn 2026-03-13 4/200 2026-03-14 08:37 by zhukairuo
[考研] 328,0703考生求调剂,一志愿为东北师范大学 +4 观素律 2026-03-09 5/250 2026-03-14 01:24 by JourneyLucky
[基金申请] 有必要更换申报口吗 20+3 fannyamoy 2026-03-11 3/150 2026-03-14 00:52 by zhanghaozhu
[考研] 材料371求调剂 +9 鳄鱼? 2026-03-11 11/550 2026-03-13 22:53 by JourneyLucky
[考研] 337一志愿华南理工0805材料求调剂 +7 mysdl 2026-03-11 9/450 2026-03-13 22:43 by JourneyLucky
[考研] 【考研调剂求收留】 +3 Ceciilia 2026-03-11 3/150 2026-03-13 20:18 by JourneyLucky
[考研] 301求调剂 +6 Liyouyumairs 2026-03-11 6/300 2026-03-13 20:11 by JourneyLucky
[考研] 工科材料085601 279求调剂 +8 困于星晨 2026-03-12 10/500 2026-03-13 15:42 by ms629
[考研] 282分材料专业求调剂院校 +18 枫桥ZL 2026-03-09 25/1250 2026-03-13 10:47 by 白夜悠长
[考研] 研究生招生 +3 徐海涛11 2026-03-10 7/350 2026-03-12 14:26 by 徐海涛11
[考研] 0703化学调剂 +3 三dd. 2026-03-10 3/150 2026-03-10 15:45 by peike
信息提示
请填处理意见