Using recursive function with combination of n variables(each variable being an array of numbers)!!
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have 5 variables; x, y, z, r and s.
each of these variables contains an array of data. Eg. x=[10, 20, 30, 40, 50, 60], y=[2,3,4,5,6], z=[0.5, 0.75, 1, 5, 10], r=[50, 220, 1100], s=[2, 10, 100]
conditions for the simulation to be met; x/y <= 10; r/s>50
How to run simulation for the various combination of this data set, in a single go?
0 commentaires
Réponses (1)
Torsten
le 18 Juil 2021
mx = size(x,2);
my = size(y,2);
mz = size(z,2);
mr = size(r,2);
ms = size(s,2);
[X,Y,Z,R,S] = ndgrid(1:mx,1:my,1:mz,1:mr,1:ms];
product = [x(:,X),y(:,Y),z(:,Z),r(:,R),s(:,S)];
product(product(:,1)./product(:,2) > 10 | product(:,4)./product(:,5) <= 50) = [];
product
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!