麻烦matlab高手用lsqcurvefit函数帮我拟合一组数据.
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/18 00:52:47
麻烦matlab高手用lsqcurvefit函数帮我拟合一组数据.
y=[0.925,0.881,0.8604,0.8604,0.8409,0.8409,0.8409,0.8222,0.8222,0.8222,0.8044,
0.8044,0.8044,0.8044,0.7872,0.7872,0.7872,0.7872,0.7708,0.7708,0.7708,0.7708,
0.7708,0.7551,0.7255,0.7115,0.6727,0.6599,0.6491,0.6379,0.6271,0.6271,0.6167,
0.6167,0.6066,0.6066,0.6066,0.5968,0.5968,0.5968,0.5873,0.5873,0.5873,0.5873]
x=[0.0833,0.1667,0.25,0.3333,0.4167,0.5,0.5833,0.6667,0.75,0.8333,0.9167,1,1.0833
,1.1667,1.25,1.3333,1.4167,1.5,1.5833,1.6667,1.75,1.8333,1.9167,2,6,9,22,34,46,58,70,82,94,106,118,130,142,154,166,178,190,202,214,226].想用matlab里的lsqcurvefit拟合出下面这个函数,y=1/a+x/b+(1/c)*[1-exp(-c*x/d)].a,b,c,d要求的大于0的.就这些条件了.麻烦哪位会的同学,帮我解决下,-哪里看不清的可以说下.
y=[0.925,0.881,0.8604,0.8604,0.8409,0.8409,0.8409,0.8222,0.8222,0.8222,0.8044,
0.8044,0.8044,0.8044,0.7872,0.7872,0.7872,0.7872,0.7708,0.7708,0.7708,0.7708,
0.7708,0.7551,0.7255,0.7115,0.6727,0.6599,0.6491,0.6379,0.6271,0.6271,0.6167,
0.6167,0.6066,0.6066,0.6066,0.5968,0.5968,0.5968,0.5873,0.5873,0.5873,0.5873]
x=[0.0833,0.1667,0.25,0.3333,0.4167,0.5,0.5833,0.6667,0.75,0.8333,0.9167,1,1.0833
,1.1667,1.25,1.3333,1.4167,1.5,1.5833,1.6667,1.75,1.8333,1.9167,2,6,9,22,34,46,58,70,82,94,106,118,130,142,154,166,178,190,202,214,226].想用matlab里的lsqcurvefit拟合出下面这个函数,y=1/a+x/b+(1/c)*[1-exp(-c*x/d)].a,b,c,d要求的大于0的.就这些条件了.麻烦哪位会的同学,帮我解决下,-哪里看不清的可以说下.
![麻烦matlab高手用lsqcurvefit函数帮我拟合一组数据.](/uploads/image/z/15959263-31-3.jpg?t=%E9%BA%BB%E7%83%A6matlab%E9%AB%98%E6%89%8B%E7%94%A8lsqcurvefit%E5%87%BD%E6%95%B0%E5%B8%AE%E6%88%91%E6%8B%9F%E5%90%88%E4%B8%80%E7%BB%84%E6%95%B0%E6%8D%AE.)
我做了一下发现误差比较大,是不是我给的初值有问题,还是给的数据有问题,你可以参考下function f=curvefun1(x,xdata)% y=1/a+x/b+(1/c)*[1-exp(-c*x/d)]f=1/x(1)+xdata/x(2)+(1/x(3))*(1-exp(-x(3)*xdata/x(4)));运行:clear;clc;xdata=[0.0833,0.1667,0.25,0.3333,0.4167,0.5,0.5833,0.6667,0.75,... 0.8333,0.9167,1,1.0833,1.1667,1.25,1.3333,1.4167,1.5,1.5833,... 1.6667,1.75,1.8333,1.9167,2,6,9,22,34,46, 58,70,82,94,106,118,... 130,142,154,166,178,190,202,214,226];ydata=[0.925,0.881,0.8604,0.8604,0.8409,0.8409,0.8409,0.8222,0.8222,0.8222,0.8044,...0.8044,0.8044,0.8044,0.7872,0.7872,0.7872,0.7872,0.7708,0.7708,0.7708,0.7708,...0.7708,0.7551,0.7255,0.7115,0.6727,0.6599,0.6491,0.6379,0.6271,0.6271,0.6167,...0.6167,0.6066,0.6066,0.6066,0.5968,0.5968,0.5968,0.5873,0.5873,0.5873,0.5873];x0=[5,3,5,2]; %初值x=lsqcurvefit('curvefun1',x0,xdata,ydata)f=curvefun1(x,xdata);plot(xdata,ydata,'.')hold onplot(xdata,f,'.')运行结果:x = 1.0e+002 * Columns 1 through 3 0.036322600853330 2.664204064307804 0.038239112150553 Column 4 0.000104652408479
再问: 对不起,我的错,我给的Y值有问题,Y值是:y=[0.0123,0.0129,0.0132,0.0132,0.0135,0.0135,0.0135,0.0138,0.0138,0.0138,0.0141,0.0141,0.0141,0.0141,0.0144,0.0144,0.0144,0.0144,0.0148,0.0148,0.0148,0.0148,0.0148,0.0151,0.0157,0.016,0.0169,0.0172,0.0175,0.0178,0.0181,0.018,0.0184,0.0184,0.0188,0.0188,0.0188,0.0191,0.0191,0.0191,0.0194,0.0194,0.0194,0.0194] X值不变。麻烦你再看看,耽误你时间了,不好意思。
![](http://img.wesiedu.com/upload/6/09/60944fdb368ceffa2fc72ea04dd54fe8.jpg)
再问: 对不起,我的错,我给的Y值有问题,Y值是:y=[0.0123,0.0129,0.0132,0.0132,0.0135,0.0135,0.0135,0.0138,0.0138,0.0138,0.0141,0.0141,0.0141,0.0141,0.0144,0.0144,0.0144,0.0144,0.0148,0.0148,0.0148,0.0148,0.0148,0.0151,0.0157,0.016,0.0169,0.0172,0.0175,0.0178,0.0181,0.018,0.0184,0.0184,0.0188,0.0188,0.0188,0.0191,0.0191,0.0191,0.0194,0.0194,0.0194,0.0194] X值不变。麻烦你再看看,耽误你时间了,不好意思。
lsqcurvefit在matlab中拟合函数问题
用matlab拟合一组数据,要求得出函数表达式
关于用MATLAB拟合一组数据,得到函数的表达式
我有一组数据,用MATLAB做拟合曲线,数据在下边,麻烦各位帅哥靓女看看,
我正在用matlab作一组数据的非线性拟合
我有一组数据,需要用matlab拟合,
用matlab 对一组数据进行拟合后,怎么直接显示拟合函数的图像?
matlab的lsqcurvefit函数做幂函数拟合出错
matlab数据拟合函数
matlab中高斯拟合函数lsqcurvefit初始参数怎么设置
lsqcurvefit在matlab中拟合多元函数问题
matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,