连续时间LTI系统的时域分析
实验一:如下图
首先对改电路进行频域分析可求得H(jw)=25/(2(jw)^2+10(jw)+25)
即开始编码:
a=[2 10 25];%分母系数
b=[25];%分子系数
w=-5:0.25:5;%定义域
hw=freqs(b,a,w);%函数引用
f1=abs(hw);%取模
f2=angle(hw);%求相角
subplot(2,1,1),plot(w,f1),xlabel('w'),ylabel('幅频响应'),grid on
subplot(2,1,2),plot(w,f2),xlabel('w'),ylabel('相频响应'),grid on
实验二:如下图
求解此题先介绍傅里叶函数:
function [t,omg,FT,IFT]=prefourier(Trg,N,OMGrg,K)
%Trg为时域起止范围
%N为时域抽样点数
%OMGrg为频域起止范围
%K为频域抽样点数
%t为抽样时间点
%omg为抽样频率点
%FT为傅里叶变换矩阵(将该矩阵左乘信号即得信号的傅里叶变换)
%IFT为傅里叶反变换矩阵(将该矩阵左乘信号即得信号的傅里叶反变换)
T=Trg(2)-Trg(1);
t=linspace(Trg(1),Trg(2)-T/N,N)';
OMG=OMGrg(2)-OMGrg(1);
omg=linspace(OMGrg(1)-OMGrg(2)-OMG/K,K)';
FT=T/N*exp(-1i*kron(omg,t'));
IFT=OMG/2/pi/K*exp(1i*kron(t,omg'));
end
虽然matlab内置傅里叶变换函数,但是更常用的还是这个函数,并且此题求解以此函数为背景展开,也被称为矩阵法
T = 6;
N = 4000;
OMG = 500;
[t, omg, FT, IFT] = prefourier([-T/2,T/2],N,[-OMG/2,OMG/2],N);
gt=3*cos(10*t)+2*cos(20*t);%基带信号g(t)
ft=gt.*cos(100*t);%f(t)
gt0=ft.*cos(100*t);%g0(t)
HW = 0 * omg;
HW(omg>-30 & omg<30) = 1;%低通滤波器
figure(1);
subplot(4,1,1),plot(t,gt),xlabel('t'),ylabel('g(t)=3cos(10t)+2cos(20t)'),grid on
subplot(4,1,2),plot(t,ft),xlabel('t'),ylabel('f(t)=g(t)cos(100t)'),grid on
subplot(4,1,3),plot(t,gt0),xlabel('t'),ylabel('g0(t)=f(t)cos(100t)'),grid on
Gt0 = FT * gt0;
Gt1=Gt0.*HW;
gt1 = IFT * Gt1;%调制后傅里叶反变换
subplot(4,1,4),plot(t,gt1),xlabel('t'),ylabel('g0(t)通过低通滤波器之后的g1(t)'),grid on
figure(2);
Gt= FT * gt;
subplot(4,1,1),plot(omg, Gt),xlabel('w'),ylabel('G(jw)'),grid on
Ft= FT * ft;
subplot(4,1,2),plot(omg, Ft),xlabel('w'),ylabel('F(jw)'),grid on
Gt00= FT * gt0;
subplot(4,1,3),plot(omg, Gt00),xlabel('w'),ylabel('G0(jw)'),grid on
subplot(4,1,4),plot(omg, Gt1),xlabel('w'),ylabel('G1(jw)'),grid on