blob: 941918498c984b2ad2ff9f68c5fcb9570733141b (
plain)
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
|
function [Num,Den,AllpassNum,AllpassDen] = iirlp2mb(varargin)
B = varargin(1)
A = varargin(2)
Wo = varargin(3)
Wt = varargin(4)
rhs = argn(2)
lhs = argn(1)
if(rhs < 4 | rhs > 5)
error("Wrong number of input arguments.")
end
if(rhs == 5)
Pass = varargin(5);
if(Pass == 'pass')
pass_stop = -1
elseif(Pass == 'stop')
pass_stop = 1
else
error("Pass must be pass or stop.")
end
else
pass_stop = -1
end
if(Wo <= 0)
error("Wo is <= 0.")
end
if(Wo >= 1)
error("Wo is >= 1.");
end
oWt = 0;
for i = 1 : length(Wt)
if(Wt(i) <= 0)
error("Wt is <= 0.");
end
if(Wt(i) >= 1)
error("Wt is >= 1.");
end
if(Wt(i) <= oWt)
error("Wt not monotonically increasing.");
else
oWt = Wt(i);
end
end
endfunction
|