Write array in a while loop
1 view (last 30 days)
Show older comments
I have this code.
while((abs(Tj_HS_cicle - Tj_HS)/Tj_HS_cicle))>epsilon && (n_iter <= n_iter_max) || (n_iter<2)
n_iter = n_iter + 1;
Tj_HS_cicle = Tj_HS;
Rds_HS= Rds_25_HS*(1+dX_dT(1)*(Tj_HS_cicle-25));
Vth_HS= Vth_25_HS*(1+dX_dT(2)*(Tj_HS_cicle-25));
gfs_HS= gfs_25_HS*(1+dX_dT(3)*(Tj_HS_cicle-25));
IgON = (Vdr - Vth_HS - (Specifiche(13)/gfs_HS))/Rgtot;
IgOFF = (Vth_HS + (Specifiche(14)/gfs_HS))/Rgtot;
ton = Qgsw_HS / IgON;
toff = Qgsw_HS / IgOFF;
Psw = 0.5*(Specifiche(1)+Vf)*Specifiche(9)*(ton*Specifiche(13) + toff*Specifiche(14));
Pcond = Rds_HS*Specifiche(5)*(Specifiche(3)^2)*(1+(1/12)*((Specifiche(23)/Specifiche(3))^2));
P_Coss = 0.5*Coss*Specifiche(9)*(Specifiche(1)^2);
P_gate = Qg_HS * Specifiche(9) * Vdr;
Prr = Qrr_HS * Specifiche(9) * Specifiche(1);
Pd_HS = Prr + P_gate + P_Coss + Psw + Pcond;
Tj_HS = Ta + R_teta_ja*Pd_HS;
end;
During the cicle the values of Tj_HS and Pd_HS are updates. I would write all values of Tj_HS and Pd_HS they have during the cicle in two array like Tj_HS_array and Pd_HS_array. I need these array because i want to plot both of them to show all while loop steps.
If there were a different function to realize my idea i would be happy to know how to realize it.
0 Comments
Answers (1)
Harshita Gupta
on 28 Mar 2019
Hello,
As per my understanding you want the arrays to plot the intermediate iteration results .I think these links should help you :
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!