Variables with especific posible values
Afficher commentaires plus anciens
Hi, i'm trying to define some variables that only can take one of some defined values, and depending of wich value results for this variable, other variabe take a value. for example:
i have this variable: Capext, this must take one of this values :
/0,50,95,120/
and if Capext = 0, then Cuext = 0 and Cauext = 0
Capext = 50, then Cuext = 0.6 and Cauext = 570
Capext = 95, then Cuext = 0.8 and Cauext = 900
Capext = 120, then Cuext = 1.1 and Cauext = 1030
i don't know how to use or define as variables that three. i´ve tried to define a set ( i /1*4/) and the variables as parameters depending of "i", but it didn't work. i've tried to define all that as a table but now i think it's not possible, because i need that as variables, and i need to know which value is taken for the model.
i would be grateful if one you can help me.
Réponse acceptée
Plus de réponses (1)
Sean de Wolski
le 6 Avr 2015
Modifié(e) : Sean de Wolski
le 6 Avr 2015
Here's a small example with synthetic values and variable names:
% c is independent, cdep is dependent on c
c = [0 25 90 100];
cdep = [1 34 56 78]
n = randi(numel(c),1) % random choice
cex = c(n) % Extrac
cdex = cdep(ismember(c,cex)) % grab corresponding one
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!