Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
5011cem-2021/Graphs.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
43 lines (35 sloc)
980 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Plotting graphs in Matlab | |
clear all | |
close all | |
%% Show two plots on different y-axes | |
%% 250 data processed | |
x1Vals = [2, 3, 4, 5, 6, 7]; | |
y1Vals = [65, 56, 47, 44, 40, 39]; | |
figure(1) | |
yyaxis left | |
plot(x1Vals, y1Vals, '-bd') | |
xlabel('Number of Processors') | |
ylabel('Processing time (s)') | |
title('Processing time vs number of processors') | |
%% 5,000 data processed | |
x2Vals = [2, 3, 4, 5, 6, 7, 8]; | |
y2Vals = [1560, 1077, 945, 838, 852, 725, 707]; | |
figure(1) | |
yyaxis right | |
plot(x2Vals, y2Vals, '-rx') | |
xlabel('Number of Processors') | |
ylabel('Processing time (s)') | |
title('Processing time vs number of processors') | |
legend('250 Data', '5,000 Data') | |
%% Show two plots on same y-axis | |
%% Mean processing time | |
y1MeanVals = y1Vals / 250; | |
y2MeanVals = y2Vals / 5000; | |
figure(2) | |
plot(x1Vals, y1MeanVals, '-bd') | |
hold on | |
plot(x2Vals, y2MeanVals, '-rx') | |
xlabel('Number of Processors') | |
ylabel('Processing time (s)') | |
title('Mean Processing time vs number of processors') | |
legend('250 Data', '5,000 Data') |