Function File: [phi, w] = phasez (b, a, n)
Function File: [phi, w] = phasez (b, a)
Function File: [phi, w] = phasez (sos, n)
Function File: [phi, w] = phasez (sos)
Function File: [phi, w] = phasez (…, n, "whole")
Function File: [phi, w] = phasez (…, n, Fs)
Function File: phasez (…)

Compute the phase response of digital filter defined either by its coefficients (b and a are the numerator and denominator coefficients respectively) or by its second-order sections representation, given by the matrix sos. The output phi is the phase response computed in a vector the vector of frequencies w.

The phase response is evaluated at n angular frequencies between 0 and pi.

If a is omitted, the denominator is assumed to be 1 (this corresponds to a simple FIR filter).

If n is omitted, a value of 512 is assumed.

If the third/forth argument, "whole", is given, the response is evaluated at n angular frequencies between 0 and 2*pi. It is possible also to pass the value "half", which will lead to the default behaviour.

Example:

[b, a] = butter (2, [.15,.3]);
phasez (b, a);

Ref [1] Oppenheim, Alan, and Ronald Schafer. Discrete-Time Signal Processing. 3rd edition, Pearson, 2009.

See also: freqz, phasedelay.

Demonstration 1

The following code

 N = 2;
 b = ones (1, N)/N;
 a = 1;
 [phi, w] = phasez (b, a)
 ## test input validation

Produces the following output

