Effacer les filtres
Effacer les filtres

Trying to Solve for multiple values of a variable

1 vue (au cours des 30 derniers jours)
Mary Jean Savitsky
Mary Jean Savitsky le 15 Avr 2020
Modifié(e) : Star Strider le 15 Avr 2020
W_algae=0:0.2:0.05
m_1_algae=(5*10^4)*(1/3600); %[=] kg/s
m_1_water= (m_1_algae/W_algae)*(1-W_algae);%[=] kg/s
m_1_slurry= m_1_algae+m_1_water;
In this script I am trying to calculate m_1_slurry using values for W_algae of 0.05, 0.1, 0.15, & 0.2 but it is giving me a solution of infinity. Is there any way i can perform this calculation for each value and obtain 5 solutions or do I have to do each calculation separately?

Réponses (1)

Star Strider
Star Strider le 15 Avr 2020
Modifié(e) : Star Strider le 15 Avr 2020
Try this version of your code (with the correct ‘W_algae’ vector):
W_algae=0.05:0.05:0.2;
m_1_algae=(5*10^4)*(1/3600); %[=] kg/s
m_1_water= (m_1_algae./W_algae).*(1-W_algae);%[=] kg/s
m_1_slurry= m_1_algae+m_1_water;
EDIT —
To multiply or divide (or exponetiate) with vectors, use element-wise operations. See Array vs. Matrix Operations for an extended discussion.
.

Catégories

En savoir plus sur Elementary Math 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!

Translated by