matlab simultaneous equations question

7 ビュー (過去 30 日間)
Sasa
Sasa 2013 年 4 月 10 日
Hey Guys,
I am new to Matlab and i am having trouble getting this set of simultaneous equations to work, i have 7 equations and 7 variables and when i run the program matlab does not return an answer but i am pretty sure that this equation should have an answer, here is my code any help would be appreciated.
syms i_ph I_01 I_02 R_s a_1 a_2 R_p;
%a_1 = ((n_1*25)/1.6e-19);
%a_2 = ((n_2*25)/1.6e-19);
g_1 = -4.75e-4 + i_ph+ I_01*(exp((4.75e-4*R_s)/a_1)-1)-I_02*(exp((4.75e-4*R_s)/a_2)-1)-((4.75e-4*R_s)/R_p);
g_2 = -4.8964e-4 + i_ph+ I_01*(exp((0.15+4.8964e-4*R_s)/a_1)-1)-I_02*(exp((0.15+4.8964e-4*R_s)/a_2)-1)-((0.15+4.8964e-4*R_s)/R_p);
g_3 = -5e-4 + i_ph+ I_01*(exp((0.3+5e-4*R_s)/a_1)-1)-I_02*(exp((0.3+5e-4*R_s)/a_2)-1)-((0.3+5e-4*R_s)/R_p);
g_4 = -3.5775e-4 + i_ph+ I_01*(exp((0.45+3.5775e-4*R_s)/a_1)-1)-I_02*(exp((0.45+3.5775e-4*R_s)/a_2)-1)-((0.45+3.5775e-4*R_s)/R_p);
g_5 = -5.1839e-4 + i_ph+ I_01*(exp((0.5282+5.1839e-4*R_s)/a_1)-1)-I_02*(exp((0.5282+5.1839e-4*R_s)/a_2)-1)-((0.5282+5.1839e-4*R_s)/R_p);
g_6 = -5.2284e-4 + i_ph+ I_01*(exp((0.5822+5.2284e-4*R_s)/a_1)-1)-I_02*(exp((0.5822+5.2284e-4*R_s)/a_2)-1)-((0.5822+5.2284e-4*R_s)/R_p);
g_7 = i_ph+ I_01*((exp(0.6483)/a_1)-1)-I_02*((exp(0.6483)/a_2)-1)-((0.6483)/R_p);
solution = solve(g_1,g_2,g_3,g_4,g_5,g_6,g_7,i_ph,I_01,I_02,R_s,a_1,a_2,R_p);
solution.i_ph;
double(solution.i_ph);

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 4 月 10 日
When you use floating point values like that, then solve() is going to convert them into rational fractions for the purpose of finding a solution. However, the fraction it constructs is going to be based upon converting the double precision representation of values such as 1.69e-19 into fractions. Most of those numbers do not have exact binary representations, so the fractions are not going to be what you would expect. For example, 4.75e-4 is probably not going to be converted to 475/10000. So even if you managed to get a solution from solve() based upon those converted fractions, it would be the solution to a different problem then you thought you were posing.
You would probably be better off trying to use fsolve() if you have the Optimization Toolkit.

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by