How does lsim work?

119 views (last 30 days)
shahzer rahman
shahzer rahman on 10 Mar 2020
Commented: shahzer rahman on 10 Mar 2020
Hye.
I've been trying to figure out how the lsim function works in MATLAB. Does it do a time domain solution or a frequency domain solution? I am basically trying to solve a transfer function using lsim. The solution works out perfectly fine, but I have been trying to understand the theory behind how it works. I am very new to MATLAB, so kindly explain the basics if you've got time. THanks

Accepted Answer

Robert U
Robert U on 10 Mar 2020
Hi shahzer rahman,
your question is answered within Matlab documentation: lsim(), linking to ltitr() (which unfortunately does not have a documentation entry in the current version, built-in function, see below) and filter().
open ltitr
%LTITR Linear time-invariant time response kernel.
%
% X = LTITR(A,B,U) calculates the time response of the
% system:
% x[n+1] = Ax[n] + Bu[n]
%
% to input sequence U. The matrix U must have as many columns as
% there are inputs u. Each row of U corresponds to a new time
% point. LTITR returns a matrix X with as many columns as the
% number of states x, and with as many rows as in U.
%
% LTITR(A,B,U,X0) can be used if initial conditions exist.
% Here is what it implements, in high speed:
%
% for i=1:n
% x(:,i) = x0;
% x0 = a * x0 + b * u(i,:).';
% end
% x = x.';
% Copyright 1984-2007 The MathWorks, Inc.
% built-in function
Same question here: Matlab forum
Your core question answered short: lsim solves your system response in time domain.
Kind regards,
Robert
  1 Comment
shahzer rahman
shahzer rahman on 10 Mar 2020
Thanks alot Robert. Appreciate the effort.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!