__Program Code__clc;

close all;

clear all;

N=input('Enter the length of the sequence N= ');

n=0:N-1;

f1=input('Enter the first frequency component of the signal f1= ');

f2=input('Enter the second frequency component of the signal f2= ');

x=sin(2*pi*f1*n)+sin(2*pi*f2*n);

L=input('Input the up sampling factor L= ');

x1=zeros(1,L*N);

n1=1:L*N;

a=1:L:L*N;

x1(a)=x;

M=input('Input the down sampling rate M= ');

x2=x1(1:M:(L*N));

n2=1:((L*N)/M);

subplot(311);

stem(n,x);

xlabel('discrete frequency');

ylabel('Amplitude');

title('input sequence');

grid on;

subplot(312);

stem(n1,x1);

xlabel('discrete frequency');

ylabel('Amplitude');

title('up sampled sequence');

grid on;

subplot(313);

stem(n2,x2);

xlabel('discrete frequency');

ylabel('Amplitude');

title('down sampled sequence');

grid on;

**Example of Output**Enter the first frequency component of the signal f1= 1000

Enter the second frequency component of the signal f2= 250

Input the up sampling factor L= 3

Input the down sampling rate M= 2

_________________________________________________________________________________

If you find this post useful, then please like this post on facebook and please +1 this post on google plus using +1 button and Facebook button given in this blog.

Please send your opinion

our e-mail:

s5electronicsandcommunication@gmail.com

## No comments:

## Post a Comment