Unified · Split
| @@ -0,0 +1,50 @@ | ||
| 1 | +function [t, mt, w] = timeline (len, stretch) | |
| 2 | + | |
| 3 | + | |
| 4 | +if (stretch < 0 || stretch > 1) | |
| 5 | + error ("stretch out of range [0, 1].\n"); | |
| 6 | + endif | |
| 7 | + | |
| 8 | +# Mofified time | |
| 9 | + | |
| 10 | +x_w = 0.2 ; | |
| 11 | +x = [-0.5 -0.2 0.2 0.5]; | |
| 12 | +y = [-0.5 -0.4 -0.1 0.5]; | |
| 13 | + | |
| 14 | +p = polyfit (x, y, 4); | |
| 15 | + | |
| 16 | +t = linspace (-0.5, 0.5, 100); | |
| 17 | +y = polyval (p,t); | |
| 18 | +plot (t, y) | |
| 19 | +return | |
| 20 | + | |
| 21 | +mt = ((1 - stretch) * t + stretch * t.^2) - 0.5 ; | |
| 22 | + | |
| 23 | + | |
| 24 | +# Basically a Nuttall indow | |
| 25 | +ak = [0.42323 0.49755 0.07922] ; | |
| 26 | + | |
| 27 | +w = zeros (1, len) ; | |
| 28 | + | |
| 29 | +k = 0 ; | |
| 30 | +for a = ak, | |
| 31 | + w = w + a * cos (2 * pi * k * mt) ; | |
| 32 | + k += 1 ; | |
| 33 | + endfor | |
| 34 | + | |
| 35 | +w = fliplr (w / len) ; | |
| 36 | + | |
| 37 | +# Linear t | |
| 38 | + | |
| 39 | +t = linspace (-(len-2)/2, (len-2)/2, len) / len ; | |
| 40 | + | |
| 41 | + | |
| 42 | +end | |
| 43 | + | |
| 44 | +# Do not edit or modify anything in this comment block. | |
| 45 | +# The following line is a file identity tag for the GNU Arch | |
| 46 | +# revision control system. | |
| 47 | +# | |
| 48 | +# arch-tag: 830f701e-5e9c-478a-a929-609513d4b1a6 | |
| 49 | + | |
| 50 | + | |
| @@ -10,7 +10,7 @@ function f = make_src_filter (cycles, increment, atten, filename) · 9 unmodified lines | ||
| 10 | 10 | #======================================================================= |
| 11 | 11 | |
| 12 | 12 | if nargin < 3, |
| 13 | − error ("Try make_filter (12, 32, 88)") ; | |
| 13 | + error ('Try make_filter (12, 32, 88, "output.txt")') ; | |
| 14 | 14 | endif |
| 15 | 15 | |
| 16 | 16 | if nargin < 4, |