matrix dimension must agree and the size is different on left and right side. I need to iterate to observe cooling. Please help !

조회 수: 4 (최근 30일)
R_in =[0.02;1.0]; %total E Resistance
Keff = 1.5e-3; % W/K
rho = 10e-6; % ohm.meter
Sab = 200e-6; % Volt per Kelvin
N = [75];
% Ti = 200; % intiial temp
% Hhx = 0.004; % heat transfer Coef forced Air circulation
Ta = [50;10] ; % cooling side or being pumped in Kelvin
alpha =220e-6;% V/Keff seebecKeff coeff
I_in = [2:30];
V_in = [2:30];
W = V_in.*I_in;
T_pump_cold = 200.15; % final required temperature
T_sink = 173.15;
Tb = 298.15; % hot side initial temperature
DT = T_pump_cold - T_sink;
dx = 0.04; % in m
Q_c = 2*N*((Sab*T_pump_cold.*I_in) - 2*N*((Keff*rho)./R_in)*(DT)-0.5*(I_in.^2).*R_in)
COP = Q_c/W;
A_cr = 0.00002; % in m2
t(1) =1;
T(1)=T_pump_cold ;
Time2=(1:t:12); hours
for j = (1:t:1000)
[T(j+1)] = ((dx.*Q_c)./Keff.*Time2.*A_cr)+T(j);
end

답변 (1개)

Rushil
Rushil 2025년 2월 20일
편집: Rushil 2025년 2월 20일
Hello
While running the code, I encountered an error in the following line:
[T(j+1)] = ((dx.*Q_c)./Keff.*Time2.*A_cr)+T(j);
This happens because the size of “Q_c” is [2x29] and “Time2” is [1x12]. In the above line, the code attempts to multiply “Q_c” and “Time2”. This is not valid because their dimensions do not align for element-wise operations.
A possible way to treat this issue is to choose a fixed value of "Q_c" and model "T" in a slightly different way. Here is some code that shows you how it could be done (it iterates over the length of "Time2" instead):
Q_c_value = Q_c(1, 1); % example: using the first element
for j = 1:length(Time2)
T(j+1) = ((dx * Q_c_value) ./ Keff * A_cr) * Time2(j) + T(j);
end
Hope you are able resolve the issue.

카테고리

Help CenterFile Exchange에서 Thermal Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by