LTI System Creates non-LTI Output?

2 views (last 30 days)
Khoi Ly
Khoi Ly on 3 Jul 2019
Hi everyone,
Theoretically, a mass spring system is an LTI system when the intial condition is 0. For this reason, the sinusoid output of the system is merely a shifted, scaled version of the sinusoid input.
For this reason, if I have a sinewave input at 0.1Hz, I expect to see only one single sinusoid output at 0.1Hz. For some reason, the below simulation always show me 2 frequency contents: one at 0.1Hz, one as the natural frequency of the mass-spring system as if there is an initial condition.
Could someone help me explain the problem? Is this a programming issue?
clear all;
close all;
clc;
t = 0:0.001:250; % Generate a time series starting from 0s and ending at 250s with a sampling rate of 1000Hz
% The below code allows me to generate a sine wave with sine wave frequency of 0.1 Hz from 0s to 250s
f=0.1
Amp=1
ts=1/1000;
T=250
t=0:ts:T;
U=sin(2*pi*f*t);
% U = ones(1, length(t))*2;
% U = chirp(t,0.1,250,0.1,'linear',-90);
% Description of the state space model, as you can see, there is no damping on this system.
A = [0 1; -0.2 -0];
B = [0; 1];
C = [1 0];
D = [0];
figure();
sys = ss(A,B,C,D);
x0 = [0; 0]; % I set the initial condition to zero
% Response of the system under forced sinusoid input
[yout,tout,xout] = lsim(sys, U, t,x0);
plot(tout,yout);
title('Response to Sine Wave input');
% The below code shows the FFT of the system response. It should contains only the frequency content of the input (0.1Hz). It instead generate 2 frequency contents.
figure()
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = length(t); % Length of signal
t = (0:L-1)*T; % Time vector
Y = fft(yout);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')

Answers (0)

Community Treasure Hunt

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

Start Hunting!