Calculation of y axis values or cdf values from given x axis values using another plot of best fit cdf
8 ビュー (過去 30 日間)
古いコメントを表示
I have calculated the cdf of best fit distribution. Now I have some x axis values. I want to get their corresponding y axis values or rather cdf values using the same cdf plot of best fit distribution as mentioned above. how to do so?
3 件のコメント
回答 (1 件)
Star Strider
2023 年 8 月 13 日
編集済み: Star Strider
2023 年 8 月 13 日
It would help to have your code and data.
Assuming it is similar to this approach, this may do what you want —
[f,x] = ecdf(wblrnd(2,6,[1 500])); % Calculate Empirical CDF
[xs,idx] = unique(x); % Unique Points (Required For 'interp1')
fs = f(idx); % Unique Points (Required For 'interp1')
xq = 3*rand(1,10) % Random Query Points (Can Be Any Values Within The Range of 'xs')
yq = interp1(xs, fs, xq, 'linear') % Interpolated CDF Values
figure
plot(x, f, 'DisplayName','CDF')
hold on
stem(xq, yq, '.r', 'DisplayName','Values At Query Points')
hold off
grid
legend('Location','best')
prms = wblfit(wblrnd(2,6,[1 500])); % Estimate Weibull Parameters
x = linspace(0, 3, 150); % Independent Variable Vector (For 'plot')
f = wblcdf(x,prms(1),prms(2));
q = 2.5*rand(1,10) % Random Query Points (Can Be Any Values Within The Range of 'xs')
yq = interp1(x, f, xq, 'linear') % Interpolated CDF Values
figure
plot(x, f, 'DisplayName','CDF')
hold on
stem(xq, yq, '.r', 'DisplayName','Values At Query Points')
hold off
grid
legend('Location','best')
yq = wblcdf(xq,prms(1),prms(2)); % Use 'wblcdf' To Calculate & Plot Query Points
figure
plot(x, f, 'DisplayName','CDF')
hold on
stem(xq, yq, '.r', 'DisplayName','Values At Query Points')
hold off
grid
legend('Location','best')
Experiment with this approach with your data.
EDIT — (13 Aug 2023 at 16:36)
Expanded to include specific distribution, additional options.
.
2 件のコメント
Star Strider
2023 年 8 月 13 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!