how to make input in simulink equal to 1/s in matlab

In Simulink, you can use a Transfer Function block to represent 1/s. To set s to the input signal, use a Signal Generator block with Frequency set to 1.

Your Simulink model would look something like this:

main.m
Signal Generator -----> Transfer Function -----> Scope
                    1/s
79 chars
3 lines

In the Transfer Function block, specify the numerator as 1 and the denominator as [1 0] to represent 1/s.

Here's how you can do this in MATLAB code:

main.m
% Create transfer function
num = 1;
den = [1 0];
tf = tf(num, den);

% Create input signal
t = 0:0.01:10;
u = 1./t;

% Simulate transfer function
y = lsim(tf, u, t);

% Plot input and output signals
plot(t, u, t, y);
legend('Input', 'Output');
244 chars
16 lines

This code will generate an input signal u that is equal to 1/s and then simulate the transfer function 1/s using lsim. The input and output signals are then plotted using plot.

related categories

gistlibby LogSnag