Cody

# Problem 150. chirp again

Solution 265752

Submitted on 23 Jun 2013 by andrea84
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))

ans = Columns 1 through 10 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0007 0.0009 0.0011 Columns 11 through 20 0.0014 0.0016 0.0020 0.0023 0.0027 0.0031 0.0035 0.0039 0.0044 0.0049 Columns 21 through 30 0.0055 0.0060 0.0066 0.0072 0.0079 0.0085 0.0092 0.0099 0.0107 0.0115 Columns 31 through 40 0.0123 0.0131 0.0140 0.0148 0.0158 0.0167 0.0177 0.0187 0.0197 0.0207 Columns 41 through 50 0.0218 0.0229 0.0241 0.0252 0.0264 0.0276 0.0288 0.0301 0.0314 0.0327 Columns 51 through 60 0.0341 0.0355 0.0369 0.0383 0.0398 0.0412 0.0427 0.0443 0.0459 0.0474 Columns 61 through 70 0.0491 0.0507 0.0524 0.0541 0.0558 0.0576 0.0594 0.0612 0.0630 0.0649 Columns 71 through 80 0.0668 0.0687 0.0706 0.0726 0.0746 0.0766 0.0787 0.0808 0.0829 0.0850 Columns 81 through 90 0.0872 0.0893 0.0916 0.0938 0.0961 0.0984 0.1007 0.1030 0.1054 0.1078 Columns 91 through 100 0.1102 0.1127 0.1152 0.1177 0.1202 0.1227 0.1253 0.1279 0.1306 0.1332 Columns 101 through 110 0.1359 0.1386 0.1414 0.1442 0.1469 0.1498 0.1526 0.1555 0.1584 0.1613 Columns 111 through 120 0.1642 0.1672 0.1702 0.1732 0.1763 0.1794 0.1825 0.1856 0.1887 0.1919 Columns 121 through 130 0.1951 0.1983 0.2016 0.2048 0.2081 0.2114 0.2148 0.2182 0.2215 0.2250 Columns 131 through 140 0.2284 0.2319 0.2354 0.2389 0.2424 0.2460 0.2495 0.2531 0.2568 0.2604 Columns 141 through 150 0.2641 0.2678 0.2715 0.2752 0.2790 0.2828 0.2866 0.2904 0.2942 0.2981 Columns 151 through 160 0.3020 0.3059 0.3098 0.3138 0.3178 0.3218 0.3258 0.3298 0.3339 0.3379 Columns 161 through 170 0.3420 0.3461 0.3503 0.3544 0.3586 0.3628 0.3670 0.3712 0.3754 0.3797 Columns 171 through 180 0.3839 0.3882 0.3925 0.3969 0.4012 0.4056 0.4099 0.4143 0.4187 0.4231 Columns 181 through 190 0.4276 0.4320 0.4365 0.4409 0.4454 0.4499 0.4544 0.4590 0.4635 0.4680 Columns 191 through 200 0.4726 0.4772 0.4818 0.4863 0.4910 0.4956 0.5002 0.5048 0.5095 0.5141 Columns 201 through 210 0.5188 0.5234 0.5281 0.5328 0.5375 0.5422 0.5469 0.5516 0.5563 0.5610 Columns 211 through 220 0.5657 0.5705 0.5752 0.5799 0.5846 0.5894 0.5941 0.5989 0.6036 0.6083 Columns 221 through 230 0.6131 0.6178 0.6226 0.6273 0.6320 0.6368 0.6415 0.6462 0.6509 0.6557 Columns 231 through 240 0.6604 0.6651 0.6698 0.6745 0.6792 0.6838 0.6885 0.6932 0.6978 0.7025 Columns 241 through 250 0.7071 0.7117 0.7163 0.7209 0.7255 0.7301 0.7347 0.7392 0.7437 0.7482 Columns 251 through 260 0.7527 0.7572 0.7617 0.7661 0.7705 0.7750 0.7793 0.7837 0.7880 0.7924 Columns 261 through 270 0.7967 0.8009 0.8052 0.8094 0.8136 0.8178 0.8219 0.8260 0.8301 0.8342 Columns 271 through 280 0.8382 0.8422 0.8462 0.8501 0.8540 0.8579 0.8617 0.8655 0.8693 0.8730 Columns 281 through 290 0.8767 0.8804 0.8840 0.8876 0.8911 0.8946 0.8981 0.9015 0.9048 0.9081 Columns 291 through 300 0.9114 0.9147 0.9178 0.9210 0.9241 0.9271 0.9301 0.9330 0.9359 0.9388 Columns 301 through 310 0.9415 0.9443 0.9469 0.9496 0.9521 0.9546 0.9571 0.9595 0.9618 0.9641 Columns 311 through 320 0.9663 0.9684 0.9705 0.9725 0.9745 0.9764 0.9782 0.9799 0.9816 0.9833 Columns 321 through 330 0.9848 0.9863 0.9877 0.9890 0.9903 0.9915 0.9926 0.9936 0.9946 0.9955 Columns 331 through 340 0.9963 0.9970 0.9977 0.9983 0.9988 0.9992 0.9995 0.9998 0.9999 1.0000 Columns 341 through 350 1.0000 0.9999 0.9997 0.9994 0.9991 0.9986 0.9981 0.9975 0.9968 0.9960 Columns 351 through 360 0.9951 0.9941 0.9930 0.9918 0.9905 0.9891 0.9877 0.9861 0.9844 0.9827 Columns 361 through 370 0.9808 0.9788 0.9768 0.9746 0.9723 0.9699 0.9675 0.9649 0.9622 0.9594 Columns 371 through 380 0.9565 0.9535 0.9504 0.9472 0.9439 0.9405 0.9370 0.9333 0.9296 0.9257 Columns 381 through 390 0.9218 0.9177 0.9135 0.9092 0.9048 0.9003 0.8957 0.8910 0.8861 0.8811 Columns 391 through 400 0.8761 0.8709 0.8656 0.8602 0.8547 0.8490 0.8433 0.8374 0.8314 0.8254 Columns 401 through 410 0.8192 0.8128 0.8064 0.7999 0.7932 0.7865 0.7796 0.7726 0.7655 0.7583 Columns 411 through 420 0.7509 0.7435 0.7359 0.7283 0.7205 0.7126 0.7046 0.6965 0.6883 0.6800 Columns 421 through 430 0.6716 0.6630 0.6544 0.6456 0.6368 0.6278 0.6187 0.6095 0.6002 0.5909 Columns 431 through 440 0.5814 0.5718 0.5621 0.5523 0.5424 0.5324 0.5223 0.5121 0.5018 0.4915 Columns 441 through 450 0.4810 0.4704 0.4598 0.4490 0.4382 0.4272 0.4162 0.4051 0.3939 0.3827 Columns 451 through 460 0.3713 0.3599 0.3484 0.3368 0.3251 0.3134 0.3015 0.2896 0.2777 0.2656 Columns 461 through 470 0.2535 0.2414 0.2291 0.2169 0.2045 0.1921 0.1796 0.1671 0.1545 0.1419 Columns 471 through 480 0.1292 0.1164 0.1037 0.0908 0.0780 0.0651 0.0521 0.0391 0.0261 0.0131 Columns 481 through 490 0.0000 -0.0131 -0.0262 -0.0394 -0.0526 -0.0657 -0.0789 -0.0922 -0.1054 -0.1186 Columns 491 through 500 -0.1319 -0.1451 -0.1584 -0.1716 -0.1849 -0.1981 -0.2113 -0.2245 -0.2377 -0.2509 Columns 501 through 510 -0.2641 -0.2772 -0.2903 -0.3034 -0.3165 -0.3295 -0.3425 -0.3554 -0.3683 -0.3812 Columns 511 through 520 -0.3940 -0.4067 -0.4195 -0.4321 -0.4447 -0.4572 -0.4697 -0.4821 -0.4944 -0.5066 Columns 521 through 530 -0.5188 -0.5309 -0.5429 -0.5548 -0.5666 -0.5783 -0.5899 -0.6015 -0.6129 -0.6242 Columns 531 through 540 -0.6354 -0.6466 -0.6575 -0.6684 -0.6792 -0.6898 -0.7003 -0.7107 -0.7209 -0.7310 Columns 541 through 550 -0.7410 -0.7508 -0.7604 -0.7700 -0.7793 -0.7886 -0.7976 -0.8065 -0.8153 -0.8238 Columns 551 through 560 -0.8322 -0.8405 -0.8485 -0.8564 -0.8641 -0.8716 -0.8789 -0.8861 -0.8930 -0.8998 Columns 561 through 570 -0.9063 -0.9127 -0.9188 -0.9248 -0.9305 -0.9360 -0.9413 -0.9464 -0.9513 -0.9560 Columns 571 through 580 -0.9604 -0.9646 -0.9686 -0.9724 -0.9759 -0.9792 -0.9823 -0.9851 -0.9877 -0.9900 Columns 581 through 590 -0.9921 -0.9940 -0.9956 -0.9970 -0.9981 -0.9989 -0.9995 -0.9999 -1.0000 -0.9998 Columns 591 through 600 -0.9994 -0.9987 -0.9978 -0.9966 -0.9951 -0.9934 -0.9914 -0.9892 -0.9866 -0.9838 Columns 601 through 610 -0.9808 -0.9775 -0.9739 -0.9700 -0.9659 -0.9615 -0.9568 -0.9519 -0.9466 -0.9412 Columns 611 through 620 -0.9354 -0.9294 -0.9231 -0.9166 -0.9098 -0.9027 -0.8953 -0.8877 -0.8798 -0.8717 Columns 621 through 630 -0.8633 -0.8546 -0.8457 -0.8365 -0.8271 -0.8174 -0.8074 -0.7972 -0.7868 -0.7761 Columns 631 through 640 -0.7652 -0.7540 -0.7426 -0.7309 -0.7190 -0.7069 -0.6945 -0.6819 -0.6691 -0.6560 Columns 641 through 650 -0.6428 -0.6293 -0.6156 -0.6017 -0.5876 -0.5733 -0.5588 -0.5441 -0.5292 -0.5141 Columns 651 through 660 -0.4988 -0.4834 -0.4677 -0.4519 -0.4360 -0.4198 -0.4035 -0.3871 -0.3705 -0.3538 Columns 661 through 670 -0.3369 -0.3199 -0.3027 -0.2855 -0.2681 -0.2506 -0.2330 -0.2153 -0.1974 -0.1795 Columns 671 through 680 -0.1615 -0.1435 -0.1253 -0.1071 -0.0888 -0.0705 -0.0521 -0.0337 -0.0152 0.0033 Columns 681 through 690 0.0218 0.0404 0.0589 0.0775 0.0961 0.1146 0.1332 0.1517 0.1702 0.1887 Columns 691 through 700 0.2071 0.2255 0.2438 0.2621 0.2803 0.2984 0.3165 0.3344 0.3523 0.3701 Columns 701 through 710 0.3877 0.4053 0.4227 0.4400 0.4571 0.4741 0.4910 0.5076 0.5242 0.5405 Columns 711 through 720 0.5567 0.5727 0.5885 0.6041 0.6195 0.6347 0.6496 0.6643 0.6788 0.6931 Columns 721 through 730 0.7071 0.7209 0.7344 0.7476 0.7605 0.7732 0.7856 0.7977 0.8095 0.8210 Columns 731 through 740 0.8322 0.8431 0.8537 0.8639 0.8738 0.8834 0.8926 0.9015 0.9100 0.9181 Columns 741 through 750 0.9260 0.9334 0.9405 0.9471 0.9535 0.9594 0.9649 0.9701 0.9748 0.9792 Columns 751 through 760 0.9831 0.9866 0.9898 0.9925 0.9948 0.9967 0.9981 0.9992 0.9998 1.0000 Columns 761 through 770 0.9998 0.9991 0.9980 0.9965 0.9945 0.9921 0.9893 0.9860 0.9823 0.9781 Columns 771 through 780 0.9736 0.9686 0.9631 0.9572 0.9509 0.9442 0.9370 0.9294 0.9213 0.9129 Columns 781 through 790 0.9040 0.8947 0.8850 0.8748 0.8643 0.8533 0.8420 0.8302 ...

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))

