Borrar filtros
Borrar filtros

Need help getting my delta functions to work

3 visualizaciones (últimos 30 días)
Brianna Miranda
Brianna Miranda el 15 de Oct. de 2021
Comentada: Brianna Miranda el 15 de Oct. de 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.

Respuesta aceptada

Paul
Paul el 15 de Oct. de 2021
The problem is that
nfft = 150;
0:0:nfft-1
ans = 1×0 empty double row vector
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;

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by