ODE45: ODE Error using odearguments must return a column vector
이전 댓글 표시
Hi, I have the following equation and I am trying to solve this for Tm. The size of Qinj_t is 10525X1. I have 10525 different data points and I want to get the Tm value for each point/timestep. All other parameters are constant except the Qinj_t . By using the following code I am getting error. Can anyone please help me out?
%% Auusmptions &constant parameters
n = 1.3581 % Capacity exponent for the unit
Tsu = 75; % [C] inlet temperature of the radiator
Tair = 21; % [C] Air temperature
C_rad = 5.7770e+04; % Total thermal capacity of radiator
C=10;
%% Time series data for Qinj
tQin = (0:0.0022805:24)';
step = 10524; %
tspan =[0 0.0022805];
t0 = 0; % Start time
t1 = 24; % Final time
t = linspace(t0 , t1 , (step+1));
%% Reading data from Excel sheet
[num txt raw] = xlsread('Radiator_sweep190.xlsx');
Qinj_t = num(:,4); (10525X1)
Qinj_td = interp1(tQin, Qinj_t, t, 'linear');
Tmo = 20 ;
[t,Tm] = ode45(@(t,Tm) rad_h(t, Tm, tQin, C_rad, Qinj_td, C, Tair, n ),tspan,Tmo);
Following function is used:
function dtmdt = rad_h(t, Tm, tQin, C_rad, Qinj_td, C, Tair, n )
dtmdt = 1/C_rad*((Qinj_td)- (C*(Tm-Tair).^n))
end
댓글 수: 4
Star Strider
2019년 4월 24일
I cannot run your code. However the problem is likely that you are passing ‘Qinj_td’ as a row vector rather than as individual elements in a loop. The same would also apply to the other vectors you are passing as arguments.
Haseeb
2019년 4월 24일
Star Strider
2019년 4월 24일
My pleasure.
It might help to know what you want to do.
Haseeb
2019년 4월 24일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!