for loop that loops through a changing paramter of ode45
Afficher commentaires plus anciens
I am trying to loop through a column of data that is a parameter (bolded below) in my ODE45 function. I keep getting the error "Unable to perform assignment because the size of the left side is 8760-by-1 and the size of the right side is 8760-by-2." I'm a bit stuck on where I am causing the error and how to fix it.
CIMIS = importdata('temps.csv'); % 8760 by 1
Y0 = [10,15]; % initial conditions (degrees celcius)
tspan = linspace(0,86400,8760);
T = zeros(8760,17520); % preallocating matrix for ODE output
t = zeros(8760,8760);
for i = 1:8760
To(i) = CIMIS(i);
[t(:,i),T(:,i)] = ode45('temp',tspan,Y0); % calling function and solving DEs
end
% function [Tdot] = temp(t,T)
% global ca h U To m Io R cm
%
% Tdot(1) = (1/ca).*(h.*(T(2)-T(1)) - U.*(T(1) - To)); % equation for temp of greenhouse air
%
% Tdot(2) = (1/cm).*(m.*Io - h.*(T(2) - T(1)) - R); % equation for temp of thermal mass
%
% Tdot = Tdot'; % row vectors into column vectors
% end
Réponses (1)
darova
le 4 Mai 2020
0 votes
Here is the problem

Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!