Cody

# Problem 150. chirp again

Solution 94046

Submitted on 31 May 2012 by Richard Zapor
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% accu=10^6; f = 10000; fs=48000; your_chirp=round(chirping(f,fs)*accu)/accu; y_correct = round(chirp(0:1/fs:1-1/fs, 0,1,f,'linear',-90)*accu)/accu; assert(isequal(your_chirp,y_correct))

y = Columns 1 through 6 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 Columns 7 through 12 0.0005 0.0007 0.0009 0.0011 0.0014 0.0016 Columns 13 through 18 0.0020 0.0023 0.0027 0.0031 0.0035 0.0039 Columns 19 through 24 0.0044 0.0049 0.0055 0.0060 0.0066 0.0072 Columns 25 through 30 0.0079 0.0085 0.0092 0.0099 0.0107 0.0115 Columns 31 through 36 0.0123 0.0131 0.0140 0.0148 0.0158 0.0167 Columns 37 through 42 0.0177 0.0187 0.0197 0.0207 0.0218 0.0229 Columns 43 through 48 0.0241 0.0252 0.0264 0.0276 0.0288 0.0301 Columns 49 through 54 0.0314 0.0327 0.0341 0.0355 0.0369 0.0383 Columns 55 through 60 0.0398 0.0412 0.0427 0.0443 0.0459 0.0474 Columns 61 through 66 0.0491 0.0507 0.0524 0.0541 0.0558 0.0576 Columns 67 through 72 0.0594 0.0612 0.0630 0.0649 0.0668 0.0687 Columns 73 through 78 0.0706 0.0726 0.0746 0.0766 0.0787 0.0808 Columns 79 through 84 0.0829 0.0850 0.0872 0.0893 0.0916 0.0938 Columns 85 through 90 0.0961 0.0984 0.1007 0.1030 0.1054 0.1078 Columns 91 through 96 0.1102 0.1127 0.1152 0.1177 0.1202 0.1227 Columns 97 through 102 0.1253 0.1279 0.1306 0.1332 0.1359 0.1386 Columns 103 through 108 0.1414 0.1442 0.1469 0.1498 0.1526 0.1555 Columns 109 through 114 0.1584 0.1613 0.1642 0.1672 0.1702 0.1732 Columns 115 through 120 0.1763 0.1794 0.1825 0.1856 0.1887 0.1919 Columns 121 through 126 0.1951 0.1983 0.2016 0.2048 0.2081 0.2114 Columns 127 through 132 0.2148 0.2182 0.2215 0.2250 0.2284 0.2319 Columns 133 through 138 0.2354 0.2389 0.2424 0.2460 0.2495 0.2531 Columns 139 through 144 0.2568 0.2604 0.2641 0.2678 0.2715 0.2752 Columns 145 through 150 0.2790 0.2828 0.2866 0.2904 0.2942 0.2981 Columns 151 through 156 0.3020 0.3059 0.3098 0.3138 0.3178 0.3218 Columns 157 through 162 0.3258 0.3298 0.3339 0.3379 0.3420 0.3461 Columns 163 through 168 0.3503 0.3544 0.3586 0.3628 0.3670 0.3712 Columns 169 through 174 0.3754 0.3797 0.3839 0.3882 0.3925 0.3969 Columns 175 through 180 0.4012 0.4056 0.4099 0.4143 0.4187 0.4231 Columns 181 through 186 0.4276 0.4320 0.4365 0.4409 0.4454 0.4499 Columns 187 through 192 0.4544 0.4590 0.4635 0.4680 0.4726 0.4772 Columns 193 through 198 0.4818 0.4863 0.4910 0.4956 0.5002 0.5048 Columns 199 through 204 0.5095 0.5141 0.5188 0.5234 0.5281 0.5328 Columns 205 through 210 0.5375 0.5422 0.5469 0.5516 0.5563 0.5610 Columns 211 through 216 0.5657 0.5705 0.5752 0.5799 0.5846 0.5894 Columns 217 through 222 0.5941 0.5989 0.6036 0.6083 0.6131 0.6178 Columns 223 through 228 0.6226 0.6273 0.6320 0.6368 0.6415 0.6462 Columns 229 through 234 0.6509 0.6557 0.6604 0.6651 0.6698 0.6745 Columns 235 through 240 0.6792 0.6838 0.6885 0.6932 0.6978 0.7025 Columns 241 through 246 0.7071 0.7117 0.7163 0.7209 0.7255 0.7301 Columns 247 through 252 0.7347 0.7392 0.7437 0.7482 0.7527 0.7572 Columns 253 through 258 0.7617 0.7661 0.7705 0.7750 0.7793 0.7837 Columns 259 through 264 0.7880 0.7924 0.7967 0.8009 0.8052 0.8094 Columns 265 through 270 0.8136 0.8178 0.8219 0.8260 0.8301 0.8342 Columns 271 through 276 0.8382 0.8422 0.8462 0.8501 0.8540 0.8579 Columns 277 through 282 0.8617 0.8655 0.8693 0.8730 0.8767 0.8804 Columns 283 through 288 0.8840 0.8876 0.8911 0.8946 0.8981 0.9015 Columns 289 through 294 0.9048 0.9081 0.9114 0.9147 0.9178 0.9210 Columns 295 through 300 0.9241 0.9271 0.9301 0.9330 0.9359 0.9388 Columns 301 through 306 0.9415 0.9443 0.9469 0.9496 0.9521 0.9546 Columns 307 through 312 0.9571 0.9595 0.9618 0.9641 0.9663 0.9684 Columns 313 through 318 0.9705 0.9725 0.9745 0.9764 0.9782 0.9799 Columns 319 through 324 0.9816 0.9833 0.9848 0.9863 0.9877 0.9890 Columns 325 through 330 0.9903 0.9915 0.9926 0.9936 0.9946 0.9955 Columns 331 through 336 0.9963 0.9970 0.9977 0.9983 0.9988 0.9992 Columns 337 through 342 0.9995 0.9998 0.9999 1.0000 1.0000 0.9999 Columns 343 through 348 0.9997 0.9994 0.9991 0.9986 0.9981 0.9975 Columns 349 through 354 0.9968 0.9960 0.9951 0.9941 0.9930 0.9918 Columns 355 through 360 0.9905 0.9891 0.9877 0.9861 0.9844 0.9827 Columns 361 through 366 0.9808 0.9788 0.9768 0.9746 0.9723 0.9699 Columns 367 through 372 0.9675 0.9649 0.9622 0.9594 0.9565 0.9535 Columns 373 through 378 0.9504 0.9472 0.9439 0.9405 0.9370 0.9333 Columns 379 through 384 0.9296 0.9257 0.9218 0.9177 0.9135 0.9092 Columns 385 through 390 0.9048 0.9003 0.8957 0.8910 0.8861 0.8811 Columns 391 through 396 0.8761 0.8709 0.8656 0.8602 0.8547 0.8490 Columns 397 through 402 0.8433 0.8374 0.8314 0.8254 0.8192 0.8128 Columns 403 through 408 0.8064 0.7999 0.7932 0.7865 0.7796 0.7726 Columns 409 through 414 0.7655 0.7583 0.7509 0.7435 0.7359 0.7283 Columns 415 through 420 0.7205 0.7126 0.7046 0.6965 0.6883 0.6800 Columns 421 through 426 0.6716 0.6630 0.6544 0.6456 0.6368 0.6278 Columns 427 through 432 0.6187 0.6095 0.6002 0.5909 0.5814 0.5718 Columns 433 through 438 0.5621 0.5523 0.5424 0.5324 0.5223 0.5121 Columns 439 through 444 0.5018 0.4915 0.4810 0.4704 0.4598 0.4490 Columns 445 through 450 0.4382 0.4272 0.4162 0.4051 0.3939 0.3827 Columns 451 through 456 0.3713 0.3599 0.3484 0.3368 0.3251 0.3134 Columns 457 through 462 0.3015 0.2896 0.2777 0.2656 0.2535 0.2414 Columns 463 through 468 0.2291 0.2169 0.2045 0.1921 0.1796 0.1671 Columns 469 through 474 0.1545 0.1419 0.1292 0.1164 0.1037 0.0908 Columns 475 through 480 0.0780 0.0651 0.0521 0.0391 0.0261 0.0131 Columns 481 through 486 0.0000 -0.0131 -0.0262 -0.0394 -0.0526 -0.0657 Columns 487 through 492 -0.0789 -0.0922 -0.1054 -0.1186 -0.1319 -0.1451 Columns 493 through 498 -0.1584 -0.1716 -0.1849 -0.1981 -0.2113 -0.2245 Columns 499 through 504 -0.2377 -0.2509 -0.2641 -0.2772 -0.2903 -0.3034 Columns 505 through 510 -0.3165 -0.3295 -0.3425 -0.3554 -0.3683 -0.3812 Columns 511 through 516 -0.3940 -0.4067 -0.4195 -0.4321 -0.4447 -0.4572 Columns 517 through 522 -0.4697 -0.4821 -0.4944 -0.5066 -0.5188 -0.5309 Columns 523 through 528 -0.5429 -0.5548 -0.5666 -0.5783 -0.5899 -0.6015 Columns 529 through 534 -0.6129 -0.6242 -0.6354 -0.6466 -0.6575 -0.6684 Columns 535 through 540 -0.6792 -0.6898 -0.7003 -0.7107 -0.7209 -0.7310 Columns 541 through 546 -0.7410 -0.7508 -0.7604 -0.7700 -0.7793 -0.7886 Columns 547 through 552 -0.7976 -0.8065 -0.8153 -0.8238 -0.8322 -0.8405 Columns 553 through 558 -0.8485 -0.8564 -0.8641 -0.8716 -0.8789 -0.8861 Columns 559 through 564 -0.8930 -0.8998 -0.9063 -0.9127 -0.9188 -0.9248 Columns 565 through 570 -0.9305 -0.9360 -0.9413 -0.9464 -0.9513 -0.9560 Columns 571 through 576 -0.9604 -0.9646 -0.9686 -0.9724 -0.9759 -0.9792 Columns 577 through 582 -0.9823 -0.9851 -0.9877 -0.9900 -0.9921 -0.9940 Columns 583 through 588 -0.9956 -0.9970 -0.9981 -0.9989 -0.9995 -0.9999 Columns 589 through 594 -1.0000 -0.9998 -0.9994 -0.9987 -0.9978 -0.9966 Columns 595 through 600 -0.9951 -0.9934 -0.9914 -0.9892 -0.9866 -0.9838 Columns 601 through 606 -0.9808 -0.9775 -0.9739 -0.9700 -0.9659 -0.9615 Columns 607 through 612 -0.9568 -0.9519 -0.9466 -0.9412 -0.9354 -0.9294 Columns 613 through 618 -0.9231 -0.9166 -0.9098 -0.9027 -0.8953 -0.8877 Columns 619 through 624 -0.8798 -0.8717 -0.8633 -0.8546 -0.8457 -0.8365 Columns 625 through 630 -0.8271 -0.8174 -0.8074 -0.7972 -0.7868 -0.7761 Columns 631 through 636 -0.7652 -0.7540 -0.7426 -0.7309 -0.7190 -0.7069 Columns 637 through 642 -0.6945 -0.6819 -0.6691 -0.6560 -0.6428 -0.6293 Columns 643 through 648 -0.6156 -0.6017 -0.5876 -0.5733 -0.5588 -0.5441 Columns 649 through 654 -0.5292 -0.5141 -0.4988 -0.4834 -0.4677 -0.4519 Columns 655 through 660 -0.4360 -0.4198 -0.4035 -0.3871 -0.3705 -0.3538 Columns 661 through 666 -0.3369 -0.3199 -0.3027 -0.2855 -0.2681 -0.2506 Columns 667 through 672 -0.2330 -0.2153 -0.1974 -0.1795 -0.1615 -0.1435 Columns 673 through 678 -0.1253 -0.1071 -0.0888 -0.0705 -0.0521 -0.0337 Columns 679 through 684 -0.0152 0.0033 0.0218 0.0404 0.0589 0.0775 Columns 685 through 690 0.0961 0.1146 0.1332 0.1517 0.1702 0.1887 Columns 691 through 696 ...

