Professional Documents
Culture Documents
Thí nghiệm xử lý tín hiệu số
Thí nghiệm xử lý tín hiệu số
a>
Exercise 1
a) Thay tn cua file dampedCosine.m thanh ThaoNguyen_dampedCosine.m
diary your_nameex1
%INSERT your name and section into these display commands
disp('NAME: Thao_Nguyen')
disp('SECTION: Thao-_section')
datestr(cputime)
%dampedCosine.m produces a plot of a cosine with frequency
0,5Hz and 1 Hz, with amplitude
% scaled by a decaying exponential
figure
x = -5:0.01:5;
y2=exp(-abs(x)).*cos(pi*x);
subplot(2,1,1);
plot(x,y2);
xlabel('thoi gian');
ylabel('bien do');
title('f(x)=exp(-|x|)cos(pi*x)');
subplot(2,1,2);
y1=exp(-abs(x)).*cos(2*pi*x);
plot(x,y1);
xlabel('thoi gian');
ylabel('bien do');
title('f(x)=exp(-|x|)cos(2*pi*x)');
diary off
RESULT:
y2=exp(-abs(x)).*cos(0.5*pi*x);
subplot(2,1,1);
plot(x,y2);
xlabel('thoi gian');
ylabel('bien do');
title('f(x)=exp(-|x|)cos(0.5*pi*x)');
subplot(2,1,2);
y1=exp(-abs(x)).*cos(2*pi*x);
plot(x,y1);
xlabel('thoi gian');
ylabel('bien do');
title('f(x)=exp(-|x|)cos(pi*x)');
diary off
RESULT:
Exercise 2:
Nhn xet:
<LAB1.b>
Exercise 1<Fader>.
a) Yu cu thc hin
RESULT:
RESULT:
c) Nhn xt kt qu.
- Trn thc t tin hiu sau khi c fade se co nhng mu phia sau suy
giam hn nhiu so vi tin hiu gc. iu nay co th chng minh c
-
Exercise 2<Repeater>.
a) Yu cu thc hin:
- Tao function thc hin lp tin hiu m thanh N ln. Dng vng lp thc
hin n. Bn trong vng lp for chng ta cn ghp tin hiu c tin hiu sau
cng.
- Vi d, nu mun ghp 2 vector x,y nh bn di c mt vector thi ta thc
hin nh sau:
>> x = [1 4 2 2 3];
>> y = [5 8 3 9 0];
>> x = [x y];
b) Kt qu thc hin:
- Function: repeat.m thc hin repeat.
end
Vi file m thanh khao st la bassdrum.wav khi thc hin oan script repeat
la 5 times.
>>x=wavread('bassdrum');
>>[y]= repeat(x,5);
>>suptitle('Khao sat ham repeat');
>>subplot(2,1,1);
>>plot(x);
>>xlabel('Bassdrum');
>>subplot(2,1,2);
>>plot([y]);
>>xlabel('Repeat bassdrum 5 times');
RESULT:
a. Nhn xt kt qu
Kt qua tin hiu sau khi c qua ham repeat se c lp lai theo N ln
yu cu.
Bin ch lp lai theo s ln quy inh ch khng co hin tng bi bin
i dang tin hiu.
Exercise 3 <DELAY>.
a)
-
Yu cu thc hin:
Tao 1 function lam tr tin hiu. Vi chng ta ang lam vic vi tin
hiu s nn chng ta co th thc hin mt cach n gian o la them s
- S lng s 0 cn them vao trc tin hiu chinh la s thi gian delay va s mu
tng ng. i vi cc bai chng ta khao st thi t l mu la 8000 mu/s.
b) Kt qu thc hin:
-
hien function
lai nhu sau:
function [y] = delay(x,t)
m=zeros(t*8000,1);
y =[m;x];
end
c) Nhn xt kt qu.
- Ham delay ch lam tr tin hiu i mt khoang theo yu cu ch khng lam bin
dang tin hiu gc.
Exercise 4. Mixer.
a) Yu cu thc hin
- Tao 1 function thc hin chc nng cng 2 vector m thanh.
- Function cn thc hin s c th x l c cc yu t u vao khng cng kich c.
Va s phai re-scale lai tin hiu cho n khng nm ngoai pham vi [-1,1].
b) Kt qu thc hin
- Function thc hin vic add ng thi re-scale tin hiu tin hiu ra khng
vt ngoai khoang [-1,1]
x = wavread(bleeep);plot(x);
y = wavread('bassdrum');
plot(y)
v = mixer(x,y);
>> plot(v)
Nh n xt :
Chng ta c th thy khi mixer hai tin hi u m thanh vi nhau cc phn tin hi u
trng nhau s c tng cng ln nhau nhng khng vt qu gi tri [-1;1] do bi
gii han, phn nao vt qua s bi xn bt.
Exercise 5: Groove
Yu cu thc hin