Need help getting my delta functions to work
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Brianna Miranda
am 15 Okt. 2021
Kommentiert: Brianna Miranda
am 15 Okt. 2021
I'm trying to take the Fourier transform of two delta function but I'm having a problem with writing the code for my delta functions. The two functions are x = [1,0,0,0,....,0,0,0]; n=0...nfft-1 and y = x = [0,0,0,1,....,0,0,0]; n=0...nfft-1. The length of my fft (nfft) is 150. So far what I have is
nfft = 150;
x = [1,0,0,0:0:nfft-1];
y = [0,0,0,1,0:0:nfft-1];
but my vectors are x = [1,0,0] and y = [0,0,0,1]. They should be x = [1,0,0,.....0,0,0] and y = [0,0,0,1,0,0.....,0,0,0] from n=0 to nfft-1.
0 Kommentare
Akzeptierte Antwort
Paul
am 15 Okt. 2021
The problem is that
nfft = 150;
0:0:nfft-1
is empty. What that line is bascially asking for is a vector of number from 0 to 149 in increments of 0, which doesn't make sense, hench the empty result. If I understand the question correclty, you really want this
x = zeros(1,nfft);
x(1) = 1;
y = zeros(1,nfft);
y(4) = 1;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!