Error using min MIN with two matrices to compare and a working dimension is not supported.
18 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2018-2-26
编辑:Walter Roberson
2018-2-26
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 个评论
Walter Roberson
2018-2-27
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!