phi =

        0
  -0.0031
  -0.0061
  -0.0092
  -0.0123
  -0.0153
  -0.0184
  -0.0215
  -0.0245
  -0.0276
  -0.0307
  -0.0337
  -0.0368
  -0.0399
  -0.0430
  -0.0460
  -0.0491
  -0.0522
  -0.0552
  -0.0583
  -0.0614
  -0.0644
  -0.0675
  -0.0706
  -0.0736
  -0.0767
  -0.0798
  -0.0828
  -0.0859
  -0.0890
  -0.0920
  -0.0951
  -0.0982
  -0.1012
  -0.1043
  -0.1074
  -0.1104
  -0.1135
  -0.1166
  -0.1197
  -0.1227
  -0.1258
  -0.1289
  -0.1319
  -0.1350
  -0.1381
  -0.1411
  -0.1442
  -0.1473
  -0.1503
  -0.1534
  -0.1565
  -0.1595
  -0.1626
  -0.1657
  -0.1687
  -0.1718
  -0.1749
  -0.1779
  -0.1810
  -0.1841
  -0.1871
  -0.1902
  -0.1933
  -0.1963
  -0.1994
  -0.2025
  -0.2056
  -0.2086
  -0.2117
  -0.2148
  -0.2178
  -0.2209
  -0.2240
  -0.2270
  -0.2301
  -0.2332
  -0.2362
  -0.2393
  -0.2424
  -0.2454
  -0.2485
  -0.2516
  -0.2546
  -0.2577
  -0.2608
  -0.2638
  -0.2669
  -0.2700
  -0.2730
  -0.2761
  -0.2792
  -0.2823
  -0.2853
  -0.2884
  -0.2915
  -0.2945
  -0.2976
  -0.3007
  -0.3037
  -0.3068
  -0.3099
  -0.3129
  -0.3160
  -0.3191
  -0.3221
  -0.3252
  -0.3283
  -0.3313
  -0.3344
  -0.3375
  -0.3405
  -0.3436
  -0.3467
  -0.3497
  -0.3528
  -0.3559
  -0.3590
  -0.3620
  -0.3651
  -0.3682
  -0.3712
  -0.3743
  -0.3774
  -0.3804
  -0.3835
  -0.3866
  -0.3896
  -0.3927
  -0.3958
  -0.3988
  -0.4019
  -0.4050
  -0.4080
  -0.4111
  -0.4142
  -0.4172
  -0.4203
  -0.4234
  -0.4264
  -0.4295
  -0.4326
  -0.4357
  -0.4387
  -0.4418
  -0.4449
  -0.4479
  -0.4510
  -0.4541
  -0.4571
  -0.4602
  -0.4633
  -0.4663
  -0.4694
  -0.4725
  -0.4755
  -0.4786
  -0.4817
  -0.4847
  -0.4878
  -0.4909
  -0.4939
  -0.4970
  -0.5001
  -0.5031
  -0.5062
  -0.5093
  -0.5123
  -0.5154
  -0.5185
  -0.5216
  -0.5246
  -0.5277
  -0.5308
  -0.5338
  -0.5369
  -0.5400
  -0.5430
  -0.5461
  -0.5492
  -0.5522
  -0.5553
  -0.5584
  -0.5614
  -0.5645
  -0.5676
  -0.5706
  -0.5737
  -0.5768
  -0.5798
  -0.5829
  -0.5860
  -0.5890
  -0.5921
  -0.5952
  -0.5983
  -0.6013
  -0.6044
  -0.6075
  -0.6105
  -0.6136
  -0.6167
  -0.6197
  -0.6228
  -0.6259
  -0.6289
  -0.6320
  -0.6351
  -0.6381
  -0.6412
  -0.6443
  -0.6473
  -0.6504
  -0.6535
  -0.6565
  -0.6596
  -0.6627
  -0.6657
  -0.6688
  -0.6719
  -0.6750
  -0.6780
  -0.6811
  -0.6842
  -0.6872
  -0.6903
  -0.6934
  -0.6964
  -0.6995
  -0.7026
  -0.7056
  -0.7087
  -0.7118
  -0.7148
  -0.7179
  -0.7210
  -0.7240
  -0.7271
  -0.7302
  -0.7332
  -0.7363
  -0.7394
  -0.7424
  -0.7455
  -0.7486
  -0.7517
  -0.7547
  -0.7578
  -0.7609
  -0.7639
  -0.7670
  -0.7701
  -0.7731
  -0.7762
  -0.7793
  -0.7823
  -0.7854
  -0.7885
  -0.7915
  -0.7946
  -0.7977
  -0.8007
  -0.8038
  -0.8069
  -0.8099
  -0.8130
  -0.8161
  -0.8191
  -0.8222
  -0.8253
  -0.8283
  -0.8314
  -0.8345
  -0.8376
  -0.8406
  -0.8437
  -0.8468
  -0.8498
  -0.8529
  -0.8560
  -0.8590
  -0.8621
  -0.8652
  -0.8682
  -0.8713
  -0.8744
  -0.8774
  -0.8805
  -0.8836
  -0.8866
  -0.8897
  -0.8928
  -0.8958
  -0.8989
  -0.9020
  -0.9050
  -0.9081
  -0.9112
  -0.9143
  -0.9173
  -0.9204
  -0.9235
  -0.9265
  -0.9296
  -0.9327
  -0.9357
  -0.9388
  -0.9419
  -0.9449
  -0.9480
  -0.9511
  -0.9541
  -0.9572
  -0.9603
  -0.9633
  -0.9664
  -0.9695
  -0.9725
  -0.9756
  -0.9787
  -0.9817
  -0.9848
  -0.9879
  -0.9910
  -0.9940
  -0.9971
  -1.0002
  -1.0032
  -1.0063
  -1.0094
  -1.0124
  -1.0155
  -1.0186
  -1.0216
  -1.0247
  -1.0278
  -1.0308
  -1.0339
  -1.0370
  -1.0400
  -1.0431
  -1.0462
  -1.0492
  -1.0523
  -1.0554
  -1.0584
  -1.0615
  -1.0646
  -1.0677
  -1.0707
  -1.0738
  -1.0769
  -1.0799
  -1.0830
  -1.0861
  -1.0891
  -1.0922
  -1.0953
  -1.0983
  -1.1014
  -1.1045
  -1.1075
  -1.1106
  -1.1137
  -1.1167
  -1.1198
  -1.1229
  -1.1259
  -1.1290
  -1.1321
  -1.1351
  -1.1382
  -1.1413
  -1.1443
  -1.1474
  -1.1505
  -1.1536
  -1.1566
  -1.1597
  -1.1628
  -1.1658
  -1.1689
  -1.1720
  -1.1750
  -1.1781
  -1.1812
  -1.1842
  -1.1873
  -1.1904
  -1.1934
  -1.1965
  -1.1996
  -1.2026
  -1.2057
  -1.2088
  -1.2118
  -1.2149
  -1.2180
  -1.2210
  -1.2241
  -1.2272
  -1.2303
  -1.2333
  -1.2364
  -1.2395
  -1.2425
  -1.2456
  -1.2487
  -1.2517
  -1.2548
  -1.2579
  -1.2609
  -1.2640
  -1.2671
  -1.2701
  -1.2732
  -1.2763
  -1.2793
  -1.2824
  -1.2855
  -1.2885
  -1.2916
  -1.2947
  -1.2977
  -1.3008
  -1.3039
  -1.3070
  -1.3100
  -1.3131
  -1.3162
  -1.3192
  -1.3223
  -1.3254
  -1.3284
  -1.3315
  -1.3346
  -1.3376
  -1.3407
  -1.3438
  -1.3468
  -1.3499
  -1.3530
  -1.3560
  -1.3591
  -1.3622
  -1.3652
  -1.3683
  -1.3714
  -1.3744
  -1.3775
  -1.3806
  -1.3837
  -1.3867
  -1.3898
  -1.3929
  -1.3959
  -1.3990
  -1.4021
  -1.4051
  -1.4082
  -1.4113
  -1.4143
  -1.4174
  -1.4205
  -1.4235
  -1.4266
  -1.4297
  -1.4327
  -1.4358
  -1.4389
  -1.4419
  -1.4450
  -1.4481
  -1.4511
  -1.4542
  -1.4573
  -1.4603
  -1.4634
  -1.4665
  -1.4696
  -1.4726
  -1.4757
  -1.4788
  -1.4818
  -1.4849
  -1.4880
  -1.4910
  -1.4941
  -1.4972
  -1.5002
  -1.5033
  -1.5064
  -1.5094
  -1.5125
  -1.5156
  -1.5186
  -1.5217
  -1.5248
  -1.5278
  -1.5309
  -1.5340
  -1.5370
  -1.5401
  -1.5432
  -1.5463
  -1.5493
  -1.5524
  -1.5555
  -1.5585
  -1.5616
  -1.5647
  -1.5677

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

Package: signal