- Insert the block in your simulation and connect it to the desired output
- Open the To Workspace parameters and change the save format to Structure with time
Graphical construction (max, min, tangent line in a point) from simulink scope / multiplot graph
38 views (last 30 days)
Show older comments
Hi all, i've the graph from a simulink simulation in a multiplot graph;
then i need to find the point of maximum slope of that graph (along with its x, y coordinates), in that point i need to plot the tangent line to the graph, and then plot the intersections with x axis and the extrapolation from max value of graph of this tangent line. To make simpler to explain i've an image of what i would to obtain:
I've already tried to send graph data to workspace, but then plotting it i lose the time x axis...
Any help would be very appreciated.
0 Comments
Accepted Answer
Paulo Silva
on 28 Jul 2011
Using the To Workspace block
Do the simulation and the data appears on the workspace, you can use it and plot it like this
plot(simout.time,simout.signals.values)
2 Comments
Paulo Silva
on 28 Jul 2011
Michele we expect you and everyone else to show some effort at solving the problems, we are here to help at specific questions, not to do all your work.
Here's more code but please try to understand it to finish what you want, the only thing that's missing is the line, the code gives you the slope and you can easily find the maximum slope.
si=simout.signals.values;
st=simout.time;
cla;hold on
plot(st,si)
d=diff(si)./diff(st); %d is the slope of the signal
[C,I]=max(d); %find maximum of the slope C and the index I where the slope is
plot(st(1:end-1),d,'r')
legend('signal','slope')
More Answers (2)
Nelis Vandermeiren
on 30 Dec 2011
Hello
I need to do the same thing, but here is my question: How can you plot the tangent line on the (step-response) graphic where the slope is max? and how to add those intersection points?
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!