how to change the scale on the y-axis to a double log sclae?

9 views (last 30 days)
Hi, I am plotting a CDF distribution for the max moment caused on a bridge by traffic. I want to change the scale on the y-axis to a double log or Gumbell scale. ie. Ln(Ln)(p) The default options for axis scale are only linear or log.
The code i am using is;
z= bootstrp(2500,@max,data);
cdfplot(z)
This returns a cdf plot of the data but I cannot change the value of the y-axis to a double log scale.What process do I need to use to achieve this double log scale?

Answers (2)

dpb
dpb on 2 Apr 2014
Edited: dpb on 2 Apr 2014
You'll have to do it manually by transforming the data and the y axis values then set the tick mark values at the appropriate tick marks based on the unscaled value location.
y=log(log(p)); % the data transformed
plot(x,y) % plotted on linear scale
xlim([log(log(ymin)) log(log(ymax))]) % set a y-axis limit in scaled units
yt = [ymin:ystep:ymax]; % a set of tick mark values
set(gca,'ytick',log(log(yt}},'yticklabel',num2str(yt.')); % set ticks/label same
NB: aircode, untested--salt to suit...

Vaibhav
Vaibhav on 12 Feb 2024
Edited: Vaibhav on 12 Feb 2024
Hi Chencho
The Gumbel scale for the y-axis involves transforming the cumulative probabilities p to Ln(-Ln(1-p)).
Here's an approach to achieve this:
  1. Calculate the empirical CDF using the ecdf function instead of cdfplot.
  2. Transform the y-axis data to the Gumbel scale.
  3. Plot the transformed data.
Here's a code snippet for your reference:
% Bootstrap to get the maximum moments from the data
z = bootstrp(2500, @max, data);
% Calculate the empirical CDF
[F, x] = ecdf(z);
% Transform the y-axis data to Gumbel scale: Ln(-Ln(1-p))
% We need to avoid log(0) which occurs when p=1, so we limit p to be less than 1.
p = F(F < 1);
y_gumbel = log(-log(1 - p));
% Plot the transformed CDF data
plot(x(F < 1), y_gumbel);
xlabel('Max Moment');
ylabel('Ln(-Ln(1-p))');
title('CDF with Gumbel Scale for Y-axis');
% Optionally, you can add grid lines to help read the values
grid on;
You can refer to the MathWorks documentation below to learn more about "ecdf" function:
Hope this helps!

Community Treasure Hunt

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

Start Hunting!