Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

First time user Need help with evaluating equation for several different possiblities.

1 Ansicht (letzte 30 Tage)
I have an equation (9*a) + (12.5*b) + (15*c) + (17*d) + (20*e) + (22.5*f) + (27*g) + (30*h) + (35*j) where a = 1:143 b = 1:100 c = 1:80 d = 1:67 e = 1:57 f = 1:40 g = 1:34 h = 1:29 I want to evaluate the expression for all of the possible comninations of all arrays.
  6 Kommentare
Voss
Voss am 30 Jun. 2020
It is a very large number of combinations (172310835840000*NJ, where NJ is the number of values j can have (unspecified in the question), which is ~ 64000*NJ GB of memory, assuming single-precision floating-point numbers). I can't imagine a 9-dimensional array of this size would fit in RAM; how do you intend to store the resulting values? The answer to this question will dictate the possible solutions.
Rik
Rik am 30 Jun. 2020
It should be possible to efficiently find the histogram of the resulting evaluations, but I don't immediately see how you would do that. The code below is probably a good start.
a=[1 143];
b = [1 100];
c = [1 80];
d = [1 67];
e = [1 57];
f = [1 40];
g = [1 34];
h = [1 29];
j=1;
[a,b,c,d,e,f,g,h,j]=ndgrid(a,b,c,d,e,f,g,h,j);
v=(9*a) + (12.5*b) + (15*c) + (17*d) + (20*e) + (22.5*f) + (27*g) + (30*h) + (35*j) ;

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by