how to change the scale on the y-axis to a double log sclae?
8 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
dpb
2014-4-2
编辑:dpb
2014-4-2
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
2024-2-12
编辑:Vaibhav
2024-2-12
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:
- Calculate the empirical CDF using the ecdf function instead of cdfplot.
- Transform the y-axis data to the Gumbel scale.
- 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!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!