利用matlab的设计

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了利用matlab的设计相关的知识,希望对你有一定的参考价值。

离散时间系统的分析考察知识点:卷积和、Z变换。设计内容:(1) 自行设计产生两个离散序列信号,对其进行相加、乘及卷积运算。(2) 利用filter命令求下面LTI系统的冲激响应:画出系统的零极点图,判断系统的稳定性、因果性。(3) 绘出系统的频响曲线。

给出详细解答的我会将分数加到最高给你最佳答案

解:建模

⑴单位冲激函数@(t)无法直接用MATLAB描述,可以把它看作是宽度为Δ(程序中用dt表示),幅度为

1/Δ的矩形脉冲。

⑵单位阶跃函数:在t=t1处跃升的节约信号可写为u(t-t1).

⑶复指数函数:x3(t)=e^(ut+jwt)若w=0,它是实指数函数,若u=0,则为虚指数函数,其实部为余弦函数,虚部为正弦函数。

MATLAB程序

clear,t0=0;tf=5;dt=0.05;t1=1;

t=[t0:dt:tf];st=length(t);

% ⑴单位冲激信号

%在t1处有时间连续为dt,面积为1的脉冲信号,其余时间均为零。

n1=floor((t1-t0)/dt);%求t1对应的样本序号

x1=zeros(1,st);% 把全部信号先初始化为零

x1(n1)=1/dt;%给出t1处的脉冲信号

