Finding the function corresponds to the minimum residual

I am trying to find the optimum function by minimising the residual. Need to find the function corresponds to the minimum residual.
I am using the Matlab code similar to the one below. Is there any other better, more efficient way to find the optimum function 'f'?
Thanks in advance.
for i = 1: length(alphaarray)
alpha = alphaarray(i);
[f] = fine(K1,K2,Mmeas,alpha);
res(i) = norm (K2*f - Mmeas);
end
idx = find(res == min(res));
Xidx = alphaarray(idx);
alpha = Xidx;
[f] = fine(K1,K2,Mmeas,alpha);

답변 (1개)

Torsten
Torsten 2022년 4월 27일
편집: Torsten 2022년 4월 27일
resmin = Inf;
fmin = [];
for i = 1: length(alphaarray)
alpha = alphaarray(i);
f = fine(K1,K2,Mmeas,alpha);
res = norm (K2*f - Mmeas);
if res < resmin
resmin = res;
alphamin = alpha;
fmin = f;
end
end

카테고리

도움말 센터File Exchange에서 Software Development에 대해 자세히 알아보기

태그

질문:

2022년 4월 27일

댓글:

2022년 4월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by