单位冲激信号 matlab,信号与系统的MATLAB仿真(4.1-4.9)

函数名

功能(产生***信号)

函数名

功能(产生***信号)

sawtooth

锯齿波(三角波)

pulstran

冲激串

square

方波

rectpuls

非周期的方波

sinc

抽样(sinc)函数

tripuls

非周期的三角波

chirp

调频余弦

diric

Dirichlet(sinc)函数

gauspuls

高斯正弦脉冲

gmonopuls

高斯单脉冲

vco

电压控制振荡器

(1)周期性三角波或者锯齿波函数sawtooth

调用格式:x = sawtooth(t,width)

(width:最大幅度出现的位置)

【例题4-5】 产生周期为0.2的三角波,width取值分别为0、1、0.5.

a4c26d1e5885305701be709a3d33442f.png

% zht_ex4_5_p73.m

% 【例题4-5】 产生周期为0.2的三角波,width取值分别为0、1、0.5.

td = 1/100000;  % td - 时间间隔

t = 0:td:1

x1 = sawtooth(2*pi*5*t,0);

x2 = sawtooth(2*pi*5*t,1);

x3 = sawtooth(2*pi*5*t,0.5);

subplot(311); td1=plot(t,x1);set(td1,'linewidth',2);

title('周期性三角波');

subplot(312); td2=plot(t,x2);set(td2,'linewidth',2);

subplot(313); td3=plot(t,x3);set(td3,'linewidth',2);

%_________________________________________________________________

【例4-6】 仔细观察由下面代码产生的3个三角波信号之间的区别。

a4c26d1e5885305701be709a3d33442f.png

% 【例4-6】 仔细观察由下面代码产生的3个三角波信号之间的区别。

%  (filename:zht_ex4_6_p74.m

t = -3:0.001:3;

x1=tripuls(t,4,0);

subplot(131); td1=plot(t,x1);set(td1,'linewidth',2);

axis([-4 4 0 1]);

grid

t=-6:0.001:6;

x2=tripuls(t,4,0.5);

subplot(132); td2=plot(t,x2);set(td2,'linewidth',2);

axis([-4 4 0 1]);title('非周期三角波');

grid;

x3=tripuls(t+2,4,0.5);

subplot(133); td3=plot(t,x3);set(td3,'linewidth',2);

axis([-4 4 0 1]);

grid

%______________________________________________________________

a4c26d1e5885305701be709a3d33442f.png

% [【例题4-7】 产生频率为40Hz,占空比分别为25%,50%,75%的周期性方波。

% filename: zht_ex_4_7_p75.m

% 调用格式:x=square(t,duty)

% 产生周期为2π、幅度为±1的周期性方波。duty表示占空比。

clear;

td=1/100000;  % td -

时间间隔

t = 0:td:1;

x1 = square(2*pi*40*t, 25);

x2 = square(2*pi*40*t, 50);

x3 = square(2*pi*40*t, 75);

subplot(311);td1=plot(t,x1);set(td1,'linewidth',2);

title('占空比 25%'); axis([0 0.1 -1.5 1.5]);grid;

subplot(312);td2=plot(t,x2);set(td2,'linewidth',2);

title('占空比 50%'); axis([0 0.1 -1.5 1.5]);grid;

subplot(313);td3=plot(t,x3);set(td3,'linewidth',2);

title('占空比 75%'); axis([0 0.1 -1.5 1.5]);grid

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值