Returning NaN after mean calculation?
Ältere Kommentare anzeigen
Just wondring why my code is returning NaN when I use the mean fucntion? My numbers are not that big i have scaled back the number of runs from 1000 to 10 but still no change. I'm confused
clear all
close all
clc
% set up variables
no_of_calls = 60;
no_of_runs = 10;
CallTime = [];
CallLength =[];
n = ones(1,no_of_calls).*42;
E_1 = zeros(no_of_runs, no_of_calls);
call_timeDIST= makedist('Uniform');
call_lengthDIST = makedist('Poisson','lambda',3);
CallLength = zeros(no_of_runs,no_of_calls);
for i = 1:no_of_calls
for j = 1:no_of_runs
% Create distribution for calls in time
CallTime(j) = random(call_timeDIST);
% Create distribution for call length
CallLength(j,i) = random(call_lengthDIST);
% calculate A0
A_0 = 600.*(CallLength./60);
% calculate E_1 using Erlings-B Formula
E_1(j,i) = part_2(A_0(j,i), n(i));
end
% Find Mean for number of iterations
GOS = mean(E_1,2);
end
CT = sort(CallTime)';
plot(CT, GOS)
2 Kommentare
Torsten
am 17 Okt. 2022
We don't know what "part_2" does with A_0(j,i) and n(i).
Cormac Carr
am 17 Okt. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!