-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.m
executable file
·83 lines (70 loc) · 1.92 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
% Adaptive Filter Homework
% 2021/10/13
% s : signal source
% u : noise source
% d : primary input, d = s + f* u
% Function : 1. 2. 3. 4
%% Problem 1
clc; close all; clear
s_name = 'FSJK1_con_160000_mul5.wav';
[s,fs] = audioread(s_name);
u_name = 'laplacian1.wav';
[u, ] = audioread(u_name);
f = [-0.4, -1.7, 0.1, 0.3, -1.1, 1.2, 1.2, 0.0, 0.3, 0.2];
% d = s + f*u , primary input
d = s + filter(f,1,u);
LMS('1',d, u, s, f);
%% Problem 2
clc; clear; close all
s_name = 'FSJK1_con_160000_mul5.wav';
[s,fs] = audioread(s_name);
u_name = 'MDAC0_con_160000_mul5.wav';
[u, ] = audioread(u_name);
f = [-0.4, -1.7, 0.1, 0.3, -1.1, 1.2, 1.2, 0.0, 0.3, 0.2];
% d = s + f*u , primary input
d = s + filter(f,1,u);
LMS('2',d, u, s, f);
%% Problem 3-1
clc; clear; close all;
s_name = 'FSJK1_con_160000_mul5.wav';
[s,fs] = audioread(s_name);
u_name = 'laplacian1.wav';
[u, ] = audioread(u_name);
f_name = 'standp4m1_nhpf_512.wav';
[f, ] = audioread(f_name);
f = f.';
d = s + filter(f,1,u);
LMS('3-1',d, u, s, f);
%% Problem 3-2
clc; clear; close all;
s_name = 'FSJK1_con_160000_mul5.wav';
[s,fs] = audioread(s_name);
u_name = 'MDAC0_con_160000_mul5.wav';
[u, ] = audioread(u_name);
f_name = 'standp4m1_nhpf_512.wav';
[f, ] = audioread(f_name);
f = f.';
d = s + filter(f,1,u);
LMS('3-2',d, u, s, f);
%% Problem 4
clc; clear; close all;
s_name = 'FSJK1_con_160000_mul5.wav';
[s,fs] = audioread(s_name);
u_name = 'MDAC0_con_160000_mul5.wav';
[u, ] = audioread(u_name);
f_name = 'standp4m1_nhpf_512.wav';
[f, ] = audioread(f_name);
f = f.';
d = s + filter(f,1,u);
NLMS('4',d, u, s, f);
%% Problem 5
clc; clear; close all;
s_name = 'FSJK1_con_160000_mul5.wav';
[s,fs] = audioread(s_name);
u_name = 'MDAC0_con_160000_mul5.wav';
[u, ] = audioread(u_name);
f_name = 'standp4m1_nhpf_512.wav';
[f, ] = audioread(f_name);
f = f.';
d = s + filter(f,1,u);
FastBlockLMS('5',d, u, s, f);