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 件のコメント
Payel
Payel 2023 年 8 月 13 日
best fit distribution has been found to be weibull. then cdf in a matrix format has been calculated using y=cdf(pd,x).
Torsten
Torsten 2023 年 8 月 13 日
編集済み: Torsten 2023 年 8 月 13 日
Then - given an x-value of your choice - you should be able to compute the corresponding y-value just as y = cdf(pd,x), shouldn't you ?

サインインしてコメントする。

回答 (1 件)

Star Strider
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')
xq = 1×10
2.2552 1.2215 1.1666 2.8139 0.1724 0.1016 1.4187 2.6146 2.1569 1.2920
yq = interp1(xs, fs, xq, 'linear') % Interpolated CDF Values
yq = 1×10
0.8649 0.0489 0.0356 NaN NaN NaN 0.1095 0.9974 0.7893 0.0657
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')
q = 1×10
1.8311 0.1284 1.7376 1.1860 0.9805 2.0554 1.7172 0.3337 0.9212 0.7660
yq = interp1(x, f, xq, 'linear') % Interpolated CDF Values
yq = 1×10
0.8782 0.0541 0.0414 0.9996 0.0000 0.0000 0.1263 0.9936 0.8013 0.0746
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.
.

カテゴリ

Help Center および File ExchangeExploration and Visualization についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by