I'm trying to implement a 1 dimensional DFT without using Matlab built-in functions such as fft(). This is my code:
function [Xk] = dft1(xn)N=length(xn);n = 0:1:N-1; % row vector for n
k = 0:1:N-1; % row vecor for k
WN = exp(-1j*2*pi/N); % Twiddle factor (w)
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ nk; % DFT matrix
Xk = (WNnk*xn );
when i run the code after using the following commands:
I = imread('sample.jpg')R = dft1(I)I get this particular error: *Error using * MTIMES is not fully supported for integer classes. At least one input must be scalar. To compute elementwise TIMES, use TIMES (.*) instead.*
Can someone please help me to figure out how to solve this problem
Note: I am still in the very beginning level of learning Matlab. Thank you very much
Best Answer