连续时间信号

写在前面

了解一些连续时间信号他们的处理以及MATLAB实现
**一.**用MATLAB实现信号f1(t)=sin(πt)和f2(t)=sin(10πt)的相加和相乘,试分别绘制这两个信号及它们的和信号和积信号的波形。
解:采用数值计算方法,代码如下

t = 0:0.01:2; 
x1 = sin(1*pi*t); 
x2 = sin(6*pi*t)
x3=x1+x2;
x4=x1.*x2;
% plotting the function
subplot(2,2,1)
plot(t, x1)
xlabel('t (sec)'); ylabel('x(t)')
subplot(2,2,2)
plot(t, x2)
xlabel('t (sec)'); ylabel('x(t)')
subplot(2,2,3) 
plot(t, x3,t,x1+1,'r--',t,x1-1,'r--') 
xlabel('t (sec)'); ylabel('y(t)') 
subplot(2,2,4)
plot(t, x4,t,x1,'r--',t,-x1,'r--') 
xlabel('t (sec)'); ylabel('y(t)')

在这里插入图片描述
**二.**用MATLAB绘制例如图信号的奇、偶分量的波形,并绘制奇、偶分量的和信号的波形,比较是否和原信号一样。
在这里插入图片描述
解:采用符号计算方法,代码如下:

%符号计算
syms t s
u=heaviside(t); 
u1=heaviside(-t);
f1=2*cos(3*t)*u;    %f(t)
f2=2*cos(-3*t)*u1;  %f(-t)
fe=0.5*(f1+f2);   %偶分量
fo=0.5*(f1-f2);   %奇分量
f=fe+fo;           %合成的原信号 
subplot(221)
ezplot(f1, [-4, 4]); %原信号
grid
subplot(222)
ezplot(fe, [-4, 4]);%偶分量
grid
subplot(223)
ezplot(fo, [-4, 4]);%奇分量
grid
subplot(224)
ezplot(f, [-4, 4]); %合成的原信号 
grid

在这里插入图片描述
**三.**已知信号f(t)=e2t,试用MATLAB绘制其翻转信号f(–t)以及奇分量和偶分量的波形。
解:采用数值计算方法,代码如下

%符号计算
syms t s

f1=exp(2*t);    %f(t)
f2=exp(-2*t);  %f(-t)
fe=0.5*(f1+f2);   %偶分量
fo=0.5*(f1-f2);   %奇分量
f=fe+fo;           %合成的原信号 
subplot(221)
ezplot(f1, [-4, 4]); %原信号
grid
subplot(222)
ezplot(fe, [-4, 4]);%偶分量
grid
subplot(223)
ezplot(fo, [-4, 4]);%奇分量
grid
subplot(224)
ezplot(f2, [-4, 4]); %翻转原信号 
grid

在这里插入图片描述
**四.**R(t)为斜变信号,ε(t)为阶跃信号,用MATLAB产生信号
f(t)=3R(t+3)–6R(t+1)+3R(t)–ε(t–2)–2ε(t–4)
(1)绘制信号的波形;(2)绘制信号的奇、偶分量的波形。
解:先用function函数产生斜变信号ramp和单位阶跃信号ustep,然后调用这两个子函数产生所需要的信号。

function y = ramp(t,m,ad)
% t: time support 时间变量
% m: slope of ramp  斜率
% ad : advance (positive), delay (negative) factor 时移因子
N=length(t);
y=zeros(1,N);
for i=1:N,
          if t(i)>=-ad,
              y(i)=m*(t(i)+ad);
          end
end
function y=ustep(t,ad)
% t: time
% ad : advance (positive), delay (negative)
N=length(t);
y=zeros(1,N);
for i=1:N,
      if t(i)>=-ad,
           y(i)=1;
      end
end

Ts=0.01; t=-5:Ts:5; 
y1=ramp(t,3,3);
y2=ramp(t,-6,1);
y3=ramp(t,3,0);
y4=-1*ustep(t,-2);
y5=-2*ustep(t,-4);
y=y1+y2+y3+y4+y5;
plot(t,y,'k'); 
axis([-5 5 -1 7]); 
grid
figure
%奇偶分解
[ye, yo]=evenodd(t,y);
subplot(211)
plot(t,ye,'r')
grid
axis([min(t) max(t) -1 5])
subplot(212)
plot(t,yo,'r')
grid
axis([min(t) max(t) -3 3])

在这里插入图片描述
在这里插入图片描述
是否对一些matlab函数处理连续时间信号有了一定掌握呢?欢迎评论区留言

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值