step function gives Error using step Not enough input arguments.

I want to make a simulation of a plant, I wrote this code but it throws this error: Error using step Not enough input arguments.
% Define the transfer function of the plant
num_p = [13];
den_p = [1 -1/13];
p = tf(num_p, den_p);
% Define the transfer function of the controller
num_c = [40/13];
den_c = [1 (1/13 + 0.2) (0.2/13)];
c = tf(num_c, den_c);
% Find the transfer function of the closed-loop system
cl = feedback(p, c);
amplitudes = 20:5:60;
t = 0:0.01:100;
figure;
for i = 1:length(amplitudes)
amplitude = amplitudes(i);
input_signal = amplitude * step(t);
[y, t_out] = lsim(cl, input_signal, t);
plot(t_out, y);
hold on;
end
xlabel('Time (s)');
ylabel('Output (y)');
title('Response');
legend(num2str(amplitudes'));

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 2월 1일

0 개 추천

Not the correct way to use step(). It is used to get the step response of a system, not to get the step input signal.
You can use step() in replace of lsim(). Look at the examples in "doc step".

카테고리

도움말 센터File Exchange에서 Control System Toolbox에 대해 자세히 알아보기

질문:

2023년 2월 1일

답변:

2023년 2월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by