MATLAB Answers

0

How to calculate a curve for different variables?

Asked by PhotovoltaicQuestion on 14 Aug 2019
Latest activity Answered by Are Mjaavatten on 15 Aug 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.

  0 Comments

Sign in to comment.

Products


Release

R2019a

1 Answer

Answer by Are Mjaavatten on 15 Aug 2019
 Accepted Answer

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;

  0 Comments

Sign in to comment.