一.实验目的
1.熟悉MATLAB软件的使用
2.用matlab表示表示常用信号和进行信号基本运算
二.实验内容
1.指数信号
A=1;a=-0.4;
t=0:0.01:10;
ft=Aexp(at)
plot(t,ft);
grid on;
2.正弦信号
A=1;w=2pi;phi=pi/6;
t=0:0.01:8;
ft=Asin(w*t+phi);
plot(t,ft);
grid on;
3.抽样信号
t=-3pi:pi/100:3pi;
ft=sinc(t/pi);
plot(t,ft)
grid on
title(‘抽样信号’)
4.三角信号
t=-3:0.01:3;
ft=tripuls(t,4,0.5);
plot(t,ft);
grid on;
axis([-3,3,-0.5,1.5]);
5.虚指数信号
t=0:0.01:15;
w=pi/4;
X=exp(jwt);
Xr=real(X);
Xi=imag(X);
Xa=angle(X);
Xn=angle(X);
subplot(2,2,1)
plot(t,Xr)
axis([0,15,-(max(Xa)+0.5),max(Xa)+0.5]),
title(‘实部’)
6.复指数信号
t=0:0.01:3;
a=-1;b=10;
f=exp((a+j*b)*t);
subplot(2,2,1),
plot(t,real(f)),title(‘实部’)
subplot(2,2,3),
plot(t,imag(f)),title(‘虚部’)
subplot(2,2,2),
plot(t,abs(f)),title(‘模’)
subplot(2,2,4),
plot(t,angle(f)),title(‘相角’)
7.矩形脉冲信号
t=-2:0.01:2;
width=1;
ft=2*rectpuls(t,width);
plot(t,ft)
grid on;
8.单位阶跃信号
t=-1:0.01:5;
ft=(t>=0);
plot(t,ft);
grid on;
axis([-1,5,-0.5,1.5]);
9.正弦信号
syms t
y=sin(pi/4*t)
ezplot(y,[-16,16])
或者
f=sym(sin(pi/4*t))
ezplot(f,[-16,16])
10.单位阶跃信号
t=-1:0.01:3;
f=heaviside(t);
plot(t,f)
axis([-1,3,-0.2,1.2])
11.以f(t)三角信号为例,求f(2t).f(2-2t)
t=-3:0.001:3;
ft=tripuls(t,4,0.5);
subplot(3,1,1);
plot(t,ft)
grid on
title(‘f(t)’)
ft1=tripuls(2t,4,0.5);
subplot(3,1,2);
plot(t,ft1);
grid on;
title(‘f(2t)’)
ft2=tripuls(2-2t,4,0.5);
subplot(3,1,3);
plot(t,ft2);
grid on;
title(‘f(2-2t’);
12.f1(t)=sinwt,f2(t)=sin8wt,w=2pi,求f1(t)+f2(t)和f1(t)f2(t)波形图
w=2pi;
t=0:0.01:3;
f1=sin(wt);
f2=sin(8wt);
subplot(211)
plot(t,f1+1,’:’,t,f1-1,’:’,t,f1+f2)
grid on,title(‘f1(t)+f2(t)’)
subplot(212)
plot(t,f1,’:’,t,-f1,’:’,t,f1.*f2)
grid on,
title(‘f1(t)*f2(t)’)
13.求一阶导数 Y1=sin(ax2) , y2=xsinxlnx
syms a x y1 y2
y1=sin(ax^2)
y2=xsin(x)*log(x);
dy1=diff(y1,‘x’)
dy2=diff(y2)
14.求积分
syms a x y3 y4
y3=x5-a*x2+sqrt(x)/2;
y4=(x*exp(x))/(1+x)^2;
iy3=int(y3,‘x’)
iy4=int(y4,0,1)
15.离散时间序列波形
k=-3:3;
f=[1,2,-1,3,2,4,-1];
stem(k,f,‘filled’);
axis([-4,4,-1.5,4.5])