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 | akileshbadrinaaraayanan/IITH-master | model_train.m | .m | IITH-master/Sem6/CS5190_Soft_Computing/cs13b1042_final_code/model_train.m | 15,023 | utf_8 | d917316085f0feb53840b2af50c42680 | function model_train(varargin)
% Copyright (C) 2015 Tsung-Yu Lin, Aruni RoyChowdhury, Subhransu Maji.
% All rights reserved.
%
% This file is part of the BCNN and is made available under
% the terms of the BSD license (see the COPYING file).
[opts, imdb] = model_setup(varargin{:}) ;
% -------------------------------... |
github | akileshbadrinaaraayanan/IITH-master | bcnn_train.m | .m | IITH-master/Sem6/CS5190_Soft_Computing/cs13b1042_final_code/bcnn_train.m | 20,624 | utf_8 | 08aba3ab9bfbaab945389480c52b8ac7 | function [bcnn_net, info] = bcnn_train(bcnn_net, getBatch, imdb, varargin)
% BNN_TRAIN training an asymmetric BCNN
% BCNN_TRAIN() is an example learner implementing stochastic gradient
% descent with momentum to train an asymmetric BCNN for image classification.
% It can be used with different datasets by ... |
github | akileshbadrinaaraayanan/IITH-master | imdb_get_batch_bcnn.m | .m | IITH-master/Sem6/CS5190_Soft_Computing/cs13b1042_final_code/imdb_get_batch_bcnn.m | 3,947 | utf_8 | 66ff062002437a8ac04ba2fd4e8f8468 | function imo = imdb_get_batch_bcnn(images, varargin)
% imdb_get_batch_bcnn Load, preprocess, and pack images for BCNN evaluation
% For asymmetric model, the function preprocesses the images twice for two networks
% separately.
% OUTPUT
% imo: a cell array where each element is a cell array of images.
% For symm... |
github | econdaryl/GSSA-master | GSSA.m | .m | GSSA-master/MATLAB/GSSA MATLAB Code in Progress/GSSA.m | 12,736 | utf_8 | ccdceb3ab22c08fcd51d3d23fc692ecf | % GSSA function
% version 1.3 written by Kerk L. Phillips 2/11/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
% This function takes two inputs:
% 1) a guess for the steady state value of the endogne... |
github | econdaryl/GSSA-master | GSSA.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.2 (4 Feb 2012)/GSSA.m | 13,295 | utf_8 | 659817883a76880af2cfcebd95a488ed | % GSSA function
% version 1.1 written by Kerk L. Phillips 2/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
% This function takes two inputs:
% 1) a guess for the steady state value of the endogneous state ... |
github | econdaryl/GSSA-master | GSSA_genex.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.4 (5 Nov 2012)/GSSA_genex.m | 3,651 | utf_8 | e0d07d7cbae613aac65b2279399c5620 | % GSSA package
% version 1.4 written by Kerk L. Phillips 11/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
function [XYex,eulerr] = GSSA_genex(XY,Z,beta,J,epsi_nodes,weight_nodes,...
GSSAparams,modelp... |
github | econdaryl/GSSA-master | GSSA_nodes.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.4 (5 Nov 2012)/GSSA_nodes.m | 1,095 | utf_8 | c559001097911876e4daa2eefbab70f6 | % GSSA package
% version 1.4 written by Kerk L. Phillips 11/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
function [nodes, weights] = GSSA_nodes(J,nz,SigZ)
% This function calculates nodes and weights fo... |
github | econdaryl/GSSA-master | GSSA.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.4 (5 Nov 2012)/GSSA.m | 13,889 | utf_8 | d75f59a5fb83f59f079bb42862bdf5fb | % GSSA package
% version 1.4 written by Kerk L. Phillips 11/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
function [beta,XYbar,eulerr] = GSSA(XYbarguess, beta, modelname,...
GSSAparams, model... |
github | econdaryl/GSSA-master | GSSA_ss.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.4 (5 Nov 2012)/GSSA_ss.m | 759 | utf_8 | 14e62369785d64c04a7385ac10dac2d8 | % GSSA package
% version 1.4 written by Kerk L. Phillips 11/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
function out = GSSA_ss(XYbar)
global nx ny nz dyneqns
% GSSA.m uses this function along with the ... |
github | econdaryl/GSSA-master | GSSA_PQU.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.4 (5 Nov 2012)/GSSA_PQU.m | 1,810 | utf_8 | 7a44121e3a77dec00f67532aacb8a189 | % GSSA package
% version 1.4 written by Kerk L. Phillips 11/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
function [PP,QQ,UU,RR,SS,VV] = GSSA_PQU(theta0, Zbar, GSSAparams,...
modelparam)
global dyne... |
github | econdaryl/GSSA-master | GSSA_XYfunc.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.4 (5 Nov 2012)/GSSA_XYfunc.m | 1,819 | utf_8 | 524db1e17195d9b5ca0c86b72fb4b511 | % GSSA package
% version 1.4 written by Kerk L. Phillips 11/5/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
function XYp = GSSA_XYfunc(X,Z,beta,GSSAparams)
global trunceqns
% This is the approximation func... |
github | econdaryl/GSSA-master | GSSAold.m | .m | GSSA-master/MATLAB/Old Uused MATLAB code/GSSAold.m | 14,505 | utf_8 | cf655438b9ec319d635806843013b005 | % GSSA function
% version 1.3 written by Kerk L. Phillips 2/11/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
% It requires the following subroutines written by by Kenneth L. Judd,
% Lilia Maliar and Sergue... |
github | econdaryl/GSSA-master | GSSA.m | .m | GSSA-master/MATLAB/GSSA MATLAB ver 1.3 (11 Feb 2012)/GSSA.m | 12,744 | utf_8 | 99e91f3ba158ad62e5c16e92dbccbb39 | % GSSA function
% version 1.3 written by Kerk L. Phillips 2/11/2012
% Implements a version of Judd, Mailar & Mailar's (Quatitative Economics,
% 2011) Generalized Stochastic Simulation Algorithm with jump variables.
% This function takes three inputs:
% 1) a guess for the steady state value of the endog... |
github | txzhao/QbH-Demo-master | PostProcess.m | .m | QbH-Demo-master/scripts/PostProcess.m | 2,757 | utf_8 | 5bbe9042e6910e393dbd430f645da70e | % semitone = PostProcess(frIseq, verbose)
%
% method to post-process features obtained from "GetMusicFeatures.m"
%
% Input: frIseq - feature matrix (3*T) from "GetMusicFeatures.m"
% verbose - plot flag (boolean)
%
% Output: semitone - post-processed feature vector (1*T)
%
% Usage:
% This fun... |
github | txzhao/QbH-Demo-master | demo.m | .m | QbH-Demo-master/scripts/demo.m | 5,990 | utf_8 | a780e19736f3a0d1938b99f769bbcd44 | function varargout = demo(varargin)
% DEMO MATLAB code for demo.fig
% DEMO, by itself, creates a new DEMO or raises the existing
% singleton*.
%
% H = DEMO returns the handle to a new DEMO or the handle to
% the existing singleton*.
%
% DEMO('CALLBACK',hObject,eventData,handles,...) calls the l... |
github | txzhao/QbH-Demo-master | MusicFromFeatures.m | .m | QbH-Demo-master/scripts/GetMusicFeatures/MusicFromFeatures.m | 4,007 | utf_8 | 2c1020edef2861ddca3f5764fdf734a4 | %[signal] = MusicFromFeatures(feats,fs)
%or
%[signal] = MusicFromFeatures(feats,fs,winlength)
%or
%[signal] = MusicFromFeatures(feats,fs,winlength,noiseopt)
%
%Method to synthesize a signal from melody recognition features
%
%Usage:
%This function can generate signals from melody recognition features data like
%those g... |
github | txzhao/QbH-Demo-master | GetMusicFeatures.m | .m | QbH-Demo-master/scripts/GetMusicFeatures/GetMusicFeatures.m | 4,634 | utf_8 | 1f5bc70d10aa7285068637abcdda7521 | %[frIsequence] = GetMusicFeatures(signal,fs)
%or
%[frIsequence] = GetMusicFeatures(signal,fs,winlength)
%
%Method to calculate features for melody recognition
%
%Usage:
%First load a sound file using wavread or similar, then use this function
%to extract pitch and energy contours of the melody in the sound. This
%infor... |
github | txzhao/QbH-Demo-master | adaptStart.m | .m | QbH-Demo-master/scripts/@GaussMixD/adaptStart.m | 674 | utf_8 | f2cba1509325e96dad87f697502ad32c | %aState=adaptStart(pD)
%starts GaussMixD object adaptation to observed data,
%by initializing accumulator data structure for sufficient statistics,
%to be used in subsequent calls to method adaptAccum and adaptSet.
%
%Input:
%pD= GaussMixD object or array of GaussD objects
%
%Result:
%aState= data structure t... |
github | txzhao/QbH-Demo-master | adaptAccum.m | .m | QbH-Demo-master/scripts/@GaussMixD/adaptAccum.m | 3,676 | utf_8 | 9f083fcf31a490e01dbd7f56edad7c54 | %aState=adaptAccum(pD,aState,obsData,obsWeight)
%method to adapt array of GaussMixD objects to observed data,
%by accumulating sufficient statistics from the data,
%for later updating of the object by method adaptSet.
%
%Usage:
%First obtain the storage data structure aState from method adaptStart.
%Then, adaptAccum ca... |
github | txzhao/QbH-Demo-master | init.m | .m | QbH-Demo-master/scripts/@GaussMixD/init.m | 1,921 | utf_8 | 5b033aa7d8bc6f8214b3a795ed735a11 | %pD=init(pD,x);
%initializes a GaussMixD object or array of such objects
%to conform with a set of given observed vectors.
%The agreement is very crude, and should be refined by training,
%using methods adaptStart, adaptAccum, and adaptSet.
%
%Input:
%pD= a single GaussMixD object or array of such objects
%x... |
github | txzhao/QbH-Demo-master | adaptSet.m | .m | QbH-Demo-master/scripts/@GaussMixD/adaptSet.m | 993 | utf_8 | 4ca6665d6b9e85c675f31abffd865fd3 | %pD=adaptSet(pD,aState)
%method to finally adapt a GaussMixD object
%using accumulated statistics from observed data.
%
%Input:
%pD= GaussMixD object or array of GaussD objects
%aState= accumulated statistics from previous calls of adaptAccum
%
%Result:
%pD= adapted version of the GaussMixD object
%
%T... |
github | txzhao/QbH-Demo-master | logprob.m | .m | QbH-Demo-master/scripts/@GaussMixD/logprob.m | 1,334 | utf_8 | f8724eb6c7a8d8d4bcddbd8f85a932e3 | %logP=logprob(pD,x) gives log(probability densities) for given vectors
%assumed to be drawn from a given GaussMixD object
%
%Input:
%pD= GaussMixD object or array of such objects
%x= matrix with given vectors stored columnwise
%
%Result:
%logP= log(probability densities for x)
% size(logP)== [num... |
github | txzhao/QbH-Demo-master | rand.m | .m | QbH-Demo-master/scripts/@GaussMixD/rand.m | 766 | utf_8 | b780c5bb11fdaef5b6a99aec30b89b82 | %[X,S]=rand(pD,nSamples) returns random vectors drawn from a single GaussMixD object.
%
%Input:
%pD= the GaussMixD object
%nSamples= scalar defining number of wanted random data vectors
%
%Result:
%X= matrix with data vectors drawn from object pD
% size(X)== [DataSize, nSamples]
%S= row vector with indices of... |
github | txzhao/QbH-Demo-master | adaptStart.m | .m | QbH-Demo-master/scripts/@HMM/adaptStart.m | 795 | utf_8 | bc9660ec5d20fd009c1bcda6006c231e | %aState=adaptStart(hmm)
% initialises adaptation data structure for a single HMM object,
% to be saved between subsequent calls to method adaptAccum.
%
%Input:
%hmm= single HMM object
%
%Result:
%aState= struct representing zero weight of previous observed data,
% with fields
%aState.MC for the ... |
github | txzhao/QbH-Demo-master | adaptAccum.m | .m | QbH-Demo-master/scripts/@HMM/adaptAccum.m | 2,197 | utf_8 | 6a9249a64c2447d744dce7c50a9dcf77 | %[aState,logP]=adaptAccum(hmm,aState,obsData)
%method to adapt a single HMM object to observed data,
%by accumulating sufficient statistics from the data,
%for later updating of the object by method adaptSet.
%
%Usage:
%First obtain the storage data structure aState from method adaptStart.
%Then, adaptAccum can be call... |
github | txzhao/QbH-Demo-master | adaptSet.m | .m | QbH-Demo-master/scripts/@HMM/adaptSet.m | 524 | utf_8 | 614d518ee94beac4b3b5ca9eecec1b81 | %hmm=adaptSet(hmm,aState)
%method to finally adapt a single HMM object
%using accumulated statistics from observed training data sets.
%
%Input:
%hmm= single HMM object
%aState= accumulated statistics from previous calls of adaptAccum
%
%Result:
%hmm= adapted version of the HMM object
%
%Theory and Metho... |
github | txzhao/QbH-Demo-master | logprob.m | .m | QbH-Demo-master/scripts/@HMM/logprob.m | 1,762 | utf_8 | eda55425f67dfb12d14f892a2d14fbf3 | %logP=logprob(hmm,x) gives conditional log(probability densities)
%for an observed sequence of (possibly vector-valued) samples,
%for each HMM object in an array of HMM objects.
%This can be used to compare how well HMMs can explain data from an unknown source.
%
%Input:
%hmm= array of HMM objects
%x= matr... |
github | txzhao/QbH-Demo-master | viterbi.m | .m | QbH-Demo-master/scripts/@HMM/viterbi.m | 1,569 | utf_8 | bd3bf13e506663061de4c7d697f181a3 | %[S,logP]=viterbi(hmm,x)
%calculates optimal HMM state sequence
%for an observed sequence of (possibly vector-valued) samples,
%for each HMM object in an array of HMM objects.
%
%Input:
%hmm= array of HMM objects
%x= matrix with a sequence of observed vectors, stored columnwise
%NOTE: hmm DataSize must b... |
github | txzhao/QbH-Demo-master | double.m | .m | QbH-Demo-master/scripts/@DiscreteD/double.m | 584 | utf_8 | c202f8b43b6862ff03458f6960a07b30 | %pMass=double(pD)
%converts a DiscreteD object or column vector of such objects
%to an array with ProbMass values.
%i.e. inverse of pD=DiscreteD(pMass).
%
%Result:
%pMass(i,z)= P(Z(i)=z), with Z(i)= the i-th discrete random variable.
%
%Arne Leijon 2006-09-03 tested
function pMass=double(pD)
M=0;%max discrete random i... |
github | txzhao/QbH-Demo-master | adaptStart.m | .m | QbH-Demo-master/scripts/@DiscreteD/adaptStart.m | 683 | utf_8 | ac7fd76163fba59a09d6d64f8502f5df | %aState=adaptStart(pD)
%starts DiscreteD object adaptation to observed data,
%by initializing accumulator data structure for sufficient statistics,
%to be used in subsequent calls to method adaptAccum and adaptSet.
%
%Input:
%pD= DiscreteD object or array of such objects
%
%Result:
%aState= data structure to ... |
github | txzhao/QbH-Demo-master | adaptAccum.m | .m | QbH-Demo-master/scripts/@DiscreteD/adaptAccum.m | 2,271 | utf_8 | c66cbdd91fa34e74c190349a907c2346 | %aState=adaptAccum(pD,aState,obsData,obsWeight)
%method to adapt DiscreteD object, or object array, to observed data,
%by accumulating sufficient statistics from the data,
%for later updating of the object by method adaptSet.
%
%Usage:
%First obtain the storage data structure aState from method adaptStart.
%Then, adapt... |
github | txzhao/QbH-Demo-master | init.m | .m | QbH-Demo-master/scripts/@DiscreteD/init.m | 1,531 | utf_8 | e68d9547cf0f68b4958d54442b76079d | %pD=init(pD,x);
%initializes DiscreteD object or array of such objects
%to conform with a set of given observed data values.
%The agreement is crude, and should be further refined by training,
%using methods adaptStart, adaptAccum, and adaptSet.
%
%Input:
%pD= a single DiscreteD object or multidim array of Ga... |
github | txzhao/QbH-Demo-master | adaptSet.m | .m | QbH-Demo-master/scripts/@DiscreteD/adaptSet.m | 1,310 | utf_8 | 34015b2276663c72b6439b33c8f1065c | %pD=adaptSet(pD,aState)
%method to finally adapt a DiscreteD object
%using accumulated statistics from observed data.
%
%Input:
%pD= DiscreteD object or array of such objects
%aState= accumulated statistics from previous calls of adaptAccum
%
%Result:
%pD= adapted version of the DiscreteD object
%
%The... |
github | txzhao/QbH-Demo-master | prob.m | .m | QbH-Demo-master/scripts/@DiscreteD/prob.m | 1,350 | utf_8 | 3c9694ec22c8663ba9577c76bace7113 | %[p,logS]=prob(pD,Z)
%method to give the probability of a data sequence,
%assumed to be drawn from given Discrete Distribution(s).
%
%Input:
%pD= DiscreteD object or array of DiscreteD objects
%Z= row vector with data assumed to be drawn from a Discrete Distribution
% (Z may be real-valued, but is always r... |
github | txzhao/QbH-Demo-master | finiteDuration.m | .m | QbH-Demo-master/scripts/@MarkovChain/finiteDuration.m | 450 | utf_8 | f56a08b101840c331ce18109640c62cf | %fd=finiteDuration(mc)
% tests if a given MarkovChain object has finite duration.
%
%Input:
%mc= single MarkovChain object
%
%Result:
%fd= true, if duration is finite.
%
%Arne Leijon 2009-07-19 tested
function fd=finiteDuration(mc)
fd=size(mc.TransitionProb,2)==size(mc.TransitionProb,1)+1;%first condition
if fd
... |
github | txzhao/QbH-Demo-master | adaptStart.m | .m | QbH-Demo-master/scripts/@MarkovChain/adaptStart.m | 468 | utf_8 | 366c886f8600a036eead166ba927a598 | %aS=adaptStart(mc)
% initialises adaptation data structure,
% to be saved externally between subsequent calls to method adaptAccum.
%
%Input:
%mc= single MarkovChain object
%
%Result:
%aS= initialised adaptation data structure.
%
%Arne Leijon 2004-11-10 tested
function aS=adaptStart(mc)
aS.pI=zeros(size(mc.Initial... |
github | txzhao/QbH-Demo-master | adaptAccum.m | .m | QbH-Demo-master/scripts/@MarkovChain/adaptAccum.m | 3,245 | utf_8 | c928e31dfb69d14aaaf35a1820cd4e5c | %[aState,gamma,lP]=adaptAccum(mc,aState,pX)
%method to adapt a single MarkovChain object to observed data,
%by accumulating sufficient statistics from the data,
%for later updating of the object by method adaptSet.
%
%Usage:
%First obtain the storage data structure aState from method adaptStart.
%Then, adaptAccum can b... |
github | txzhao/QbH-Demo-master | adaptSet.m | .m | QbH-Demo-master/scripts/@MarkovChain/adaptSet.m | 1,325 | utf_8 | cfde9d8065852cfca77a09199016915d | %mc=adaptSet(mc,aState)
%method to finally adapt a single MarkovChain object
%using accumulated statistics from observed training data sets.
%
%Input:
%mc= single MarkovChain object
%aState= struct with accumulated statistics from previous calls of adaptAccum
%
%Result:
%mc= adapted version of the Mark... |
github | txzhao/QbH-Demo-master | logprob.m | .m | QbH-Demo-master/scripts/@MarkovChain/logprob.m | 1,280 | utf_8 | fdbdaa81b486e2b4dd249ed545208d99 | %lP=logprob(mc, S)
%calculates log probability of complete observed state sequence
%
%Input:
%mc= the MarkovChain object(s)
%S= row vector with integer state-index sequence.
% For a finite-duration Markov chain,
% S(end) may or may not be the END state flag = nStates+1.
%
%Result:
%lP= vector wit... |
github | txzhao/QbH-Demo-master | adaptStart.m | .m | QbH-Demo-master/scripts/@GaussD/adaptStart.m | 888 | utf_8 | ba37a1185528355dc6b4272ea2c74620 | %aState=adaptStart(pD)
%starts GaussD object adaptation to observed data,
%by initializing accumulator data structure for sufficient statistics,
%to be used in subsequent calls to method adaptAccum and adaptSet.
%
%Input:
%pD= GaussD object or array of GaussD objects
%
%Result:
%aState= data structure to be u... |
github | txzhao/QbH-Demo-master | adaptAccum.m | .m | QbH-Demo-master/scripts/@GaussD/adaptAccum.m | 2,202 | utf_8 | 4c1025eee7755cca5152ee32a6d44753 | %aState=adaptAccum(pD,aState,obsData,obsWeight)
%method to adapt GaussD object to observed data,
%by accumulating sufficient statistics from the data,
%for later updating of the object by method adaptSet.
%
%Usage:
%First obtain the storage data structure aState from method adaptStart.
%Then, adaptAccum can be called s... |
github | txzhao/QbH-Demo-master | init.m | .m | QbH-Demo-master/scripts/@GaussD/init.m | 4,062 | utf_8 | 6ac396786af0110b43e3a2b56b07cd24 | %[pD,iOK]=init(pD,x);
%initializes GaussD object or array of GaussD objects
%to conform with a set of given observed vectors.
%The agreement is very crude, and should be refined by training,
%using methods adaptStart, adaptAccum, and adaptSet.
%
%*****REQUIRES: VQ class ********
%
%Input:
%pD= a single Gaus... |
github | txzhao/QbH-Demo-master | adaptSet.m | .m | QbH-Demo-master/scripts/@GaussD/adaptSet.m | 3,179 | utf_8 | c0326b7bc4a99562959e208f63675714 | %pD=adaptSet(pD,aState)
%method to finally adapt a GaussD object
%using accumulated statistics from observed data.
%
%Input:
%pD= GaussD object or array of GaussD objects
%aState= accumulated statistics from previous calls of adaptAccum
%
%Result:
%pD= adapted version of the GaussD object
%
%Theory and... |
github | txzhao/QbH-Demo-master | logprob.m | .m | QbH-Demo-master/scripts/@GaussD/logprob.m | 1,536 | utf_8 | b605f3e2165466af2693cc2cbfb225b3 | %logP=logprob(pD,x) gives log(probability densities) for given vectors
%assumed to be drawn from a given GaussD object
%
%Input:
%pD= GaussD object or array of GaussD objects
%x= matrix with given vectors stored columnwise
%
%Result:
%logP= log(probability densities for x)
% size(logP)== [numel(p... |
github | txzhao/QbH-Demo-master | rand.m | .m | QbH-Demo-master/scripts/@GaussD/rand.m | 887 | utf_8 | 0040c8e3bac1a02ac5ab547250da5bf4 | %R=rand(pD,nData) returns random vectors drawn from a single GaussD object.
%
%Input:
%pD= the GaussD object
%nData= scalar defining number of wanted random data vectors
%
%Result:
%R= matrix with data vectors drawn from object pD
% size(R)== [length(pD.Mean), nData]
%
%Arne Leijon 2005-11-16 tested
% 20... |
github | MarcoSaerens/networkDLA_matlab-master | Alg_10_07_ForcedirectedLayoutGraph.m | .m | networkDLA_matlab-master/ToReview/Chapter10_GraphEmbedding/Alg_10_07_ForcedirectedLayoutGraph.m | 4,271 | utf_8 | ba5ca9c2bc40a1f85943daedf9870531 | function X = Alg_10_07_ForcedirectedLayoutGraph(W, w, X_0, a, r)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Authors: Gilissen & Edouard Lardinois, revised by Guillaume Guex (2017).
%
% Source: Francois Fouss, Marco Saerens and Masashi Shimbo (2016).
%... |
github | MarcoSaerens/networkDLA_matlab-master | Alg_10_06_SpringNetworkLayout.m | .m | networkDLA_matlab-master/ToReview/Chapter10_GraphEmbedding/Alg_10_06_SpringNetworkLayout.m | 3,796 | utf_8 | a24847cc20a410bd55af38f55fa8091d | function X = Alg_10_06_SpringNetworkLayout(D, X_0, l_0, k)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Authors: Gilissen & Edouard Lardinois, revised by Guillaume Guex (2017).
%
% Source: Francois Fouss, Marco Saerens and Masashi Shimbo (2016).
% ... |
github | MarcoSaerens/networkDLA_matlab-master | Alg_10_05_LatentSocialMap.m | .m | networkDLA_matlab-master/ToReview/Chapter10_GraphEmbedding/Alg_10_05_LatentSocialMap.m | 4,891 | utf_8 | 076cc66bd262c1997e3ac511abf9853e | function X = Alg_10_05_LatentSocialMap(A, p, X_0)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Authors: Gilissen & Edouard Lardinois, revised by Guillaume Guex (2017).
%
% Source: Francois Fouss, Marco Saerens and Masashi Shimbo (2016).
% "Algor... |
github | MarcoSaerens/networkDLA_matlab-master | Alg_08_07_LouvainMethod.m | .m | networkDLA_matlab-master/ToReview/Chapter08_DenseRegions/Alg_08_07_LouvainMethod.m | 7,334 | utf_8 | b8688a9c52465d0f82da551516d8f79e | function U = Alg_08_07_LouvainMethod(A,mix)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Authors: Ilkka Kivimaki (2015),revised by Sylvain Courtain (2017).
% Direct source: Francois Fouss, Marco Saerens and Masashi Shimbo (2016).
% "Algorithms and models for network data and link analy... |
github | MarcoSaerens/networkDLA_matlab-master | Alg_04_02_Brandes.m | .m | networkDLA_matlab-master/ToReview/Chapter04_CentralityMeasures/Alg_04_02_Brandes/Alg_04_02_Brandes.m | 4,966 | ibm852 | acadc590c403c640520a474836f74692 | function bet = Alg_04_02_Brandes(C)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Masashi Shimbo (2018).
%
% Source: François Fouss, Marco Saerens and Masashi Shimbo (2016).
% "Algorithms and models for network data and link analysis".
% Cambridge University... |
github | fangq/brain2mesh-master | polylinesimplify.m | .m | brain2mesh-master/polylinesimplify.m | 1,639 | utf_8 | 775bed53f6eef19868915b208d8f9c92 | function [newnodes, len]=polylinesimplify(nodes, minangle)
%
% [newnodes, len]=polylinesimplify(nodes, minangle)
%
% Calculate a simplified polyline by removing nodes where two adjacent
% segment have an angle less than a specified limit
%
% author: Qianqian Fang (q.fang at neu.edu)
%
% input:
% node: an N x 3 array... |
github | fangq/brain2mesh-master | brain1020.m | .m | brain2mesh-master/brain1020.m | 16,256 | utf_8 | 699e84568f37319e6530f1b69a9217cd | function [landmarks, curves, initpoints]=brain1020(node, face, initpoints, perc1, perc2, varargin)
%
% landmarks=brain1020(node, face)
% or
% landmarks=brain1020(node, face, [], perc1, perc2)
% landmarks=brain1020(node, face, initpoints)
% landmarks=brain1020(node, face, initpoints, perc1, perc2)
% [landmarks, curves... |
github | fangq/brain2mesh-master | intriangulation.m | .m | brain2mesh-master/intriangulation.m | 19,161 | utf_8 | 91270a58325ab59566ceae6f98ae81f1 | function in = intriangulation(vertices,faces,testp,heavytest)
% intriangulation: Test points in 3d wether inside or outside a (closed) triangulation
% usage: in = intriangulation(vertices,faces,testp,heavytest)
%
% arguments: (input)
% vertices - points in 3d as matrix with three columns
%
% faces - descriptio... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | MakeObj.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/plotting/MakeObj.m | 683 | utf_8 | a81a3fae729eca365c5bffe0df3d8124 |
% returns convex hull from point cloud
function obj = MakeObj(points, color)
%figure()
% create face representation and create convex hull
F = convhull(points(1,:), points(2,:));
fill(points(1,F),points(2,F),color);
%{
S.Vertices = transpose(points(1:2,:));
S.Faces = F;
S.Face... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PlotSetBasedSim.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/plotting/PlotSetBasedSim.m | 1,537 | utf_8 | 41159ed792610c3e67a56c471efe2ea5 | % PlotSetBasedSim(agentPos, obst, threshold)
%
% plots associated sets with the simulation
function PlotSetBasedSim(agentPos, obst, threshold, target)
figure()
hold on
% mA - coordinate (usually size 3)
% nA - time step, equal to iterations in simulation
[mA,nA] = size(agentPos);
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PlotSimDistance.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/plotting/PlotSimDistance.m | 2,137 | utf_8 | 247c9aed4e54b4c7c47b5b92b7ddae44 | % PlotSetBasedSim(agentPos, obst, threshold)
%
% plots max distance to target and min distance to projectile throughout
% the simulation
function PlotSimDistance(agentPos, obst, threshold, target)
figure()
hold on
% mA - coordinate (usually size 3)
% nA - time step, equal to iterations in si... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PlotOptimalPredicted.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/plotting/PlotOptimalPredicted.m | 1,446 | utf_8 | c9b3ae67ab8a11a7f45b94800201e13c |
function PlotOptimalPredicted(agentPos, obst, threshold, target)
figure()
hold on
% mA - coordinate (usually size 3)
% nA - time step, equal to iterations in simulation
[mA,nA] = size(agentPos);
% create objects/convex hulls for each set at each time step
for i = 1:nA
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | Cost.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/system/Cost.m | 1,054 | utf_8 | 143e65321cbb4cc55eae7ee3646a6247 | % c = Cost(x0_set, u, ts, target)
%
% custom cost function - sum of distance from each vertex to target squared
function c = Cost(x0_set, u, ts, target, L, terminalWeight)
% predict system state with set based dynamics
x_set = Dubin(x0_set,u,ts,L);
% calculate cost of prediction for set based dynamics
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | FindOptimalInput.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/system/FindOptimalInput.m | 1,220 | utf_8 | 4d99d1329218ef002c43fdbd6e4312f2 | % function u0 = FindOptimalInput(x0, N, ts, target)
%
% uses fmincon to minimize cost function given system dynamics and
% nonlinear constraints, returns optimal input sequence
function uopt = FindOptimalInput(x0_set, N, ts, target, xObst, threshold, L, speedBound, steeringBound, terminalWeight)
A = [];
b = ... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | ObstConstraint.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/system/ObstConstraint.m | 1,482 | utf_8 | 04e6c3e7aa641c9244adfd3c6e4d36c9 | % [c,ceq] = ObstConstraint(x0_set, u, ts, xObst, threshold)
%
% defines the non linear constraint - agent polytope to maintain
% a distance from the obstacle position above threshold
function [c,ceq] = ObstConstraint(x0_set, u, ts, xObst, threshold,L,options)
% predict agent with set based dynamics
% co... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SingleIntegrator.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/system/SingleIntegrator.m | 412 | utf_8 | 103d816561c56f118cee17686dc4c4c4 | % x = SingleIntegrator(x0_set, u, ts)
%
% set based dynamics of single integrator
function x = SingleIntegrator(x0_set, u, ts)
[mP,nP] = size(x0_set);
[mH,nH] = size(u);
% coords X time X set points
x = zeros(3,nH+1,nP);
x(:,1,:) = x0_set;
% apply integrator dynamics
for j = 1:nP... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationProjectilePredict.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/projectile/SimulationProjectilePredict.m | 764 | utf_8 | 8ea559140e8b2248afec5e16b1990cb5 | % [trajectory, velocity] = SimulationProjectilePredict(p_0, simTime)
%
% calls on simulink to predict projectile state given initial conditions
function [trajectory, velocity] = SimulationProjectilePredict(p_0, simTime)
% set up simulink
set_param('projectile/rx','Value',num2str(p_0(1)));
set_param('proje... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | CreateSphere.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/polytope/CreateSphere.m | 913 | utf_8 | e7fc2c7730cbb8e66f70c29e702d9c20 |
% creates a point cloud in a sphere around the center
function points = CreateSphere(center, r, thetadis, phidis)
% angle discretization
thetas = linspace(0,2*pi,thetadis);
phis = linspace(0,pi,phidis);
% point calculation
points = [];
x = [];
y = [];
z = [];
for i = 1:length(phis)
for j = 1:... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PolytopeMinDist.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/polytope/PolytopeMinDist.m | 1,150 | utf_8 | 5a4decdbc742e1a03013ff2627495551 | % minDist = PolytopeMinDist(X1,X2)
%
% finds the minimum distance between two polytopes X1 and X2
function minDist = PolytopeMinDist(X1,X2,options)
% declare constraints for fmincon
lb = [];
ub = [];
% get sizes of vertices for polytopes
[m1,n1] = size(X1);
[m2,n2] = size(X2);
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PolytopeDist.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Dubins_SBONL/polytope/PolytopeDist.m | 668 | utf_8 | 34f5332d650d2fb60f349903cb7edf17 |
function [f,g] = PolytopeDist(X1,X2,lambda,n1,n2,n)
f = norm((X1 * lambda(1:n1))-(X2 * lambda(n1+1:n)))^2;
%{
g = zeros(n,1);
for i = 1:n1
g(i) = 2*((X1(1,:)*lambda(1:n1))-(X2(1,:)*lambda(n1+1:n)))*X1(1,i) ...
+ 2*((X1(2,:)*lambda(1:n1))-(X2(2,:)*lambda(n1+1:n)))*X1(2,i) ...
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | GJK.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/GJK.m | 5,909 | utf_8 | acc17476d868c4bb652640495a721180 | function flag = GJK(shape1,shape2,iterations)
% GJK Gilbert-Johnson-Keerthi Collision detection implementation.
% Returns whether two convex shapes are are penetrating or not
% (true/false). Only works for CONVEX shapes.
%
% Inputs:
% shape1:
% must have fields for XData,YData,ZData, which are the x,y,z
% coord... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | convexhull.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/convexhull.m | 1,701 | utf_8 | cb09453005f6a6fce441276524c4e5c7 | %How many iterations to allow for collision detection.
iterationsAllowed = 6;
% Make a figure
figure(1)
hold on
% constants for set making
cntr_1 = [0.0, 0.0, 0.0];
cntr_2 = [1.0, 0.0, 0.0];
r_1 = 0.5;
r_2 = 0.2;
tdis = 11;
pdis = 6;
% create point cloud
sphere_1 = CreateSphere(cntr_1, r_1, tdis, pdis);
sphere_2 =... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | CreateSphere.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/functions/CreateSphere.m | 866 | utf_8 | 3ea485e3c5956a7fef00a0fe4c32bddb |
% creates a point cloud in a sphere around the center
function points = CreateSphere(center, r, thetadis, phidis)
% angle discretization
thetas = linspace(0,2*pi,thetadis);
phis = linspace(0,pi,phidis);
% point calculation
points = [];
x = [];
y = [];
z = [];
for i = 1:length(phis)
for j = 1:... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SBPC.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/functions/SBPC.m | 5,030 | utf_8 | 949b15cab9a8feb3e5d93327897e1e38 |
% prediction algorithm
% state - [x, y, z, px, py, pz, pxdot, pydot, pzdot]
function input = SBPC(state,target,QR,PR,TDIS,PDIS,N,K,TIMESTEP,VELOCITY)
% number of iterations to allow for collision detection.
iterationsAllowed = 6;
% get possible velocities
S = length(VELOCITY);
%% project... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | MakeObj.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/functions/MakeObj.m | 613 | utf_8 | 9842e71e7c6229282ca128ecd7b965bf |
% returns convex hull from point cloud
function obj = MakeObj(points, color)
%figure()
% create face representation and create convex hull
F = convhull(points(:,1), points(:,2), points(:,3));
S.Vertices = points;
S.Faces = F;
S.FaceVertexCData = jet(size(points,1));
S.FaceColor = 'interp';
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationMakeObj.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/functions/SimulationMakeObj.m | 367 | utf_8 | d4f1152a27a0887bcaaf5135543da40a |
% returns convex hull from point cloud
function obj = SimulationMakeObj(points)
%figure()
% create face representation and create convex hull
F = convhull(points(:,1), points(:,2), points(:,3));
S.Vertices = points;
S.Faces = F;
S.FaceVertexCData = jet(size(points,1));
S.FaceColor = 'interp... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationSBPC.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/functions/SimulationSBPC.m | 5,434 | utf_8 | dd7ff212697c5fe6aad585ea6b6e6848 |
% prediction algorithm
% state - [x, y, z, px, py, pz, pxdot, pydot, pzdot]
function input = SimulationSBPC(state,target,QR,PR,TDIS,PDIS,N,K,TIMESTEP,VELOCITY)
% number of iterations to allow for collision detection.
iterationsAllowed = 6;
% get possible velocities
S = length(VELOCITY);
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | CostSum.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK/functions/CostSum.m | 313 | utf_8 | 49502b1d0e6bda46cdf68a30ef0c6178 |
% calculates total cost of a trajectory
function totalCost = CostSum(trajectory, target, N)
totalCost = 0;
% sum distances between each point in trajectory and target
for i = 1:N
cost = pdist([trajectory(i,:); target], 'euclidean');
totalCost = totalCost + cost;
end
end |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | Cost.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/OptimizationNonlinear/system/Cost.m | 310 | utf_8 | 51f685855353dc4fd9e48dfe8b08777d | % function c = Cost(x0, u, ts, target)
%
% custom cost function - distance to target squared
function c = Cost(x0, u, ts, target)
% predict system state
x = SingleIntegrator(x0,u,ts);
% calculate cost of prediction
[m,n] = size(x);
c = norm(x-target*ones(1,n))^2;
end
|
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | FindOptimalInput.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/OptimizationNonlinear/system/FindOptimalInput.m | 592 | utf_8 | 618a4324d35b4942fef032b67ed76eb4 | % function u0 = FindOptimalInput(x0, N, ts, target)
%
% uses fmincon to minimize cost function given system dynamics and
% nonlinear constraints
function u0 = FindOptimalInput(x0, N, ts, target, xObst, threshold)
A = [];
b = [];
Aeq = [];
beq = [];
% set lower and upper bounds on inputs to i... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | ObstConstraint.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/OptimizationNonlinear/system/ObstConstraint.m | 537 | utf_8 | 5da3f5721088cc5ffbd7bbdd7ef040a2 | % [c,ceq] = ObstConstraint(x0, u, ts, xObst, threshold)
%
% defines the non linear constraint - maintain a distance above threshold
% from the obstacle position
function [c,ceq] = ObstConstraint(x0, u, ts, xObst, threshold)
% predict agent
x = SingleIntegrator(x0, u, ts);
% calculate distance between... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SingleIntegrator.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/OptimizationNonlinear/system/SingleIntegrator.m | 293 | utf_8 | 7d9d571566f2467b1d62668899c1f5d6 | % function x = SingleIntegrator(x0, u, ts)
%
% dynamics of single integrator
function x = SingleIntegrator(x0, u, ts)
[m,n] = size(u);
x = zeros(3,n+1);
x(:,1) = x0;
% apply integrator dynamics
for i = 1:n
x(:,i+1) = x(:,i) + ts*u(:,i);
end
end |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationProjectilePredict.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/OptimizationNonlinear/projectile/SimulationProjectilePredict.m | 764 | utf_8 | 8ea559140e8b2248afec5e16b1990cb5 | % [trajectory, velocity] = SimulationProjectilePredict(p_0, simTime)
%
% calls on simulink to predict projectile state given initial conditions
function [trajectory, velocity] = SimulationProjectilePredict(p_0, simTime)
% set up simulink
set_param('projectile/rx','Value',num2str(p_0(1)));
set_param('proje... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PolytopeMinDist.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/OptimizationNonlinear/polytope/PolytopeMinDist.m | 863 | utf_8 | 072ed9efcd311aebe3e16b4c074dbc1d | % minDist = PolytopeMinDist(X1,X2)
%
% finds the minimum distance between two polytopes X1 and X2
function minDist = PolytopeMinDist(X1,X2)
% declare constraints for fmincon
lb = [];
ub = [];
% get sizes of vertices for polytopes
[m1,n1] = size(X1);
[m2,n2] = size(X2);
if(m1 ... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | MakeObj.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/plotting/MakeObj.m | 624 | utf_8 | 21b5894435118a86bc40d17143893710 |
% returns convex hull from point cloud
function obj = MakeObj(points, color)
%figure()
% create face representation and create convex hull
F = convhull(points(1,:), points(2,:), points(3,:));
S.Vertices = transpose(points);
S.Faces = F;
S.FaceVertexCData = jet(size(points,1));
S.FaceColor =... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PlotSetBasedSim.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/plotting/PlotSetBasedSim.m | 1,233 | utf_8 | b30a722967dfb8f695b2211db0d86669 | % PlotSetBasedSim(agentPos, obst, threshold)
%
% plots associated sets with the simulation
function PlotSetBasedSim(agentPos, obst, threshold, target)
figure()
hold on
% mA - coordinate (usually size 3)
% nA - number of points in each set
% pA - time step, equal to iterations in simula... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | Cost.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/system/Cost.m | 804 | utf_8 | 12eaf7fb318a8f3e60546adda1dbf9e0 | % c = Cost(x0_set, u, ts, target)
%
% custom cost function - sum of distance from each vertex to target squared
function c = Cost(x0_set, u, ts, target)
% predict system state with set based dynamics
x_set = SingleIntegrator(x0_set,u,ts);
% calculate cost of prediction for set based dynamics
%... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | FindOptimalInput.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/system/FindOptimalInput.m | 790 | utf_8 | c5a509e96bfdd548f829af064cad15c3 | % function u0 = FindOptimalInput(x0, N, ts, target)
%
% uses fmincon to minimize cost function given system dynamics and
% nonlinear constraints, returns optimal input sequence
function u0 = FindOptimalInput(x0_set, N, ts, target, xObst, threshold)
A = [];
b = [];
Aeq = [];
beq = [];
% set l... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | ObstConstraint.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/system/ObstConstraint.m | 945 | utf_8 | 6c6d8b6f1fcfb85521cf4e989817ad15 | % [c,ceq] = ObstConstraint(x0_set, u, ts, xObst, threshold)
%
% defines the non linear constraint - agent polytope to maintain
% a distance from the obstacle position above threshold
function [c,ceq] = ObstConstraint(x0_set, u, ts, xObst, threshold)
% predict agent with set based dynamics
x_set = SingleInteg... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SingleIntegrator.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/system/SingleIntegrator.m | 379 | utf_8 | 9f0d16760b6c1ffa95bb300f5b505a9f | % x = SingleIntegrator(x0_set, u, ts)
%
% set based dynamics of single integrator
function x = SingleIntegrator(x0_set, u, ts)
[mP,nP] = size(x0_set);
[mH,nH] = size(u);
x = zeros(3,nH+1,nP);
x(:,1,:) = x0_set;
% apply integrator dynamics
for j = 1:nP
for i = 1:nH
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationProjectilePredict.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/projectile/SimulationProjectilePredict.m | 764 | utf_8 | 8ea559140e8b2248afec5e16b1990cb5 | % [trajectory, velocity] = SimulationProjectilePredict(p_0, simTime)
%
% calls on simulink to predict projectile state given initial conditions
function [trajectory, velocity] = SimulationProjectilePredict(p_0, simTime)
% set up simulink
set_param('projectile/rx','Value',num2str(p_0(1)));
set_param('proje... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | CreateSphere.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/polytope/CreateSphere.m | 913 | utf_8 | e7fc2c7730cbb8e66f70c29e702d9c20 |
% creates a point cloud in a sphere around the center
function points = CreateSphere(center, r, thetadis, phidis)
% angle discretization
thetas = linspace(0,2*pi,thetadis);
phis = linspace(0,pi,phidis);
% point calculation
points = [];
x = [];
y = [];
z = [];
for i = 1:length(phis)
for j = 1:... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PolytopeMinDist.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/SetBasedOptimizationNonlinear/polytope/PolytopeMinDist.m | 960 | utf_8 | 20c5308cdee25a3c8505d60826371706 | % minDist = PolytopeMinDist(X1,X2)
%
% finds the minimum distance between two polytopes X1 and X2
function minDist = PolytopeMinDist(X1,X2)
% declare constraints for fmincon
lb = [];
ub = [];
% get sizes of vertices for polytopes
[m1,n1] = size(X1);
[m2,n2] = size(X2);
if(m1 ... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | Cost.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Optimization/system/Cost.m | 311 | utf_8 | fc4f6c88e62c79980b6e20d8f3cd646a | % function c = Cost(x0, u, ts, target)
%
% custom cost function - distance to target squared
function c = Cost(x0, u, ts, target)
% predict system state
x = SingleIntegrator(x0,u,ts);
% calculate cost of prediction
[m,n] = size(x);
c = norm(x-target*ones(1,n))^2
end
|
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | FindOptimalInput.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Optimization/system/FindOptimalInput.m | 502 | utf_8 | 411fc54f433b2b1cf39f577e1e47e3cc | % function u0 = FindOptimalInput(x0, N, ts, target)
%
% uses fmincon to minimize cost function given system dynamics
function u0 = FindOptimalInput(x0, N, ts, target)
A = [];
b = [];
Aeq = [];
beq = [];
% set lower and upper bounds on inputs to integrator
lb = -1*ones(2,N);
ub = ones... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SingleIntegrator.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Optimization/system/SingleIntegrator.m | 293 | utf_8 | 68f06aba97ead41f96c992494e24fba4 | % function x = SingleIntegrator(x0, u, ts)
%
% dynamics of single integrator
function x = SingleIntegrator(x0, u, ts)
[m,n] = size(u);
x = zeros(2,n+1);
x(:,1) = x0;
% apply integrator dynamics
for i = 1:n
x(:,i+1) = x(:,i) + ts*u(:,i);
end
end |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | PolytopeMinDist.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/Optimization/polytope/PolytopeMinDist.m | 863 | utf_8 | 072ed9efcd311aebe3e16b4c074dbc1d | % minDist = PolytopeMinDist(X1,X2)
%
% finds the minimum distance between two polytopes X1 and X2
function minDist = PolytopeMinDist(X1,X2)
% declare constraints for fmincon
lb = [];
ub = [];
% get sizes of vertices for polytopes
[m1,n1] = size(X1);
[m2,n2] = size(X2);
if(m1 ... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | GJK.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/GJK.m | 5,909 | utf_8 | acc17476d868c4bb652640495a721180 | function flag = GJK(shape1,shape2,iterations)
% GJK Gilbert-Johnson-Keerthi Collision detection implementation.
% Returns whether two convex shapes are are penetrating or not
% (true/false). Only works for CONVEX shapes.
%
% Inputs:
% shape1:
% must have fields for XData,YData,ZData, which are the x,y,z
% coord... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | convexhull.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/convexhull.m | 1,701 | utf_8 | cb09453005f6a6fce441276524c4e5c7 | %How many iterations to allow for collision detection.
iterationsAllowed = 6;
% Make a figure
figure(1)
hold on
% constants for set making
cntr_1 = [0.0, 0.0, 0.0];
cntr_2 = [1.0, 0.0, 0.0];
r_1 = 0.5;
r_2 = 0.2;
tdis = 11;
pdis = 6;
% create point cloud
sphere_1 = CreateSphere(cntr_1, r_1, tdis, pdis);
sphere_2 =... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | CreateSphere.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/functions/CreateSphere.m | 866 | utf_8 | 3ea485e3c5956a7fef00a0fe4c32bddb |
% creates a point cloud in a sphere around the center
function points = CreateSphere(center, r, thetadis, phidis)
% angle discretization
thetas = linspace(0,2*pi,thetadis);
phis = linspace(0,pi,phidis);
% point calculation
points = [];
x = [];
y = [];
z = [];
for i = 1:length(phis)
for j = 1:... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SBPC.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/functions/SBPC.m | 5,186 | utf_8 | 9465ecd091b943cce8a5775605bcae44 |
% prediction algorithm
% state - [x, y, z, px, py, pz, pxdot, pydot, pzdot]
function input = SBPC(state,target,sigma,QR,PR,TDIS,PDIS,N,K,TIMESTEP,VELOCITY)
% number of iterations to allow for collision detection.
iterationsAllowed = 6;
% target object
targetSet = CreateSphere(target, 0.001, 5, 5)... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | MakeObj.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/functions/MakeObj.m | 613 | utf_8 | 9842e71e7c6229282ca128ecd7b965bf |
% returns convex hull from point cloud
function obj = MakeObj(points, color)
%figure()
% create face representation and create convex hull
F = convhull(points(:,1), points(:,2), points(:,3));
S.Vertices = points;
S.Faces = F;
S.FaceVertexCData = jet(size(points,1));
S.FaceColor = 'interp';
... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationMakeObj.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/functions/SimulationMakeObj.m | 367 | utf_8 | d4f1152a27a0887bcaaf5135543da40a |
% returns convex hull from point cloud
function obj = SimulationMakeObj(points)
%figure()
% create face representation and create convex hull
F = convhull(points(:,1), points(:,2), points(:,3));
S.Vertices = points;
S.Faces = F;
S.FaceVertexCData = jet(size(points,1));
S.FaceColor = 'interp... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | SimulationSBPC.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/functions/SimulationSBPC.m | 5,284 | utf_8 | 60c22e645f032eb5bd2dfa58890c8fa7 | % prediction algorithm
% state - [x, y, z, px, py, pz, pxdot, pydot, pzdot]
function input = SimulationSBPC(state,target,sigma,QR,PR,TDIS,PDIS,N,K,TIMESTEP,VELOCITY)
% number of iterations to allow for collision detection.
iterationsAllowed = 3;
% target object
targetSet = CreateSphere(target, 0.0... |
github | HybridSystemsLab/SetBasedPredictionCollisionAndEvasion-master | CostSum.m | .m | SetBasedPredictionCollisionAndEvasion-master/OldSimFiles/MatlabSim/GJK_Distance/functions/CostSum.m | 313 | utf_8 | 49502b1d0e6bda46cdf68a30ef0c6178 |
% calculates total cost of a trajectory
function totalCost = CostSum(trajectory, target, N)
totalCost = 0;
% sum distances between each point in trajectory and target
for i = 1:N
cost = pdist([trajectory(i,:); target], 'euclidean');
totalCost = totalCost + cost;
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.