1792 lines
32 KiB
Plaintext
1792 lines
32 KiB
Plaintext
octave:7>
|
|
^[[200~p = [2 -2 0 -3]; % 2x^3 - 2x^2 - 3^[[201~octave:7>
|
|
octave:7>
|
|
octave:7>
|
|
octave:7>
|
|
octave:7> p = [2 -2 0 -3]; % 2x^3 - 2x^2 - 3
|
|
octave:8> y = polyval(p, -5:.05:5);
|
|
octave:9> plot(y)
|
|
octave:10> figure
|
|
octave:11> plot(y)
|
|
octave:12> close all
|
|
octave:13> r = roots(p)
|
|
r =
|
|
|
|
1.5919 + 0i
|
|
-0.2960 + 0.9245i
|
|
-0.2960 - 0.9245i
|
|
|
|
octave:14> polyval(p, r)
|
|
ans =
|
|
|
|
8.4377e-15 + 0i
|
|
2.6645e-15 + 1.1102e-16i
|
|
2.6645e-15 - 1.1102e-16i
|
|
|
|
octave:15> abs(polyval(p, r))
|
|
ans =
|
|
|
|
8.4377e-15
|
|
2.6668e-15
|
|
2.6668e-15
|
|
|
|
octave:16> p1 = poly(r)
|
|
p1 =
|
|
|
|
1.0000e+00 -1.0000e+00 -5.5511e-16 -1.5000e+00
|
|
|
|
octave:17>
|
|
^[[200~b = [-4 8];
|
|
a = [1 6 8];^[[201~octave:17>
|
|
octave:17>
|
|
octave:17>
|
|
octave:17>
|
|
octave:17> b = [-4 8];
|
|
a = [1 6 8];
|
|
octave:19> help residue
|
|
'residue' is a function from the file /usr/share/octave/7.3.0/m/polynomial/re
|
|
sidue.m
|
|
|
|
-- [R, P, K, E] = residue (B, A)
|
|
-- [B, A] = residue (R, P, K)
|
|
-- [B, A] = residue (R, P, K, E)
|
|
The first calling form computes the partial fraction expansion for
|
|
the quotient of the polynomials, B and A.
|
|
|
|
The quotient is defined as
|
|
|
|
B(s) M r(m) N
|
|
---- = SUM ------------- + SUM k(i)*s^(N-i)
|
|
A(s) m=1 (s-p(m))^e(m) i=1
|
|
|
|
where M is the number of poles (the length of the R, P, and E), the
|
|
K vector is a polynomial of order N-1 representing the direct
|
|
contribution, and the E vector specifies the multiplicity of the
|
|
m-th residue's pole.
|
|
|
|
For example,
|
|
|
|
b = [1, 1, 1];
|
|
a = [1, -5, 8, -4];
|
|
[r, p, k, e] = residue (b, a)
|
|
=> r = [-2; 7; 3]
|
|
=> p = [2; 2; 1]
|
|
=> k = [](0x0)
|
|
=> e = [1; 2; 1]
|
|
|
|
which represents the following partial fraction expansion
|
|
|
|
s^2 + s + 1 -2 7 3
|
|
------------------- = ----- + ------- + -----
|
|
s^3 - 5s^2 + 8s - 4 (s-2) (s-2)^2 (s-1)
|
|
|
|
The second calling form performs the inverse operation and computes
|
|
the reconstituted quotient of polynomials, B(s)/A(s), from the
|
|
partial fraction expansion; represented by the residues, poles, and
|
|
a direct polynomial specified by R, P and K, and the pole
|
|
multiplicity E.
|
|
|
|
If the multiplicity, E, is not explicitly specified the
|
|
multiplicity is determined by the function 'mpoles'.
|
|
|
|
For example:
|
|
|
|
r = [-2; 7; 3];
|
|
p = [2; 2; 1];
|
|
k = [1, 0];
|
|
[b, a] = residue (r, p, k)
|
|
=> b = [1, -5, 9, -3, 1]
|
|
=> a = [1, -5, 8, -4]
|
|
|
|
where mpoles is used to determine e = [1; 2; 1]
|
|
|
|
Alternatively the multiplicity may be defined explicitly, for
|
|
example,
|
|
|
|
r = [7; 3; -2];
|
|
p = [2; 1; 2];
|
|
k = [1, 0];
|
|
e = [2; 1; 1];
|
|
[b, a] = residue (r, p, k, e)
|
|
=> b = [1, -5, 9, -3, 1]
|
|
=> a = [1, -5, 8, -4]
|
|
|
|
which represents the following partial fraction expansion
|
|
|
|
-2 7 3 s^4 - 5s^3 + 9s^2 - 3s + 1
|
|
----- + ------- + ----- + s = --------------------------
|
|
(s-2) (s-2)^2 (s-1) s^3 - 5s^2 + 8s - 4
|
|
|
|
See also: mpoles, poly, roots, conv, deconv.
|
|
|
|
Additional help for built-in functions and operators is
|
|
available in the online version of the manual. Use the command
|
|
'doc <topic>' to search the manual index.
|
|
|
|
Help and information about Octave is also available on the WWW
|
|
at https://www.octave.org and via the help@octave.org
|
|
mailing list.
|
|
octave:20> [r, p, k] = residue(b, a)
|
|
r =
|
|
|
|
-12
|
|
8
|
|
|
|
p =
|
|
|
|
-4
|
|
-2
|
|
|
|
k = [](0x0)
|
|
octave:21> [r, p, k, e] = residue(b, a)
|
|
r =
|
|
|
|
-12
|
|
8
|
|
|
|
p =
|
|
|
|
-4
|
|
-2
|
|
|
|
k = [](0x0)
|
|
e =
|
|
|
|
1
|
|
1
|
|
|
|
octave:22> b
|
|
b =
|
|
|
|
-4 8
|
|
|
|
octave:23> a
|
|
a =
|
|
|
|
1 6 8
|
|
|
|
octave:24>
|
|
octave:24>
|
|
octave:24>
|
|
octave:24>
|
|
octave:24> a = [1 2 -3 4];
|
|
b = [5 0 3 -2];
|
|
octave:26> conv(a, b)
|
|
ans =
|
|
|
|
5 10 -12 24 -13 18 -8
|
|
|
|
octave:27>
|
|
^[[201~octave:27>
|
|
octave:27>
|
|
octave:27>
|
|
octave:27>
|
|
octave:27> b1 = [1]; % numerator
|
|
a1 = [1 -0.5]; % denominator
|
|
figure;
|
|
zplane(b1, a1);
|
|
error: 'zplane' undefined near line 1, column 1
|
|
|
|
The 'zplane' function belongs to the signal package from Octave Forge
|
|
which you have installed but not loaded. To load the package, run 'pkg
|
|
load signal' from the Octave prompt.
|
|
|
|
Please read <https://www.octave.org/missing.html> to learn how you can
|
|
contribute missing functionality.
|
|
octave:31> pkg load signal
|
|
octave:32> b1 = [1]; % numerator
|
|
a1 = [1 -0.5]; % denominator
|
|
figure;
|
|
zplane(b1, a1);
|
|
octave:36> close all
|
|
octave:37>
|
|
|
|
a = [1 1/sqrt(2) 1/4];^[[201~octave:37>
|
|
octave:37>
|
|
octave:37>
|
|
octave:37>
|
|
octave:37> b = [2 3 0];
|
|
a = [1 1/sqrt(2) 1/4];
|
|
octave:39>
|
|
^[[200~[z, p, k] = tf2zp(b, a);^[[201~octave:39>
|
|
octave:39>
|
|
octave:39>
|
|
octave:39>
|
|
octave:39> [z, p, k] = tf2zp(b, a);
|
|
octave:40> z
|
|
z =
|
|
|
|
-1.5000
|
|
0
|
|
|
|
octave:41> p
|
|
p =
|
|
|
|
-0.3536 + 0.3536i
|
|
-0.3536 - 0.3536i
|
|
|
|
octave:42> figure
|
|
octave:43> zplane(z, p)
|
|
octave:44> close all
|
|
octave:45>
|
|
octave:45>
|
|
octave:45>
|
|
octave:45>
|
|
octave:45>
|
|
octave:45> b2 = [1];
|
|
a2 = [1 -1.5];
|
|
b3 = [1 -1 0.25];
|
|
a3 = [1 -23/10 1.2];
|
|
octave:49>
|
|
octave:49>
|
|
octave:49>
|
|
octave:49>
|
|
octave:49>
|
|
octave:49> subplot(3, 1, 2);
|
|
zplane(b2, a2);
|
|
title('$$H_2(z)=\frac{z}{z-\frac{3}{2}}$$', 'interpreter', 'latex');
|
|
sh: 1: dvipng: not found
|
|
warning: latex_renderer: a run-time test failed and the 'latex' interpreter h
|
|
as been disabled.
|
|
warning: called from
|
|
__axis_label__ at line 36 column 6
|
|
title at line 64 column 8
|
|
|
|
octave:52> close all
|
|
octave:53>
|
|
^[[200~zplane(b2, a2);^[[201~octave:53>
|
|
octave:53>
|
|
octave:53>
|
|
octave:53>
|
|
octave:53> zplane(b2, a2);
|
|
octave:54> close all
|
|
octave:55>
|
|
octave:55>
|
|
octave:55>
|
|
octave:55>
|
|
octave:55>
|
|
octave:55> [h1, t] = impz(b1, a1, 8); % h is the IMPULSE RESPONSE
|
|
octave:56> plot(t, h1)
|
|
octave:57> close all
|
|
octave:58> stem(t, h1);
|
|
octave:59> close all
|
|
octave:60>
|
|
n = 0:1:5;
|
|
x1 = (1/2).^n;
|
|
y1 = conv(x1, h1);
|
|
|
|
figure;
|
|
subplot(2, 1, 1);
|
|
stem(y1);
|
|
title('Convolution between x_1 and h_1');
|
|
subplot(2, 1, 2);
|
|
y2 = filter(b1, a1, x1);
|
|
stem(y2);
|
|
title('Filter with b_1,a_1 and x_1');
|
|
xlim([0 14]);^[[201~octave:60>
|
|
octave:60>
|
|
octave:60>
|
|
octave:60>
|
|
octave:60> n = 0:1:5;
|
|
x1 = (1/2).^n;
|
|
y1 = conv(x1, h1);
|
|
|
|
figure;
|
|
subplot(2, 1, 1);
|
|
stem(y1);
|
|
title('Convolution between x_1 and h_1');
|
|
subplot(2, 1, 2);
|
|
y2 = filter(b1, a1, x1);
|
|
stem(y2);
|
|
title('Filter with b_1,a_1 and x_1');
|
|
xlim([0 14]);
|
|
octave:72> close all
|
|
octave:73> b1
|
|
b1 = 1
|
|
octave:74> a1
|
|
a1 =
|
|
|
|
1.0000 -0.5000
|
|
|
|
octave:75>
|
|
octave:75>
|
|
octave:75>
|
|
octave:75>
|
|
octave:75>
|
|
octave:75> freqz(b1, a1);
|
|
octave:76>
|
|
octave:76>
|
|
octave:76>
|
|
octave:76>
|
|
octave:76> [H, w] = freqz(b1, a1);
|
|
octave:77> close all
|
|
octave:78> H
|
|
H =
|
|
|
|
2.0000 + 0i
|
|
1.9999 - 0.0123i
|
|
1.9995 - 0.0245i
|
|
1.9990 - 0.0368i
|
|
1.9982 - 0.0490i
|
|
1.9972 - 0.0612i
|
|
1.9959 - 0.0734i
|
|
1.9945 - 0.0856i
|
|
1.9928 - 0.0977i
|
|
1.9909 - 0.1097i
|
|
1.9888 - 0.1217i
|
|
1.9865 - 0.1337i
|
|
1.9839 - 0.1456i
|
|
1.9812 - 0.1574i
|
|
1.9782 - 0.1691i
|
|
1.9750 - 0.1808i
|
|
1.9717 - 0.1923i
|
|
1.9681 - 0.2038i
|
|
1.9643 - 0.2152i
|
|
1.9603 - 0.2265i
|
|
1.9562 - 0.2377i
|
|
1.9519 - 0.2487i
|
|
1.9473 - 0.2597i
|
|
1.9426 - 0.2706i
|
|
1.9378 - 0.2813i
|
|
1.9327 - 0.2919i
|
|
1.9275 - 0.3024i
|
|
1.9221 - 0.3127i
|
|
1.9166 - 0.3229i
|
|
1.9109 - 0.3330i
|
|
1.9050 - 0.3429i
|
|
1.8991 - 0.3527i
|
|
1.8929 - 0.3623i
|
|
1.8867 - 0.3718i
|
|
1.8803 - 0.3812i
|
|
1.8738 - 0.3904i
|
|
1.8671 - 0.3994i
|
|
1.8604 - 0.4083i
|
|
1.8535 - 0.4170i
|
|
1.8465 - 0.4255i
|
|
1.8394 - 0.4339i
|
|
1.8323 - 0.4422i
|
|
1.8250 - 0.4503i
|
|
1.8176 - 0.4582i
|
|
1.8102 - 0.4659i
|
|
1.8026 - 0.4735i
|
|
1.7950 - 0.4809i
|
|
1.7873 - 0.4882i
|
|
1.7796 - 0.4953i
|
|
1.7718 - 0.5022i
|
|
1.7639 - 0.5090i
|
|
1.7560 - 0.5155i
|
|
1.7480 - 0.5220i
|
|
1.7400 - 0.5283i
|
|
1.7320 - 0.5344i
|
|
1.7239 - 0.5403i
|
|
1.7157 - 0.5461i
|
|
1.7076 - 0.5517i
|
|
1.6994 - 0.5572i
|
|
1.6912 - 0.5625i
|
|
1.6829 - 0.5676i
|
|
1.6747 - 0.5726i
|
|
1.6664 - 0.5775i
|
|
1.6582 - 0.5822i
|
|
1.6499 - 0.5867i
|
|
1.6416 - 0.5911i
|
|
1.6333 - 0.5954i
|
|
1.6250 - 0.5995i
|
|
1.6168 - 0.6034i
|
|
1.6085 - 0.6072i
|
|
1.6002 - 0.6109i
|
|
1.5920 - 0.6144i
|
|
1.5838 - 0.6178i
|
|
1.5756 - 0.6211i
|
|
1.5674 - 0.6242i
|
|
1.5592 - 0.6272i
|
|
1.5511 - 0.6301i
|
|
1.5430 - 0.6328i
|
|
1.5349 - 0.6355i
|
|
1.5268 - 0.6380i
|
|
1.5188 - 0.6403i
|
|
1.5108 - 0.6426i
|
|
1.5029 - 0.6448i
|
|
1.4949 - 0.6468i
|
|
1.4871 - 0.6487i
|
|
1.4792 - 0.6505i
|
|
1.4714 - 0.6522i
|
|
1.4637 - 0.6538i
|
|
1.4560 - 0.6553i
|
|
1.4483 - 0.6567i
|
|
1.4407 - 0.6580i
|
|
1.4331 - 0.6592i
|
|
1.4256 - 0.6603i
|
|
1.4181 - 0.6613i
|
|
1.4107 - 0.6622i
|
|
1.4033 - 0.6630i
|
|
1.3960 - 0.6637i
|
|
1.3887 - 0.6644i
|
|
1.3815 - 0.6649i
|
|
1.3743 - 0.6654i
|
|
1.3672 - 0.6658i
|
|
1.3602 - 0.6661i
|
|
1.3532 - 0.6664i
|
|
1.3462 - 0.6665i
|
|
1.3393 - 0.6666i
|
|
1.3325 - 0.6667i
|
|
1.3257 - 0.6666i
|
|
1.3190 - 0.6665i
|
|
1.3123 - 0.6663i
|
|
1.3057 - 0.6661i
|
|
1.2991 - 0.6658i
|
|
1.2926 - 0.6654i
|
|
1.2862 - 0.6650i
|
|
1.2798 - 0.6645i
|
|
1.2735 - 0.6640i
|
|
1.2672 - 0.6634i
|
|
1.2610 - 0.6627i
|
|
1.2548 - 0.6620i
|
|
1.2487 - 0.6613i
|
|
1.2427 - 0.6605i
|
|
1.2367 - 0.6596i
|
|
1.2307 - 0.6587i
|
|
1.2249 - 0.6578i
|
|
1.2190 - 0.6568i
|
|
1.2133 - 0.6558i
|
|
1.2076 - 0.6547i
|
|
1.2019 - 0.6536i
|
|
1.1963 - 0.6524i
|
|
1.1907 - 0.6512i
|
|
1.1853 - 0.6500i
|
|
1.1798 - 0.6487i
|
|
1.1744 - 0.6475i
|
|
1.1691 - 0.6461i
|
|
1.1638 - 0.6448i
|
|
1.1586 - 0.6434i
|
|
1.1534 - 0.6419i
|
|
1.1483 - 0.6405i
|
|
1.1432 - 0.6390i
|
|
1.1382 - 0.6375i
|
|
1.1332 - 0.6359i
|
|
1.1283 - 0.6344i
|
|
1.1235 - 0.6328i
|
|
1.1186 - 0.6312i
|
|
1.1139 - 0.6295i
|
|
1.1092 - 0.6278i
|
|
1.1045 - 0.6262i
|
|
1.0999 - 0.6244i
|
|
1.0953 - 0.6227i
|
|
1.0908 - 0.6210i
|
|
1.0863 - 0.6192i
|
|
1.0819 - 0.6174i
|
|
1.0775 - 0.6156i
|
|
1.0731 - 0.6138i
|
|
1.0688 - 0.6120i
|
|
1.0646 - 0.6101i
|
|
1.0604 - 0.6082i
|
|
1.0562 - 0.6063i
|
|
1.0521 - 0.6044i
|
|
1.0480 - 0.6025i
|
|
1.0440 - 0.6006i
|
|
1.0400 - 0.5987i
|
|
1.0361 - 0.5967i
|
|
1.0322 - 0.5948i
|
|
1.0283 - 0.5928i
|
|
1.0245 - 0.5908i
|
|
1.0207 - 0.5888i
|
|
1.0169 - 0.5868i
|
|
1.0132 - 0.5848i
|
|
1.0096 - 0.5828i
|
|
1.0060 - 0.5807i
|
|
1.0024 - 0.5787i
|
|
0.9988 - 0.5767i
|
|
0.9953 - 0.5746i
|
|
0.9918 - 0.5726i
|
|
0.9884 - 0.5705i
|
|
0.9850 - 0.5684i
|
|
0.9816 - 0.5663i
|
|
0.9783 - 0.5643i
|
|
0.9750 - 0.5622i
|
|
0.9717 - 0.5601i
|
|
0.9685 - 0.5580i
|
|
0.9653 - 0.5559i
|
|
0.9622 - 0.5538i
|
|
0.9590 - 0.5517i
|
|
0.9560 - 0.5496i
|
|
0.9529 - 0.5475i
|
|
0.9499 - 0.5453i
|
|
0.9469 - 0.5432i
|
|
0.9439 - 0.5411i
|
|
0.9410 - 0.5390i
|
|
0.9381 - 0.5369i
|
|
0.9352 - 0.5347i
|
|
0.9324 - 0.5326i
|
|
0.9296 - 0.5305i
|
|
0.9268 - 0.5284i
|
|
0.9240 - 0.5262i
|
|
0.9213 - 0.5241i
|
|
0.9186 - 0.5220i
|
|
0.9159 - 0.5198i
|
|
0.9133 - 0.5177i
|
|
0.9107 - 0.5156i
|
|
0.9081 - 0.5134i
|
|
0.9055 - 0.5113i
|
|
0.9030 - 0.5092i
|
|
0.9005 - 0.5071i
|
|
0.8980 - 0.5049i
|
|
0.8956 - 0.5028i
|
|
0.8931 - 0.5007i
|
|
0.8907 - 0.4986i
|
|
0.8884 - 0.4964i
|
|
0.8860 - 0.4943i
|
|
0.8837 - 0.4922i
|
|
0.8814 - 0.4901i
|
|
0.8791 - 0.4880i
|
|
0.8768 - 0.4859i
|
|
0.8746 - 0.4837i
|
|
0.8724 - 0.4816i
|
|
0.8702 - 0.4795i
|
|
0.8680 - 0.4774i
|
|
0.8659 - 0.4753i
|
|
0.8638 - 0.4732i
|
|
0.8617 - 0.4711i
|
|
0.8596 - 0.4690i
|
|
0.8575 - 0.4670i
|
|
0.8555 - 0.4649i
|
|
0.8535 - 0.4628i
|
|
0.8515 - 0.4607i
|
|
0.8495 - 0.4586i
|
|
0.8475 - 0.4566i
|
|
0.8456 - 0.4545i
|
|
0.8437 - 0.4524i
|
|
0.8418 - 0.4504i
|
|
0.8399 - 0.4483i
|
|
0.8380 - 0.4462i
|
|
0.8362 - 0.4442i
|
|
0.8344 - 0.4421i
|
|
0.8326 - 0.4401i
|
|
0.8308 - 0.4380i
|
|
0.8290 - 0.4360i
|
|
0.8273 - 0.4340i
|
|
0.8255 - 0.4319i
|
|
0.8238 - 0.4299i
|
|
0.8221 - 0.4279i
|
|
0.8204 - 0.4259i
|
|
0.8188 - 0.4239i
|
|
0.8171 - 0.4219i
|
|
0.8155 - 0.4198i
|
|
0.8139 - 0.4178i
|
|
0.8123 - 0.4158i
|
|
0.8107 - 0.4138i
|
|
0.8091 - 0.4119i
|
|
0.8075 - 0.4099i
|
|
0.8060 - 0.4079i
|
|
0.8045 - 0.4059i
|
|
0.8030 - 0.4039i
|
|
0.8015 - 0.4020i
|
|
0.8000 - 0.4000i
|
|
0.7985 - 0.3980i
|
|
0.7971 - 0.3961i
|
|
0.7956 - 0.3941i
|
|
0.7942 - 0.3922i
|
|
0.7928 - 0.3902i
|
|
0.7914 - 0.3883i
|
|
0.7900 - 0.3864i
|
|
0.7887 - 0.3844i
|
|
0.7873 - 0.3825i
|
|
0.7860 - 0.3806i
|
|
0.7846 - 0.3787i
|
|
0.7833 - 0.3767i
|
|
0.7820 - 0.3748i
|
|
0.7807 - 0.3729i
|
|
0.7795 - 0.3710i
|
|
0.7782 - 0.3691i
|
|
0.7769 - 0.3672i
|
|
0.7757 - 0.3653i
|
|
0.7745 - 0.3635i
|
|
0.7732 - 0.3616i
|
|
0.7720 - 0.3597i
|
|
0.7708 - 0.3578i
|
|
0.7697 - 0.3560i
|
|
0.7685 - 0.3541i
|
|
0.7673 - 0.3522i
|
|
0.7662 - 0.3504i
|
|
0.7650 - 0.3485i
|
|
0.7639 - 0.3467i
|
|
0.7628 - 0.3449i
|
|
0.7617 - 0.3430i
|
|
0.7606 - 0.3412i
|
|
0.7595 - 0.3394i
|
|
0.7584 - 0.3375i
|
|
0.7574 - 0.3357i
|
|
0.7563 - 0.3339i
|
|
0.7553 - 0.3321i
|
|
0.7542 - 0.3303i
|
|
0.7532 - 0.3285i
|
|
0.7522 - 0.3267i
|
|
0.7512 - 0.3249i
|
|
0.7502 - 0.3231i
|
|
0.7492 - 0.3213i
|
|
0.7482 - 0.3195i
|
|
0.7472 - 0.3177i
|
|
0.7463 - 0.3159i
|
|
0.7453 - 0.3142i
|
|
0.7444 - 0.3124i
|
|
0.7435 - 0.3106i
|
|
0.7425 - 0.3089i
|
|
0.7416 - 0.3071i
|
|
0.7407 - 0.3054i
|
|
0.7398 - 0.3036i
|
|
0.7389 - 0.3019i
|
|
0.7380 - 0.3001i
|
|
0.7372 - 0.2984i
|
|
0.7363 - 0.2967i
|
|
0.7355 - 0.2949i
|
|
0.7346 - 0.2932i
|
|
0.7338 - 0.2915i
|
|
0.7329 - 0.2898i
|
|
0.7321 - 0.2881i
|
|
0.7313 - 0.2863i
|
|
0.7305 - 0.2846i
|
|
0.7297 - 0.2829i
|
|
0.7289 - 0.2812i
|
|
0.7281 - 0.2795i
|
|
0.7273 - 0.2778i
|
|
0.7266 - 0.2762i
|
|
0.7258 - 0.2745i
|
|
0.7250 - 0.2728i
|
|
0.7243 - 0.2711i
|
|
0.7235 - 0.2694i
|
|
0.7228 - 0.2678i
|
|
0.7221 - 0.2661i
|
|
0.7214 - 0.2644i
|
|
0.7206 - 0.2628i
|
|
0.7199 - 0.2611i
|
|
0.7192 - 0.2595i
|
|
0.7185 - 0.2578i
|
|
0.7178 - 0.2562i
|
|
0.7172 - 0.2545i
|
|
0.7165 - 0.2529i
|
|
0.7158 - 0.2512i
|
|
0.7152 - 0.2496i
|
|
0.7145 - 0.2480i
|
|
0.7139 - 0.2464i
|
|
0.7132 - 0.2447i
|
|
0.7126 - 0.2431i
|
|
0.7119 - 0.2415i
|
|
0.7113 - 0.2399i
|
|
0.7107 - 0.2383i
|
|
0.7101 - 0.2367i
|
|
0.7095 - 0.2350i
|
|
0.7089 - 0.2334i
|
|
0.7083 - 0.2318i
|
|
0.7077 - 0.2303i
|
|
0.7071 - 0.2287i
|
|
0.7065 - 0.2271i
|
|
0.7060 - 0.2255i
|
|
0.7054 - 0.2239i
|
|
0.7048 - 0.2223i
|
|
0.7043 - 0.2207i
|
|
0.7037 - 0.2192i
|
|
0.7032 - 0.2176i
|
|
0.7026 - 0.2160i
|
|
0.7021 - 0.2145i
|
|
0.7016 - 0.2129i
|
|
0.7010 - 0.2113i
|
|
0.7005 - 0.2098i
|
|
0.7000 - 0.2082i
|
|
0.6995 - 0.2067i
|
|
0.6990 - 0.2051i
|
|
0.6985 - 0.2036i
|
|
0.6980 - 0.2020i
|
|
0.6975 - 0.2005i
|
|
0.6970 - 0.1989i
|
|
0.6966 - 0.1974i
|
|
0.6961 - 0.1959i
|
|
0.6956 - 0.1943i
|
|
0.6952 - 0.1928i
|
|
0.6947 - 0.1913i
|
|
0.6942 - 0.1897i
|
|
0.6938 - 0.1882i
|
|
0.6933 - 0.1867i
|
|
0.6929 - 0.1852i
|
|
0.6925 - 0.1837i
|
|
0.6920 - 0.1822i
|
|
0.6916 - 0.1807i
|
|
0.6912 - 0.1791i
|
|
0.6908 - 0.1776i
|
|
0.6904 - 0.1761i
|
|
0.6899 - 0.1746i
|
|
0.6895 - 0.1731i
|
|
0.6891 - 0.1716i
|
|
0.6887 - 0.1701i
|
|
0.6884 - 0.1687i
|
|
0.6880 - 0.1672i
|
|
0.6876 - 0.1657i
|
|
0.6872 - 0.1642i
|
|
0.6868 - 0.1627i
|
|
0.6865 - 0.1612i
|
|
0.6861 - 0.1597i
|
|
0.6857 - 0.1583i
|
|
0.6854 - 0.1568i
|
|
0.6850 - 0.1553i
|
|
0.6847 - 0.1539i
|
|
0.6843 - 0.1524i
|
|
0.6840 - 0.1509i
|
|
0.6836 - 0.1494i
|
|
0.6833 - 0.1480i
|
|
0.6830 - 0.1465i
|
|
0.6826 - 0.1451i
|
|
0.6823 - 0.1436i
|
|
0.6820 - 0.1422i
|
|
0.6817 - 0.1407i
|
|
0.6814 - 0.1392i
|
|
0.6811 - 0.1378i
|
|
0.6808 - 0.1363i
|
|
0.6805 - 0.1349i
|
|
0.6802 - 0.1335i
|
|
0.6799 - 0.1320i
|
|
0.6796 - 0.1306i
|
|
0.6793 - 0.1291i
|
|
0.6790 - 0.1277i
|
|
0.6787 - 0.1263i
|
|
0.6785 - 0.1248i
|
|
0.6782 - 0.1234i
|
|
0.6779 - 0.1220i
|
|
0.6777 - 0.1205i
|
|
0.6774 - 0.1191i
|
|
0.6771 - 0.1177i
|
|
0.6769 - 0.1162i
|
|
0.6766 - 0.1148i
|
|
0.6764 - 0.1134i
|
|
0.6761 - 0.1120i
|
|
0.6759 - 0.1106i
|
|
0.6757 - 0.1091i
|
|
0.6754 - 0.1077i
|
|
0.6752 - 0.1063i
|
|
0.6750 - 0.1049i
|
|
0.6747 - 0.1035i
|
|
0.6745 - 0.1021i
|
|
0.6743 - 0.1007i
|
|
0.6741 - 0.0992i
|
|
0.6739 - 0.0978i
|
|
0.6737 - 0.0964i
|
|
0.6735 - 0.0950i
|
|
0.6733 - 0.0936i
|
|
0.6731 - 0.0922i
|
|
0.6729 - 0.0908i
|
|
0.6727 - 0.0894i
|
|
0.6725 - 0.0880i
|
|
0.6723 - 0.0866i
|
|
0.6721 - 0.0852i
|
|
0.6720 - 0.0838i
|
|
0.6718 - 0.0824i
|
|
0.6716 - 0.0810i
|
|
0.6714 - 0.0796i
|
|
0.6713 - 0.0783i
|
|
0.6711 - 0.0769i
|
|
0.6710 - 0.0755i
|
|
0.6708 - 0.0741i
|
|
0.6706 - 0.0727i
|
|
0.6705 - 0.0713i
|
|
0.6703 - 0.0699i
|
|
0.6702 - 0.0685i
|
|
0.6701 - 0.0672i
|
|
0.6699 - 0.0658i
|
|
0.6698 - 0.0644i
|
|
0.6697 - 0.0630i
|
|
0.6695 - 0.0616i
|
|
0.6694 - 0.0602i
|
|
0.6693 - 0.0589i
|
|
0.6691 - 0.0575i
|
|
0.6690 - 0.0561i
|
|
0.6689 - 0.0547i
|
|
0.6688 - 0.0533i
|
|
0.6687 - 0.0520i
|
|
0.6686 - 0.0506i
|
|
0.6685 - 0.0492i
|
|
0.6684 - 0.0478i
|
|
0.6683 - 0.0465i
|
|
0.6682 - 0.0451i
|
|
0.6681 - 0.0437i
|
|
0.6680 - 0.0424i
|
|
0.6679 - 0.0410i
|
|
0.6678 - 0.0396i
|
|
0.6678 - 0.0382i
|
|
0.6677 - 0.0369i
|
|
0.6676 - 0.0355i
|
|
0.6675 - 0.0341i
|
|
0.6675 - 0.0328i
|
|
0.6674 - 0.0314i
|
|
0.6673 - 0.0300i
|
|
0.6673 - 0.0287i
|
|
0.6672 - 0.0273i
|
|
0.6672 - 0.0259i
|
|
0.6671 - 0.0246i
|
|
0.6671 - 0.0232i
|
|
0.6670 - 0.0218i
|
|
0.6670 - 0.0205i
|
|
0.6669 - 0.0191i
|
|
0.6669 - 0.0177i
|
|
0.6669 - 0.0164i
|
|
0.6668 - 0.0150i
|
|
0.6668 - 0.0136i
|
|
0.6668 - 0.0123i
|
|
0.6668 - 0.0109i
|
|
0.6667 - 0.0095i
|
|
0.6667 - 0.0082i
|
|
0.6667 - 0.0068i
|
|
0.6667 - 0.0055i
|
|
0.6667 - 0.0041i
|
|
0.6667 - 0.0027i
|
|
0.6667 - 0.0014i
|
|
|
|
octave:79> w
|
|
w =
|
|
|
|
0
|
|
0.0061
|
|
0.0123
|
|
0.0184
|
|
0.0245
|
|
0.0307
|
|
0.0368
|
|
0.0430
|
|
0.0491
|
|
0.0552
|
|
0.0614
|
|
0.0675
|
|
0.0736
|
|
0.0798
|
|
0.0859
|
|
0.0920
|
|
0.0982
|
|
0.1043
|
|
0.1104
|
|
0.1166
|
|
0.1227
|
|
0.1289
|
|
0.1350
|
|
0.1411
|
|
0.1473
|
|
0.1534
|
|
0.1595
|
|
0.1657
|
|
0.1718
|
|
0.1779
|
|
0.1841
|
|
0.1902
|
|
0.1963
|
|
0.2025
|
|
0.2086
|
|
0.2148
|
|
0.2209
|
|
0.2270
|
|
0.2332
|
|
0.2393
|
|
0.2454
|
|
0.2516
|
|
0.2577
|
|
0.2638
|
|
0.2700
|
|
0.2761
|
|
0.2823
|
|
0.2884
|
|
0.2945
|
|
0.3007
|
|
0.3068
|
|
0.3129
|
|
0.3191
|
|
0.3252
|
|
0.3313
|
|
0.3375
|
|
0.3436
|
|
0.3497
|
|
0.3559
|
|
0.3620
|
|
0.3682
|
|
0.3743
|
|
0.3804
|
|
0.3866
|
|
0.3927
|
|
0.3988
|
|
0.4050
|
|
0.4111
|
|
0.4172
|
|
0.4234
|
|
0.4295
|
|
0.4357
|
|
0.4418
|
|
0.4479
|
|
0.4541
|
|
0.4602
|
|
0.4663
|
|
0.4725
|
|
0.4786
|
|
0.4847
|
|
0.4909
|
|
0.4970
|
|
0.5031
|
|
0.5093
|
|
0.5154
|
|
0.5216
|
|
0.5277
|
|
0.5338
|
|
0.5400
|
|
0.5461
|
|
0.5522
|
|
0.5584
|
|
0.5645
|
|
0.5706
|
|
0.5768
|
|
0.5829
|
|
0.5890
|
|
0.5952
|
|
0.6013
|
|
0.6075
|
|
0.6136
|
|
0.6197
|
|
0.6259
|
|
0.6320
|
|
0.6381
|
|
0.6443
|
|
0.6504
|
|
0.6565
|
|
0.6627
|
|
0.6688
|
|
0.6750
|
|
0.6811
|
|
0.6872
|
|
0.6934
|
|
0.6995
|
|
0.7056
|
|
0.7118
|
|
0.7179
|
|
0.7240
|
|
0.7302
|
|
0.7363
|
|
0.7424
|
|
0.7486
|
|
0.7547
|
|
0.7609
|
|
0.7670
|
|
0.7731
|
|
0.7793
|
|
0.7854
|
|
0.7915
|
|
0.7977
|
|
0.8038
|
|
0.8099
|
|
0.8161
|
|
0.8222
|
|
0.8283
|
|
0.8345
|
|
0.8406
|
|
0.8468
|
|
0.8529
|
|
0.8590
|
|
0.8652
|
|
0.8713
|
|
0.8774
|
|
0.8836
|
|
0.8897
|
|
0.8958
|
|
0.9020
|
|
0.9081
|
|
0.9143
|
|
0.9204
|
|
0.9265
|
|
0.9327
|
|
0.9388
|
|
0.9449
|
|
0.9511
|
|
0.9572
|
|
0.9633
|
|
0.9695
|
|
0.9756
|
|
0.9817
|
|
0.9879
|
|
0.9940
|
|
1.0002
|
|
1.0063
|
|
1.0124
|
|
1.0186
|
|
1.0247
|
|
1.0308
|
|
1.0370
|
|
1.0431
|
|
1.0492
|
|
1.0554
|
|
1.0615
|
|
1.0677
|
|
1.0738
|
|
1.0799
|
|
1.0861
|
|
1.0922
|
|
1.0983
|
|
1.1045
|
|
1.1106
|
|
1.1167
|
|
1.1229
|
|
1.1290
|
|
1.1351
|
|
1.1413
|
|
1.1474
|
|
1.1536
|
|
1.1597
|
|
1.1658
|
|
1.1720
|
|
1.1781
|
|
1.1842
|
|
1.1904
|
|
1.1965
|
|
1.2026
|
|
1.2088
|
|
1.2149
|
|
1.2210
|
|
1.2272
|
|
1.2333
|
|
1.2395
|
|
1.2456
|
|
1.2517
|
|
1.2579
|
|
1.2640
|
|
1.2701
|
|
1.2763
|
|
1.2824
|
|
1.2885
|
|
1.2947
|
|
1.3008
|
|
1.3070
|
|
1.3131
|
|
1.3192
|
|
1.3254
|
|
1.3315
|
|
1.3376
|
|
1.3438
|
|
1.3499
|
|
1.3560
|
|
1.3622
|
|
1.3683
|
|
1.3744
|
|
1.3806
|
|
1.3867
|
|
1.3929
|
|
1.3990
|
|
1.4051
|
|
1.4113
|
|
1.4174
|
|
1.4235
|
|
1.4297
|
|
1.4358
|
|
1.4419
|
|
1.4481
|
|
1.4542
|
|
1.4603
|
|
1.4665
|
|
1.4726
|
|
1.4788
|
|
1.4849
|
|
1.4910
|
|
1.4972
|
|
1.5033
|
|
1.5094
|
|
1.5156
|
|
1.5217
|
|
1.5278
|
|
1.5340
|
|
1.5401
|
|
1.5463
|
|
1.5524
|
|
1.5585
|
|
1.5647
|
|
1.5708
|
|
1.5769
|
|
1.5831
|
|
1.5892
|
|
1.5953
|
|
1.6015
|
|
1.6076
|
|
1.6137
|
|
1.6199
|
|
1.6260
|
|
1.6322
|
|
1.6383
|
|
1.6444
|
|
1.6506
|
|
1.6567
|
|
1.6628
|
|
1.6690
|
|
1.6751
|
|
1.6812
|
|
1.6874
|
|
1.6935
|
|
1.6997
|
|
1.7058
|
|
1.7119
|
|
1.7181
|
|
1.7242
|
|
1.7303
|
|
1.7365
|
|
1.7426
|
|
1.7487
|
|
1.7549
|
|
1.7610
|
|
1.7671
|
|
1.7733
|
|
1.7794
|
|
1.7856
|
|
1.7917
|
|
1.7978
|
|
1.8040
|
|
1.8101
|
|
1.8162
|
|
1.8224
|
|
1.8285
|
|
1.8346
|
|
1.8408
|
|
1.8469
|
|
1.8530
|
|
1.8592
|
|
1.8653
|
|
1.8715
|
|
1.8776
|
|
1.8837
|
|
1.8899
|
|
1.8960
|
|
1.9021
|
|
1.9083
|
|
1.9144
|
|
1.9205
|
|
1.9267
|
|
1.9328
|
|
1.9390
|
|
1.9451
|
|
1.9512
|
|
1.9574
|
|
1.9635
|
|
1.9696
|
|
1.9758
|
|
1.9819
|
|
1.9880
|
|
1.9942
|
|
2.0003
|
|
2.0064
|
|
2.0126
|
|
2.0187
|
|
2.0249
|
|
2.0310
|
|
2.0371
|
|
2.0433
|
|
2.0494
|
|
2.0555
|
|
2.0617
|
|
2.0678
|
|
2.0739
|
|
2.0801
|
|
2.0862
|
|
2.0923
|
|
2.0985
|
|
2.1046
|
|
2.1108
|
|
2.1169
|
|
2.1230
|
|
2.1292
|
|
2.1353
|
|
2.1414
|
|
2.1476
|
|
2.1537
|
|
2.1598
|
|
2.1660
|
|
2.1721
|
|
2.1783
|
|
2.1844
|
|
2.1905
|
|
2.1967
|
|
2.2028
|
|
2.2089
|
|
2.2151
|
|
2.2212
|
|
2.2273
|
|
2.2335
|
|
2.2396
|
|
2.2457
|
|
2.2519
|
|
2.2580
|
|
2.2642
|
|
2.2703
|
|
2.2764
|
|
2.2826
|
|
2.2887
|
|
2.2948
|
|
2.3010
|
|
2.3071
|
|
2.3132
|
|
2.3194
|
|
2.3255
|
|
2.3317
|
|
2.3378
|
|
2.3439
|
|
2.3501
|
|
2.3562
|
|
2.3623
|
|
2.3685
|
|
2.3746
|
|
2.3807
|
|
2.3869
|
|
2.3930
|
|
2.3991
|
|
2.4053
|
|
2.4114
|
|
2.4176
|
|
2.4237
|
|
2.4298
|
|
2.4360
|
|
2.4421
|
|
2.4482
|
|
2.4544
|
|
2.4605
|
|
2.4666
|
|
2.4728
|
|
2.4789
|
|
2.4850
|
|
2.4912
|
|
2.4973
|
|
2.5035
|
|
2.5096
|
|
2.5157
|
|
2.5219
|
|
2.5280
|
|
2.5341
|
|
2.5403
|
|
2.5464
|
|
2.5525
|
|
2.5587
|
|
2.5648
|
|
2.5710
|
|
2.5771
|
|
2.5832
|
|
2.5894
|
|
2.5955
|
|
2.6016
|
|
2.6078
|
|
2.6139
|
|
2.6200
|
|
2.6262
|
|
2.6323
|
|
2.6384
|
|
2.6446
|
|
2.6507
|
|
2.6569
|
|
2.6630
|
|
2.6691
|
|
2.6753
|
|
2.6814
|
|
2.6875
|
|
2.6937
|
|
2.6998
|
|
2.7059
|
|
2.7121
|
|
2.7182
|
|
2.7243
|
|
2.7305
|
|
2.7366
|
|
2.7428
|
|
2.7489
|
|
2.7550
|
|
2.7612
|
|
2.7673
|
|
2.7734
|
|
2.7796
|
|
2.7857
|
|
2.7918
|
|
2.7980
|
|
2.8041
|
|
2.8103
|
|
2.8164
|
|
2.8225
|
|
2.8287
|
|
2.8348
|
|
2.8409
|
|
2.8471
|
|
2.8532
|
|
2.8593
|
|
2.8655
|
|
2.8716
|
|
2.8777
|
|
2.8839
|
|
2.8900
|
|
2.8962
|
|
2.9023
|
|
2.9084
|
|
2.9146
|
|
2.9207
|
|
2.9268
|
|
2.9330
|
|
2.9391
|
|
2.9452
|
|
2.9514
|
|
2.9575
|
|
2.9637
|
|
2.9698
|
|
2.9759
|
|
2.9821
|
|
2.9882
|
|
2.9943
|
|
3.0005
|
|
3.0066
|
|
3.0127
|
|
3.0189
|
|
3.0250
|
|
3.0311
|
|
3.0373
|
|
3.0434
|
|
3.0496
|
|
3.0557
|
|
3.0618
|
|
3.0680
|
|
3.0741
|
|
3.0802
|
|
3.0864
|
|
3.0925
|
|
3.0986
|
|
3.1048
|
|
3.1109
|
|
3.1170
|
|
3.1232
|
|
3.1293
|
|
3.1355
|
|
|
|
octave:80>
|
|
Hph = rad2deg(unwrap(angle(H)));^[[201~octave:80>
|
|
octave:80>
|
|
octave:80>
|
|
octave:80>
|
|
octave:80> Hdb = 20*log10(abs(H));
|
|
Hph = rad2deg(unwrap(angle(H)));
|
|
octave:82>
|
|
octave:82>
|
|
octave:82>
|
|
octave:82>
|
|
octave:82>
|
|
octave:82> figure;
|
|
subplot(2, figure;
|
|
subplot(2, 1, 1);
|
|
plot(w, Hdb);ency (rad)");
|
|
xlabel("Frequency (rad)");
|
|
ylabel("|H| (dB)");
|
|
xlim([0 pi]);2 pi]);
|
|
xticks([0 pi/2 pi]);pi/2', '\pi'});
|
|
xticklabels({'0', '\pi/2', '\pi'});
|
|
title("Magnitude Response");
|
|
subplot(2, 1, 2);
|
|
subplot(2, 1, 2);
|
|
plot(w, Hph);ency (rad)");
|
|
xlabel("Frequency (rad)");
|
|
ylabel("Phase (deg)");
|
|
xlim([0 pi]);2 pi]);
|
|
xticks([0 pi/2 pi]);pi/2', '\pi'});
|
|
xticklabels({'0', '\pi/2', '\pi'});
|
|
title("Phase Response");
|
|
octave:99> close all
|
|
octave:100>
|
|
|
|
|
|
|
|
|
|
^[[200~zer = -0.5;
|
|
pol = 0.9*exp(j*2*pi*[-0.3 0.3]');^[[201~octave:100>
|
|
octave:100>
|
|
octave:100>
|
|
octave:100>
|
|
octave:100> zer = -0.5;
|
|
pol = 0.9*exp(j*2*pi*[-0.3 0.3]');
|
|
octave:102> zer
|
|
zer = -0.5000
|
|
octave:103> pol
|
|
pol =
|
|
|
|
-0.2781 - 0.8560i
|
|
-0.2781 + 0.8560i
|
|
|
|
octave:104>
|
|
octave:104>
|
|
octave:104>
|
|
octave:104>
|
|
octave:104>
|
|
octave:104> figure;
|
|
zplane(zer, pol);
|
|
octave:106> close all
|
|
octave:107>
|
|
octave:107>
|
|
octave:107>
|
|
octave:107>
|
|
octave:107>
|
|
octave:107> [b4,a4] = zp2tf(zer, pol, 1);
|
|
octave:108>
|
|
^[[200~[H,w] = freqz(b4, a4);^[[201~octave:108>
|
|
octave:108>
|
|
octave:108>
|
|
octave:108>
|
|
octave:108> [H,w] = freqz(b4, a4);
|
|
octave:109>
|
|
Hdb = 20*log10(abs(H));
|
|
Hph = rad2deg(unwrap(angle(H)));^[[201~octave:109>
|
|
octave:109>
|
|
octave:109>
|
|
octave:109>
|
|
octave:109> Hdb = 20*log10(abs(H));
|
|
Hph = rad2deg(unwrap(angle(H)));
|
|
octave:111>
|
|
|
|
plot(w, Hdb);
|
|
xlabel("Frequency (rad)");
|
|
ylabel("|H| (dB)");
|
|
xlim([0 pi]);
|
|
xticks([0 pi/2 pi]);
|
|
xticklabels({'0', '\pi/2', '\pi'});
|
|
title("Magnitude Response");
|
|
|
|
subplot(2, 1, 2);
|
|
plot(w, Hph);
|
|
xlabel("Frequency (rad)");
|
|
ylabel("Phase (deg)");
|
|
xlim([0 pi]);
|
|
xticks([0 pi/2 pi]);
|
|
xticklabels({'0', '\pi/2', '\pi'});
|
|
title("Phase Response");^[[201~octave:111>
|
|
octave:111>
|
|
octave:111>
|
|
octave:111>
|
|
octave:111> figure;
|
|
subplot(2, 1figure;
|
|
subplot(2, 1, 1);
|
|
plot(w, Hdb);ency (rad)");
|
|
xlabel("Frequency (rad)");
|
|
ylabel("|H| (dB)");
|
|
xlim([0 pi]);2 pi]);
|
|
xticks([0 pi/2 pi]);pi/2', '\pi'});
|
|
xticklabels({'0', '\pi/2', '\pi'});
|
|
title("Magnitude Response");
|
|
subplot(2, 1, 2);
|
|
subplot(2, 1, 2);
|
|
plot(w, Hph);ency (rad)");
|
|
xlabel("Frequency (rad)");
|
|
ylabel("Phase (deg)");
|
|
xlim([0 pi]);2 pi]);
|
|
xticks([0 pi/2 pi]);pi/2', '\pi'});
|
|
xticklabels({'0', '\pi/2', '\pi'});
|
|
title("Phase Response");
|
|
octave:128> close all
|
|
octave:129>
|
|
^[[200~a = [1 0.4 1];
|
|
b = [0.2 0.3 1];^[[201~octave:129>
|
|
octave:129>
|
|
octave:129>
|
|
octave:129>
|
|
octave:129> a = [1 0.4 1];
|
|
b = [0.2 0.3 1];
|
|
octave:131>
|
|
^[[200~w = logspace(-1, 1);
|
|
H = freqs(b, a, w);^[[201~octave:131>
|
|
octave:131>
|
|
octave:131>
|
|
octave:131>
|
|
octave:131> w = logspace(-1, 1);
|
|
H = freqs(b, a, w);
|
|
octave:133>
|
|
octave:133>
|
|
octave:133>
|
|
xlabel("Frequency (rad/s)");
|
|
ylabel("|H| (dB)");
|
|
title("Magnitude Response");
|
|
|
|
subplot(2, 1, 2);
|
|
semilogx(w, Hph);
|
|
xlabel("Frequency (rad/s)");
|
|
ylabel("Phase (deg)");
|
|
title("Phase Response");^[[201~octave:133>
|
|
octave:133>
|
|
octave:133> Hdb = 20*log10(abs(H));
|
|
Hph = rad2deg(unwrap(angle(H)));
|
|
|
|
figure;
|
|
subplot(2, 1, 1);
|
|
semilogx(w, Hdb);
|
|
xlabel("Frequency (rad/s)");
|
|
ylabel("|H| (dB)");
|
|
title("Magnitude Response");
|
|
|
|
subplot(2, 1, 2);
|
|
semilogx(w, Hph);
|
|
xlabel("Frequency (rad/s)");
|
|
ylabel("Phase (deg)");
|
|
title("Phase Response");
|
|
octave:146> close all
|
|
octave:147>
|
|
^[[200~[z, p, k] = tf2zp(b, a);
|
|
figure;
|
|
splane(z, p);^[[201~octave:147>
|
|
octave:147>
|
|
octave:147>
|
|
octave:147>
|
|
octave:147> [z, p, k] = tf2zp(b, a);
|
|
figure;
|
|
splane(z, p);
|
|
octave:150> close all
|
|
octave:151> load handel
|
|
octave:152> soundsc(y, Fs)
|
|
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
|
|
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
|
|
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
|
|
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
|
|
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
|
|
Cannot connect to server socket err = No such file or directory
|
|
Cannot connect to server request channel
|
|
jack server is not running or cannot be started
|
|
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping un
|
|
lock
|
|
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping un
|
|
lock
|
|
Cannot connect to server socket err = No such file or directory
|
|
Cannot connect to server request channel
|
|
jack server is not running or cannot be started
|
|
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping un
|
|
lock
|
|
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping un
|
|
lock
|
|
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
|
|
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
|
|
ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback
|
|
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
|
|
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
|
|
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
|
|
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
|
|
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
|
|
Cannot connect to server socket err = No such file or directory
|
|
Cannot connect to server request channel
|
|
jack server is not running or cannot be started
|
|
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping un
|
|
lock
|
|
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping un
|
|
lock
|
|
octave:153> size(y)
|
|
ans =
|
|
|
|
73113 1
|
|
|
|
octave:154> ufs
|
|
error: 'ufs' undefined near line 1, column 1
|
|
octave:155> Fs
|
|
Fs = 8192
|
|
octave:156>
|
|
^[[200~T = 1/Fs;
|
|
t = 0:T:(length(y)-1)*T;^[[201~octave:156>
|
|
octave:156>
|
|
octave:156>
|
|
octave:156>
|
|
octave:156> T = 1/Fs;
|
|
t = 0:T:(length(y)-1)*T;
|
|
octave:158>
|
|
|
|
noise = 0.2*sin(2*pi*t*Fnoise).'; % additive "noise" with freq. 2.5kHz
|
|
y = noise + y;^[[201~octave:158>
|
|
octave:158>
|
|
octave:158>
|
|
octave:158>
|
|
octave:158> Fnoise = 2500;
|
|
noise = 0.2*sin(2*pi*t*Fnoise).'; % additive "noise" with freq. 2.5kHz
|
|
y = noise + y;
|
|
octave:161> soundsc(y, Fs)
|
|
octave:162>
|
|
octave:162>
|
|
octave:162>
|
|
octave:162>
|
|
octave:162>
|
|
octave:162> N = 2^15;
|
|
S = fft(y, N); % N-point DFT (best to use power of 2)
|
|
octave:164> N
|
|
N = 32768
|
|
octave:165>
|
|
^[[200~S = fftshift(abs(S)) / N;^[[201~octave:165>
|
|
octave:165>
|
|
octave:165>
|
|
octave:165>
|
|
octave:165> S = fftshift(abs(S)) / N;
|
|
octave:166>
|
|
^[[200~F = Fs .* (-N/2:N/2-1) / N;^[[201~octave:166>
|
|
octave:166>
|
|
octave:166>
|
|
octave:166>
|
|
octave:166> F = Fs .* (-N/2:N/2-1) / N;
|
|
octave:167>
|
|
octave:167>
|
|
title 'Fourier Transform of Audio';
|
|
xlabel 'Frequency (Hz)';
|
|
ylabel 'Magnitude';^[[201~octave:167>
|
|
octave:167>
|
|
octave:167>
|
|
octave:167> figure;
|
|
plot(F, S);
|
|
title 'Fourier Transform of Audio';
|
|
xlabel 'Frequency (Hz)';
|
|
ylabel 'Magnitude';
|
|
octave:172> close all
|
|
octave:173>
|
|
^[[200~figure;
|
|
plot(F2, abs(S));
|
|
% plot(F3, abs(S));
|
|
% plot(F4, abs(S));
|
|
title 'Fourier Transform of Audio';
|
|
xlabel 'Frequency (Hz)';
|
|
ylabel 'Magnitude';^[[201~octave:173>
|
|
octave:173>
|
|
octave:173>
|
|
octave:173>
|
|
octave:173> figure;
|
|
plot(F2, abs(S));
|
|
% plot(F3, abs(S));
|
|
% plot(F4, abs(S));
|
|
title 'Fourier Transform of Audio';
|
|
xlabel 'Frequency (Hz)';
|
|
ylabel 'Magnitude';
|
|
error: 'F2' undefined near line 1, column 6
|
|
octave:178>
|
|
^[[200~ * Fs / (2 * pi);^[[201~octave:178>
|
|
octave:178>
|
|
octave:178>
|
|
octave:178>
|
|
octave:178> * Fs / (2 * pi);
|
|
wd = linspace(-pi, pi, N+1);
|
|
wd = wd(1:end-1);
|
|
F2 = wd * Fs / (2 * pi);error: parse error:
|
|
|
|
syntax error
|
|
|
|
>>> * Fs / (2 * pi);
|
|
^
|
|
octave:178>
|
|
octave:178>
|
|
octave:178>
|
|
octave:178>
|
|
octave:178> wd = linspace(-pi, pi, N+1);
|
|
octave:179> wd = wd(1:end-1);
|
|
octave:180> F2 = wd * Fs / (2 * pi);
|
|
octave:181> close all
|
|
octave:182>
|
|
^[[200~figure;
|
|
plot(F2, abs(S));
|
|
% plot(F3, abs(S));
|
|
% plot(F4, abs(S));
|
|
title 'Fourier Transform of Audio';
|
|
xlabel 'Frequency (Hz)';
|
|
ylabel 'Magnitude';^[[201~octave:182>
|
|
octave:182>
|
|
octave:182>
|
|
octave:182>
|
|
octave:182> figure;
|
|
plot(F2, abs(S));
|
|
% plot(F3, abs(S));
|
|
% plot(F4, abs(S));
|
|
title 'Fourier Transform of Audio';
|
|
xlabel 'Frequency (Hz)';
|
|
ylabel 'Magnitude';
|
|
octave:187> close all
|
|
octave:188>
|
|
octave:188>
|
|
octave:188>
|
|
octave:188>
|
|
octave:188>
|
|
octave:188> x = imread('bw-cat.jpg');
|
|
imshow(x);
|
|
octave:190> close all
|
|
octave:191>
|
|
octave:191>
|
|
octave:191>
|
|
octave:191>
|
|
octave:191>
|
|
octave:191> F = fftshift(fft2(x));
|
|
octave:192>
|
|
^[[200~lpf_mask = zeros(size(F));
|
|
[H, W] = size(F);
|
|
lpf_mask(floor(H/2-H/10):floor(H/2+H/10), ...
|
|
floor(W/2-W/10):floor(W/2+W/10)) = 1;^[[201~octave:192>
|
|
octave:192>
|
|
octave:192>
|
|
octave:192>
|
|
octave:192> lpf_mask = zeros(size(F));
|
|
[H, W] = size(F);
|
|
lpf_mask(floor(H/2-H/10):floor(H/2+H/10), ...
|
|
floor(W/2-W/10):floor(W/2+W/10)) = 1;
|
|
octave:195>
|
|
^[[200~figure;
|
|
subplot(121);
|
|
% Normalize FFT to range [0, 1]
|
|
imshow(log(abs(F)) / max(log(abs(F(:)))));
|
|
title 'Fourier transform';^[[201~octave:195>
|
|
octave:195>
|
|
octave:195>
|
|
octave:195>
|
|
octave:195> figure;
|
|
subplot(121);
|
|
% Normalize FFT to range [0, 1]
|
|
imshow(log(abs(F)) / max(log(abs(F(:)))));
|
|
title 'Fourier transform';
|
|
octave:199>
|
|
octave:199>
|
|
octave:199>
|
|
octave:199>
|
|
octave:199>
|
|
octave:199> % Show the LPF mask
|
|
subplot(122);
|
|
imshow(lpf_mask);
|
|
title 'LPF mask';
|
|
octave:202> close all
|
|
octave:203>
|
|
octave:203>
|
|
octave:203>
|
|
octave:203>
|
|
octave:203>
|
|
octave:203> im_filtered_fft = lpf_mask .* F; % high frequencies remove
|
|
d im_filtered_fft = lpf_mask .* F; % high frequencies remove
|
|
d = ifft2(ifftshift(im_filtered_fft)); % ifft2 == ifft 2-D
|
|
f = ifft2(ifftshift(im_filtered_fft)); % ifft2 == ifft 2-Dfft(:)))));
|
|
imshow(log(abs(im_filtered_fft)) / max(log(abs(im_filtered_fft(:)))));
|
|
title 'Filtered FFT';
|
|
octave:207> close all
|
|
octave:208>
|
|
^[[200~figure;
|
|
subplot(121);
|
|
fnorm = abs(f) / max(abs(f(:)));
|
|
imshow(fnorm);
|
|
title 'High frequencies removed';
|
|
|
|
subplot(122);
|
|
xnorm = abs(double(x)) / max(double(x(:)));
|
|
imshow(xnorm);
|
|
title 'Original image';^[[201~octave:208>
|
|
octave:208>
|
|
octave:208>
|
|
octave:208>
|
|
octave:208> figure;
|
|
subplot(121);
|
|
fnorm = abs(f) / max(abs(f(:)));
|
|
imshow(fnorm);
|
|
title 'High frequencies removed';
|
|
|
|
subplot(122);
|
|
xnorm = abs(double(x)) / max(double(x(:)));
|
|
imshow(xnorm);
|
|
title 'Original image';
|
|
octave:217> close all
|
|
octave:218>
|
|
octave:218>
|
|
octave:218>
|
|
octave:218>
|
|
octave:218>
|
|
octave:218> sharp_image = abs(fnorm - xnorm);
|
|
sharp_image_norm = sharp_image / max(sharp_image(:));
|
|
imshow(sharp_image_norm);
|
|
|
|
%% Pinpoints these changes
|
|
edge_image = zeros(size(sharp_image_norm));
|
|
edge_image(sharp_image_norm > 3.5*std(sharp_image_norm(:))) = 1;
|
|
imshow(edge_image);
|
|
octave:224> close all
|
|
octave:225>
|