- “ginput”-https://www.mathworks.com/help/matlab/ref/ginput.html?s_tid=doc_ta
- 'sprintf'- https://www.mathworks.com/help/matlab/ref/sprintf.html?searchHighlight=precision%20value%20in%20data%20tips&s_tid=srchtitle_support_results_3_precision%2520value%2520in%2520data%2520tips
Increasing Precision in Data Tips on Root Locus Plots in MATLAB R2023b
조회 수: 10 (최근 30일)
이전 댓글 표시
After running a transfer function through through rlocus(), and then drawing a specific damping ratio via sgrid(), I have been instructed to drag a Data Tip to an intersection of the two plotted lines, and read the appropriate Gain and Pole information. However, the Data Tips never provide enough significant figures to match the assignments in my textbook.
I have searched for many ways to increase the precision and have tried:
- switching from format SHORT to format LONG
- editing content and style (seems impossible to change the length, as the data is inserted into "Label" fields in the DataTipRows).
- editing the update function to increase the number of figures displayed with num2str(), as the resulting DataTips only show the X and Y values, not the Gain, or other important data points generated in the Figure.
While I know that I could likely write a custom solution and call it manually, it seems like a lot of work for a simple problem, and I would like to know if there's an easier way.
댓글 수: 0
채택된 답변
SANKALP DEV
2023년 12월 22일
Hello Kyle,
I understand that you want to display gain and pole information with enough significant figures to match the precision required by your textbook assignments, while using “rlocus()” and “sgrid()” functions for control system analysis.
When utilizing Data Tips in MATLAB to select a point on the plot, it is noteworthy that MATLAB, by default, displays a restricted number of significant figures.
However, you can use “ginput” function to select a point and “sprintf” function to display gain and pole value on the plot with higher number of significant digits. Here is a sample code for the same:
tr_gain = sprintf('Gain: %.10f', selectedGain);
str_pole = sprintf('Pole: %.10f + %.10fi', real(selectedPole), imag(selectedPole));
text(x, y, {str_gain, str_pole}, 'VerticalAlignment', 'bottom');
To know more about these functions, you can refer to following MATLAB documentations:
Hope this helps,
Regards
Sankalp dev
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Classical Control Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!