I have already built the arrays I just dont know the method to evaluate the expression for all the possible values for all variables. if it is easier i can just use 1:143 for all the variables but i still need to evaluate the expression for every possible value and every combination of values
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)
Ältere Kommentare anzeigen
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
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
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)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!