필터 지우기
필터 지우기

Finding four parameters that are the closest to the prescribed value_Minimize the function?

조회 수: 1 (최근 30일)
Hello,
I have four a cell with four arrays each containing around 5000 numbers (all arrays have the same length). I call these arrays
s,k,I,G
and
length(s)=length(k)=length(I)=length(G)=5000.
On the other hand, I have the prescribed values for these four parameters
s0,k0,I0,G0
and I need to find the combination of s,k,I,G that is closest to the values of s0,k0,I0,G0. It is important to note that s,k,I,G have to be in the same row (i.e., not s(10), k(1), I(1001), G (50000), but, for instance s(888), k(888), I(888), G(888) are the closest to s0,k0,I0,G0).
Please can you give me some hits how to tackle this problem? Would this be a minimize the function problem?
Thank you,
djr

채택된 답변

Matt J
Matt J 2017년 6월 13일
편집: Matt J 2017년 6월 13일
Seems like a simple application of min()
[minval,rownum]=min(sum( abs( [s-s0, k-k0, I-I0, G-G0] ) , 2 ) );

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by