How plot graph with loop over existing graph on new figure

조회 수: 1 (최근 30일)
Vinay Sharma
Vinay Sharma 2020년 5월 8일
댓글: Ridzuan Rashid 2023년 12월 27일
clc;
clear all;
K = 1.38065*10^-23; %Boltzmann constant
q = 1.602 *10^-19; %charge of electron
Iscn = 8.21; %Nominal SC current
Vocn = 34.9; %Nominal OC voltage
Kv = -0.123; %Temperature voltage constant
Ki = 0.0032; %Temperature current constant
Ns = 54; %no. of series connected cells
T = 25+273; %operating temperature
Tn = 25+273; %nominal temperature
Gn = 1000; %Nominal Irradiance
a = 1.3; %diode ideality constant
Eg = 1.12; %Band gap of silicon at 25 degree Celsius
G = 1000; %Actual Irradiance
Rs = 0.221; Rp = 415.405;
for n=0:5
G = G+100;
Vth = Ns*(K*Tn/q);
Ion = Iscn/((exp(Vocn/(a*Vth)))-1);
Io = Ion*((Tn/T)^3)*exp(((q*Eg/(a*K))*((1/Tn)-(1/T))));
Ipvn = Iscn;
Ipv = (Ipvn + Ki*(T-Tn))*(G/Gn);
Vt = Ns*(K*T/q);
I = zeros (330,1); i = 1; I(1,1)=0;
for V=0:0.1:34.9
I_part = Io*(exp((V+(I(i,1)*Rs))/(Vt*a))-1) + ((V+(Rs*I(i,1)))/Rp);
I(i+1) = Ipv - I_part;
V1(i)=V;
P(i)= V*I(i);
i=i+1;
end V1(i)=V1(i-1);
P(i) = P(i-1);
V1=transpose(V1);
hold on xlabel('output voltage'); ylabel('output power');
plot(V1,P,"linewidth",3);
end
hold off
  댓글 수: 4
Mehmed Saad
Mehmed Saad 2020년 5월 8일
Something like this
Vinay Sharma
Vinay Sharma 2020년 5월 8일
Yess , how you did , guide please

댓글을 달려면 로그인하십시오.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 5월 8일
편집: KALYAN ACHARJYA 2020년 5월 8일
K = 1.38065*10^-23; %Boltzmann constant
q = 1.602 *10^-19; %charge of electron
Iscn = 8.21; %Nominal SC current
Vocn = 34.9; %Nominal OC voltage
Kv = -0.123; %Temperature voltage constant
Ki = 0.0032; %Temperature current constant
Ns = 54; %no. of series connected cells
T = 25+273; %operating temperature
Tn = 25+273; %nominal temperature
Gn = 1000; %Nominal Irradiance
a = 1.3; %diode ideality constant
Eg = 1.12; %Band gap of silicon at 25 degree Celsius
Gvalue =1000; %Actual Irradiance
Rs = 0.221;
Rp = 415.405;
G=0;
for n=0:4
G = G +100;
Vth = Ns*(K*Tn/q);
Ion = Iscn/((exp(Vocn/(a*Vth)))-1);
Io = Ion*((Tn/T)^3)*exp(((q*Eg/(a*K))*((1/Tn)-(1/T))));
Ipvn = Iscn;
Ipv = (Ipvn + Ki*(T-Tn))*(G/Gn);
Vt = Ns*(K*T/q);
I = zeros (330,1); i = 1; I(1,1)=0;
for V=0:0.1:34.9
I_part = Io*(exp((V+(I(i,1)*Rs))/(Vt*a))-1) + ((V+(Rs*I(i,1)))/Rp);
I(i+1) = Ipv - I_part;
V1(i)=V; P(i)= V*I(i); i=i+1;
end
V1(i)=V1(i-1);
P(i) = P(i-1);
V1=transpose(V1);
xlabel('output voltage');
ylabel('output power');
plot(V1,P,'linewidth',3);
hold on
grid on;
end
If you are looking for different figure, then
K = 1.38065*10^-23; %Boltzmann constant
q = 1.602 *10^-19; %charge of electron
Iscn = 8.21; %Nominal SC current
Vocn = 34.9; %Nominal OC voltage
Kv = -0.123; %Temperature voltage constant
Ki = 0.0032; %Temperature current constant
Ns = 54; %no. of series connected cells
T = 25+273; %operating temperature
Tn = 25+273; %nominal temperature
Gn = 1000; %Nominal Irradiance
a = 1.3; %diode ideality constant
Eg = 1.12; %Band gap of silicon at 25 degree Celsius
Gvalue =1000; %Actual Irradiance
Rs = 0.221;
Rp = 415.405;
G=0;
for n=0:4
G = G +100;
Vth = Ns*(K*Tn/q);
Ion = Iscn/((exp(Vocn/(a*Vth)))-1);
Io = Ion*((Tn/T)^3)*exp(((q*Eg/(a*K))*((1/Tn)-(1/T))));
Ipvn = Iscn;
Ipv = (Ipvn + Ki*(T-Tn))*(G/Gn);
Vt = Ns*(K*T/q);
I = zeros (330,1); i = 1; I(1,1)=0;
for V=0:0.1:34.9
I_part = Io*(exp((V+(I(i,1)*Rs))/(Vt*a))-1) + ((V+(Rs*I(i,1)))/Rp);
I(i+1) = Ipv - I_part;
V1(i)=V; P(i)= V*I(i); i=i+1;
end
V1(i)=V1(i-1);
P(i) = P(i-1);
V1=transpose(V1);
figure, plot(V1,P,'linewidth',3);
grid on;
xlabel('output voltage');
ylabel('output power');
end
  댓글 수: 5
