# How to calculate a curve for different variables?

조회 수: 2 (최근 30일)
PhotovoltaicQuestion 2019년 8월 14일
답변: Are Mjaavatten 2019년 8월 15일
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.
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.

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

### 채택된 답변

Are Mjaavatten 2019년 8월 15일
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;

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

### 카테고리

Help CenterFile Exchange에서 Get Started with MuPAD에 대해 자세히 알아보기

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by