EN / USD
32
of 76
TEP , The Engineering Projects , Image

syedzainnasir

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
I want to be able to run this 100 times for a certain set of parameter values and take an average of the amount of groups that it produces.

Here is the code I have at the minute. Do I need to create another m file for this or can i do it within the function I've already created? [code]function [t seqBeliefs] = extendedHK(n, tol, adj) %extendedHK Summary of function goes here %Detailed explanation goes here beliefs = rand(n,1); seqBeliefs = beliefs; %NxT matrix converge = 0; step = 0 t = step while converge ~= 1 step = step+1; t = [t step]; A = zeros (n,n); for i=1:1:n for j=i:1:n if abs(beliefs(i) - beliefs(j)) < tol && adj(i,j)==1 A(j,i)=1; A(i,j)=1; end end end beliefs = A*beliefs./ sum(A,2); seqBeliefs = [seqBeliefs beliefs]; if sum(abs(beliefs - seqBeliefs(:,step)))<1e-12 converge = 1; end end plot(t,seqBeliefs) end %%in command window type adj=random_graph(n) then call extendedHK function %%with same n then tol value and 'adj'[/code]
TEP , The Engineering Projects , Icon Answer: 0 TEP , The Engineering Projects , Icon Views: 150 TEP , The Engineering Projects , Icon Followers: 85
Small Bio
TEP , The Engineering Projects , Tags
PLC
Robot
STM32
Arduino
AI
ESP32
Ladder Logic
PLC Projects
Programming
Communicates STM32
PLC Projects
Communicates PLC
Font Style
Alignment
Indenting and Lists
Insert Media
Insert Items

Want to leave an answer!

Word Count :0 Draft Saved at 12:42 am.