ans = Columns 1 through 10 0.0000 0.0000 0.0000 0.0001 0.0001 0.0001 0.0002 0.0003 0.0004 0.0005 Columns 11 through 20 0.0006 0.0007 0.0009 0.0010 0.0012 0.0013 0.0015 0.0017 0.0019 0.0021 Columns 21 through 30 0.0024 0.0026 0.0029 0.0031 0.0034 0.0037 0.0040 0.0043 0.0046 0.0050 Columns 31 through 40 0.0053 0.0057 0.0061 0.0065 0.0068 0.0073 0.0077 0.0081 0.0086 0.0090 Columns 41 through 50 0.0095 0.0100 0.0104 0.0110 0.0115 0.0120 0.0125 0.0131 0.0136 0.0142 Columns 51 through 60 0.0148 0.0154 0.0160 0.0166 0.0173 0.0179 0.0186 0.0192 0.0199 0.0206 Columns 61 through 70 0.0213 0.0220 0.0228 0.0235 0.0243 0.0250 0.0258 0.0266 0.0274 0.0282 Columns 71 through 80 0.0290 0.0299 0.0307 0.0316 0.0324 0.0333 0.0342 0.0351 0.0360 0.0370 Columns 81 through 90 0.0379 0.0389 0.0398 0.0408 0.0418 0.0428 0.0438 0.0448 0.0459 0.0469 Columns 91 through 100 0.0480 0.0490 0.0501 0.0512 0.0523 0.0534 0.0546 0.0557 0.0569 0.0580 Columns 101 through 110 0.0592 0.0604 0.0616 0.0628 0.0640 0.0653 0.0665 0.0678 0.0690 0.0703 Columns 111 through 120 0.0716 0.0729 0.0742 0.0756 0.0769 0.0783 0.0796 0.0810 0.0824 0.0838 Columns 121 through 130 0.0852 0.0866 0.0880 0.0895 0.0909 0.0924 0.0939 0.0954 0.0969 0.0984 Columns 131 through 140 0.0999 0.1015 0.1030 0.1046 0.1062 0.1077 0.1093 0.1109 0.1126 0.1142 Columns 141 through 150 0.1158 0.1175 0.1191 0.1208 0.1225 0.1242 0.1259 0.1276 0.1294 0.1311 Columns 151 through 160 0.1329 0.1346 0.1364 0.1382 0.1400 0.1418 0.1436 0.1455 0.1473 0.1492 Columns 161 through 170 0.1510 0.1529 0.1548 0.1567 0.1586 0.1606 0.1625 0.1644 0.1664 0.1684 Columns 171 through 180 0.1703 0.1723 0.1743 0.1763 0.1784 0.1804 0.1824 0.1845 0.1866 0.1886 Columns 181 through 190 0.1907 0.1928 0.1949 0.1971 0.1992 0.2013 0.2035 0.2056 0.2078 0.2100 Columns 191 through 200 0.2122 0.2144 0.2166 0.2188 0.2211 0.2233 0.2256 0.2278 0.2301 0.2324 Columns 201 through 210 0.2347 0.2370 0.2393 0.2417 0.2440 0.2463 0.2487 0.2511 0.2535 0.2558 Columns 211 through 220 0.2582 0.2606 0.2631 0.2655 0.2679 0.2704 0.2728 0.2753 0.2778 0.2803 Columns 221 through 230 0.2828 0.2853 0.2878 0.2903 0.2928 0.2954 0.2979 0.3005 0.3031 0.3056 Columns 231 through 240 0.3082 0.3108 0.3134 0.3160 0.3187 0.3213 0.3239 0.3266 0.3292 0.3319 Columns 241 through 250 0.3346 0.3373 0.3400 0.3427 0.3454 0.3481 0.3508 0.3535 0.3563 0.3590 Columns 251 through 260 0.3618 0.3646 0.3673 0.3701 0.3729 0.3757 0.3785 0.3813 0.3841 0.3869 Columns 261 through 270 0.3898 0.3926 0.3955 0.3983 0.4012 0.4040 0.4069 0.4098 0.4127 0.4156 Columns 271 through 280 0.4185 0.4214 0.4243 0.4272 0.4302 0.4331 0.4360 0.4390 0.4419 0.4449 Columns 281 through 290 0.4478 0.4508 0.4538 0.4568 0.4598 0.4627 0.4657 0.4687 0.4717 0.4748 Columns 291 through 300 0.4778 0.4808 0.4838 0.4868 0.4899 0.4929 0.4960 0.4990 0.5021 0.5051 Columns 301 through 310 0.5082 0.5112 0.5143 0.5174 0.5204 0.5235 0.5266 0.5297 0.5328 0.5359 Columns 311 through 320 0.5390 0.5420 0.5451 0.5482 0.5513 0.5545 0.5576 0.5607 0.5638 0.5669 Columns 321 through 330 0.5700 0.5731 0.5762 0.5794 0.5825 0.5856 0.5887 0.5918 0.5950 0.5981 Columns 331 through 340 0.6012 0.6043 0.6075 0.6106 0.6137 0.6168 0.6199 0.6231 0.6262 0.6293 Columns 341 through 350 0.6324 0.6356 0.6387 0.6418 0.6449 0.6480 0.6511 0.6542 0.6573 0.6605 Columns 351 through 360 0.6636 0.6667 0.6698 0.6728 0.6759 0.6790 0.6821 0.6852 0.6883 0.6913 Columns 361 through 370 0.6944 0.6975 0.7005 0.7036 0.7067 0.7097 0.7128 0.7158 0.7188 0.7219 Columns 371 through 380 0.7249 0.7279 0.7309 0.7339 0.7369 0.7399 0.7429 0.7459 0.7488 0.7518 Columns 381 through 390 0.7547 0.7577 0.7606 0.7636 0.7665 0.7694 0.7723 0.7752 0.7781 0.7810 Columns 391 through 400 0.7839 0.7867 0.7896 0.7924 0.7953 0.7981 0.8009 0.8037 0.8065 0.8093 Columns 401 through 410 0.8121 0.8148 0.8176 0.8203 0.8230 0.8257 0.8284 0.8311 0.8338 0.8365 Columns 411 through 420 0.8391 0.8417 0.8444 0.8470 0.8496 0.8521 0.8547 0.8573 0.8598 0.8623 Columns 421 through 430 0.8648 0.8673 0.8698 0.8723 0.8747 0.8771 0.8795 0.8819 0.8843 0.8867 Columns 431 through 440 0.8890 0.8913 0.8936 0.8959 0.8982 0.9004 0.9027 0.9049 0.9071 0.9092 Columns 441 through 450 0.9114 0.9135 0.9157 0.9177 0.9198 0.9219 0.9239 0.9259 0.9279 0.9299 Columns 451 through 460 0.9318 0.9337 0.9356 0.9375 0.9394 0.9412 0.9430 0.9448 0.9466 0.9483 Columns 461 through 470 0.9500 0.9517 0.9534 0.9550 0.9566 0.9582 0.9598 0.9613 0.9628 0.9643 Columns 471 through 480 0.9658 0.9672 0.9686 0.9700 0.9713 0.9726 0.9739 0.9752 0.9764 0.9776 Columns 481 through 490 0.9788 0.9800 0.9811 0.9822 0.9832 0.9843 0.9853 0.9862 0.9872 0.9881 Columns 491 through 500 0.9890 0.9898 0.9906 0.9914 0.9921 0.9929 0.9935 0.9942 0.9948 0.9954 Columns 501 through 510 0.9959 0.9965 0.9969 0.9974 0.9978 0.9982 0.9985 0.9988 0.9991 0.9993 Columns 511 through 520 0.9995 0.9997 0.9998 0.9999 1.0000 1.0000 1.0000 0.9999 0.9998 0.9997 Columns 521 through 530 0.9995 0.9993 0.9991 0.9988 0.9985 0.9981 0.9977 0.9973 0.9968 0.9962 Columns 531 through 540 0.9957 0.9951 0.9944 0.9938 0.9930 0.9923 0.9915 0.9906 0.9897 0.9888 Columns 541 through 550 0.9878 0.9868 0.9857 0.9846 0.9835 0.9823 0.9811 0.9798 0.9785 0.9771 Columns 551 through 560 0.9757 0.9743 0.9728 0.9712 0.9696 0.9680 0.9663 0.9646 0.9629 0.9611 Columns 561 through 570 0.9592 0.9573 0.9554 0.9534 0.9513 0.9492 0.9471 0.9449 0.9427 0.9405 Columns 571 through 580 0.9381 0.9358 0.9334 0.9309 0.9284 0.9259 0.9233 0.9206 0.9179 0.9152 Columns 581 through 590 0.9124 0.9096 0.9067 0.9037 0.9008 0.8977 0.8947 0.8915 0.8884 0.8851 Columns 591 through 600 0.8819 0.8786 0.8752 0.8718 0.8683 0.8648 0.8612 0.8576 0.8539 0.8502 Columns 601 through 610 0.8465 0.8427 0.8388 0.8349 0.8309 0.8269 0.8229 0.8188 0.8146 0.8104 Columns 611 through 620 0.8062 0.8019 0.7975 0.7931 0.7887 0.7842 0.7796 0.7751 0.7704 0.7657 Columns 621 through 630 0.7610 0.7562 0.7513 0.7465 0.7415 0.7365 0.7315 0.7264 0.7213 0.7161 Columns 631 through 640 0.7109 0.7056 0.7003 0.6949 0.6895 0.6841 0.6785 0.6730 0.6674 0.6617 Columns 641 through 650 0.6560 0.6503 0.6445 0.6387 0.6328 0.6268 0.6209 0.6149 0.6088 0.6027 Columns 651 through 660 0.5965 0.5903 0.5841 0.5778 0.5714 0.5651 0.5586 0.5522 0.5457 0.5391 Columns 661 through 670 0.5325 0.5259 0.5192 0.5125 0.5057 0.4989 0.4920 0.4852 0.4782 0.4713 Columns 671 through 680 0.4642 0.4572 0.4501 0.4430 0.4358 0.4286 0.4214 0.4141 0.4068 0.3994 Columns 681 through 690 0.3920 0.3846 0.3771 0.3696 0.3621 0.3545 0.3469 0.3393 0.3316 0.3239 Columns 691 through 700 0.3162 0.3084 0.3006 0.2928 0.2849 0.2770 0.2691 0.2611 0.2531 0.2451 Columns 701 through 710 0.2371 0.2290 0.2209 0.2128 0.2046 0.1965 0.1883 0.1800 0.1718 0.1635 Columns 711 through 720 0.1552 0.1469 0.1385 0.1302 0.1218 0.1134 0.1050 0.0965 0.0881 0.0796 Columns 721 through 730 0.0711 0.0626 0.0540 0.0455 0.0369 0.0283 0.0198 0.0111 0.0025 -0.0061 Columns 731 through 740 -0.0147 -0.0234 -0.0321 -0.0407 -0.0494 -0.0581 -0.0668 -0.0755 -0.0842 -0.0929 Columns 741 through 750 -0.1016 -0.1104 -0.1191 -0.1278 -0.1365 -0.1453 -0.1540 -0.1627 -0.1715 -0.1802 Columns 751 through 760 -0.1889 -0.1976 -0.2064 -0.2151 -0.2238 -0.2325 -0.2412 -0.2499 -0.2585 -0.2672 Columns 761 through 770 -0.2759 -0.2845 -0.2932 -0.3018 -0.3104 -0.3190 -0.3276 -0.3361 -0.3447 -0.3532 Columns 771 through 780 -0.3617 -0.3702 -0.3787 -0.3871 -0.3956 -0.4040 -0.4124 -0.4207 -0.4291 -0.4374 Columns 781 through 790 -0.4457 -0.4539 -0.4622 -0.4704 -0.4785 -0.4867 -0.4948 -0.5029 ...