MATLAB signal and System Analysis (II.)--time-domain analysis of discrete-time signals and systems

Source: Internet
Author: User

The expression of discrete signals 1, a discrete signal needs to be represented by two vectors:

(1) Amplitude of discrete signal

(2) location information of discrete signals

2, using MATLAB to realize the visualization of discrete signals

(1) Symbolic operations cannot be used to represent

(2) The stem command is generally used to draw discrete signals.

(3) x (n)--stem (n,x)

3, a demo:

Clear All;x=[-1,2,3,3,5,-4];n=[-2 ,-1,0,1,2,3];figure (1) Stem (n,x), axis ([-2.5,3.5,-4.5,5.5])

Second, some commonly used discrete signal 1, unit impulse sequence of the expression

function [X,n] = impseq (k1,k2,k0)
%K1,K2 represents the starting and ending point of a sequence (only a finite sequence is represented)
%k0 represents the impulse point. =0]; 
2, the unit step sequence of the expression:
function [X,n] = stepseq (n1,n2,n0)
%N1,N2 represents the starting and ending point of a sequence (only a finite sequence is represented)
=0]

Three, time domain operation of discrete signal, time domain transform 1, addition of discrete sequence:

function [Y,n] =Sigadd (X1,N1,X2,N2)% implements Y (n) = X1 (n) +X2 (N)%-----------------------------% [y,n] =Sigadd (X1,N1,X2,N2)% y =sum sequence over N, which includes N1 and N2% X1 =First sequence over N1% x2 = Second sequence over N2 (N2 can different fromN1)%N= Min (min (n1), Min (n2)): Max (Max (N1), Max (N2)); %duration of y (n) Y1= Zeros (1, Length (n));              y2 = y1; %initializationy1 (Find (n>=min (N1) & (N<=max (n1)) = =1)) =x1; %x1 with duration of Yy2 (Find (n>=min (n2) & (N<=max (n2)) = =1)) =x2; %x2 with duration of yy= Y1+y2; % sequence Addition

2. Multiplication of discrete sequences:

function [Y,n] == = Zeros (1, Length (n)); y2 = y1;            Y1 (Find (n>=min (N1)) & (N<=max (n1)) = =1)) =x1; Y2 (Find (N>=min (n2) & (N<=max (n2)) = =1)) == y1. * y2;

3, the inverse of the discrete sequence
function [Y,n] = sigfold (x,n)% implements Y (n) = x (-N)%-----------------------% [y,n] = sigfold (x , N)%= FLIPLR (x); n =-FLIPLR (n);

4. Translation of discrete sequences
function [Y,n] = sigshift (x,m,n0)% implements Y (n) = x (n-n0)%-------------------------% [y,n] = si Gshift (x,m,n0)%= m+n0; y = x;

5, the inverted phase of the discrete sequence
function [Y,n] == m; Y =-x;

Four, the response of discrete systems 1, 0 states, 0 inputs, full response

2, impulse response, step response

3, a demo

%ex_6clear all;n=0: -; x=cos (n*pi/3); a=[1,0.95,0.9025];b=[1/3,1/3,1/3];yi=[2,3];xi=0; xic=filtic (b,a,yi,xi);%Y1=filter (B,a,zeros (1, Length (n)), xic); Y2=filter (b,a,x); Y3=filter (b,a,x,xic); figure (1) Subplot (3,1,1), stem (n,y1), title ('0 Input Response') Subplot (3,1,2), stem (n,y2), title ('0 Status Response') Subplot (3,1,3), stem (n,y3), title ('Full Response') Figure (2) Subplot (2,1,1), Impz (B,a), title ('Impulse Response') Subplot (2,1,2), STEPZ (B,a), title ('Step Response')%U1=impseq (0, -,0); U2=stepseq (0, -,0); Y4=filter (B,A,U1); Y5=filter (B,A,U2); n=0: -; figure (3) Subplot (2,1,1), stem (n,y4), title ('Impulse Response'); subplot (2,1,2), stem (n,y5), title ('Step Response');

Convolution of discrete systems

function [F,k] = dconv (f1,f2,k1,k2)    k0= K1 (1) +k2 (1);     K3=length (F1) +length (F2)-2+K0;    K=k0:k3;     = CONV (F1,F2);

MATLAB signal and System Analysis (II.)--time-domain analysis of discrete-time signals and systems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.