Filter löschen
Filter löschen

Increasing Precision in Data Tips on Root Locus Plots in MATLAB R2023b

10 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

SANKALP DEV
SANKALP DEV am 22 Dez. 2023
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

Weitere Antworten (0)

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by