PLEASE HELP!!!! PLOT STEP FUNCTION WITH DEFINED AMPLITUDE

35 visualizzazioni (ultimi 30 giorni)
Hello everyone,
I have a problem with plotting step function. I have a code about plotting a transfer function. I will add my code to show.
In my code, i want to change the default amplitude of transfer function. As I learned, Matlab has a default amplitude as 1. According to my research, there is a option about "Options for the step command". Here is the link: https://www.mathworks.com/help/control/ref/stepdataoptions.html#d123e129499
Here, I want to change my amplitude as 5. I think I might write opt = stepDataOptions('StepAmplitude',5);
But here there was a code which is [y,t] = step(sys,opt); and I dont get it what is the meaning of y and t. Why must we do smth like that?
And also I want to plot my transfer function after change the amplitude. And again, as my research, I think I must be write code as plot(t,y).
But why must we write (t,y) in the plot while we define [y,t]?
K_parameter = 1;
TL_parameter = 2;
TI_parameter = 3;
WN_parameter = 4;
t_parameter = 5;
zeta_parameter = 6;
F = K_parameter*tf([TL_parameter 1],[TI_parameter 1])*tf(1,[1/WN_parameter^2 2*zeta_parameter/WN_parameter 1]);
sys = F*exp(-t_parameter*tf('s'));
transfer_plot = stepplot(sys);
grid on
info = stepinfo(sys)
st = info.SettlingTime

Risposta accettata

Atsushi Ueno
Atsushi Ueno il 14 Mag 2021
>[y,t] = step(sys,opt); Why must we do smth like that?
You don't have to do that. You can choose both way, with [y, t], or without [y, t].
  • if you choose with [y, t], step() gives you "Step Response Data", and it does not give you "Step Response Plots".
  • if you choose without [y, t], step() gives you "Step Response Plots", and it does not give you "Step Response Data".
You might see this example, but [y,t] = step(sys,opt); can be replaced with step(sys,opt);. You will get plot instead of [t, y] data.
opt = stepDataOptions('InputOffset',-1,'StepAmplitude',2);
[y,t] = step(sys,opt);
>But why must we write (t,y) in the plot while we define [y,t]?
Plot() is process for plot only and does not care about step function. So it needs (t, y) for data plot. If you choose step() without [y, t], you don't need using plot().
  5 Commenti
Paul
Paul il 16 Mag 2021
The doc pages will answer these questions:
doc step
doc plot

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by