文档介绍:课 程 实 验 报 告
1
课程名称: 信号与线性系统
专业班级: 计算机科学与技术 11 级 10 班 学 号: U201114445
姓 名: 王涛 指导教师: 孙伟平 报告日期: 2013/7/1
计算机科学与技术学院
2
实验一
连续时间系统的时域分析
% T=; tx=0:T:2;
x=rectpuls((tx-1),2).*exp(-tx); th=0:T:2;
h=rectpuls((th-1),2).*2;
t=(0+0):T:(2+2);
y=conv(x,h); figure
subplot(3,1,1); plot(tx,x) ylabel('输入激励');
subplot(3,1,2); plot(th,h)
ylabel('单位冲激响应');
subplot(3,1,3); plot(t,y)
ylabel('输出响应');
%
T=; tx=-4:T:4;
x=rectpuls((tx-0),8).*(1-abs(tx)/4); th=0:T:4; h=(th>=0);
t=(-4):T:8;
y=conv(x,h); figure subplot(3,1,1); plot(tx,x)
ylabel('输入激励');
subplot(3,1,2); plot(th,h)
ylabel('单位冲激响应'); subplot(3,1,3);
plot(t,y)
ylabel('输出响应');
%
R=10; C=4; U0=2;
% 电阻值
% 电容值
% 电容电压初始值
3
S=[num2str(C),'*',num2str(R),'*Dy+','y=heaviside(t)']; % 得到微分 方程的字符串表达式
init=['y(0)=',num2str(U0)]; % 得到初始条件的字符串表达式
y=dsolve(S,init,'t');
%求解微分方程,得到符号解 t=2::2*pi;
x=ones(1,length(t)); figure subplot(1,2,1);
plot(t,x)
title('激励电压');
% 2 号子图显示输出响应 ys
subplot(1,2,2);
ezplot(y,[0,2*pi]) title('输出响应')
% 得到微分
% R=; % 电阻值 L=1; % 电容值
I0=2; % 电感电流初始值
S=[num2str(L),'*Dy+', num2str(R),'*y=heaviside(t)'];
方程的字符串表达式
init=['y(0)=',num2str(I0)]; % 得到初始条件的字符串表达式 y=dsolve(S,init,'t'); %求解微分方程,得到符号解 t=0::2*pi;
x=ones(1,length(t));
%得到时间范围 t 内的阶跃信号 u(t) 的离散抽样序列 x figure
subplot(1,2,1);
% 多子图显示,将图形框分为 1x2 个子图,1 号子图显示阶跃信号 x plot(t,x)
title('激励电压');
% 2 号子图显示输出响应 ys
subplot(1,2,2);
ezplot(y,[0,2*pi]) title('输出响应') 实验分析:
本次实验应用连续系统时域分析的两种方法,卷积计算和微分方程的求解。
实验二 信号的傅里叶分析实验
%
N=10; %希望看到的谐波次数
syms t T k; % 定义时间 t、周期 Ta、下标 k 三个符号
y=subs(sym('Heaviside(t+T/20)-Heaviside(t-T/20)'),'T',TT); % 锯齿脉冲基础波形,tao/T=1/20
%修改上面的 sym 中的参数,将 T/20 改为 T/40 皆可
%得到占空比为 1/20 的。
4
A0=int(y,t,-TT/2,TT/2)/TT; % 直流分量 A0
%利用符号法得到各频率分量的复数 Fourier 系数 Ak 的符号表达式
Ak=int(y*exp(-2*i*pi*k*t/TT),t,-TT/2,TT/2)/TT; fk=sym(Ak)*sym(exp(2*i*k*pi*t/TT));
% 计算 k 在区间 [-N,N] 内的 Fourier 系数,存入向量 a(长度为 2*N+1) for m=-N:-1
% a(m+N+1)=numeric(subs(Ak,k,m)); a(m+N+1)=dou