通信系统仿真中用到的那些函数

1、upsample

Increase sampling rate by integer factor

Syntax

y=upsample(x,n)
y=upsample(x,n,phase)

Description

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.

Examples

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

2、firrcos

Raised cosine FIR filter design

Syntax

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

Description

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.

Examples

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)


3、如何修改Matlab默认目录

from here http://www.ilovematlab.cn/thread-64808-1-1.html

Solution

1. 桌面Matlab的快捷方式-> 属性-> 更改起始位置为所希望的默认目录
2. 编辑x:\Program Files\MATLAB\R2010b\toolbox\local\matlabrc.m文件,在最后加上:
cd ‘default path’%default path换成你默认目录即可



 

转载于:https://my.oschina.net/bubifengyun/blog/127060

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值