如何用MATLAB拟合曲线来求参数?我要计算的是a,b参数,已知c,k,y其中y=252*a/(2.016129032*10^9)*((cos(k)/sin(k))/c)^b其中数据为,c=[2.7,2.8,2.9,3,3.1,3.2,3.45,3.7,3.95,4.2,4.45,4.7,4.95,5.2]k=[ 0,47,93,140,186,279,372,465,558,651]
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 22:22:18
如何用MATLAB拟合曲线来求参数?我要计算的是a,b参数,已知c,k,y其中y=252*a/(2.016129032*10^9)*((cos(k)/sin(k))/c)^b其中数据为,c=[2.7,2.8,2.9,3,3.1,3.2,3.45,3.7,3.95,4.2,4.45,4.7,4.95,5.2]k=[ 0,47,93,140,186,279,372,465,558,651]
如何用MATLAB拟合曲线来求参数?
我要计算的是a,b参数,已知c,k,y
其中y=252*a/(2.016129032*10^9)*((cos(k)/sin(k))/c)^b
其中数据为,c=[2.7,2.8,2.9,3,3.1,3.2,3.45,3.7,3.95,4.2,4.45,4.7,4.95,5.2]
k=[ 0,47,93,140,186,279,372,465,558,651];
y=[18.98,27.35,34.86,38.52,38.44,37.73,38.43,43.87,42.77,46.22];
要怎么拟合,才能求出a,
如何用MATLAB拟合曲线来求参数?我要计算的是a,b参数,已知c,k,y其中y=252*a/(2.016129032*10^9)*((cos(k)/sin(k))/c)^b其中数据为,c=[2.7,2.8,2.9,3,3.1,3.2,3.45,3.7,3.95,4.2,4.45,4.7,4.95,5.2]k=[ 0,47,93,140,186,279,372,465,558,651]
令x=(cos(k)./sin(k))./c,这个就是xdata向量
y=252/(2.016129032*10^9)*a*x^b
取log得到
log(y)=b*log(x)+log(252/(2.016129032*10^9)*a)
所以log(y)与log(x)是线性关系,用p=polyfit(log(xdata),log(y),1)求出
b=p(1);
a=exp(p(2))/252*(2.016129032*10^9); % 因为log(252/(2.016129032*10^9)*a)=p(2)
所以最终程序是如下:
clear all
c=[2.7,2.8,2.9,3,3.1,3.2,3.45,3.7,3.95,4.2,4.45,4.7,4.95,5.2];
k=[0,47,93,140,186,279,372,465,558,651];
y=[18.98,27.35,34.86,38.52,38.44,37.73,38.43,43.87,42.77,46.22];
xdata=(cos(k)./sin(k))./c;
p=polyfit(log(xdata),log(y),1);
b=p(1);
a=exp(p(2))/252*(2.016129032*10^9);