Wednesday, 15 January 2014

symbolic math - Matlab 2012b too slow when solving a system of two equations on mupadmex(statement) -



symbolic math - Matlab 2012b too slow when solving a system of two equations on mupadmex(statement) -

i'm trying solve scheme of 2 non-linear equations in matlab in loop. aware loop may cause programme run slow right takes around hr 1 instance solved. on debugging code, realized line causes programme hang:

[res,status] = mupadmex(statement);

if terminate programme following:

operation terminated user during mupadengine/evalin (line 97) in mupadengine/feval (line 150) [s,err] = evalin(engine,stmt); in solve (line 160) sol = eng.feval('symobj::solvefull',eqns,vars); in algorithm2 (line 139) reply = solve (f , g);

where line 97 refers same line of code. here's section of code phone call solve function:

syms ro1 t_prime1 assume(t_prime1 > 0) i=1:1:length(n1ps) n1p = n1ps(1,i); n2p = n2ps(1,i); w1 = (ro1/theta_p)*(1-exp((-1)*theta_p*t_prime1)); w2 = exp((-1)*theta_p*t_prime1); w3 = (ro1/theta_p)*(1-exp((-1)*theta_p*t1))-q(1,1); w4 = (1-exp((-1)*n1p*theta_p*t1))/(1-exp((-1)*theta_p*t1)); w5 = exp((-1)*theta_p*(t1-t_prime1)); q1 = (w1 + w2*w3*w4)*w5 - q(1,1); w6 = ((ro-ro1)/theta_p)*(1-exp((-1)*theta_p*(n1p*t1 + t_prime1 - n2p*t2))); w7 = exp((-1)*theta_p*(n1p*t1 + t_prime1 - n2p*t2)); w8 = ((ro-ro1)/theta_p)*(1-exp((-1)*theta_p*t2))-q(1,2); w9 = (1-exp((-1)*n2p*theta_p*t2))/(1-exp((-1)*theta_p*t2)); w10 = exp((-1)*theta_p*(t2-(n1p*t1 + t_prime1 - n2p*t2))); q2 = (w6 + w7*w8*w9)*w10 - q(1,2); q1_prime = q(1,1)*((exp((tn1 - n1p - 1)*theta_p*t1)-1)/(1-exp((-1)*theta_p*t1))); q2_prime = q(1,2)*((exp((tn2 - n2p - 1)*theta_p*t2)-1)/(1-exp((-1)*theta_p*t2))); f=q1_prime-q1; g=q2_prime-q2; reply = solve (f , g); end

matlab symbolic-math mupad

No comments:

Post a Comment