App.designer to plot step response
18 次查看(过去 30 天)
显示 更早的评论
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 个评论
Diego Roa
2022-11-21
R = app.Resistencia.Value;
C=app.Condensador.Value;
H=tf([0 1],[1 1/(R*C)])
step(app.UIAxes,H)
回答(1 个)
Sindhuja Parimalarangan
2017-2-21
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!