紧急:用matlab中的最小二乘法拟合指数函数(人口问题)
t=[1971:1:1990];y=[8.52298.71778.92219.08599.24209.37179.49749.62599.75429.870510.007...
t=[1971:1:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
拟合曲线y=exp(a*t+b)
希望您上机操作一下,给出具体的编写程序.
x=[1971:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
z=log(y);
p=polyfit(x,z,1)
y1=polyval(p,x);
由此程序求得y1=exp(0.0147*x-26.7773)
再绘图plot(x,y,'o',x,y1),结果点都在拟合的曲线的下面,谁能帮我找出毛病并修改一下?
并写出答案的结果 展开
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
拟合曲线y=exp(a*t+b)
希望您上机操作一下,给出具体的编写程序.
x=[1971:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
z=log(y);
p=polyfit(x,z,1)
y1=polyval(p,x);
由此程序求得y1=exp(0.0147*x-26.7773)
再绘图plot(x,y,'o',x,y1),结果点都在拟合的曲线的下面,谁能帮我找出毛病并修改一下?
并写出答案的结果 展开
展开全部
呵呵,还需要棚让转换一次啊链仿局。及y1=exp(z1)
clear all
x=[1971:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
fun=inline('exp(a(1)*t+a(2))'大虚,'a','t')
a=nlinfit(x,y,fun,[0.01 -20])
xx=1970:1990;
yy=exp(a(1)*xx+a(2));
plot(x,y,'o',xx,yy)
z=log(y);
p=polyfit(x,z,1)
z1=polyval(p,x);
y1=exp(z1);
figure
plot(x,y,'*',x,y1)
结果:
a =
0.014631 -26.68
p =
0.01468 -26.777
clear all
x=[1971:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
fun=inline('exp(a(1)*t+a(2))'大虚,'a','t')
a=nlinfit(x,y,fun,[0.01 -20])
xx=1970:1990;
yy=exp(a(1)*xx+a(2));
plot(x,y,'o',xx,yy)
z=log(y);
p=polyfit(x,z,1)
z1=polyval(p,x);
y1=exp(z1);
figure
plot(x,y,'*',x,y1)
结果:
a =
0.014631 -26.68
p =
0.01468 -26.777
富港检测技术(东莞)有限公司_
2024-04-02 广告
2024-04-02 广告
正弦振动多用于找出产品设计或包装设计的脆弱点。看在哪一个具体频率点响应最大(共振点);正弦振动在任一瞬间只包含一种频率的振动,而随机振动在任一瞬间包含频谱范围内的各种频率的振动。由于随机振动包含频谱内所有的频率,所以样品上的共振点会同时激发...
点击进入详情页
本回答由富港检测技术(东莞)有限公司_提供
展开全部
y1要取指数吧桐灶!信轮吵滑侍
x=[1971:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
z=log(y);
>> p=polyfit(x,z,1)
p =
0.0147 -26.7773
>> y1=polyval(p,x);
>> y1
y1 =
Columns 1 through 12
2.1575 2.1722 2.1869 2.2015 2.2162 2.2309 2.2456 2.2603 2.2749 2.2896 2.3043 2.3190
Columns 13 through 20
2.3337 2.3483 2.3630 2.3777 2.3924 2.4071 2.4217 2.4364
>> y2=exp(y1)
y2 =
Columns 1 through 12
8.6494 8.7773 8.9071 9.0389 9.1725 9.3082 9.4458 9.5855 9.7273 9.8711 10.0171 10.1653
Columns 13 through 20
10.3156 10.4681 10.6229 10.7800 10.9395 11.1012 11.2654 11.4320
>> plot(x,y,'o',x,y2)
x=[1971:1990];
y=[8.5229 8.7177 8.9221 9.0859 9.2420 9.3717 9.4974 9.6259 9.7542 9.8705 10.0072 10.1654 10.3008 10.4357 10.5851 10.7507 10.9300 11.1026 11.2704 11.4333];
z=log(y);
>> p=polyfit(x,z,1)
p =
0.0147 -26.7773
>> y1=polyval(p,x);
>> y1
y1 =
Columns 1 through 12
2.1575 2.1722 2.1869 2.2015 2.2162 2.2309 2.2456 2.2603 2.2749 2.2896 2.3043 2.3190
Columns 13 through 20
2.3337 2.3483 2.3630 2.3777 2.3924 2.4071 2.4217 2.4364
>> y2=exp(y1)
y2 =
Columns 1 through 12
8.6494 8.7773 8.9071 9.0389 9.1725 9.3082 9.4458 9.5855 9.7273 9.8711 10.0171 10.1653
Columns 13 through 20
10.3156 10.4681 10.6229 10.7800 10.9395 11.1012 11.2654 11.4320
>> plot(x,y,'o',x,y2)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询