matlab nlinfit的问题
f=@(a,t)a(1).*exp(a(2).*(t-a(3)))t=[1790,1800,1810,1820,1830,1840,1850,1860,1870,1880...
f=@(a,t)a(1).*exp(a(2).*(t-a(3)))
t=[1790,1800,1810,1820,1830,1840,1850,1860,1870,1880,1890,1900,1910,1920,1930,1940,1950,1960,1970,1980,1990,2000]
y=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.0,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4]
k=nlinfit(t,y,f,k0)
k0=[3.9,1,1790]
sse=sum((y-f(a,t)).^2)
哪里错了??? 展开
t=[1790,1800,1810,1820,1830,1840,1850,1860,1870,1880,1890,1900,1910,1920,1930,1940,1950,1960,1970,1980,1990,2000]
y=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.0,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4]
k=nlinfit(t,y,f,k0)
k0=[3.9,1,1790]
sse=sum((y-f(a,t)).^2)
哪里错了??? 展开
1个回答
展开全部
clear;clc
f=@(a,t)a(1).*exp(a(2).*(t-a(3)))
t=[1790,1800,1810,1820,1830,1840,1850,1860,1870,1880,1890,1900,1910,1920,1930,1940,1950,1960,1970,1980,1990,2000];
y=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.0,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4];
k0=[1,0.01,1000]; % 初值放在此行
k=nlinfit(t,y,f,k0)
plot(t,y,'*',t,f(k,t))
sse=sum((y-f(k,t)).^2) % 不是f(a,t)
追问
谢谢 请问 我的问题是不是应该要a=nlinfit~?还有你是怎么算k0的?
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
单片机,即单片微控制器,也称为单片微型计算机,是将中央处理器(CPU)、存储器(ROM,RAM)、输入/输出接口和其他功能部件集成在一块 在一个小块的集成电路上,从而实现对整个电路或系统的数字式控制。单片机不是完成某一个逻辑功能的芯片,而是...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询