odmd icon indicating copy to clipboard operation
odmd copied to clipboard

Matrix dimensions must agree.

Open jodyngo opened this issue 5 years ago • 3 comments

I am running the code and the program shows below error

Error using .* Matrix dimensions must agree.

Error in OnlineDMD/initialize (line 86) Xq = Xq.*weight;

Error in online_demo (line 79) odmd.initialize(x(:,1:q),y(:,1:q));

Could you please help me resolve it!

jodyngo avatar Oct 21 '19 08:10 jodyngo

Try Xq = Xq * weight? I did not seem to find the <.*> operation in my code, could you please direct me to the line of code?

haozhg avatar Mar 08 '20 19:03 haozhg

Please refer to below link https://github.com/haozhg/odmd/blob/b75539a3f9b1cc967b0f0d94af68e48f06983a78/matlab/OnlineDMD.m#L86

jodyngo avatar Mar 09 '20 04:03 jodyngo

Hey, so the matrix must be of shape (n, q) (q by n will not work), where n is state dimension and q is the first q snapshots (q > n). See this https://github.com/haozhg/odmd-matlab/tree/main/matlab for example usage. Also, i would recommend using the python implementation: https://github.com/haozhg/odmd#use-pip, just need pip install odmd

haozhg avatar Feb 18 '21 05:02 haozhg