how to optimize an input variable to a function to obtain a set point output variable?

2 views (last 30 days)
T_in_IC1 = 35;
T_in_DIC = 80;
T_in_a = 120;
[T_out_IC1,T_a_out_IC1] = IC1(m_w1,T_in_IC1,T_in_a);
T_a_in_IC2 = 23*T_a_out_IC1^0.5;
[T_out_IC2,T_a_out_IC2] = IC2(m_w1,T_out_IC1,T_a_in_IC2);
T_a_in_AC = 23*T_a_out_IC2^0.5;
[T_out_DIC] = DIC(m_w2,T_in_DIC,T_a_out_AC);
T_in_AC = T_out_DIC*(m_w1/(m_w1+m_w2)) + T_out_IC2*(m_w1/(m_w1+m_w2));
m_tot = m_w1 +m_w2;
[T_out_AC,T_a_out_AC] = AC(m_tot,T_in_AC, T_a_in_AC);
T_out_AC_sp = 90;
Diff = T_out_AC_sp - T_out_AC;
Basically, I want to write a code which gives me that value of m_tot for which Diff = 0, or close to 0; Also note that the input variables to AC are dependent on IC1,IC2, AND DIC. Also, one of the input to DIC1 is dependent on the output of AC

Answers (1)

Yogananda Jeppu
Yogananda Jeppu on 1 Oct 2017
Hi I am not sure I fully understand the question. What are IC1(), IC2() etc. They could be some complicated functions. You can look at fminsearch for any optimization. It works very help. Try the help for this function.
  1 Comment
Roshni Khetan
Roshni Khetan on 1 Oct 2017
Hi Yogananda! IC1, IC2, AC, and DIC1 are function which solve for the outputs using the inputs. Also, the outputs of IC1 serve as an input to IC2, and outputs of IC2 & DIC1 serve as an input to AC. Again, here is a little complexity - one of the output of AC serves as an input to DIC1

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!