vpa command for solving a root(), after solve() command
Show older comments
Hi,
I'm trying to find the optimum T in the following equation:
n_ov = ((alf_eff * (2 * pi * sigG^2 * C_max * K * (1 - exp( (-r^2) / (2 * sigG^2) ))) - eps_eff * r^2 * sigB * T^4 - (B*(T-T_l)) / P_in) * (1 - T_l / T))
First I derive T;
dT = diff(n_ov, T)
To find the optimum T, I search T where dT = 0.
T_opt = solve(dT == 0, T)
I got the following results:
root(4*P_in*r^2*sigB*z^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z^4*exp(r^2/(2*sigG^2)) + B*z^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z, 1)
root(4*P_in*r^2*sigB*z^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z^4*exp(r^2/(2*sigG^2)) + B*z^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z, 2)
root(4*P_in*r^2*sigB*z^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z^4*exp(r^2/(2*sigG^2)) + B*z^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z, 3)
root(4*P_in*r^2*sigB*z^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z^4*exp(r^2/(2*sigG^2)) + B*z^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z, 4)
root(4*P_in*r^2*sigB*z^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z^4*exp(r^2/(2*sigG^2)) + B*z^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z, 5)
For this I now I can use the vpa command. I did the same as explained in the matlab documentation vpa() .
So I just try to solve T_opt with the vpa command
T_opt_vpa = vpa(T_opt)
This returns me exactly the same as I just tried with the solve() command, the only difference is that z now z1 is.
root(4*P_in*r^2*sigB*z1^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z1^4*exp(r^2/(2*sigG^2)) + B*z1^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z1, 1)
root(4*P_in*r^2*sigB*z1^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z1^4*exp(r^2/(2*sigG^2)) + B*z1^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z1, 2)
root(4*P_in*r^2*sigB*z1^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z1^4*exp(r^2/(2*sigG^2)) + B*z1^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z1, 3)
root(4*P_in*r^2*sigB*z1^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z1^4*exp(r^2/(2*sigG^2)) + B*z1^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z1, 4)
root(4*P_in*r^2*sigB*z1^5*exp(r^2/(2*sigG^2)) - 3*P_in*T_l*r^2*sigB*z1^4*exp(r^2/(2*sigG^2)) + B*z1^2*exp(r^2/(2*sigG^2)) - 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi*exp(r^2/(2*sigG^2)) + 2*C_max*K*P_in*T_l*alf_eff*sigG^2*pi - B*T_l^2*exp(r^2/(2*sigG^2)), z1, 5)
Anybody an idea what I'm doing wrong? Thanks in advance
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers 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!