How to set an axis with arbitrary, but equally spaced, scaling.

Technical Source
2 min readFeb 15, 2024

--

Hello,

I am attempting to replicate the following plot in a textbook using my own numerical solver. I am having trouble with replicating the x-axis in the plot for comparison since it is a bit odd. See the axes below:

I am aware that you can use Xtick to choose where ticks are located, but this does not affect the spacing of the ticks such that they are equally spaced like in the example above. The closest I am able to get is shown below:

Log scaling does slightly better, but is still not evenly spaced like I would hope:

Unfortunately I have not been able to find a way to change the scaling to be something other than linear or log. I am using MATLAB R2023a.

Does anyone know a way to create the evently spaced type of scaling seen in the first set of axes?

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

You could not plot versus the numbers 0,1,2,3, but then set the x-tick labels as you wish?

x = [1/3 1/2 1 inf];
xfake = [0 1 2 3];
y = [2 3 5 7];plot(xfake,y,'-or')
set(gca,Xtick = [0 1 2 3],XTickLabel = x)

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet