Increase sampling rate by integer factor
y=upsample(x,n)
y=upsample(x,n,phase)
y = upsample(x,n)increases the sampling rate ofxby insertingn-1 zeros between samples.xcan be a vector or a matrix. Ifxis a matrix, each column is considered a separate sequence. The upsampledyhasx*nsamples.
y = upsample(x,n,phase)specifies the number of samples by which to offset the upsampled sequence.phasemust be an integer from 0 ton-1.
Increase the sampling rate of a sequence by 3:
x = [1 2 3 4]; y = upsample(x,3); x,y x = 1 2 3 4 y = 1 0 0 2 0 0 3 0 0 4 0 0
Increase the sampling rate of the sequence by 3 and add a phase offset of 2:
x = [1 2 3 4]; y = upsample(x,3,2); x,y x = 1 2 3 4 y = 0 0 1 0 0 2 0 0 3 0 0 4
Increase the sampling rate of a matrix by 3:
x = [1 2; 3 4; 5 6;]; y = upsample(x,3); x,y x = 1 2 3 4 5 6 y = 1 2 0 0 0 0 3 4 0 0 0 0 5 6 0 0 0 0
Raised cosine FIR filter design
b = firrcos(n,Fc,df)
b = firrcos(n,Fc,df,Fs)
b = firrcos(n,Fc,df,Fs,'bandwidth')
b = firrcos(n,Fc,df,Fs,'type')
b = firrcos(...,'type',delay)
b = firrcos(...,'type',delay,window)
b = firrcos(n,Fc,r,Fs,'rolloff')
b = firrcos(...,'rolloff','type')
[b,a] = firrcos(...)
b = firrcos(n,Fc,df)uses a default sampling frequency ofFs = 2.
b = firrcos(n,Fc,df,Fs)or, equivalently,
b = firrcos(n,Fc,df,Fs,'bandwidth')returns an ordernlowpass linear-phase FIR filter with a raised cosine transition band. The ordernmust be even. The filter has cutoff frequencyFc, transition bandwidthdf, and sampling frequencyFs, all in hertz.dfmust be small enough so thatFc±df/2is between0andFs/2. The coefficients inbare normalized so that the nominal passband gain is always equal to 1.
b = firrcos(n,Fc,df,Fs,'type')designs either a normal raised cosine filter or a square root raised cosine filter according to how you specify the string 'type'. Specify 'type' as:
'normal', for a regular raised cosine filter. This is the default, and is also in effect when the 'type' argument is left empty,[], or unspecified.
'sqrt', for a square root raised cosine filter.
b = firrcos(...,'type',delay)specifies an integer delay in the range[0,n+1]. The default isn/2for alln.
b = firrcos(...,'type',delay,window)applies a lengthn+1 window to the designed filter to reduce the ripple in the frequency response.windowmust be a lengthn+1 column vector. If no window is specified, a rectangular (rectwin) window is used. Care must be exercised when using a window with a delay other than the default.
b = firrcos(n,Fc,r,Fs,'rolloff')interprets the third argument,r, as the rolloff factor instead of the transition bandwidth,df.rmust be in the range[0,1].
b = firrcos(...,'rolloff','type')specifies the type of raised cosine filter.
[b,a] = firrcos(...)always returnsa = 1.
Design an order 20 raised cosine FIR filter with cutoff frequency 0.25 of the Nyquist frequency and a transition bandwidth of 0.25:
h = firrcos(20,0.25,0.25);
freqz(h,1)
from here http://www.ilovematlab.cn/thread-64808-1-1.html
1. 桌面Matlab的快捷方式-> 属性-> 更改起始位置为所希望的默认目录
2. 编辑x:\Program Files\MATLAB\R2010b\toolbox\local\matlabrc.m文件,在最后加上:
cd ‘default path’%default path换成你默认目录即可