Hi,
I'm trying to simulate the code for choosing range of voltage and current. When I simulate and input the data (V and I are 3000×1 double).
The code is
function [V, I] = casechoose(V2,I2,V_drop_loc,Region,Isc_step)persistent V2_full I2_full V2_half I2_half Isc_step_2 Isc_ratio I_shade2 V_shade2if isempty(V2_full) V2_full = []; I2_full = []; V2_half = []; I2_half = []; Isc_step_2 = 0; Isc_ratio = 0; I_shade2 = []; V_shade2 = [];endif isempty(I2_full) I2_full = 0;enddatatype = 'double'%%Find Isc_step_2
V2_full = V2(V2<0.9*(V2(end)) & V2>0.6*(V2(end))); % filter V2 value to be in 60-90% range of Voc
I2_full = I2(V2<0.9*(V2(end)) & V2>0.6*(V2(end))); % filter I2
V2_half = V2(V2<0.9*(V2(end)/2) & V2>0.6*(V2(end)/2)); I2_half = I2(V2<0.9*(V2(end)/2) & V2>0.6*(V2(end)/2));I_shade2 = I2(V_drop_loc:end,:);V_shade2 = V2(V_drop_loc:end,:); Isc_step_2 = I_shade2(1);Isc_ratio = Isc_step/Isc_step_2; % Isc_ratio as Main criteria
%%check the region
% Region = 1 (P_Gmppt is on LHS of the curve)
% Region = 2 (P_Gmppt is on RHS of the curve)
% Region 1
if Region ==1; if Isc_ratio < 1 % case1
V = V2_full; I = I2_full; else V = V2_half; % case2
I = I2_half; endelse if Isc_ratio > 1 % Region 2
V = V2_half; % case3
I = I2_half; else V = V2_full; % case4
I = I2_full; endend
Sorry it's a long code
The error that I get is
Output 'V' has variable size but the upper bound is not specified; explicit upper bound must be provided.
There's an error on size of the outputs V and I. I've tried setting the data in "Edit data" panel but does not work.
Any suggestion so far? Thank you so much in advance
Best Answer