Drawing a 1-CDF Graph
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone, I want to ask how do I draw a 1-cdf graph on matlab?
I have a set of data and I have already plotted a regular cdf using ecdf(data set). However, when I simply put 1-ecdf(data set), matlab returns me a vector. I have also tried plot(X,1-ecdf(data set)) but it looks completely wrong. X is just a vector I used for my data points. Can anyone help me out?
F=SGLD_cdf(X,Sigma,r,deta,b)
Y1 = n(1:1529:end,:);
figure(2)
plot(X,F)
hold on
% SGLD_cdf is a function created in another script, while X = 0.1:0.1:max(n) where n is my dataset
ecdf(n)
hold on
legend('Fitted curve','Data Set')
2 comentarios
Respuestas (1)
nick
el 27 de Feb. de 2024
Hi See Kai Xiang,
I understand that you are looking for a way to plot 1-CDF of the data.
To plot the 1-CDF, you can utilize the function values and x intervals obtained from MATLAB's "ecdf" function. The following MATLAB script demonstrates how to do this:
% Generate some example data, e.g., random numbers from a normal distribution
data = randn(1000, 1);
% Calculate the CDF values and the corresponding x values (sorted data)
[f, x_values] = ecdf(data);
% Calculate the 1-CDF
one_minus_f = 1 - f;
% Plot the 1-CDF and CDF
figure;
ecdf(data) % plots CDF
hold on;
plot(x_values, one_minus_f);
xlabel('Data values');
ylabel('1-CDF/ CDF');
title('CDF plots of the data');
legend('CDF Data', '1-CDF Data')
grid on;
You may refer to the following documentation to learn more about "ecdf" function :
Hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!