Write array in a while loop

조회 수: 1 (최근 30일)
Francesco Tancredi
Francesco Tancredi 2019년 3월 25일
답변: Harshita Gupta 2019년 3월 28일
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.

답변 (1개)

Harshita Gupta
Harshita Gupta 2019년 3월 28일
Hello,
As per my understanding you want the arrays to plot the intermediate iteration results .I think these links should help you :

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by