Clear Filters
Clear Filters

Trying to Solve for multiple values of a variable

1 view (last 30 days)
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?

Answers (1)

Star Strider
Star Strider on 15 Apr 2020
Edited: Star Strider on 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.
.

Categories

Find more on Elementary Math in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!