how to store 3 outputs of simulation in array and each time i run the simulation the outputs are stored in a the next row in the same array
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Akzeptierte Antwort
Image Analyst
am 1 Mai 2022
Try this:
numRuns = 10000; % How many times you want to run the simulation
allResults = zeros(numRuns, 3); % Array to hold all the results of all runs.
for k = 1 : numRuns
% Run your simulation and get results.
[w1, w2, w3] = MySimultationFunction();
% Tack on the results for this run to our master results list of all runs.
allResults(k, :) = [w1, w2, w3];
end
3 Kommentare
Image Analyst
am 1 Mai 2022
I think you need the function
function [w1, w2, w3] = MySimulationFunction()
%Energy wavelets
%first number is phase number @ second number is level of decomposition
%Ea energy wavelet approximate
%Ed energy wavelet detailed
%level 1
[Ea11,Ed11] = wenergy(cA1,LA1);
[Ea21,Ed21] = wenergy(cB1,LB1);
[Ea31,Ed31] = wenergy(cC1,LC1);
[Ea1,Ed1] = wenergy(cG1,LG1);
%level 2
[Ea12,Ed12] = wenergy(cA2,LA2);
[Ea22,Ed22] = wenergy(cB2,LB2);
[Ea32,Ed32] = wenergy(cC2,LC2);
%level 3
[Ea13,Ed13] = wenergy(cA3,LA3);
[Ea23,Ed23] = wenergy(cB3,LB3);
[Ea33,Ed33] = wenergy(cC3,LC3);
w1=sum(Ed11(1,:))+sum(Ed21(1,:))+sum(Ed31(1,:));
w2=sum(Ed12(1,:))+sum(Ed22(1,:))+sum(Ed32(1,:));
w3=sum(Ed13(1,:))+sum(Ed23(1,:))+sum(Ed33(1,:));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Discrete Multiresolution Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!