subplot(2,2,1),stairs(t,x1),grid on,title(\'冲激函数\') %绘图

axis([0,5,0,22])

%⑵单位阶跃函数

x2=[zeros(1,n1-1),ones(1,st-n1+1)];

subplot(2,2,3),stairs(t,x2),grid on,title(\'阶跃函数\');

axis([0,5,0,1.1]);

%⑶复指数函数

alpha=-0.5;w=10;x3=exp((alpha+j*w)*t);

subplot(2,2,2),plot(t,real(x3)),grid on,title(\'复指数函数实部\')

subplot(2,2,4),plot(t,imag(x3)),grid on,title(\'复指数函数虚部\')

例6.2LTI系统的零输入响应

描述n阶线性时不变(LTI)连续系统的微分方程为:

解:建模

当LTI系统的输入为零时,其零输入响应为微分方程的齐次解(即微分方程的等号右边为零),其形式为(设特征根均为单根)

y(t)=c1*exp(p1*t)+c2*exp(p2*t)+c3*exp(p3*t)+…+cn*exp(pn*t)

其中p1,p2,p3,…,pn是特征方程的根,他们可以用roots(a)语句求的。各系数c1,c2,…,cn由y及其各阶倒数的初值来确定。

MATLAB程序q602.m

a=input(\'输入分母系数向a=[a1,a2,a3,…]=\');

n=length(a)-1;

Y0=input(\'输入初始条件向量Y0=[y0,D1y1,D2y2,D3y3…]=\');

p=roots(a);V=rot90(vander(p));c=V\\Y0\';

dt=input(\'dt=\');tf=input(\'tf=\')

t=0:dt:tf; y=zeros(1,length(t));

for k=1:n y=y+c(k)*exp(p(k)*t);

disp([\' c\',\' (\',num2str(k),\') \',\'is\'])

disp(num2str(c(k)))

disp([\' p\',\' (\',num2str(k),\') \',\'is\'])

disp(num2str(p(k)))

end

plot(t,y),grid
参考技术A 自行设计产生两个离散序列信号,对其进行相加、乘及卷积运算。
clear all;clc;
N=8;M=8;L=N+M-1;
x=[1,1,2,3,5,8,11,7];nx=0:N-1;
h=[2,4,6,8,1,3,5,7];nh=0:M-1;
y1=x+h;ny1=0:N-1;
y2=x.*h;ny2=0:N-1;
y3=conv(x,h);ny3=0:L-1;
figure(1)
subplot(121);stem(nx,x,'.');xlabel('n');ylabel('x(n)');grid on;
subplot(122);stem(nh,h,'.');xlabel('n');ylabel('h(n)');grid on;
figure(2);
subplot(131);stem(ny1,y1,'.');xlabel('n');ylabel('y1(n)');grid on;
subplot(132);stem(ny2,y2,'.');xlabel('n');ylabel('y2(n)');grid on;
subplot(133);stem(ny3,y3,'.');xlabel('n');ylabel('y3(n)');grid on;
参考技术B 可 一 找个 人叫 你

利用MATLAB结合双线性变换法设计一个数字切比雪夫带通IIR滤波器

要做一个上面题目的课程设计,各位大虾帮帮忙,到底怎么做,看了很多资料,现在心里一片混乱。
我们还没有学习dsp,学校就让我们做这,郁闷!

帮你设计了一个数字切比雪夫I型的IIR低通滤波器,下面参数是随便给的
通带频率0.2*pi,截止频率0.3*pi通带衰减波纹比1dB,阻带衰减15dB
>> wp=0.2*pi;
>> ws=0.3*pi;
>> Rp=1;
>> As=15;
>> T=1;Fs=1/T;
>> OmegaP=(2/T)*tan(wp/2);
>> OmegaS=(2/T)*tan(ws/2);
>> [cs,ds]=afd_chb1(OmegaP,OmegaS,Rp,As);

*** Chebyshev-1 Filter Order= 4
>> [b,a]=bilinear(cs,ds,Fs);%双线性变换
>> [C,B,A]=dir2cas(b,a)

当然先得加上2个M函数,是频带变换的
函数1

function [b,a]=afd_chb1(Wp,Ws,Rp,As);
% Analog Lowpass Filter Design:Chebyshen-1
%----------------------------------------------
% [b,a]=afd_chb1(Wp,Ws,Rp,As);
% b=Numerator coefficients of Ha(s)
% a=Denominator coefficients of Ha(s)
% Wp=Passband edge frequency in rad/sec ;Wp>0
% Ws=Stopband edge frequency in rad/sec;Ws>Wp>0
% Rp=Passband ripple in +dB;(Rp>0)
% As=Stopband attenuation in +dB;(As>0)
%
if Wp<=0
error('Passband edge must be large than 0')
end
if Ws<=Wp
error('Stopband edge must be larger than Passband edge')
end
if (Rp<=0)|(As<0)
error('PB ripple and/or SB attenuation must be larger than 0')
end

ep=sqrt(10^(Rp/10)-1);
A=10^(As/20);
OmegaC=Wp;
OmegaR=Ws/Wp;
g=sqrt(A*A-1)/ep;
N=ceil(log10(g+sqrt(g*g-1))/log10(OmegaR+sqrt(OmegaR*OmegaR-1)));
fprintf('\n*** Chebyshev-1 Filter Order=%2.0f\n',N)
[b,a]=u_chb1ap(N,Rp,OmegaC);

函数2
function [b0,B,A]=dir2cas(b,a)
% DIRECT-form to CASCADE-foem conversion(cplxpair version)
%--------------------------------------------------------------------
%[b0,B,A]=dir2cas(b,a)
%b0=gain coefficient
%B=K by 3 matrix of real coefficients containing bk's
%A=K by 3 matrix of real coefficients containing ak's
%b=numerator polynonial coefficients of DIRECT form
%a=denominator polynomial coefficients of DIRECT form

%compute gain coefficient b0
b0=b(1);b=b/b0;
a0=a(1);a=a/a0;
b0=b0/a0;
%
M=length(b);N=length(a);
if N>M
b=[b zeros(1,N-M)];
elseif M>N
a=[a zeros(1,M-N)];N=M;
else
NM=0;
end
%
K=floor(N/2);B=zeros(K,3);A=zeros(K,3);
if K*2==N;
b=[b 0];
a=[a 0];
end
%
broots=cplxpair(roots(b));
aroots=cplxpair(roots(a));
for i=1:2:2*K
Brow=broots(i:1:i+1,:);
Brow=real(poly(Brow));
B(fix((i+1)/2),:)=Brow;
Arow=aroots(i:1:i+1,:);
Arow=real(poly(Arow));
A(fix((i+1)/2),:)=Arow;
end
参考技术A 通带频率0.2*pi,截止频率0.3*pi通带衰减波纹比1dB,阻带衰减15dB
>> wp=0.2*pi;
>> ws=0.3*pi;
>> Rp=1;
>> As=15;
>> T=1;Fs=1/T;
>> OmegaP=(2/T)*tan(wp/2);
>> OmegaS=(2/T)*tan(ws/2);
>> [cs,ds]=afd_chb1(OmegaP,OmegaS,Rp,As);

*** Chebyshev-1 Filter Order= 4
>> [b,a]=bilinear(cs,ds,Fs);%双线性变换
>> [C,B,A]=dir2cas(b,a)

当然先得加上2个M函数,是频带变换的
函数1

function [b,a]=afd_chb1(Wp,Ws,Rp,As);
% Analog Lowpass Filter Design:Chebyshen-1
%----------------------------------------------
% [b,a]=afd_chb1(Wp,Ws,Rp,As);
% b=Numerator coefficients of Ha(s)
% a=Denominator coefficients of Ha(s)
% Wp=Passband edge frequency in rad/sec ;Wp>0
% Ws=Stopband edge frequency in rad/sec;Ws>Wp>0
% Rp=Passband ripple in +dB;(Rp>0)
% As=Stopband attenuation in +dB;(As>0)
%
if Wp<=0
error('Passband edge must be large than 0')
end
参考技术B fp1=? 通带截止频率1自己设;单位Hz
fs1=?阻带截止频率1自己设;单位Hz
fp2=? 通带截止频率2自己设;单位Hz
fs2=?阻带截止频率2自己设;单位Hz
Fs=?抽样频率自己设;单位Hz
rp=?通带衰减自己设;单位db
rs=?阻带衰减自己设;单位db
wp1=2*fp1/Fs;
ws1=2*fs1/Fs;
wp2=2*fp2/Fs;
ws2=2*fs2/Fs;
[n,wn]=cheb1ord([wp1 wp2],[ws1 ws2],rp,rs);
[bz,az]=cheby1(n,rp,wn);
freqz(bz,az,512,Fs);

以上是关于利用matlab的设计的主要内容,如果未能解决你的问题,请参考以下文章

低副瓣阵列天线综合2 matlab HFSS

利用MATLAB结合双线性变换法设计一个数字切比雪夫带通IIR滤波器

关于用MATLAB设计对信号进行频谱分析和滤波处理的程序

用MATLAB设计对信号进行频谱分析和滤波处理的程序

matlab如何读取结构体中的数据,比如我想利用里面的数据画图

学个Antenna:利用HFSS-API设计指数渐变传输线