Matlab - 如何保存fmincon优化的步骤(步骤摘要)?

时间:2017-11-14 08:29:43

标签: matlab optimization rotation

我的脚本中有fmincon优化,可以对齐笛卡尔坐标系中的几何曲面。

function fDiffLiRe = opt_Teil2(phi)

global xNeg yNeg xPos yPos stepsX yyPos yyNeg fLiDiff fReDiff  fistLi fistRe fsollLi fsollRe xxxPos xxxNeg yyyPos
global yyyNeg
global interpolationsmethode

%Coordinates are rotated through Phi
%left geometrical shape rotated
xxxNeg=xNeg*cos(phi)+yNeg*sin(phi);
yyyNeg=-xNeg*sin(phi)+yNeg*cos(phi);

%right geometrical shape rotated 
xxxPos=xPos*cos(phi)+yPos*sin(phi);
yyyPos=-xPos*sin(phi)+yPos*cos(phi);

%rotated coordinates are interpolated
yyPos = interp1(yyyPos,xxxPos,stepsX, interpolationsmethode);
yyNeg = interp1(yyyNeg,xxxNeg,stepsX, interpolationsmethode);

%area of each geometrical shape is calculated
%left
fistLi=trapz(stepsX,yyNeg);

%target size of the left shape
fsollLi=-0.93;
fLiDiff=fsollLi-fistLi;

%right
fistRe=trapz(stepsX,yyPos');

%target size of the right shape
fsollRe=0.93
fReDiff=fsollRe-fistRe;  

%sum of the Deviation of the target sizes is minimized
fDiffLiRe=(fReDiff+fLiDiff)^2;
  end

优化正常,并返回正确旋转的坐标yyPosyyNeg。我现在想要返回坐标旋转过的总角度phi。我怎样才能做到这一点?变量phi仅显示优化的最后一步

0 个答案:

没有答案