Where am I going wrong in setting up this function?

1 Ansicht (letzte 30 Tage)
Justin Arackel
Justin Arackel am 28 Nov. 2020
Kommentiert: Justin Arackel am 28 Nov. 2020
For starters, I hae no clue how to use matLAb, I could program this easily in python or C++ but here I'm at a loss for how function definitions occur: The code below is a function I'm trying to get to work, but clearly it wants to throw errors about not enough input arguments. So what am I missing here, how would I pass x in as an array of length N and why is N raising errors of its own?
function X = dft(x, N)
X = [];
w = 2*pi/N;
for l = 1:N
X(l) = symsum( x(k)* e^(-(1i)*l*k*w), k, 0, N-1 );
end
end

Akzeptierte Antwort

VBBV
VBBV am 28 Nov. 2020
X(l) = symsum( x(k)* exp(-(1i)*l*k*w), k, 0, N-1 );
use exp function

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by