曲线函数求出来之后就只可带横坐标算纵坐标了对应描点连线就可以了,编辑框 把编辑框的句柄传入onpaint中就可以绘图了。
help polyfit。
POLYFIT Fit polynomial to data。
POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of。
degree N that fits the data, P(X(I))~=Y(I), in a least-squares sense。
The structure S contains the Cholesky factor of the Vandermonde。
matrix (R), the degrees of freedom (df),and the norm of the。
residuals (normr) as fields。
工程设计
所得到的数据往往是一张关于离散数据点的表 ,没有解析式来描述 x-y关系。根据所给定的这些离散数据点绘制的曲线,称为不规则曲线,通常用曲线拟合的方法解决这类问题。
所谓曲线拟合方法是由给定的离散数据点,建立数据关系(数学模型),求出一系列微小的直线段把这些插值点连接成曲线,只要插值点的间隔选择得当,就可以形成一条光滑的曲线。
POLYFIT Fit polynomial to data.
POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of
degree N that fits the data, P(X(I))~=Y(I), in a least-squares sense.
[P,S] = POLYFIT(X,Y,N) returns the polynomial coefficients P and a
structure S for use with POLYVAL to obtain error estimates on
predictions. If the errors in the data, Y, are independent normal
with constant variance, POLYVAL will produce error bounds which
contain at least 50% of the predictions.
The structure S contains the Cholesky factor of the Vandermonde
matrix (R), the degrees of freedom (df), and the norm of the
residuals (normr) as fields.