Info
This question is closed. Reopen it to edit or answer.
how to solve error of subscripted dimension mismatch?
1 view (last 30 days)
Show older comments
% the code works for one iteration and stops at column 27 for the second iteration
T_air_DIC1 = [];
i =1;
T_air_DIC1(1) = 78; %input('input the lowest possible value of T_air_in_DIC1 in Celsius');
T_air_DIC1_max = 94; %input('input the maximum possible value of T_air_in_DIC1 in Celsius');
k = T_air_DIC1_max - T_air_DIC1(1);
no_data_pt = k+1;
c =2;
max_temp = T_air_DIC1_max+1;
%%finding water flow rates for different inlet air temp.'s to DIC1 to obtain the required set point temperatures
while T_air_DIC1(i) < max_temp
guess1 = 3.5; %input('a expected guess flow rate for water into IC1');
guess2 = 1.5; %input('a expected guess flow rate for water into DIC1');
x0 = [guess1,guess2];
x = fsolve(@(x)LPCA1_ctrlscheme(x,T_air_DIC1(i),T_sp_AC,T_sp_DIC1,T_0,P_0,RH_0,P_out,Flow_required),x0);
m_wat_DIC1(i) = x(2);
m_wat_IC1(i) = x(1);
m_wat_AC(i) = x(1) + x(2);
[P,T,T_w_out,T_w_in,Q,RH] = LPCA1ctrlschemenew(x(1),x(2),T_air_DIC1,...
T_sp_AC,T_sp_DIC1,T_0,P_0,RH_0,P_out,Flow_required);
% while c <no_data_pt+1
DataSummary(c,1) = T_0;
DataSummary(c,2) = P_0/1000;
DataSummary(c,3) = RH_0;
index = length(T); % T is a vector in the compressor file which has all the temperature state points
DataSummary(c,4:3+index) = T; % 3+index is the last column where Temp. state point value is stored,
%it begins from 4 & cotinues till 11
%DataSummary(c,4+index:3+index*2) = P; % from 12 to 19
DataSummary(c,12:19) = P;
%DataSummary(c,4+index*2:3+index*3) = RH; % from 20 to 27
DataSummary(c,20:27) = RH; % from 20 to 27
ind = length(T_w_out);
% DataSummary(c,4+index*3:ind+3+index*3) = T_w_out; % temp. of water leaving the HEXs from 28 to 30
DataSummary(c,28:30) = T_w_out;
%DataSummary(c,1+ind+3+index*3:ind +ind+3+index*3) = T_w_in; % temp. of water entering the HEXs from 31 to 33
DataSummary(c,31:33) = T_w_out;
DataSummary(c,34:36) = Q/1000; % heat recovered across the compressor HEXs
DataSummary(c,37) = m_wat_DIC1(i); % flow rate of water through DIC1 (kg/sec)
DataSummary(c,38) = m_wat_IC1(i); % flow rate of water through IC1 (kg/sec)
DataSummary(c,39) = m_wat_AC(i); % flow rate of water through AC(kg/sec)
DataSummary(c,40) = T_air_DIC1(i); % temp. of air entering DIC1(C)
i = i+1;
c = c+1;
T_air_DIC1(i) = T_air_DIC1(i-1) + 1;
end
1 Comment
OCDER
on 2 Oct 2017
Post the full error message, which should show the line number where the error occurred. That way, we don't have to figure out where in the code is causing an issue.
Also, use the {} Code button to make your code readable like this:
function a = dispThis(b)
disp(b)
end
We can't read that code you posted until someone has edit capabilities.
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!