What Is Wrong With My Code? (Downsampling Of A Sinc Signal)
Show older comments
Hi, I'm studying on my own about downsampling the signals on matlab.
Before exhibit my code which I wrote, I've curiosity questions below about my code.
I'm a self learner, so if anyone else could help me to understand. That would be glamorous.
1) How can I find the downsampling of my code?
2) How can I create a discrete time sinusoidal signal of a preferred frequency and decimate it?
Here is my code mentioned before which I wrote it:
N = 30;
n= 0:N;
x1 = sinc(n/6);
subplot(221);
stem(n,x1);
grid;
title('original signal');
xlabel('sample');
m = 2;
x2 = x1(1:m:length(x1));
m = 0:m:N;
subplot(222);
stem(m,x2);
grid;
title('decimated signal');
xlabel('sample');
f1=0:0.1:3; %frequency values
f2=0:0.4:6; %new frequency values
X1 = abs(fft(x1));
subplot(223);
stem(f1,X1);
title('input spectrum');
xlabel('frequency(Hz)');
X2 = abs(fft(x2));
subplot(224);
stem(f2,X2);
title('output spectrum');
xlabel('frequency(Hz)');
Here is my output:

Accepted Answer
More Answers (0)
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!