- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Use CDF for graph
2 views (last 30 days)
Show older comments
Hi everyone,
I have this graph that shows the serial time of transimation data for 10000 rounds (x is time and y is the number of rounds). How can I use CDF in this graph?
figure
subplot(3,1,1)
plot(1:Simulation,OverallTotalDelayArrOptimalEnv(2,:),'r--');
title('E2ET-(kkk) #50 Nodes')
xlabel('Rounds');
ylabel('Time (ms)');
grid on
subplot(3,1,2)
plot(1:Simulation,OverallTotalDelayArrOriginalEnv(2,:),'k-.');
title('E2ET-(bbb) #50 Nodes')
xlabel('Rounds');
ylabel('Time (ms)');
grid on
subplot(3,1,3)
plot(1:Simulation,OverallTotalDelayArrShortEnv(1,:),'b');
title('E2ET-(bbb) #50 Nodes')
xlabel('Rounds');
ylabel('Time (ms)');
grid on
0 Comments
Accepted Answer
Hassaan
on 9 Jan 2024
To use a Cumulative Distribution Function (CDF) in your graph, you'll first need to compute the CDF for each of the data sets you are plotting
(i.e., OverallTotalDelayArrOptimalEnv(2,:),
OverallTotalDelayArrOriginalEnv(2,:),
and OverallTotalDelayArrShortEnv(1,:)).
A CDF plot will show the proportion of data points less than or equal to a certain value, which can be useful for understanding the distribution and variability of your data over time.
Here’s how you can modify your code to include CDF plots for each of your datasets:
% Assuming 'Simulation' is defined and contains the number of simulation rounds
Simulation = 10000; % Example value, replace with your actual number of rounds
% Your existing data arrays
% OverallTotalDelayArrOptimalEnv, OverallTotalDelayArrOriginalEnv, OverallTotalDelayArrShortEnv
% should already be defined in your workspace
% Plotting the existing time series data
figure;
subplot(4,1,1)
plot(1:Simulation, OverallTotalDelayArrOptimalEnv(2,:), 'r--');
title('E2ET-(kkk) #50 Nodes');
xlabel('Rounds');
ylabel('Time (ms)');
grid on;
subplot(4,1,2)
plot(1:Simulation, OverallTotalDelayArrOriginalEnv(2,:), 'k-.');
title('E2ET-(bbb) #50 Nodes');
xlabel('Rounds');
ylabel('Time (ms)');
grid on;
subplot(4,1,3)
plot(1:Simulation, OverallTotalDelayArrShortEnv(1,:), 'b');
title('E2ET-(bbb) #50 Nodes');
xlabel('Rounds');
ylabel('Time (ms)');
grid on;
% Calculating and plotting the CDF for each dataset
subplot(4,1,4)
[cdfOptimal, xOptimal] = ecdf(OverallTotalDelayArrOptimalEnv(2,:));
plot(xOptimal, cdfOptimal, 'r--');
hold on;
[cdfOriginal, xOriginal] = ecdf(OverallTotalDelayArrOriginalEnv(2,:));
plot(xOriginal, cdfOriginal, 'k-.');
[cdfShort, xShort] = ecdf(OverallTotalDelayArrShortEnv(1,:));
plot(xShort, cdfShort, 'b');
title('CDF of E2ET for Different Environments');
xlabel('Time (ms)');
ylabel('CDF');
grid on;
hold off;
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
Feel free to contact me.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!