You are on page 1of 2

EXPERIMENT NO- 8

AIM: Write a MATLAB program to plot the following function:


h(n) = {4rncos[pi*n(1+r)/m] + msin[pi*n(1-r)/m]}/[1-(4rn/m)^2]*pi*nm

h(0) = (1/m)+(r/(m*4/pi-1))

h(|m/4|) = (-r/m)*[(2*cos{(pi/4*r)*(1+4)}-cos{pi*(1-r)/4*r})]

Given: m=4, r=0.1

TOOL USED: MATLAB 2014

THEORY:
The given function simply can be generated by computing the value of h at every n in a suitable
interval using the given formula:

h(n) = {4rncos[pi*n(1+r)/m] + msin[pi*n(1-r)/m]}/[1-(4rn/m)^2]*pi*nm;

We set the values of m=4 and r=0.1 before computation and iterate through a pre-declared vector
representing the values of n on both the positive and negative sides of the number line. The
values of the function at specific values of n=0 and n=|m/4| are then encompassed in the plot for
h(n), since, m and r have fixed values.

MATLAB CODE:
clc;
close all;
clear all;

m = 4;
r = 0.1;
n = -50:50;

for i = 1:length(n)
h(i) = ((4*r*n(i))*cos(pi*n(i)*(1+r)/m)+m*sin(pi*n(i)*(1-r)/m))/((1-(4*r*n(i)/m))^2 *
pi*n(i)*m);
end

stem(n,h)
xlabel('n');
ylabel('h(n)');

OUTUT WAVEFORM:

Result: The MATLAB program to generate the signal s(n)=2*n*(0.8*n) corrupted by the noise
d(n) resulting the signal x(n)=s(n)+d(n) is generated and downsample of corrupted signal was
also plotted.

You might also like