How to calculate a curve for different variables?

2 vues (au cours des 30 derniers jours)
PhotovoltaicQuestion
PhotovoltaicQuestion le 14 Août 2019
I have a function : Current = msx60iScript(V,Suns,Temperature), which is dependant on 3 variables; Voltage, Suns, and Temperature.
As temperature and suns are time dependant functions, I have created 2 vectors which give the temp and irradiance at each time:
Sunrise = -2.1749
Sunset = 11.0372
Time = linspace(Sunrise,Sunset,200)
Temperature = -abs(0.333333333333333.*(Time-5.83))+27.22
Suns = (293.*sin(0.3692.*Time+6.218)+223.6)./1000
I have also created a vector: Voltage as follows:
V = linspace(30,70)
I want to obtain the Voltage v Current data for each time specified above.
-- More info--
I want to obtain the Current v Voltage data for each time in order to calculate the maximum power at each time, and then calculate efficiency.
If anyone has any ideas about how to do this, I would be very grateful.

Réponse acceptée

Are Mjaavatten
Are Mjaavatten le 15 Août 2019
Here is one way to do it. I have reduced the number of elements in your Time and V vectors in order to make a nicer surface plot.
Sunrise = -2.1749;
Sunset = 11.0372;
Time = linspace(Sunrise,Sunset,50);
msx60iScript = @(V,S,T) sin((V-30)/20+2*S)*log(S+5)*T; % Dummy function
V = linspace(30,70,50);
P = zeros(length(Time),length(V));
maxPower = zeros(size(Time));
maxVoltage = zeros(size(Time));
for k = 1:length(Time);
Temperature = -abs(0.333333333333333.*(Time(k)-5.83))+27.22;
Suns = (293.*sin(0.3692.*Time(k)+6.218)+223.6)./1000;
Current = msx60iScript(V,Suns,Temperature); %Must return vector size of V
Power = V.*Current;
[maxPower(k),index] = max(Power);
maxVoltage(k) = V(index);
P(k,:) = Power;
end
figure(1);
subplot(211);plot(Time,maxPower);xlabel Time;ylabel('Max power')
subplot(212);plot(Time,maxVoltage);xlabel Time;ylabel('Corresponding voltage')
figure(2);
surf(V,Time,P); xlabel Voltage;ylabel Time; zlabel Power;

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MuPAD dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by