Adding custom properties to response plot (e.g. settling time, peak response etc.)

1 visualización (últimos 30 días)
Hey everyone,
I have a simple model of a state-space system and I'd like to examine its response to initial conditions.
One of the things I'd like to show is a kind of "settling time", but not the kind we all know and love (ha). I want to show the first point at which the graph goes below a certain value (1% of the starting point, for what it's worth. It's a descending graph, of course).
Now, had this been a common thing to show, I'd have the option to display is through right click-->properties, but it's not.
So my question is - how do I go about doing this? I basically need to do three things:
1. adding a marker to the plot at the specific point where the graph goes below a certain value (call it m)
2. plotting a horizontal line (at m) that goes from the y-axis to the graph line (but doesn't cross it)
3. plotting a vertical line that goes from the x-axis up to the graph (but doesn't cross it)
If you guys have any ideas/tips, please share! Any kind of help would be greatly appreciated.
  1 comentario
Guy Lalkin
Guy Lalkin el 5 de Jun. de 2015
So after doing a little more digging through the 'plot' documentation, I've come up with this:
h=initial(sys,x0,t);
ix=find(h<=m,1);
initial(sys,x0,t)
hold on
% plot horizontal line, vertical line and marker
plot([0 t(ix)],[m m],'b--',[t(ix) t(ix)],[0 m],'b--',...
t(ix),0.02*(pi/2),'ro','MarkerSize',5,'MarkerFaceColor','r')
Is this a good solution? I feel it's kind-of "dirty", if you know what I mean, but it gets the job done. If anyone has any other suggestions, you're more than welcome to reply!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by