Need help getting my delta functions to work
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Paul
2021년 10월 15일
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;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!