How I can plot average line on cdf plots?

조회 수: 1 (최근 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.

카테고리

Help CenterFile Exchange에서 Exploration and Visualization에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by