Is this code(in mat lab function block) correct for the attached logic?

[~,k2]=sort(g,'ascend');
[~,k1]=sort(h,'ascend');
k3=k1+k2;
k=k3/2;
[~,fx_opt]=min(k);

댓글 수: 1

Looks good.
Please note that MATLAB uses 1-based indexing while you require 0-based indexing. However, this won't affect the output of fx_opt because all values are off-shifted by 1.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

제품

태그

질문:

2019년 12월 23일

댓글:

2019년 12월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by