/usr/share/octave/packages/signal-1.2.2/doc-cache is in octave-signal 1.2.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 | # Created by Octave 3.8.0, Mon Feb 24 23:59:26 2014 UTC <root@klock>
# name: cache
# type: cell
# rows: 3
# columns: 140
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
ar_psd
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4320
Usage:
[psd,f_out] = ar_psd(a,v,freq,Fs,range,method,plot_type)
Calculate the power spectrum of the autoregressive model
M
x(n) = sqrt(v).e(n) + SUM a(k).x(n-k)
k=1
where x(n) is the output of the model and e(n) is white noise.
This function is intended for use with
[a,v,k] = arburg(x,poles,criterion)
which use the Burg (1968) method to calculate a "maximum entropy"
autoregressive model of "x". This function runs on octave and matlab.
If the "freq" argument is a vector (of frequencies) the spectrum is
calculated using the polynomial method and the "method" argument is
ignored. For scalar "freq", an integer power of 2, or "method='FFT'",
causes the spectrum to be calculated by FFT. Otherwise, the spectrum
is calculated as a polynomial. It may be computationally more
efficient to use the FFT method if length of the model is not much
smaller than the number of frequency values. The spectrum is scaled so
that spectral energy (area under spectrum) is the same as the
time-domain energy (mean square of the signal).
ARGUMENTS:
All but the first two arguments are optional and may be empty.
a %% [vector] list of M=(order+1) autoregressive model
%% coefficients. The first element of "ar_coeffs" is the
%% zero-lag coefficient, which always has a value of 1.
v %% [real scalar] square of the moving-average coefficient of
%% the AR model.
freq %% [real vector] frequencies at which power spectral density
%% is calculated
%% [integer scalar] number of uniformly distributed frequency
%% values at which spectral density is calculated.
%% [default=256]
Fs %% [real scalar] sampling frequency (Hertz) [default=1]
CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
Control-string arguments can be in any order after the other arguments.
range %% 'half', 'onesided' : frequency range of the spectrum is
%% from zero up to but not including sample_f/2. Power
%% from negative frequencies is added to the positive
%% side of the spectrum.
%% 'whole', 'twosided' : frequency range of the spectrum is
%% -sample_f/2 to sample_f/2, with negative frequencies
%% stored in "wrap around" order after the positive
%% frequencies; e.g. frequencies for a 10-point 'twosided'
%% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
%% 'shift', 'centerdc' : same as 'whole' but with the first half
%% of the spectrum swapped with second half to put the
%% zero-frequency value in the middle. (See "help
%% fftshift". If "freq" is vector, 'shift' is ignored.
%% If model coefficients "ar_coeffs" are real, the default
%% range is 'half', otherwise default range is 'whole'.
method %% 'fft': use FFT to calculate power spectrum.
%% 'poly': calculate power spectrum as a polynomial of 1/z
%% N.B. this argument is ignored if the "freq" argument is a
%% vector. The default is 'poly' unless the "freq"
%% argument is an integer power of 2.
plot_type%% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
%% specifies the type of plot. The default is 'plot', which
%% means linear-linear axes. 'squared' is the same as 'plot'.
%% 'dB' plots "10*log10(psd)". This argument is ignored and a
%% spectrum is not plotted if the caller requires a returned
%% value.
RETURNED VALUES:
If returned values are not required by the caller, the spectrum
is plotted and nothing is returned.
psd %% [real vector] estimate of power-spectral density
f_out %% [real vector] frequency values
N.B. arburg runs in octave and matlab, and does not depend on octave-forge
or signal-processing-toolbox functions.
REFERENCE
[1] Equation 2.28 from Steven M. Kay and Stanley Lawrence Marple Jr.:
"Spectrum analysis -- a modern perspective",
Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
Usage:
[psd,f_out] = ar_psd(a,v,freq,Fs,range,method,plot_type)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
arburg
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4080
[a,v,k] = arburg(x,poles,criterion)
Calculate coefficients of an autoregressive (AR) model of complex data
"x" using the whitening lattice-filter method of Burg (1968). The inverse
of the model is a moving-average filter which reduces "x" to white noise.
The power spectrum of the AR model is an estimate of the maximum
entropy power spectrum of the data. The function "ar_psd" calculates the
power spectrum of the AR model.
ARGUMENTS:
x %% [vector] sampled data
poles %% [integer scalar] number of poles in the AR model or
%% limit to the number of poles if a
%% valid "stop_crit" is provided.
criterion %% [optional string arg] model-selection criterion. Limits
%% the number of poles so that spurious poles are not
%% added when the whitened data has no more information
%% in it (see Kay & Marple, 1981). Recognised values are
%% 'AKICc' -- approximate corrected Kullback information
%% criterion (recommended),
%% 'KIC' -- Kullback information criterion
%% 'AICc' -- corrected Akaike information criterion
%% 'AIC' -- Akaike information criterion
%% 'FPE' -- final prediction error" criterion
%% The default is to NOT use a model-selection criterion
RETURNED VALUES:
a %% [polynomial/vector] list of (P+1) autoregression coeffic-
%% ients; for data input x(n) and white noise e(n),
%% the model is
%% P+1
%% x(n) = sqrt(v).e(n) + SUM a(k).x(n-k)
%% k=1
v %% [real scalar] mean square of residual noise from the
%% whitening operation of the Burg lattice filter.
k %% [column vector] reflection coefficients defining the
%% lattice-filter embodiment of the model
HINTS:
(1) arburg does not remove the mean from the data. You should remove
the mean from the data if you want a power spectrum. A non-zero mean
can produce large errors in a power-spectrum estimate. See
"help detrend".
(2) If you don't know what the value of "poles" should be, choose the
largest (reasonable) value you could want and use the recommended
value, criterion='AKICc', so that arburg can find it.
E.g. arburg(x,64,'AKICc')
The AKICc has the least bias and best resolution of the available
model-selection criteria.
(3) arburg runs in octave and matlab, does not depend on octave forge
or signal-processing-toolbox functions.
(4) Autoregressive and moving-average filters are stored as polynomials
which, in matlab, are row vectors.
NOTE ON SELECTION CRITERION
AIC, AICc, KIC and AKICc are based on information theory. They attempt
to balance the complexity (or length) of the model against how well the
model fits the data. AIC and KIC are biassed estimates of the asymmetric
and the symmetric Kullback-Leibler divergence respectively. AICc and
AKICc attempt to correct the bias. See reference [4].
REFERENCES
[1] John Parker Burg (1968)
"A new analysis technique for time series data",
NATO advanced study Institute on Signal Processing with Emphasis on
Underwater Acoustics, Enschede, Netherlands, Aug. 12-23, 1968.
[2] Steven M. Kay and Stanley Lawrence Marple Jr.:
"Spectrum analysis -- a modern perspective",
Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981
[3] William H. Press and Saul A. Teukolsky and William T. Vetterling and
Brian P. Flannery
"Numerical recipes in C, The art of scientific computing", 2nd edition,
Cambridge University Press, 2002 --- Section 13.7.
[4] Abd-Krim Seghouane and Maiza Bekara
"A small sample model selection criterion based on Kullback's symmetric
divergence", IEEE Transactions on Signal Processing,
Vol. 52(12), pp 3314-3323, Dec. 2004
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
[a,v,k] = arburg(x,poles,criterion)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
aryule
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 799
usage: [a, v, k] = aryule (x, p)
fits an AR (p)-model with Yule-Walker estimates.
x = data vector to estimate
a: AR coefficients
v: variance of white noise
k: reflection coeffients for use in lattice filter
The power spectrum of the resulting filter can be plotted with
pyulear(x, p), or you can plot it directly with ar_psd(a,v,...).
See also:
pyulear, power, freqz, impz -- for observing characteristics of the model
arburg -- for alternative spectral estimators
Example: Use example from arburg, but substitute aryule for arburg.
Note: Orphanidis '85 claims lattice filters are more tolerant of
truncation errors, which is why you might want to use them. However,
lacking a lattice filter processor, I haven't tested that the lattice
filter coefficients are reasonable.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
usage: [a, v, k] = aryule (x, p)
fits an AR (p)-model with Yule-Walker esti
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
barthannwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 137
-- Function File: [W] = barthannwin( L)
Compute the modified Bartlett-Hann window of lenght L.
See also: rectwin, bartlett.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Compute the modified Bartlett-Hann window of lenght L.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
besselap
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 105
Return bessel analog filter prototype.
References:
http://en.wikipedia.org/wiki/Bessel_polynomials
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Return bessel analog filter prototype.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
besself
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 804
Generate a bessel filter.
Default is a Laplace space (s) filter.
[b,a] = besself(n, Wc)
low pass filter with cutoff pi*Wc radians
[b,a] = besself(n, Wc, 'high')
high pass filter with cutoff pi*Wc radians
[b,a] = besself(n, [Wl, Wh])
band pass filter with edges pi*Wl and pi*Wh radians
[b,a] = besself(n, [Wl, Wh], 'stop')
band reject filter with edges pi*Wl and pi*Wh radians
[z,p,g] = besself(...)
return filter as zero-pole-gain rather than coefficients of the
numerator and denominator polynomials.
[...] = besself(...,'z')
return a discrete space (Z) filter, W must be less than 1.
[a,b,c,d] = besself(...)
return state-space matrices
References:
Proakis & Manolakis (1992). Digital Signal Processing. New York:
Macmillan Publishing Company.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Generate a bessel filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
bilinear
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2658
usage: [Zz, Zp, Zg] = bilinear(Sz, Sp, Sg, T)
[Zb, Za] = bilinear(Sb, Sa, T)
Transform a s-plane filter specification into a z-plane
specification. Filters can be specified in either zero-pole-gain or
transfer function form. The input form does not have to match the
output form. 1/T is the sampling frequency represented in the z plane.
Note: this differs from the bilinear function in the signal processing
toolbox, which uses 1/T rather than T.
Theory: Given a piecewise flat filter design, you can transform it
from the s-plane to the z-plane while maintaining the band edges by
means of the bilinear transform. This maps the left hand side of the
s-plane into the interior of the unit circle. The mapping is highly
non-linear, so you must design your filter with band edges in the
s-plane positioned at 2/T tan(w*T/2) so that they will be positioned
at w after the bilinear transform is complete.
The following table summarizes the transformation:
+---------------+-----------------------+----------------------+
| Transform | Zero at x | Pole at x |
| H(S) | H(S) = S-x | H(S)=1/(S-x) |
+---------------+-----------------------+----------------------+
| 2 z-1 | zero: (2+xT)/(2-xT) | zero: -1 |
| S -> - --- | pole: -1 | pole: (2+xT)/(2-xT) |
| T z+1 | gain: (2-xT)/T | gain: (2-xT)/T |
+---------------+-----------------------+----------------------+
With tedious algebra, you can derive the above formulae yourself by
substituting the transform for S into H(S)=S-x for a zero at x or
H(S)=1/(S-x) for a pole at x, and converting the result into the
form:
H(Z)=g prod(Z-Xi)/prod(Z-Xj)
Please note that a pole and a zero at the same place exactly cancel.
This is significant since the bilinear transform creates numerous
extra poles and zeros, most of which cancel. Those which do not
cancel have a "fill-in" effect, extending the shorter of the sets to
have the same number of as the longer of the sets of poles and zeros
(or at least split the difference in the case of the band pass
filter). There may be other opportunistic cancellations but I will
not check for them.
Also note that any pole on the unit circle or beyond will result in
an unstable filter. Because of cancellation, this will only happen
if the number of poles is smaller than the number of zeros. The
analytic design methods all yield more poles than zeros, so this will
not be a problem.
References:
Proakis & Manolakis (1992). Digital Signal Processing. New York:
Macmillan Publishing Company.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
usage: [Zz, Zp, Zg] = bilinear(Sz, Sp, Sg, T)
[Zb, Za] = bilinear(Sb, S
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
bitrevorder
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 111
-- Function File: [Y I] = bitrevorder( X)
Reorder x in the bit reversed order
See also: fft,ifft.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Reorder x in the bit reversed order
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
blackmanharris
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 121
-- Function File: [W] = blackmanharris( L)
Compute the Blackman-Harris window.
See also: rectwin, bartlett.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Compute the Blackman-Harris window.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
blackmannuttall
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 124
-- Function File: [W] = blackmannuttall( L)
Compute the Blackman-Nuttall window.
See also: nuttallwin, kaiser.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Compute the Blackman-Nuttall window.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
bohmanwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 119
-- Function File: [W] = bohmanwin( L)
Compute the Bohman window of lenght L.
See also: rectwin, bartlett.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Compute the Bohman window of lenght L.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
boxcar
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 95
usage: w = boxcar (n)
Returns the filter coefficients of a rectangular window of length n.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
usage: w = boxcar (n)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
buffer
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1492
-- Function File: Y = buffer (X, N, P, OPT)
-- Function File: [Y, Z, OPT] = buffer (...)
Buffer a signal into a data frame. The arguments to 'buffer' are
X
The data to be buffered.
N
The number of rows in the produced data buffer. This is an
positive integer value and must be supplied.
P
An integer less than N that specifies the under- or overlap
between column in the data frame. The default value of P is
0.
OPT
In the case of an overlap, OPT can be either a vector of
length P or the string 'nodelay'. If OPT is a vector, then
the first P entries in Y will be filled with these values. If
OPT is the string 'nodelay', then the first value of Y
corresponds to the first value of X.
In the can of an underlap, OPT must be an integer between 0
and '-P'. The represents the initial underlap of the first
column of Y.
The default value for OPT the vector 'zeros (1, P)' in the
case of an overlap, or 0 otherwise.
In the case of a single output argument, Y will be padded with
zeros to fill the missing values in the data frame. With two
output arguments Z is the remaining data that has not been used in
the current data frame.
Likewise, the output OPT is the overlap, or underlap that might be
used for a future call to 'code' to allow continuous buffering.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Buffer a signal into a data frame.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
buttap
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 218
-- Function File: [Z, P, G] = buttap (N)
Design lowpass analog Butterworth filter.
This function exists only for matlab compatibility and is
equivalent to 'butter (N, 1, "s")'
See also: butter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Design lowpass analog Butterworth filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
butter
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 799
Generate a butterworth filter.
Default is a discrete space (Z) filter.
[b,a] = butter(n, Wc)
low pass filter with cutoff pi*Wc radians
[b,a] = butter(n, Wc, 'high')
high pass filter with cutoff pi*Wc radians
[b,a] = butter(n, [Wl, Wh])
band pass filter with edges pi*Wl and pi*Wh radians
[b,a] = butter(n, [Wl, Wh], 'stop')
band reject filter with edges pi*Wl and pi*Wh radians
[z,p,g] = butter(...)
return filter as zero-pole-gain rather than coefficients of the
numerator and denominator polynomials.
[...] = butter(...,'s')
return a Laplace space filter, W can be larger than 1.
[a,b,c,d] = butter(...)
return state-space matrices
References:
Proakis & Manolakis (1992). Digital Signal Processing. New York:
Macmillan Publishing Company.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Generate a butterworth filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
buttord
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1107
Compute butterworth filter order and cutoff for the desired response
characteristics. Rp is the allowable decibels of ripple in the pass
band. Rs is the minimum attenuation in the stop band.
[n, Wc] = buttord(Wp, Ws, Rp, Rs)
Low pass (Wp<Ws) or high pass (Wp>Ws) filter design. Wp is the
pass band edge and Ws is the stop band edge. Frequencies are
normalized to [0,1], corresponding to the range [0,Fs/2].
[n, Wc] = buttord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
filter design. Wp gives the edges of the pass band, and Ws gives
the edges of the stop band.
Theory: |H(W)|^2 = 1/[1+(W/Wc)^(2N)] = 10^(-R/10)
With some algebra, you can solve simultaneously for Wc and N given
Ws,Rs and Wp,Rp. For high pass filters, subtracting the band edges
from Fs/2, performing the test, and swapping the resulting Wc back
works beautifully. For bandpass and bandstop filters this process
significantly overdesigns. Artificially dividing N by 2 in this case
helps a lot, but it still overdesigns.
See also: butter
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute butterworth filter order and cutoff for the desired response
character
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
cceps
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 195
usage: cceps (x [, correct])
Returns the complex cepstrum of the vector x.
If the optional argument correct has the value 1, a correction
method is applied. The default is not to do this.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
usage: cceps (x [, correct])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
cheb
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 371
Usage: cheb (n, x)
Returns the value of the nth-order Chebyshev polynomial calculated at
the point x. The Chebyshev polynomials are defined by the equations:
/ cos(n acos(x), |x| <= 1
Tn(x) = |
\ cosh(n acosh(x), |x| > 1
If x is a vector, the output is a vector of the same size, where each
element is calculated as y(i) = Tn(x(i)).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Usage: cheb (n, x)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
cheb1ap
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 232
-- Function File: [Z, P, G] = cheb1ap (N, RP)
Design lowpass analog Chebyshev type I filter.
This function exists only for matlab compatibility and is
equivalent to 'cheby1 (N, RP, 1, "s")'
See also: cheby1.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Design lowpass analog Chebyshev type I filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
cheb1ord
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 678
Compute chebyshev type I filter order and cutoff for the desired response
characteristics. Rp is the allowable decibels of ripple in the pass
band. Rs is the minimum attenuation in the stop band.
[n, Wc] = cheb1ord(Wp, Ws, Rp, Rs)
Low pass (Wp<Ws) or high pass (Wp>Ws) filter design. Wp is the
pass band edge and Ws is the stop band edge. Frequencies are
normalized to [0,1], corresponding to the range [0,Fs/2].
[n, Wc] = cheb1ord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
filter design. Wp gives the edges of the pass band, and Ws gives
the edges of the stop band.
See also: cheby1
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute chebyshev type I filter order and cutoff for the desired response
char
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
cheb2ap
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 233
-- Function File: [Z, P, G] = cheb2ap (N, RS)
Design lowpass analog Chebyshev type II filter.
This function exists only for matlab compatibility and is
equivalent to 'cheby2 (N, RS, 1, "s")'
See also: cheby2.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Design lowpass analog Chebyshev type II filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
cheb2ord
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 690
Compute chebyshev type II filter order and cutoff for the desired response
characteristics. Rp is the allowable decibels of ripple in the pass
band. Rs is the minimum attenuation in the stop band.
[n, Wc] = cheb2ord(Wp, Ws, Rp, Rs)
Low pass (Wp<Ws) or high pass (Wp>Ws) filter design. Wp is the
pass band edge and Ws is the stop band edge. Frequencies are
normalized to [0,1], corresponding to the range [0,Fs/2].
[n, Wc] = cheb2ord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
filter design. Wp gives the edges of the pass band, and Ws gives
the edges of the stop band.
Theory:
See also: cheby2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute chebyshev type II filter order and cutoff for the desired response
cha
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
chebwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1137
Usage: chebwin (L, at)
Returns the filter coefficients of the L-point Dolph-Chebyshev window
with at dB of attenuation in the stop-band of the corresponding
Fourier transform. The default attenuation value is 100 dB.
For the definition of the Chebyshev window, see
* Peter Lynch, "The Dolph-Chebyshev Window: A Simple Optimal Filter",
Monthly Weather Review, Vol. 125, pp. 655-660, April 1997.
(http://www.maths.tcd.ie/~plynch/Publications/Dolph.pdf)
* C. Dolph, "A current distribution for broadside arrays which
optimizes the relationship between beam width and side-lobe level",
Proc. IEEE, 34, pp. 335-348.
The window is described in frequency domain by the expression:
Cheb(L-1, beta * cos(pi * k/L))
W(k) = -------------------------------
Cheb(L-1, beta)
with
beta = cosh(1/(L-1) * acosh(10^(at/20))
and Cheb(m,x) denoting the m-th order Chebyshev polynomial calculated
at the point x.
Note that the denominator in W(k) above is not computed, and after
the inverse Fourier transform the window is scaled by making its
maximum value unitary.
See also: kaiser
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Usage: chebwin (L, at)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
cheby1
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 802
Generate an Chebyshev type I filter with Rp dB of pass band ripple.
[b, a] = cheby1(n, Rp, Wc)
low pass filter with cutoff pi*Wc radians
[b, a] = cheby1(n, Rp, Wc, 'high')
high pass filter with cutoff pi*Wc radians
[b, a] = cheby1(n, Rp, [Wl, Wh])
band pass filter with edges pi*Wl and pi*Wh radians
[b, a] = cheby1(n, Rp, [Wl, Wh], 'stop')
band reject filter with edges pi*Wl and pi*Wh radians
[z, p, g] = cheby1(...)
return filter as zero-pole-gain rather than coefficients of the
numerator and denominator polynomials.
[...] = cheby1(...,'s')
return a Laplace space filter, W can be larger than 1.
[a,b,c,d] = cheby1(...)
return state-space matrices
References:
Parks & Burrus (1987). Digital Filter Design. New York:
John Wiley & Sons, Inc.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
Generate an Chebyshev type I filter with Rp dB of pass band ripple.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
cheby2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 808
Generate an Chebyshev type II filter with Rs dB of stop band attenuation.
[b, a] = cheby2(n, Rs, Wc)
low pass filter with cutoff pi*Wc radians
[b, a] = cheby2(n, Rs, Wc, 'high')
high pass filter with cutoff pi*Wc radians
[b, a] = cheby2(n, Rs, [Wl, Wh])
band pass filter with edges pi*Wl and pi*Wh radians
[b, a] = cheby2(n, Rs, [Wl, Wh], 'stop')
band reject filter with edges pi*Wl and pi*Wh radians
[z, p, g] = cheby2(...)
return filter as zero-pole-gain rather than coefficients of the
numerator and denominator polynomials.
[...] = cheby2(...,'s')
return a Laplace space filter, W can be larger than 1.
[a,b,c,d] = cheby2(...)
return state-space matrices
References:
Parks & Burrus (1987). Digital Filter Design. New York:
John Wiley & Sons, Inc.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
Generate an Chebyshev type II filter with Rs dB of stop band attenuation.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
chirp
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 811
usage: y = chirp(t [, f0 [, t1 [, f1 [, form [, phase]]]]])
Evaluate a chirp signal at time t. A chirp signal is a frequency
swept cosine wave.
t: vector of times to evaluate the chirp signal
f0: frequency at time t=0 [ 0 Hz ]
t1: time t1 [ 1 sec ]
f1: frequency at time t=t1 [ 100 Hz ]
form: shape of frequency sweep
'linear' f(t) = (f1-f0)*(t/t1) + f0
'quadratic' f(t) = (f1-f0)*(t/t1)^2 + f0
'logarithmic' f(t) = (f1-f0)^(t/t1) + f0
phase: phase shift at t=0
Example
specgram(chirp([0:0.001:5])); # linear, 0-100Hz in 1 sec
specgram(chirp([-2:0.001:15], 400, 10, 100, 'quadratic'));
soundsc(chirp([0:1/8000:5], 200, 2, 500, "logarithmic"),8000);
If you want a different sweep shape f(t), use the following:
y = cos(2*pi*integral(f(t)) + 2*pi*f0*t + phase);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
usage: y = chirp(t [, f0 [, t1 [, f1 [, form [, phase]]]]])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
clustersegment
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 531
-- Function File: CLUSTERIDX = clustersegment (UNOS)
Calculate boundary indexes of clusters of 1's.
The function calculates the initial index and end index of the
sequences of 1's in the rows of UNOS. The result is returned in a
cell of size 1-by-Np, being Np the numer of rows in UNOS. Each
element of the cell has two rows. The first row is the inital
index of a sequence of 1's and the second row is the end index of
that sequence.
If Np == 1 the output is a matrix with two rows.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Calculate boundary indexes of clusters of 1's.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
cmorwavf
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 96
-- Function File: [PSI,X] = cmorwavf (LB,UB,N,FB,FC)
Compute the Complex Morlet wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Compute the Complex Morlet wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
cohere
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 377
Usage:
[Pxx,freq] = cohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
Estimate (mean square) coherence of signals "x" and "y".
Use the Welch (1967) periodogram/FFT method.
Compatible with Matlab R11 cohere and earlier.
See "help pwelch" for description of arguments, hints and references
--- especially hint (7) for Matlab R11 defaults.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Usage:
[Pxx,freq] = cohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detren
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
convmtx
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 496
-- Function File: convmtx (A, N)
If A is a column vector and X is a column vector of length N, then
'convmtx(A, N) * X'
gives the convolution of of A and X and is the same as 'conv(A,
X)'. The difference is if many vectors are to be convolved with
the same vector, then this technique is possibly faster.
Similarly, if A is a row vector and X is a row vector of length N,
then
'X * convmtx(A, N)'
is the same as 'conv(X, A)'.
See also: conv.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
If A is a column vector and X is a column vector of length N, then
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
cplxreal
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 701
-- Function File: [ZC, ZR] = cplxreal (Z, THRESH)
Split the vector z into its complex (ZC) and real (ZR) elements,
eliminating one of each complex-conjugate pair.
INPUTS:
* Z = row- or column-vector of complex numbers
* THRESH = tolerance threshold for numerical comparisons
(default = 100*eps)
RETURNED:
* ZC = elements of Z having positive imaginary parts
* ZR = elements of Z having zero imaginary part
Each complex element of Z is assumed to have a complex-conjugate
counterpart elsewhere in Z as well. Elements are declared real if
their imaginary parts have magnitude less than THRESH.
See also: cplxpair.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Split the vector z into its complex (ZC) and real (ZR) elements,
eliminating one
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
cpsd
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 242
Usage:
[Pxx,freq] = cpsd(x,y,window,overlap,Nfft,Fs,range)
Estimate cross power spectrum of data "x" and "y" by the Welch (1967)
periodogram/FFT method.
See "help pwelch" for description of arguments, hints and references
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Usage:
[Pxx,freq] = cpsd(x,y,window,overlap,Nfft,Fs,range)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
csd
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 358
Usage:
[Pxx,freq] = csd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
Estimate cross power spectrum of data "x" and "y" by the Welch (1967)
periodogram/FFT method. Compatible with Matlab R11 csd and earlier.
See "help pwelch" for description of arguments, hints and references
--- especially hint (7) for Matlab R11 defaults.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79
Usage:
[Pxx,freq] = csd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
czt
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 828
usage y=czt(x, m, w, a)
Chirp z-transform. Compute the frequency response starting at a and
stepping by w for m steps. a is a point in the complex plane, and
w is the ratio between points in each step (i.e., radius increases
exponentially, and angle increases linearly).
To evaluate the frequency response for the range f1 to f2 in a signal
with sampling frequency Fs, use the following:
m = 32; ## number of points desired
w = exp(-j*2*pi*(f2-f1)/((m-1)*Fs)); ## freq. step of f2-f1/m
a = exp(j*2*pi*f1/Fs); ## starting at frequency f1
y = czt(x, m, w, a);
If you don't specify them, then the parameters default to a fourier
transform:
m=length(x), w=exp(-j*2*pi/m), a=1
If x is a matrix, the transform will be performed column-by-column.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
usage y=czt(x, m, w, a)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
data2fun
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1115
-- Function File: [FHANDLE, FULLNAME] = data2fun (TI, YI)
-- Function File: [ ... ] = data2fun (TI, YI,PROPERTY,VALUE)
Creates a vectorized function based on data samples using
interpolation.
The values given in YI (N-by-k matrix) correspond to evaluations of
the function y(t) at the points TI (N-by-1 matrix). The data is
interpolated and the function handle to the generated interpolant
is returned.
The function accepts property-value pairs described below.
'file'
Code is generated and .m file is created. The VALUE contains
the name of the function. The returned function handle is a
handle to that file. If VALUE is empty, then a name is
automatically generated using 'tmpnam' and the file is created
in the current directory. VALUE must not have an extension,
since .m will be appended. Numerical value used in the
function are stored in a .mat file with the same name as the
function.
'interp'
Type of interpolation. See 'interp1'.
See also: interp1.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Creates a vectorized function based on data samples using interpolation.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
dct
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 687
y = dct (x, n)
Computes the discrete cosine transform of x. If n is given, then
x is padded or trimmed to length n before computing the transform.
If x is a matrix, compute the transform along the columns of the
the matrix. The transform is faster if x is real-valued and even
length.
The discrete cosine transform X of x can be defined as follows:
N-1
X[k] = w(k) sum x[n] cos (pi (2n+1) k / 2N ), k = 0, ..., N-1
n=0
with w(0) = sqrt(1/N) and w(k) = sqrt(2/N), k = 1, ..., N-1. There
are other definitions with different scaling of X[k], but this form
is common in image processing.
See also: idct, dct2, idct2, dctmtx
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
y = dct (x, n)
Computes the discrete cosine transform of x.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
dct2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
y = dct2 (x)
Computes the 2-D discrete cosine transform of matrix x
y = dct2 (x, m, n) or y = dct2 (x, [m n])
Computes the 2-D DCT of x after padding or trimming rows to m and
columns to n.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 71
y = dct2 (x)
Computes the 2-D discrete cosine transform of matrix x
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
dctmtx
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 599
T = dctmtx (n)
Return the DCT transformation matrix of size n x n.
If A is an n x n matrix, then the following are true:
T*A == dct(A), T'*A == idct(A)
T*A*T' == dct2(A), T'*A*T == idct2(A)
A dct transformation matrix is useful for doing things like jpeg
image compression, in which an 8x8 dct matrix is applied to
non-overlapping blocks throughout an image and only a subblock on the
top left of each block is kept. During restoration, the remainder of
the block is filled with zeros and the inverse transform is applied
to the block.
See also: dct, idct, dct2, idct2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
T = dctmtx (n)
Return the DCT transformation matrix of size n x n.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
decimate
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1021
usage: y = decimate(x, q [, n] [, ftype])
Downsample the signal x by a factor of q, using an order n filter
of ftype 'fir' or 'iir'. By default, an order 8 Chebyshev type I
filter is used or a 30 point FIR filter if ftype is 'fir'. Note
that q must be an integer for this rate change method.
Example
## Generate a signal that starts away from zero, is slowly varying
## at the start and quickly varying at the end, decimate and plot.
## Since it starts away from zero, you will see the boundary
## effects of the antialiasing filter clearly. Next you will see
## how it follows the curve nicely in the slowly varying early
## part of the signal, but averages the curve in the quickly
## varying late part of the signal.
t=0:0.01:2; x=chirp(t,2,.5,10,'quadratic')+sin(2*pi*t*0.4);
y = decimate(x,4); # factor of 4 decimation
stem(t(1:121)*1000,x(1:121),"-g;Original;"); hold on; # plot original
stem(t(1:4:121)*1000,y(1:31),"-r;Decimated;"); hold off; # decimated
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
usage: y = decimate(x, q [, n] [, ftype])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
dftmtx
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 344
-- Function File: D = dftmtx (N)
If N is a scalar, produces a N-by-N matrix D such that the Fourier
transform of a column vector of length N is given by 'dftmtx(N) *
x' and the inverse Fourier transform is given by 'inv(dftmtx(N)) *
x'. In general this is less efficient than calling the "fft" and
"ifft" directly.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
If N is a scalar, produces a N-by-N matrix D such that the Fourier
transform of
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
diric
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 117
-- Function File: [Y] = diric( X,N)
Compute the dirichlet function.
See also: sinc, gauspuls, sawtooth.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Compute the dirichlet function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
downsample
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 511
-- Function File: Y = downsample (X, N)
-- Function File: Y = downsample (X, N, OFFSET)
Downsample the signal, selecting every nth element. If X is a
matrix, downsample every column.
For most signals you will want to use 'decimate' instead since it
prefilters the high frequency components of the signal and avoids
aliasing effects.
If OFFSET is defined, select every nth element starting at sample
OFFSET.
See also: decimate, interp, resample, upfirdn, upsample.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Downsample the signal, selecting every nth element.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
dst
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 482
-- Function File: Y = dst (X)
-- Function File: Y = dst (X, N)
Computes the type I discrete sine transform of X. If N is given,
then X is padded or trimmed to length N before computing the
transform. If X is a matrix, compute the transform along the
columns of the the matrix.
The discrete sine transform X of x can be defined as follows:
N
X[k] = sum x[n] sin (pi n k / (N+1) ), k = 1, ..., N
n=1
See also: idst.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Computes the type I discrete sine transform of X.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
dwt
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 112
-- Function File: [CA CD] = dwt( X,LO_D,HI_D)
Comupte de discrete wavelet transform of x with one level.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Comupte de discrete wavelet transform of x with one level.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
ellip
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1050
N-ellip 0.2.1
usage: [Zz, Zp, Zg] = ellip(n, Rp, Rs, Wp, stype,'s')
Generate an Elliptic or Cauer filter (discrete and contnuious).
[b,a] = ellip(n, Rp, Rs, Wp)
low pass filter with order n, cutoff pi*Wp radians, Rp decibels
of ripple in the passband and a stopband Rs decibels down.
[b,a] = ellip(n, Rp, Rs, Wp, 'high')
high pass filter with cutoff pi*Wp...
[b,a] = ellip(n, Rp, Rs, [Wl, Wh])
band pass filter with band pass edges pi*Wl and pi*Wh ...
[b,a] = ellip(n, Rp, Rs, [Wl, Wh], 'stop')
band reject filter with edges pi*Wl and pi*Wh, ...
[z,p,g] = ellip(...)
return filter as zero-pole-gain.
[...] = ellip(...,'s')
return a Laplace space filter, W can be larger than 1.
[a,b,c,d] = ellip(...)
return state-space matrices
References:
- Oppenheim, Alan V., Discrete Time Signal Processing, Hardcover, 1999.
- Parente Ribeiro, E., Notas de aula da disciplina TE498 - Processamento
Digital de Sinais, UFPR, 2001/2002.
- Kienzle, Paul, functions from Octave-Forge, 1999 (http://octave.sf.net).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
N-ellip 0.2.1
usage: [Zz, Zp, Zg] = ellip(n, Rp, Rs, Wp, stype,'s')
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
ellipap
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 230
-- Function File: [Z, P, G] = ellipap (N, RP, RS)
Design lowpass analog elliptic filter.
This function exists only for matlab compatibility and is
equivalent to 'ellip (N, RP, RS, 1, "s")'
See also: ellip.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Design lowpass analog elliptic filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
ellipord
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 346
usage: [n,wp] = ellipord(wp,ws, rp,rs)
Calculate the order for the elliptic filter (discrete)
wp: Cutoff frequency
ws: Stopband edge
rp: decibels of ripple in the passband.
rs: decibels of ripple in the stopband.
References:
- Lamar, Marcus Vinicius, Notas de aula da disciplina TE 456 - Circuitos
Analogicos II, UFPR, 2001/2002.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
usage: [n,wp] = ellipord(wp,ws, rp,rs)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
fht
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 790
-- Function File: m = fht ( d, n, dim )
The function fht calculates Fast Hartley Transform where D is the
real input vector (matrix), and M is the real-transform vector.
For matrices the hartley transform is calculated along the columns
by default. The options N,and DIM are similar to the options of
FFT function.
The forward and inverse hartley transforms are the same (except for
a scale factor of 1/N for the inverse hartley transform), but
implemented using different functions .
The definition of the forward hartley transform for vector d, m[K]
= \sum_{i=0}^{N-1} d[i]*(cos[K*2*pi*i/N] + sin[K*2*pi*i/N]), for 0
<= K < N. m[K] = \sum_{i=0}^{N-1} d[i]*CAS[K*i], for 0 <= K < N.
fht(1:4)
See also: ifht,fft.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
The function fht calculates Fast Hartley Transform where D is the real
input vec
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
filtfilt
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 673
usage: y = filtfilt(b, a, x)
Forward and reverse filter the signal. This corrects for phase
distortion introduced by a one-pass filter, though it does square the
magnitude response in the process. That's the theory at least. In
practice the phase correction is not perfect, and magnitude response
is distorted, particularly in the stop band.
Example
[b, a]=butter(3, 0.1); % 10 Hz low-pass filter
t = 0:0.01:1.0; % 1 second sample
x=sin(2*pi*t*2.3)+0.25*randn(size(t)); % 2.3 Hz sinusoid+noise
y = filtfilt(b,a,x); z = filter(b,a,x); % apply filter
plot(t,x,';data;',t,y,';filtfilt;',t,z,';filter;')
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
usage: y = filtfilt(b, a, x)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
filtic
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 718
Set initial condition vector for filter function
The vector zf has the same values that would be obtained
from function filter given past inputs x and outputs y
The vectors x and y contain the most recent inputs and outputs
respectively, with the newest values first:
x = [x(-1) x(-2) ... x(-nb)], nb = length(b)-1
y = [y(-1) y(-2) ... y(-na)], na = length(a)-a
If length(x)<nb then it is zero padded
If length(y)<na then it is zero padded
zf = filtic(b, a, y)
Initial conditions for filter with coefficients a and b
and output vector y, assuming input vector x is zero
zf = filtic(b, a, y, x)
Initial conditions for filter with coefficients a and b
input vector x and output vector y
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Set initial condition vector for filter function
The vector zf has the same va
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
findpeaks
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2797
-- Function File: [PKS LOC EXTRA] = findpeaks (DATA)
-- Function File: ... = findpeaks (..., PROPERTY, VALUE)
-- Function File: ... = findpeaks (..., "DoubleSided")
Finds peaks on DATA.
Peaks of a positive array of data are defined as local maxima. For
double-sided data, they are maxima of the positive part and minima
of the negative part. DATA is expected to be a single column
vector.
The function returns the value of DATA at the peaks in PKS. The
index indicating their position is returned in LOC.
The third output argument is a structure with additional
information:
"parabol"
A structure containing the parabola fitted to each returned
peak. The structure has two fields, "x" and "pp". The field
"pp" contains the coefficients of the 2nd degree polynomial
and "x" the extrema of the intercal here it was fitted.
"height"
The estimated height of the returned peaks (in units of DATA).
"baseline"
The height at which the roots of the returned peaks were
calculated (in units of DATA).
"roots"
The abscissa values (in index units) at which the parabola
fitted to each of the returned peaks crosses the "baseline"
value. The width of the peak is calculated by 'diff(roots)'.
This function accepts property-value pair given in the list below:
"MinPeakHeight"
Minimum peak height (positive scalar). Only peaks that exceed
this value will be returned. For data taking positive and
negative values use the option "DoubleSided". Default value
'2*std (abs (detrend (data,0)))'.
"MinPeakDistance"
Minimum separation between (positive integer). Peaks
separated by less than this distance are considered a single
peak. This distance is also used to fit a second order
polynomial to the peaks to estimate their width, therefore it
acts as a smoothing parameter. Default value 4.
"MinPeakWidth"
Minimum width of peaks (positive integer). The width of the
peaks is estimated using a parabola fitted to the neighborhood
of each peak. The neighborhood size is equal to the value of
"MinPeakDistance". The width is evaluated at the half height
of the peak with baseline at "MinPeakHeight". Default value
2.
"DoubleSided"
Tells the function that data takes positive and negative
values. The base-line for the peaks is taken as the mean
value of the function. This is equivalent as passing the
absolute value of the data after removing the mean.
Run 'demo findpeaks' to see some examples.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Finds peaks on DATA.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
fir1
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1180
usage: b = fir1(n, w [, type] [, window] [, noscale])
Produce an order n FIR filter with the given frequency cutoff,
returning the n+1 filter coefficients in b.
n: order of the filter (1 less than the length of the filter)
w: band edges
strictly increasing vector in range [0, 1]
singleton for highpass or lowpass, vector pair for bandpass or
bandstop, or vector for alternating pass/stop filter.
type: choose between pass and stop bands
'high' for highpass filter, cutoff at w
'stop' for bandstop filter, edges at w = [lo, hi]
'DC-0' for bandstop as first band of multiband filter
'DC-1' for bandpass as first band of multiband filter
window: smoothing window
defaults to hamming(n+1) row vector
returned filter is the same shape as the smoothing window
noscale: choose whether to normalize or not
'scale': set the magnitude of the center of the first passband to 1
'noscale': don't normalize
To apply the filter, use the return vector b:
y=filter(b,1,x);
Examples:
freqz(fir1(40,0.3));
freqz(fir1(15,[0.2, 0.5], 'stop')); # note the zero-crossing at 0.1
freqz(fir1(15,[0.2, 0.5], 'stop', 'noscale'));
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
usage: b = fir1(n, w [, type] [, window] [, noscale])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
fir2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1199
usage: b = fir2(n, f, m [, grid_n [, ramp_n]] [, window])
Produce an FIR filter of order n with arbitrary frequency response,
returning the n+1 filter coefficients in b.
n: order of the filter (1 less than the length of the filter)
f: frequency at band edges
f is a vector of nondecreasing elements in [0,1]
the first element must be 0 and the last element must be 1
if elements are identical, it indicates a jump in freq. response
m: magnitude at band edges
m is a vector of length(f)
grid_n: length of ideal frequency response function
defaults to 512, should be a power of 2 bigger than n/2
ramp_n: transition width for jumps in filter response
defaults to grid_n/25; a wider ramp gives wider transitions
but has better stopband characteristics.
window: smoothing window
defaults to hamming(n+1) row vector
returned filter is the same shape as the smoothing window
To apply the filter, use the return vector b:
y=filter(b,1,x);
Note that plot(f,m) shows target response.
Example:
f=[0, 0.3, 0.3, 0.6, 0.6, 1]; m=[0, 0, 1, 1/2, 0, 0];
[h, w] = freqz(fir2(100,f,m));
plot(f,m,';target response;',w/pi,abs(h),';filter response;');
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
usage: b = fir2(n, f, m [, grid_n [, ramp_n]] [, window])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
firls
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 976
b = firls(N, F, A);
b = firls(N, F, A, W);
FIR filter design using least squares method. Returns a length N+1
linear phase filter such that the integral of the weighted mean
squared error in the specified bands is minimized.
F specifies the frequencies of the band edges, normalized so that
half the sample frequency is equal to 1. Each band is specified by
two frequencies, to the vector must have an even length.
A specifies the amplitude of the desired response at each band edge.
W is an optional weighting function that contains one value for each
band that weights the mean squared error in that band. A must be the
same length as F, and W must be half the length of F. N must be
even. If given an odd value, firls increments it by 1.
The least squares optimization algorithm for computing FIR filter
coefficients is derived in detail in:
I. Selesnick, "Linear-Phase FIR Filter Design by Least Squares,"
http://cnx.org/content/m10577
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
b = firls(N, F, A);
b = firls(N, F, A, W);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
flattopwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 679
flattopwin(L, [periodic|symmetric])
Return the window f(w):
f(w) = 1 - 1.93 cos(2 pi w) + 1.29 cos(4 pi w)
- 0.388 cos(6 pi w) + 0.0322cos(8 pi w)
where w = i/(L-1) for i=0:L-1 for a symmetric window, or
w = i/L for i=0:L-1 for a periodic window. The default
is symmetric. The returned window is normalized to a peak
of 1 at w = 0.5.
This window has low pass-band ripple, but high bandwidth.
According to [1]:
The main use for the Flat Top window is for calibration, due
to its negligible amplitude errors.
[1] Gade, S; Herlufsen, H; (1987) "Use of weighting functions in DFT/FFT
analysis (Part I)", Bruel & Kjaer Technical Review No.3.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
flattopwin(L, [periodic|symmetric])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
fracshift
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 279
-- Function File: [Y H]= fracshift( X,D)
-- Function File: Y = fracshift( X,D,H)
Shift the series X by a (possibly fractional) number of samples D.
The interpolator H is either specified or either designed with a
Kaiser-windowed sinecard.
See also: circshift.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Shift the series X by a (possibly fractional) number of samples D.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
freqs
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 300
Usage: H = freqs(B,A,W);
Compute the s-plane frequency response of the IIR filter B(s)/A(s) as
H = polyval(B,j*W)./polyval(A,j*W). If called with no output
argument, a plot of magnitude and phase are displayed.
Example:
B = [1 2]; A = [1 1];
w = linspace(0,4,128);
freqs(B,A,w);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Usage: H = freqs(B,A,W);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
freqs_plot
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 90
-- Function File: freqs_plot ( W, H)
Plot the amplitude and phase of the vector H.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Plot the amplitude and phase of the vector H.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
fwhm
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1318
Compute peak full-width at half maximum (FWHM) or at another level of peak
maximum for vector or matrix data y, optionally sampled as y(x). If y is
a matrix, return FWHM for each column as a row vector.
Syntax:
f = fwhm({x, } y {, 'zero'|'min' {, 'rlevel', rlevel}})
f = fwhm({x, } y {, 'alevel', alevel})
Examples:
f = fwhm(y)
f = fwhm(x, y)
f = fwhm(x, y, 'zero')
f = fwhm(x, y, 'min')
f = fwhm(x, y, 'alevel', 15.3)
f = fwhm(x, y, 'zero', 'rlevel', 0.5)
f = fwhm(x, y, 'min', 'rlevel', 0.1)
The default option 'zero' computes fwhm at half maximum, i.e. 0.5*max(y).
The option 'min' computes fwhm at the middle curve, i.e. 0.5*(min(y)+max(y)).
The option 'rlevel' computes full-width at the given relative level of peak
profile, i.e. at rlevel*max(y) or rlevel*(min(y)+max(y)), respectively.
For example, fwhm(..., 'rlevel', 0.1) computes full width at 10 % of peak
maximum with respect to zero or minimum; FWHM is equivalent to
fwhm(..., 'rlevel', 0.5).
The option 'alevel' computes full-width at the given absolute level of y.
Return 0 if FWHM does not exist (e.g. monotonous function or the function
does not cut horizontal line at rlevel*max(y) or rlevel*(max(y)+min(y)) or
alevel, respectively).
Compatibility: Octave 3.x, Matlab
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute peak full-width at half maximum (FWHM) or at another level of peak
max
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
fwht
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 983
-- Function File: fwht (X)
-- Function File: fwht (X, N)
-- Function File: fwht (X, N, ORDER)
Compute the Walsh-Hadamard transform of X using the Fast
Walsh-Hadamard Transform (FWHT) algorithm. If the input is a
matrix, the FWHT is calculated along the columns of X.
The number of elements of X must be a power of 2; if not, the input
will be extended and filled with zeros. If a second argument is
given, the input is truncated or extended to have length N.
The third argument specifies the ORDER in which the returned
Walsh-Hadamard transform coefficients should be arranged. The
ORDER may be any of the following strings:
"sequency"
The coefficients are returned in sequency order. This is the
default if ORDER is not given.
"hadamard"
The coefficients are returned in Hadamard order.
"dyadic"
The coefficients are returned in Gray code order.
See also: ifwht.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute the Walsh-Hadamard transform of X using the Fast Walsh-Hadamard
Transfor
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
gauspuls
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 98
-- Function File: [Y] = gauspuls( T,FC,BW)
Return the Gaussian modulated sinusoidal pulse.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Return the Gaussian modulated sinusoidal pulse.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
gaussian
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 442
usage: w = gaussian(n, a)
Generate an n-point gaussian convolution window of the given
width. Use larger a for a narrower window. Use larger n for
longer tails.
w = exp ( -(a*x)^2/2 )
for x = linspace ( -(n-1)/2, (n-1)/2, n ).
Width a is measured in frequency units (sample rate/num samples).
It should be f when multiplying in the time domain, but 1/f when
multiplying in the frequency domain (for use in convolutions).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
usage: w = gaussian(n, a)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
gausswin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 227
usage: w = gausswin(L, a)
Generate an L-point gaussian window of the given width. Use larger a
for a narrow window. Use larger L for a smoother curve.
w = exp ( -(a*x)^2/2 )
for x = linspace(-(L-1)/L, (L-1)/L, L)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
usage: w = gausswin(L, a)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
gmonopuls
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79
-- Function File: [Y] = gmonopuls( T,FC)
Return the gaussian monopulse.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Return the gaussian monopulse.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
grpdelay
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2463
Compute the group delay of a filter.
[g, w] = grpdelay(b)
returns the group delay g of the FIR filter with coefficients b.
The response is evaluated at 512 angular frequencies between 0 and
pi. w is a vector containing the 512 frequencies.
The group delay is in units of samples. It can be converted
to seconds by multiplying by the sampling period (or dividing by
the sampling rate fs).
[g, w] = grpdelay(b,a)
returns the group delay of the rational IIR filter whose numerator
has coefficients b and denominator coefficients a.
[g, w] = grpdelay(b,a,n)
returns the group delay evaluated at n angular frequencies. For fastest
computation n should factor into a small number of small primes.
[g, w] = grpdelay(b,a,n,'whole')
evaluates the group delay at n frequencies between 0 and 2*pi.
[g, f] = grpdelay(b,a,n,Fs)
evaluates the group delay at n frequencies between 0 and Fs/2.
[g, f] = grpdelay(b,a,n,'whole',Fs)
evaluates the group delay at n frequencies between 0 and Fs.
[g, w] = grpdelay(b,a,w)
evaluates the group delay at frequencies w (radians per sample).
[g, f] = grpdelay(b,a,f,Fs)
evaluates the group delay at frequencies f (in Hz).
grpdelay(...)
plots the group delay vs. frequency.
If the denominator of the computation becomes too small, the group delay
is set to zero. (The group delay approaches infinity when
there are poles or zeros very close to the unit circle in the z plane.)
Theory: group delay, g(w) = -d/dw [arg{H(e^jw)}], is the rate of change of
phase with respect to frequency. It can be computed as:
d/dw H(e^-jw)
g(w) = -------------
H(e^-jw)
where
H(z) = B(z)/A(z) = sum(b_k z^k)/sum(a_k z^k).
By the quotient rule,
A(z) d/dw B(z) - B(z) d/dw A(z)
d/dw H(z) = -------------------------------
A(z) A(z)
Substituting into the expression above yields:
A dB - B dA
g(w) = ----------- = dB/B - dA/A
A B
Note that,
d/dw B(e^-jw) = sum(k b_k e^-jwk)
d/dw A(e^-jw) = sum(k a_k e^-jwk)
which is just the FFT of the coefficients multiplied by a ramp.
As a further optimization when nfft>>length(a), the IIR filter (b,a)
is converted to the FIR filter conv(b,fliplr(conj(a))).
For further details, see
http://ccrma.stanford.edu/~jos/filters/Numerical_Computation_Group_Delay.html
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Compute the group delay of a filter.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
hann
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
w = hann(n)
see hanning
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
w = hann(n)
see hanning
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
hilbert
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 649
-- Function File: H = hilbert (F,N,DIM)
Analytic extension of real valued signal
'H=hilbert(F)' computes the extension of the real valued signal F
to an analytic signal. If F is a matrix, the transformation is
applied to each column. For N-D arrays, the transformation is
applied to the first non-singleton dimension.
'real(H)' contains the original signal F. 'imag(H)' contains the
Hilbert transform of F.
'hilbert(F,N)' does the same using a length N Hilbert transform.
The result will also have length N.
'hilbert(F,[],DIM)' or 'hilbert(F,N,DIM)' does the same along
dimension dim.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Analytic extension of real valued signal
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
idct
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 584
y = dct (x, n)
Computes the inverse discrete cosine transform of x. If n is
given, then x is padded or trimmed to length n before computing
the transform. If x is a matrix, compute the transform along the
columns of the the matrix. The transform is faster if x is
real-valued and even length.
The inverse discrete cosine transform x of X can be defined as follows:
N-1
x[n] = sum w(k) X[k] cos (pi (2n+1) k / 2N ), n = 0, ..., N-1
k=0
with w(0) = sqrt(1/N) and w(k) = sqrt(2/N), k = 1, ..., N-1
See also: idct, dct2, idct2, dctmtx
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
y = dct (x, n)
Computes the inverse discrete cosine transform of x.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
idct2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 221
y = idct2 (x)
Computes the inverse 2-D discrete cosine transform of matrix x
y = idct2 (x, m, n) or y = idct2 (x, [m n])
Computes the 2-D inverse DCT of x after padding or trimming rows to m and
columns to n.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
y = idct2 (x)
Computes the inverse 2-D discrete cosine transform of matrix x
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
idst
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 333
-- Function File: Y = idst (X)
-- Function File: Y = idst (X, N)
Computes the inverse type I discrete sine transform of Y. If N is
given, then Y is padded or trimmed to length N before computing the
transform. If Y is a matrix, compute the transform along the
columns of the the matrix.
See also: dst.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Computes the inverse type I discrete sine transform of Y.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
ifht
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 806
-- Function File: m = ifht ( d, n, dim )
The function ifht calculates Fast Hartley Transform where D is the
real input vector (matrix), and M is the real-transform vector.
For matrices the hartley transform is calculated along the columns
by default. The options N, and DIM are similar to the options of
FFT function.
The forward and inverse hartley transforms are the same (except for
a scale factor of 1/N for the inverse hartley transform), but
implemented using different functions .
The definition of the forward hartley transform for vector d, m[K]
= 1/N \sum_{i=0}^{N-1} d[i]*(cos[K*2*pi*i/N] + sin[K*2*pi*i/N]),
for 0 <= K < N. m[K] = 1/N \sum_{i=0}^{N-1} d[i]*CAS[K*i], for 0 <=
K < N.
ifht(1:4)
See also: fht,fft.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
The function ifht calculates Fast Hartley Transform where D is the real
input ve
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
ifwht
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1008
-- Function File: ifwht (X)
-- Function File: ifwht (X, N)
-- Function File: ifwht (X, N, ORDER)
Compute the inverse Walsh-Hadamard transform of X using the Fast
Walsh-Hadamard Transform (FWHT) algorithm. If the input is a
matrix, the inverse FWHT is calculated along the columns of X.
The number of elements of X must be a power of 2; if not, the input
will be extended and filled with zeros. If a second argument is
given, the input is truncated or extended to have length N.
The third argument specifies the ORDER in which the returned
inverse Walsh-Hadamard transform coefficients should be arranged.
The ORDER may be any of the following strings:
"sequency"
The coefficients are returned in sequency order. This is the
default if ORDER is not given.
"hadamard"
The coefficients are returned in Hadamard order.
"dyadic"
The coefficients are returned in Gray code order.
See also: fwht.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute the inverse Walsh-Hadamard transform of X using the Fast
Walsh-Hadamard
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
iirlp2mb
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1305
IIR Low Pass Filter to Multiband Filter Transformation
[Num,Den,AllpassNum,AllpassDen] = iirlp2mb(B,A,Wo,Wt)
[Num,Den,AllpassNum,AllpassDen] = iirlp2mb(B,A,Wo,Wt,Pass)
Num,Den: numerator,denominator of the transformed filter
AllpassNum,AllpassDen: numerator,denominator of allpass transform,
B,A: numerator,denominator of prototype low pass filter
Wo: normalized_angular_frequency/pi to be transformed
Wt: [phi=normalized_angular_frequencies]/pi target vector
Pass: This parameter may have values 'pass' or 'stop'. If
not given, it defaults to the value of 'pass'.
With normalized ang. freq. targets 0 < phi(1) < ... < phi(n) < pi radians
for Pass == 'pass', the target multiband magnitude will be:
-------- ---------- -----------...
/ \ / \ / .
0 phi(1) phi(2) phi(3) phi(4) phi(5) (phi(6)) pi
for Pass == 'stop', the target multiband magnitude will be:
------- --------- ----------...
\ / \ / .
0 phi(1) phi(2) phi(3) phi(4) (phi(5)) pi
Example of use:
[B, A] = butter(6, 0.5);
[Num, Den] = iirlp2mb(B, A, 0.5, [.2 .4 .6 .8]);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
IIR Low Pass Filter to Multiband Filter Transformation
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
impinvar
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 878
-- Function File: [B_OUT, A_OUT] = impinvar (B, A, FS, TOL)
-- Function File: [B_OUT, A_OUT] = impinvar (B, A, FS)
-- Function File: [B_OUT, A_OUT] = impinvar (B, A)
Converts analog filter with coefficients B and A to digital,
conserving impulse response.
If FS is not specificied, or is an empty vector, it defaults to
1Hz.
If TOL is not specified, it defaults to 0.0001 (0.1%) This function
does the inverse of impinvar so that the following example should
restore the original values of A and B.
'invimpinvar' implements the reverse of this function.
[b, a] = impinvar (b, a);
[b, a] = invimpinvar (b, a);
Reference: Thomas J. Cavicchi (1996) "Impulse invariance and
multiple-order poles". IEEE transactions on signal processing, Vol
40 (9): 2344-2347
See also: bilinear, invimpinvar.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Converts analog filter with coefficients B and A to digital, conserving
impulse
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
impz
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 545
usage: [x, t] = impz(b [, a, n, fs])
Generate impulse-response characteristics of the filter. The filter
coefficients correspond to the the z-plane rational function with
numerator b and denominator a. If a is not specified, it defaults to
1. If n is not specified, or specified as [], it will be chosen such
that the signal has a chance to die down to -120dB, or to not explode
beyond 120dB, or to show five periods if there is no significant
damping. If no return arguments are requested, plot the results.
See also: freqz, zplane
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
usage: [x, t] = impz(b [, a, n, fs])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
interp
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 631
usage: y = interp(x, q [, n [, Wc]])
Upsample the signal x by a factor of q, using an order 2*q*n+1 FIR
filter. Note that q must be an integer for this rate change method.
n defaults to 4 and Wc defaults to 0.5.
Example
# Generate a signal.
t=0:0.01:2; x=chirp(t,2,.5,10,'quadratic')+sin(2*pi*t*0.4);
y = interp(x(1:4:length(x)),4,4,1); # interpolate a sub-sample
stem(t(1:121)*1000,x(1:121),"-g;Original;"); hold on;
stem(t(1:121)*1000,y(1:121),"-r;Interpolated;");
stem(t(1:4:121)*1000,x(1:4:121),"-b;Subsampled;"); hold off;
See also: decimate, resample
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
usage: y = interp(x, q [, n [, Wc]])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
invfreq
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1687
usage: [B,A] = invfreq(H,F,nB,nA)
[B,A] = invfreq(H,F,nB,nA,W)
[B,A] = invfreq(H,F,nB,nA,W,[],[],plane)
[B,A] = invfreq(H,F,nB,nA,W,iter,tol,plane)
Fit filter B(z)/A(z) or B(s)/A(s) to complex frequency response at
frequency points F. A and B are real polynomial coefficients of order
nA and nB respectively. Optionally, the fit-errors can be weighted vs
frequency according to the weights W. Also, the transform plane can be
specified as either 's' for continuous time or 'z' for discrete time. 'z'
is chosen by default. Eventually, Steiglitz-McBride iterations will be
specified by iter and tol.
H: desired complex frequency response
It is assumed that A and B are real polynomials, hence H is one-sided.
F: vector of frequency samples in radians
nA: order of denominator polynomial A
nB: order of numerator polynomial B
plane='z': F on unit circle (discrete-time spectra, z-plane design)
plane='s': F on jw axis (continuous-time spectra, s-plane design)
H(k) = spectral samples of filter frequency response at points zk,
where zk=exp(sqrt(-1)*F(k)) when plane='z' (F(k) in [0,.5])
and zk=(sqrt(-1)*F(k)) when plane='s' (F(k) nonnegative)
Example:
[B,A] = butter(12,1/4);
[H,w] = freqz(B,A,128);
[Bh,Ah] = invfreq(H,F,4,4);
Hh = freqz(Bh,Ah);
disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
References: J. O. Smith, "Techniques for Digital Filter Design and System
Identification with Application to the Violin, Ph.D. Dissertation,
Elec. Eng. Dept., Stanford University, June 1983, page 50; or,
http://ccrma.stanford.edu/~jos/filters/FFT_Based_Equation_Error_Method.html
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
usage: [B,A] = invfreq(H,F,nB,nA)
[B,A] = invfreq(H,F,nB,nA,W)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
invfreqs
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 943
Usage: [B,A] = invfreqs(H,F,nB,nA)
[B,A] = invfreqs(H,F,nB,nA,W)
[B,A] = invfreqs(H,F,nB,nA,W,iter,tol,'trace')
Fit filter B(s)/A(s)to the complex frequency response H at frequency
points F. A and B are real polynomial coefficients of order nA and nB.
Optionally, the fit-errors can be weighted vs frequency according to
the weights W.
Note: all the guts are in invfreq.m
H: desired complex frequency response
F: frequency (must be same length as H)
nA: order of the denominator polynomial A
nB: order of the numerator polynomial B
W: vector of weights (must be same length as F)
Example:
B = [1/2 1];
A = [1 1];
w = linspace(0,4,128);
H = freqs(B,A,w);
[Bh,Ah] = invfreqs(H,w,1,1);
Hh = freqs(Bh,Ah,w);
plot(w,[abs(H);abs(Hh)])
legend('Original','Measured');
err = norm(H-Hh);
disp(sprintf('L2 norm of frequency response error = %f',err));
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Usage: [B,A] = invfreqs(H,F,nB,nA)
[B,A] = invfreqs(H,F,nB,nA,W)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
invfreqz
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 819
usage: [B,A] = invfreqz(H,F,nB,nA)
[B,A] = invfreqz(H,F,nB,nA,W)
[B,A] = invfreqz(H,F,nB,nA,W,iter,tol,'trace')
Fit filter B(z)/A(z)to the complex frequency response H at frequency
points F. A and B are real polynomial coefficients of order nA and nB.
Optionally, the fit-errors can be weighted vs frequency according to
the weights W.
Note: all the guts are in invfreq.m
H: desired complex frequency response
F: normalized frequncy (0 to pi) (must be same length as H)
nA: order of the denominator polynomial A
nB: order of the numerator polynomial B
W: vector of weights (must be same length as F)
Example:
[B,A] = butter(4,1/4);
[H,F] = freqz(B,A);
[Bh,Ah] = invfreq(H,F,4,4);
Hh = freqz(Bh,Ah);
disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
usage: [B,A] = invfreqz(H,F,nB,nA)
[B,A] = invfreqz(H,F,nB,nA,W)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
invimpinvar
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 824
-- Function File: [B_OUT, A_OUT] = invimpinvar (B, A, FS, TOL)
-- Function File: [B_OUT, A_OUT] = invimpinvar (B, A, FS)
-- Function File: [B_OUT, A_OUT] = invimpinvar (B, A)
Converts digital filter with coefficients B and A to analog,
conserving impulse response.
This function does the inverse of impinvar so that the following
example should restore the original values of A and B.
[b, a] = impinvar (b, a);
[b, a] = invimpinvar (b, a);
If FS is not specificied, or is an empty vector, it defaults to
1Hz.
If TOL is not specified, it defaults to 0.0001 (0.1%)
Reference: Thomas J. Cavicchi (1996) "Impulse invariance and
multiple-order poles". IEEE transactions on signal processing, Vol
40 (9): 2344-2347
See also: bilinear, impinvar.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Converts digital filter with coefficients B and A to analog, conserving
impulse
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
kaiser
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 454
usage: kaiser (L, beta)
Returns the filter coefficients of the L-point Kaiser window with
parameter beta.
For the definition of the Kaiser window, see A. V. Oppenheim &
R. W. Schafer, "Discrete-Time Signal Processing".
The continuous version of width L centered about x=0 is:
besseli(0, beta * sqrt(1-(2*x/L).^2))
k(x) = -------------------------------------, L/2 <= x <= L/2
besseli(0, beta)
See also: kaiserord
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
usage: kaiser (L, beta)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
kaiserord
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1809
usage: [n, Wn, beta, ftype] = kaiserord(f, m, dev [, fs])
Returns the parameters needed for fir1 to produce a filter of the
desired specification from a kaiser window:
n: order of the filter (length of filter minus 1)
Wn: band edges for use in fir1
beta: parameter for kaiser window of length n+1
ftype: choose between pass and stop bands
b = fir1(n,Wn,kaiser(n+1,beta),ftype,'noscale');
f: frequency bands, given as pairs, with the first half of the
first pair assumed to start at 0 and the last half of the last
pair assumed to end at 1. It is important to separate the
band edges, since narrow transition regions require large order
filters.
m: magnitude within each band. Should be non-zero for pass band
and zero for stop band. All passbands must have the same
magnitude, or you will get the error that pass and stop bands
must be strictly alternating.
dev: deviation within each band. Since all bands in the resulting
filter have the same deviation, only the minimum deviation is
used. In this version, a single scalar will work just as well.
fs: sampling rate. Used to convert the frequency specification into
the [0, 1], where 1 corresponds to the Nyquist frequency, fs/2.
The Kaiser window parameters n and beta are computed from the
relation between ripple (A=-20*log10(dev)) and transition width
(dw in radians) discovered empirically by Kaiser:
/ 0.1102(A-8.7) A > 50
beta = | 0.5842(A-21)^0.4 + 0.07886(A-21) 21 <= A <= 50
\ 0.0 A < 21
n = (A-8)/(2.285 dw)
Example
[n, w, beta, ftype] = kaiserord([1000,1200], [1,0], [0.05,0.05], 11025);
freqz(fir1(n,w,kaiser(n+1,beta),ftype,'noscale'),1,[],11025);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
usage: [n, Wn, beta, ftype] = kaiserord(f, m, dev [, fs])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
levinson
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 818
usage: [a, v, ref] = levinson (acf [, p])
Use the Durbin-Levinson algorithm to solve:
toeplitz(acf(1:p)) * x = -acf(2:p+1).
The solution [1, x'] is the denominator of an all pole filter
approximation to the signal x which generated the autocorrelation
function acf.
acf is the autocorrelation function for lags 0 to p.
p defaults to length(acf)-1.
Returns
a=[1, x'] the denominator filter coefficients.
v= variance of the white noise = square of the numerator constant
ref = reflection coefficients = coefficients of the lattice
implementation of the filter
Use freqz(sqrt(v),a) to plot the power spectrum.
REFERENCE
[1] Steven M. Kay and Stanley Lawrence Marple Jr.:
"Spectrum analysis -- a modern perspective",
Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
usage: [a, v, ref] = levinson (acf [, p])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
marcumq
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 960
-- Function File: Q = marcumq (A, B)
-- Function File: Q = marcumq (A, B, M)
-- Function File: Q = marcumq (A, B, M, TOL)
Compute the generalized Marcum Q function of order M with
noncentrality parameter A and argument B. If the order M is
omitted it defaults to 1. An optional relative tolerance TOL may
be included, the default is 'eps'.
If the input arguments are commensurate vectors, this function will
produce a table of values.
This function computes Marcum's Q function using the infinite
Bessel series, truncated when the relative error is less than the
specified tolerance. The accuracy is limited by that of the Bessel
functions, so reducing the tolerance is probably not useful.
Reference: Marcum, "Tables of Q Functions", Rand Corporation.
Reference: R.T. Short, "Computation of Noncentral Chi-squared and
Rice Random Variables", www.phaselockedsystems.com/publications
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute the generalized Marcum Q function of order M with noncentrality
paramete
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
mexihat
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 86
-- Function File: [PSI,X] = mexihat( LB,UB,N)
Compute the Mexican hat wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Compute the Mexican hat wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
meyeraux
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 90
-- Function File: [Y] = meyeraux( X)
Compute the Meyer wavelet auxiliary function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Compute the Meyer wavelet auxiliary function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
morlet
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
-- Function File: [PSI,X] = morlet( LB,UB,N)
Compute the Morlet wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Compute the Morlet wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
movingrms
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 398
-- Function File: [RMSX,W] = movingrms (X,W,RC,FS=1)
Calculates moving RMS value of the signal in X.
The signla is convoluted against a sigmoid window of width W and
risetime RC. The units of these to parameters are relative ot the
vlaue of the sampling frequency given in FS (Default value = 1).
Run 'demo movingrms' to see an example.
See also: sigmoid_train.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Calculates moving RMS value of the signal in X.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
mscohere
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 252
Usage:
[Pxx,freq]=mscohere(x,y,window,overlap,Nfft,Fs,range)
Estimate (mean square) coherence of signals "x" and "y".
Use the Welch (1967) periodogram/FFT method.
See "help pwelch" for description of arguments, hints and references
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
Usage:
[Pxx,freq]=mscohere(x,y,window,overlap,Nfft,Fs,range)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
ncauer
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 383
usage: [Zz, Zp, Zg] = ncauer(Rp, Rs, n)
Analog prototype for Cauer filter.
[z, p, g]=ncauer(Rp, Rs, ws)
Rp = Passband ripple
Rs = Stopband ripple
Ws = Desired order
References:
- Serra, Celso Penteado, Teoria e Projeto de Filtros, Campinas: CARTGRAF,
1983.
- Lamar, Marcus Vinicius, Notas de aula da disciplina TE 456 - Circuitos
Analogicos II, UFPR, 2001/2002.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
usage: [Zz, Zp, Zg] = ncauer(Rp, Rs, n)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
nuttallwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 155
-- Function File: [W] = nuttallwin( L)
Compute the Blackman-Harris window defined by Nuttall of length L.
See also: blackman, blackmanharris.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Compute the Blackman-Harris window defined by Nuttall of length L.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
parzenwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 119
-- Function File: [W] = parzenwin( L)
Compute the Parzen window of lenght L.
See also: rectwin, bartlett.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Compute the Parzen window of lenght L.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
pburg
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3783
usage:
[psd,f_out] = pburg(x,poles,freq,Fs,range,method,plot_type,criterion)
Calculate Burg maximum-entropy power spectral density.
The functions "arburg" and "ar_psd" do all the work.
See "help arburg" and "help ar_psd" for further details.
ARGUMENTS:
All but the first two arguments are optional and may be empty.
x %% [vector] sampled data
poles %% [integer scalar] required number of poles of the AR model
freq %% [real vector] frequencies at which power spectral density
%% is calculated
%% [integer scalar] number of uniformly distributed frequency
%% values at which spectral density is calculated.
%% [default=256]
Fs %% [real scalar] sampling frequency (Hertz) [default=1]
CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
Control-string arguments can be in any order after the other arguments.
range %% 'half', 'onesided' : frequency range of the spectrum is
%% from zero up to but not including sample_f/2. Power
%% from negative frequencies is added to the positive
%% side of the spectrum.
%% 'whole', 'twosided' : frequency range of the spectrum is
%% -sample_f/2 to sample_f/2, with negative frequencies
%% stored in "wrap around" order after the positive
%% frequencies; e.g. frequencies for a 10-point 'twosided'
%% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
%% 'shift', 'centerdc' : same as 'whole' but with the first half
%% of the spectrum swapped with second half to put the
%% zero-frequency value in the middle. (See "help
%% fftshift". If "freq" is vector, 'shift' is ignored.
%% If model coefficients "ar_coeffs" are real, the default
%% range is 'half', otherwise default range is 'whole'.
method %% 'fft': use FFT to calculate power spectral density.
%% 'poly': calculate spectral density as a polynomial of 1/z
%% N.B. this argument is ignored if the "freq" argument is a
%% vector. The default is 'poly' unless the "freq"
%% argument is an integer power of 2.
plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
%% specifies the type of plot. The default is 'plot', which
%% means linear-linear axes. 'squared' is the same as 'plot'.
%% 'dB' plots "10*log10(psd)". This argument is ignored and a
%% spectrum is not plotted if the caller requires a returned
%% value.
criterion %% [optional string arg] model-selection criterion. Limits
%% the number of poles so that spurious poles are not
%% added when the whitened data has no more information
%% in it (see Kay & Marple, 1981). Recognised values are
%% 'AKICc' -- approximate corrected Kullback information
%% criterion (recommended),
%% 'KIC' -- Kullback information criterion
%% 'AICc' -- corrected Akaike information criterion
%% 'AIC' -- Akaike information criterion
%% 'FPE' -- final prediction error" criterion
%% The default is to NOT use a model-selection criterion
RETURNED VALUES:
If return values are not required by the caller, the spectrum
is plotted and nothing is returned.
psd %% [real vector] power-spectral density estimate
f_out %% [real vector] frequency values
HINTS
This function is a wrapper for arburg and ar_psd.
See "help arburg", "help ar_psd".
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
usage:
[psd,f_out] = pburg(x,poles,freq,Fs,range,method,plot_type,criterion
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
pei_tseng_notch
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 695
-- Function File: [ B, A ] = pei_tseng_notch ( FREQUENCIES, BANDWIDTHS
Return coefficients for an IIR notch-filter with one or more filter
frequencies and according (very narrow) bandwidths to be used with
'filter' or 'filtfilt'. The filter construction is based on an
allpass which performs a reversal of phase at the filter
frequencies. Thus, the mean of the phase-distorted and the
original signal has the respective frequencies removed. See the
demo for an illustration.
Original source: Pei, Soo-Chang, and Chien-Cheng Tseng "IIR
Multiple Notch Filter Design Based on Allpass Filter" 1996 IEEE
Tencon doi: 10.1109/TENCON.1996.608814)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Return coefficients for an IIR notch-filter with one or more filter
frequencies
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
polystab
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 156
b = polystab(a)
Stabalize the polynomial transfer function by replacing all roots
outside the unit circle with their reflection inside the unit circle.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
b = polystab(a)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
pulstran
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1187
usage: y=pulstran(t,d,'func',...)
y=pulstran(t,d,p,Fs,'interp')
Generate the signal y=sum(func(t+d,...)) for each d. If d is a
matrix of two columns, the first column is the delay d and the second
column is the amplitude a, and y=sum(a*func(t+d)) for each d,a.
Clearly, func must be a function which accepts a vector of times.
Any extra arguments needed for the function must be tagged on the end.
Example
fs = 11025; # arbitrary sample rate
f0 = 100; # pulse train sample rate
w = 0.001; # pulse width of 1 millisecond
auplot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, 'rectpuls', w), fs);
If instead of a function name you supply a pulse shape sampled at
frequency Fs (default 1 Hz), an interpolated version of the pulse
is added at each delay d. The interpolation stays within the the
time range of the delayed pulse. The interpolation method defaults
to linear, but it can be any interpolation method accepted by the
function interp1.
Example
fs = 11025; # arbitrary sample rate
f0 = 100; # pulse train sample rate
w = boxcar(10); # pulse width of 1 millisecond at 10 kHz
auplot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, w, 10000), fs);
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
usage: y=pulstran(t,d,'func',...)
y=pulstran(t,d,p,Fs,'interp')
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
pwelch
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7140
USAGE:
[spectra,freq] = pwelch(x,window,overlap,Nfft,Fs,
range,plot_type,detrend,sloppy)
Estimate power spectral density of data "x" by the Welch (1967)
periodogram/FFT method. All arguments except "x" are optional.
The data is divided into segments. If "window" is a vector, each
segment has the same length as "window" and is multiplied by "window"
before (optional) zero-padding and calculation of its periodogram. If
"window" is a scalar, each segment has a length of "window" and a
Hamming window is used.
The spectral density is the mean of the periodograms, scaled so that
area under the spectrum is the same as the mean square of the
data. This equivalence is supposed to be exact, but in practice there
is a mismatch of up to 0.5% when comparing area under a periodogram
with the mean square of the data.
[spectra,freq] = pwelch(x,y,window,overlap,Nfft,Fs,
range,plot_type,detrend,sloppy,results)
Two-channel spectrum analyser. Estimate power spectral density, cross-
spectral density, transfer function and/or coherence functions of time-
series input data "x" and output data "y" by the Welch (1967)
periodogram/FFT method.
pwelch treats the second argument as "y" if there is a control-string
argument "cross", "trans", "coher" or "ypower"; "power" does not force
the 2nd argument to be treated as "y". All other arguments are
optional. All spectra are returned in matrix "spectra".
[spectra,Pxx_ci,freq] = pwelch(x,window,overlap,Nfft,Fs,conf,
range,plot_type,detrend,sloppy)
[spectra,Pxx_ci,freq] = pwelch(x,y,window,overlap,Nfft,Fs,conf,
range,plot_type,detrend,sloppy,results)
Estimates confidence intervals for the spectral density.
See Hint (7) below for compatibility options. Confidence level "conf"
is the 6th or 7th numeric argument. If "results" control-string
arguments are used, one of them must be "power" when the "conf"
argument is present; pwelch can estimate confidence intervals only for
the power spectrum of the "x" data. It does not know how to estimate
confidence intervals of the cross-power spectrum, transfer function or
coherence; if you can suggest a good method, please send a bug report.
ARGUMENTS
All but the first argument are optional and may be empty, except that
the "results" argument may require the second argument to be "y".
x %% [non-empty vector] system-input time-series data
y %% [non-empty vector] system-output time-series data
window %% [real vector] of window-function values between 0 and 1; the
%% data segment has the same length as the window.
%% Default window shape is Hamming.
%% [integer scalar] length of each data segment. The default
%% value is window=sqrt(length(x)) rounded up to the
%% nearest integer power of 2; see 'sloppy' argument.
overlap %% [real scalar] segment overlap expressed as a multiple of
%% window or segment length. 0 <= overlap < 1,
%% The default is overlap=0.5 .
Nfft %% [integer scalar] Length of FFT. The default is the length
%% of the "window" vector or has the same value as the
%% scalar "window" argument. If Nfft is larger than the
%% segment length, "seg_len", the data segment is padded
%% with "Nfft-seg_len" zeros. The default is no padding.
%% Nfft values smaller than the length of the data
%% segment (or window) are ignored silently.
Fs %% [real scalar] sampling frequency (Hertz); default=1.0
conf %% [real scalar] confidence level between 0 and 1. Confidence
%% intervals of the spectral density are estimated from
%% scatter in the periodograms and are returned as Pxx_ci.
%% Pxx_ci(:,1) is the lower bound of the confidence
%% interval and Pxx_ci(:,2) is the upper bound. If there
%% are three return values, or conf is an empty matrix,
%% confidence intervals are calculated for conf=0.95 .
%% If conf is zero or is not given, confidence intervals
%% are not calculated. Confidence intervals can be
%% obtained only for the power spectral density of x;
%% nothing else.
CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
Control-string arguments must be after the other arguments but can be in
any order.
range %% 'half', 'onesided' : frequency range of the spectrum is
%% zero up to but not including Fs/2. Power from
%% negative frequencies is added to the positive side of
%% the spectrum, but not at zero or Nyquist (Fs/2)
%% frequencies. This keeps power equal in time and
%% spectral domains. See reference [2].
%% 'whole', 'twosided' : frequency range of the spectrum is
%% -Fs/2 to Fs/2, with negative frequencies
%% stored in "wrap around" order after the positive
%% frequencies; e.g. frequencies for a 10-point 'twosided'
%% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
%% 'shift', 'centerdc' : same as 'whole' but with the first half
%% of the spectrum swapped with second half to put the
%% zero-frequency value in the middle. (See "help
%% fftshift".
%% If data (x and y) are real, the default range is 'half',
%% otherwise default range is 'whole'.
plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
%% specifies the type of plot. The default is 'plot', which
%% means linear-linear axes. 'squared' is the same as 'plot'.
%% 'dB' plots "10*log10(psd)". This argument is ignored and a
%% spectrum is not plotted if the caller requires a returned
%% value.
detrend %% 'no-strip', 'none' -- do NOT remove mean value from the data
%% 'short', 'mean' -- remove the mean value of each segment from
%% each segment of the data.
%% 'linear', -- remove linear trend from each segment of
%% the data.
%% 'long-mean' -- remove the mean value from the data before
%% splitting it into segments. This is the default.
sloppy %% 'sloppy': FFT length is rounded up to the nearest integer
%% power of 2 by zero padding. FFT length is adjusted
%% after addition of padding by explicit Nfft argument.
%% The default is to use exactly the FFT and window/
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
USAGE:
[spectra,freq] = pwelch(x,window,overlap,Nfft,Fs,
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
pyulear
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3140
usage:
[psd,f_out] = pyulear(x,poles,freq,Fs,range,method,plot_type)
Calculates a Yule-Walker autoregressive (all-pole) model of the data "x"
and computes the power spectrum of the model. This is a wrapper for
functions "aryule" and "ar_psd" which perform the argument checking.
See "help aryule" and "help ar_psd" for further details.
ARGUMENTS:
All but the first two arguments are optional and may be empty.
x %% [vector] sampled data
poles %% [integer scalar] required number of poles of the AR model
freq %% [real vector] frequencies at which power spectral density
%% is calculated
%% [integer scalar] number of uniformly distributed frequency
%% values at which spectral density is calculated.
%% [default=256]
Fs %% [real scalar] sampling frequency (Hertz) [default=1]
CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
Control-string arguments can be in any order after the other arguments.
range %% 'half', 'onesided' : frequency range of the spectrum is
%% from zero up to but not including sample_f/2. Power
%% from negative frequencies is added to the positive
%% side of the spectrum.
%% 'whole', 'twosided' : frequency range of the spectrum is
%% -sample_f/2 to sample_f/2, with negative frequencies
%% stored in "wrap around" order after the positive
%% frequencies; e.g. frequencies for a 10-point 'twosided'
%% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
%% 'shift', 'centerdc' : same as 'whole' but with the first half
%% of the spectrum swapped with second half to put the
%% zero-frequency value in the middle. (See "help
%% fftshift". If "freq" is vector, 'shift' is ignored.
%% If model coefficients "ar_coeffs" are real, the default
%% range is 'half', otherwise default range is 'whole'.
method %% 'fft': use FFT to calculate power spectrum.
%% 'poly': calculate power spectrum as a polynomial of 1/z
%% N.B. this argument is ignored if the "freq" argument is a
%% vector. The default is 'poly' unless the "freq"
%% argument is an integer power of 2.
plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
%% specifies the type of plot. The default is 'plot', which
%% means linear-linear axes. 'squared' is the same as 'plot'.
%% 'dB' plots "10*log10(psd)". This argument is ignored and a
%% spectrum is not plotted if the caller requires a returned
%% value.
RETURNED VALUES:
If return values are not required by the caller, the spectrum
is plotted and nothing is returned.
psd %% [real vector] power-spectrum estimate
f_out %% [real vector] frequency values
HINTS
This function is a wrapper for aryule and ar_psd.
See "help aryule", "help ar_psd".
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
usage:
[psd,f_out] = pyulear(x,poles,freq,Fs,range,method,plot_type)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
qp_kaiser
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 602
Usage: qp_kaiser (nb, at, linear)
Computes a finite impulse response (FIR) filter for use with a
quasi-perfect reconstruction polyphase-network filter bank. This
version utilizes a Kaiser window to shape the frequency response of
the designed filter. Tha number nb of bands and the desired
attenuation at in the stop-band are given as parameters.
The Kaiser window is multiplied by the ideal impulse response
h(n)=a.sinc(a.n) and converted to its minimum-phase version by means
of a Hilbert transform.
By using a third non-null argument, the minimum-phase calculation is
ommited at all.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Usage: qp_kaiser (nb, at, linear)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
rceps
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 693
usage: [y, xm] = rceps(x)
Produce the cepstrum of the signal x, and if desired, the minimum
phase reconstruction of the signal x. If x is a matrix, do so
for each column of the matrix.
Example
f0=70; Fs=10000; # 100 Hz fundamental, 10kHz sampling rate
a=poly(0.985*exp(1i*pi*[0.1, -0.1, 0.3, -0.3])); # two formants
s=0.005*randn(1024,1); # Noise excitation signal
s(1:Fs/f0:length(s)) = 1; # Impulse glottal wave
x=filter(1,a,s); # Speech signal in x
[y, xm] = rceps(x.*hanning(1024)); # cepstrum and min phase reconstruction
Reference
Programs for digital signal processing. IEEE Press.
New York: John Wiley & Sons. 1979.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
usage: [y, xm] = rceps(x)
Produce the cepstrum of the signal x, and if desir
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
rectpuls
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 429
usage: y = rectpuls(t, w)
Generate a rectangular pulse over the interval [-w/2,w/2), sampled at
times t. This is useful with the function pulstran for generating a
series pulses.
Example
fs = 11025; # arbitrary sample rate
f0 = 100; # pulse train sample rate
w = 0.3/f0; # pulse width 3/10th the distance between pulses
auplot(pulstran(0:1/fs:4/f0, 0:1/f0:4/f0, 'rectpuls', w), fs);
See also: pulstran
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
usage: y = rectpuls(t, w)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
rectwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 143
-- Function File: [W] = rectwin( L)
Return the filter coefficients of a rectangle window of length L.
See also: hamming, hanning.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
Return the filter coefficients of a rectangle window of length L.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
resample
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 643
-- Function File: [Y H]= resample( X,P,Q)
-- Function File: Y = resample( X,P,Q,H)
Change the sample rate of X by a factor of P/Q. This is performed
using a polyphase algorithm. The impulse response H of the
antialiasing filter is either specified or either designed with a
Kaiser-windowed sinecard.
Ref [1] J. G. Proakis and D. G. Manolakis, Digital Signal
Processing: Principles, Algorithms, and Applications, 4th ed.,
Prentice Hall, 2007. Chap. 6
Ref [2] A. V. Oppenheim, R. W. Schafer and J. R. Buck,
Discrete-time signal processing, Signal processing series,
Prentice-Hall, 1999
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Change the sample rate of X by a factor of P/Q.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
residued
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1059
-- Function File: [R, P, F, M] = residued (B, A)
Compute the partial fraction expansion (PFE) of filter H(z) =
B(z)/A(z). In the usual PFE function 'residuez', the IIR part
(poles P and residues R) is driven _in parallel_ with the FIR part
(F). In this variant ('residued') the IIR part is driven by the
_output_ of the FIR part. This structure can be more accurate in
signal modeling applications.
INPUTS: B and A are vectors specifying the digital filter H(z) =
B(z)/A(z). Say 'help filter' for documentation of the B and A
filter coefficients.
RETURNED:
* R = column vector containing the filter-pole residues
* P = column vector containing the filter poles
* F = row vector containing the FIR part, if any
* M = column vector of pole multiplicities
EXAMPLES:
Say test residued verbose to see a number of examples.
For the theory of operation, see
'http://ccrma.stanford.edu/~jos/filters/residued.html'
See also: residue residued.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Compute the partial fraction expansion (PFE) of filter H(z) = B(z)/A(z).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
residuez
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 748
-- Function File: [R, P, F, M] = residuez (B, A)
Compute the partial fraction expansion of filter H(z) = B(z)/A(z).
INPUTS: B and A are vectors specifying the digital filter H(z) =
B(z)/A(z). Say 'help filter' for documentation of the B and A
filter coefficients.
RETURNED:
* R = column vector containing the filter-pole residues
* P = column vector containing the filter poles
* F = row vector containing the FIR part, if any
* M = column vector of pole multiplicities
EXAMPLES:
Say test residuez verbose to see a number of examples.
For the theory of operation, see
'http://ccrma.stanford.edu/~jos/filters/residuez.html'
See also: residue residued.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Compute the partial fraction expansion of filter H(z) = B(z)/A(z).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
sampled2continuous
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 402
Usage:
xt = sampled2continuous( xn , T, t )
Calculate the x(t) reconstructed
from samples x[n] sampled at a rate 1/T samples
per unit time.
t is all the instants of time when you need x(t)
from x[n]; this time is relative to x[0] and not
an absolute time.
This function can be used to calculate sampling rate
effects on aliasing, actual signal reconstruction
from discrete samples.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Usage:
xt = sampled2continuous( xn , T, t )
Calculate the x(t) reconstruc
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
sawtooth
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 666
-- Function File: [Y] = sawtooth( T)
-- Function File: [Y] = sawtooth( T,WIDTH)
Generates a sawtooth wave of period '2 * pi' with limits '+1/-1'
for the elements of T.
WIDTH is a real number between '0' and '1' which specifies the
point between '0' and '2 * pi' where the maximum is. The function
increases linearly from '-1' to '1' in '[0, 2 * pi * WIDTH]'
interval, and decreases linearly from '1' to '-1' in the interval
'[2 * pi * WIDTH, 2 * pi]'.
If WIDTH is 0.5, the function generates a standard triangular wave.
If WIDTH is not specified, it takes a value of 1, which is a
standard sawtooth function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Generates a sawtooth wave of period '2 * pi' with limits '+1/-1' for the
element
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
schtrig
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 358
-- Function File: [RMSX,W] = schtrig (X,LVL,RST=1)
Implements a multisignal Schmitt trigger with levels LVL.
The triger works along the first dimension of the array X. When
'RST==1' the state of the trigger for all signals is set to the low
state (i.e. 0).
Run 'demo schtrig' to see an example.
See also: clustersegment.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Implements a multisignal Schmitt trigger with levels LVL.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
sftrans
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3646
usage: [Sz, Sp, Sg] = sftrans(Sz, Sp, Sg, W, stop)
Transform band edges of a generic lowpass filter (cutoff at W=1)
represented in splane zero-pole-gain form. W is the edge of the
target filter (or edges if band pass or band stop). Stop is true for
high pass and band stop filters or false for low pass and band pass
filters. Filter edges are specified in radians, from 0 to pi (the
nyquist frequency).
Theory: Given a low pass filter represented by poles and zeros in the
splane, you can convert it to a low pass, high pass, band pass or
band stop by transforming each of the poles and zeros individually.
The following table summarizes the transformation:
Transform Zero at x Pole at x
---------------- ------------------------- ------------------------
Low Pass zero: Fc x/C pole: Fc x/C
S -> C S/Fc gain: C/Fc gain: Fc/C
---------------- ------------------------- ------------------------
High Pass zero: Fc C/x pole: Fc C/x
S -> C Fc/S pole: 0 zero: 0
gain: -x gain: -1/x
---------------- ------------------------- ------------------------
Band Pass zero: b ± sqrt(b^2-FhFl) pole: b ± sqrt(b^2-FhFl)
S^2+FhFl pole: 0 zero: 0
S -> C -------- gain: C/(Fh-Fl) gain: (Fh-Fl)/C
S(Fh-Fl) b=x/C (Fh-Fl)/2 b=x/C (Fh-Fl)/2
---------------- ------------------------- ------------------------
Band Stop zero: b ± sqrt(b^2-FhFl) pole: b ± sqrt(b^2-FhFl)
S(Fh-Fl) pole: ±sqrt(-FhFl) zero: ±sqrt(-FhFl)
S -> C -------- gain: -x gain: -1/x
S^2+FhFl b=C/x (Fh-Fl)/2 b=C/x (Fh-Fl)/2
---------------- ------------------------- ------------------------
Bilinear zero: (2+xT)/(2-xT) pole: (2+xT)/(2-xT)
2 z-1 pole: -1 zero: -1
S -> - --- gain: (2-xT)/T gain: (2-xT)/T
T z+1
---------------- ------------------------- ------------------------
where C is the cutoff frequency of the initial lowpass filter, Fc is
the edge of the target low/high pass filter and [Fl,Fh] are the edges
of the target band pass/stop filter. With abundant tedious algebra,
you can derive the above formulae yourself by substituting the
transform for S into H(S)=S-x for a zero at x or H(S)=1/(S-x) for a
pole at x, and converting the result into the form:
H(S)=g prod(S-Xi)/prod(S-Xj)
The transforms are from the references. The actual pole-zero-gain
changes I derived myself.
Please note that a pole and a zero at the same place exactly cancel.
This is significant for High Pass, Band Pass and Band Stop filters
which create numerous extra poles and zeros, most of which cancel.
Those which do not cancel have a "fill-in" effect, extending the
shorter of the sets to have the same number of as the longer of the
sets of poles and zeros (or at least split the difference in the case
of the band pass filter). There may be other opportunistic
cancellations but I will not check for them.
Also note that any pole on the unit circle or beyond will result in
an unstable filter. Because of cancellation, this will only happen
if the number of poles is smaller than the number of zeros and the
filter is high pass or band pass. The analytic design methods all
yield more poles than zeros, so this will not be a problem.
References:
Proakis & Manolakis (1992). Digital Signal Processing. New York:
Macmillan Publishing Company.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
usage: [Sz, Sp, Sg] = sftrans(Sz, Sp, Sg, W, stop)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
sgolay
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1079
F = sgolay (p, n [, m [, ts]])
Computes the filter coefficients for all Savitzsky-Golay smoothing
filters of order p for length n (odd). m can be used in order to
get directly the mth derivative. In this case, ts is a scaling factor.
The early rows of F smooth based on future values and later rows
smooth based on past values, with the middle row using half future
and half past. In particular, you can use row i to estimate x(k)
based on the i-1 preceding values and the n-i following values of x
values as y(k) = F(i,:) * x(k-i+1:k+n-i).
Normally, you would apply the first (n-1)/2 rows to the first k
points of the vector, the last k rows to the last k points of the
vector and middle row to the remainder, but for example if you were
running on a realtime system where you wanted to smooth based on the
all the data collected up to the current time, with a lag of five
samples, you could apply just the filter on row n-5 to your window
of length n each time you added a new sample.
Reference: Numerical recipes in C. p 650
See also: sgolayfilt
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
F = sgolay (p, n [, m [, ts]])
Computes the filter coefficients for all Savi
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
sgolayfilt
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 857
y = sgolayfilt (x, p, n [, m [, ts]])
Smooth the data in x with a Savitsky-Golay smoothing filter of
polynomial order p and length n, n odd, n > p. By default, p=3
and n=p+2 or n=p+3 if p is even.
y = sgolayfilt (x, F)
Smooth the data in x with smoothing filter F computed by sgolay.
These filters are particularly good at preserving lineshape while
removing high frequency squiggles. Particularly, compare a 5 sample
averager, an order 5 butterworth lowpass filter (cutoff 1/3) and
sgolayfilt(x, 3, 5), the best cubic estimated from 5 points:
[b, a] = butter(5,1/3);
x=[zeros(1,15), 10*ones(1,10), zeros(1,15)];
plot(sgolayfilt(x),"r;sgolayfilt;",...
filtfilt(ones(1,5)/5,1,x),"g;5 sample average;",...
filtfilt(b,a,x),"c;order 5 butterworth;",...
x,"+b;original data;");
See also: sgolay
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
y = sgolayfilt (x, p, n [, m [, ts]])
Smooth the data in x with a Savitsky-
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
shanwavf
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 97
-- Function File: [PSI,X] = shanwavf (LB,UB,N,FB,FC)
Compute the Complex Shannon wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Compute the Complex Shannon wavelet.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
sigmoid_train
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 557
-- Function File: Y = sigmoid_train(T, RANGES, RC)
Evaluates a train of sigmoid functions at T.
The number and duration of each sigmoid is determined from RANGES.
Each row of RANGES represents a real interval, e.g. if sigmod 'i'
starts at 't=0.1' and ends at 't=0.5', then 'RANGES(i,:) = [0.1
0.5]'. The input RC is a array that defines the rising and falling
time constants of each sigmoids. Its size must equal the size of
RANGES.
Run 'demo sigmoid_train' to some examples of the use of this
function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Evaluates a train of sigmoid functions at T.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
sos2tf
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 905
-- Function File: [B, A] = sos2tf (SOS)
-- Function File: [B, A] = sos2tf (SOS, BSCALE)
Convert series second-order sections to direct form H(z) =
B(z)/A(z).
INPUTS:
* SOS = matrix of series second-order sections, one per row:
SOS = [B1.' A1.'; ...; BN.' AN.'], where
'B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
b0 must be nonzero for each section.
See 'filter()' for documentation of the second-order
direct-form filter coefficients Bi and Ai.
* BSCALE is an overall gain factor that effectively scales the
output B vector (or any one of the input Bi vectors). If not
given the gain is assumed to be 1.
RETURNED: B and A are vectors specifying the digital filter H(z) =
B(z)/A(z). See 'filter()' for further details.
See also: tf2sos zp2sos sos2pz zp2tf tf2zp.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
Convert series second-order sections to direct form H(z) = B(z)/A(z).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
sos2zp
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1103
-- Function File: [Z, P, G] = sos2zp (SOS)
-- Function File: [Z, P, G] = sos2zp (SOS, BSCALE)
Convert series second-order sections to zeros, poles, and gains
(pole residues).
INPUTS:
* SOS = matrix of series second-order sections, one per row:
SOS = [B1.' A1.'; ...; BN.' AN.'], where
'B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
b0 must be nonzero for each section. See 'filter()' for
documentation of the second-order direct-form filter
coefficients Bi and Ai.
* BSCALE is an overall gain factor that effectively scales any
one of the input Bi vectors. If not given the gain is assumed
to be 1.
RETURNED:
* Z = column-vector containing all zeros (roots of B(z))
* P = column-vector containing all poles (roots of A(z))
* G = overall gain = B(Inf)
EXAMPLE:
[z,p,g] = sos2zp([1 0 1, 1 0 -0.81; 1 0 0, 1 0 0.49])
=> z = [i; -i; 0; 0], p = [0.9, -0.9, 0.7i, -0.7i], g=1
See also: zp2sos sos2tf tf2sos zp2tf tf2zp.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Convert series second-order sections to zeros, poles, and gains (pole
residues).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
specgram
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4570
usage: [S [, f [, t]]] = specgram(x [, n [, Fs [, window [, overlap]]]])
Generate a spectrogram for the signal. This chops the signal into
overlapping slices, windows each slice and applies a Fourier
transform to determine the frequency components at that slice.
x: vector of samples
n: size of fourier transform window, or [] for default=256
Fs: sample rate, or [] for default=2 Hz
window: shape of the fourier transform window, or [] for default=hanning(n)
Note: window length can be specified instead, in which case
window=hanning(length)
overlap: overlap with previous window, or [] for default=length(window)/2
Return values
S is complex output of the FFT, one row per slice
f is the frequency indices corresponding to the rows of S.
t is the time indices corresponding to the columns of S.
If no return value is requested, the spectrogram is displayed instead.
Example
x = chirp([0:0.001:2],0,2,500); # freq. sweep from 0-500 over 2 sec.
Fs=1000; # sampled every 0.001 sec so rate is 1 kHz
step=ceil(20*Fs/1000); # one spectral slice every 20 ms
window=ceil(100*Fs/1000); # 100 ms data window
specgram(x, 2^nextpow2(window), Fs, window, window-step);
## Speech spectrogram
[x, Fs] = auload(file_in_loadpath("sample.wav")); # audio file
step = fix(5*Fs/1000); # one spectral slice every 5 ms
window = fix(40*Fs/1000); # 40 ms data window
fftn = 2^nextpow2(window); # next highest power of 2
[S, f, t] = specgram(x, fftn, Fs, window, window-step);
S = abs(S(2:fftn*4000/Fs,:)); # magnitude in range 0<f<=4000 Hz.
S = S/max(S(:)); # normalize magnitude so that max is 0 dB.
S = max(S, 10^(-40/10)); # clip below -40 dB.
S = min(S, 10^(-3/10)); # clip above -3 dB.
imagesc(t, f, flipud(log(S))); # display in log scale
The choice of window defines the time-frequency resolution. In
speech for example, a wide window shows more harmonic detail while a
narrow window averages over the harmonic detail and shows more
formant structure. The shape of the window is not so critical so long
as it goes gradually to zero on the ends.
Step size (which is window length minus overlap) controls the
horizontal scale of the spectrogram. Decrease it to stretch, or
increase it to compress. Increasing step size will reduce time
resolution, but decreasing it will not improve it much beyond the
limits imposed by the window size (you do gain a little bit,
depending on the shape of your window, as the peak of the window
slides over peaks in the signal energy). The range 1-5 msec is good
for speech.
FFT length controls the vertical scale. Selecting an FFT length
greater than the window length does not add any information to the
spectrum, but it is a good way to interpolate between frequency
points which can make for prettier spectrograms.
After you have generated the spectral slices, there are a number of
decisions for displaying them. First the phase information is
discarded and the energy normalized:
S = abs(S); S = S/max(S(:));
Then the dynamic range of the signal is chosen. Since information in
speech is well above the noise floor, it makes sense to eliminate any
dynamic range at the bottom end. This is done by taking the max of
the magnitude and some minimum energy such as minE=-40dB. Similarly,
there is not much information in the very top of the range, so
clipping to a maximum energy such as maxE=-3dB makes sense:
S = max(S, 10^(minE/10)); S = min(S, 10^(maxE/10));
The frequency range of the FFT is from 0 to the Nyquist frequency of
one half the sampling rate. If the signal of interest is band
limited, you do not need to display the entire frequency range. In
speech for example, most of the signal is below 4 kHz, so there is no
reason to display up to the Nyquist frequency of 10 kHz for a 20 kHz
sampling rate. In this case you will want to keep only the first 40%
of the rows of the returned S and f. More generally, to display the
frequency range [minF, maxF], you could use the following row index:
idx = (f >= minF & f <= maxF);
Then there is the choice of colormap. A brightness varying colormap
such as copper or bone gives good shape to the ridges and valleys. A
hue varying colormap such as jet or hsv gives an indication of the
steepness of the slopes. The final spectrogram is displayed in log
energy scale and by convention has low frequencies on the bottom of
the image:
imagesc(t, f, flipud(log(S(idx,:))));
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
usage: [S [, f [, t]]] = specgram(x [, n [, Fs [, window [, overlap]]]])
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
square
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 381
-- Function File: S = square( T, DUTY)
-- Function File: S = square( T)
Generate a square wave of period 2 pi with limits +1/-1.
If DUTY is specified, the square wave is +1 for that portion of the
time.
on time
duty cycle = ------------------
on time + off time
See also: cos, sawtooth, sin, tripuls.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Generate a square wave of period 2 pi with limits +1/-1.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
ss2tf
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 354
-- Function File: [NUM, DEN] = ss2tf (A, B, C, D)
Conversion from transfer function to state-space. The state space
system:
.
x = Ax + Bu
y = Cx + Du
is converted to a transfer function:
num(s)
G(s)=-------
den(s)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Conversion from transfer function to state-space.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
ss2zp
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 171
-- Function File: [POL, ZER, K] = ss2zp (A, B, C, D)
Converts a state space representation to a set of poles and zeros;
K is a gain associated with the zeros.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Converts a state space representation to a set of poles and zeros; K is
a gain a
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
tf2sos
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1054
-- Function File: [SOS, G] = tf2sos (B, A)
Convert direct-form filter coefficients to series second-order
sections.
INPUTS: B and A are vectors specifying the digital filter H(z) =
B(z)/A(z). See 'filter()' for documentation of the B and A filter
coefficients.
RETURNED: SOS = matrix of series second-order sections, one per
row:
SOS = [B1.' A1.'; ...; BN.' AN.'], where
'B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
b0 must be nonzero for each section (zeros at infinity not
supported). BSCALE is an overall gain factor that effectively
scales any one of the Bi vectors.
EXAMPLE:
B=[1 0 0 0 0 1];
A=[1 0 0 0 0 .9];
[sos,g] = tf2sos(B,A)
sos =
1.00000 0.61803 1.00000 1.00000 0.60515 0.95873
1.00000 -1.61803 1.00000 1.00000 -1.58430 0.95873
1.00000 1.00000 -0.00000 1.00000 0.97915 -0.00000
g = 1
See also: sos2tf zp2sos sos2pz zp2tf tf2zp.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Convert direct-form filter coefficients to series second-order sections.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
tf2ss
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 518
-- Function File: [A, B, C, D] = tf2ss (NUM, DEN)
Conversion from transfer function to state-space. The state space
system:
.
x = Ax + Bu
y = Cx + Du
is obtained from a transfer function:
num(s)
G(s)=-------
den(s)
The state space system matrices obtained from this function will be
in observable companion form as Wolovich's Observable Structure
Theorem is used.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Conversion from transfer function to state-space.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
tf2zp
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 241
-- Function File: [ZER, POL, K] = tf2zp (NUM, DEN)
Converts transfer functions to poles-and-zero representations.
Returns the zeros and poles of the system defined by NUM/DEN. K is
a gain associated with the system zeros.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Converts transfer functions to poles-and-zero representations.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
tfe
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 381
Usage:
[Pxx,freq] = tfe(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
Estimate transfer function of system with input "x" and output "y".
Use the Welch (1967) periodogram/FFT method.
Compatible with Matlab R11 tfe and earlier.
See "help pwelch" for description of arguments, hints and references
--- especially hint (7) for Matlab R11 defaults.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79
Usage:
[Pxx,freq] = tfe(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
tfestimate
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 266
Usage:
[Pxx,freq]=tfestimate(x,y,window,overlap,Nfft,Fs,range)
Estimate transfer function of system with input "x" and output "y".
Use the Welch (1967) periodogram/FFT method.
See "help pwelch" for description of arguments, hints and references.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Usage:
[Pxx,freq]=tfestimate(x,y,window,overlap,Nfft,Fs,range)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
triang
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 277
usage: w = triang (L)
Returns the filter coefficients of a triangular window of length L.
Unlike the bartlett window, triang does not go to zero at the edges
of the window. For odd L, triang(L) is equal to bartlett(L+2) except
for the zeros at the edges of the window.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
usage: w = triang (L)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
tripuls
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 629
usage: y = tripuls(t, w, skew)
Generate a triangular pulse over the interval [-w/2,w/2), sampled at
times t. This is useful with the function pulstran for generating a
series pulses.
skew is a value between -1 and 1, indicating the relative placement
of the peak within the width. -1 indicates that the peak should be
at -w/2, and 1 indicates that the peak should be at w/2.
Example
fs = 11025; # arbitrary sample rate
f0 = 100; # pulse train sample rate
w = 0.3/f0; # pulse width 3/10th the distance between pulses
auplot(pulstran(0:1/fs:4/f0, 0:1/f0:4/f0, 'tripuls', w), fs);
See also: pulstran
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
usage: y = tripuls(t, w, skew)
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
tukeywin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 640
-- Function File: W = tukeywin (L, R)
Return the filter coefficients of a Tukey window (also known as the
cosine-tapered window) of length L. R defines the ratio between
the constant section and and the cosine section. It has to be
between 0 and 1. The function returns a Hanning window for R egals
0 and a full box for R egals 1. By default R is set to 1/2.
For a definition of the Tukey window, see e.g. Fredric J. Harris,
"On the Use of Windows for Harmonic Analysis with the Discrete
Fourier Transform, Proceedings of the IEEE", Vol. 66, No. 1,
January 1978, Page 67, Equation 38.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Return the filter coefficients of a Tukey window (also known as the
cosine-taper
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
upsample
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 372
-- Function File: Y = upsample (X, N)
-- Function File: Y = upsample (X, N, OFFSET)
Upsample the signal, inserting n-1 zeros between every element.
If X is a matrix, upsample every column.
If OFFSET is specified, control the position of the inserted sample
in the block of n zeros.
See also: decimate, downsample, interp, resample, upfirdn.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
Upsample the signal, inserting n-1 zeros between every element.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
welchwin
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 696
-- Function File: [W] = welchwin( L,C)
Returns a row vector containing a Welch window, given by
W(n)=1-(n/N-1)^2, n=[0,1, ... L-1]. Argument L is the length of
the window. Optional argument C specifies a "symmetric" window
(the default), or a "periodic" window.
A symmetric window has zero at each end and maximum in the middle;
L must be an integer larger than 2. 'if c=="symmetric", N=(L-1)/2'
A periodic window wraps around the cyclic interval [0,1, ... L-1],
and is intended for use with the DFT (functions fft(),
periodogram() etc). L must be an integer larger than 1. 'if
c=="periodic", N=L/2'.
See also: blackman, kaiser.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Returns a row vector containing a Welch window, given by
W(n)=1-(n/N-1)^2, n=[0,
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
window
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 223
-- Function File: W = window (F, N, OPTS)
Create a N-point windowing from the function F. The function F can
be for example '@blackman'. Any additional arguments OPT are
passed to the windowing function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Create a N-point windowing from the function F.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
wkeep
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 128
-- Function File: [Y] = wkeep( X,L,OPT)
Extract the elements of x of size l from the center, the right or
the left.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 75
Extract the elements of x of size l from the center, the right or the
left.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
wrev
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 122
-- Function File: [Y] = wrev( X)
Reverse the order of the element of the vector x.
See also: flipud, fliplr.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Reverse the order of the element of the vector x.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
xcorr
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3024
-- Function File: [R, LAG] = xcorr ( X )
-- Function File: ... = xcorr ( X, Y )
-- Function File: ... = xcorr ( ..., MAXLAG)
-- Function File: ... = xcorr ( ..., SCALE)
Estimates the cross-correlation.
Estimate the cross correlation R_xy(k) of vector arguments X and Y
or, if Y is omitted, estimate autocorrelation R_xx(k) of vector X,
for a range of lags k specified by argument "maxlag". If X is a
matrix, each column of X is correlated with itself and every other
column.
The cross-correlation estimate between vectors "x" and "y" (of
length N) for lag "k" is given by
N
R_xy(k) = sum x_{i+k} conj(y_i),
i=1
where data not provided (for example x(-1), y(N+1)) is zero. Note
the definition of cross-correlation given above. To compute a
cross-correlation consistent with the field of statistics, see
'xcov'.
*ARGUMENTS*
X
[non-empty; real or complex; vector or matrix] data
Y
[real or complex vector] data
If X is a matrix (not a vector), Y must be omitted. Y may be
omitted if X is a vector; in this case xcorr estimates the
autocorrelation of X.
MAXLAG
[integer scalar] maximum correlation lag If omitted, the
default value is N-1, where N is the greater of the lengths of
X and Y or, if X is a matrix, the number of rows in X.
SCALE
[character string] specifies the type of scaling applied to
the correlation vector (or matrix). is one of:
'none'
return the unscaled correlation, R,
'biased'
return the biased average, R/N,
'unbiased'
return the unbiassed average, R(k)/(N-|k|),
'coeff'
return the correlation coefficient, R/(rms(x).rms(y)),
where "k" is the lag, and "N" is the length of X. If
omitted, the default value is "none". If Y is supplied
but does not have the same length as X, scale must be
"none".
*RETURNED VARIABLES*
R
array of correlation estimates
LAG
row vector of correlation lags [-maxlag:maxlag]
The array of correlation estimates has one of the following forms:
(1) Cross-correlation estimate if X and Y are vectors.
(2) Autocorrelation estimate if is a vector and Y is omitted.
(3) If X is a matrix, R is an matrix containing the
cross-correlation estimate of each column with every other column.
Lag varies with the first index so that R has 2*maxlag+1 rows and
P^2 columns where P is the number of columns in X.
If Rij(k) is the correlation between columns i and j of X
'R(k+maxlag+1,P*(i-1)+j) == Rij(k)'
for lag k in [-maxlag:maxlag], or
'R(:,P*(i-1)+j) == xcorr(X(:,i),X(:,j))'.
'reshape(R(k,:),P,P)' is the cross-correlation matrix for 'X(k,:)'.
See also: xcov.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Estimates the cross-correlation.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
xcorr2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1011
-- Function File: xcorr2 (A)
-- Function File: xcorr2 (A, B)
-- Function File: xcorr2 (..., SCALE)
Compute the 2D cross-correlation of matrices A and B.
If B is not specified, computes autocorrelation of A, i.e., same as
'xcorr (A, A)'.
The optional argument SCALE, defines the type of scaling applied to
the cross-correlation matrix. Possible values are:
"none" (default)
No scaling.
"biased"
Scales the raw cross-correlation by the maximum number of
elements of A and B involved in the generation of any element
of C.
"unbiased"
Scales the raw correlation by dividing each element in the
cross-correlation matrix by the number of products A and B
used to generate that element.
"coeff"
Scales the normalized cross-correlation on the range of [0 1]
so that a value of 1 corresponds to a correlation coefficient
of 1.
See also: conv2, corr2, xcorr.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
Compute the 2D cross-correlation of matrices A and B.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
xcov
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 940
-- Function File: [R, LAG] = xcov ( X )
-- Function File: ... = xcov ( X, Y )
-- Function File: ... = xcov ( ..., MAXLAG)
-- Function File: ... = xcov ( ..., SCALE)
Compute covariance at various lags
[=correlation(x-mean(x),y-mean(y))].
X
input vector
Y
if specified, compute cross-covariance between X and Y,
otherwise compute autocovariance of X.
MAXLAG
is specified, use lag range [-maxlag:maxlag], otherwise use
range [-n+1:n-1].
SCALE:
'biased'
for covariance=raw/N,
'unbiased'
for covariance=raw/(N-|lag|),
'coeff'
for covariance=raw/(covariance at lag 0),
'none'
for covariance=raw
'none'
is the default.
Returns the covariance for each lag in the range, plus an optional
vector of lags.
See also: xcorr.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 71
Compute covariance at various lags [=correlation(x-mean(x),y-mean(y))].
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
zerocrossing
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 186
-- Function File: X0 = zerocrossing (X, Y)
Estimates the points at which a given waveform y=y(x) crosses the
x-axis using linear interpolation.
See also: fzero, roots.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Estimates the points at which a given waveform y=y(x) crosses the x-axis
using l
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
zp2sos
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1274
-- Function File: [SOS, G] = zp2sos (Z, P)
-- Function File: [SOS, G] = zp2sos (Z, P, G)
Convert filter poles and zeros to second-order sections.
INPUTS:
* Z = column-vector containing the filter zeros
* P = column-vector containing the filter poles
* G = overall filter gain factor If not given the gain is
assumed to be 1.
RETURNED:
* SOS = matrix of series second-order sections, one per row:
SOS = [B1.' A1.'; ...; BN.' AN.'], where
'B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
b0 must be nonzero for each section.
See 'filter()' for documentation of the second-order
direct-form filter coefficients Bi and %Ai, i=1:N.
* BSCALE is an overall gain factor that effectively scales any
one of the Bi vectors.
EXAMPLE:
[z,p,g] = tf2zp([1 0 0 0 0 1],[1 0 0 0 0 .9]);
[sos,g] = zp2sos(z,p,g)
sos =
1.0000 0.6180 1.0000 1.0000 0.6051 0.9587
1.0000 -1.6180 1.0000 1.0000 -1.5843 0.9587
1.0000 1.0000 0 1.0000 0.9791 0
g =
1
See also: sos2pz sos2tf tf2sos zp2tf tf2zp.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Convert filter poles and zeros to second-order sections.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
zp2ss
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 563
-- Function File: [A, B, C, D] = zp2ss (ZER, POL, K)
Conversion from zero / pole to state space.
*Inputs*
ZER
POL
Vectors of (possibly) complex poles and zeros of a transfer
function. Complex values must come in conjugate pairs (i.e.,
x+jy in ZER means that x-jy is also in ZER).
K
Real scalar (leading coefficient).
*Outputs*
A
B
C
D
The state space system, in the form:
.
x = Ax + Bu
y = Cx + Du
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Conversion from zero / pole to state space.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
zp2tf
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 328
-- Function File: [NUM, DEN] = zp2tf (ZER, POL, K)
Converts zeros / poles to a transfer function.
*Inputs*
ZER
POL
Vectors of (possibly complex) poles and zeros of a transfer
function. Complex values must appear in conjugate pairs.
K
Real scalar (leading coefficient).
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Converts zeros / poles to a transfer function.
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
zplane
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1223
usage: zplane(b [, a]) or zplane(z [, p])
Plot the poles and zeros. If the arguments are row vectors then they
represent filter coefficients (numerator polynomial b and denominator
polynomial a), but if they are column vectors or matrices then they
represent poles and zeros.
This is a horrid interface, but I didn't choose it; better would be
to accept b,a or z,p,g like other functions. The saving grace is
that poly(x) always returns a row vector and roots(x) always returns
a column vector, so it is usually right. You must only be careful
when you are creating filters by hand.
Note that due to the nature of the roots() function, poles and zeros
may be displayed as occurring around a circle rather than at a single
point.
The transfer function is
B(z) b0 + b1 z^(-1) + b2 z^(-2) + ... + bM z^(-M)
H(z) = ---- = --------------------------------------------
A(z) a0 + a1 z^(-1) + a2 z^(-2) + ... + aN z^(-N)
b0 (z - z1) (z - z2) ... (z - zM)
= -- z^(-M+N) ------------------------------
a0 (z - p1) (z - p2) ... (z - pN)
The denominator a defaults to 1, and the poles p defaults to [].
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
usage: zplane(b [, a]) or zplane(z [, p])
|