フィルターのクリア

How I can plot average line on cdf plots?

2 ビュー (過去 30 日間)
Arijet Sarker
Arijet Sarker 2022 年 4 月 23 日
回答済み: Nithin 2023 年 11 月 1 日
How I can plot average line on cdf plots?
data_cellular = readmatrix('tmobile5gmain.csv', 'Delimiter', ',', 'LineEnding', '\n');
data_cellularb = readmatrix('att5gmain.csv', 'Delimiter', ',', 'LineEnding', '\n');
fig = figure();
y_c = data_cellular(:, 2);
%y_u = data_cellularb(:, 3)
hold on;
y_h = data_cellularb(:, 2);
hold on;
c1 = cdfplot(y_c);
hold on;
c2 = cdfplot(y_h);
hold on;
%set(gca, 'XScale', 'log')
%c2 = cdfplot(y_u);
nbins = 50;
dist = 'Normal';
  1 件のコメント
Mathieu NOE
Mathieu NOE 2022 年 4 月 25 日
hello
please provide the data files
tx

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

回答 (1 件)

Nithin
Nithin 2023 年 11 月 1 日
Hi Arijet,
I understand that you want to plot an average line on the CDF plots mentioned.
To implement this, kindly refer to the following steps:
  • Compute the Cumulative Distribution Function (CDF) for each dataset using the cdfplot function, as you have already done for y_c and y_h.
  • Calculate the average values for each dataset using the mean function and name them as “avg_c and avg_h.
avg_c = mean(y_c);
avg_h = mean(y_h);
  • Plot the average lines on the CDF plots using the “line” function. Specify the x-values as the average values and the y-values as [0 1] to span the entire range of the CDF plot.
line([avg_c avg_c], [0 1], 'Color', 'red', 'LineStyle', '--');
line([avg_h avg_h], [0 1], 'Color', 'blue', 'LineStyle', '--');
For more information regarding the “cdfplot”, “mean” and “line” functions, kindly refer to the following documentation:
I hope this answer provides you with the required information regarding your query.
Regards,
Nithin Kumar.

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by