Matlab求曲线方程问题
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/07/04 22:08:22
Matlab求曲线方程问题
x=0
2
3
4.5
5
6.5
8
10
12.5
15
18.5
20
22
23.5
y对应的为:0
10
15
20
25
30
35
40
45
50
55
57.5
60
62
y=Ax^2+Bx(注意:上面的数据是一一对应的,是一元二次方程)
求:A,B.顺便把曲线也贴上吧
x=0
2
3
4.5
5
6.5
8
10
12.5
15
18.5
20
22
23.5
y对应的为:0
10
15
20
25
30
35
40
45
50
55
57.5
60
62
y=Ax^2+Bx(注意:上面的数据是一一对应的,是一元二次方程)
求:A,B.顺便把曲线也贴上吧
![Matlab求曲线方程问题](/uploads/image/z/10291140-36-0.jpg?t=Matlab%E6%B1%82%E6%9B%B2%E7%BA%BF%E6%96%B9%E7%A8%8B%E9%97%AE%E9%A2%98)
x=[0,2,3,4.5,5,6.5,8,10,12.5,15,18.5,20,22,23.5]';
y=[0,10,15,20,25,30,35,40,45,50,55,57.5,60,62]';
X=[x.^2,x,ones(length(y),1)];
Y=y;
[b,bint,r,rint,stats] = regress(Y,X);
xt=0:0.1:25;
yt=b(1).*xt.^2+b(2).*xt;
plot(x',y','*',xt,yt)
![](http://img.wesiedu.com/upload/6/89/68996ddd092b6509f4184da36a6ad2a7.jpg)
y=[0,10,15,20,25,30,35,40,45,50,55,57.5,60,62]';
X=[x.^2,x,ones(length(y),1)];
Y=y;
[b,bint,r,rint,stats] = regress(Y,X);
xt=0:0.1:25;
yt=b(1).*xt.^2+b(2).*xt;
plot(x',y','*',xt,yt)
![](http://img.wesiedu.com/upload/6/89/68996ddd092b6509f4184da36a6ad2a7.jpg)