Reputation: 65
Good day!
I am trying to multiply two matrices those are:
z = [64 x 1] ; with complex attribute.
top = [32 x 64]
both of the matrices class are double but when I tried to run the program I got an error at the last line
Matrix dimensions must agree.
here is the code:
clear all; clc;
load('eeg.mat');
load('top.mat');
N = 64;
M = 32;
Psi = dftmtx(N);
z = Psi * VarName1;
y = z * top;
the output that I want is [32 x 1]
Upvotes: 0
Views: 46
Reputation: 11628
You seem to have the product y = z * top
where size(z) == [64, 1]
and size(top) == [32, 64]
. The sizes of these two matrices are incompatible to be multiplied in this order, as the "inner" dimensions must agree, but in your case 1 ~= 32
(see https://en.wikipedia.org/wiki/Matrix_multiplication#Definition). What you probably want is
y = top * z
Upvotes: 1