how to find the standard deviation of one file which i want to run it for 100 times.

조회 수: 1 (최근 30일)
Hello everyone i have a one file in matlab which show me the shortest path and shortest time,how can write another matlab file and ask run the previous matlab file for 100 time and fine standard of deviation of time and standard deviation of path of it?
thank you

답변 (1개)

Konstantinos Sofos
Konstantinos Sofos 2015년 5월 17일
편집: per isakson 2015년 5월 17일
Hi,
Assuming your function is the "PathGen" (because you haven't posted or uploaded anything) with 2 outputs
[Path,Time]=PathGen(varargin)
a solution would be
% Script to run 100 times PathGen with some stats
%
N = 100;
AllTimes = []; % Initialize
AllPaths = []; % Initialize
for n = 1:N
[Path,Time]=PathGen(varargin);
AllPaths = [AllPaths Path] % This will be a matrix size(Path) x N
AllTimes = [AllTimes Time] % This will be a vector 1xN
end
%%Std
Timestd = std(AllTimes );
stdPath= std(AllPaths,0,2); % This will be a vector 1xN
plot(stdPath);
Pathstd = std(stdPath);

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by