step function gives Error using step Not enough input arguments.
조회 수: 9 (최근 30일)
이전 댓글 표시
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'));
댓글 수: 0
답변 (1개)
Fangjun Jiang
2023년 2월 1일
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".
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!