Effacer les filtres
Effacer les filtres

Error using min MIN with two matrices to compare and a working dimension is not supported.

11 vues (au cours des 30 derniers jours)
The code gives me the following error: using min MIN with two matrices to compare and a working dimension is not supported.
The corresponding line in the code:
yp(2) = min(e*f*y(1)/(a+y(1)),(y(3)*f*y(1)/(theta*(a+y(1)))),e*f*theta/y(3))*y(2)-d*y(2);
Could you please help me to fix it?

Réponse acceptée

Walter Roberson
Walter Roberson le 26 Fév 2018
Modifié(e) : Walter Roberson le 26 Fév 2018
Bracket count. Each number indicates the nesting level "after" the bracket above it
yp(2) = min(e*f*y(1)/(a+y(1)),(y(3)*f*y(1)/(theta*(a+y(1)))),e*f*theta/y(3))*y(2)-d*y(2);
1 0 1 2 1 2 3 21,2 3 2 3 2 3 4 5 4321, 2 10 1 0 1 0
notice there are two commas inside the min() level, so you are invoking min() with three arguments. min() has two different syntaxes:
min(ARRAY,ARRAY)
min(ARRAY,[],DIMENSION)
there is no syntax for
min(ARRAY,ARRAY,DIMENSION)
and there is no syntax for
min(ARRAY,ARRAY,ARRAY)
If you need to take the min() amongst three arrays, use
min(min(ARRAY,ARRAY),ARRAY)
or
D = ndims(ARRAY) + 1;
min(cat(D,ARRAY,ARRAY,ARRAY),D)
  3 commentaires
Walter Roberson
Walter Roberson le 27 Fév 2018
When you use min(A, B) then it proceeds element by element giving you a result the same size as the original with the pairwise minimum.
When you min(A) which is the same case as min([A;B;C]) then you take the minimum along each column giving you a result that has one row and the same number of columns as the original. Not the same.
LALE ASIK
LALE ASIK le 27 Fév 2018
Thank you so much for your clarification.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by