App.designer to plot step response

In Appdesigner, I create a app.UIAxes and a app.Button, how to write a callback to use this app.UIAxes to plot a step response using the command 'step(tf)' when I push down this Button.

1 comentario

Diego Roa
Diego Roa el 21 de Nov. de 2022
R = app.Resistencia.Value;
C=app.Condensador.Value;
H=tf([0 1],[1 1/(R*C)])
step(app.UIAxes,H)

Iniciar sesión para comentar.

Respuestas (1)

Sindhuja Parimalarangan
Sindhuja Parimalarangan el 21 de Feb. de 2017
You can extract the output of the step function and use the "plot" function in App Designer. Here is an example callback function for the Button :
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
tf = 1:3:100;
a = [-0.5572,-0.7814;0.7814,0];
b = [1,-1;0,2];
c = [1.9691,6.4493];
sys = ss(a,b,c,0);
[y,t] = step(sys);
plot(app.UIAxes,y(:,:,1));
end
This link has guidelines on how to write a callback function for a Button to plot on UIAxes.
You could execute the "step" function in MATLAB to figure out how to extract relevant data from the output of the "step" function for plotting.

4 comentarios

jiarui zhang
jiarui zhang el 22 de Feb. de 2017
Thanks for your answer. But I want to use step to get the figure directly, not just use it to get some vector and then use plot to get the figure.
Franklin Ngo
Franklin Ngo el 28 de Jun. de 2018
@jiarui zhang: Did you find a solution for this? I have a same problem with you, please share if you have solution. Thank you.
Denis RONDEAU
Denis RONDEAU el 9 de Mzo. de 2020
same problem and no answer :(

Iniciar sesión para comentar.

Categorías

Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.

Preguntada:

el 17 de Feb. de 2017

Comentada:

el 21 de Nov. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by