Problem 1: A \"simple\" digital differentiator is given by y(n)-x(n)-x(n-I) whic
ID: 3349711 • Letter: P
Question
Problem 1: A "simple" digital differentiator is given by y(n)-x(n)-x(n-I) which computes a backward first-order difference of the input sequence. Implement this differentiator (i.e., find y(n)) on the following sequences (by using filter finction in MATLAB) and plot the results. Comment on the appropriateness of this simple differentiator. l . x(n) = 5[n(n)-n(n-20): a rectangular pulse using 23 points. 2.x(n)- sinT" lu(n)-u(n-100)]; a sinusoidal pulse using 102 points. |10 pointsl HINT: See Example 2.12 in the Ingle-Proakis MATLAB tex. 10 points 25Explanation / Answer
%%%%% Matlab
clc;
clear all;
close all;
%%% a)
xn=5*ones(1,20);
xnn=[0 xn 0 0 ];
for n=1:length(xnn)-1
y(n)=xnn(n+1)-xnn(n);
end
figure;
stem(y);
%%%% (b)
xn=sin(pi*0:99/25);
xnn=[0 xn 0 0 ];
for n=1:length(xnn)-1
y(n)=xnn(n+1)-xnn(n);
end
figure;
stem(y);
OUTPUT: