"Christopher Creutzig" <Christopher.Creutzig@mathworks.com> wrote in message
news:539E968E.9020408@mathworks.com...
> On 6/4/14 5:38 PM, Jas wrote:
>
>> The problem I am having with the equation is below. For the time being,
>> there are several additional input variables that can be assigned as:
>
> Your code also contains an A_in, which you have not defined.
>
>> S = solve (P_in + 0.5*(mdot_in/(rho_gas*A_in))^2 == P_1 +
>> 0.5*(mdot_1/(rho_gas*A_1))^2 +
>> (.015*(length/dh*((rho_gas*(mdot_1/(rho_gas*A_1))^2)/2)) 
>> a*(length/dh*(mdot_1/(rho_gas*A_1))^2)), P_in +
>> 0.5*(mdot_in/(rho_gas*A_in))^2 == P_3 + 0.5*(mdot_4/(rho_gas*A_4))^2 +
>> (.015*(length/dh*((rho_gas*(mdot_4/(rho_gas*A_4))^2)/2)) 
>> a*(length/dh*(mdot_4/(rho_gas*A_4))^2)), P_1 +
>> 0.5*(mdot_1/(rho_gas*A_1))^2 +
>> (.015*(length/dh*((rho_gas*(mdot_1/(rho_gas*A_1))^2)/2)) 
>> a*(length/dh*(mdot_1/(rho_gas*A_1))^2)) == P_2 +
>> 0.5*(mdot_2/(rho_gas*A_2))^2 +
>> (.015*(length/dh*((rho_gas*(mdot_2/(rho_gas*A_2))^2)/2)) 
>> a*(length/dh*(mdot_2/(rho_gas*A_2))^2)), P_3 +
>> 0.5*(mdot_4/(rho_gas*A_4))^2 +
>> (.015*(length/dh*((rho_gas*(mdot_4/(rho_gas*A_4))^2)/2)) 
>> a*(length/dh*(mdot_4/(rho_gas*A_4))^2)) == P_2 +
>> 0.5*(mdot_3/(rho_gas*A_3))^2 +
>> (.015*(length/dh*((rho_gas*(mdot_3/(rho_gas*A_3))^2)/2)) 
>> a*(length/dh*(mdot_3/(rho_gas*A_3))^2)), (mdot_4/(rho_gas*A_4)) ==
>> (mdot_3/(rho_gas*A_3)) + D_3, (mdot_2/(rho_gas*A_2)) +
>> (mdot_3/(rho_gas*A_3)) == D_2, (mdot_1/(rho_gas*A_2)) ==
>> (mdot_2(rho_gas*A_2)) + D_1);
>
> Your errors come from the mdot_2(rho_gas*A_2) near the end.
>
> To search for such errors, it's usually a good idea to iteratively
> reduce the input little by little in this case, you could have started
> leaving out the first equation, leaving out the first and second
> equations, etc., each time checking if the error is still there.
Or define intermediate variables, like T1 = mdot_1/(rho_gas*A_1), T2 =
mdot_2/(rho_gas*A_2), etc. for terms that appear repeatedly in your
equations. This would also make your equations shorter and IMO easier to
read, which may help in validating that you're solving the equations you
think you are. [For example, in your last equation, is that supposed to be
mdot_1/(rho_gas*A_2) or should it be either T1 or T2? Nowhere else in your
code do the mdot subscript and the A subscript differ.]

Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
