Plotting Output of Function Given Transfer Function and Input in MATLAB

AI Thread Summary
The discussion focuses on plotting the output of a transfer function in MATLAB, specifically H(s) = 1000/(s^2 + s + 1000), given an input defined as 1 for 0 < t < 10 and 0 elsewhere. The user is seeking guidance on expressing the input function in MATLAB, contemplating the use of the unit step function, x(t) = U(t)*U(10 - t). They plan to use the inverse Laplace transform of the transfer function and convolve it with the input to obtain the output. Questions arise regarding the necessity of the time vector t and the formulation of the input using the Heaviside function. The discussion emphasizes the correct approach to implementing these concepts in MATLAB.
magnifik
Messages
350
Reaction score
0
i am trying to plot the output of a function given the transfer function and an input. however, i am having trouble with trying to express the input as a function in MATLAB

my transfer function is
m = 1;
b = 2;
k = 1000;
num = [ 1000 ];
den = [ m b k ];
transferfunction = tf(num, den)

so it's equal to H(s) = 1000/(s^2 + s + 1000)

i am given that the input is 1 from 0 < t < 10 and 0 elsewhere
i know that x(t) in terms if unit step is x(t) = U(t)*U(10 - t) --- how do i express this in MATLAB?

after this, my plan is to do q = ilaplace(transferfunction) and conv(q, x) to get the output. is this a correct method?
 
Physics news on Phys.org
is this correct...
t = 0:0.001:10; %do i even need this??
td = 10;
x1 = heaviside(t) - heaviside(t-td);
 
Back
Top