how to make figure perfectly squared?

2 views (last 30 days)
I would like to make a perfect squared figure. When I use axis equal I still find that y-axis is stretched more than x-axis and does not make a perfect square. It appears like a rectangle elongated in y-direction. I do not want to change x and y limits.
I understand that my PC screen does not have 1:1 ratio, but how to get figure in 1:1 ratio??
Can anyone please help me making figure perfectly squared?
Here is the tentative code:
clear; close all; clc;
subplot(131)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
subplot(132)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
subplot(133)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
I want a figure like this . Square.
Any help will be greatly appriciated.
Thank you very much in advance!

Accepted Answer

Walter Roberson
Walter Roberson on 24 Aug 2022
Edited: Walter Roberson on 24 Aug 2022
You will need to create a calibration pattern and record it with some external camera, and create an undistortion matrix. You would draw into an array instead of on to the display, and then you would apply the undistortion matrix to it to arrive at the final image to display. The image would then pass through the distortion of your pc display and the distortion and undistortion would cancel out.
The computer vision toolbox contains tools for analyzing camera distortion that could be applied in reverse.
If this sounds as if I am blaming your pc display or your graphics hardware for not displaying correctly, then you have understood correctly.
  2 Comments
Walter Roberson
Walter Roberson on 24 Aug 2022
There are several different standard types of distortion for CRT displays, including pincushioning and bowing.
LCD and OLED and QLED displays are considerably less prone to some kinds of distortions, but they are not free of distortion, especially if viewed at angles.
Those are distortion at the physical display level. There is also potential distortion if the graphics card is sending incorrect or less-than-optimal information, due to settings or problems with the graphics driver or problems with the graphics card.
In the past I have used axis square on my iMac and measured the size of a data rectangle with digital calipers. On my system, the lengths of the two sides was equal to within round-off error.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!