plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | prashanthvarma/Complex-Networks-Analysis-master | min_span_tree.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/min_span_tree.m | 1,157 | utf_8 | bcabcd05b8a4da735ddc67e60ff3ebb5 | % Prim's minimal spanning tree algorithm
% Prim's alg idea:
% start at any node, find closest neighbor and mark edges
% for all remaining nodes, find closest to previous cluster, mark edge
% continue until no nodes remain
% INPUTS: graph defined by adjacency matrix
% OUTPUTS: matrix specifying minimum spanning tree ... |
github | prashanthvarma/Complex-Networks-Analysis-master | num_conn_triples.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/num_conn_triples.m | 544 | utf_8 | 110de16713b263ee2d37f676fea0c610 | % Counts the number of connected triples in a graph
% INPUTs: adjacency matrix
% OUTPUTs: integer - num conn triples
% Other routines used: kneighbors.m, loops3.m
% Note: works for undirected graphs only
% GB, Last updated: October 9, 2009
function c=num_conn_triples(adj)
c=0; % initialize
for i=1:length(adj)
n... |
github | prashanthvarma/Complex-Networks-Analysis-master | PositiveOpinion.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/PositiveOpinion.m | 2,133 | utf_8 | 6a285739cb7fe2873603f17112b70720 | %input:adjacency matrix
%output:a vector of s1
function [s1,MaxClusterSize]=PositiveOpinion(classadj)
s1=zeros(100,1);
MaxClusterSize=zeros(100,1);
for i=1:100
%f=i*0.01;
%k=i*100;
index=randperm(10000,i*10000/100);%10000/imax
%generate opinion vector which 1 means positive, -1 means negative
op... |
github | prashanthvarma/Complex-Networks-Analysis-master | adjL2adj.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/adjL2adj.m | 343 | utf_8 | db90beccb8ed769b1516201fed70f899 | % Convert an adjacency list to an adjacency matrix
% INPUTS: adjacency list: {n}
% OUTPUTS: adjacency matrix nxn
% Note: Assume that if node i has no neighbours, L{i}=[];
% GB, Last updated: October 6, 2009
function adj=adjL2adj(adjL)
adj = zeros(length(adjL));
for i=1:length(adjL)
for j=1:length(adjL{i}); adj(i... |
github | prashanthvarma/Complex-Networks-Analysis-master | edge_betweenness.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/edge_betweenness.m | 3,838 | utf_8 | 82d506b662223f087f3105c6194d2f3b | % Edge betweenness routine, based on shortest paths
% INPUTs: edgelist, mx3, m - number of edges
% OUTPUTs: w - betweenness per edge
% Note: Valid for undirected graphs only
% Source: Newman, Girvan, "Finding and evaluating community structure in networks"
% Other routines used: adj2edgeL.m, numnodes.m, numedges.m, kne... |
github | prashanthvarma/Complex-Networks-Analysis-master | el2geom.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/el2geom.m | 1,535 | utf_8 | d1c4fe1b13a8ab684f79a13c860f6692 | % Plot geometry based on extended edgelist
% INPUTS: extended edgelist el[i,:]=[n1 n2 m x1 y1 x2 y2]
% OUTPUTS: geometry plot, higher-weight links are thicker and lighter
% Note 1: m - edge weight; (x1,y1) are the Euclidean coordinates of n1, (x2,y2) - n2 resp.
% Note 2: Easy to change colors and corresponding edge we... |
github | prashanthvarma/Complex-Networks-Analysis-master | ave_path_length.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/ave_path_length.m | 485 | utf_8 | b239a8493a131f840feeff93355722bb | % Compute average path length for a network - the average shortest path
% INPUTS: adjL - matrix of weights/distances between nodes
% OUTPUTS: average path length: the average of the shortest paths between every two edges
% Note: works for directed/undirected networks
% GB, December 8, 2005
function l = ave_path_length... |
github | prashanthvarma/Complex-Networks-Analysis-master | radial_plot.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/radial_plot.m | 3,422 | utf_8 | 871c4d0f094d2eba426fb6e795354d1e | % Plots nodes radially out from a given center. Equidistant nodes
% have the same radius, but different angles. Works best as a quick
% visualization for trees, or very sparse graphs.
% Note 1: No spring-energy method implemented.
% Note 2: If a center node is not specified, the nodes are ordered by
% sum of neighbor ... |
github | prashanthvarma/Complex-Networks-Analysis-master | isweighted.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/isweighted.m | 307 | utf_8 | 045573a6f9b4cb8c72cf9e81a45b9be7 | % Check whether a graph is weighted, i.e not all edges are 0,1.
% INPUTS: edge list, m x 3, m: number of edges, [node 1, node 2, edge weight]
% OUTPUTS: Boolean variable, yes/no
% GB, Last updated: October 1, 2009
function S=isweighted(el)
S=true;
if numel( find(el(:,3)==1) ) == size(el,1); S=false; end |
github | prashanthvarma/Complex-Networks-Analysis-master | graph_similarity.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/graph_similarity.m | 737 | utf_8 | 82376ec972ae128e0bfd27d7b48028a8 | % Computes the similarity matrix between two graphs
% Ref: "A measure of similarity between graph vertices:
% applications to synomym extraction and web searching"
% Blondel, SIAM Review, Vol. 46, No. 4, pp. 647-666
% Inputs: A, B - two graphs adjacency matrices, mxm and nxn
% Outputs: S - similarity matrix, mxn
% Last... |
github | prashanthvarma/Complex-Networks-Analysis-master | adjL2edgeL.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/adjL2edgeL.m | 272 | utf_8 | c24ec53465dbf161886a1ec25a4a3d8d | % Converts adjacency list to an edge list
% INPUTS: adjacency list
% OUTPUTS: edge list
% GB, Last Updated: October 6, 2009
function el = adjL2edgeL(adjL)
el = []; % initialize edgelist
for i=1:length(adjL)
for j=1:length(adjL{i}); el=[el; i, adjL{i}(j), 1]; end
end |
github | prashanthvarma/Complex-Networks-Analysis-master | diameter.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/diameter.m | 335 | utf_8 | d9992d55ce6f495d679b7df0cb7a76c7 | % The longest shortest path between any two nodes nodes in the network
% INPUTS: adjacency matrix, adj
% OUTPUTS: network diameter, diam
% Other routines used: simple_dijkstra.m
% GB, Last updated: June 8, 2010
function diam = diameter(adj)
diam=0;
for i=1:size(adj,1)
d=simple_dijkstra(adj,i);
diam = max([max... |
github | prashanthvarma/Complex-Networks-Analysis-master | adj2adjL.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/adj2adjL.m | 411 | utf_8 | 9dcd7d329d1123d1909bdb66ba283327 | % Converts an adjacency graph representation to an adjacency list
% Valid for a general (directed, not simple) network model, but edge
% weights get lost in the conversion.
% INPUT: an adjacency matrix, NxN, N - # of nodes
% OUTPUT: cell structure for adjacency list: x{i_1}=[j_1,j_2 ...]
% GB, October 1, 2009
function... |
github | prashanthvarma/Complex-Networks-Analysis-master | num_star_motifs.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/num_star_motifs.m | 503 | utf_8 | 0bfa482372798254d4aded546946d37e | % Calculates the number of star motifs of given (subgraph) size
% Easily extendible to return the actual stars as k-tuples of nodes
% INPUTs: adjacency matrix of original graph, k - size of the star motif
% OUTPUTs: number of stars with k nodes (k-1 spokes)
% Other routines used: degrees.m
% Note: star of size 1 is the... |
github | prashanthvarma/Complex-Networks-Analysis-master | isconnected.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/isconnected.m | 1,802 | utf_8 | d49e273550e7e55a897c208f835673ad | % Determine if a graph is connected
% INPUTS: adjacency matrix
% OUTPUTS: Boolean variable {0,1}
% Note: this only works for undirected graphs
% Idea by Ed Scheinerman, circa 2006, source: http://www.ams.jhu.edu/~ers/matgraph/
% routine: matgraph/@graph/isconnected.m
function S = is... |
github | prashanthvarma/Complex-Networks-Analysis-master | modularity_metric.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/modularity_metric.m | 1,568 | utf_8 | 072dbf35dc30ed72bebe7c8ad86361bc | % Computing the modularity for a given module/commnunity break-down
% Defined as: Q=sum_over_modules_i (eii-ai^2) (eq 5) in Newman and Girvan.
% eij = fraction of edges that connect community i to community j, ai=sum_j (eij)
% Source: Newman, M.E.J., Girvan, M., "Finding and evaluating community structure in networks"
... |
github | prashanthvarma/Complex-Networks-Analysis-master | adj2edgeL.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/adj2edgeL.m | 369 | utf_8 | 726a2ad04d68d1c368b86a70730fc234 | % Converts adjacency matrix (nxn) to edge list (mx3)
% INPUTS: adjacency matrix: nxn
% OUTPUTS: edge list: mx3
% GB, Last updated: October 2, 2009
function el=adj2edgeL(adj)
n=length(adj); % number of nodes
edges=find(adj>0); % indices of all edges
el=[];
for e=1:length(edges)
[i,j]=ind2sub([n,n],edges(e)); % node... |
github | prashanthvarma/Complex-Networks-Analysis-master | degrees.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/degrees.m | 522 | utf_8 | a84c21eaa099ed34ba358bab5707d4f5 | % Compute the total degree, in-degree and out-degree of a graph based on
% the adjacency matrix; should produce weighted degrees, if the input matrix is weighted
% INPUTS: adjacency matrix
% OUTPUTS: degree, indegree and outdegree sequences
% GB, Last Updated: October 2, 2009
function [deg,indeg,outdeg]=degrees(adj)
... |
github | prashanthvarma/Complex-Networks-Analysis-master | newmangastner.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/newmangastner.m | 1,581 | utf_8 | 2582fbfc9e5c0a7fc7ced5fdb4f27e93 | % Implements the Newman-Gastner model for spatially distributed networks
% Source: Newman, Gastner, "Shape and efficiency in spatial distribution networks"
% Note 1: minimize: wij = dij + beta x (dj0)
% Note 2: easy to change to input point coordinates, instead of generate randomly
% Inputs: n - number of points/nodes,... |
github | prashanthvarma/Complex-Networks-Analysis-master | build_smax_graph.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/build_smax_graph.m | 5,068 | utf_8 | a6dff8eceb8f3bdc1ec177b5b884a807 | % Construct the graph with the maximum possible s-metric, given the degree
% sequence; the s-metric is the sum of products of degrees across all edges
% Source: Li et al "Towards a Theory of Scale-Free Graphs"
% INPUTs: degree sequence: 1xn vector of positive integers
% OUTPUTs: edgelist of the s-max graph, mx3
% Other... |
github | prashanthvarma/Complex-Networks-Analysis-master | newman_comm_fast.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/newman_comm_fast.m | 3,479 | utf_8 | 20b8dc9e74edc11601ce79be077391d0 | % Newman fast community finding algorithm
% Source: "Fast algorithm for detecting community structure in networks", Mark Newman
% Input: adjacency matrix
% Output: group (cluster) formation over time, modularity metric for each cluster breakdown
% Other functions used: numedges.m
% Originally: June 6, 2007, GB, last mo... |
github | prashanthvarma/Complex-Networks-Analysis-master | find_conn_comp.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/find_conn_comp.m | 1,439 | utf_8 | 597d084c5e1da29ec68c8236a1ab772d | % Algorithm for finding connected components in a graph
% Valid for undirected graphs only
% INPUTS: adj - adjacency matrix
% OUTPUTS: a list of the components comp{i}=[j1,j2,...jk}
% Other routines used: find_conn_compI.m (embedded), degrees.m, kneighbors.m
% GB, Last updated: October 2, 2009
function comp_mat = fi... |
github | prashanthvarma/Complex-Networks-Analysis-master | edgeL2adjL.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/edgeL2adjL.m | 293 | utf_8 | d97fdd10c0697323ff8ad37487af389a | % Converts an edgelist to an adjacency list
% INPUTS: edgelist, (mx3)
% OUTPUTS: adjacency list
% GB, Last updated: October 13, 2006
function adjL = edgeL2adjL(el)
nodes = unique([el(:,1)' el(:,2)']);
adjL=cell(numel(nodes),1);
for e=1:size(el,1); adjL{el(e,1)}=[adjL{el(e,1)},el(e,2)]; end |
github | prashanthvarma/Complex-Networks-Analysis-master | sort_nodes_by_max_neighbor_degree.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/sort_nodes_by_max_neighbor_degree.m | 719 | utf_8 | d39339b7fdc93d005e68a337347a8432 | % Sort nodes by degree, and where there's equality, by maximum neighbor degree
% Ideas from Guo, Chen, Zhou, "Fingerprint for Network Topologies"
% INPUTS: adjacency matrix, 0s and 1s
% OUTPUTS: sorted sequence from 1 to n, where n is the number of rows/cols of the adjacency
% Other routines used: degrees.m, kneighbors... |
github | prashanthvarma/Complex-Networks-Analysis-master | kneighbors.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/kneighbors.m | 302 | utf_8 | f6202976c531ddfc15e6ef0c09c8487b | % Finds the number of k-neighbors (k links away) for every node
% INPUTS: adjacency matrix, node index, k - number of links
% OUTPUTS: vector of k-neighbors indices
% GB, May 3, 2006
function kneigh = kneighbors(adj,ind,k)
adjk = adj;
for i=1:k-1; adjk = adjk*adj; end;
kneigh = find(adjk(ind,:)>0); |
github | prashanthvarma/Complex-Networks-Analysis-master | leaf_edges.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/leaf_edges.m | 793 | utf_8 | 84d28c1ef0b1e3c6405eb1a6ee1ae2d3 | % Return the leaf edges of the graph: edges with one adjacent edge only
% Leaf edges have only one associated leaf node, otherwise they are single floating disconnected edges.
% Assumptions:
% Note 1: For a directed graph, leaf edges are those that "flow into" the leaf node
% Note 2: There could be other definitions o... |
github | prashanthvarma/Complex-Networks-Analysis-master | symmetrize_edgeL.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/symmetrize_edgeL.m | 458 | utf_8 | 12ea5e1060cfe27d9bf1fefc90387211 | % Making an edgelist (representation of a graph) symmetric
% INPUTs: edge list, mx3
% OUTPUTs: symmetrized edge list, mx3
% GB, Last updated: October 8, 2009
function el=symmetrize_edgeL(el)
el2=[el(:,1), el(:,2)];
for e=1:size(el,1)
ind=ismember(el2,[el2(e,2),el2(e,1)],'rows');
if sum(ind)==0; el=[el; el(e,... |
github | prashanthvarma/Complex-Networks-Analysis-master | exponential_growth_model.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/exponential_growth_model.m | 400 | utf_8 | fa00cfdcbd1094d56edc596cd6d51c70 | % Grow a network exponentially
% Probability of node s having k links at time t: p(k,s,t)=1/t*p(k-1,s,t-1)+(1-1/t)*p(k,s,t-1)
% INPUTS: number of time-steps, t
% OUTPUTs: edgelist, mx3
% GB, Last Updated: May 7, 2007
function el=exponential_growth_model(t)
el=[1 2 1; 2 1 1]; % initialize with two connected nodes
% f... |
github | prashanthvarma/Complex-Networks-Analysis-master | algebraic_connectivity.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/algebraic_connectivity.m | 231 | utf_8 | ba65837e861918e4286675151c56ade4 | % The algebraic connectivity of a graph: the second smallest eigenvalue of the Laplacian
% INPUTs: adjacency matrix
% OUTPUTs: algebraic connectivity
function a=algebraic_connectivity(adj)
s=graph_spectrum(adj);
a=s(length(s)-1); |
github | prashanthvarma/Complex-Networks-Analysis-master | clust_coeff.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/clust_coeff.m | 1,124 | utf_8 | 20e886d07c2c892456520f77f896ecfb | % Computes clustering coefficient, based on triangle motifs count and local clustering
% C1 = num triangle loops / num connected triples
% C2 = the average local clustering, where Ci = (num triangles connected to i) / (num triples centered on i)
% Ref: M. E. J. Newman, "The structure and function of complex networks"
%... |
github | prashanthvarma/Complex-Networks-Analysis-master | random_directed_graph.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/random_directed_graph.m | 517 | utf_8 | 7034a164931ad3a7fa080bad05b24700 | % Random directed graph construction
% INPUTS: N - number of nodes
% p - probability, 0<=p<=1
% Output: adjacency matrix
% Note 1: if p is omitted, p=0.5 is default
% Note 2: no self-loops, no double edges
function adj = random_directed_graph(n,p)
adj=zeros(n); % initialize adjacency matrix
if nargin==1; p... |
github | prashanthvarma/Complex-Networks-Analysis-master | getNodes.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/getNodes.m | 827 | utf_8 | 694eae7aaa73f6b7cd39bfb6dba871cb | % return the list of nodes for varying representation types
% inputs: graph structure (matrix or cell or struct) and type of structure
% (string)
% 'type' can be: 'adj','edgelist','adjlist' (neighbor list),'inc' (incidence matrix)
% Note 1: only the edge list allows/returns non-consecutive node indexing
% Note 2: no bu... |
github | prashanthvarma/Complex-Networks-Analysis-master | inc2edgeL.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/inc2edgeL.m | 728 | utf_8 | 7c48b8c1258857df4d649e6a2b228e89 | % Converts an incidence matrix to an edgelist
% inputs: inc - incidence matrix nxm
% outputs: edgelist - mx3
% GB, Last Updated: June 9, 2006
function el = inc2edgeL(inc)
m = size(inc,2); % number of edges
el = zeros(m,3); % initialize edgelist [n1, n2, weight]
for e=1:m
ind_m1 = find(inc(:,e)==-1);
ind_p1 =... |
github | prashanthvarma/Complex-Networks-Analysis-master | newmangirvan.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/newmangirvan.m | 2,125 | utf_8 | b1556f5556916ea96807d0dd28fddd5b | % Newman-Girvan community finding algorithm
% source: Newman, M.E.J., Girvan, M., "Finding and evaluating community structure in networks"
% Algorithm idea:
% 1. Calculate betweenness scores for all edges in the network.
% 2. Find the edge with the highest score and remove it from the network.
% 3. Recalculate betweenn... |
github | prashanthvarma/Complex-Networks-Analysis-master | issimple.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/issimple.m | 352 | utf_8 | 09055a7694198df590b61fe1f64a5735 | % Checks whether a graph is simple (no self-loops, no multiple edges)
% INPUTs: adj - adjacency matrix
% OUTPUTs: S - a Boolean variable
% Other routines used: selfloops.m, multiedges.m
% GB, Last updated: October 1, 2009
function S = issimple(adj)
S=true;
% check for self-loops or double edges
if selfloops(adj)>0 |... |
github | prashanthvarma/Complex-Networks-Analysis-master | simple_spectral_partitioning.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/simple_spectral_partitioning.m | 1,172 | utf_8 | 14c411516a8e06f3365e7093f80921ef | % Uses the fiedler vector to assign nodes to groups
% INPUTS: adj - adjancency matrix, k - desired number of nodes in groups [n1, n2, ..], [optional]
% OUTPUTs: modules - [k] partitioned groups of nodes
% Other functions used: fiedler_vector.m
function modules = simple_spectral_partitioning(adj,k)
% find the Fiedler ... |
github | prashanthvarma/Complex-Networks-Analysis-master | selfloops.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/selfloops.m | 197 | utf_8 | 8e4f475bc083530b62ca862f89163fd6 | % counts the number of self-loops in the graph
% INPUT: adjacency matrix
% OUTPUT: interger, number of self-loops
% Last Updated: GB, October 1, 2009
function sl=selfloops(adj)
sl=sum(diag(adj)); |
github | prashanthvarma/Complex-Networks-Analysis-master | draw_circ_graph.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/draw_circ_graph.m | 796 | utf_8 | d4a699654578af95523d415a96313ec3 | % Draw a circular graph with links and nodes in order of degree
% Strategy: position vertices in a regular n-polygon
% INPUTs: adj - adjacency matrix
% OUTPUTs: a figure
% Other routines used: degrees.m
% GB, February 21, 2006
function [] = draw_circ_graph(adj)
n = size(adj,1); % number of nodes
[degs,~,~]=degrees(ad... |
github | prashanthvarma/Complex-Networks-Analysis-master | path_histogram.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/custom/path_histogram.m | 2,057 | utf_8 | 8ba677da99d2a4a4e26d41487c0ea5db | function [l c] = path_histogram(G,varargin)
% PATH_HISTOGRAM Compute a histogram of all shortest paths in graph G
%
% [l c] = path_histogram(G) computes all shortest paths in A one at a time
% and forms the histogram of the shortest distances between all vertices.
%
% [l c] = path_histogram(G,struct('sample',N)) uses... |
github | prashanthvarma/Complex-Networks-Analysis-master | bacon_numbers.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/examples/bacon_numbers.m | 912 | utf_8 | 640ffeda3bf059842e10b5e204d99888 | function bn = bacon_numbers(A,u)
% BACON_NUMBERS Compute the Bacon numbers for a graph.
%
% bn = bacon_numbers(A,u) computes the Bacon numbers for all nodes in the
% graph assuming that Kevin Bacon is node u.
% allocate storage for the bacon numbers
% the ipdouble call allocates storage that can be modified in place.... |
github | prashanthvarma/Complex-Networks-Analysis-master | rtest_1.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/test/rtest_1.m | 1,767 | utf_8 | 591edf7b20b839883d608054412f6829 | function rval=rtest_1()
n = 49;
[A,b] = testmat(n,2);
x0 = [1:n]'/(n+1);
y0 = [1:n]'/(n+1);
x = repmat(x0,1,n);
y = repmat(y0',n,1);
xy = [x(:),y(:)];
rval = 0;
try
T = mst(A);
T = T + diag(diag(A));
rval = 1;
catch
lasterr
end;
try
A(1,2)= -1;
A(2,1)= -1;
T = prim_mst(A);
rval ... |
github | prashanthvarma/Complex-Networks-Analysis-master | rtest_6.m | .m | Complex-Networks-Analysis-master/Assignment/Exercise 5/Code/test/rtest_6.m | 609 | utf_8 | eb8fb5b91bb3daf03c595491cc14de96 | function rval = rtest_6()
rval = 0;
try
% create a line graph
n = 10;
A = sparse(1:n-1,2:n,1,n,n);
A = A+A';
u = 1;
v = 5;
d = dist_uv(A,u,v);
if any(d(v+1:end) > 0)
error('breadth_first_search did not stop correctly');
end
rval = 1;
catch
lasterr
end
end... |
github | jeholmes/MATLAB-CSS-master | findendsjunctions.m | .m | MATLAB-CSS-master/findendsjunctions.m | 3,885 | utf_8 | 1c766254222e0b8fd5326786249247bf | % FINDENDSJUNCTIONS - find junctions and endings in a line/edge image
%
% Usage: [rj, cj, re, ce] = findendsjunctions(edgeim, disp)
%
% Arguments: edgeim - A binary image marking lines/edges in an image. It is
% assumed that this is a thinned or skeleton image
% disp - An optional... |
github | jeholmes/MATLAB-CSS-master | findisolatedpixels.m | .m | MATLAB-CSS-master/findisolatedpixels.m | 1,342 | utf_8 | e3a3768f5d589a865aa10a992e5197e2 | % FINDENDSJUNCTIONS - find isolated pixels in a binary image
%
% Usage: [r, c] = findisolatedpixels(b)
%
% Argument: b - A binary image
%
% Returns: r, c - Row and column coordinates of isolated pixels in the
% image.
%
% See also: FINDENDSJUNCTIONS
%
% Copyright (c) 2013 Peter Kovesi
% C... |
github | jeholmes/MATLAB-CSS-master | filledgegaps.m | .m | MATLAB-CSS-master/filledgegaps.m | 3,911 | utf_8 | f36cafd2cfd5507602b58f0ebfc6f549 | % FILLEDGEGAPS Fills small gaps in a binary edge map image
%
% Usage: bw2 = filledgegaps(bw, gapsize)
%
% Arguments: bw - Binary edge image
% gapsize - The edge gap size that you wish to be able to fill.
% Use the smallest value you can. (Odd values work best).
%
% Returns: bw2 - Th... |
github | jeholmes/MATLAB-CSS-master | edgelink.m | .m | MATLAB-CSS-master/edgelink.m | 21,107 | utf_8 | 25bee720223bdbc51946de674aa2d085 | % EDGELINK - Link edge points in an image into lists
%
% Usage: [edgelist edgeim, etypr] = edgelink(im, minlength, location)
%
% **Warning** 'minlength' is ignored at the moment because 'cleanedgelist'
% has some bugs and can be memory hungry
%
% Arguments: im - Binary edge image, it is assu... |
github | jeholmes/MATLAB-CSS-master | circularstruct.m | .m | MATLAB-CSS-master/circularstruct.m | 648 | utf_8 | aec494462bd52689db93faf1d6a9ea60 | % CIRCULARSTRUCT
%
% Function to construct a circular structuring element
% for morphological operations.
%
% function strel = circularstruct(radius)
%
% Note radius can be a floating point value though the resulting
% circle will be a discrete approximation
%
% Peter Kovesi March 2000
function strel = circularstruc... |
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | H.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/H.m | 253 | utf_8 | 69037274b5c88c309c5e6a422eb65b13 |
function H = H(q,d,l,a)
H =[cos(q), -sin(q)*cos(a), sin(q)*sin(a), l*cos(q);
sin(q), cos(q)*cos(a), -cos(q)*sin(a), l*sin(q);
0 , sin(a), cos(a), d;
0 , 0, 0, 1];
end |
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | Correct_robot.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationMCG DeanParam/Correct_robot.m | 179 | utf_8 | a70433b86693300d384f3b34114bce2d | %This file was automatically generated by --Generate_RobotPlot--
function Qc=Correct_robot(u)
Qc(1)=u(1)+0;
Qc(2)=u(2)+0;
Qc(3)=u(3)+0;
Qc(4)=u(4)+0;
Qc(5)=u(5)+0;
Qc(6)=u(6)+0;
|
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | Dinamic_robot.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationMCG DeanParam/Dinamic_robot.m | 323,720 | utf_8 | a3f5d4da53c775a38c82fd8ec9bb927d | %This file was atutomatically generated by --Generate_Dinamic--
%the input vector is:
%u=[q1 q2 q3 qp4 qp5 qp6 l1 l2 l3 ]
%NOTE: The function --Genera_Robot_robot_Exe-- must be executed
%before running the simulink-simulator for the first time
function Qpp=Dinamic_robot(u)
%Joint Position
q1=u(1);
q2=u(2);
q3=u(3);
q4... |
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | H.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationMCG DeanParam/H.m | 300 | utf_8 | 5cce7c8bf0f7bcacfda8c2b5ae963fb9 | %%computer homogeneous transformation matrix
function H = H(q,d,l,a)
H =[cos(q), -sin(q)*cos(a), sin(q)*sin(a), l*cos(q);
sin(q), cos(q)*cos(a), -cos(q)*sin(a), l*sin(q);
0 , sin(a), cos(a), d;
0 , 0, 0, 1];
end
|
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | Correct_robot.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationMVG/Correct_robot.m | 179 | utf_8 | a70433b86693300d384f3b34114bce2d | %This file was automatically generated by --Generate_RobotPlot--
function Qc=Correct_robot(u)
Qc(1)=u(1)+0;
Qc(2)=u(2)+0;
Qc(3)=u(3)+0;
Qc(4)=u(4)+0;
Qc(5)=u(5)+0;
Qc(6)=u(6)+0;
|
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | Dinamic_robot.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationMVG/Dinamic_robot.m | 323,946 | utf_8 | 63996ceaed63fae0e23b20c97e2daace | %This file was atutomatically generated by --Generate_Dinamic--
%the input vector is:
%u=[q1 q2 q3 qp4 qp5 qp6 l1 l2 l3 ]
%NOTE: The function --Genera_Robot_robot_Exe-- must be executed
%before running the simulink-simulator for the first time
function Qpp=Dinamic_robot(u)
%Joint Position
q1=u(1);
q2=u(2);
q3=u(3);
q4... |
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | H.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationMVG/H.m | 300 | utf_8 | 5cce7c8bf0f7bcacfda8c2b5ae963fb9 | %%computer homogeneous transformation matrix
function H = H(q,d,l,a)
H =[cos(q), -sin(q)*cos(a), sin(q)*sin(a), l*cos(q);
sin(q), cos(q)*cos(a), -cos(q)*sin(a), l*sin(q);
0 , sin(a), cos(a), d;
0 , 0, 0, 1];
end
|
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | Correct_robot.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationRegressor/Correct_robot.m | 179 | utf_8 | a70433b86693300d384f3b34114bce2d | %This file was automatically generated by --Generate_RobotPlot--
function Qc=Correct_robot(u)
Qc(1)=u(1)+0;
Qc(2)=u(2)+0;
Qc(3)=u(3)+0;
Qc(4)=u(4)+0;
Qc(5)=u(5)+0;
Qc(6)=u(6)+0;
|
github | mahmoudakl/Robot-Kinematic-and-Dynamic-Modeling-master | H.m | .m | Robot-Kinematic-and-Dynamic-Modeling-master/SimulationRegressor/H.m | 300 | utf_8 | 5cce7c8bf0f7bcacfda8c2b5ae963fb9 | %%computer homogeneous transformation matrix
function H = H(q,d,l,a)
H =[cos(q), -sin(q)*cos(a), sin(q)*sin(a), l*cos(q);
sin(q), cos(q)*cos(a), -cos(q)*sin(a), l*sin(q);
0 , sin(a), cos(a), d;
0 , 0, 0, 1];
end
|
github | GerardBoberg/MethodOfCharacteristics-master | moc_wall_backsolve.m | .m | MethodOfCharacteristics-master/moc_solver/moc_wall_backsolve.m | 2,680 | utf_8 | 1d54f64acaaa5a4831b8fda2879a61be | function [ x3, y3, slope3, Mach3 ] = moc_wall_backsolve( data_1, data_2,...
f_wall, f_wall_der,...
x_star, y_star )
%MOC_WALL_POINT Summary of this function goes here
% Detailed explanation goes here
global gamma;
% Assume ... |
github | GerardBoberg/MethodOfCharacteristics-master | moc_interior_point.m | .m | MethodOfCharacteristics-master/moc_solver/moc_interior_point.m | 3,244 | utf_8 | 266300682c58212cc1512048eefa127f | function [ x3, y3, slope3, Mach3 ] = moc_interior_point( data_1, data_2 )
%MOC_INTERIOR_POINT Summary of this function goes here
% Detailed explanation goes here
global gamma;
% Assume -- Data_1 is above, Data_2 is below
%
% 1 o
% \
% o 3
% /
% /
% 2 o
%% Extract data from t... |
github | GerardBoberg/MethodOfCharacteristics-master | flowprandtlmeyer.m | .m | MethodOfCharacteristics-master/moc_solver/flowprandtlmeyer.m | 12,673 | utf_8 | 556a83e31f1f4625d964de0c6beaf50f | function [mach, nu, mu] = flowprandtlmeyer(gamma, varargin)
%FLOWPRANDTLMEYER Calculate Prandtl-Meyer functions for expansion waves
% [MACH, NU, MU] = FLOWPRANDTLMEYER(GAMMA, VAR, MTYPE) computes an array
% of Mach numbers, MACH, Prandtl-Meyer angles, NU in degrees, and Mach
% angles, MU in degrees. FLOWPRANDTL... |
github | GerardBoberg/MethodOfCharacteristics-master | moc_wall_point.m | .m | MethodOfCharacteristics-master/moc_solver/moc_wall_point.m | 1,737 | utf_8 | 9569ac10a7634f7c367e70bb2813e84f | function [ x3, y3, slope3, Mach3 ] = moc_wall_point( data_1,...
f_wall, f_wall_der, x_star )
%MOC_WALL_POINT Summary of this function goes here
% Detailed explanation goes here
global gamma;
% Assume -- Data_1 is below
% -------
% ---o-- 3
% ----... |
github | christophernhill/gmao_mitgcm_couplng-master | griddata_fast.m | .m | gmao_mitgcm_couplng-master/matlab/griddata_fast.m | 1,493 | utf_8 | 061a90829321a2f3a5e863cbfb3af1e5 | function zi = griddata_fast(delau,z,method)
%GRIDDATA_FAST Data gridding and surface fitting.
% ZI = GRIDDATA_FAST(DEL,Z)
%
% See also GRIDDATA_PREPROCESS
% Based on
% Clay M. Thompson 8-21-95
% Copyright 1984-2001 The MathWorks, Inc.
% $Revision: 1.2 $ $Date: 2007/02/17 23:49:43 $
% $Header: /u/gcmpack... |
github | christophernhill/gmao_mitgcm_couplng-master | rdmds.m | .m | gmao_mitgcm_couplng-master/matlab/rdmds.m | 15,833 | utf_8 | c708ef0d0c7d006ae6df82ffb2f7bc49 | function [AA,itrs,MM] = rdmds(fnamearg,varargin)
% RDMDS Read MITgcmUV meta/data files
%
% A = RDMDS(FNAME)
% A = RDMDS(FNAME,ITER)
% A = RDMDS(FNAME,[ITER1 ITER2 ...])
% A = RDMDS(FNAME,NaN)
% A = RDMDS(FNAME,Inf)
% [A,ITS,M] = RDMDS(FNAME,[...])
% A = RDMDS(FNAME,[...],'rec',RECNUM)
%
% A = RDMDS(FNAME) reads data... |
github | christophernhill/gmao_mitgcm_couplng-master | griddata_preprocess.m | .m | gmao_mitgcm_couplng-master/matlab/griddata_preprocess.m | 3,065 | utf_8 | 1cd5b54ac7fbd6eabbc3b6d707bff724 | function [del] = griddata_preprocess(x,y,xi,yi,method)
%GRIDDATA_PREPROCESS Pre-calculate Delaunay triangulation for use
% with GRIDDATA_FAST.
%
% DEL = GRIDDATA_PREPROCESS(X,Y,XI,YI)
% Based on
% Clay M. Thompson 8-21-95
% Copyright 1984-2001 The MathWorks, Inc.
% $Revision: 1.4 $ $Date: 2013/07/11 12:4... |
github | MarcBS/Object-Detection-CNN-master | VOCap.m | .m | Object-Detection-CNN-master/Results_Evaluation/VOCap.m | 315 | utf_8 | f169ec8ebba51ec359b72ae284a85a85 | % This code was originally written and distributed as part of the
% PASCAL VOC challenge
function ap = VOCap(rec,prec)
mrec=[0 ; rec ; 1];
mpre=[0 ; prec ; 0];
for i=numel(mpre)-1:-1:1
mpre(i)=max(mpre(i),mpre(i+1));
end
i=find(mrec(2:end)~=mrec(1:end-1))+1;
ap=sum((mrec(i)-mrec(i-1)).*mpre(i));
|
github | MarcBS/Object-Detection-CNN-master | prepare_batch2.m | .m | Object-Detection-CNN-master/Utils/prepare_batch2.m | 2,669 | utf_8 | 97bf0b700872d16d401c1b738a9cbab2 | % ------------------------------------------------------------------------
function images = prepare_batch2(image_files,imgs_loaded, parallel,IMAGE_MEAN,batch_size)
% ------------------------------------------------------------------------
if nargin < 2
imgs_loaded = false;
end
if nargin < 3
parallel = true;
e... |
github | jojo-/PTSim-master | gui_stop.m | .m | PTSim-master/post processing/gui_stop.m | 5,190 | utf_8 | 0b625d2a4fd4a70aaa096f06993c9b23 | function varargout = gui_stop(varargin)
%GUI_STOP M-file for gui_stop.fig
% GUI_STOP, by itself, creates a new GUI_STOP or raises the existing
% singleton*.
%
% H = GUI_STOP returns the handle to a new GUI_STOP or the handle to
% the existing singleton*.
%
% GUI_STOP('Property','Value',... |
github | jojo-/PTSim-master | csvwrite_with_headers.m | .m | PTSim-master/post processing/csvwrite_with_headers.m | 1,845 | utf_8 | 952e9d8f606152e35d596418f828f354 | % This function functions like the build in MATLAB function csvwrite but
% allows a row of headers to be easily inserted
%
% known limitations
% The same limitation that apply to the data structure that exist with
% csvwrite apply in this function, notably:
% m must not be a cell array
%
% Inputs
%
% fil... |
github | optas/FmapLib-master | Laplace_Beltrami.m | .m | FmapLib-master/src/Mesh/Laplace_Beltrami.m | 7,896 | utf_8 | 61ff880bed0f13e0ddc0e5ee3258ba39 | classdef Laplace_Beltrami < Basis
% A class representing the cotangent discretization of the Laplace Beltrami operator, associated with a given
% object of the class Mesh.
%
% (c) Achlioptas, Corman, Guibas - 2015 - http://www.fmaplib.org
properties (GetAccess = public, SetAccess = private)
... |
github | optas/FmapLib-master | Laplacian.m | .m | FmapLib-master/src/Graphs/Laplacian.m | 8,819 | utf_8 | 99d436c5815a0adc567ca8ec0db2204c | classdef Laplacian < Basis
% All the goodies around the Laplacian of a graph.
%
% (c) Achlioptas, Corman, Guibas - 2015 - http://www.fmaplib.org
properties (SetAccess = public) % TODO turn back to private/immutable.
L; % (n x n) The Laplacian matrix.
type; %... |
github | optas/FmapLib-master | rdir.m | .m | FmapLib-master/src/External_Code/Enhanced_rdir/rdir.m | 12,435 | utf_8 | 04112133f25d66e254ca35af639d4281 | function [varargout] = rdir(rootdir,varargin)
% RDIR - Recursive directory listing
%
% D = rdir(ROOT)
% D = rdir(ROOT, TEST)
% D = rdir(ROOT, TEST, RMPATH)
% D = rdir(ROOT, TEST, 1)
% D = rdir(ROOT, '', ...)
% [D, P] = rdir(...)
% rdir(...)
%
%
% *Inputs*
%
% * ROOT
%
% rdir(ROOT) lists the spec... |
github | optas/FmapLib-master | dijkstra_pairs.m | .m | FmapLib-master/src/External_Code/Geodesics/dijkstra_pairs.m | 715 | utf_8 | 4305e5e7587e4058e556c6a426b137b6 | % Function to compute the geodesic distances on a shape between a set of
% pairs of vertices using Dijkstra's algorithm.
% Pairs must be given as a Nx2 matrix, where each row
% represents a pair vid1, vid2 to compute the distance.
%
% NOTE: vertex ids start at 1 (Matlab-style), NOT at 0 (C++ style).
%
% Output: a Nx... |
github | optas/FmapLib-master | geodesics_pairs.m | .m | FmapLib-master/src/External_Code/Geodesics/geodesics_pairs.m | 710 | utf_8 | e16af912acd8dd4b7f41a6d0aa3b05b1 | % Function to compute the geodesic distances on a shape between a set of
% pairs of vertices. Pairs must be given as a Nx2 matrix, where each row
% represents a pair vid1, vid2 to compute the distance.
%
% NOTE: vertex ids start at 1 (Matlab-style), NOT at 0 (C++ style).
%
% Output: a Nx1 matrix of geodesic distances... |
github | optas/FmapLib-master | Test_Mesh_Features.m | .m | FmapLib-master/src/Unit_Tests/Test_Mesh_Features.m | 7,913 | utf_8 | 02afbe772c1de892838b9f1649bc669f | classdef Test_Mesh_Features < matlab.unittest.TestCase
% Unit test verifying the expected behavior and functionality of the
% class 'Mesh_Features'.
%
% Usage Example:
% test1 = Test_Mesh_Features();
% test1.initialize_mesh_and_LB();
% test1.test_... |
github | aanish94/Particle_Collision-master | Reverse_Velocity.m | .m | Particle_Collision-master/Reverse_Velocity.m | 1,552 | utf_8 | fc1d18c5ee30b2eb74bbdfff81f973d2 | % %INPUT: POSITIONS and VELOCITIES (X & Y) of BOTH PARTICLES and if INELASTIC
function [v1x_after,v2x_after,v1y_after,v2y_after] = Reverse_Velocity(first,second,inelastic,e)
%Position and Velocity of Particle 1
px1 = first.x;
py1 = first.y;
v1x = first.vx;
v1y = first.vy;
m1 = first.m;
%Position and Velocity of Parti... |
github | dimme/cost2100model-master | get_para.m | .m | cost2100model-master/matlab/get_para.m | 21,946 | utf_8 | 3de3dba31676db027b4de1730baf0457 | function [paraEx paraSt] = get_para(network,scenario,Nlink,Band,freq,snapRate, snapNum, posBS,posMS,veloMS)
%GET_PARA Generate the external and stochastic parameters of the scenario
%Default call: [paraEx paraSt] = get_para(network,scenario,Nlink,freq,snapRate, snapNum,
%posBS,posMS,veloMS)
%
%------
%Input:
%--... |
github | dimme/cost2100model-master | get_cluster.m | .m | cost2100model-master/matlab/get_cluster.m | 9,645 | utf_8 | a63fc8e3a33881a2188999b4289ce757 | function cluster = get_cluster( VR, VRtable, paraEx, paraSt )
%GET_CLUSTER function to generate the cluster
%Default call: VR = get_VR( VR, VRtable, paraEx, paraSt)
%------
%Input:
%------
%paraEx,paraSt: external parameters and stochastic parameters
%VRtable: VR assignment table
%VR: VR distribution
%------
%Output:
%... |
github | mathor/book-master | ns.m | .m | book-master/MCM2014A/CA-NS-doublelanes/ns.m | 5,573 | utf_8 | e5bed48e7d446d88cf76fd39bb832b20 | function [rho, flux, vmean] = ns(rho, p, L, tmax, animation, spacetime)
%
% NS: This script implements the Nagel Schreckenberg cellular automata based
% traffic model. Car move forward governed by NS algorithm:
%
% 1. Acceleration. If the vehicle can speed up without hitting the speed
% limit vmax it will add ... |
github | mathor/book-master | ns.m | .m | book-master/MCM2014A/CA-NS-singlelane/ns.m | 3,696 | utf_8 | 4aec317dbd7b525e15c5c91ca8dc4975 | function [rho, flux, vmean] = ns(rho, p, L, tmax, animation, spacetime)
%
% NS: This script implements the Nagel Schreckenberg cellular automata based
% traffic model. Car move forward governed by NS algorithm:
%
% 1. Acceleration. If the vehicle can speed up without hitting the speed
% limit vmax it will add ... |
github | mathor/book-master | nsacdnt.m | .m | book-master/MCM2014A/CA-NS-singlelane/nsacdnt.m | 4,872 | utf_8 | 35c775eb5724bcb2fca25c316cdcff9f | function [rho, flux, vmean, Nacdnts] = nsacdnt(rho, p, L, tmax, animation, spacetime)
%
% NS: This script implements the Nagel Schreckenberg cellular automata based
% traffic model. Car move forward governed by NS algorithm:
%
% 1. Acceleration. If the vehicle can speed up without hitting the speed
% limit vma... |
github | mathor/book-master | distancematrix.m | .m | book-master/HA/TSP(GA)/distancematrix.m | 883 | utf_8 | 1e2d36405073bd86e4af83903a01299b | function dis = distancematrix(city)
% DISTANCEMATRIX
% dis = DISTANCEMATRIX(city) return the distance matrix, dis(i,j) is the
% distance between city_i and city_j
numberofcities = length(city);
R = 6378.137; % The radius of the Earth
for i = 1:numberofcities
for j = i+1:numberofcities
dis(i,j) = distance(... |
github | mathor/book-master | distancematrix.m | .m | book-master/HA/TSP(SA)/distancematrix.m | 883 | utf_8 | 1e2d36405073bd86e4af83903a01299b | function dis = distancematrix(city)
% DISTANCEMATRIX
% dis = DISTANCEMATRIX(city) return the distance matrix, dis(i,j) is the
% distance between city_i and city_j
numberofcities = length(city);
R = 6378.137; % The radius of the Earth
for i = 1:numberofcities
for j = i+1:numberofcities
dis(i,j) = distance(... |
github | mathor/book-master | ns.m | .m | book-master/CA/ns.m | 3,836 | utf_8 | a92c5bfdb44c66416e5c4099d6e56d82 | function [rho, flux, vmean] = ns(rho, p, L, tmax, animation, spacetime)
%
% NS: This script implements the Nagel Schreckenberg cellular automata based
% traffic model. Car move forward governed by NS algorithm:
%
% 1. Acceleration. If the vehicle can speed up without hitting the speed
% limit vmax it will add ... |
github | mathor/book-master | ns.m | .m | book-master/CA/CA-NS-multilanes/ns.m | 5,979 | utf_8 | 6df371a701576c32fa66c78aba00c413 | function [rho, flux, vmean] = ns(rho, p, L, tmax, animation, spacetime)
%
% NS: This script implements the Nagel Schreckenberg cellular automata based
% traffic model. Car move forward governed by NS algorithm:
%
% 1. Acceleration. If the vehicle can speed up without hitting the speed
% limit vmax it will add ... |
github | mathor/book-master | ns.m | .m | book-master/CA/CA-NS-singlelane/ns.m | 3,696 | utf_8 | 4aec317dbd7b525e15c5c91ca8dc4975 | function [rho, flux, vmean] = ns(rho, p, L, tmax, animation, spacetime)
%
% NS: This script implements the Nagel Schreckenberg cellular automata based
% traffic model. Car move forward governed by NS algorithm:
%
% 1. Acceleration. If the vehicle can speed up without hitting the speed
% limit vmax it will add ... |
github | sods/bcm-master | dembcm.m | .m | bcm-master/dembcm.m | 7,382 | utf_8 | 33436707dd8d9b814aa65de29ee3e1d2 | function dembcm()
% dembcm - Demo program for BCM approximation for large scale GP regression
%
% Synopsis:
% dembcm;
%
% Description:
% This routine demonstrates how the provided routines for the Bayesian
% Committee Machine can be used for analyzing data
% Basic steps are
% - Generate a data set (linear com... |
github | rb643/fieldtrip_restingState-master | rb_EEG_Network.m | .m | fieldtrip_restingState-master/rb_EEG_Network.m | 8,754 | utf_8 | 02899949f0e5d2836b0947fbd75307b5 | % function to compute various BCT/graph metric on a set of adjacency matrices
function [Results] = rb_EEG_Network(matrices, subids, path2save, step, costlimit, nRand, prefix, TAKEABS)
% matrices - 3D matrix of subs*nodes*nodes
% subids - list of subject ID's (or filenames)
% path2save ... |
github | rb643/fieldtrip_restingState-master | rb_makeSymmetric.m | .m | fieldtrip_restingState-master/rb_makeSymmetric.m | 919 | utf_8 | 756541b7390bcddf141f00604e8128a4 | %% simple function to ensure an adjacency matrix is symmetric and absolute
%% occasionally corrcoef will give some rounding error
%% this prevents creating a sparse matrix needed to compute the minimal spanning tree
function [Out] = rb_makeSymmetric(In)
dwt = In;
%symmetry
disp(sprintf('Making correlation mat... |
github | rb643/fieldtrip_restingState-master | rb_EEG_Conn.m | .m | fieldtrip_restingState-master/rb_EEG_Conn.m | 5,939 | utf_8 | 57c8f7d36db6f3188c0391128c957310 | %% standard functions to load preprocessed fieldtrip mat-files and create WPLI matrices
function [] = rb_EEG_Conn(directory, Example_figure)
epochLength = 4;
cd(directory);
subs = ls('*.mat');
nsubs = size(subs,1);
if exist('subids.mat','file')==2
disp('Output folder exists');
load('subids.mat')
else
disp... |
github | rb643/fieldtrip_restingState-master | permutation_2tailed.m | .m | fieldtrip_restingState-master/Scripts/permutation_2tailed.m | 693 | utf_8 | ad10cd554bbb1012df9d7c3ad4ff5234 | % permutation testing
function [pval] = permutation_2tailed(Control,Case,n)
% Control is a vector of values for controls that you'd like to compare to
% a vector of values from cases (called Case).
% n is the number of permutations you'd like to do. This should be at least
% 1000 usually.
% the output pval is the p... |
github | mattpitkin/matlabmultinest-master | mchol.m | .m | matlabmultinest-master/src/mchol.m | 3,726 | utf_8 | db92b557d0cdfdad0fb8faf990a0099b | %
% [L,D,E,pneg]=mchol(G)
%
% Given a symmetric matrix G, find a matrix E of "small" norm and c
% L, and D such that G+E is Positive Definite, and
%
% G+E = L*D*L'
%
% Also, calculate a direction pneg, such that if G is not PD, then
%
% pneg'*G*pneg < 0
%
% Note that if G is PD, then the routine will re... |
github | wilsonsws/CSMA-CA_for_Linear_VANET_Matlab-master | carInfmatrixGen.m | .m | CSMA-CA_for_Linear_VANET_Matlab-master/carInfmatrixGen.m | 545 | utf_8 | 7e2acbf3dad822162a6aa3bcb82ab4fb | % this file is used to calculate interference between cars
%
function carInfmat = carInfmatrixGen(carDistriArray,effectiveRange)
row_number = length(carDistriArray) - 1;
carInfmat = zeros(row_number,row_number);
eps = 10^(-11);
for row = 1:row_number
for col = 1:row_number
distance = abs(carDistriArray(col+... |
github | ambarpal/3d-hough-master | veronese.m | .m | 3d-hough-master/code/vidal/GPCA/helper_functions/veronese.m | 1,128 | utf_8 | 95596f36a5d297adbd53de31e65b6bfa | % [y,powers] = veronese(x,n,scale,powers)
% Computes the Veronese map of degree n, that is all
% the monomials of a certain degree.
% x is a K by N matrix, where K is dimension and N number of points
% y is a K by Mn matrix, where Mn = nchoosek(n+K-1,n)
% powes is a K by Mn matrix with the exponent ... |
github | ambarpal/3d-hough-master | spectralcluster.m | .m | 3d-hough-master/code/vidal/GPCA/helper_functions/spectralcluster.m | 901 | utf_8 | 6c207c891257ca85c7c0c93d6c3504c6 | %function [diagMat,LMat,X,Y,IDX,errorsum]= spectralcluster(affMat,k,num_class)
% Implements the spectral clustering algorithm from Ng et al.
% Inputs
% affmat is the affinity matrix A
% k is the number of largest eigenvectors in matrix L
% num_class is the number of classes
% Outputs
% diagmat is the diagonal m... |
github | ambarpal/3d-hough-master | cheegerpartition.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/cheegerpartition.m | 540 | utf_8 | 805fd3f3628a368e8e290d864080c6c7 | %evaluates the cheeger constant for a given partition
function h=cheegerpartition(group,simMat);
d=sum(simMat,2); %grade of each node (sum of distances on the row)
[IcutA,IcutB]=meshgrid(group-1,2-group); %bool that indicates if a group is connected to A and/or B
IcutAB=and(IcutA,IcutB); ... |
github | ambarpal/3d-hough-master | ransacfitarbitraryplane.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/ransacfitarbitraryplane.m | 1,126 | utf_8 | b6dfe588e6abfe9c862f5bc7788b97bf | function [B,inliers,Borth]=ransacfitarbitraryplane(x,d,t)
[K,N]=size(x);
if(d>=K)
error('Dimension requested for the plane equal or greater than the dimension of the data')
end
if(N<d)
error('Number of points less than the dimension of the hyperplane')
end
s = 3; % Minimum No of points needed to fit a plan... |
github | ambarpal/3d-hough-master | evaluatenormalcut.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/evaluatenormalcut.m | 875 | utf_8 | 632d9c3976c06872e169c6341f601334 | %evaluates the normal cut function
% group is a vector of zeros and ones that indicates the two partitions
% simMat is the similarity matrix
function cost=evaluatenormalcut(group,simMat);
d=sum(simMat,2); %grade of each node (sum of distances on the row)
assocA=sum(d(find(group==0))... |
github | ambarpal/3d-hough-master | veronese.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/veronese.m | 1,128 | utf_8 | 95596f36a5d297adbd53de31e65b6bfa | % [y,powers] = veronese(x,n,scale,powers)
% Computes the Veronese map of degree n, that is all
% the monomials of a certain degree.
% x is a K by N matrix, where K is dimension and N number of points
% y is a K by Mn matrix, where Mn = nchoosek(n+K-1,n)
% powes is a K by Mn matrix with the exponent ... |
github | ambarpal/3d-hough-master | spectralcluster.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/spectralcluster.m | 765 | utf_8 | bb76077d06ddfb666bba7353094f70c1 | % affmat is the affinity matrix A
% k is the number of largest eigenvectors in matrix L
% num_class is the number of classes
%diagmat is the diagonal matrix D^(-0.5)
% Lmat is the matrix L
%X and Y ar matrices formed from eigenvectors of L
% IDX is the clustering results
% errorsum is the distance from kmeans
functio... |
github | ambarpal/3d-hough-master | plotgroups.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/plotgroups.m | 3,308 | utf_8 | c346f8f62b68298063de7731b881b192 | %function plotgroups(X,N,dimensions,K)
%
% Plots the points (contained in the matrix X) with a different color for
% each group. The dimension is assumed to be equal to size(X,1).
% N is a vector containing the number of points for each group
% Marker used:
% | color | |
% --------+---... |
github | ambarpal/3d-hough-master | gramsmithorth.m | .m | 3d-hough-master/code/vidal/HopkinsMultiviewMultibody/helper_functions/gramsmithorth.m | 303 | utf_8 | bac0b1b0bd989cf218054231c4156017 | %function y=gramsmithorth(x)
% Returns Y the Gram-Smith orthogonalization of the colums of X
% Y and X have the same dimensions
function y=gramsmithorth(x)
[K,D]=size(x);
I=eye(K);
y=x(:,1)/norm(x(:,1));
for(i=2:D)
newcol=(I-y*y')*x(:,i);
newcol=newcol/norm(newcol);
y=[y newcol];
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.