【matlab】pulstran函数

1、作用:生成连续或离散的脉冲串;


2、定义:

Y=pulstran (t,d,'func')

其中t为时间轴,一般是一个一维数组

d为采样间隔,可以是两列,第一列对应偏移量,第二列对应增益量

连续函数func指定了脉冲串的形状,包括:

高斯调制正弦信号:gauspuls;非周期的矩形信号:rectpuls;非周期的三角信号:tripuls

 

3、讨论:

1)pulstran函数实质是返回一组信号的和,即:

Y=func(t-d(1))+ func(t-d(1))+…

 

2)如果func函数需要参数,则定义格式为:

Y=pulstran (t,d,'func',p1,p2,…)

 

例:产生一串高斯脉冲

t=0:0.001:8;

d=[0:1:8;0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8]';

y=pulstran(t-0.25,d,'gauspuls',10,0.5);

plot(t,y);

grid;


  • 8
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
Matlab可以使用傅里叶级数进行三角函数频谱图的绘制。根据提供的引用,可以通过给定幅度An和相位ψn的值,使用stem函数plot函数来绘制幅度谱和相位谱。同时,可以使用pulstran函数和trifourierseries函数对三角函数进行级数展开,并通过plot函数将展开后的结果与原函数进行对比。以下是一个示例代码: ```Matlab % 给定参数 n = 0:1:10; anVal = eval(an); bnVal = eval(bn); An = sqrt(anVal.^2 + bnVal.^2); An(1) = a0; phi = atan(-bnVal./anVal); phi(1) = 0; % 画幅度谱 subplot(2,3,3); stem(n, An, 'b'); grid on; axis([-0.1,10.1,-0.1,1.1]); title('幅度谱'); xlabel('n'); ylabel('An'); % 画相位谱 subplot(2,3,6); plot(n, phi, 'b'); grid on; axis([-0.1,10.1,-0.1,1.1]); title('相位谱'); xlabel('n'); ylabel('ψn'); % 画级数展开图 t = -6:0.01:6; d = -6:2:6; f = pulstran(t, d, 'tripuls'); f3 = trifourierseries(a0, an, bn, 3, t); f9 = trifourierseries(a0, an, bn, 9, t); f21 = trifourierseries(a0, an, bn, 21, t); f45 = trifourierseries(a0, an, bn, 45, t); subplot(2,3,1); plot(t, f, 'r', t, f3, 'b'); grid on; axis([-6.1,6.1,-0.1,1.1]); title('展开3项'); xlabel('t'); ylabel('f(t)'); subplot(2,3,4); plot(t, f, 'r', t, f9, 'b'); grid on; axis([-6.1,6.1,-0.1,1.1]); title('展开9项'); xlabel('t'); ylabel('f(t)'); subplot(2,3,2); plot(t, f, 'r', t, f21, 'b'); grid on; axis([-6.1,6.1,-0.1,1.1]); title('展开21项'); xlabel('t'); ylabel('f(t)'); subplot(2,3,5); plot(t, f, 'r', t, f45, 'b'); grid on; axis([-6,6,-0.1,1.1]); title('展开45项'); xlabel('t'); ylabel('f(t)'); ```
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值