Trying to Solve for multiple values of a variable

1 次查看(过去 30 天)
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?

回答(1 个)

Star Strider
Star Strider 2020-4-15
编辑:Star Strider 2020-4-15
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.
.

类别

Help CenterFile Exchange 中查找有关 Elementary Math 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by