The following MATLAB code implements the down-sampling operation with M = 2:
clear all, close all, clc
% Down-sampling
N = 41 ; % Length of the sequence
n = 0:N-1; % Time index
x = 0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
M = 2; % Down-sampling factor
y = x(1:M:N); % Down-sampled signal
Ny = length(y); % Length of the down-sampled sequence
figure
subplot(211),
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
subplot(212)
stem(0: Ny -1,y(1: Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
clear all, close all, clc
clear all, close all, clc
N = 21 ; % Length of the original sequence
n=0:N-1; % Time index
x=0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
L=2; % Up-sampling factor
y = upsample(x,L); % Up-sampled signal
Ny = length(y); % Length of the up-sampled signal
figure
subplot(2,1,1)
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
axis tight
subplot(2,1,2)
stem(0:Ny-1,y(1:Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
axis tightclear all, close all, clc
% Down-sampling
N = 41 ; % Length of the sequence
n = 0:N-1; % Time index
x = 0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
M = 2; % Down-sampling factor
y = x(1:M:N); % Down-sampled signal
Ny = length(y); % Length of the down-sampled sequence
figure
subplot(211),
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
subplot(212)
stem(0: Ny -1,y(1: Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
clear all, close all, clc
clear all, close all, clc
N = 21 ; % Length of the original sequence
n=0:N-1; % Time index
x=0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
L=2; % Up-sampling factor
y = upsample(x,L); % Up-sampled signal
Ny = length(y); % Length of the up-sampled signal
figure
subplot(2,1,1)
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
axis tight
subplot(2,1,2)
stem(0:Ny-1,y(1:Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
axis tight clear all, close all, clc
% Down-sampling
N = 41 ; % Length of the sequence
n = 0:N-1; % Time index
x = 0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
M = 2; % Down-sampling factor
y = x(1:M:N); % Down-sampled signal
Ny = length(y); % Length of the down-sampled sequence
figure
subplot(211),
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
subplot(212)
stem(0: Ny -1,y(1: Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
clear all, close all, clc
clear all, close all, clc
N = 21 ; % Length of the original sequence
n=0:N-1; % Time index
x=0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
L=2; % Up-sampling factor
y = upsample(x,L); % Up-sampled signal
Ny = length(y); % Length of the up-sampled signal
figure
subplot(2,1,1)
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
axis tight
subplot(2,1,2)
stem(0:Ny-1,y(1:Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
axis tight perform decimation/down-sampling using the matlab, the following matlab code implements the up-sampli, notice that the second subplot above contains zero, the next matlab program illustrates the effects of MATLAB Answers — New Questions