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 comentario

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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 23 de Dic. de 2019

Comentada:

el 26 de Dic. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by