Trying to Solve for multiple values of a variable

1 visualización (últimos 30 días)
Mary Jean Savitsky
Mary Jean Savitsky el 15 de Abr. de 2020
Editada: Star Strider el 15 de Abr. de 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?

Respuestas (1)

Star Strider
Star Strider el 15 de Abr. de 2020
Editada: Star Strider el 15 de Abr. de 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.
.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by