2   Pass
%% accu=10^6; f = 3650; fs=44000; your_chirp=round(chirping(f,fs)*accu)/accu; y_correct = round(chirp(0:1/fs:1-1/fs, 0,1,f,'linear',-90)*accu)/accu; assert(isequal(your_chirp,y_correct))

y = Columns 1 through 6 0.0000 0.0000 0.0000 0.0001 0.0001 0.0001 Columns 7 through 12 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 Columns 13 through 18 0.0009 0.0010 0.0012 0.0013 0.0015 0.0017 Columns 19 through 24 0.0019 0.0021 0.0024 0.0026 0.0029 0.0031 Columns 25 through 30 0.0034 0.0037 0.0040 0.0043 0.0046 0.0050 Columns 31 through 36 0.0053 0.0057 0.0061 0.0065 0.0068 0.0073 Columns 37 through 42 0.0077 0.0081 0.0086 0.0090 0.0095 0.0100 Columns 43 through 48 0.0104 0.0110 0.0115 0.0120 0.0125 0.0131 Columns 49 through 54 0.0136 0.0142 0.0148 0.0154 0.0160 0.0166 Columns 55 through 60 0.0173 0.0179 0.0186 0.0192 0.0199 0.0206 Columns 61 through 66 0.0213 0.0220 0.0228 0.0235 0.0243 0.0250 Columns 67 through 72 0.0258 0.0266 0.0274 0.0282 0.0290 0.0299 Columns 73 through 78 0.0307 0.0316 0.0324 0.0333 0.0342 0.0351 Columns 79 through 84 0.0360 0.0370 0.0379 0.0389 0.0398 0.0408 Columns 85 through 90 0.0418 0.0428 0.0438 0.0448 0.0459 0.0469 Columns 91 through 96 0.0480 0.0490 0.0501 0.0512 0.0523 0.0534 Columns 97 through 102 0.0546 0.0557 0.0569 0.0580 0.0592 0.0604 Columns 103 through 108 0.0616 0.0628 0.0640 0.0653 0.0665 0.0678 Columns 109 through 114 0.0690 0.0703 0.0716 0.0729 0.0742 0.0756 Columns 115 through 120 0.0769 0.0783 0.0796 0.0810 0.0824 0.0838 Columns 121 through 126 0.0852 0.0866 0.0880 0.0895 0.0909 0.0924 Columns 127 through 132 0.0939 0.0954 0.0969 0.0984 0.0999 0.1015 Columns 133 through 138 0.1030 0.1046 0.1062 0.1077 0.1093 0.1109 Columns 139 through 144 0.1126 0.1142 0.1158 0.1175 0.1191 0.1208 Columns 145 through 150 0.1225 0.1242 0.1259 0.1276 0.1294 0.1311 Columns 151 through 156 0.1329 0.1346 0.1364 0.1382 0.1400 0.1418 Columns 157 through 162 0.1436 0.1455 0.1473 0.1492 0.1510 0.1529 Columns 163 through 168 0.1548 0.1567 0.1586 0.1606 0.1625 0.1644 Columns 169 through 174 0.1664 0.1684 0.1703 0.1723 0.1743 0.1763 Columns 175 through 180 0.1784 0.1804 0.1824 0.1845 0.1866 0.1886 Columns 181 through 186 0.1907 0.1928 0.1949 0.1971 0.1992 0.2013 Columns 187 through 192 0.2035 0.2056 0.2078 0.2100 0.2122 0.2144 Columns 193 through 198 0.2166 0.2188 0.2211 0.2233 0.2256 0.2278 Columns 199 through 204 0.2301 0.2324 0.2347 0.2370 0.2393 0.2417 Columns 205 through 210 0.2440 0.2463 0.2487 0.2511 0.2535 0.2558 Columns 211 through 216 0.2582 0.2606 0.2631 0.2655 0.2679 0.2704 Columns 217 through 222 0.2728 0.2753 0.2778 0.2803 0.2828 0.2853 Columns 223 through 228 0.2878 0.2903 0.2928 0.2954 0.2979 0.3005 Columns 229 through 234 0.3031 0.3056 0.3082 0.3108 0.3134 0.3160 Columns 235 through 240 0.3187 0.3213 0.3239 0.3266 0.3292 0.3319 Columns 241 through 246 0.3346 0.3373 0.3400 0.3427 0.3454 0.3481 Columns 247 through 252 0.3508 0.3535 0.3563 0.3590 0.3618 0.3646 Columns 253 through 258 0.3673 0.3701 0.3729 0.3757 0.3785 0.3813 Columns 259 through 264 0.3841 0.3869 0.3898 0.3926 0.3955 0.3983 Columns 265 through 270 0.4012 0.4040 0.4069 0.4098 0.4127 0.4156 Columns 271 through 276 0.4185 0.4214 0.4243 0.4272 0.4302 0.4331 Columns 277 through 282 0.4360 0.4390 0.4419 0.4449 0.4478 0.4508 Columns 283 through 288 0.4538 0.4568 0.4598 0.4627 0.4657 0.4687 Columns 289 through 294 0.4717 0.4748 0.4778 0.4808 0.4838 0.4868 Columns 295 through 300 0.4899 0.4929 0.4960 0.4990 0.5021 0.5051 Columns 301 through 306 0.5082 0.5112 0.5143 0.5174 0.5204 0.5235 Columns 307 through 312 0.5266 0.5297 0.5328 0.5359 0.5390 0.5420 Columns 313 through 318 0.5451 0.5482 0.5513 0.5545 0.5576 0.5607 Columns 319 through 324 0.5638 0.5669 0.5700 0.5731 0.5762 0.5794 Columns 325 through 330 0.5825 0.5856 0.5887 0.5918 0.5950 0.5981 Columns 331 through 336 0.6012 0.6043 0.6075 0.6106 0.6137 0.6168 Columns 337 through 342 0.6199 0.6231 0.6262 0.6293 0.6324 0.6356 Columns 343 through 348 0.6387 0.6418 0.6449 0.6480 0.6511 0.6542 Columns 349 through 354 0.6573 0.6605 0.6636 0.6667 0.6698 0.6728 Columns 355 through 360 0.6759 0.6790 0.6821 0.6852 0.6883 0.6913 Columns 361 through 366 0.6944 0.6975 0.7005 0.7036 0.7067 0.7097 Columns 367 through 372 0.7128 0.7158 0.7188 0.7219 0.7249 0.7279 Columns 373 through 378 0.7309 0.7339 0.7369 0.7399 0.7429 0.7459 Columns 379 through 384 0.7488 0.7518 0.7547 0.7577 0.7606 0.7636 Columns 385 through 390 0.7665 0.7694 0.7723 0.7752 0.7781 0.7810 Columns 391 through 396 0.7839 0.7867 0.7896 0.7924 0.7953 0.7981 Columns 397 through 402 0.8009 0.8037 0.8065 0.8093 0.8121 0.8148 Columns 403 through 408 0.8176 0.8203 0.8230 0.8257 0.8284 0.8311 Columns 409 through 414 0.8338 0.8365 0.8391 0.8417 0.8444 0.8470 Columns 415 through 420 0.8496 0.8521 0.8547 0.8573 0.8598 0.8623 Columns 421 through 426 0.8648 0.8673 0.8698 0.8723 0.8747 0.8771 Columns 427 through 432 0.8795 0.8819 0.8843 0.8867 0.8890 0.8913 Columns 433 through 438 0.8936 0.8959 0.8982 0.9004 0.9027 0.9049 Columns 439 through 444 0.9071 0.9092 0.9114 0.9135 0.9157 0.9177 Columns 445 through 450 0.9198 0.9219 0.9239 0.9259 0.9279 0.9299 Columns 451 through 456 0.9318 0.9337 0.9356 0.9375 0.9394 0.9412 Columns 457 through 462 0.9430 0.9448 0.9466 0.9483 0.9500 0.9517 Columns 463 through 468 0.9534 0.9550 0.9566 0.9582 0.9598 0.9613 Columns 469 through 474 0.9628 0.9643 0.9658 0.9672 0.9686 0.9700 Columns 475 through 480 0.9713 0.9726 0.9739 0.9752 0.9764 0.9776 Columns 481 through 486 0.9788 0.9800 0.9811 0.9822 0.9832 0.9843 Columns 487 through 492 0.9853 0.9862 0.9872 0.9881 0.9890 0.9898 Columns 493 through 498 0.9906 0.9914 0.9921 0.9929 0.9935 0.9942 Columns 499 through 504 0.9948 0.9954 0.9959 0.9965 0.9969 0.9974 Columns 505 through 510 0.9978 0.9982 0.9985 0.9988 0.9991 0.9993 Columns 511 through 516 0.9995 0.9997 0.9998 0.9999 1.0000 1.0000 Columns 517 through 522 1.0000 0.9999 0.9998 0.9997 0.9995 0.9993 Columns 523 through 528 0.9991 0.9988 0.9985 0.9981 0.9977 0.9973 Columns 529 through 534 0.9968 0.9962 0.9957 0.9951 0.9944 0.9938 Columns 535 through 540 0.9930 0.9923 0.9915 0.9906 0.9897 0.9888 Columns 541 through 546 0.9878 0.9868 0.9857 0.9846 0.9835 0.9823 Columns 547 through 552 0.9811 0.9798 0.9785 0.9771 0.9757 0.9743 Columns 553 through 558 0.9728 0.9712 0.9696 0.9680 0.9663 0.9646 Columns 559 through 564 0.9629 0.9611 0.9592 0.9573 0.9554 0.9534 Columns 565 through 570 0.9513 0.9492 0.9471 0.9449 0.9427 0.9405 Columns 571 through 576 0.9381 0.9358 0.9334 0.9309 0.9284 0.9259 Columns 577 through 582 0.9233 0.9206 0.9179 0.9152 0.9124 0.9096 Columns 583 through 588 0.9067 0.9037 0.9008 0.8977 0.8947 0.8915 Columns 589 through 594 0.8884 0.8851 0.8819 0.8786 0.8752 0.8718 Columns 595 through 600 0.8683 0.8648 0.8612 0.8576 0.8539 0.8502 Columns 601 through 606 0.8465 0.8427 0.8388 0.8349 0.8309 0.8269 Columns 607 through 612 0.8229 0.8188 0.8146 0.8104 0.8062 0.8019 Columns 613 through 618 0.7975 0.7931 0.7887 0.7842 0.7796 0.7751 Columns 619 through 624 0.7704 0.7657 0.7610 0.7562 0.7513 0.7465 Columns 625 through 630 0.7415 0.7365 0.7315 0.7264 0.7213 0.7161 Columns 631 through 636 0.7109 0.7056 0.7003 0.6949 0.6895 0.6841 Columns 637 through 642 0.6785 0.6730 0.6674 0.6617 0.6560 0.6503 Columns 643 through 648 0.6445 0.6387 0.6328 0.6268 0.6209 0.6149 Columns 649 through 654 0.6088 0.6027 0.5965 0.5903 0.5841 0.5778 Columns 655 through 660 0.5714 0.5651 0.5586 0.5522 0.5457 0.5391 Columns 661 through 666 0.5325 0.5259 0.5192 0.5125 0.5057 0.4989 Columns 667 through 672 0.4920 0.4852 0.4782 0.4713 0.4642 0.4572 Columns 673 through 678 0.4501 0.4430 0.4358 0.4286 0.4214 0.4141 Columns 679 through 684 0.4068 0.3994 0.3920 0.3846 0.3771 0.3696 Columns 685 through 690 0.3621 0.3545 0.3469 0.3393 0.3316 0.3239 Columns 691 through 696 ...