step function gives Error using step Not enough input arguments.
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Fangjun Jiang
am 1 Feb. 2023
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 Kommentare
Siehe auch
Kategorien
Mehr zu Classical Control Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!