📄 gen_compare.m
字号:
function [Gen_Flop, Gen_Res, Gen_Err] = gen_compare (how_init);%GEN_COMPARE%% [Gen_Flop, Gen_Res, Gen_Err] = gen_compare (how_init)% computes flops, residual and error condition% for all geometric least square methods and several% data sets; initialize method 'how_init'.%% NOTE: flops < 0 for minimum in row !%% how_init is one of% - 'algcircle'% - 'bookstein' What = str2mat ( ... 'spec1', ... 'rand', ... 'circle', ... 'circle_rand', ... 'ellipse', ... 'ellipse_rand', ... 'hyperbola', ... 'hyperbola_rand'); How = str2mat ( ... 'pare_gauss', ... 'pare_newton', ... 'pare_marq', ... 'pare_varpro', ... 'alge_odr'); m1 = 1; m2 = size(What, 1); n1 = 1; n2 = size(How, 1); Gen_Res = zeros(m2,n2); Gen_Flop = zeros(m2,n2); Gen_Err = zeros(m2,n2); for i = m1:m2, for j = n1:n2, str = sprintf ('%s: %s', deblank(What(i,:)), deblank(How(j,:))); disp(str); [Gen_Res(i,j), Gen_Flop(i,j), Gen_Err(i,j)] = ... gen_proccall (deblank(What(i,:)), deblank(How(j,:)), how_init); end end for i = m1:m2, nrow = norm(Gen_Res(i,:), inf) + 1; minres = nrow; for j = n1:n2, if (~Gen_Err(i,j)), if (minres > Gen_Res(i,j)), minres = Gen_Res(i,j); end end end for j = n1:n2, if (Gen_Err(i,j) | ..., ((Gen_Res(i,j) - minres) >= 1.0E-3*nrow) | ... (Gen_Flop(i,j) <= 0)), Gen_Flop(i,j) = inf; end end end [Y, I] = min (Gen_Flop'); for i = m1:m2, if (Y(i) ~= inf), Gen_Flop (i, I(i)) = -Gen_Flop (i, I(i)); endend % gen_compare
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -