- “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
21 次查看(过去 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 中查找有关 Stability Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!