step function gives Error using step Not enough input arguments.
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Fangjun Jiang
il 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 Commenti
Vedere anche
Categorie
Scopri di più su Simulation, Tuning, and Visualization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!