Returning NaN after mean calculation?
Show older comments
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 Comments
Torsten
on 17 Oct 2022
We don't know what "part_2" does with A_0(j,i) and n(i).
Cormac Carr
on 17 Oct 2022
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!