Error using min MIN with two matrices to compare and a working dimension is not supported.
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
LALE ASIK
el 26 de Feb. de 2018
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?
0 comentarios
Respuesta aceptada
Walter Roberson
el 26 de Feb. de 2018
Editada: Walter Roberson
el 26 de Feb. de 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 comentarios
Walter Roberson
el 27 de Feb. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!