24小时热门版块排行榜    

CyRhmU.jpeg
查看: 2651  |  回复: 11
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

右手握炮

新虫 (小有名气)

[求助] 自己编了个matlab数据拟合公式,拟合成功但不显示参数,请问问题出在哪了?已有2人参与

程序代码如下
data1=xlsread('C:\Users\dell\Desktop\数据拟合\新建 Microsoft Excel 工作表.xlsx',1,'a1:a100');
data=xlsread('C:\Users\dell\Desktop\数据拟合\新建 Microsoft Excel 工作表.xlsx',1,'B1:B100');
x=[data1];
y=[data];
p=fittype('a^x*(b-c)+c','independent','x', 'dependent', 'y')
f=fit(x,y,p);
plot(f,x,y);

p =

     General model:
     p(a,b,c,x) = a^x*(b-c)+c
警告: Start point not provided, choosing random start point.
> In Warning>Warning.throw at 30
  In fit>iFit at 312
  In fit at 108
没有显示出abc的结果。。。这是怎么回事?求高手指点。。。
回复此楼

» 猜你喜欢

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

新的风暴已经出现 怎么能够停滞不前 穿越时空竭尽全力 我会来到你身边 微笑面对危险 梦想成真不会遥远 鼓起勇气坚定向前 奇迹一定会出现
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

angocn

至尊木虫 (文坛精英)

引用回帖:
6楼: Originally posted by 右手握炮 at 2015-05-28 21:32:12
请问在哪里查看?我初学者,求指教。。。...

直接敲a,b,c回车,不可以么?
其实我喜欢历史,可是却学了理科
7楼2015-05-28 21:45:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 12 个回答

monkeyking0

木虫 (正式写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
右手握炮: 金币+50, ★★★★★最佳答案, 太感谢拉 2015-05-29 14:18:03
警告: Start point not provided, choosing random start point.
需要设置初始值
您没有提供数据,我随即给了几个值拟合试了下;如下:
x = [1:5]';
y =[12.4000;21.7000;35.0000;64.7000;85.3000];

p=fittype('a^x*(b-c)+c','independent','x', 'dependent', 'y');
opt=fitoptions(p);
opt.StartPoint=[1 1 0];
f=fit(x,y,p,opt);
plot(f,x,y);
结果如图:

在窗口输入f,得到:
f =

     General model:
     f(x) = a^x*(b-c)+c
     Coefficients (with 95% confidence bounds):
       a =       1.311  (0.5083, 2.114)
       b =        1.55  (-31.32, 34.42)
       c =      -28.15  (-187.1, 130.8)
更细致的问题可以 doc fittype,我也只是搜索了一下,尝试了一下,深入也是不懂的
自己编了个matlab数据拟合公式,拟合成功但不显示参数,请问问题出在哪了?
11.jpg

2楼2015-05-28 20:27:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

右手握炮

新虫 (小有名气)

多谢兄台,我把程序改成这个,没警告了,但不显示abc的值不知是怎么回事,附excel表格
data1=xlsread('C:\Users\dell\Desktop\数据拟合\新建 Microsoft Excel 工作表.xlsx',1,'a1:a100');
data=xlsread('C:\Users\dell\Desktop\数据拟合\新建 Microsoft Excel 工作表.xlsx',1,'B1:B100');
x=[data1];
y=[data];
p=fittype('a^x*(b-c)+c','independent','x', 'dependent', 'y');
opt=fitoptions(p);
opt.StartPoint=[0.7 1 0.7];
f=fit(x,y,p,opt);
plot(f,x,y);
新的风暴已经出现 怎么能够停滞不前 穿越时空竭尽全力 我会来到你身边 微笑面对危险 梦想成真不会遥远 鼓起勇气坚定向前 奇迹一定会出现
3楼2015-05-28 21:09:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

右手握炮

新虫 (小有名气)

x=1到50
y=0.69869602
0.590282096
0.53444396
0.50040014
0.477474302
0.4609846
0.44855435
0.438848807
0.431060579
0.424672595
0.419338377
0.414817048
0.410935948
0.407568082
0.404617959
0.402012394
0.399694353
0.397618734
0.395749397
0.394057046
0.392517681
0.391111457
0.389821815
0.388634834
0.387538726
0.38652344
0.385580354
0.384702032
0.383882023
0.383114707
0.382395163
0.381719064
0.381082591
0.38048236
0.37991536
0.379378906
0.378870595
0.378388268
0.377929983
0.377493986
0.37707869
0.376682654
0.376304569
0.375943242
0.375597582
0.375266593
0.374949359
0.374645041
0.374352865
0.37407212
新的风暴已经出现 怎么能够停滞不前 穿越时空竭尽全力 我会来到你身边 微笑面对危险 梦想成真不会遥远 鼓起勇气坚定向前 奇迹一定会出现
4楼2015-05-28 21:13:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见