Vinay Sharma
Vinay Sharma 2020년 5월 8일
편집: Vinay Sharma 2020년 5월 8일

Thank you sir , My problem is solved I used "hold on" after the "plot" then i use saveas command to save each plot

H=figure()

For ....

....

Plot(...)

Hold on

Saveas(h,sprintf("fig%d.png",n));

End

Ridzuan Rashid
Ridzuan Rashid 2023년 12월 27일
hi can i ask question. why i have error using plot must be same lenght if i change the value Vocn. please someone help me.thankyou
clc;
clear all;
K = 1.38065e-23; %Boltman Constants
q = 1.602e-19; %charge of electron
Iscn = 1.80; %Nominal SC current
Vocn = 21.6; %Nominal OC Voltage
Kv = -0.123; %Temperature voltage constant
Ki = 0.0032; %Temperature Current constant
Ns = 36; %n0. of serries connected cells
T = 29+273; %operating temperature
Tn = 25+273; %Nominal temperature
Gn = 1000; %Nominal irrandiace
a = 1.3; %diode ideality constant
Eg = 1.12; %ban gap of silicon at 25 degree celcius
G = 1000; %actual irradiation
Rs = 0.221;
Rp = 415.405;
Vtn = Ns*(K*Tn/q);
Ion = Iscn/ ((exp(Vocn/(a*Vtn)))-1)
Io = Ion*((Tn/T)^3)*exp(((q*Eg/(a*K))*((1/Tn)-(1/T))));
Ipvn = Iscn;
Ipv = (Ipvn + Ki*(T-Tn))*(G/Gn)
Vt = Ns*(K*T/q);
I = zeros(330,1);
i=1;
I(1,1)=0;
for V=21.6:-0.1:0
I_part = Io*(exp((V+(I(i,1)*Rs))/(Vt*a))-1) + ((V+(Rs*I(i,1)))/Rp);
I(i+1) = Ipv - I_part;
V1(i)=V;
P(i)=V*I(i);
i=i+1;
end
V1(i)=V1(i-1);
P(i) = P(i-1);
V1=transpose(V1);
% subplot(3,1,1)
plot(V1,I);
%subplot(3,1,2)
xlabel("Voltage")
ylabel("Current")
%plot(V1,P);
%subplot(3,1,3)
%plot (V1,I_part);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by