%连续时间信号的基本运算
%相加
clc;
clear;
t=-2:0.01:6;
u=(t>=0);
y=sin(pi*t);
ft=y+u;
plot(t,ft);
xlabel('时间(t)');
ylabel('幅值f(t)');
title('连续信号的相加');
%相乘
clc;
clear;
t=-2:0.01:6;
u=(t>=0);
y=sin(pi*t);
ft=y.*u;
plot(t,ft);
xlabel('时间(t)');
ylabel('幅值f(t)');
title('连续信号的相乘');
%移位
clc;
clear;
t=0:0.001:4;
y=sin(pi*(t));
y1=sin(pi*(t-0.5));
plot(t,y,'b',t,y1,'r');
xlabel('时间(t)');
ylabel('幅值f(t)');
title('连续信号的移位');
%翻转
clc;
clear;
t=-4:0.01:4;
u=(t>=0);
y=sin(pi*t);
ft=y.*u;
ft=fliplr(ft);
plot(t,ft);
xlabel('时间(t)');
ylabel('幅值f(t)');
title('连续信号的翻转');
%尺度变换
clc;
clear;
t=-4:0.001:4;
ft=tripuls(t,4,0.5);
subplot(3,1,1);
plot(t,ft);
grid on;
title('f(t)');
ft=tripuls(2*t,4,0.5);
subplot(3,1,2);
plot(t,ft);
grid on;
title('f(2t)');
ft=tripuls(0.5*t,4,0.5);
subplot(3,1,3);
plot(t,ft);
grid on;
title('f(0.5t)');
%倒相
clc;
clear;
t=-4:0.001:4;
ft=tripuls(t,4,0.5);
subplot(2,1,1);
plot(t,ft);
grid on;
title('f(t)');
ft=tripuls(t,4,0.5);
ft1=-ft;
subplot(2,1,2);
plot(t,ft1);
grid on;
title('-f(t)');
%微分
clc;
clear;
h=0.001;
t=-4:0.001:4;
ft=tripuls(t,4,0.5);
ft1=diff(ft)/h;%diff求差分
subplot(2,1,1);
plot(t,ft);
title('f(t)');
grid on;
subplot(2,1,2);
plot(t(1:length(t)-1),ft1);
title('df(t)/dt');
grid on;
clc;
clear;
t=-1:0.2:1;
syms t;%创建符号对象
ft=2*t*t;
ft1=int(ft);
subplot(2,1,1);
ezplot(ft);
grid on;
subplot(2,1,2);
ezplot(ft1);
grid on;
%练习
clc;
clear;
t=-10:0.01:10;
y1t=t;
y2t=(t>=0);
ft=y1t.*y2t;
plot(t,ft);
grid on;
clc;
clear;
k=-5:10;
f1k=[zeros(1,3),1,zeros(1,12)];
f2k=[zeros(1,10),1,zeros(1,5)];
fk=f1k-f2k;
stem(k,fk);
clc;
clear;
t=-1:0.01:1;
w=2*pi;
f1t=sin(w*t);
f2t=sin(8*w*t);
ft=f1t+f2t;
subplot(2,1,1);
plot(t,ft);
grid on;
ft=f1t.*f2t;
subplot(2,1,2);
plot(t,ft);
grid on;
连续时间信号的基本运算
最新推荐文章于 2021-05-21 04:24:04 发布