MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]曲线拟合的问题 (https://www.labfans.com/bbs/showthread.php?t=2698)

心际依然 2008-04-29 09:53

[求助]曲线拟合的问题
 
已知函数x=exp([COLOR="Red"]q[/COLOR]/tan(B))*cos([COLOR="red"]q[/COLOR]-qa)+pa*sin([COLOR="red"]q[/COLOR]-qa+B);
y=exp([COLOR="red"]q[/COLOR]/tan(B))*sin([COLOR="red"]q[/COLOR]-qa)-pa*cos([COLOR="red"]q[/COLOR]-qa+B);
其中只有[COLOR="red"]q[/COLOR]是变量,且[COLOR="red"]q[/COLOR]=[1.3,1.5];B,qa,pa都是常量;
现在要把x,y拟合为以下的函数形式:
x=exp([COLOR="red"]q[/COLOR]/tan(B+[COLOR="Blue"]tB[/COLOR]))*cos([COLOR="Red"]q[/COLOR]+[COLOR="blue"]tq[/COLOR]);
y=exp([COLOR="red"]q[/COLOR]/tan(B+[COLOR="blue"]tB[/COLOR]))*sin([COLOR="red"]q[/COLOR]+[COLOR="blue"]tq[/COLOR]);
怎么求出[COLOR="Blue"]tB[/COLOR]和[COLOR="blue"]tq[/COLOR]呢?
如果用 p = curvefit(‘Fun’p0,xdata,ydata)这个,具体要怎么写.
我的x,y都是隐函数.

watcher 2008-04-29 15:00

1,由q=[1.3,1.5]获得x,y的离散序列
2,由x=exp(q/tan(B+tB))*cos(q+tq);y=exp(q/tan(B+tB))*sin(q+tq);得到
atan(y/x)=q+tq%线性拟合截距
ln(x^2+y^2)=q/tan(B+tB)%线性拟合斜率

不知道可不可以,呵呵

心际依然 2008-04-30 13:27

1,由q=[1.3,1.5]获得x,y的离散序列
2,由x=exp(q/tan(B+tB))*cos(q+tq);y=exp(q/tan(B+tB))*sin(q+tq);得到
atan(y/x)=q+tq%线性拟合截距
ln(x^2+y^2)=q/tan(B+tB)%线性拟合斜率

你的意思是这样吗?
令x1=q;
y1=atan(y/x)+ln(x^2+y^2)=q+tq+2q/tan(B+tB)=(1+2/tan(B+tB))*x+tq
p=polyfit(x1y11);
求出来的p(1)=1+2/tan(B+tB)
p(2)=tq

watcher 2008-05-01 20:56

right
:smile:

心际依然 2008-05-04 10:24

这样求出来误差很大,2条曲线差很多呀。好像是累积了很多误差

zhanhuichong 2008-05-05 14:40

使用lsqcurvefit进行最小二乘拟合


所有时间均为北京时间。现在的时间是 11:24

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.