MATLAB: How to plot function with a sine input in Matlab (not in simulink)

how to plot a function with sine as an input in matlab

we just type command 'step(function)' to plot a function with input step but How to plot a function that use sine as an input in Matlab.

Best Answer

When you invoke the step function you are multiplying your function on the frequency domain by 1/s, the function you get from that operation is then converted to the time domain using the ilaplace function.
Now for you specific case you can first convert the function to the time domain using ilaplace and then multiply by sin(t).
For the plot make the t vector and use the plot function to plot the response
plot(t,f(t))
Example
syms s t
TFC=evalc('tf([1 1],[1 1 1 0])')
%subplot(211)
[a b] = strread(TFC, '%s %s', 'delimiter',char(10));
num=sym(char(a(2)));
den=sym(char(a(3)));
tft=ilaplace(num/den);
tt=0:0.01:10;
plot(tt,subs(tft,t,tt).*sin(tt))
title('f*sin(t)') %response to input sin(t)
ylabel('Amplitude')
xlabel('time')
Related Question