Skip to content
Snippets Groups Projects
Commit 98377c8e authored by Felix Kong's avatar Felix Kong
Browse files

rename to dmd_vortex

parent b6163f4f
No related merge requests found
%% Dynamic Mode Decomposition (DMD) on Vortex Data
% This example is from Kutz et. al's Dynamic Mode Decomposition book
% I have written a class to make the DMD code easier to use.
% Step 0: Load data
clear all, close all, clc clear all, close all, clc
load data/VortexData.mat % loads variables VORTALL, nx, ny load data/VortexData.mat % loads variables VORTALL, nx, ny
% initialize DMD object % Step 1: initialize DMD object with data
verbose = true; % print how long things take verbose = true; % print how long things take
vortex_dmd = dmd(VORTALL,verbose); vortex_dmd = dmd(VORTALL,verbose);
% perform DMD regression on data % Step 2: perform DMD regression on data
truncation_rank = 21; % rank to truncate reduced dynamics to truncation_rank = 21; % rank to truncate reduced dynamics to
vortex_dmd.regression(truncation_rank); vortex_dmd.regression(truncation_rank);
% reconstruct VORTALL(:,2:end) using DMD approximation % Step 3: reconstruct VORTALL(:,2:end) using DMD approximation
X2hat = vortex_dmd.reconstruct(); % not used in the script X2hat = vortex_dmd.reconstruct(); % not used in the script
% use predict() to reconstruct the data a different way % Step 3 (alternate method):
% values may differ very slightly from X2hat % use predict() to reconstruct the data instead of reconstruct()
% values may differ slightly from X2hat if truncation_rank isn't full
initial_condition = VORTALL(:,1); initial_condition = VORTALL(:,1);
num_timesteps = size(VORTALL,2); % could use predict() for more timesteps too num_timesteps = size(VORTALL,2); % could use predict() for more timesteps too
xhat = vortex_dmd.predict(initial_condition,num_timesteps); xhat = vortex_dmd.predict(initial_condition,num_timesteps);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment