I'm writing a DFT script and I keep running up agains this problem where my matrix multiplication is erroring out due to their matrix sizes. One is 1×1000 and the other is 500 x 500.
Here is the code below.
clc;clear all;close all;t = 0:1/100:10-1/100; % Time vector
xn = 5 + 2*cos(2*pi*t-pi/2) + 3*cos(2*pi*4*t); %Signal in Time domain
N = 500; % length of data points
for k=0:N-1 for n=0:N-1 Wn=exp(-j*2*pi*k*n/N); X1(k+1,n+1)=Wn; endendXk = X1*xn';
Best Answer