真心求教labview的三维曲面拟合问题,希望高手能出手相助!

2019-07-17 15:00发布

我想实现的是将大量数据样本点通过最小二乘法进行曲面拟合,最小二乘法和插值法不同的是,拟合无需过每一个点。保证R值最好就可以了
但是满足最小二乘法的多项式形式有很多,按照不同的数据,可以采用多种不同的多项式,很多时候需要自己定义多项式
因此我想按照自己定义的多项式,通过labview拟合后,由labview导出系数,
举例说明:
我自定义的式子:
Y=F1+F2
F1=a+b*x1+c*x1^2+d*x1^3+e*x1^4+f*x1^5+g*x1^6
F2=m*x2+n*x2^2+o*x2^3

我的数据样本如下如下:


X1X2Y0.141520.3540.149220.3580.15720.35120.165490.35160.17410.35200.183060.35240.192360.35280.202040.35320.212080.35360.222520.35400.141180.640.148820.680.156760.6120.165010.6160.173580.6200.182480.6240.191740.6280.201370.6320.211360.6360.221750.6400.140760.8540.148370.8580.156260.85120.164460.85160.172980.85200.181850.85240.191050.85280.200630.85320.210590.85360.220950.85400.140261.140.147831.180.155681.1120.163851.1160.172331.1200.181851.1240.190321.1280.199861.1320.209781.1360.220081.1400.13971.3540.147231.3580.155051.35120.163181.35160.171631.35200.18041.35240.189541.35280.199041.35320.208931.35360.219211.35400.139071.640.146571.680.154351.6120.162441.6160.170861.6200.179611.6240.188721.6280.198181.6320.208031.6360.218271.6400.138381.8540.145841.8580.15361.85120.161661.85160.170041.85200.178771.85240.187851.85280.197281.85320.207111.85360.217321.85400.137622.140.145062.180.152792.1120.160832.1160.169182.1200.177882.1240.186932.1280.196342.1320.206142.1360.216342.140

通过matlab好像只能计算拟合出最高阶5阶的多项式,同时对matlab也不熟悉,因此想采用labview通过以上数据,按照自己定义的多项式进行拟合,拟合出如下曲面,
QQ截图20170703215034.jpg
并且计算输出多项式中的系数 a,b,c,d,e,f,g,h, m,n,o



友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
14条回答
wind6218
1楼-- · 2019-07-18 18:59
永不放弃,继续求教
wind6218
2楼-- · 2019-07-19 00:21
 精彩回答 2  元偷偷看……
zhouyezuishuai
3楼-- · 2019-07-19 02:58
>我*,看着就好高大上啊,高数,微积分方面在下是小白,帮不了,看看  帮顶一下吧
wind6218
4楼-- · 2019-07-19 04:17
非常感谢,继续求教
wind6218
5楼-- · 2019-07-19 05:13
高手请出现,快来快啦
joyl67
6楼-- · 2019-07-19 05:50
你研究下这个代码!

x = rand(1,10);
y = rand(1,10);
z = (3-2*x-5*y)/4; % Equation of the plane containing
% (x,y,z) points is 2*x+5*y+4*z=3
Xcolv = x(:); % Make X a column vector
Ycolv = y(:); % Make Y a column vector
Zcolv = z(:); % Make Z a column vector
Const = ones(size(Xcolv)); % Vector of ones for constant term
Coefficients = [Xcolv Ycolv Const]colv; % Find the coefficients
XCoeff = Coefficients(1); % X coefficient
YCoeff = Coefficients(2); % X coefficient
CCoeff = Coefficients(3); % constant term
% Using the above variables, z = XCoeff * x + YCoeff * y + CCoeff
L=plot3(x,y,z,'ro'); % Plot the original data points
set(L,'Markersize',2*get(L,'Markersize')) % Making the circle markers larger
% set(L,'Markerfacecolor','r') % Filling in the markers
hold on
[xx, yy]=meshgrid(0:0.1:1,0:0.1:1); % Generating a regular grid for plotting
zz = XCoeff * xx + YCoeff * yy + CCoeff;
surf(xx,yy,zz) % Plotting the surface
title(sprintf('Plotting plane z=(%f)*x+(%f)*y+(%f)',XCoeff, YCoeff, CCoeff))
% By rotating the surface, you can see that the points lie on the plane
% Also, if you multiply both sides of the equation in the title by 4,
% you get the equation in the comment on the third line of this example

一周热门 更多>