离散时间信号的基本运算

%序列相加
clc;
clear;
x1=[1,2,3,4,5];
k1=-1:3;
x2=[5,6,7];
k2=2:4;
k=min([k1,k2]):max([k1,k2]);
f1=zeros(1,length(k));
f2=zeros(1,length(k));
f1(find((k>=min(k1))&(k<=max(k1))==1))=x1;
f2(find((k>=min(k2))&(k<=max(k2))==1))=x2;
f=f1+f2;
subplot(3,1,1);
stem(k1,x1,'filled');
axis([-1,4,0,15]);
title('f1');
grid on;
subplot(3,1,2);
stem(k2,x2,'filled');
title('f2');
grid on;
axis([-1,4,0,15]);
subplot(3,1,3);
stem(k,f,'filled');
title('f');
grid on;



%序列相乘
clc;
clear;
x1=[1,2,3,4,5];
k1=-1:3;
x2=[5,6,7];
k2=2:4;
k=min([k1,k2]):max([k1,k2]);
f1=zeros(1,length(k));
f2=zeros(1,length(k));
f1(find((k>=min(k1))&(k<=max(k1))==1))=x1;
f2(find((k>=min(k2))&(k<=max(k2))==1))=x2;
f=f1.*f2;
subplot(3,1,1);
stem(k1,x1,'filled');
axis([-1,4,0,15]);
title('f1');
grid on;
subplot(3,1,2);
stem(k2,x2,'filled');
title('f2');
grid on;
axis([-1,4,0,15]);
subplot(3,1,3);
stem(k,f,'filled');
title('f=f1*f2');
grid on;

%序列的翻转
clc;
clear;
f1=[1,2,3,4,5];
k1=-1:3;
k=-fliplr(k1);
f=fliplr(f1);
subplot(2,1,1);
stem(k1,f1,'filled');
axis([-3,3,0,5]);
title('f1');
grid on;
subplot(2,1,2);
stem(k,f,'filled');
title('f1的翻转序列');
axis([-3,3,0,5]);
grid on;

%序列的倒相
f1=[1,2,3,4,5];
k1=-1:3;
k=k1;
f=-f1;
subplot(2,1,1);
stem(k1,f1,"filled");
axis([-1,3,-5,5]);
title('f1');
grid on;
subplot(2,1,2);
stem(k,f,"filled");
title("f1的倒相序列");
axis([-1,3,-5,5]);
grid on;



%序列的平移
clc;
clear;
f1=[1,2,3,4,5];
k1=-1:3;
k0=2;
k=k1+k0;
f=f1;
subplot(2,1,1);
stem(k1,f1,"filled");
axis([-1,5,0,5]);
title('f1');
grid on;
subplot(2,1,2);
stem(k,f,"filled");
title('f1的移位序列');
axis([-1,5,0,5]);
grid on;


%练习
clc;
clear;
f1=[0,1,2,3,4,3];
k1=1:6;
subplot(4,1,1);
stem(k1,f1,"filled");
f2=[2,2,0,0,0,-2,-2];
k2=2:8;
subplot(4,1,2);
stem(k2,f2,"filled");
k=1:8;
f1=[0,1,2,3,4,3,0,0];
f2=[0,2,2,0,0,0,-2,-2];
f3=f1+f2;
subplot(4,1,3);
stem(k,f3,"filled");
f4=f1.*f2;
subplot(4,1,4);
stem(k,f4,"filled");

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值