thí nghiệm xử lý tín hiệu số
DESCRIPTION
Thí nghiệm xử lý tin hiệu sốTRANSCRIPT
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:
b) Tao hai tin hiu hinh sin vi chu ky gp i ( tn s giam i mt na) so vi ngun ban u.
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 is reduced 2 times, with amplitude
% scaled by a decaying exponential
figure
x = -5:0.01:5;
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:
1. Tao tin hiu co tn s F = 4Hz va d = 4 bng lnh compexp(4,4).
RESULT:
1. Tao tin hiu co gia tri tn s giam i mt na va nhn xet thi compexp(2,4).
Nhn xet:
Ta co th thy khi khng co mc level tin hiu se suy giam v mc khng con nu s dung mc level thi tin hiu se c ghim gi lai mc level.
Nu mc level bng 1 thi ta se thu c tin hiu tun hoan.
Nu khng s dung mc level thi thc cht la mt trng hp c bit vi level bng 0.
Exercise 1.
a) Yu cu thc hin
Chnh sa li function fade.m km theo ngun thc hin vic iu chnh dc ca tn hiu da vo bc ca hm function.
S dng gi tr bin level ( trong hm fade.m) chn mc suy gim dn ca tn hiu. V gi tr level nm trong khong [0..1]
b) Kt qu thc hin.
Tn hiu ph hp vi handout
Function fade2.m
function [ y ] = fade2(x, level)
%
% x: vector am thanh dau vao
% level : slope of ramp
if((level1))
fprintf('nhap lai level trong khoang [0,1]\n');
y=[];
%Thong bao loi neu level nam ngoai khoang [0,1]
end
% Thuc hien ramp vector khi gia tri level phu hop voi yeu cau.
if((level>=0) & (level