Can I modify the XY-Graph in Matlab-Simulnk R2016a so that I can follow the end of my output line clearly?

조회 수: 5 (최근 30일)
As the figure below shows, I can not follow the end of my output line. Could it be possible to make the tail of the line disappear after a lapse of certain time (such as a comet in the sky)?
Or to adapt the XY-Graph to provide the end of line with a head, which has a different color from the main line?
Or is there any another suggestion to display the line clearly?
Thank you for any help!

채택된 답변

Vaibhav Awale
Vaibhav Awale 2016년 5월 2일
Hi Mahfoud,
You can modify the XY-Graph in Simulink R2016a. The XY graph that we see is a s-function. If you right click on the block and go to Mask -> Look under Mask, you will see that the s-function "sfunxy.m" is used.
You can modify this s-function according to your requirement. For example, you can clear the graph periodically or provide a marker for the head of the graph. The s-function uses MATLAB syntax, so you can use all the available properties of a MATLAB figure.
Another much simpler workaround would be to use a MATLAB function block. It is fairly straightforward to write to MATLAB function block to plot a x-y graph. If you are not much familiar with using s-functions, I would recommend to use a MATLAB function block.
Regards,
Vaibhav

추가 답변 (1개)

Mahfoud Alibrahim
Mahfoud Alibrahim 2017년 5월 11일
편집: Mahfoud Alibrahim 2017년 5월 11일
Hello, I found the following method, which could help:
you can edit the s-function for the XY-Graph in that you type the following instruction On MATLAB Command Window:
edit sfunxy.m
To provide the data-points with a marker you can do the following:
Go to the line(number about 239):
set(ud.XYLine, 'LineStyle','-');
and replace it with:
set(ud.XYLine, 'LineStyle','-', 'Marker','*');
To clear a part of the plot, go to the line (number about 396 in matlab 2015):
new_line = feval(@()hg2sample.ScopeLineAnimator('maxNumVertices',50000));
Here you can change the numbers of the 'maxNumVertices' to got the desired Display on the XY-Graph. For Exempel you can type 10 instead of 50000 to display just the last ten data-points in the XY-Graph.
Regards
Mahfoud

카테고리

Help CenterFile Exchange에서 Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by