The operation of signal dilation (or decimation or down-sampling) is defined by
ID: 2079147 • Letter: T
Question
The operation of signal dilation (or decimation or down-sampling) is defined by
y(n) = x(nM)
in which the sequence x(n) is down-sampled by an integer factor M. For example, if
x(n) = {. . . ,2, 4,3,6, 5,1, 8, . . . }then the down-sampled sequences by a factor 2 are given by
y(n) = {. . . ,2, 3, 5, 8, . . .}
1. Develop a MATLAB function dnsample that has the form
function [y,m] = dnsample(x,n,M)
% Downsample sequence x(n) by a factor M to obtain y(m)
to implement the above operation. Use the indexing mechanism of MATLAB with
careful attention to the origin of the time axis n = 0.
Explanation / Answer
function [y,m]=dnsample(x,n,M)
m=1; %Initilization of output indicies
for i=1:(M+1):n % Downsampling
y(m)=x(i);
m=m+1;
end
m=m-1;
end
output:
x=[1 2 3 4 5 6 7 8 9 10];
[y m]=dnsample(x,10,3)
y =
1 5 9
m =
3
>> [y m]=dnsample(x,10,2)
y =
1 4 7 10
m =
4
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.