Why are the lines not showing up on my graph?
I need to show two separate lines on the same figure, one for dcs and one for d2p, using the values provided by each iteration of the for loop. I’m not sure what I’m doing wrong here. Thanks in advance! Here is my code:
N = [10 90 1000]; % number of peers
F = 20 * 1024; % converting Gbits to Mbits
us = 30; % server upload
di = 2; % client download
u = 300/1024; % client upload
dcs = zeros(size(N));
dp2 = zeros(size(N));
figure();
grid
hold on;
for i = 1:1:length(N)
Nval = N(i);
cs1 = Nval*F/us;
cs2 = F/di;
dcs = max(cs1,cs2);
p21 = F/us;
ui = u*Nval;
p23 = Nval*F/(us+ui);
dp2 = max([p21(:); cs2(:); p23(:)]);
plot(dcs, Nval);
plot(dp2, Nval);
title(‘Distribution Time’)
end
ylabel(‘Minimum Distribution Time’)
xlabel(‘N’)I need to show two separate lines on the same figure, one for dcs and one for d2p, using the values provided by each iteration of the for loop. I’m not sure what I’m doing wrong here. Thanks in advance! Here is my code:
N = [10 90 1000]; % number of peers
F = 20 * 1024; % converting Gbits to Mbits
us = 30; % server upload
di = 2; % client download
u = 300/1024; % client upload
dcs = zeros(size(N));
dp2 = zeros(size(N));
figure();
grid
hold on;
for i = 1:1:length(N)
Nval = N(i);
cs1 = Nval*F/us;
cs2 = F/di;
dcs = max(cs1,cs2);
p21 = F/us;
ui = u*Nval;
p23 = Nval*F/(us+ui);
dp2 = max([p21(:); cs2(:); p23(:)]);
plot(dcs, Nval);
plot(dp2, Nval);
title(‘Distribution Time’)
end
ylabel(‘Minimum Distribution Time’)
xlabel(‘N’) I need to show two separate lines on the same figure, one for dcs and one for d2p, using the values provided by each iteration of the for loop. I’m not sure what I’m doing wrong here. Thanks in advance! Here is my code:
N = [10 90 1000]; % number of peers
F = 20 * 1024; % converting Gbits to Mbits
us = 30; % server upload
di = 2; % client download
u = 300/1024; % client upload
dcs = zeros(size(N));
dp2 = zeros(size(N));
figure();
grid
hold on;
for i = 1:1:length(N)
Nval = N(i);
cs1 = Nval*F/us;
cs2 = F/di;
dcs = max(cs1,cs2);
p21 = F/us;
ui = u*Nval;
p23 = Nval*F/(us+ui);
dp2 = max([p21(:); cs2(:); p23(:)]);
plot(dcs, Nval);
plot(dp2, Nval);
title(‘Distribution Time’)
end
ylabel(‘Minimum Distribution Time’)
xlabel(‘N’) graph, for loop, max MATLAB Answers — New Questions