Check this Matlab code for down sampling a cos signal

Status
Not open for further replies.

ednan

Advanced Member level 4
Joined
Feb 13, 2007
Messages
118
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
2,059
i hav cos signal n i want to do down sample by 2..is this matlab code is correct ...

n=1:20;
x=cos(2*pi*n/10);
y=zeros(1,60)
for ii=1:20;
y(3*ii)=x(ii)
end

figure;

stem(n,x)

figure
stem

n1=1:20;
N=1000;
x1=cos(2*pi*n1/N)
imp_train=zeros(1,50)
imp_train(1)=1;
train=imp_train;
for i=1:19
train=[train imp_train]
end
figure;

stem(x1)

figure
stem(imp_train)
title('imp_train')

figure;
stem(train)
title('train')

sampled=train.*x;
figure;
stem(sampled);
title('Sampled')


plz help me if m doing wrong...
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…