Filter löschen
Filter löschen

Trying to Solve for multiple values of a variable

1 Ansicht (letzte 30 Tage)
Mary Jean Savitsky
Mary Jean Savitsky am 15 Apr. 2020
Bearbeitet: Star Strider am 15 Apr. 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?

Antworten (1)

Star Strider
Star Strider am 15 Apr. 2020
Bearbeitet: Star Strider am 15 Apr. 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.
.

Kategorien

Mehr zu Elementary Math finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by