Académique Documents
Professionnel Documents
Culture Documents
& Technology
stem(n ,c);
xlabel ( 'Time index n');
ylabel ( 'Amplitude ');
Consider the finite-length signal
x[n]={?(1,
0?n?5,@0,
otherwise )?
plot x[n] and analytically determine y[n]=x[n]*x[n]
n=0:5;
x=(0<=n<=5);
stem(n,x);
title('finite length signal');
xlabel('n');
ylabel('x');
otherwise )?
ylabel('y');
In conclusion, it looks very different comparing with that in part 1.
Consider the finite-length signal
x[n]={?(2n+1
0?n?5@0
elsewhere )?
)?
Filter :
The filter command in MATLAB computes the output of a causal, LTI system for a g
iven input when the system is specified by a linear constant-coefficient differe
nce equation. Consider the LTI system satisfying the difference equation:
?_(k=0)^K?a_k y[n-k]=?_(m=0)^M?b_k x[n-m]
Where x[n] is the system input and y[n] is the system output. If x is a vector c
ontaining the input on the interval n_x<=n<=n_x+ N_x-1 and the vectors a and b c
ontain the coefficients a_k and b_k then y= filter (b, a, x) returns the output
of this causal LTI system satisfying
?_(K=0)^K??a(k+1)y(n-k)=?_(m=0)^M?b(m+1)x(n-m) ?
x=(0<=n<=5);
n=-5:0;
h2=n.*(-3<=n<=2);
y2=filter(h2,1,x);
stem(n,y2);
title('filter');
xlabel('n');
ylabel('y2');
Simulation of the Time Response of the LTI System with Differential Equations:
the function lsim in MATLAB can be used to simulate the output of continuous ti
me, LTI system described by linear constant-coefficient differential equations o
f the form,
?_(k=0)^N??a_k (d^k y(t))/?dt?^k ?=?_(m=0)^M??b_m (d^m x(t))/?dt?^m ?
We define a and b as vectors .with a and b defined, the vector y will simulate t
he output when executing command
>>y= lsim(b,a,x,t);
t=[0:0.5:10];
x= ones(1, length(t));
b=3;
a=[3 2];
s=lsim(b, a, x,t);
plot(t,s);
title('LTI system');
xlabel('t');
ylabel('s');
(b)- Use lsim can simulate the response to the causal LTI system described by
(dy(t))/dt=-3y(t)+2x(t)
to the input x(t)=(t-2). Use t=[0:0.5:10].
clear all;
t=[0:0.5:10];
x=(t>=2);
a=[1 3];
b=2;
s=lsim(b,a,x,t);
plot(t,s);
smoothing of Time Sequences
Loading and Visualizing the Data:
load beer,
plot(beer)
title('beer')
the graph:
Conclusion:
In, general MATLAB helps us to represent, manipulate, and analyze basic
signals and systems.