Solving system of two (non)-linear eqautions multiple times using a for loop
Show older comments
I want to solve a system of two equations and two unknows (m and A). However. the right side of the second equation is a integer, which I would like to change with every iteration in the for loop. Doing so with every iteration two equations appear and two new unknowns to solve.
The vectors m_dot and A_volute have the solutions, however when I fill in the solutions in the second equation it is not right.
Does anyone know what I am doing wrong?
%% constants
rho = 1.3;
D = 0.126;
%% choose
W = 2600
RPM = 6000
Omega = RPM*((2*pi)/60);
%% solve
m_dot = [];
A_volute = [];
for i = 1500:1000:4500
syms m A
E = [(W*rho*A)/(m^2*Omega*D) == 1.2e-8 , m /(rho*Omega*A*D) == i];
S = solve(E,m,A);
m_dot = [m_dot, S.m];
A_volute = [A_volute, S.A];
end
Accepted Answer
More Answers (1)
%% constants
rho = 1.3;
D = 0.126;
%% choose
W = 2600;
RPM = 6000;
Omega = RPM*((2*pi)/60);
i = 1500:1000:4500;
%Solutions
m_dot = W./(i*Omega^2*D^2*1.2e-8)
A_volute = W./(i.^2*rho*Omega^3*D^3*1.2e-8)
%Test for solution
(W*rho*A_volute)./(m_dot.^2*Omega*D) - 1.2e-8
m_dot./(rho*Omega*A_volute*D) - i
1 Comment
Harm Gilsing
on 11 Sep 2022
Categories
Find more on Symbolic Math Toolbox 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!