Attempt to grow array along ambiguous dimension.

2 visualizzazioni (ultimi 30 giorni)
a = [0:80];
b = flip(a);
multA = ones(a);
multB = ones(a);
multAB = ones(a);
for i=1:80
multA(i) = (factorial(a(i)+99))/(factorial(a(i))*factorial(99));
multB(i) = (factorial(b(i)+99))/(factorial(b(i))*factorial(99));
multAB(i) = multA(i)*multB(i);
end
Error: Attempt to grow array along ambiguous dimension.
Why do I keep getting the above error? What is the ambiguous direction?
  1 Commento
Stephen23
Stephen23 il 5 Feb 2020
Modificato: Stephen23 il 5 Feb 2020
Note that your results will be not be accurate (down to ones precision), as the values you are working with (e.g. 99!) are well above flintmax. If you require a precise output then you will need to use symbolic maths or a high-precision integer class:

Accedi per commentare.

Risposte (1)

the cyclist
the cyclist il 4 Feb 2020
The way your defined your mult variables, they are 81-dimensional arrays. I think you meant:
multA = ones(size(a));
multB = ones(size(a));
multAB = ones(size(a));

Categorie

Scopri di più su Numeric Types in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by