Tuesday, 15 June 2010

iteration - MATLAB While loop for convergence -


I am trying to write a loop request for a while, as if my value converts when it stops. When the new value is only 1% different from the last, I want the code to be closed. Here are the interactive relationships:

change

And here's my Code thus far:

 % values ​​clear all CLC TT4 = 3250 pi_c = 25 alpha = 0.5 M_0 = 1.6 h = 40 t0 = 390.01 a_0 = 967.68 g_c = 1.4 g_t = 1.3 CPC = 0.24 Cpt = 0.296 h_pr = 18400 M_6 = 0.4 pi_Mmax = 0.96 eta_m = 0.99 eta_b = 0.99 table% 6.2 pi_dmax = 0.96 e_c = .9 e_f = .89 pi_b = 0.95 eta_b = 0.999 e_t = 0.89 pi_n = 0.97 eta_m = 0.995% calculation R_c = ((g_c-1) / g_c) * CPC R_t = ((g_t -1) / g_t) * Cpt V_0 = a_0 * M_0 tao_r = 1 + ((g_c-1) / g_c) * M_0 ^ 2 pi_r = tao_r ^ (g_c / (g_c -1)) eta_r = 1-0.075 * (M_0-1) ^ 1.35 pi_d = pi_dmax * eta_r tao_l = (CPT * TT4) / (CPC * T0) tao _c = pi_c ^ ((g_c-1) / (g_c * e_c)) eta_c = (pi_c ^ ((g_c-1) / g_c) -1) / (tao_c-1) f = (tao_l-tao_r * tao_c) / ((eta_b * h_pr) / (CPC * T0) -tao_l)% recycle tao_f tao_f = (tao_r * (alpha (tao_c -1)) + eta_m * (1 + f) * tao_l) / (tao_r * alpha + Eta_m * (1 + f) * Tao_l / ((pi_c * pi_b) ^ ((G_t-1) * e_t / g_t))) tao_fi = (tao_r * (alpha (tao_c -1)) + eta_m * (1 + f) * tao_l) / ((tao_r * alpha + eta_m * (1 + f) * Tao_l / ((Pi_c * Pi_b). ^ ((G_t -1) * ET / Ji_ti))) * (Tao_f). (* (GCM * (Ji_ti -1) * * I_ti I_f) / Ji_ti * ( GC-1)) - 1)) while ABS (Tao_F) - (Tao_fi)) .2 tao_ff = (tao_r * (alpha (tao_c-1)) + eta_m * (1 + f) * tao_l) / ((tao_r * alpha + eta_m * (1 + f) * tao_l / ((pi_c * pi_b) . ^ ((G_T-1) * E_T / G_T) * * (Tao_F). ^ ((((* (G_c * (g_t-1) * e_t * e_f) / g_t * (g_c-1)) - 1)) end  

I'm new to matlab and coding in general, I know that my code is stuck in the infinite loop but I'm not sure why.

Any help appreciated!


No comments:

Post a Comment