Matlab calculate output

225 Views Asked by At

I'm trying to write a matlab function that takes in a transfer function and the input so it can calculate the output. So far, based on this information under I have the following piece of matlab code:

function [output] = sys_response(system, input)
xs = laplace(input);
output = system*xs;    
end

But I don't think this is right because what if the input is a unit step u(t)? How would I detect that? I'm kind of shooting in the dark here, can anyone point me in the right direction?

1

There are 1 best solutions below

3
On

One of the things to remember is that MATLAB does the analytical Laplace transform, so it will detect that you are providing an explicit unit step function. Normally the symbolic functions take the "normal" MATLAB functions as arguments, but internally change them over to the analytical versions. I think this is probably the same with the MATLAB unit step function.