matlab三维拟合x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];>> y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];>> z=[150.786 150.99 151.136 151.655 151.
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 21:41:10
matlab三维拟合x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];>> y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];>> z=[150.786 150.99 151.136 151.655 151.
matlab三维拟合
x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];
>> y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];
>> z=[150.786 150.99 151.136 151.655 151.444 151.053 150.241 150.59 150.36 150.363];
>> z=a0+a1*x+a2*y+a3*x^2+a4*x*y+a5*y^2
如何求a0,a1,a2,a3,a4,a5
matlab三维拟合x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];>> y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];>> z=[150.786 150.99 151.136 151.655 151.
clear;clc;
x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];
y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];
z=[150.786 150.99 151.136 151.655 151.444 151.053 150.241 150.59 150.36 150.363];
f1=@(x,y,p)(p(1)+p(2)*x+p(3)*y+p(4)*x.^2+p(5)*x.*y+p(6)*y.^2);
f2=@(p)(sum((f1(x,y,p)-z).^2));
fun=f2(sym('[p1 p2 p3 p4 p5 p6]'));
[p1 p2 p3 p4 p5 p6]=solve(diff(fun,'p1'),diff(fun,'p2'),diff(fun,'p3'),diff(fun,'p4'),diff(fun,'p5'),diff(fun,'p6'));
a=vpa([p1 p2 p3 p4 p5 p6],5)%这就是你要求的a0到a5
p=double([p1 p2 p3 p4 p5 p6]);
f=@(x,y)(f1(x,y,p));
plot3(x,y,z,'o');hold on;
ezsurf(f,[503770,503810,647080,647170])
shading interp;alpha(.5);hold off;
在命令窗口写:
x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];
y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 64713...
全部展开
在命令窗口写:
x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];
y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];
>> x=[503808.4 503793.6 503793.7 503793.7 503793.7 503793.8 503779.2 503779.2 503779.2 503779.2];
>> y=[647086.5 647093.0 647107.9 647122.7 647137.1 647152.5 647160.6 647146.1 647145.3 647136.1];
>> z=[150.786 150.99 151.136 151.655 151.444 151.053 150.241 150.59 150.36 150.363];
>> x1=x.*x;
>> y1=y.*y;
>> y2=x.*y;
>> n=[ones(10,1),x',y',x1',y2',y1'];
>> [b,bint,r,rint,s]=regress(z',n)
运行得到:
b =
0
0
-0.03303805055511
-0.00047955141230
0.00074673076326
-0.00029064047690
便是z=a0+a1*x+a2*y+a3*x^2+a4*x*y+a5*y^2 的系数。
收起