MATLAB Answers

How to handle big data while using ODE45

1 view (last 30 days)
Telema Harry
Telema Harry on 23 Jun 2021
Hello Programmers,
I have a challenge that I will like to solve.
I am using weather data for my simulation. The challenge is, a 1 hour data is about 6.5 G and I need to run my simulation using 24 hours worth of data. It is almost impossible to read all these data at once.
My plan is to read the weather data one at a time, i.e. read the first data use it for my simulation, discard it to free of memory and read the next data. I was able to execute this plan in the discrete system. And the code worked fine
%% Import and modify wind data
Files = 'C:\Weather Data\g*.nc'; % list all files with extension .nc
Ncfiles = dir(Files); % Identify all files in the folder with .nc extension
N = length(Ncfiles);
No_Runs = 1000;
Run_Time = No_Runs/dt;
tF = N * Run_Time;
for q = 1: N
if q == 1
t0 = 1;
Hour = Run_Time;
if exist('wind','var') ~= 1
wind = RawData(q);
end
else
t0 = k+1;
Hour = k + Run_Time;
wind = RawData(q);
end
for k = t0:Hour
... % Sets of equations
...
end
end
I am now solving sets of ODE using ODE45.
I can easily solve the model using the first weather data i.e. the weather data corresponding to 1.00 PM.
I will like the the next weather data to load after the program has run for 3600 seconds.
Thank you for your help.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!