fft - frequency spectrum of sinc function in matlab shows me nothing -


since don't have sinc function in matlab,

i implemented function shown below

    %% time specificactions:     fs=10000; dt=1/fs; t=(-0.1:dt:0.1-dt)'; n=size(t,1);     %message signal     mt=(sin(pi*100*t))./(pi*100*t);      %% frequency specifications     df=fs/n;      f=-fs/2:df:fs/2-df;     m=fftshift(fft(mt));     plot(f,abs(m)/n); 

but figure shows me nothing blank, looked variable table , filled nan.

one thing don't understand same procedure worked pretty when function want fourier transform cosine function.

you have wrongly defined sinc function, when t=0 outputs nan.

you can check doing any(isnan(mt)) in code.

to define function do

mt(find(t==0))=1; 

that make code output

enter image description here

you may want reconsider parameters in order see better square wave.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -