Plot a cumulative distribution with a symmetric logarithmic scale centred at 50%

5 visualizaciones (últimos 30 días)
I have a cumulative distribution for wind speeds. From this graph I have estimated a normal distribution. In order to compare the estimation with the original graph, I would like to create exactly the same kind of graph plotting. The x-axis is mirrored logarithmically at the probability of 50% in the given figure. However, I have not found a way to do this in Matlab. A figure is included to visualize the desired outcome. I already calculated an approximated function:
% Approximated coefficients for cumulative distribution function (CDF)
a1 = 0.1194;
a2 = -0.000102;
mu = 1.5;
% Range of CS-AWO wind speeds in "probability of exceedene plot"
x = linspace(-30,30);
% Calculate values from approximated function of CDF from CS-AWO
for i = 1:length(x)
cdf_app(i) = exp(2*(a1*(x(i)-mu)*(1+a2*(x(i)-mu)^2)))/(1+exp(2*(a1*(x(i)-mu)*(1+a2*(x(i)-mu)^2))));
end
% Plot result
plot(cdf_app*100,x)

Respuesta aceptada

Jeff Miller
Jeff Miller el 17 de Sept. de 2022
Not sure if I really understand what you want but maybe something like this:
z_app = norminv(cdf_app); % find the normal Z scores corresponding to each CDF value
plot(z_app,x); % this plot may have the x-axis spacing you want
% Now set the xticks & labels to show the cumulative probabilities at
% various x points. You will want more ticks I am sure.
xticks([-0.25335 0 0.25335]); % the CDFs of these three Z values are 0.40, 0.50, and 0.60, from norminv
xticklabels({'40' '50' '60'})
Is this close to what you have in mind?
  1 comentario
Nikolai B.
Nikolai B. el 19 de Sept. de 2022
Editada: Nikolai B. el 19 de Sept. de 2022
This was a very good answer. Thank you! I finally was able to plot it in Matlab with the help of your Code. Here is the solution:
% Approximated coefficients for cumulative distribution function (CDF)
a1 = 0.1194;
a2 = -0.000102;
mu = 1.5;
% Range of CS-AWO wind speeds in "probability of exceedene plot"
% Set step size very small, so that the next value can be found with "min"
x = linspace(-40,40,5000);
% Calculate values from approximated function of CDF from CS-AWO
for i = 1:length(x)
cdf_app(i) = exp(2*(a1*(x(i)-mu)*(1+a2*(x(i)-mu)^2)))/...
(1+exp(2*(a1*(x(i)-mu)*(1+a2*(x(i)-mu)^2))));
end
% Set wanted Probabilities for x-Axis
ProbX = [0.1,1,10,20,30,40,50,60,70,80,90,99,99.9]/100;
% Calculate normal inverse cumulative distribution function
z_app = norminv(cdf_app);
for i = 1:length(ProbX)
[val,pos] = min(abs(cdf_app-ProbX(i))); % search pos. of probabilities
Approx(i) = x(pos); % Get position of approximation with defined Prob.
z_appPos(i) = z_app(pos); % Get position in inverted Gauss distr.
ProbStr(i) = {num2str(ProbX(i)*100)}; % Make cell array of Xtick str.
end
plot(z_app,x); % Plot inverted normal distribution
xticks(z_appPos); % Set X-Ticks
xticklabels(ProbStr); % Set X-Tick labels
xlabel('Probability of not Exceeding [%]')
ylabel('Wind Speed [kt]')
legend('Approximated Cumulative Distribution')
grid on

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by