# matlab隐函数参数拟合,matlab拟合隐函数参数（1stOpt拟合7参数请求代跑）

，形状是一个椭球，x，y，z有9组观测值，参数有8个，p(1)-p(8)；求如何拟合出这8个参数

F=@(p,x)(0.5...

*(abs(...

0.5*(p(1)*(2*x(:,1)-x(:,2))/3.0+p(2)*(2*x(:,2)-x(:,1))/3.0)+0.5*sqrt((p(1)*(2*x(:,1)-x(:,2))/3.0-p(2)*(2*x(:,2)-x(:,1))/3.0).^2+4*p(7)*x(:,3).^2)...%a1

-0.5*(p(1)*(2*x(:,1)-x(:,2))/3.0+p(2)*(2*x(:,2)-x(:,1))/3.0)-0.5*sqrt((p(1)*(2*x(:,1)-x(:,2))/3.0-p(2)*(2*x(:,2)-x(:,1))/3.0).^2+4*p(7)*x(:,3).^2)...%a2

).^8.0...%a

+abs(...

((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0+((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0+sqrt(( ((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0-((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0).^2+4*p(8)*x(:,3).^2)...%2*b1

+0.5*(((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0+((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0-sqrt(( ((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0-((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0).^2+4*p(8)*x(:,3).^2))...%b2

).^8.0...

+abs(...

0.5*(((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0+((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0+sqrt(( ((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0-((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0).^2+4*p(8)*x(:,3).^2))...%b1

+((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0+((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0-sqrt(( ((p(3)-4*(p(4)+p(5)-p(6)))*x(:,2)+2*(4*p(5)-p(6)+p(4)-p(3))*x(:,1))/9.0-((p(6)-4*(p(4)+p(5)-p(3)))*x(:,1)+2*(4*p(4)-p(6)+p(5)-p(3))*x(:,2))/9.0).^2+4*p(8)*x(:,3).^2)...%2*b2

).^8.0...

)...%b

).^1.0/8.0;@月只蓝

%%%%*********************

Parameter p(7);

Variable x y z;

Function (0.5*(abs(0.5*(p(1)*(2*x-y)/3.0+p(2)*(2*y-x)/3.0)+0.5*sqrt((p(1)*(2*x-y)/3.0-p(2)*(2*y-x)/3.0)^2+4*p(7)*z^2)

-0.5*(p(1)*(2*x-y)/3.0+p(2)*(2*y-x)/3.0)-0.5*sqrt((p(1)*(2*x-y)/3.0-p(2)*(2*y-x)/3.0)^2+4*p(7)*z^2))^8.0

+abs(((p(3)-4*(p(4)+p(5)-p(6)))*y+2*(4*p(5)-p(6)+p(4)-p(3))*x)/9.0+((p(6)-4*(p(4)+p(5)-p(3)))*x+2*(4*p(4)-p(6)+p(5)-p(3))*y)/9.0+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 0

-0.5826 0.5826 0

0.5826 -0.5826 0

0.5011 0.5011 -0.5011

0 0 0.9377

[Last edited by 独孤神宇 on 2018-6-15 at 22:27]

• 0
点赞
• 0
收藏
• 0
评论
05-16
11-26 1万+
06-24 676
03-18 329
07-28 1194
03-12 9968
02-14 7万+

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助