How to calculate P at each x values?

조회 수: 1 (최근 30일)
MUNKHBOLOR BAIGALI
MUNKHBOLOR BAIGALI 2020년 9월 11일
답변: Ayush Gupta 2020년 9월 15일
Hello.
I tried to calculate P. Please help me
function [Tc, P] = myfun2()
Ppv_rated = 250;
G = [5.75, 6, 6.365, 6.5, 6.185, 5.75, 5, 4.8, 5.5, 6.18, 6.15, 5.8];
Gref = 1000;
Kt = -0.485;
Tref = 25;
Tamb = [25.63, 26.7, 26.610, 25.46, 24.9, 24.01, 23.16, 23.01, 23.54, 23.78, 24.45, 25.3];
x = [0 2 5 7 8 9 10];
for i = 1:length(x)
for j = 1:length(Tamb)
Tc(j)= Tamb(j) + 0.0256*G(j);
P(i,j) = Ppv_rated*x(i)*(G(j)/Gref)*(1+Kt*(Tc(j)-Tref));
end
end
But Result is
The results is correct. BUT I want to calculate like this:
x1 = 0
P1 = Ppv_rated * x1 * (G1/Gref) * (1 + Kt * (Tc1 -Tref))
P2 = Ppv_rated * x1 * (G2/Gref) * (1 + Kt * (Tc2 -Tref))
...
...
P12 = Ppv_rated * x1 * (G12/Gref) * (1 + Kt * (Tc12 -Tref))
x2 = 2
P1 = Ppv_rated * x2 * (G1/Gref) * (1 + Kt * (Tc1 -Tref))
P2 = Ppv_rated * x2 * (G2/Gref) * (1 + Kt * (Tc2 -Tref))
...
...
P12 = Ppv_rated * x1 * (G12/Gref) * (1 + Kt * (Tc12 -Tref))
x7 = 10
P1 = Ppv_rated * x7 * (G1/Gref) * (1 + Kt * (Tc1 -Tref))
P2 = Ppv_rated * x7 * (G2/Gref) * (1 + Kt * (Tc2 -Tref))
...
...
P12 = Ppv_rated * x7 * (G12/Gref) * (1 + Kt * (Tc12 -Tref))
How do I do??? PLEASE HELP !!!

답변 (1개)

Ayush Gupta
Ayush Gupta 2020년 9월 15일
The problem with the approach suggested above is only the values of last iteration of x will be stored in P values. So, to keep the record of all iterations previously, refer to this code:
P(j,i) = Ppv_rated*x(i)*(G(j)/Gref)*(1+Kt*(Tc(j)-Tref));

카테고리

Help CenterFile Exchange에서 LEGO MINDSTORMS EV3 Hardware에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!