matlab隐函数参数拟合,matlab拟合隐函数参数(1stOpt拟合7参数请求代跑)

已知隐函数

f3288404e8dccd32a3c415dc4cee7396.gif,形状是一个椭球,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)+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

//x,y,z

1 0 0

0 1.0121 0

0.5315 1.0711 0

1.0095 1.0076 0

1.0688 0.5324 0

-0.98765 0 0

0 -1.0201 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
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:深蓝海洋 设计师:CSDN官方博客 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值