MATLAB Answers

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

2 views (last 30 days)
siv1
siv1 on 23 Dec 2019
Commented: Asvin Kumar on 26 Dec 2019
[~,k2]=sort(g,'ascend');
[~,k1]=sort(h,'ascend');
k3=k1+k2;
k=k3/2;
[~,fx_opt]=min(k);

  1 Comment

Asvin Kumar
Asvin Kumar on 26 Dec 2019
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.

Sign in to comment.

Answers (0)

Sign in to answer this question.

Products