資源簡介
進行模態分析的MATLAB程序,包括本征正交分解和動態模態分解
代碼片段和文件信息
clear;clf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?Higham?J.E.?Brevis?W?&?Keylock?C.J.?(2018)?
%?Implications?of?the?selection?of?a?particular?modal?decomposition?technique?for?the?analysis?of?shallow?flows?
%?Journal?of?Hydraulic?Research
%?Taylor?and?Francis
%?10.1080/00221686.2017.1419990?
%?Any?questions?email?jonny.e.higham@gmail.com
%%%%%%%%%%%%%%%%%%%?USAGE?%%%%%%%%%%%%%%%%%%%%%%
%?When?the?data?is?input?the?POD?modes?will?be?calculated?after?which?you
%?are?promped?with?a?window?to?choose?the?frequency?highlighted?in?the
%?particular?POD?mode?which?you?would?like?the?DMD?algorithm?to?extract.?
%%%%%%%%%%%%%%%%%%?EXAMPLES?%%%%%%%%%%%%%%%%%%%%
%?Here?we?provide?two?examples?‘cylinder‘?&?‘groyne‘?change?by?either?using
%?‘cylinder‘?or?‘groyne‘;
%?Chose?the?cylinder?example?for?one?velocity?component?and?the?groyne?for
%?two?velocity?components?(this?can?easily?be?extended?to?three?components
%%%%%%%%%%%%%%%%%%??INPUT??%%%%%%%%%%%%%%%%%%%%%
freq?=?5;?%Hz;?aquisition?frequency
example?=?‘cylinder‘;?%?input?case?(cylinder?/?groyne)?
mode=2;?%?which?mode?to?plot?and?extract?DMD?from
%%%%%%%%%%%%%%%%%%%?script?%%%%%%%%%%%%%%%%%%%%%
%?Import?the?images?from?folder.?The?colour?images?are?converted?to
%?grayscale.?
data?=?[];
if?strcmp(example‘cylinder‘)
????directory?=?‘data_cylinder‘;
????count?=?1;
????while?exist(sprintf(‘%s/B_%0.4d.bmp‘directorycount))?~=?0????%?exist?檢驗變量或文件是否存在??sprintf?格式化輸出
????????data(::count)?=?imread(sprintf(‘%s/B_%0.4d.bmp‘directorycount));?%?imread?圖像讀入
????????count?=?count?+1;
????end
????r?=?size(data1);?c?=?size(data2);
????%?Transform?the?data?into?column?vectors.
????data=reshape(datar*csize(data3));????%??data?重構出?r*c?X?size(data3)的?矩陣
end
if?strcmp(example‘groynes‘)
????directory?=?‘data_groynes‘;
????count?=?1;
????while?exist(sprintf(‘%s/PIV_%0.4d.mat‘directorycount))?~=?0
????????load(sprintf(‘%s/PIV_%0.4d.mat‘directorycount))
????????data_u(::count)?=?u;
????????data_v(::count)?=?v;
????????count?=?count?+1;
????end
????r?=?size(data_u1);?c?=?size(data_u2);
????%?Transform?the?data?into?column?vectors.
????data=[reshape(data_ur*csize(data_u3));reshape(data_vr*csize(data_v3))];
end
%%%%%%%%%%%%%%%%%%%?POD?%%%%%%%%%%%%%%%%%%%%%%
%?Perform?the?POD?-?this?is?mean?subtracted?for?POD?not?for?DMD
[Phi?~?C]=svd(data-repmat(mean(data2)?[1?size(data2)])‘econ‘);??%?repmat?復制平鋪矩陣??mean(data2)為行平均的列向量
??????????????????????????????????????????????????????????????????????%?奇異值分解(精簡分解)
????????????
評論
共有 條評論