matlab 重採樣---Resampling
06-18
Resampling The toolbox provides a number of functions that resample a signal at a higher or lower rate.Operation FunctionApply FIR filter with resampling upfirdnCubic spline interpolation splineDecimation decimateInterpolation interpOther 1-D interpolation interp1Resample at new rate resample The resample function changes the sampling rate for a sequence to any rate that is a ratio of two integers. The basic syntax for resample is y = resample(x,p,q)where the function resamples the sequence x at p/q times the original sampling rate. The length of the result y is p/q times the length of x. One resampling application is the conversion of digitized audio signals from one sampling rate to another, such as from 48 kHz (the digital audio tape standard) to 44.1 kHz (the compact disc standard). The example file contains a length 4001 vector of speech sampled at 7418 Hz: clear load mtlb whosName Size Bytes Class Fs 1x1 8 double array mtlb 4001x1 32008 double arrayGrand total is 4002 elements using 32016 bytesFsFs = 7418 To play this speech signal on a workstation that can only play sound at 8192 Hz, use the rat function to find integers p and q that yield the correct resampling factor:[p,q] = rat(8192/Fs,0.0001) p = 127q = 115 Since p/q*Fs = 8192.05 Hz, the tolerance of 0.0001 is acceptable; to resample the signal at very close to 8192 Hz: y = resample(mtlb,p,q); resample applies a lowpass filter to the input sequence to prevent aliasing during resampling. It designs this filter using the firls function with a Kaiser window. The syntax resample(x,p,q,l,beta)controls the filter"s length and the beta parameter of the Kaiser window. Alternatively, use the function intfilt to design an interpolation filter b and use it with resample(x,p,q,b) The decimate and interp functions do the same thing as resample with p = 1 and q = 1, respectively. These functions provide different anti-alias filtering options, and they incur a slight signal delay due to filtering. The interp function is significantly less efficient than the resample function with q = 1. The toolbox also contains a function, upfirdn, that applies an FIR filter to an input sequence and outputs the filtered sequence at a sample rate different than its original. See Multirate Filter Bank Implementation. The standard MATLAB environment contains a function, spline, that works with irregularly spaced data. The MATLAB function interp1 performs interpolation, or table lookup, using various methods including linear and cubic interpolation.
推薦閱讀:
推薦閱讀:
※4eva is a Mighty Long Time
※圖解SMOTE方法
※Improved Deep Metric Learning with Multi-class N-pair Loss Objective(NIPS,2016)
TAG:採樣 |