matlab实验教程
1 目 录 实验一、MATLAB 基本应用 实验二、实验二 信号的时域表示 实验三、连续信号卷积 实验四、典型周期信号的频谱表示 实验五、傅立叶变换性质研究 实验六、系统的零极点分析 实验七 离散信号分析2 实验一 MATLAB 基本应用 一、实验目的:学习 MATLAB 的基本用法,了解 MATLAB 的目录结构和基 本功能以及 MATLAB 在信号与系统中的应用。 二、实验内容: 例一 已知 x 的取值范围,画出 y=sin(x) 的 图型。 参考程序:x=0:0.05:4*pi; y=sin(x); plot(y) 例二 计算 y=sin(/5)+4cos(/4) 例三 已知 z 取值范围 ,x=sin(z);y=cos(z);画三维图形。 z=0:pi/50:10*pi; x=sin(z); y=cos(z); plot3(x,y,z)3 xlabel( x ) ylabel( y ) zlabel( z ) 例四 已知 x 的取值范围,用 subplot 函数绘图。 参考程序:x=0:0.05:7; y1=sin(x); y2=1.5*cos(x); y3=sin(2*x); y4=5*cos(2*x); subplot(2,2,1),plot(x,y1),title( sin(x) ) subplot(2,2,2),plot(x,y2),title( 1.5*cos(x) ) subplot(2,2,3),plot(x,y3),title( sin(2*x) ) subplot(2,2,4),plot(x,y4),title( 5*cos(2*x) )4 单位阶跃信号 u(t+3)-2u(t) 其中 u(t)=1/2+(1/2)sign(t) Sigh(t)是符号函数t>0 时为1,t<0时为-1 ; clear all %利用maple中的heaviside函数来实现u(t+3)-2u(t) syms t f=maple( Heaviside(t+3)-2*Heaviside(t) ); t1=-3*pi:0.01:3*pi;%注意精度问题 ff=subs(f,t,t1); figure(1); plot(t1,ff); axis([-5,5,-1.2,1.2]); title( u(t+3)-2u(t) ); %利用自己编写的heaviside函数来实现u(t+3)-2u(t) t=-5:0.01:5; f=Heaviside(t+3)-2*Heaviside(t); figure(2); plot(t,f); axis([-5,5,-1.2,1.2]); title( u(t+3)-2u(t) ) %利用符号函数来实现u(t) t=-5:0.05:5; f=sign(t); ff=1/2+1/2*f; figure(3); plot(t,ff); axis([-5 5 -0.1 1.1]); title( u(t) ) %利用符号函数来实现u(t+3)-2u(t) t=-5:0.01:5; f=(1/2+1/2*sign(t+3))-2*(1/2+1/2*sign(t)); figure(4) plot(t,f),axis([-5,5,-1.2,1.2]),title( u(t+3)-2u(t) )5 MATLAB 提供了一个 ezplot 函数绘制隐函数图形,下面介绍其用法。 (1) 对 于函数 f = f(x),ezplot 函数的调用格式为: ezplot(f):在默认区间-2π