classdef Analysis
-% ANALYSIS Collection of functions (static methods) used for GLM analysis
-% of point process data.
-%
-% <a href="matlab:web('AnalysisExamples.html', '-helpbrowser')">Analysis Examples</a>
-%
-% see also <a href="matlab:help('Trial')">Trial</a>, <a
-% href="matlab:help('CovColl')">CovColl</a>, <a
-% href="matlab:help('nstColl')">nstColl</a>,<a
-% href="matlab:help('History')">History</a>
-%
-%
-% Reference page in Help browser
-% <a href="matlab: doc('Analysis')">doc Analysis</a>
-
-properties (Constant)
- colors = {'b','g','r','c','m','y','k'};
-end
-
- methods (Static)
- function fitResults =RunAnalysisForNeuron(tObj,neuronNumber,configColl,makePlot,Algorithm)
-
% fitResults =RunAnalysisForNeuron(tObj,neuronNumber,configColl,makePlot,Algorithm)
- % tObj: Trial to be analyzed
- % neuronNumber: number of the neuron to be analyzed. Can be a
- % vector to specify multiple neurons to be analyzed.
- % If more than one neuron specified, then
- % fitResults is a cell array of fitResult
- % objects. fitResults{i} will contain the
- % fitResults object for neuronNum(i).
- % configColl: ConfigColl object containing the different
- % configurations (description of the the types of fits, eg. covariates) that correspond to each fit.
- % makePlot: Set to 1 to show a summary plot for this neuron. If performing multiple neuron analysis (eg. via RunAnalysisForAllNeurons) set ths parameter to zero to avoid screen clutter.
- % Algorithm: Either 'GLM' or 'BNLRCG'. Default is 'GLM'
- % GLM - Standard GLM regression from matlab.
- % BNLRCG - faster Truncated, L-2 Regularized,
- % Binomial Logistic Regression with Conjugate
- % Gradient Solver by Demba Ba (demba@mit.edu).
- %
- if(nargin<5)
- Algorithm = 'GLM';
- end
- if(nargin<4)
- makePlot=1;
- end
- numNeurons = length(neuronNumber);
- labels=cell(numNeurons,1);
- lambda=cell(numNeurons,1);
- b =cell(numNeurons,1);
- dev =zeros(numNeurons,1);
- numHist=cell(numNeurons,1);
- stats =cell(numNeurons,1);
- histObj =cell(numNeurons,1);
- ensHistObj=cell(numNeurons,1);
- AIC =zeros(numNeurons,1);
- BIC =zeros(numNeurons,1);
- windowSize = .01; % 1/tObj.sampleRate;% for Residual Computation;
- spikeTraining = cell(1,numNeurons);
- XvalData =cell(numNeurons,1);
- XvalTime =cell(numNeurons,1);
- spikeValidation = cell(1,numNeurons);
-
Fit Using Training Data
if(diff(tObj.validationWindow)~=0)
- tObj.setTrialTimesFor('training');
- end
- for i=1:configColl.numConfigs
- configColl.setConfig(tObj,i);
- display(strcat('Analyzing Configuration #',num2str(i)));
-
- for j=1:numNeurons
-
end
- end
-
-
-% %% Collect the validation Data
-%
-% if(diff(tObj.validationWindow)~=0)
-% tObj.setTrialTimesFor('validation');
-% for i=1:configColl.numConfigs
-% configColl.setConfig(tObj,i);
-% for j=1:numNeurons
-% XvalData{j,i}=tObj.getDesignMatrix(neuronNumber(j));
-% XvalTime{j,i}=tObj.covarColl.getCov(1).time;
-% spikeValidation{j} = tObj.nspikeColl.getNST(neuronNumber(j)).nstCopy;
-% spikeTraining{j}.setName(num2str(neuronNumber(j)));
-% end
-% end
-%
-% %tObj.setTrialTimesFor('training');
-% end
-%
-
Store the results
fitResults =cell(length(neuronNumber),1);
- for j=1:numNeurons
-
fitResults{j}=FitResult(spikeTraining{j},labels{j},numHist{j},histObj{j},ensHistObj{j},lambda{j},b{j}, dev(j,:), stats{j},AIC(j,:),BIC(j,:),configColl,XvalData{j},XvalTime{j},distrib{j});
- if(diff(tObj.validationWindow)~=0)
- tObj.setTrialTimesFor('validation');
- lambdaValidation = fitResults{j}.computeValLambda;
- ValResults = FitResult(spikeValidation{j},labels{j},numHist{j},histObj{j},ensHistObj{j},lambdaValidation,b{j}, dev(j,:), stats{j},AIC(j,:),BIC(j,:),configColl,XvalData{j},XvalTime{j},distrib);
- fitResults{j}.validation = ValResults; %validation field is actually another fitResults object but with the validation data
- end
-
Process the results and compute further parameters
end
- if(length(neuronNumber)==1)
- fitResults = fitResults{1};
- end
-
end
- function fitResults = RunAnalysisForAllNeurons(tObj,configs,makePlot,Algorithm)
- % fitResults = RunAnalysisForAllNeurons(tObj,configs,makePlot,Algorithm)
- % Runs the fits specifed by configs (a ConfigColl object) on
- % all the neurons that are unmasked in the trial tObj.
- % tObj - trial to be analyzed
- % configs - ConfigColl object specifying the types of fits to
- % be performed.
- % makePlot - Set to 1 to generate a summary plot for each
- % neuron.
- % Algorithm: Either 'GLM' or 'BNLRCG'. Default is 'GLM'
- % GLM - Standard GLM regression from matlab.
- % BNLRCG - faster Truncated, L-2 Regularized,
- % Binomial Logistic Regression with Conjugate
- % Gradient Solver by Demba Ba (demba@mit.edu).
-
- if(nargin<4)
- Algorithm = 'GLM';
- end
- if(nargin<3)
- makePlot=1; %default to plotting results
- end
-
- neuronIndex=tObj.getNeuronIndFromMask;
-% numLoops = floor(length(neuronIndex)/4);
-% loopArray = cell(1,numLoops);
-% for k=1:numLoops
-% if(k==numLoops)
-% loopArray{k} = neuronIndex((4*(k-1)+1):end);
-% else
-% loopArray{k} = neuronIndex((4*(k-1)+1):4*k);
-% end
-% end
-
- % parfor i=1:length(neuronIndex)
- fitResults = Analysis.RunAnalysisForNeuron(tObj,neuronIndex,configs,makePlot,Algorithm);
- %end
-
- end
-
-
- function [lambda,b, dev, stats,AIC, BIC,distribution] = GLMFit(tObj,neuronNumber,lambdaIndex,Algorithm)
- % [lambda,b, dev, stats,AIC, BIC] = GLMFit(tObj,neuronNumber,lambdaIndex,Algorithm)
- % Given a trial, tObj, and a neuronNumber specifying a neuron
- % from the trial, extracts the design matrix X from the current
- % covariate masks, history, and ensemble history in the trial,
- % and the observation vector,Y, and performs the GLM regression
- % using the specified algorithm. lambdaIndex: is used to
- % labeling the returned lambda with the number of the
- % configuration that it corresponds to.
- % Algorithm: Either 'GLM' or 'BNLRCG'. Default is 'GLM'
- % GLM - Standard GLM regression from matlab.
- % BNLRCG - faster Truncated, L-2 Regularized,
- % Binomial Logistic Regression with Conjugate
- % Gradient Solver by Demba Ba (demba@mit.edu).
- % Returns:
- % lambda - Covariate containing the resulting conditional
- % intensity function evaluated with the design matrix data.
- % b - the GLM regression coefficients. Constant term is
- % first followed by the components in X.
- %
- % dev - deviance for the this regression.
- % stats - stats structure from the GLM regression
- % (p-values,std dev, etc.)
- % AIC - Akaike's information criteria for this regression.
- % BIC - Bayes Information Criteria for this regression.
-
- if(nargin<4)
- Algorithm='GLM';
- end
-
- if(strcmp(Algorithm,'BNLRCG') && ~tObj.nspikeColl.getNST(neuronNumber).isSigRepBinary)
- error('To use BNLRCG Algorithm, spikeTrain must have a binary representation. Increase sampleRate and try again');
- end
- %For a single neuron given covariates,perform the GLM fit.
- y=tObj.getSpikeVector(neuronNumber);
- X=tObj.getDesignMatrix(neuronNumber);
-
-
- if(tObj.nspikeColl.getNST(neuronNumber).isSigRepBinary)
- distribution = 'binomial';
- linkfunction = 'logit';
- else
- distribution = 'poisson';
- linkfunction = 'log';
- end
-% size(X)
-% size(y)
- if(strcmp(Algorithm,'GLM'))
- [b,dev,stats] = glmfit(X,y,distribution, 'link', linkfunction,'constant','off');
- elseif(strcmp(Algorithm,'BNLRCG'))
- rrflag=0; %ML estimation
- [b,dev,stats] = bnlrCG(X,y,rrflag);
- else
- error('Algorithm not supported!');
- end
- if(length(b)>=1)
- if(strcmp(distribution,'binomial'))
- data = exp(X*b(1:end));
- data = (data./(1+data)).*tObj.sampleRate;
-
- elseif(strcmp(distribution,'poisson'));
- data = exp(X*b(1:end)).*tObj.sampleRate;
-
-%
- end
- end
-
-% size(tObj.covarColl.getCov(1).getSigRep.time)
-% size(data)
-
- lambda=Covariate(tObj.getCov(1).time,data,...
- '\Lambda(t)',tObj.getCov(1).xlabelval,...
- tObj.getCov(1).xunits,'Hz',strcat('\lambda_{',num2str(lambdaIndex),'}'));
- AIC = 2*length(b)+dev;
- BIC = length(b)*log(length(y))+dev;
- end
- function handle = plotInvGausTrans(fitResults,makePlot)
- % handle = plotInvGausTrans(fitResults,makePlot)
- % Given the CDF of the rescaled spike times (the u'js) computes
- % the auto-correlation function inverse gaussian tranformated
- % u'js and the 95% confidence interval that they are distinct
- % from zero.
- % Idea: if gaussian RVs are uncorrelated, they are indep., then
- % this suggest independence of the uj's and of the zj's
- % from the time-rescaling theorem. If zj's are
- % independent and KS plot is within 95% confidence
- % interval suggests that candidate lambda is close to the
- % true lambda.
- if(nargin<2)
- makePlot=0;
- end
- [X,rhoSig,confBoundSig] = Analysis.computeInvGausTrans(fitResults.Z);
- fitResults.setInvGausStats(X,rhoSig,confBoundSig);
-
- if(fitResults.isValDataPresent)
- [X,rhoSig,confBoundSig] = Analysis.computeInvGausTrans(fitResults.validation.Z);
- fitResults.validation.setInvGausStats(X,rhoSig,confBoundSig);
- end
-
- if(makePlot==1)
- handle=fitResults.plotInvGausTrans;
- end
-
- end
- function plotFitResidual(fitResults,windowSize,makePlot)
- % plotFitResidual(fitResults,windowSize,makePlot)
- % computes the point process residual between the true spike
- % train and that predicted by the candidate conditional
- % intensity function.
- % The result is stored in fitResult.
- %
- M = Analysis.computeFitResidual(fitResults.neuralSpikeTrain,fitResults.lambda,windowSize);
- fitResults.setFitResidual(M);
-
- if(fitResults.isValDataPresent)
- M = Analysis.computeFitResidual(fitResults.validation.neuralSpikeTrain,fitResults.validation.lambda,windowSize);
- fitResults.validation.setFitResidual(M);
- end
-
- if(makePlot)
- fitResults.plotResidual;
- end
- end
- function handle = KSPlot(fitResults,makePlot)
- %handle = KSPlot(fitResults,makePlot)
- % Computes the KS statistics and makes the plot. Stores
- % appropriate parameters in fitResults.
- % If validation data is also available, it does the same for
- % the validation data.
- if(nargin <2)
- makePlot =1; %By default make the plot
- end
-
- [Z, U, xAxis, KSSorted, ks_stat] = Analysis.computeKSStats(fitResults.neuralSpikeTrain,fitResults.lambda);
- fitResults.setKSStats(Z,U, xAxis, KSSorted, ks_stat);
-
-
- if(fitResults.isValDataPresent)
- %make sure nst is in appropriate window
- [Z, U, xAxis, KSSorted, ks_stat] = Analysis.computeKSStats(fitResults.validation.neuralSpikeTrain,fitResults.validation.lambda);
- fitResults.validation.setKSStats(Z, U, xAxis, KSSorted, ks_stat);
-
- end
-
- if(makePlot)
- handle = fitResults.KSPlot;
- else
- handle = [];
- end
-
- end
- function handle = plotSeqCorr(fitResults)
- % handle = plotSeqCorr(fitResults)
- % Plots the sequential correlation coefficients of the rescaled
- % ISIs. zj vs. zj-1
- handle = fitResults.plotSeqCorr;
-
- end
- function handle = plotCoeffs(fitResults)
- % handle = plotCoeffs(fitResults)
- % Plots the regression coefficients for all the different fits.
-
- handle = fitResults.plotCoeffs;
-
- end
-
-
- function [X,rhoSig,confBoundSig] = computeInvGausTrans(Z)
- % [U,X,rhoSig,confBoundSig] = computeInvGausTrans(Z)
- % Take rescaled spikeTimes, zjs, transforms them to
- % uniform(0,1), then computes the inverse gaussian
- % transformation of these to xj's. rhoSig is the
- % auto-correlation funcion of these xj's and is used to test
- % for independence of the xj's. Independence of the xj's
- % suggests indepence of the uj's and zj's (a condition
- % necessary for the Time Rescaling Theorem).
-
- U=1-exp(-Z);
- U(U>=1)=.99999; %Prevent any 1 values which lead to infinity in X
- X = norminv(U,0,1);
- %X=erfinv(U);
- [~,colm] = size(X);
- for i=1:colm
- [c(:,i),lags] = xcov(X(:,i));
- end
- index=find(lags==1);
- lags=lags(index:end);
- rho=c(index:end,:)./repmat(c(index-1,:),length(lags),1);
- n=length(X);
- confBound = 1.96/sqrt(n)*ones(length(lags),1);
-% size(lags)
-% size(rho)
-
- confBoundSig = SignalObj(lags,[confBound -confBound],'ACF[ \Phi^{-1}(u_i) ]','\Delta \tau','sec');
- confBoundSig.setPlotProps({' ''r'', ''LineWidth'' ,3'},1);
- confBoundSig.setPlotProps({' ''r'', ''LineWidth'' ,3'},2);
-
- handle=[];
- rhoSig = SignalObj(lags,rho, 'ACF[ \Phi^-1(u_i) ]','\Delta \tau','sec');
- plotProps = cell(1,colm);
- for i=1:colm
- plotProps{i}=strcat('''', '.',Analysis.colors{mod(i-1,length(Analysis.colors))+1},'''');
- end
- rhoSig.setPlotProps(plotProps);
-
-
-
- end
- function [Z,U,xAxis,KSSorted, ks_stat] = computeKSStats(nspikeTrain,lambdaInput,dtCorrection)
- % [Z,U,xAxis,KSSorted, ks_stat] = computeKSStats(nspikeTrain,lambdaInput)
- % Given a neural spike train (a sequence of spike times) and a
- % conditional intensity function, computes the rescaled ISIs
- % according to the time-rescaling theorem in Z. The Uj are
- % returned in U and correspond to a transformation fo the Zjs
- % (exponential rate 1 (according to T-R theorem) to be
- % uniform(0,1).
- %
- % nspikeTrain: a nspikeTrain object
- % lambdaInput: candidate conditional intensity function (a Covariate)
- % Z: rescaled spike times
- % U: Zjs tranformed to be uniform(0,1)
- % xAxis: x-axis of the KS plot
- % KSSorted: y-axis of KS plot
- % ks_stat: the KS statistic. Maximum deviations from the 45
- % degree line for each conditional intensity function.
-
- %get the relevant spike train
- if(nargin<3)
- dtCorrection =1;
- end
-
- nCopy =nspikeTrain.nstCopy;
-% minTime = nCopy.minTime;
-% maxTime = nCopy.maxTime;
-% nCopy.setMinTime(minTime);
-% nCopy.setMaxTime(maxTime);
-
-
-
- if(dtCorrection==1 && nCopy.isSigRepBin)
- % Use DT Correction for Time Rescaling Theorem - Haslinger, Pipa and Brown (2010)
- pkSignal=lambdaInput.*(1/lambdaInput.sampleRate);
- pk = pkSignal.data;
- spikeTrain = nCopy.getSigRep.data;
- intValues=zeros(length(nCopy.getSpikeTimes)-1,lambdaInput.dimension);
- for i=1:lambdaInput.dimension
- temp = ksdiscrete(pk(:,i),spikeTrain,'spiketrain');
-% length(temp)
-% length(intValues(:,i))
- %sometimes ksdiscrete returns 1 less spike train than
- %expected ... need to debug .... for now just fix
- %using length(temp) to index into intValues;
- intValues(1:length(temp),i) = temp;
- end
-
-
- else% do not correct for discrete time effects
-
- tempLambda = lambdaInput;
-% tempLambda = tempLambda.resample(tempLambda.sampleRate*4);
-% lambda=tempLambda.getSigInTimeWindow(minTime,maxTime);%.dataToMatrix;
- lambdaPosdata = max(tempLambda.data,0);
- lambda = Covariate(tempLambda.time,lambdaPosdata,tempLambda.name,tempLambda.xlabelval,tempLambda.xunits,tempLambda.yunits,tempLambda.dataLabels);
-
- lambdaInt = lambda.integral;
-
- if(nCopy.isSigRepBin)
- spikeTimes = nCopy.getSpikeTimes;
-
- else
- nstSignal = nCopy.getSigRep;
- spikeTimes=nstSignal.time(nstSignal.data~=0);
-
-
- end
-
- if(~isempty(spikeTimes))
- tempVals = lambdaInt.getValueAt(spikeTimes);
- intValues= tempVals(2:end,:)-tempVals(1:end-1,:);
- else
- intValues = 0;
- end
-
- % intValues=2*intValues;
- % lambdaInt.plot; hold all;
- % vals =lambdaInt.getValueAt(spikeTimes);
- % plot(spikeTimes,vals,'.')
-
- end
- Z = intValues; % rescales spike times - exponential rate 1
- U = 1-exp(-Z); % store the rescaled spike times - uniform(0,1)
-
-
- KSSorted = sort( U,'ascend' );
- N = length(KSSorted);
- if(N~=0)
- xAxis=(([1:N]-.5)/N)'*ones(1,lambdaInput.dimension);
- ks_stat = max(abs(KSSorted - (([1:N]-.5)/N)'*ones(1,lambdaInput.dimension)));
- else
- ks_stat=1;
- xAxis=[];
- end
- end
- function M=computeFitResidual(nspikeTrain,lambda,windowSize)
- % M=computeFitResidual(nspikeTrain,lambda,windowSize)
- % Computes the Point Process residual defined in
- % 'A point process framework for relating neural spiking
- % activity to spiking history, W Truccolo, UT Eden, MR Fellows,
- % JP Donoghue and EN. Brown. Journal of Neurophysiology 2005.
- %
- % nspikeTrain: nspikeTrain object
- % lambda: candidate conditional intensity function evaluated on the time
- % interval of the spike train.
- % windowSize: the size of the window over which to compute the
- % residual.
- % M: the point process residual (a Covariate object).
- %
- if(nargin<3 || isempty(windowSize))
- windowSize=.1;
- end
- windowTimes = nspikeTrain.minTime:windowSize:nspikeTrain.maxTime;
- nCopy=nspikeTrain.nstCopy.getSigRep(windowSize);%tObj.getNeuron(fitResults.neuronNumber).nstCopy;
- %nCopy.windowedSignal(windowTimes)
- % this gets us the SUM over a window of length windowSize
- % y[n] = y[n-1] + x[n] -- running sum filter
- B=1; A=[1 -1];
- sumSpikes = nCopy.filter(B,A);
- %spikeTimes =nCopy.getSpikeTimes';
- sumSpikesOverWindow= sumSpikes.getValueAt(windowTimes(2:end))-sumSpikes.getValueAt(windowTimes(1:(end-1)));
- lambdaInt = lambda.integral;
- lambdaIntVals = lambdaInt.getValueAt(windowTimes(2:end))-lambdaInt.getValueAt(windowTimes(1:(end-1)));
- Mdata=repmat(sumSpikesOverWindow,[1 lambdaInt.dimension])-lambdaIntVals;
- dataLabels = cell(1,lambdaInt.dimension);
- for i=1:lambdaInt.dimension
- dataLabels{i} = lambda.dataLabels{i};
- end
-
- M=Covariate(windowTimes(2:end),Mdata,'M(t_k)-Residual',lambdaInt.xlabelval, ...
- lambdaInt.xunits,lambdaInt.yunits,dataLabels);
-
- end
-
- function [fitResults,ensembleCovariate,tcc] = compHistEnsCoeffForAll(tObj,history,makePlot)
- % [fitResults,ensembleCovariate,tcc] = compHistEnsCoeffForAll(tObj,history,makePlot)
- % runs Analysis.compHistEnsCoff for each neuron that is not masked.
- if(nargin<3 || isempty(makePlot))
- makePlot=1;
- end
- neuronIndex=tObj.getNeuronIndFromMask;
- fitResults = cell(1,length(neuronIndex));
- tcc = cell(1,length(neuronIndex));
- ensembleCovariate = tObj.getEnsembleNeuronCovariates(neuronIndex(1),[],history);
- [fitResults{1},tcc{1}] = Analysis.compHistEnsCoeff(tObj,history,neuronIndex(1),tObj.getNeuronNeighbors(1),ensembleCovariate,makePlot);
- for i=2:length(neuronIndex)
- ensembleCovariate.maskAwayAllExcept(tObj.getNeuronNeighbors(neuronIndex(i)));
- [fitResults{i},tcc{i}] = Analysis.compHistEnsCoeff(tObj,history,neuronIndex(i),tObj.getNeuronNeighbors(neuronIndex(i)),ensembleCovariate,makePlot);
- end
- end
- function [fitResults,ensembleCov,tcc] = compHistEnsCoeff(tObj,history,neuronNum,neighbors,ensembleCov,makePlot)
- % [fitResults,ensembleCov,tcc] = compHistEnsCoeff(tObj,history,neuronNum,neighbors,ensembleCov,makePlot)
- % Given a trial, a history object compute the history time
- % series for the ensemble of neighboring neurons. This is done for all neurons and the result is returned in
- % ensembleCov as a covariate collection. This collection is
- % then used as the design matrix and the analysis performed for
- % each neuron. The results are returned in fitResults.
- %
- %
- if(nargin<6 || isempty(makePlot))
- makePlot=1;
- end
-
- if(nargin<3 || isempty(neuronNum))
- neuronNum=tObj.getNeuronIndFromMask;
- end
-
- if(nargin<4 || isempty(neighbors))
- neighbors=tObj.getNeuronNeighbors(neuronNum); %every other neuron
- end
-
- if(nargin<5 || isempty(ensembleCov))
- ensembleCov = tObj.getEnsembleNeuronCovariates(neuronNum,neighbors,history);
- end
-
-
- %Create a covariate collection that consists of only the
- %ensemble history
- ensembTrial = Trial(tObj.nspikeColl,ensembleCov);
- tc=TrialConfig('all',[],[]); %use all ensembleCov
- tcc = ConfigColl(tc);
- fitResults =Analysis.RunAnalysisForNeuron(ensembTrial,neuronNum,tcc,makePlot);
- end
- function [fitResults,tcc] = computeHistLag(tObj,neuronNum,windowTimes,CovLabels,sampleRate,makePlot)
- % [fitResults,tcc] = computeHistLag(tObj,tObj,neuronNum,windowTimes,CovLabels,sampleRate,makePlot)
- % For the neuron in neuronNum, runs an analysis with self
- % history, and no extrinsic covariates, and no ensemble history
- % as a covariates. The self history is specfied by a vector
- % of windowTimes. There will be length(windowTimes) different
- % results (configurations) corresponding to increasing number of history
- % windows.
- if(nargin<6)
- makePlot=1;
- end
- if(nargin<5 || isempty(sampleRate))
- sampleRate = tObj.sampleRate;
- end
- if(nargin<4)
- CovLabels ={};
- end
- if(nargin<3)
- error('Must specify a vector of windowTimes');
- end
- if(nargin<2 || isempty(neuronNum))
- neuronNum = tObj.getNeuronIndFromMask;
- end
-
- % tcObj=TrialConfig(covMask,sampleRate, history,minTime,maxTime)
- tc=cell(1,length(windowTimes)-1);
- for i=1:length(tc)+1
- %use no covariates
- if(i==1)
- tc{i} = TrialConfig(CovLabels,sampleRate,[],[]); tc{i}.setName('Baseline');
- else
- tc{i} = TrialConfig(CovLabels,sampleRate,windowTimes(1:i));
- end
-
- end
- tcc = ConfigColl(tc);
- fitResults =Analysis.RunAnalysisForNeuron(tObj,neuronNum,tcc,makePlot);
- end
- function fitResults = computeHistLagForAll(tObj,windowTimes,CovLabels,sampleRate,makePlot)
- % [fitResults,tcc] = computeHistLagAll(tObj,windowTimes,CovLabels,sampleRate,makePlot)
- % Calls computeHistLab for each neuron in the trial that is not masked.
- if(nargin<5)
- makePlot=1;
- end
- if(nargin<4 || isempty(sampleRate))
- sampleRate = tObj.sampleRate;
- end
- if(nargin<3)
- CovLabels ={};
- end
- if(nargin<2)
- error('Must specify a vector of windowTimes');
- end
-
- neuronIndex=tObj.getNeuronIndFromMask;
- fitResults = cell(1,length(neuronIndex));
- for i=1:length(neuronIndex)
- fitResults{i} = Analysis.computeHistLag(tObj,neuronIndex(i),windowTimes,CovLabels,sampleRate,makePlot);
- end
-
-
-
- end
- function [fitResults,tcc]=computeNeighbors(tObj,neuronNum,sampleRate,windowTimes,makePlot)
- % [fitResults,tcc]=computeNeighbors(tObj,neuronNum,sampleRate,windowTimes,makePlot)
- % For the neuron in neuronNum, runs an analysis with no self
- % history, and no extrinsic covariates, only ensemble history
- % as a covariate. The ensemble history is specfied by a vector
- % of windowTimes. There will be length(windowTimes) different
- % results corresponding to increasing number of history
- % windows.
- if(nargin<4)
- makePlot=1;
- end
- if(nargin<3 || isempty(sampleRate))
- sampleRate = tObj.sampleRate;
- end
- if(nargin<2 || isempty(neuronNum))
- neuronNum = tObj.getNeuronIndFromMask;
- end
- tc=cell(1,length(windowTimes)-1);
- for i=1:length(windowTimes)
- % For reference: tcObj=TrialConfig(covMask,sampleRate, history,covHist,covLag,name)
- if(i==1)
- tc{i} = TrialConfig({},sampleRate,[],[]); tc{1}.setName('Baseline');
- else
- tc{i} = TrialConfig({},sampleRate,[],windowTimes(1:i));
- end
- end
- tcc = ConfigColl(tc);
- fitResults =Analysis.RunAnalysisForNeuron(tObj,neuronNum,tcc,makePlot);
- end
-
- function cc=spikeTrigAvg(tObj,neuronNum,windowSize)
- % cc=spikeTrigAvg(tObj,neuronNum,windowSize)
- % Each covariate dimension is sampled at every spike time of
- % the neuron specified +/- windowSize. The number of columns of
- % each new covariate corresponds to the number of spikes in the
- % spike train. A covariate collection is returned containing
- % each covariate dimension as a new covariate. These can then
- % be easily avergaged by using SignalObj method
- % plotVariability.
-
- nCopy=tObj.getNeuron(neuronNum).nstCopy;
- t=-windowSize/2:1/tObj.sampleRate:windowSize/2;
- covIndex=0;
- for i = 1:tObj.covarColl.numCov
- tempCov=tObj.getCov(i);
- data=[];
- dataIndex=0;
- % for n=1:tObj.nspikeColl.numSpikeTrains
-% nCopy=tObj.getNeuron(neuronNum).nstCopy;
- spikeTimes = nCopy.getSpikeTimes';
- for j=1:length(spikeTimes)
- dataIndex=dataIndex+1;
- tc=tempCov.getSigInTimeWindow(spikeTimes(j)-windowSize/2,spikeTimes(j)+windowSize/2);
- tc=tc.shift(-tc.minTime-windowSize/2);
- tempData = tc.getValueAt(t);
-% if(isempty(data))
-% data(dataIndex,1:length(tempData),:)=tempData;
-% else
-% data(dataIndex,:,:)=zeros(size(squeeze(data(1,:,:))));
- data(dataIndex,:,:)=tempData;
-% end
- end
- %end
-
- for k=1:tempCov.dimension
- covIndex = covIndex+1;
- cov{covIndex} = Covariate(t,squeeze(data(:,:,k)),tempCov.dataLabels{k},tempCov.xlabelval,tempCov.xunits,tempCov.yunits,tempCov.dataLabels{k});
- end
- end
- cc=CovColl(cov);
-
- end
- function plotStatHistData(index,spdata,svdata,sfdata)
- % plotStatHistData(index,spdata,svdata,sfdata)
- % Helpfer function to view historgrams of the position, velocity,
- % and force data at each spike time.
- % index is used to label the plot and should correspond to the
- % neuron that was used to compute this data.
- %
- % position (x,y,z) array
- % veloctity vx vy vz array
- % force: fz, fzmag, fld, flf array
-
- sfdata((sfdata==0))=nan; %
- fig(1)=figure('visible','off'); a1=scatterhist(spdata(:,1),spdata(:,2)); set(get(gca,'YLabel'),'String','y'); set(get(gca,'XLabel'),'String','x')
- fig(2)=figure('visible','off'); a2=scatterhist(spdata(:,1),spdata(:,3)); set(get(gca,'YLabel'),'String','z'); set(get(gca,'XLabel'),'String','x')
- fig(3)=figure('visible','off'); a3=scatterhist(spdata(:,2),spdata(:,3)); set(get(gca,'YLabel'),'String','z'); set(get(gca,'XLabel'),'String','y')
- fig(4)=figure('visible','off'); a4=scatterhist(svdata(:,1),svdata(:,2)); set(get(gca,'YLabel'),'String','v_y'); set(get(gca,'XLabel'),'String','v_x')
- fig(5)=figure('visible','off'); a5=scatterhist(svdata(:,1),svdata(:,3)); set(get(gca,'YLabel'),'String','v_z'); set(get(gca,'XLabel'),'String','v_x')
- fig(6)=figure('visible','off'); a6=scatterhist(svdata(:,2),svdata(:,3)); set(get(gca,'YLabel'),'String','v_z'); set(get(gca,'XLabel'),'String','v_y')
- fig(7)=figure('visible','off'); a7=scatterhist(sfdata(:,1),sfdata(:,3)); set(get(gca,'YLabel'),'String','f_{ld}'); set(get(gca,'XLabel'),'String','f_z')
- fig(8)=figure('visible','off'); a8=scatterhist(sfdata(:,1),sfdata(:,4)); set(get(gca,'YLabel'),'String','f_{lf}'); set(get(gca,'XLabel'),'String','f_z')
- fig(9)=figure('visible','off'); a9=scatterhist(sfdata(:,3),sfdata(:,4)); set(get(gca,'YLabel'),'String','f_{lf}'); set(get(gca,'XLabel'),'String','f_{ld}')
-
-
- h=figure(index+100);
- scrsz = get(0,'ScreenSize');
-
- set(h,'Name',strcat('Neuron #',num2str(index)),'Position',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.8]);
- u1 = uipanel(h,'position',[.0 .66 .33 .33]); set(a1,'parent',u1);
- u2 = uipanel(h,'position',[.33 .66 .33 .33]); set(a2,'parent',u2);
- u3 = uipanel(h,'position',[.66 .66 .33 .33]); set(a3,'parent',u3);
- u4 = uipanel(h,'position',[.0 .33 .33 .33]); set(a4,'parent',u4);
- u5 = uipanel(h,'position',[.33 .33 .33 .33]); set(a5,'parent',u5);
- u6 = uipanel(h,'position',[.66 .33 .33 .33]); set(a6,'parent',u6);
- u7 = uipanel(h,'position',[.0 0 .33 .33]); set(a7,'parent',u7);
- u8 = uipanel(h,'position',[.33 0 .33 .33]); set(a8,'parent',u8);
- u9 = uipanel(h,'position',[.66 0 .33 .33]); set(a9,'parent',u9);
- close(fig);
- end
-
- end
-
-
-
-end
-
-
-
-function [flatMask, maxIndex]=flatMaskCellToMat(flatMaskCell)
- % [flatMask, maxIndex]=flatMaskCellToMat(flatMaskCell)
- lMask =zeros(1,length(flatMaskCell));
- for i=1:length(flatMaskCell)
- lMask(i) = length(flatMaskCell{i});
- end
- [maxSize,maxIndex] = max(lMask);
- flatMask = zeros(maxSize,length(flatMaskCell));
- for i=1:length(flatMaskCell)
- flatMask(1:length(flatMaskCell{i}),i) = flatMaskCell{i};
- end
-end
-function [beta_new,devnew,stats] = bnlrCG(X,yframe,rrflag)
-% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
-% %
-% Truncated, L-2 Regularized, Binomial Logistic Regression with %
-% Conjugate Gradient Solver %
-% %
-% Author: Demba Elimane Ba %
-% MIT Department of EECS %
-% Neuro Stat Research Lab (MIT Department of BCS) %
-% Date : August the 25th, 2008 %
-% %
-% Note : Matlab implementation of Paul Komarek's TR-IRLS %
-% %
-% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
-
-% Modified by Iahn Cajigas 9-23-09 to automatically add the DC term for the
-% design matrix
-
-% Arguments:
-% X: design matrix, including DC column of all ones (1st or last)
-% yframe: column vector of binary observations
-% rrflag: 1: MAP estimation with Gaussian(0,sigma^2) prior (default value
-% 1/sigma^2 = 10)
-% 0: ML estimation (1/sigma^2 = 0, i.e. sigma -> infinity)
-%
-% N.B: The equivalent call with glmfit is:
-%
-% [beta,dev,stats]=glmfit(X(:,2:end),[yframe ones(size(yframe))],'binomial','logit');
-%
-% Unlike glmfit, this function assumes that the design matrix
-% already has a column of all ones (1st or last).
-
- %Modify the design Matrix;
- [rows,~]=size(X);
-% X = [ones(rows,1), X];
- % CG parameters
- cgmax = 30;
- cgeps = 1e-3;
-
- % LR parameters
- lrmax = 100;
- lreps = 0.05;
- lambda = 10;
-
- [n,d] = size(X);
- % Perform logistic regression
- i = 0;
- % Initial guess for Beta = beta_old ?
- beta_old = zeros(d,1);
- n = X*beta_old;
- u = exp(n)./(1+exp(n));
- W = repmat(u'.*(1-u)',d,1);
- z = X*beta_old + (W(1,:)'.^-1).*(yframe - u);
-
- devold = -2*sum(yframe.*log(u) + (1-yframe).*log(1-u));
- devnew = 0;
- devdiff = abs(devnew - devold);
-
-
- while (i < lrmax && devdiff > lreps)
- % Do CG -> beta_new, i.e. solve for beta_new: XtWX*beta_new = XtWz(beta_old) using CG
-
- A = X'.*W*X; b = X'.*W*z;
-
- if rrflag == 1
- A = A + lambda*eye(size(A));
- end
-
- beta_new = cgs(A,b,cgeps,cgmax,[],[],beta_old);
- beta_old = beta_new;
-
- n = X*beta_old;
- u = exp(n)./(1+exp(n));
- W = repmat(u'.*(1-u)',d,1);
- z = X*beta_old + (W(1,:)'.^-1).*(yframe - u);
-
- devnew = -2*sum(yframe.*log(u) + (1-yframe).*log(1-u));
- devdiff = abs(devnew - devold);
- devold = devnew;
-
- i = i+1;
-
-
- end
-
- % Compute a few statistics
- stats.dfe = 0;
- stats.s = 0;
- stats.sfit = 0;
- stats.covb = inv(A);
- stats.se = sqrt(diag(stats.covb));
- stats.coeffcorr = stats.covb./sqrt((repmat(diag(stats.covb),1,d).*repmat(diag(stats.covb)',d,1)));
- stats.t = 0;
- stats.p = 0;
- stats.resid = 0;
- stats.residp = 0;
- stats.residd = 0;
- stats.resida = 0;
-end
-
-
-function [rst,varargout] = ksdiscrete(pk,st,spikeflag)
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% ksdiscrete.m
-% written by Rob Haslinger, December 2009
-%
-% This function performs time rescaling of ISIs based upon the discrete
-% time version of the time rescaling theorem as described in Haslinger,
-% Pipa and Brown (2010?). This method corrects for biases in the KS plot
-% caused by the temporal discretization.
-%
-% This function can be called in two ways
-%
-% 1) input the discrete time conditional probabilities "pk" where 0<=pk<= 1
-% and the spike train "spiketrain" which has elements either equal to 0 (no
-% spike) or 1 (spike). There is also a flag 'spiketrain' to indicate that
-% it is the full spike train.
-%
-% [rst,rstsort,xks,cb,rstoldsort] = ksdiscrete(pk,spiketrain,'spiketrain')
-%
-% 2) input the discrete time conditional probabilities "pk" and a list of
-% the indicies "spikeind" of the bin indicies that the spikes are locaed in.
-% There is also a flag 'spikeind' to indicate that the indicies are
-% being given, not the full spike train
-%
-% [rst,rstsort,xks,cb,rstoldsort] = ksdiscrete(pk,spikeind,'spikeind');
-%
-% required output:
-%
-% rst : a vector of unsorted uniformly distributed rescaled times. This is
-% the only output that is required.
-%
-% optional output, given in the order they appear in the list function
-% outputs :
-%
-% rstsort : a vector of rescaled times sorted into ascending order
-% xks : a vector of x axis values to plot the sorted rescaled times against
-% cb : the value of the 95% confidence bounds
-% rstoldsort : a vector of sorted rescaled times done without the discrete
-% time correction
-%
-% To make a KS plot one would do
-% plot(xks,rstsort,'k-');
-% hold on;
-% plot(xks,xks+cb,'k--',xks,xks-cb,'k--');
-%
-% To make a Differential KS plot one would do
-% plot(xks,rstsort-xks,'k-');
-% hold on;
-% plot(xks,zeros(length(xks))+cb,'k--',xks,zeros(length(xks))-cb);
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-% Start with determining the inputs and some basic input error checking
-
- if nargin < 3 || nargin > 3;
- error('Number of input arguments must be equal to 3');
- end;
-
- % make pk into a column vector;
-
- [m1,m2]=size(pk);
- if (m1 ~=1 && m2 ~=1); error('pk must be a vector'); end;
- if (m2>m1); pk=pk'; end;
- [m1,m2]=size(pk);
-
- % make sure pk's are within [0,1]
- index=find(pk<0);
- if isempty(index) ~=1;
- error('all values for pk must be within [0,1]');
- end;
- index=find(pk>1);
- if isempty(index) ~=1;
- error('all values for pk must be within [0,1]');
- end;
- clear index;
-
- % make column vector of spike indicies
-
- if strcmp(spikeflag,'spiketrain'); % spike train input
-
- [n1,n2]=size(st);
- if (n1 ~=1 && n2 ~=1); error('spike train must be a vector'); end;
- if (n2>n1); st=st'; end;
-
- if m1 ~= n1; error('pk and spike train must be same length'); end;
-
- spikeindicies=find(st==1);
-
- Nspikes=length(spikeindicies);
-
- elseif strcmp(spikeflag,'spikeind'); % spike index input
-
- [n1,n2]=size(st);
- if (n1 ~=1 && n2 ~=1); error('spike indicies must be a vector'); end;
- if (n2>n1); st=st'; end;
-
- spikeindicies=unique(st);
- Nspikes=length(spikeindicies);
-
- end;
-
- % check that those indicies are in [1:length(pk)];
-
- if spikeindicies(1)<1;
- error('There is at least one spike with index less than 0');
- end;
- if spikeindicies(Nspikes)>length(pk);
- error('There is at least one spike with a index greater than the length of pk');
- end;
-
- % error checking done
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Now do the actual discrete time KS test
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- % initialize random number generator
- s = RandStream('mt19937ar','Seed', sum(100*clock));
- RandStream.setDefaultStream(s);
- %rand('twister',sum(100*clock));
-
- % make the qk's
-
- qk=-log(1-pk);
-
- % make the rescaled times
-
- rst=zeros(Nspikes-1,1);
- rstold=zeros(Nspikes-1,1);
-
- for r=1:Nspikes-1;
-
- total = 0;
-
- ind1=spikeindicies(r);
- ind2=spikeindicies(r+1);
-
- total=total+sum(qk(ind1+1:ind2-1));
-
- delta=-(1/qk(ind2))*log(1-rand()*(1-exp(-qk(ind2))));
-
- total=total+qk(ind2)*delta;
-
- rst(r)=total;
-
- rstold(r)=sum(qk(ind1+1:ind2));
-
- end;
-
-% rst=1-exp(-rst);
-% rstold=1-exp(-rstold);
-
- % optional outputs
-
- rstsort=sort(rst);
- varargout{1}=rstsort;
-
- inrst=1/(Nspikes-1);
- xrst=(0.5*inrst:inrst:1-0.5*inrst)';
- varargout{2}=xrst;
-
- cb=1.36*sqrt(inrst);
- varargout{3}=cb;
-
- varargout{4}=sort(rstold);
-end
-
- Published with MATLAB® 7.11
\ No newline at end of file
diff --git a/helpfiles/AnalysisExamples.html b/helpfiles/AnalysisExamples.html
deleted file mode 100644
index 45f89676..00000000
--- a/helpfiles/AnalysisExamples.html
+++ /dev/null
@@ -1,250 +0,0 @@
-
-
-
-
- Analysis Examples
% Script glm_part1.m
-% MATLAB code to visualize data, fit a GLM model of the relation between
-% spiking and the rat's position, and visualize this model for the
-% Neuroinformatics GLM problem set.
-% The code is initialized with an overly simple GLM model construction.
-% Please improve it!
-
-% load the rat trajectory and spiking data;
-close all;
-warning off;
-load('glm_data.mat');
-
visualize the raw data
figure;
-plot(xN,yN,x_at_spiketimes,y_at_spiketimes,'r.');
-axis tightsquare;
-xlabel('x position (m)'); ylabel('y position (m)');
-
visualize your model construct a grid of positions to plot the model against...
figure;
-[x_new,y_new]=meshgrid(-1:.1:1);
-y_new = flipud(y_new);
-x_new = fliplr(x_new);
-
-% compute lambda for each point on this grid using the GLM model
-lambda = exp(b(1) + b(2)*x_new + b(3)*y_new + b(4)*x_new.^2 + b(5)*y_new.^2 + b(6)*x_new.*y_new);
-lambda((x_new.^2+y_new.^2>1))=nan;
-
-%plot lambda as a function position over this grid
-h_mesh = mesh(x_new,y_new,lambda,'AlphaData',0);
-get(h_mesh,'AlphaData');
-set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.8,'EdgeColor','b');
-hold on;
-plot3(cos(-pi:1e-2:pi),sin(-pi:1e-2:pi),zeros(size(-pi:1e-2:pi))); hold on;
-plot(xN,yN,x_at_spiketimes,y_at_spiketimes,'r.');
-axis tightsquare;
-xlabel('x position (m)'); ylabel('y position (m)');
-
Compare a linear model versus a Gaussian GLM model.
[b_lin,dev_lin,stats_lin] = glmfit([xN yN],spikes_binned,'poisson');
-[b_quad,dev_quad,stats_quad] = glmfit([xN yN xN.^2 yN.^2 xN.*yN],spikes_binned,'poisson');
-
-lambdaEst_lin = exp( b_lin(1) + b_lin(2)*xN+b_lin(3)*yN); % based on our GLM model with the log "link function"
-lambdaEst_quad = exp( b_quad(1) + b_quad(2)*xN+b_quad(3)*yN+b_quad(4)*xN.^2 +b_quad(5)*yN.^2 +b_quad(6)*xN.*yN);
-
Make the KS Plot
% ******* K-S Plot *******************
-% graph the K-S plot and confidence intervals for the K-S statistic
-
-%first generate the conditional intensity at each timestep
-% ** Adjust the below line according to your choice of model.
-% remember to include a column of ones to multiply the default constant GLM parameter beta_0**
-
-% Use your parameter estimates (b) from glmfit along
-% with the covariates you used (xN, yN, ...)
-
-lambdaEst=[lambdaEst_lin, lambdaEst_quad];
-timestep = 1;
-lambdaInt = 0;
-j=0;
-KS=[];
-for t=1:length(spikes_binned),
- lambdaInt = lambdaInt + lambdaEst(t,:)*timestep;
- if (spikes_binned(t)),
- j = j + 1;
- KS(j,:) = 1-exp(-lambdaInt);
- lambdaInt = [0 0];
- end;
-end;
-KSSorted = sort( KS );
-N = length( KSSorted);
-figure;
-plot( ([1:N]-.5)/N, KSSorted, 0:.01:1,0:.01:1, 'g',0:.01:1, [0:.01:1]+1.36/sqrt(N), 'r', 0:.01:1,[0:.01:1]-1.36/sqrt(N), 'r' );
-axis( [0 1 0 1] );
-xlabel('Uniform CDF');
-ylabel('Empirical CDF of Rescaled ISIs');
-title('KS Plot with 95% Confidence Intervals');
-legend('Linear','Quadratic');
-
\ No newline at end of file
diff --git a/helpfiles/AnalysisExamples.m b/helpfiles/AnalysisExamples.m
deleted file mode 100644
index b719a482..00000000
--- a/helpfiles/AnalysisExamples.m
+++ /dev/null
@@ -1,103 +0,0 @@
-%% Analysis Examples
-% This is an example on the standard approach to fitting GLM models to
-% spike train data. This data set was obtained at the Society For
-% Neuroscience '08 Workshop on
-%
-% Compare to analysis with
-%
-%% Example 1: Tradition Preliminary Analysis
-
-% Script glm_part1.m
-% MATLAB code to visualize data, fit a GLM model of the relation between
-% spiking and the rat's position, and visualize this model for the
-% Neuroinformatics GLM problem set.
-% The code is initialized with an overly simple GLM model construction.
-% Please improve it!
-
-% load the rat trajectory and spiking data;
-close all;
-warning off;
-load('glm_data.mat');
-
-%%
-% visualize the raw data
-figure;
-plot(xN,yN,x_at_spiketimes,y_at_spiketimes,'r.');
-axis tight square;
-xlabel('x position (m)'); ylabel('y position (m)');
-
-%%
-% fit a GLM model to the x and y positions.
-[b,dev,stats] = glmfit([xN yN (xN.^2-mean(xN.^2)) (yN.^2-mean(yN.^2)) (xN.*yN-mean(xN.*yN))],spikes_binned,'poisson');
-figure;
-errorbar(1:length(b), b, stats.se,'.');
-xticks=1:length(b);
-xtickLabels= {'baseline','x','y','x^2','y^2','x*y'};
-set(gca,'xtick',xticks,'xtickLabel',xtickLabels);
-
-%%
-% visualize your model
-% construct a grid of positions to plot the model against...
-figure;
-[x_new,y_new]=meshgrid(-1:.1:1);
-y_new = flipud(y_new);
-x_new = fliplr(x_new);
-
-% compute lambda for each point on this grid using the GLM model
-lambda = exp(b(1) + b(2)*x_new + b(3)*y_new + b(4)*x_new.^2 + b(5)*y_new.^2 + b(6)*x_new.*y_new);
-lambda((x_new.^2+y_new.^2>1))=nan;
-
-%plot lambda as a function position over this grid
-h_mesh = mesh(x_new,y_new,lambda,'AlphaData',0);
-get(h_mesh,'AlphaData');
-set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.8,'EdgeColor','b');
-hold on;
-plot3(cos(-pi:1e-2:pi),sin(-pi:1e-2:pi),zeros(size(-pi:1e-2:pi))); hold on;
-plot(xN,yN,x_at_spiketimes,y_at_spiketimes,'r.');
-axis tight square;
-xlabel('x position (m)'); ylabel('y position (m)');
-
-
-%%
-% Compare a linear model versus a Gaussian GLM model.
-[b_lin,dev_lin,stats_lin] = glmfit([xN yN],spikes_binned,'poisson');
-[b_quad,dev_quad,stats_quad] = glmfit([xN yN xN.^2 yN.^2 xN.*yN],spikes_binned,'poisson');
-
-lambdaEst_lin = exp( b_lin(1) + b_lin(2)*xN+b_lin(3)*yN); % based on our GLM model with the log "link function"
-lambdaEst_quad = exp( b_quad(1) + b_quad(2)*xN+b_quad(3)*yN+b_quad(4)*xN.^2 +b_quad(5)*yN.^2 +b_quad(6)*xN.*yN);
-
-%%
-% Make the KS Plot
-
-% ******* K-S Plot *******************
-% graph the K-S plot and confidence intervals for the K-S statistic
-
-%first generate the conditional intensity at each timestep
-% ** Adjust the below line according to your choice of model.
-% remember to include a column of ones to multiply the default constant GLM parameter beta_0**
-
-% Use your parameter estimates (b) from glmfit along
-% with the covariates you used (xN, yN, ...)
-
-lambdaEst=[lambdaEst_lin, lambdaEst_quad];
-timestep = 1;
-lambdaInt = 0;
-j=0;
-KS=[];
-for t=1:length(spikes_binned),
- lambdaInt = lambdaInt + lambdaEst(t,:)*timestep;
- if (spikes_binned(t)),
- j = j + 1;
- KS(j,:) = 1-exp(-lambdaInt);
- lambdaInt = [0 0];
- end;
-end;
-KSSorted = sort( KS );
-N = length( KSSorted);
-figure;
-plot( ([1:N]-.5)/N, KSSorted, 0:.01:1,0:.01:1, 'g',0:.01:1, [0:.01:1]+1.36/sqrt(N), 'r', 0:.01:1,[0:.01:1]-1.36/sqrt(N), 'r' );
-axis( [0 1 0 1] );
-xlabel('Uniform CDF');
-ylabel('Empirical CDF of Rescaled ISIs');
-title('KS Plot with 95% Confidence Intervals');
-legend('Linear','Quadratic');
\ No newline at end of file
diff --git a/helpfiles/AnalysisExamples.png b/helpfiles/AnalysisExamples.png
deleted file mode 100644
index b69c76a8..00000000
Binary files a/helpfiles/AnalysisExamples.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples2.html b/helpfiles/AnalysisExamples2.html
deleted file mode 100644
index a92f174e..00000000
--- a/helpfiles/AnalysisExamples2.html
+++ /dev/null
@@ -1,267 +0,0 @@
-
-
-
-
- AnalysisExamples2
Compare with traditional Neural Spike Train Analysis here
% load the rat trajectory and spiking data;
-close all;
-warning off;
-load('glm_data.mat');
-
-nst = nspikeTrain(spiketimes);
-baseline = Covariate(T,ones(length(xN),1),'Baseline','time','s','',{'mu'});
-position = Covariate(T,[xN yN],'Position', 'time','s','m',{'x','y'});
-velocity = Covariate(T,[vxN,vyN],'Velocity','time','s','m/s',{'v_x','v_y'});
-radial = Covariate(T,[xN yN xN.^2 yN.^2 xN.*yN],'Radial','time','s','m',{'x','y','x^2','y^2','x*y'});
-% could just define velocity = postion.derivative;
-
-%possibly add view as vector for covariates of dimension 3 or less
-
In the original analysis, we already had vectors of the covariates sampled at the spiketimes. This step would require interpolating the covariates and then sampling them at each of the spikeTimes. In our case this is quite simple.
Visualize the firing rates as a function of the spatial covariates
figure;
-[x_new,y_new]=meshgrid(-1:.1:1); %define new x and y
-y_new = flipud(y_new);
-x_new = fliplr(x_new);
-
-%For each covariate new to place the new data in a cell array
-newData{1} =ones(size(x_new));
-newData{2} =x_new; newData{3} =y_new;
-newData{4} =x_new.^2; newData{5} =y_new.^2;
-newData{6} =x_new.*y_new;
-color = Analysis.colors;
-
-% Evaluate our fits using the new parameters
-for i=1:fitResults.numResults
-
- lambda = fitResults.evalLambda(i,newData);
- h_mesh = mesh(x_new,y_new,lambda,'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.8,'EdgeColor',color{i});
- %figure;
- hold on;
-end
-legend(fitResults.lambda.dataLabels);
-plot(position.getSubSignal('x').dataToMatrix,position.getSubSignal('y').dataToMatrix,...
- values_at_spiketimes(:,1),values_at_spiketimes(:,2),'r.');
-axis tightsquare;
-xlabel('x position (m)'); ylabel('y position (m)');
-
Toolbox vs. Standard GLM comparison
Compare the results using our approach with the standard approach used in the first example previous standard regression
[b,dev,stats] = glmfit([xN yN xN.^2 yN.^2 xN.*yN],spikes_binned,'poisson');
-b-fitResults.b{2} % should be close to zero
-
\ No newline at end of file
diff --git a/helpfiles/AnalysisExamples2.m b/helpfiles/AnalysisExamples2.m
deleted file mode 100644
index 3e6cce0c..00000000
--- a/helpfiles/AnalysisExamples2.m
+++ /dev/null
@@ -1,103 +0,0 @@
-%% Analysis Examples 2
-% Compare with traditional Neural Spike Train Analysis
-%
-
-% load the rat trajectory and spiking data;
-close all;
-warning off;
-load('glm_data.mat');
-
-nst = nspikeTrain(spiketimes);
-baseline = Covariate(T,ones(length(xN),1),'Baseline','time','s','',{'mu'});
-position = Covariate(T,[xN yN],'Position', 'time','s','m',{'x','y'});
-velocity = Covariate(T,[vxN,vyN],'Velocity','time','s','m/s',{'v_x','v_y'});
-radial = Covariate(T,[xN yN xN.^2 yN.^2 xN.*yN],'Radial','time','s','m',{'x','y','x^2','y^2','x*y'});
-% could just define velocity = postion.derivative;
-
-%possibly add view as vector for covariates of dimension 3 or less
-%%
-% In the original analysis, we already had vectors of the covariates
-% sampled at the spiketimes. This step would require interpolating the
-% covariates and then sampling them at each of the spikeTimes. In our case
-% this is quite simple.
-
-[values_at_spiketimes] =position.getValueAt(spiketimes);
-
-%%
-% We could also upsample our data to get better estimates of the covariates
-% at these points
-
-[values_at_spiketimes] =position.resample(1/min(diff(spiketimes))).getValueAt(spiketimes);
-
-%%
-% visualize the raw data
-figure;
-plot(position.getSubSignal('x').dataToMatrix,position.getSubSignal('y').dataToMatrix,...
- values_at_spiketimes(:,1),values_at_spiketimes(:,2),'r.');
-axis tight square;
-xlabel('x position (m)'); ylabel('y position (m)');
-
-%%
-% Create a trial object and define the fits that we want to run
-spikeColl = nstColl({nst});
-covarColl = CovColl({baseline,radial});
-trial = Trial(spikeColl,covarColl);
-clear tc;
-sampleRate=1000;
-% tcObj=TrialConfig(covMask,sampleRate, history,minTime,maxTime)
-tc{1} = TrialConfig({{'Baseline','mu'},{'Radial','x','y'}},sampleRate,[]); tc{1}.setName('Linear');
-tc{2} = TrialConfig({{'Baseline','mu'},{'Radial','x','y','x^2','y^2','x*y'}},sampleRate,[]); tc{2}.setName('Quadratic');
-tc{3} = TrialConfig({{'Baseline','mu'},{'Radial','x','y','x^2','y^2','x*y'}},sampleRate,[0 1]./sampleRate); tc{3}.setName('Quadratic+Hist');
-
-%%
-% Create our collection of configurations and run the analysis;
-tcc = ConfigColl(tc); makePlot=1; neuronNum=1;
-fitResults =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
-fitResults.plotResults;
-
-%%
-% Visualize the firing rates as a function of the spatial covariates
-figure;
-[x_new,y_new]=meshgrid(-1:.1:1); %define new x and y
-y_new = flipud(y_new);
-x_new = fliplr(x_new);
-
-%For each covariate new to place the new data in a cell array
-newData{1} =ones(size(x_new));
-newData{2} =x_new; newData{3} =y_new;
-newData{4} =x_new.^2; newData{5} =y_new.^2;
-newData{6} =x_new.*y_new;
-color = Analysis.colors;
-
-% Evaluate our fits using the new parameters
-for i=1:fitResults.numResults
-
- lambda = fitResults.evalLambda(i,newData);
- h_mesh = mesh(x_new,y_new,lambda,'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.8,'EdgeColor',color{i});
- %figure;
- hold on;
-end
-legend(fitResults.lambda.dataLabels);
-plot(position.getSubSignal('x').dataToMatrix,position.getSubSignal('y').dataToMatrix,...
- values_at_spiketimes(:,1),values_at_spiketimes(:,2),'r.');
-axis tight square;
-xlabel('x position (m)'); ylabel('y position (m)');
-
-%% Toolbox vs. Standard GLM comparison
-% Compare the results using our approach with the standard approach used in
-% the first example previous standard regression
-[b,dev,stats] = glmfit([xN yN xN.^2 yN.^2 xN.*yN],spikes_binned,'poisson');
-b-fitResults.b{2} % should be close to zero
-
-
-
-%% Compute the history effect
-sampleRate=1000; makePlot=1; neuronNum = 1;
-covLabels = {{'Baseline','mu'},{'Radial','x','y','x^2','y^2','x*y'}};
-Algorithm = 'GLM';
-batchMode=0;
-windowTimes =(0:1:10)./sampleRate;
-% [fitResults,tcc] = computeHistLag(tObj,neuronNum,windowTimes,CovLabels,Algorithm,batchMode,sampleRate,makePlot,histMinTimes,histMaxTimes)
-[fitResults,tcc] = Analysis.computeHistLag(trial,neuronNum,windowTimes,covLabels,Algorithm,batchMode,sampleRate,makePlot);
diff --git a/helpfiles/AnalysisExamples2.png b/helpfiles/AnalysisExamples2.png
deleted file mode 100644
index 745b81e7..00000000
Binary files a/helpfiles/AnalysisExamples2.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples2_01.png b/helpfiles/AnalysisExamples2_01.png
deleted file mode 100644
index 6d62d352..00000000
Binary files a/helpfiles/AnalysisExamples2_01.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples2_02.png b/helpfiles/AnalysisExamples2_02.png
deleted file mode 100644
index e687798e..00000000
Binary files a/helpfiles/AnalysisExamples2_02.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples2_03.png b/helpfiles/AnalysisExamples2_03.png
deleted file mode 100644
index 01c46946..00000000
Binary files a/helpfiles/AnalysisExamples2_03.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples2_04.png b/helpfiles/AnalysisExamples2_04.png
deleted file mode 100644
index 75b64706..00000000
Binary files a/helpfiles/AnalysisExamples2_04.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples_01.png b/helpfiles/AnalysisExamples_01.png
deleted file mode 100644
index a00c49f0..00000000
Binary files a/helpfiles/AnalysisExamples_01.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples_02.png b/helpfiles/AnalysisExamples_02.png
deleted file mode 100644
index 06465b04..00000000
Binary files a/helpfiles/AnalysisExamples_02.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples_03.png b/helpfiles/AnalysisExamples_03.png
deleted file mode 100644
index 132e7a6e..00000000
Binary files a/helpfiles/AnalysisExamples_03.png and /dev/null differ
diff --git a/helpfiles/AnalysisExamples_04.png b/helpfiles/AnalysisExamples_04.png
deleted file mode 100644
index e4e81f13..00000000
Binary files a/helpfiles/AnalysisExamples_04.png and /dev/null differ
diff --git a/helpfiles/ClassDefinitions.html b/helpfiles/ClassDefinitions.html
deleted file mode 100644
index 9d25256d..00000000
--- a/helpfiles/ClassDefinitions.html
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
-
- Class Definitions
Class Definitions
Summaries of each of the available classes along with corresponding source code can be accessed below:
\ No newline at end of file
diff --git a/helpfiles/ConfigCollExamples.m b/helpfiles/ConfigCollExamples.m
deleted file mode 100644
index c128bd13..00000000
--- a/helpfiles/ConfigCollExamples.m
+++ /dev/null
@@ -1,5 +0,0 @@
-%% ConfigColl Examples
-% tcObj=TrialConfig(covMask,sampleRate, history,minTime,maxTime)
-tc1 = TrialConfig({'Force','f_x'},2000,[.1 .2],-1,2);
-tc2 = TrialConfig({'Position','x'},2000,[.1 .2],-1,2);
-tcc = ConfigColl({tc1,tc2});
\ No newline at end of file
diff --git a/helpfiles/CovCollExamples.asv b/helpfiles/CovCollExamples.asv
deleted file mode 100644
index f33d1dad..00000000
--- a/helpfiles/CovCollExamples.asv
+++ /dev/null
@@ -1,17 +0,0 @@
-%% Test CovColl
-close all;
-load Covariates.mat;
-cc=CovColl({position,force});
-figure; cc.plot; %plots all covariates and their components
-
-cc.getCov(1); %returns position;
-cc.getCov('Position');
-cc.getCov({'Position','Force'});
-cc.resample(200); %resamples both position and force
-
-
-cc.setMask({{'Position','x'},{'Force','f_y'}});
-figure; cc.plot; %plot only x and f_y;
-
-dataToMatrix
-s
diff --git a/helpfiles/CovCollExamples.html b/helpfiles/CovCollExamples.html
deleted file mode 100644
index ed7af83a..00000000
--- a/helpfiles/CovCollExamples.html
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
- Test CovColl
Test CovColl
close all;
-load CovariateSample.mat;
-cc=CovColl({position,force});
-figure; cc.plot; %plots all covariates and their components
-
-cc.getCov(1); %returns position;
-cc.getCov('Position');
-cc.getCov({'Position','Force'});
-cc.resample(200); %resamples both position and force
-
-
-cc.setMask({{'Position','x'},{'Force','f_y'}});
-figure; cc.plot; %plot only x and f_y;
-
-% dataToMatrix
-% setMaxTime
-% setMinTime
-% removeCovariate
-% nActCovar
-
\ No newline at end of file
diff --git a/helpfiles/CovCollExamples.m b/helpfiles/CovCollExamples.m
deleted file mode 100644
index 8eca85ae..00000000
--- a/helpfiles/CovCollExamples.m
+++ /dev/null
@@ -1,21 +0,0 @@
-%% Test CovColl
-close all;
-load CovariateSample.mat;
-cc=CovColl({position,force});
-figure; cc.plot; %plots all covariates and their components
-
-cc.getCov(1); %returns position;
-cc.getCov('Position');
-cc.getCov({'Position','Force'});
-cc.resample(200); %resamples both position and force
-
-
-cc.setMask({{'Position','x'},{'Force','f_y'}});
-figure; cc.plot; %plot only x and f_y;
-
-% dataToMatrix
-% setMaxTime
-% setMinTime
-% removeCovariate
-% nActCovar
-
diff --git a/helpfiles/CovCollExamples.png b/helpfiles/CovCollExamples.png
deleted file mode 100644
index ae126785..00000000
Binary files a/helpfiles/CovCollExamples.png and /dev/null differ
diff --git a/helpfiles/CovCollExamples_01.png b/helpfiles/CovCollExamples_01.png
deleted file mode 100644
index 7f64977c..00000000
Binary files a/helpfiles/CovCollExamples_01.png and /dev/null differ
diff --git a/helpfiles/CovCollExamples_02.png b/helpfiles/CovCollExamples_02.png
deleted file mode 100644
index 4cc82765..00000000
Binary files a/helpfiles/CovCollExamples_02.png and /dev/null differ
diff --git a/helpfiles/CovariateExamples.asv b/helpfiles/CovariateExamples.asv
deleted file mode 100644
index b02d32a0..00000000
--- a/helpfiles/CovariateExamples.asv
+++ /dev/null
@@ -1,39 +0,0 @@
-%% Test the Cov class
-% Covariates are just like signals with a mean and a standard deviation
-% They have two representations, the default (original representation) and
-% a zero-mean representation
-
-%% Example 1: Using Covariates
-% Create some Data
-close all;
-t=0:.01:5; t=t';
-x=exp(-t);
-y=sin(2*pi*t)+.2*randn(length(t),1);
-z=(-y).^3+.2*rand(length(t),1);
-
-fx=abs(y);
-fy=abs(y)-sign(;
-
-%%
-% Define labels and plotting properties for each Covariate
-dLabels1={'f_x','f_y'};
-dLabels2={'x','y','z'};
-
-plotProps = {{' ''g'', ''LineWidth'' ,.5'},... %for x
- {' ''k'', ''LineWidth'' ,.5'},... %for y
- {' ''b'' '}}; %for z
-
-force = Covariate(t, [fx fy], 'Force', 'time', 's', 'N', dLabels1);
-position=Covariate(t,[x y z], 'Position','time','s','cm', dLabels2);
-
-%%
-% Plot the covariates and change their properties
-position.getSigRep.plot('all',plotProps); %same as position.plot
-plotPropsForce = {{' ''g'', ''LineWidth'' ,.5'},{' ''k'', ''LineWidth'' ,.5'}};
-figure;
-subplot(1,2,1); force.getSigRep.plot('all',plotPropsForce);
-% can also set these properties as default by calling
-% >>force.setPlotProps(plotPropsForce);
-% >>force.plot;
-
-subplot(1,2,2); force.getSigRep('zero-mean').plot('all',plotPropsForce);
diff --git a/helpfiles/CovariateExamples.html b/helpfiles/CovariateExamples.html
deleted file mode 100644
index 232a0f45..00000000
--- a/helpfiles/CovariateExamples.html
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
- Test the Cov class
Test the Cov class
Covariates are just like signals with a mean and a standard deviation They have two representations, the default (original representation) and a zero-mean representation
position.getSigRep.plot('all',plotProps); %same as position.plot
-plotPropsForce = {{' ''b'' '},{' ''k'' '}};
-figure;
-subplot(1,2,1); force.getSigRep.plot('all',plotPropsForce);
-% can also set these properties as default by calling
-% >>force.setPlotProps(plotPropsForce);
-% >>force.plot;
-
-subplot(1,2,2); force.getSigRep('zero-mean').plot('all',plotPropsForce);
-
- Published with MATLAB® 7.9
\ No newline at end of file
diff --git a/helpfiles/CovariateExamples.m b/helpfiles/CovariateExamples.m
deleted file mode 100644
index 0f483059..00000000
--- a/helpfiles/CovariateExamples.m
+++ /dev/null
@@ -1,39 +0,0 @@
-%% Test the Cov class
-% Covariates are just like signals with a mean and a standard deviation
-% They have two representations, the default (original representation) and
-% a zero-mean representation
-
-%% Example 1: Using Covariates
-% Create some Data
-close all;
-t=0:.01:5; t=t';
-x=exp(-t);
-y=sin(2*pi*t);
-z=(-y).^3;
-
-fx=abs(y);
-fy=abs(y).^2;
-
-%%
-% Define labels and plotting properties for each Covariate
-dLabels1={'f_x','f_y'};
-dLabels2={'x','y','z'};
-
-plotProps = {{' ''g'', ''LineWidth'' ,.5'},... %for x
- {' ''k'', ''LineWidth'' ,.5'},... %for y
- {' ''b'' '}}; %for z
-
-force = Covariate(t, [fx fy], 'Force', 'time', 's', 'N', dLabels1);
-position=Covariate(t,[x y z], 'Position','time','s','cm', dLabels2);
-
-%%
-% Plot the covariates and change their properties
-position.getSigRep.plot('all',plotProps); %same as position.plot
-plotPropsForce = {{' ''b'' '},{' ''k'' '}};
-figure;
-subplot(1,2,1); force.getSigRep.plot('all',plotPropsForce);
-% can also set these properties as default by calling
-% >>force.setPlotProps(plotPropsForce);
-% >>force.plot;
-
-subplot(1,2,2); force.getSigRep('zero-mean').plot('all',plotPropsForce);
diff --git a/helpfiles/CovariateExamples.png b/helpfiles/CovariateExamples.png
deleted file mode 100644
index d8373eb8..00000000
Binary files a/helpfiles/CovariateExamples.png and /dev/null differ
diff --git a/helpfiles/CovariateExamples_01.png b/helpfiles/CovariateExamples_01.png
deleted file mode 100644
index 18cf1781..00000000
Binary files a/helpfiles/CovariateExamples_01.png and /dev/null differ
diff --git a/helpfiles/CovariateExamples_02.png b/helpfiles/CovariateExamples_02.png
deleted file mode 100644
index accab208..00000000
Binary files a/helpfiles/CovariateExamples_02.png and /dev/null differ
diff --git a/helpfiles/CovariateSample.mat b/helpfiles/CovariateSample.mat
deleted file mode 100644
index 915aadee..00000000
Binary files a/helpfiles/CovariateSample.mat and /dev/null differ
diff --git a/helpfiles/DecodingExample.html b/helpfiles/DecodingExample.html
deleted file mode 100644
index 2f1f35e0..00000000
--- a/helpfiles/DecodingExample.html
+++ /dev/null
@@ -1,241 +0,0 @@
-
-
-
-
- STIMULUS DECODING
STIMULUS DECODING
In this example we show how to decode a univariate and a bivariate stimulus based on a point process observations using nSTAT. Even though due to the simulated nature of the data, we know the exact condition intensity function, we estimate the parameters before moving on to the decoding stage.
So we now have a model for lambda lambda = exp(b_0 + b_1*x(t))./(1+exp(b_0 + b_1*x(t)) * 1/delta because exp(b_0 + b_1*x(t))<<1 we can approximate this lambda by just the numerator i.e. lambda = exp(b_0 + b_1*x(t))./delta
Now suppose we wanted to decode x(t) based on only having observed lambda
clear lambdaCIF;
-b0=paramEst(1,:);
-b1=paramEst(2,:);
-for i=1:numRealizations
- % Construct a CIF object for each realization based on our encoding
- % results abovel
- lambdaCIF{i} = CIF([b0(i) b1(i)],{'1','x'},{'x'},'binomial');
-end
-% close all;
-spikeColl.resample(1/delta);
-dN=spikeColl.dataToMatrix;
-% Make noise according to the dynamic range of the stimulus
-Q=2*std(stim.data(2:end)-stim.data(1:end-1));
-A=1;
-[x_p, W_p, x_u, W_u] = DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN',b0,b1,'binomial',delta);
-figure;
-zVal=3;
-ciLower = min(x_u(1:end)-zVal*squeeze(sqrt(W_u(1:end)))',x_u(1:end)+zVal*squeeze(sqrt(W_u(1:end)))');
-ciUpper = max(x_u(1:end)-zVal*squeeze(sqrt(W_u(1:end)))',x_u(1:end)+zVal*squeeze(sqrt(W_u(1:end)))');
-hEst=plot(time,x_u(1:end),'b',time,ciLower,'g',time,ciUpper,'g'); hold on;
-hold all;
-
-hStim=stim.plot([],{{' ''k'',''Linewidth'',2'}});
-legend off;
-legend([hEst(1) hEst(2) hEst(3) hStim],'x_{k|k}(t)',strcat('x_{k|k}(t)-',num2str(zVal),'\sigma_{k|k}'),...
- strcat('x_{k|k}(t)+',num2str(zVal),'\sigma_{k|k}'),'x_{k|k}(t)','x(t)');
-title(['Decoded Stimulus +/- 99% confidence intervals using ' num2str(numRealizations) ' cells']);
-
\ No newline at end of file
diff --git a/helpfiles/DecodingExample.m b/helpfiles/DecodingExample.m
deleted file mode 100644
index 04352c99..00000000
--- a/helpfiles/DecodingExample.m
+++ /dev/null
@@ -1,100 +0,0 @@
-%% STIMULUS DECODING
-% In this example we show how to decode a univariate and a bivariate
-% stimulus based on a point process observations using nSTAT. Even though
-% due to the simulated nature of the data, we know the exact condition
-% intensity function, we estimate the parameters before moving on to the
-% decoding stage.
-%% Generate the conditional Intensity Function
-
- close all;
- delta = 0.001; Tmax = 10;
- time = 0:delta:Tmax;
- f=.1; b1=1;b0=-3;
- x = sin(2*pi*f*time);
- expData = exp(b1*x+b0);
- lambdaData = expData./(1+expData);
-
- lambda = Covariate(time,lambdaData./delta, '\Lambda(t)','time','s','Hz',{'\lambda_{1}'},{{' ''b'', ''LineWidth'' ,2'}});
-
- numRealizations = 10;
- spikeColl = CIF.simulateCIFByThinningFromLambda(lambda,numRealizations);
- figure;
- subplot(2,1,1); spikeColl.plot;
- subplot(2,1,2); lambda.plot;
-
-%% Fit a model to the spikedata to obtain a model CIF
-
-stim = Covariate(time,sin(2*pi*f*time),'Stimulus','time','s','V',{'stim'});
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
- {'constant'});
-figure;
-cc = CovColl({stim,baseline});
-trial = Trial(spikeColl,cc);
-trial.plot;
-
-clear c;
-selfHist = [] ; NeighborHist = []; sampleRate = 1000;
-c{1} = TrialConfig({{'Baseline','constant'}},sampleRate,selfHist,...
- NeighborHist);
-c{1}.setName('Baseline');
-c{2} = TrialConfig({{'Baseline','constant'},{'Stimulus','stim'}},...
- sampleRate,selfHist,NeighborHist);
-c{2}.setName('Baseline+Stimulus');
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-figure;
-results{1}.plotResults;
-Summary = FitResSummary(results);
-
-paramEst = squeeze(Summary.bAct(:,2,:));
-meanParams = mean(paramEst,2);
-
-%%
-% So we now have a model for lambda
-% lambda = exp(b_0 + b_1*x(t))./(1+exp(b_0 + b_1*x(t)) * 1/delta
-% because exp(b_0 + b_1*x(t))<<1 we can approximate this lambda by
-% just the numerator i.e.
-% lambda = exp(b_0 + b_1*x(t))./delta
-%
-%
-% Now suppose we wanted to decode x(t) based on only having observed lambda
-%
-%
-%
-
-clear lambdaCIF;
-b0=paramEst(1,:);
-b1=paramEst(2,:);
-for i=1:numRealizations
- % Construct a CIF object for each realization based on our encoding
- % results abovel
- lambdaCIF{i} = CIF([b0(i) b1(i)],{'1','x'},{'x'},'binomial');
-end
-% close all;
-spikeColl.resample(1/delta);
-dN=spikeColl.dataToMatrix;
-% Make noise according to the dynamic range of the stimulus
-Q=2*std(stim.data(2:end)-stim.data(1:end-1));
-A=1;
-[x_p, W_p, x_u, W_u] = DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN',b0,b1,'binomial',delta);
-figure;
-zVal=3;
-ciLower = min(x_u(1:end)-zVal*squeeze(sqrt(W_u(1:end)))',x_u(1:end)+zVal*squeeze(sqrt(W_u(1:end)))');
-ciUpper = max(x_u(1:end)-zVal*squeeze(sqrt(W_u(1:end)))',x_u(1:end)+zVal*squeeze(sqrt(W_u(1:end)))');
-hEst=plot(time,x_u(1:end),'b',time,ciLower,'g',time,ciUpper,'g'); hold on;
-hold all;
-
-hStim=stim.plot([],{{' ''k'',''Linewidth'',2'}});
-legend off;
-legend([hEst(1) hEst(2) hEst(3) hStim],'x_{k|k}(t)',strcat('x_{k|k}(t)-',num2str(zVal),'\sigma_{k|k}'),...
- strcat('x_{k|k}(t)+',num2str(zVal),'\sigma_{k|k}'),'x_{k|k}(t)','x(t)');
-title(['Decoded Stimulus +/- 99% confidence intervals using ' num2str(numRealizations) ' cells']);
-
-
-
-
-
-
-
-
-
diff --git a/helpfiles/DecodingExample.png b/helpfiles/DecodingExample.png
deleted file mode 100644
index 0fb71d5f..00000000
Binary files a/helpfiles/DecodingExample.png and /dev/null differ
diff --git a/helpfiles/DecodingExampleWithHist.html b/helpfiles/DecodingExampleWithHist.html
deleted file mode 100644
index 3a72196f..00000000
--- a/helpfiles/DecodingExampleWithHist.html
+++ /dev/null
@@ -1,242 +0,0 @@
-
-
-
-
- 1-D Stimulus Decode with History Effect
1-D Stimulus Decode with History Effect
In the above decoding example, the simulated neurons did not have memory. That is their previous firing activity did not modulate their current probability of firing. In reality the firing history does affect the probabilty of neuronal firing (eg. refractory period, bursting, etc.). In this example, we simulate a population a neurons that exhibit this type of history dependence. We then decode the stimulus activity based on a conditional intensity function that includes the correct history terms and one that assumes no history dependence.
close all;
-% clear all;
-delta = 0.001; Tmax = 1;
-time = 0:delta:Tmax;
-f=1; b1=1;b0=-2;
-stimData = b1*sin(2*pi*f*time);
-e = zeros(length(time),1); %No Ensemble input
-mu = b0; %baseline firing rate
-Ts=delta;
-
-histCoeffs= [-2 -2 -4];
-windowTimes=[0 .001 0.002 0.003];
-histObj = History(windowTimes);
-filts = histObj.toFilter(Ts); %Convert to transfer function matrix
-H=histCoeffs*filts; %scale each window transfer function by its coefficient
-S=tf([1],1,Ts,'Variable','z^-1'); %Feed the stimulus in directly
-E=tf([0],1,Ts,'Variable','z^-1'); %No ensemble effect
-stim=Covariate(time',stimData,'Stimulus','time','s','Voltage',{'sin'});
-ens =Covariate(time',e,'Ensemble','time','s','Spikes',{'n1'});
-numRealizations = 20; %Number of sample paths to generate
-sC=CIF.simulateCIF(mu,H,S,E,stim,ens,numRealizations);
-
-figure;
-subplot(2,1,1); sC.plot;
-subplot(2,1,2); stim.plot;
-
-
-for i=1:numRealizations
-% Construct a CIF object for each realization based on our encoding
-% results above
- %correct CIF w/ History
- lambdaCIF{i} = CIF([mu b1],{'1','x'},{'x'},'binomial',histCoeffs,histObj);
- %CIF ignoring the history effect
- lambdaCIFNoHist{i} = CIF([mu b1],{'1','x'},{'x'},'binomial');
-end
-
-
-
-
-sC.resample(1/delta);
-dN=sC.dataToMatrix;
-% Make noise according to the dynamic range of the stimulus
-Q=2*std(stim.data(2:end)-stim.data(1:end-1));
-Px0=.1; A=1;
-% Decode with the correct and incorrect CIFs
-
-[x_p, W_p, x_u, W_u] = DecodingAlgorithms.PPDecodeFilter(A, Q, Px0, dN',lambdaCIF,delta);
-[x_pNoHist, W_pNoHist, x_uNoHist, W_uNoHist] = DecodingAlgorithms.PPDecodeFilter(A, Q, Px0, dN',lambdaCIFNoHist,delta);
-
-
-% Compare the results
-figure;
-subplot(2,1,1);
-zVal=3;
-ciLower = min(x_u(1:end)-zVal*squeeze(W_u(1:end))',x_u(1:end)+zVal*squeeze(W_u(1:end))');
-ciUpper = max(x_u(1:end)-zVal*squeeze(W_u(1:end))',x_u(1:end)+zVal*squeeze(W_u(1:end))');
-hEst=plot(time,x_u(1:end),'b',time,ciLower,'g',time,ciUpper,'r'); hold on;
-hold all;
-
-hStim=stim.plot([],{{' ''k'',''Linewidth'',2'}});
-legend off;
-legend([hEst(1) hEst(2) hEst(3) hStim],'x_{k|k}(t)',strcat('x_{k|k}(t)-',num2str(zVal),'\sigma_{k|k}'),...
- strcat('x_{k|k}(t)+',num2str(zVal),'\sigma_{k|k}'),'x_{k|k}(t)','x(t)');
-title(['Decoded Stimulus +/- 99% confidence intervals using ' num2str(numRealizations) ' cells']);
-
-subplot(2,1,2);
-zVal=3;
-ciLower = min(x_uNoHist(1:end)-zVal*squeeze(W_uNoHist(1:end))',x_uNoHist(1:end)+zVal*squeeze(W_uNoHist(1:end))');
-ciUpper = max(x_uNoHist(1:end)-zVal*squeeze(W_uNoHist(1:end))',x_uNoHist(1:end)+zVal*squeeze(W_uNoHist(1:end))');
-hEst=plot(time,x_uNoHist(1:end),'b',time,ciLower,'g',time,ciUpper,'r'); hold on;
-hold all;
-
-hStim=stim.plot([],{{' ''k'',''Linewidth'',2'}});
-legend off;
-legend([hEst(1) hEst(2) hEst(3) hStim],'x_{k|k}(t)',strcat('x_{k|k}(t)-',num2str(zVal),'\sigma_{k|k}'),...
- strcat('x_{k|k}(t)+',num2str(zVal),'\sigma_{k|k}'),'x_{k|k}(t)','x(t)');
-title(['Decoded Stimulus No Hist +/- 99% confidence intervals using ' num2str(numRealizations) ' cells']);
-
Warning: Ignoring extra legend entries.
-Warning: Ignoring extra legend entries.
-
We see that inclusion of history effect improves (as expected) the decoding of the stimulus based on the point process observations
\ No newline at end of file
diff --git a/helpfiles/DecodingExampleWithHist.m b/helpfiles/DecodingExampleWithHist.m
deleted file mode 100644
index 5bbd9fcc..00000000
--- a/helpfiles/DecodingExampleWithHist.m
+++ /dev/null
@@ -1,92 +0,0 @@
-%% 1-D Stimulus Decode with History Effect
-% In the above decoding example, the simulated neurons did not have memory.
-% That is their previous firing activity did not modulate their current
-% probability of firing. In reality the firing history does affect the
-% probabilty of neuronal firing (eg. refractory period, bursting, etc.).
-% In this example, we simulate a population a neurons that exhibit this
-% type of history dependence. We then decode the stimulus activity based on
-% a conditional intensity function that includes the correct history terms
-% and one that assumes no history dependence.
-
-
-close all;
-% clear all;
-delta = 0.001; Tmax = 1;
-time = 0:delta:Tmax;
-f=1; b1=1;b0=-2;
-stimData = b1*sin(2*pi*f*time);
-e = zeros(length(time),1); %No Ensemble input
-mu = b0; %baseline firing rate
-Ts=delta;
-
-histCoeffs= [-2 -2 -4];
-windowTimes=[0 .001 0.002 0.003];
-histObj = History(windowTimes);
-filts = histObj.toFilter(Ts); %Convert to transfer function matrix
-H=histCoeffs*filts; %scale each window transfer function by its coefficient
-S=tf([1],1,Ts,'Variable','z^-1'); %Feed the stimulus in directly
-E=tf([0],1,Ts,'Variable','z^-1'); %No ensemble effect
-stim=Covariate(time',stimData,'Stimulus','time','s','Voltage',{'sin'});
-ens =Covariate(time',e,'Ensemble','time','s','Spikes',{'n1'});
-numRealizations = 20; %Number of sample paths to generate
-sC=CIF.simulateCIF(mu,H,S,E,stim,ens,numRealizations);
-
-figure;
-subplot(2,1,1); sC.plot;
-subplot(2,1,2); stim.plot;
-
-
-for i=1:numRealizations
-% Construct a CIF object for each realization based on our encoding
-% results above
- %correct CIF w/ History
- lambdaCIF{i} = CIF([mu b1],{'1','x'},{'x'},'binomial',histCoeffs,histObj);
- %CIF ignoring the history effect
- lambdaCIFNoHist{i} = CIF([mu b1],{'1','x'},{'x'},'binomial');
-end
-
-
-
-
-sC.resample(1/delta);
-dN=sC.dataToMatrix;
-% Make noise according to the dynamic range of the stimulus
-Q=2*std(stim.data(2:end)-stim.data(1:end-1));
-Px0=.1; A=1;
-% Decode with the correct and incorrect CIFs
-
-[x_p, W_p, x_u, W_u] = DecodingAlgorithms.PPDecodeFilter(A, Q, Px0, dN',lambdaCIF,delta);
-[x_pNoHist, W_pNoHist, x_uNoHist, W_uNoHist] = DecodingAlgorithms.PPDecodeFilter(A, Q, Px0, dN',lambdaCIFNoHist,delta);
-
-
-% Compare the results
-figure;
-subplot(2,1,1);
-zVal=3;
-ciLower = min(x_u(1:end)-zVal*squeeze(W_u(1:end))',x_u(1:end)+zVal*squeeze(W_u(1:end))');
-ciUpper = max(x_u(1:end)-zVal*squeeze(W_u(1:end))',x_u(1:end)+zVal*squeeze(W_u(1:end))');
-hEst=plot(time,x_u(1:end),'b',time,ciLower,'g',time,ciUpper,'r'); hold on;
-hold all;
-
-hStim=stim.plot([],{{' ''k'',''Linewidth'',2'}});
-legend off;
-legend([hEst(1) hEst(2) hEst(3) hStim],'x_{k|k}(t)',strcat('x_{k|k}(t)-',num2str(zVal),'\sigma_{k|k}'),...
- strcat('x_{k|k}(t)+',num2str(zVal),'\sigma_{k|k}'),'x_{k|k}(t)','x(t)');
-title(['Decoded Stimulus +/- 99% confidence intervals using ' num2str(numRealizations) ' cells']);
-
-subplot(2,1,2);
-zVal=3;
-ciLower = min(x_uNoHist(1:end)-zVal*squeeze(W_uNoHist(1:end))',x_uNoHist(1:end)+zVal*squeeze(W_uNoHist(1:end))');
-ciUpper = max(x_uNoHist(1:end)-zVal*squeeze(W_uNoHist(1:end))',x_uNoHist(1:end)+zVal*squeeze(W_uNoHist(1:end))');
-hEst=plot(time,x_uNoHist(1:end),'b',time,ciLower,'g',time,ciUpper,'r'); hold on;
-hold all;
-
-hStim=stim.plot([],{{' ''k'',''Linewidth'',2'}});
-legend off;
-legend([hEst(1) hEst(2) hEst(3) hStim],'x_{k|k}(t)',strcat('x_{k|k}(t)-',num2str(zVal),'\sigma_{k|k}'),...
- strcat('x_{k|k}(t)+',num2str(zVal),'\sigma_{k|k}'),'x_{k|k}(t)','x(t)');
-title(['Decoded Stimulus No Hist +/- 99% confidence intervals using ' num2str(numRealizations) ' cells']);
-
-%%
-% We see that inclusion of history effect improves (as expected) the
-% decoding of the stimulus based on the point process observations
\ No newline at end of file
diff --git a/helpfiles/DecodingExampleWithHist.png b/helpfiles/DecodingExampleWithHist.png
deleted file mode 100644
index 7538143a..00000000
Binary files a/helpfiles/DecodingExampleWithHist.png and /dev/null differ
diff --git a/helpfiles/DecodingExampleWithHist_01.png b/helpfiles/DecodingExampleWithHist_01.png
deleted file mode 100644
index fbcf08bc..00000000
Binary files a/helpfiles/DecodingExampleWithHist_01.png and /dev/null differ
diff --git a/helpfiles/DecodingExampleWithHist_02.png b/helpfiles/DecodingExampleWithHist_02.png
deleted file mode 100644
index 43b8c34e..00000000
Binary files a/helpfiles/DecodingExampleWithHist_02.png and /dev/null differ
diff --git a/helpfiles/DecodingExample_01.png b/helpfiles/DecodingExample_01.png
deleted file mode 100644
index dc7a0ea8..00000000
Binary files a/helpfiles/DecodingExample_01.png and /dev/null differ
diff --git a/helpfiles/DecodingExample_02.png b/helpfiles/DecodingExample_02.png
deleted file mode 100644
index 58d3b218..00000000
Binary files a/helpfiles/DecodingExample_02.png and /dev/null differ
diff --git a/helpfiles/DecodingExample_03.png b/helpfiles/DecodingExample_03.png
deleted file mode 100644
index 25cf34ed..00000000
Binary files a/helpfiles/DecodingExample_03.png and /dev/null differ
diff --git a/helpfiles/DecodingExample_04.png b/helpfiles/DecodingExample_04.png
deleted file mode 100644
index c3236b77..00000000
Binary files a/helpfiles/DecodingExample_04.png and /dev/null differ
diff --git a/helpfiles/DecodingExample_05.png b/helpfiles/DecodingExample_05.png
deleted file mode 100644
index 7a59be90..00000000
Binary files a/helpfiles/DecodingExample_05.png and /dev/null differ
diff --git a/helpfiles/EventsExamples.html b/helpfiles/EventsExamples.html
deleted file mode 100644
index 6605e91a..00000000
--- a/helpfiles/EventsExamples.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
- Events
Events
Events are simple object to use and are aimed to facilitate illustration of epochs in any time of data.
The color of the event markers can also be specified
figure; e.plot([],'r'); %dont specify handle, use red; handel = gca;
-figure; e.plot([],'g'); %dont specify handle, use green;
-
- Published with MATLAB® 7.13
\ No newline at end of file
diff --git a/helpfiles/EventsExamples.m b/helpfiles/EventsExamples.m
deleted file mode 100644
index 01026811..00000000
--- a/helpfiles/EventsExamples.m
+++ /dev/null
@@ -1,14 +0,0 @@
-%% Events
-% Events are simple object to use and are aimed to facilitate illustration
-% of epochs in any time of data.
-close all;
-eTimes = sort(rand(1,3)*1);
-eLabels={'E_1','E_2','E_3'};
-eventColor = 'b';
-e=Events(eTimes,eLabels,eventColor);
-e.plot;
-
-%%
-% The color of the event markers can also be specified
-figure; e.plot([],'r'); %dont specify handle, use red; handel = gca;
-figure; e.plot([],'g'); %dont specify handle, use green;
\ No newline at end of file
diff --git a/helpfiles/EventsExamples.png b/helpfiles/EventsExamples.png
deleted file mode 100644
index d7cd43ae..00000000
Binary files a/helpfiles/EventsExamples.png and /dev/null differ
diff --git a/helpfiles/EventsExamples_01.png b/helpfiles/EventsExamples_01.png
deleted file mode 100644
index 3449566d..00000000
Binary files a/helpfiles/EventsExamples_01.png and /dev/null differ
diff --git a/helpfiles/EventsExamples_02.png b/helpfiles/EventsExamples_02.png
deleted file mode 100644
index 86480dbd..00000000
Binary files a/helpfiles/EventsExamples_02.png and /dev/null differ
diff --git a/helpfiles/EventsExamples_03.png b/helpfiles/EventsExamples_03.png
deleted file mode 100644
index 7e75cf6f..00000000
Binary files a/helpfiles/EventsExamples_03.png and /dev/null differ
diff --git a/helpfiles/Examples.html b/helpfiles/Examples.html
deleted file mode 100644
index c70746f3..00000000
--- a/helpfiles/Examples.html
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
- Examples
Examples
Example files are provided for each of the classes defined in the Neural Spike Analysis Toolbox so that the user can understand the functionality of each in more detail.
\ No newline at end of file
diff --git a/helpfiles/Examples.m b/helpfiles/Examples.m
deleted file mode 100644
index 43726448..00000000
--- a/helpfiles/Examples.m
+++ /dev/null
@@ -1,33 +0,0 @@
-%% Examples
-% Example files are provided for each of the classes defined in the Neural
-% Spike Analysis Toolbox so that the user can understand the functionality
-% of each in more detail.
-%
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-% *
-
-
-
diff --git a/helpfiles/ExplicitStimulusWhiskerData.html b/helpfiles/ExplicitStimulusWhiskerData.html
deleted file mode 100644
index 4c402a62..00000000
--- a/helpfiles/ExplicitStimulusWhiskerData.html
+++ /dev/null
@@ -1,403 +0,0 @@
-
-
-
-
- EXPLICIT STIMULUS EXAMPLE - WHISKER STIMULATION/THALAMIC NEURON
EXPLICIT STIMULUS EXAMPLE - WHISKER STIMULATION/THALAMIC NEURON
In the worksheet with analyze the stimulus effect and history effect on the firing of a thalamic neuron under a known stimulus consisting of whisker stimulation. Data from Demba Ba (demba@mit.edu)
We fit a constant rate (Poisson) model to the data and use the fit residual to determine the appropriate lag for the stimulus.
clear c;
-selfHist = [] ; NeighborHist = []; sampleRate = 1000;
-c{1} = TrialConfig({{'Baseline','constant'}},sampleRate,selfHist,NeighborHist);
-c{1}.setName('Baseline');
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-
-% Find Stimulus Lag (look for peaks in the cross-covariance function less
-% than 1 second
-figure;
-results.Residual.xcov(stim).windowedSignal([0,1]).plot;
-[m,ind,ShiftTime] = max(results.Residual.xcov(stim).windowedSignal([0,1]));
-%Allow for shifts of less than 1 second
-stim = Covariate(time,stimData,'Stimulus','time','s','V',{'stim'});
-stim = stim.shift(ShiftTime);
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
- {'constant'});
-
-nst = nspikeTrain(spikeTimes);
-nspikeColl = nstColl(nst);
-cc = CovColl({stim,baseline});
-trial = Trial(nspikeColl,cc);
-
Analyzing Configuration #1: Neuron #1
-
Compare constant rate model with model including stimulus effect
Addition of the stimulus improves the fits in terms of the KS plot and the making the rescaled ISIs less correlated. The Point Process Residula also looks more "white"
\ No newline at end of file
diff --git a/helpfiles/ExplicitStimulusWhiskerData.m b/helpfiles/ExplicitStimulusWhiskerData.m
deleted file mode 100644
index a091edcf..00000000
--- a/helpfiles/ExplicitStimulusWhiskerData.m
+++ /dev/null
@@ -1,160 +0,0 @@
-%% EXPLICIT STIMULUS EXAMPLE - WHISKER STIMULATION/THALAMIC NEURON
-% In the worksheet with analyze the stimulus effect and history effect on
-% the firing of a thalamic neuron under a known stimulus consisting of
-% whisker stimulation.
-% Data from Demba Ba (demba@mit.edu)
-
-%% Load the data
-close all; currdir = pwd;
-index = strfind(currdir,'helpfiles')-1;
-rootpath = currdir(1:index);
-
-Direction=3; Neuron=1; Stim=2;
-datapath = fullfile(rootpath,'data','Explicit Stimulus',strcat('Dir', num2str(Direction)),...
- strcat('Neuron', num2str(Neuron)), strcat('Stim', num2str(Stim)));
-data=load(fullfile(datapath,'trngdataBis.mat'));
-
-time=0:.001:(length(data.t)-1)*.001;
-stimData = data.t;
-spikeTimes = time(data.y==1);
-
-stim = Covariate(time,stimData,'Stimulus','time','s','V',{'stim'});
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
- {'constant'});
-
-nst = nspikeTrain(spikeTimes);
-nspikeColl = nstColl(nst);
-cc = CovColl({stim,baseline});
-trial = Trial(nspikeColl,cc);
-trial.plot;
-
-figure;
-subplot(2,1,1);
-nst2 = nspikeTrain(spikeTimes);
-nst2.setMaxTime(21);nst.plot;
-subplot(2,1,2);
-stim.getSigInTimeWindow(0,21).plot;
-
-%% Fit a constant baseline and Find Stimulus Lag
-% We fit a constant rate (Poisson) model to the data and use the fit
-% residual to determine the appropriate lag for the stimulus.
-clear c;
-selfHist = [] ; NeighborHist = []; sampleRate = 1000;
-c{1} = TrialConfig({{'Baseline','constant'}},sampleRate,selfHist,NeighborHist);
-c{1}.setName('Baseline');
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-
-% Find Stimulus Lag (look for peaks in the cross-covariance function less
-% than 1 second
-figure;
-results.Residual.xcov(stim).windowedSignal([0,1]).plot;
-[m,ind,ShiftTime] = max(results.Residual.xcov(stim).windowedSignal([0,1]));
-%Allow for shifts of less than 1 second
-stim = Covariate(time,stimData,'Stimulus','time','s','V',{'stim'});
-stim = stim.shift(ShiftTime);
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
- {'constant'});
-
-nst = nspikeTrain(spikeTimes);
-nspikeColl = nstColl(nst);
-cc = CovColl({stim,baseline});
-trial = Trial(nspikeColl,cc);
-
-%% Compare constant rate model with model including stimulus effect
-% Addition of the stimulus improves the fits in terms of the KS plot and
-% the making the rescaled ISIs less correlated. The Point Process Residula
-% also looks more "white"
-clear c;
-selfHist = [] ; NeighborHist = []; sampleRate = 1000;
-c{1} = TrialConfig({{'Baseline','constant'}},sampleRate,selfHist,...
- NeighborHist);
-c{1}.setName('Baseline');
-c{2} = TrialConfig({{'Baseline','constant'},{'Stimulus','stim'}},...
- sampleRate,selfHist,NeighborHist);
-c{2}.setName('Baseline+Stimulus');
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-results.plotResults;
-
-%% History Effect
-% Determine the best history effect model using AIC, BIC, and KS statistic
-sampleRate=1000;
-delta=1/sampleRate*1;
-maxWindow=1; numWindows=30;
-windowTimes =unique(round([0 logspace(log10(delta),...
- log10(maxWindow),numWindows)]*sampleRate)./sampleRate);
-results =Analysis.computeHistLagForAll(trial,windowTimes,...
- {{'Baseline','constant'},{'Stimulus','stim'}},'BNLRCG',0,sampleRate,0);
-
-KSind = find(results{1}.KSStats.ks_stat == min(results{1}.KSStats.ks_stat));
-AICind = find((results{1}.AIC(2:end)-results{1}.AIC(1))== ...
- min(results{1}.AIC(2:end)-results{1}.AIC(1)));
-BICind = find((results{1}.BIC(2:end)-results{1}.BIC(1))== ...
- min(results{1}.BIC(2:end)-results{1}.BIC(1)));
-if(AICind==1)
- AICind=inf;
-end
-if(BICind==1)
- BICind=inf; %sometime BIC is non-decreasing and the index would be 1
-end
-windowIndex = min([KSind,AICind,BICind]) %use the minimum order model
-Summary = FitResSummary(results);
-Summary.plotSummary;
-
-
-clear c;
-if(windowIndex>1)
- selfHist = windowTimes(1:windowIndex);
-else
- selfHist = [];
-end
-NeighborHist = []; sampleRate = 1000;
-%%
-figure;
-x=1:length(windowTimes);
-subplot(3,1,1); plot(x,results{1}.KSStats.ks_stat,'.'); axis tight; hold on;
-plot(x(windowIndex),results{1}.KSStats.ks_stat(windowIndex),'r*');
-
- set(gca,'xtick',[]);
-ylabel('KS Statistic');
-dAIC = results{1}.AIC-results{1}.AIC(1);
-subplot(3,1,2); plot(x,dAIC,'.');
- set(gca,'xtick',[]);
-ylabel('\Delta AIC');axis tight; hold on;
-plot(x(windowIndex),dAIC(windowIndex),'r*');
-dBIC = results{1}.BIC-results{1}.BIC(1);
-subplot(3,1,3); plot(x,dBIC,'.');
-ylabel('\Delta BIC'); axis tight; hold on;
-plot(x(windowIndex),dBIC(windowIndex),'r*');
-
-for i=2:length(x)
- histLabels{i} = ['[' num2str(windowTimes(i-1),3) ',' num2str(windowTimes(i),3) ,']'];
-end
-
-figure;
-plot(x,dBIC,'.');
-xticks = 1:(length(histLabels));
-set(gca,'xtick',xticks,'xtickLabel',histLabels,'FontSize',6);
-if(max(xticks)>=1)
- xticklabel_rotate([],90,[],'Fontsize',8);
-end
-
-
-%% Compare Baseline, Baseline+Stimulus Model, Baseline+History+Stimulus
-% Addition of the history effect yields a model that falls within the 95%
-% CI of the KS plot.
-
-c{1} = TrialConfig({{'Baseline','constant'}},sampleRate,[],NeighborHist);
-c{1}.setName('Baseline');
-c{2} = TrialConfig({{'Baseline','constant'},{'Stimulus','stim'}},...
- sampleRate,[],[]);
-c{2}.setName('Baseline+Stimulus');
-c{3} = TrialConfig({{'Baseline','constant'},{'Stimulus','stim'}},...
- sampleRate,windowTimes(1:windowIndex),[]);
-c{3}.setName('Baseline+Stimulus+Hist');
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-results.plotResults;
-
-
diff --git a/helpfiles/ExplicitStimulusWhiskerData.png b/helpfiles/ExplicitStimulusWhiskerData.png
deleted file mode 100644
index 7857b79d..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_01.png b/helpfiles/ExplicitStimulusWhiskerData_01.png
deleted file mode 100644
index d4327285..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_01.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_02.png b/helpfiles/ExplicitStimulusWhiskerData_02.png
deleted file mode 100644
index 0bf1e2ca..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_02.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_03.png b/helpfiles/ExplicitStimulusWhiskerData_03.png
deleted file mode 100644
index 72f63838..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_03.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_04.png b/helpfiles/ExplicitStimulusWhiskerData_04.png
deleted file mode 100644
index 12c58f68..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_04.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_05.png b/helpfiles/ExplicitStimulusWhiskerData_05.png
deleted file mode 100644
index 2f81749e..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_05.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_06.png b/helpfiles/ExplicitStimulusWhiskerData_06.png
deleted file mode 100644
index 898d5a7f..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_06.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_07.png b/helpfiles/ExplicitStimulusWhiskerData_07.png
deleted file mode 100644
index 17870dbd..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_07.png and /dev/null differ
diff --git a/helpfiles/ExplicitStimulusWhiskerData_08.png b/helpfiles/ExplicitStimulusWhiskerData_08.png
deleted file mode 100644
index 48ab58b1..00000000
Binary files a/helpfiles/ExplicitStimulusWhiskerData_08.png and /dev/null differ
diff --git a/helpfiles/FitResSummaryExamples.html b/helpfiles/FitResSummaryExamples.html
deleted file mode 100644
index f604fc72..00000000
--- a/helpfiles/FitResSummaryExamples.html
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
- FitResSummary Examples
FitResSummary Examples
- Published with MATLAB® 7.9
\ No newline at end of file
diff --git a/helpfiles/FitResSummaryExamples.m b/helpfiles/FitResSummaryExamples.m
deleted file mode 100644
index dc5b84c7..00000000
--- a/helpfiles/FitResSummaryExamples.m
+++ /dev/null
@@ -1 +0,0 @@
-%% FitResSummary Examples
diff --git a/helpfiles/FitResult.html b/helpfiles/FitResult.html
deleted file mode 100644
index fc242ccd..00000000
--- a/helpfiles/FitResult.html
+++ /dev/null
@@ -1,2066 +0,0 @@
-
-
-
-
- FitResult
classdef FitResult < handle
- % FITRESULT
- % stores results of a fit using the Analysis object
- % The results are for a single neuron over a range of configurations
- % <a href="matlab:web('FitResultExamples.html', '-helpbrowser')">FitResult Examples</a>
- % see also <a href="matlab:help('Analysis')">Analysis</a>
- % Reference page in Help browser
- % <a href="matlab:doc('FitResult')">doc FitResult</a>
- properties
- numResults %Number of results in this FitResult object
- lambda %Lambda signal
- numCoeffs %Number of coefficients for each fitResult
- fitType %Poisson or Binomial
-
- b %coefficients for each fit
- dev %deviance for each fit
- AIC %Akaike's Information Criterion for each fit
- BIC %Baysian Information Criterion for each fit
- stats %Relevant statistics for each fit
- configs % the config collection for the different fits
- configNames % names of the the differen fits
- neuronNumber % the number of the neuron the data comes from
- neuralSpikeTrain % the spike data
- covLabels
- uniqueCovLabels
- indicesToUniqueLabels
- numHist % Number of history terms (used for indexing into the regression coefficients) for each fit
- histObjects % History object for self firing
- ensHistObjects % History object to be applied to the neuron's neigbors to compute ensemble effect
- flatMask
- Z % Rescaled spike times from the Time-Rescaling theorem, exponential rate 1
- U % Transformed z's -> uniform in [0,1]
- X % Transformed u's -> gaussian in [-inf, inf]
- Residual %fit residual
-% xAxis
-% KSSorted
-% ks_stat
- invGausStats
- KSStats %Kolmogorov Smirnov Statistics
- plotParams
- XvalData % cell array of raw data used for validation
- XvalTime % cell array of time vectors for each element of XvalData
- validation % a FitResult object with the validation data
- minTime % The minTime from the spikeTrain (not necessarily the analysis)
- maxTime % The maxTime for the spikeTrain (not necessarily the analysis)
- end
- properties (Constant,Hidden)
- colors={'b','g','r','c','m','y','k'};
- end
-
-
- methods
-
- function fitObj=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,configColl,XvalData,XvalTime,distribution)
- % fitObj=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,configColl,XvalData,XvalTime)
- % Stores the results of multiple regressions for a single neuron into a accessible structure.
- %
- % spikeObj: The spike train for the neuron whose results are
- % being stored.
- % covLabels: A 2-d cell array, the jth row has all the labels for the covariates used in the jth fit
- % numHist: The number of history terms in each of the N fits.
- % histObjects: The History object for each of the N fits
- % ensHistObj: The History object for used to compute the ensemble history effect.
- % lambda: The conditional intensity function evaluated usin the
- % data. Each dimension of lambda corresponds to the a different
- % GLM Fit.
- % b: N-component cell array containing the GLM regression
- % coefficient of each of the fits. The jth component has all
- % the regression coefficients for the jth trial.
- % dev: vector of Deviances for each the GLM fits.
- % stats: Cell array of the stats parameters for each GLM fit;
- % AIC: vector of Akaike's information criteria for each the GLM fits.
- % BIC: vector of Bayes Information criteria for each the GLM fits.
- % configColl: configCollection object used to generate this
- % results
- % XvalData: Data to be used for validation.
- % XvalTime: Time vector for the data.
-
- if(nargin< 14)
- XvalTime =[];
- end
- if(nargin<13)
- XvalData =[];
- end
-
- if(isnumeric(spikeObj.name))
- nNumber =spikeObj.name;
- else
- nNumber = str2double(spikeObj.name(~isletter(spikeObj.name)));
- end
- fitObj.neuronNumber = nNumber; %str2num(spikeObj.name);
- fitObj.neuralSpikeTrain = spikeObj;
- fitObj.minTime = spikeObj.minTime;
- fitObj.maxTime = spikeObj.maxTime;
- fitObj.numResults = 0;
- fitObj.configs = configColl;
- fitObj.configNames = configColl.getConfigNames;
- fitObj.covLabels=covLabels;
- fitObj.uniqueCovLabels= getUniqueLabels(covLabels);
-
- fitObj.mapCovLabelsToUniqueLabels;
- fitObj.numHist=numHist;
- fitObj.histObjects = histObjects;
- fitObj.ensHistObjects = ensHistObj;
- fitObj.addParamsToFit(fitObj.neuronNumber,lambda,b, dev, stats,AIC,BIC,configColl);
- fitObj.Z =[]; %rescaled spikes times - exponentially dist.
- fitObj.U =[]; %rescaled spike times - uniformly dist.
- fitObj.X =[]; %rescaled spike times - gaussian dist.
- fitObj.Residual =[]; %fit residual for PP
- fitObj.KSStats.xAxis =[];
- fitObj.KSStats.KSSorted =[];
- fitObj.KSStats.ks_stat =[];
- fitObj.invGausStats.rhoSig=[];
- fitObj.invGausStats.confBoundSig=[];
- fitObj.plotParams = [];
- fitObj.XvalData = XvalData;
- fitObj.XvalTime = XvalTime;
-
- fitObj.fitType = distribution;
-
- end
- function mFitRes = mergeResults(fitObj,newFitObj)
- if(isa(newFitObj,'FitResult'))
- if(fitObj.neuronNumber ==newFitObj.neuronNumber)
- spikeObj = fitObj.neuralSpikeTrain;
- covLabels = fitObj.covLabels(1:fitObj.numResults);
- covLabels((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.covLabels(1:newFitObj.numResults);
- numHist = fitObj.numHist(1:fitObj.numResults);
- numHist((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.numHist(1:newFitObj.numResults);
- histObjects=fitObj.histObjects(1:fitObj.numResults);
- histObjects((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.histObjects(1:newFitObj.numResults);
- ensHistObjects=fitObj.ensHistObjects(1:fitObj.numResults);
- ensHistObjects((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.ensHistObjects(1:newFitObj.numResults);
- b=fitObj.b(1:fitObj.numResults);
- b((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.b(1:newFitObj.numResults);
- dev = [fitObj.dev newFitObj.dev];
- AIC = [fitObj.AIC newFitObj.AIC];
- BIC = [fitObj.BIC newFitObj.BIC];
- stats=fitObj.stats(1:fitObj.numResults);
- stats((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.stats(1:newFitObj.numResults);
- lambda = fitObj.lambda.merge(newFitObj.lambda);
-
- for i=1:fitObj.numResults
- config{i}=fitObj.configs.getConfig(i);
- end
- offset=fitObj.numResults;
- for i=1:newFitObj.numResults
- config{i+offset}=newFitObj.configs.getConfig(i);
- end
- configColl= ConfigColl(config);
-
- XvalData = [fitObj.XvalData newFitObj.XvalData];
- XvalTime = [fitObj.XvalTime newFitObj.XvalTime];
- distribution=fitObj.fitType(1:fitObj.numResults);
- distribution((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.fitType(1:newFitObj.numResults);
- Z=[fitObj.Z newFitObj.Z];
- U=[fitObj.U newFitObj.U];
- [X,rhoSig,confBoundSig] = Analysis.computeInvGausTrans(Z);
-
- M=fitObj.Residual.merge(newFitObj.Residual);
- xAxis = [fitObj.KSStats.xAxis newFitObj.KSStats.xAxis];
- KSSorted = [fitObj.KSStats.KSSorted newFitObj.KSStats.KSSorted];
- ks_stat = [fitObj.KSStats.ks_stat newFitObj.KSStats.ks_stat];
- mFitRes=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObjects,lambda,b, dev, stats,AIC,BIC,configColl,XvalData,XvalTime,distribution);
- mFitRes.setKSStats(Z,U, xAxis, KSSorted, ks_stat);
- mFitRes.setInvGausStats(X,rhoSig,confBoundSig);
- mFitRes.setFitResidual(M);
-
-
- elseif(isa(newFitObj,'cell'))
- if(isa(newFitObj{1},'FitResult'))
- for i=1:length(newFitObj)
- if(i==1)
- mFitRes = fitObj.mergeResults(newFitObj{i});
- else
- mFitRes = mFitRes.mergeResults(newFitObj{i});
- end
- end
- end
- end
- end
-
- end
- function addParamsToFit(fitObj,neuronNum,lambda,b, dev, stats,AIC,BIC,configColl)
- % addParamsToFit(fitObj,neuronNum,lambda,b, dev, stats,AIC,BIC,configColl)
- % Add the specified parameters to the current FitResult object
- % only if the neuronNum matches the neuronNum of this object
- if(fitObj.neuronNumber==neuronNum)
- if(isa(lambda,'cell'))
- newLambda=lambda{1};
- for i=2:length(lambda)
- newLambda = newLambda.merge(lambda{i});
- end
- elseif(isa(lambda,'Covariate')||isa(lambda,'SignalObj'))
- newLambda = lambda;
- end
-
- numNewResults = newLambda.dimension;%number of new elements
- if(nargin<8)
- configColl = cell(1,numNewResults);
- end
-
- if(numNewResults==1)
- fitObj.b{fitObj.numResults+1} = b{1};
- fitObj.dev(fitObj.numResults+1) = dev;
- fitObj.stats{fitObj.numResults+1}= stats{1};
- if(nargin<7)
- fitObj.AIC(fitObj.numResults+1) = 2*length(b)+dev;
- fitObj.BIC(fitObj.numResults+1) = length(b)*log(length(newLambda.time))+dev;
- else
- fitObj.AIC(fitObj.numResults+1) = AIC;
- fitObj.BIC(fitObj.numResults+1) = BIC;
- end
-
- fitObj.numCoeffs(fitObj.numResults+1) = length(b);
- else
- for i=1:numNewResults
- fitObj.b{fitObj.numResults+i} = b{i};
- fitObj.dev(fitObj.numResults+i) = dev(i);
- fitObj.stats{fitObj.numResults+i}= stats{i};
- if(nargin<7)
- fitObj.AIC(fitObj.numResults+i) = 2*length(b{i})+dev(i);
- fitObj.BIC(fitObj.numResults+i) = length(b{i})*log(length(newLambda.time))+dev(i);
- else
- fitObj.AIC(fitObj.numResults+i) = AIC(i);
- fitObj.BIC(fitObj.numResults+i) = BIC(i);
- end
- fitObj.numCoeffs(fitObj.numResults+i) = length(b{i});
- end
- end
- if(fitObj.numResults ==0)
- fitObj.lambda = newLambda;
- else
- fitObj.lambda = fitObj.lambda.merge(newLambda); %new lambda
- end
-
- fitObj.numResults = fitObj.numResults+numNewResults;
- dataLabels = cell(1,fitObj.numResults);
- for i=1:fitObj.numResults
- dataLabels{i} = strcat('\lambda_',num2str(i));
- end
- fitObj.lambda.setDataLabels(dataLabels);
-
- fitObj.configs.addConfig(configColl);
- fitObj.configNames = fitObj.configs.getConfigNames;
- else
- error('Neuron number does not match');
- end
- end
- function lambda = computeValLambda(fitObj)
- % lambda = computeValLambda(fitObj)
- % Returns a Covariate object lambda. This is the Conditional
- % intensity function evaluated using the validation data
- lambdaData = zeros(length(fitObj.XvalTime{1}),fitObj.numResults);
- for i=1:fitObj.numResults
- lambdaData(:,i) = fitObj.evalLambda(i,fitObj.XvalData{i});
- end
- lambda=Covariate(fitObj.XvalTime{1},lambdaData,...
- '\Lambda(t)',fitObj.lambda.xlabelval,...
- fitObj.lambda.xunits,'Hz',fitObj.lambda.dataLabels);
- end
-
- function mapCovLabelsToUniqueLabels(fitObj)
- flatMask = zeros(length(fitObj.uniqueCovLabels),length(fitObj.covLabels));
- for j=1:length(fitObj.covLabels)
- currLabels = fitObj.covLabels{j};
- index=zeros(1,length(currLabels));
- for i=1:length(currLabels)
- index(i)=strmatch(currLabels{i}, fitObj.uniqueCovLabels, 'exact');
- end
-
- fitObj.indicesToUniqueLabels{j} = index;
- flatMask(index,j) = 1;
- end
- fitObj.flatMask = flatMask;
- end
- function p=getPlotParams(fitObj)
- % p=getPlotParams(fitObj)
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
- p=fitObj.plotParams;
- end
- function plotValidation(fitObj)
- % plotValidation(fitObj)
- % calls plotResults on the validation FitResult object if
- % validation data is present. Note that the GLM coefficients
- % are not recomputed and therefore the same as those obtained
- % from the training data.
- if(~isempty(fitObj.validation))
- fitObj.validation.plotResults;
- else
- display('Validation Data not available to plot');
- end
- end
- function answer = isValDataPresent(fitObj)
- % answer = isValDataPresent(fitObj)
- % returns 1 if validation data is present. This method is used
- % to determine if validation data is available to compute the
- % validation results.
- answer = 0;
- if(~isempty(fitObj.XvalTime) && ~isempty(fitObj.XvalData))
- for i=1:length(fitObj.XvalTime)
- currTime = fitObj.XvalTime{i};
- if(~isempty(currTime))
- if(currTime(end)-currTime(1)>0)
- answer =1;
- break;
- end
- end
- end
-
- end
-
- end
- function lambdaData = evalLambda(fitObj,lambdaIndex,newData)
- % lambdaData = evalLambda(fitObj,lambdaIndex,newData)
- % lambdaIndex: the index of the corresponding lambda to be
- % evaluated with the new data.
- % newData: matrix of covariates in same order as fits without
- % constant term in first column
-% if(isa(newData,'double'))
-% [~,columns] = size(newData);
-% tempData = cell(1,columns);
-% for i=1:columns
-% tempData{i} = newData(:,i);
-% end
-% newData = tempData;
-% end
-
- if(lambdaIndex>0 && lambdaIndex <= fitObj.numResults)
- b=fitObj.b{lambdaIndex}; %coefficient matrix
- if(isempty(newData))
- [rows,~] = size(newData);
- baseline=ones(rows,1);
- lambdaData = exp(b(1)*baseline);
- else
- if(isa(newData,'double')) %matrix, 1 column per coefficient
- baseline=ones(length(newData),1);
- [~,columns] = size(newData);
-
- if(length(b)>=1)
- lambdaData = exp(newData*b(1:end));
- if(strcmp(fitObj.fitType{lambdaIndex},'poisson'))
-% lambdaData = exp(newData*b(1:end));
-% lambdaData = exp(b(1) + newData*b(2:end));
- else
-% lambdaData = exp(b(1) + newData*b(2:end));
- lambdaData = lambdaData./(1+lambdaData);
- end
-% else
-% if(strcmp(fitObj.fitType{lambdaIndex},'poisson'))
-% lambdaData = exp(b(1)*baseline);
-%
-% else
-% lambdaData = exp(b(1)*baseline);
-% lambdaData = lambdaData./(1+lambdaData);
-% end
- end
- lambdaData = lambdaData*fitObj.neuralSpikeTrain.sampleRate;
- elseif(isa(newData,'cell')) % a cell array, each element is matrix of values for each coeff
-% baseline=ones(size(newData{1})); %design matrix
- runSum=0;
- for i=1:(length(newData)) %-fitObj.numHist(lambdaIndex))
-% if(i==1)
-% runSum = b(1)*baseline;
-% else
- runSum = runSum+b(i)*newData{i-1};
-% end
- end
- if(strcmp(fitObj.fitType{lambdaIndex},'poisson'))
- lambdaData = exp(runSum);
- lambdaData = lambdaData*fitObj.neuralSpikeTrain.sampleRate;
- else
- lambdaData = exp(runSum);
- lambdaData = lambdaData./(1+lambdaData);
- lambdaData = lambdaData*fitObj.neuralSpikeTrain.sampleRate;
- end
- else
- error('New data must be cell or a matrix');
- end
-
- end
- else
- error('Index into fit params is incorrect');
- end
-
- end
-% function handle = plotHist(fitObj,fitNum)
-% % handle = plotHist(fitObj,fitNum)
-% % plots the history terms used in this FitResult object
-% % if fitNum is not specified then fitNum=1:numResults
-% if(nargin<2 || isempty(fitNum))
-% fitNum = 1:fitObj.numResults;
-% end
-%
-% for j=fitNum
-% if(j>0 && j <= fitObj.numResults)
-% b=fitObj.b{j}; %coefficient matrix
-% startHistIndex = length(b)-fitObj.numHist(j)+1;
-% if(startHistIndex<length(b))
-% bHist = b(startHistIndex:end);
-% if(~isempty(fitObj.histObjects{j}))
-% windowTimes = fitObj.histObjects{j}.windowTimes;
-% t=linspace(windowTimes(1),windowTimes(end),100)';
-% histEffect = zeros(length(t),1);
-% for i=1:length(windowTimes)-1
-% index = and(t>=windowTimes(i),t<=windowTimes(i+1));
-% histEffect(index)=exp(-bHist(i))-1; %To offset zero coeffs
-% end
-% end
-% else
-% t=[0; 0.00001];
-% histEffect =[0;0];
-% end
-% if(j==fitNum(1))
-% hSig = SignalObj(t,histEffect,'History','time','s','',fitObj.lambda.dataLabels{j});
-% else
-% hSig = hSig.merge(SignalObj(t,histEffect,'History Effect','time','s','',fitObj.lambda.dataLabels{j}));
-% end
-% end
-% end
-% N=floor(length(hSig.time)./70); B=ones(1,N)/N; A=1;
-% handle=hSig.filtfilt(B,A).plot;
-% end
- function computePlotParams(fitObj,fitNum)
- if(nargin<2)
- fitNum = 1:fitObj.numResults;
- end
- index=find(sum(fitObj.flatMask,2)>0);%1:length(fitObj.flatMask(:,1));
- %Only use the labels that appear in at least one fit
- %Otherwise that parameter was not present for any of the
- %regressions and just takes up plot real-estate
-
- sigIndex=zeros(length(index),length(fitNum));
- bAct = nan(length(index),length(fitNum));
- seAct= nan(length(index),length(fitNum));
-
- for i=fitNum
- %this indexing is to avoid extremely large se's from
- %affecting plots
- criteria = find(fitObj.stats{i}.se'<100);
- %indicesForFit = find(fitObj.flatMask(index,i)==1);
- indicesForFit = fitObj.indicesToUniqueLabels{i};
- bVals = fitObj.b{i}(criteria);
- bAct(indicesForFit(criteria),i) = bVals; %sorted according to uniqueLabels
- seVals = fitObj.stats{i}.se(criteria)';
- seAct(indicesForFit(criteria),i)= seVals; %sorted according to uniqueLabels;
- temp = sign([bAct(:,i)-seAct(:,i) bAct(:,i)+seAct(:,i)]);
- productOfSigns = temp(:,1).*temp(:,2); %should be positive
- sIndex=and(productOfSigns>0,seAct(:,i)~=0);
- sigIndex(:,i)=sIndex;
- end
- fitObj.plotParams.bAct = bAct;
- fitObj.plotParams.seAct= seAct;
- fitObj.plotParams.sigIndex = sigIndex;
- fitObj.plotParams.xLabels = cell(length(index),1);
- fitObj.plotParams.xLabels = fitObj.uniqueCovLabels;
-
-% for i=1:(length(index))
-% if(i==1)
-% fitObj.plotParams.xLabels{i} = 'baseline';
-% %text(i, 0,'baseline','interpreter','latex');
-% else
-% fitObj.plotParams.xLabels{i} = fitObj.covLabels{index(i)-1};
-% %text(i, 0,fitObj.covLabels{index(i)-1},'interpreter','latex');
-% end
-% end
- tempVal =sum(fitObj.flatMask,2);
- fitObj.plotParams.numResultsCoeffPresent =tempVal(index);
- end
- function h=plotCoeffs(fitObj,handle,fitNum,plotProps,plotSignificance)
- % h=plotCoeffs(fitObj,handle,fitNum,plotProps,plotSignificance)
- % plots the GLM coefficients for each fit along with the
- % confidence intervals.
- % fitNum: number of the fit to plot. If not specified, all are
- % plotted.
- % plotProps: properties to use for the making the plot
- % plotSignificance: If 1 then an asterix (*) is place above
- % parameters that are statistically different
- % from zero with alpha=5%.
-
- if(nargin<5)
- plotSignificance = 1;
- end
-
- if(nargin<4 || isempty(plotProps))
- plotProps = [];
- end
-
- if(nargin<3 || isempty(fitNum))
- fitNum = 1:fitObj.numResults;
- end
-
- if(nargin<2 || isempty(handle))
- handle=gca;
- end
-
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams(fitNum);
- end
-
- bAct = fitObj.getPlotParams.bAct;
- seAct= fitObj.getPlotParams.seAct;
- sigIndex=fitObj.getPlotParams.sigIndex;
-
- if(~isempty(plotProps))
- for i=1:length(fitNum)
- h=errorbar(handle,1:length(index),bAct,seAct,plotProps{i}); hold on;
- end
- else
- Xaxis=repmat(1:length(bAct(:,1)),[length(bAct(1,:)) 1]);
- h=errorbar(handle,Xaxis',bAct,seAct,'.');%strcat('.',FitResult.colors{mod(i-1,length(FitResult.colors))+1}));
- end
-
- hold on;
-
-
- if(plotSignificance==1)
- v=axis;
- vdiff = .8*v(4);
-
- for i=fitNum
- plot(handle,find(sigIndex(:,i)==1),vdiff*ones(length(find(sigIndex(:,i)==1)),1)-i*.1,strcat('.',FitResult.colors{mod(i-1,length(FitResult.colors))+1})); hold on;
- end
- end
- ylabel('Fit Coefficients','Interpreter','latex');
- xtickLabels = fitObj.getPlotParams.xLabels;
- xticks = 1:(length(xtickLabels));
-
- set(handle,'xtick',xticks,'xtickLabel',xtickLabels,'FontSize',6);
- if(max(fitObj.numCoeffs)>1)
- xticklabel_rotate([],90,[],'Fontsize',6);
- end
-% hT=rotateticklabel(gca,-90);
- legend(handle,fitObj.lambda.dataLabels,'Location','Best');
- %axis tight;
-
- end
- function plotResults(fitObj)
- % plotResults(fitObj)
- % Generates KS plot, auto-correlation function of the inverse
- % gaussian transformed rescaled ISIs, the sequential
- % correlation coefficient between neigboring pairs of the
- % rescaled ISIs (zj vs. zj-1), the GLM regression coefficients,
- % and the Point Process Residual.
- scrsz = get(0,'ScreenSize');
- figure('Position',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.8]);
-
- subplot(2,4,[1 2]); fitObj.KSPlot; %make the plot
- text(.45, .95,strcat('Neuron:',num2str(fitObj.neuronNumber)));
- subplot(2,4,3); fitObj.plotInvGausTrans;
- subplot(2,4,4); fitObj.plotSeqCorr;
- subplot(2,4,[7 8]); fitObj.plotResidual;
- subplot(2,4,[5 6]); fitObj.plotCoeffs;
- end
- function handle = KSPlot(fitObj)
- % handle = KSPlot(fitObj)
- % computes the K-S plot for each of the the candidate rate
- % functions in this FitResult object. These candidate rate
- % functions are numbered according to the order in which they
- % were added to the FitResult.
- h=gcf;
- %h=[];
- figure(h);
- % size(xAxis)
- % size(KSSorted)
- N = length(fitObj.KSStats.KSSorted);
- xaxis = fitObj.KSStats.xAxis(:,1);
- handle=plot(fitObj.KSStats.xAxis,fitObj.KSStats.KSSorted, xaxis,xaxis, 'k-.',xaxis, xaxis+1.36/sqrt(N), 'r', xaxis,xaxis-1.36/sqrt(N), 'r' );
-
- %set(gca,'xtick',[],'ytick',[],'ztick', [])
- axis( [0 1 0 1] );
- dataLabels = cell(1,fitObj.lambda.dimension);
- for i=1:fitObj.lambda.dimension
- dataLabels{i} = fitObj.lambda.dataLabels{i};
- end
- legend(dataLabels,'Location','Best');
- xlabel('Uniform CDF');
- ylabel('Empirical CDF of Rescaled ISIs');
- title('KS Plot with 95% Confidence Intervals');
-
-
- end
-
- function structure = toStructure(fitObj)
- %
- fnames = fieldnames(fitObj);
-
- for i=1:length(fnames)
-
- currObj = fitObj.(fnames{i});
- if(strcmp(fnames{i},'histObjects')||strcmp(fnames{i},'ensHistObjects'))
- for j=1:fitObj.numResults
- tempObj = fitObj.(fnames{i}){j};
- if(~isempty(tempObj))
- structure.(fnames{i}){j} = tempObj.toStructure;
- else
- structure.(fnames{i}){j} = tempObj;
- end
- end
- elseif(strcmp(fnames{i},'invGausStats'))
- tempNames = fieldnames(fitObj.(fnames{i}));
- for j=1:length(tempNames)
- tempObj = currObj.(tempNames{j});
- if(~isempty(tempObj))
- structure.(fnames{i}).(tempNames{j})= tempObj.dataToStructure;
- else
- structure.(fnames{i}).(tempNames{j})= tempObj;
- end
-
- end
-
- else
-
- if(isa(currObj,'double')||isa(currObj,'cell'))
- structure.(fnames{i}) = currObj;
- elseif(isa(currObj,'Covariate') ||isa(currObj,'ConfigColl')||isa(currObj,'nspikeTrain'))
- structure.(fnames{i}) = currObj.toStructure;
- elseif(isa(currObj,'SignalObj'))
- structure.(fnames{i}) = currObj.dataToStructure;
- elseif(isa(currObj,'struct'))
- structure.(fnames{i}) = currObj;
- end
- end
- end
-
- end
-
-
- function handle = plotSeqCorr(fitObj)
- % handle = plotSeqCorr(fitObj)
- % plot zj+1 against zj
-
- %colors = {'.b','.g','.r','.c','.m','.y','.k'};
- rho=zeros(1,fitObj.numResults);
- pval=zeros(1,fitObj.numResults);
- dataLabels = fitObj.lambda.dataLabels;
- for i=1:fitObj.numResults
- handle = plot(fitObj.Z(1:end-1,i),fitObj.Z(2:end,i),strcat('.',Analysis.colors{mod(i-1,length(Analysis.colors))+1})); hold on;
- [rhoTemp,p]= corrcoef(fitObj.Z(1:end-1,i),fitObj.Z(2:end,i));%handle=scatterhist(fitResults.Z(1:end-1,i),fitResults.Z(2:end,i))
-
- [~,columns]=size(rhoTemp);
- if(columns>1)
- rho(i) = rhoTemp(1,2);
- pval(i)= p(1,2);
- else
- rho(i) = rhoTemp;
- pval(i)= p;
- end
- dataLabels{i} = strcat(dataLabels{i},', \rho=',num2str(rho(i),'%0.2g'),' (p=',num2str(pval(i),'%0.2g'),')');
- %get(h,'AlphaData');
- %set(h,'FaceAlpha',0.2,'EdgeAlpha',0.8,'EdgeColor',color{i});
- end
-
-
- legend(dataLabels,'Location','Best');
- ylabel('z_{j+1}'); xlabel('z_j');
- axis tight;
- end
- function handle = plotInvGausTrans(fitObj)
- %[rows,colm] = size(fitObj.X);
- %index=find(fitObj.invGausStats.lags==1);
- %lags=fitObj.invGausStats.lags;
- rhoSig=fitObj.invGausStats.rhoSig;
- n=length(fitObj.X);
- confBoundSig = fitObj.invGausStats.confBoundSig;
- handle=[];
-% for i=1:colm
-% %i
-% htemp=plot(lags',rho(:,i),strcat('.',FitResults.colors{mod(i-1,length(Analysis.colors))+1}));
-% handle=[handle,htemp];
-% hold on;
-% %labelArray{i} = ['Fit ' num2str(i)];
-% end
-
- rhoSig.plot;
- legend(fitObj.lambda.dataLabels,'Location','Best');
- %legend(h,labelArray);
- hold on; confBoundSig.plot;
-
- end
- function handle = plotResidual(fitObj)
- % handle = plotResidual(fitObj)
- % Plots the Point Process Residual
- handle=fitObj.Residual.plot;
- legend off;
- legend(fitObj.Residual.dataLabels,'Location','Best');
- end
-
-
- function setKSStats(fitObj, Z, U, xAxis, KSSorted, ks_stat)
- % setKSStats(fitObj, Z, xAxis, KSSorted, ks_stat)
- % Allows KS statistics to be set after object creation
- % Z: Rescaled ISIs from the Time Rescaling Theorem
- % xAxis: xAxis of the KS plot
- % KSSorted: the sorted values of Uj=1-exp(-zj)
- % ks_stat: the maximum deviation from the 45 degree line for
- % all of the fits.
- %
- fitObj.Z =Z;
- fitObj.U =U;
- fitObj.KSStats.xAxis =xAxis;
- fitObj.KSStats.KSSorted =KSSorted;
- fitObj.KSStats.ks_stat =ks_stat;
- N = length(fitObj.KSStats.KSSorted);
- fitObj.KSStats.withinConfInt = ks_stat<1.36/sqrt(N);
- end
- function setInvGausStats(fitObj, X,rhoSig,confBoundSig)
- % setInvGausStats(fitObj,X,rhoSig,confBoundSig)
- % Sets the inverse gaussian transformed rescaled ISIs and the
- % confidence bounds after the object has been created.
- %fitObj.U=U;
- fitObj.X=X;
- fitObj.invGausStats.rhoSig=rhoSig;
- fitObj.invGausStats.confBoundSig=confBoundSig;
- end
- function setFitResidual(fitObj,M)
- % setFitResidual(fitObj,M).
- % Adds the point process residual to the FitResult object
- fitObj.Residual = M;
- end
-
-
-
- end
-
- methods (Static)
-
- function fitObj = fromStructure(structure)
- if(isa(structure,'struct'))
- spikeObj=nspikeTrain.fromStructure(structure.neuralSpikeTrain);
- lambda=Covariate.fromStructure(structure.lambda);
- rhoSig=SignalObj.signalFromStruct(structure.invGausStats.rhoSig);
- confBoundSig = SignalObj.signalFromStruct(structure.invGausStats.confBoundSig);
- M = Covariate.fromStructure(structure.Residual);
- for i=1:structure.numResults
- histObjects{i} = History.fromStructure(structure.histObjects{i});
- ensHistObject{i} = History.fromStructure(structure.ensHistObjects{i});
- end
- configColl = ConfigColl.fromStructure(structure.configs);
- fitObj=FitResult(spikeObj,structure.covLabels,structure.numHist,histObjects,ensHistObject,lambda,structure.b, structure.dev, structure.stats,structure.AIC,structure.BIC,configColl,structure.XvalData,structure.XvalTime,structure.fitType);
- fitObj.setKSStats(structure.Z,structure.U, structure.KSStats.xAxis, structure.KSStats.KSSorted, structure.KSStats.ks_stat);
- fitObj.setInvGausStats(structure.X,rhoSig,confBoundSig);
- fitObj.setFitResidual(M);
- elseif(isa(structure,'cell')) %cell array of FitResult objects
- fitObj = cell(size(structure));
- for i=1:length(structure)
- fitObj{i} = FitResult.fromStructure(structure{i});
- end
- end
-
- end
-
- function structCell = CellArrayToStructure(fitResObjCell)
- if(isa(fitResObjCell,'FitResult'))
- structCell = fitResObjCell.toStructure;
- elseif(isa(fitResObjCell,'cell'))
- if(isa(fitResObjCell{1},'FitResult'))
- structCell = cell(size(fitResObjCell));
- for i=1:length(fitResObjCell)
- structCell{i} = fitResObjCell{i}.toStructure;
- end
- end
- end
-
- end
-
- end
-
-end
-
-%Helper functions
-function hText = xticklabel_rotate(XTick,rot,varargin)
- %hText = xticklabel_rotate(XTick,rot,XTickLabel,varargin) Rotate XTickLabel
- %
- % Syntax: xticklabel_rotate
- %
- % Input:
- % {opt} XTick - vector array of XTick positions & values (numeric)
- % uses current XTick values or XTickLabel cell array by
- % default (if empty)
- % {opt} rot - angle of rotation in degrees, 90° by default
- % {opt} XTickLabel - cell array of label strings
- % {opt} [var] - "Property-value" pairs passed to text generator
- % ex: 'interpreter','none'
- % 'Color','m','Fontweight','bold'
- %
- % Output: hText - handle vector to text labels
- %
- % Example 1: Rotate existing XTickLabels at their current position by 90°
- % xticklabel_rotate
- %
- % Example 2: Rotate existing XTickLabels at their current position by 45° and change
- % font size
- % xticklabel_rotate([],45,[],'Fontsize',14)
- %
- % Example 3: Set the positions of the XTicks and rotate them 90°
- % figure; plot([1960:2004],randn(45,1)); xlim([1960 2004]);
- % xticklabel_rotate([1960:2:2004]);
- %
- % Example 4: Use text labels at XTick positions rotated 45° without tex interpreter
- % xticklabel_rotate(XTick,45,NameFields,'interpreter','none');
- %
- % Example 5: Use text labels rotated 90° at current positions
- % xticklabel_rotate([],90,NameFields);
- %
- % Note : you can not re-run xticklabel_rotate on the same graph.
- %
- %
-
-
- % This is a modified version of xticklabel_rotate90 by Denis Gilbert
- % Modifications include Text labels (in the form of cell array)
- % Arbitrary angle rotation
- % Output of text handles
- % Resizing of axes and title/xlabel/ylabel positions to maintain same overall size
- % and keep text on plot
- % (handles small window resizing after, but not well due to proportional placement with
- % fixed font size. To fix this would require a serious resize function)
- % Uses current XTick by default
- % Uses current XTickLabel is different from XTick values (meaning has been already defined)
-
- % Brian FG Katz
- % bfgkatz@hotmail.com
- % 23-05-03
- % Modified 03-11-06 after user comment
- % Allow for exisiting XTickLabel cell array
-
- % Other m-files required: cell2mat
- % Subfunctions: none
- % MAT-files required: none
- %
- % See also: xticklabel_rotate90, TEXT, SET
-
- % Based on xticklabel_rotate90
- % Author: Denis Gilbert, Ph.D., physical oceanography
- % Maurice Lamontagne Institute, Dept. of Fisheries and Oceans Canada
- % email: gilbertd@dfo-mpo.gc.ca Web: http://www.qc.dfo-mpo.gc.ca/iml/
- % February 1998; Last revision: 24-Mar-2003
-
- % check to see if xticklabel_rotate has already been here (no other reason for this to happen)
- if isempty(get(gca,'XTickLabel')),
- error('xticklabel_rotate : can not process, either xticklabel_rotate has already been run or XTickLabel field has been erased') ;
- end
-
- % if no XTickLabel AND no XTick are defined use the current XTickLabel
- %if nargin < 3 & (~exist('XTick') | isempty(XTick)),
- if (nargin < 3 || isempty(varargin{1})) & (~exist('XTick') | isempty(XTick)),
- xTickLabels = get(gca,'XTickLabel') ; % use current XTickLabel
- if ~iscell(xTickLabels)
- % remove trailing spaces if exist (typical with auto generated XTickLabel)
- temp1 = num2cell(xTickLabels,2) ;
- for loop = 1:length(temp1),
- temp1{loop} = deblank(temp1{loop}) ;
- end
- xTickLabels = temp1 ;
- end
- varargin = varargin(2:length(varargin));
- end
-
- % if no XTick is defined use the current XTick
- if (~exist('XTick') | isempty(XTick)),
- XTick = get(gca,'XTick') ; % use current XTick
- end
-
- %Make XTick a column vector
- XTick = XTick(:);
-
- if ~exist('xTickLabels'),
- % Define the xtickLabels
- % If XtickLabel is passed as a cell array then use the text
- if (length(varargin)>0) & (iscell(varargin{1})),
- xTickLabels = varargin{1};
- varargin = varargin(2:length(varargin));
- else
- xTickLabels = num2str(XTick);
- end
- end
-
- if length(XTick) ~= length(xTickLabels),
- error('xticklabel_rotate : must have same number of elements in "XTick" and "XTickLabel"') ;
- end
-
- %Set the Xtick locations and set XTicklabel to an empty string
- set(gca,'XTick',XTick,'XTickLabel','')
-
- if nargin < 2,
- rot = 90 ;
- end
-
- % Determine the location of the labels based on the position
- % of the xlabel
- hxLabel = get(gca,'XLabel'); % Handle to xlabel
- xLabelString = get(hxLabel,'String');
-
- % if ~isempty(xLabelString)
- % warning('You may need to manually reset the XLABEL vertical position')
- % end
-
- set(hxLabel,'Units','data');
- xLabelPosition = get(hxLabel,'Position');
- y = xLabelPosition(2);
-
- %CODE below was modified following suggestions from Urs Schwarz
- y=repmat(y,size(XTick,1),1);
- % retrieve current axis' fontsize
- fs = get(gca,'fontsize');
-
- % Place the new xTickLabels by creating TEXT objects
- hText = text(XTick, y, xTickLabels,'fontsize',fs);
-
- % Rotate the text objects by ROT degrees
- set(hText,'Rotation',rot,'HorizontalAlignment','right',varargin{:})
-
- % Adjust the size of the axis to accomodate for longest label (like if they are text ones)
- % This approach keeps the top of the graph at the same place and tries to keep xlabel at the same place
- % This approach keeps the right side of the graph at the same place
-
- set(get(gca,'xlabel'),'units','data') ;
- labxorigpos_data = get(get(gca,'xlabel'),'position') ;
- set(get(gca,'ylabel'),'units','data') ;
- labyorigpos_data = get(get(gca,'ylabel'),'position') ;
- set(get(gca,'title'),'units','data') ;
- labtorigpos_data = get(get(gca,'title'),'position') ;
-
- set(gca,'units','pixel') ;
- set(hText,'units','pixel') ;
- set(get(gca,'xlabel'),'units','pixel') ;
- set(get(gca,'ylabel'),'units','pixel') ;
-
- origpos = get(gca,'position') ;
- textsizes = cell2mat(get(hText,'extent')) ;
- longest = max(textsizes(:,4)) ;
-
- laborigext = get(get(gca,'xlabel'),'extent') ;
- laborigpos = get(get(gca,'xlabel'),'position') ;
-
-
- labyorigext = get(get(gca,'ylabel'),'extent') ;
- labyorigpos = get(get(gca,'ylabel'),'position') ;
- leftlabdist = labyorigpos(1) + labyorigext(1) ;
-
- % assume first entry is the farthest left
- leftpos = get(hText(1),'position') ;
- leftext = get(hText(1),'extent') ;
- leftdist = leftpos(1) + leftext(1) ;
- if leftdist > 0, leftdist = 0 ; end% only correct for off screen problems
-
- botdist = origpos(2) + laborigpos(2) ;
- newpos = [origpos(1)-leftdist longest+botdist origpos(3)+leftdist origpos(4)-longest+origpos(2)-botdist] ;
- set(gca,'position',newpos) ;
-
- % readjust position of nex labels after resize of plot
- set(hText,'units','data') ;
- for loop= 1:length(hText),
- set(hText(loop),'position',[XTick(loop), y(loop)]) ;
- end
-
-
- % adjust position of xlabel and ylabel
- laborigpos = get(get(gca,'xlabel'),'position') ;
- set(get(gca,'xlabel'),'position',[laborigpos(1) laborigpos(2)-longest 0]) ;
-
- % switch to data coord and fix it all
- set(get(gca,'ylabel'),'units','data') ;
- set(get(gca,'ylabel'),'position',labyorigpos_data) ;
- set(get(gca,'title'),'position',labtorigpos_data) ;
-
- set(get(gca,'xlabel'),'units','data') ;
- labxorigpos_data_new = get(get(gca,'xlabel'),'position') ;
- set(get(gca,'xlabel'),'position',[labxorigpos_data(1) labxorigpos_data_new(2)]) ;
-
-
- % Reset all units to normalized to allow future resizing
- set(get(gca,'xlabel'),'units','normalized') ;
- set(get(gca,'ylabel'),'units','normalized') ;
- set(get(gca,'title'),'units','normalized') ;
- set(hText,'units','normalized') ;
- set(gca,'units','normalized') ;
-
- if nargout < 1,
- clear hText
- end
-
-end
-function [uniqueLabels, indexIntoOriginal, restoreIndex] = getUniqueLabels(covLabels)
- offset = 0;
- for i=1:length(covLabels)
- currLabels = covLabels{i};
- allLabels((1:length(currLabels))+offset) = currLabels;
- offset=length(allLabels);
- end
- [uniqueLabels, indexIntoOriginal, restoreIndex] = unique(allLabels);
-end
-
Input argument "spikeObj" is undefined.
-
-Error in ==> FitResult>FitResult.FitResult at 86
- if(isnumeric(spikeObj.name))
-
- Published with MATLAB® 7.11
\ No newline at end of file
diff --git a/helpfiles/FitResult.m b/helpfiles/FitResult.m
deleted file mode 100644
index 6b1aa4b6..00000000
--- a/helpfiles/FitResult.m
+++ /dev/null
@@ -1,1741 +0,0 @@
-classdef FitResult < handle
-% FITRESULT
-% stores results of a fit using the Analysis object
-% The results are for a single neuron over a range of configurations
-%
-% methods
-% FitResult Examples
-%
-% see also Analysis
-%
-% Reference page in Help browser
-% doc FitResult
-
-
-%
-% nSTAT v1 Copyright (C) 2012 Masschusetts Institute of Technology
-% Cajigas, I, Malik, WQ, Brown, EN
-% This program is free software; you can redistribute it and/or
-% modify it under the terms of the GNU General Public License as published
-% by the Free Software Foundation; either version 2 of the License, or
-% (at your option) any later version.
-%
-% This program is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-% See the GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this program; if not, write to the Free Software Foundation,
-% Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- properties
- numResults %Number of results in this FitResult object
- lambda %Lambda signal
- numCoeffs %Number of coefficients for each fitResult
- fitType %Poisson or Binomial
-
- b %coefficients for each fit
-
- dev %deviance for each fit
- AIC %Akaike's Information Criterion for each fit
- BIC %Baysian Information Criterion for each fit
- logLL %Log Likelihood
- stats %Relevant statistics for each fit
- configs % the config collection for the different fits
- configNames % names of the the differen fits
- neuronNumber % the number of the neuron the data comes from
- neuralSpikeTrain % the spike data
- covLabels
- uniqueCovLabels
- indicesToUniqueLabels
- numHist % Number of history terms (used for indexing into the regression coefficients) for each fit
- histObjects % History object for self firing
- ensHistObjects % History object to be applied to the neuron's neigbors to compute ensemble effect
- flatMask
- Z % Rescaled spike times from the Time-Rescaling theorem, exponential rate 1
- U % Transformed z's -> uniform in [0,1]
- X % Transformed u's -> gaussian in [-inf, inf]
- Residual %fit residual
-% xAxis
-% KSSorted
-% ks_stat
- invGausStats
- KSStats %Kolmogorov Smirnov Statistics
- plotParams
- XvalData % cell array of raw data used for validation
- XvalTime % cell array of time vectors for each element of XvalData
- validation % a FitResult object with the validation data
- minTime % The minTime from the spikeTrain (not necessarily the analysis)
- maxTime % The maxTime for the spikeTrain (not necessarily the analysis)
- end
- properties (Constant,Hidden)
- colors={'b','g','r','c','m','y','k'};
- end
-
-
- methods
-
- function fitObj=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,logLL, configColl,XvalData,XvalTime,distribution)
- % fitObj=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,configColl,XvalData,XvalTime)
- % Stores the results of multiple regressions for a single neuron into a accessible structure.
- %
- % spikeObj: The spike train for the neuron whose results are
- % being stored.
- % covLabels: A 2-d cell array, the jth row has all the labels for the covariates used in the jth fit
- % numHist: The number of history terms in each of the N fits.
- % histObjects: The History object for each of the N fits
- % ensHistObj: The History object for used to compute the ensemble history effect.
- % lambda: The conditional intensity function evaluated usin the
- % data. Each dimension of lambda corresponds to the a different
- % GLM Fit.
- % b: N-component cell array containing the GLM regression
- % coefficient of each of the fits. The jth component has all
- % the regression coefficients for the jth trial.
- % dev: vector of Deviances for each the GLM fits.
- % stats: Cell array of the stats parameters for each GLM fit;
- % AIC: vector of Akaike's information criteria for each the GLM fits.
- % BIC: vector of Bayes Information criteria for each the GLM fits.
- % configColl: configCollection object used to generate this
- % results
- % XvalData: Data to be used for validation.
- % XvalTime: Time vector for the data.
-
- if(nargin< 14)
- XvalTime =[];
- end
- if(nargin<13)
- XvalData =[];
- end
-
- if(isa(spikeObj,'cell'))
- for i=1:length(spikeObj)
- if(isnumeric(spikeObj{i}.name))
- nNumber(i) =spikeObj{i}.name;
- else
- nNumber(i) = str2double(spikeObj{i}.name(~isletter(spikeObj{i}.name)));
- end
- minTime(i)=spikeObj{i}.minTime;
- maxTime(i)=spikeObj{i}.maxTime;
- end
- nNumber = unique(nNumber);
- minTime = unique(minTime);
- maxTime = unique(maxTime);
- if(length(nNumber)>1)
- error('Can only have a FitResults with spike trains from a single neuron');
- end
- if(length(minTime)>1 || length(maxTime)>1)
- error('Spike Trains are of different lengths');
- end
-
- elseif(isa(spikeObj,'nspikeTrain'))
- if(isnumeric(spikeObj.name))
- nNumber =spikeObj.name;
- else
- nNumber = str2double(spikeObj.name(~isletter(spikeObj.name)));
- end
- minTime=spikeObj.minTime;
- maxTime=spikeObj.maxTime;
-
- end
-
- fitObj.neuronNumber = nNumber; %str2num(spikeObj.name);
- fitObj.neuralSpikeTrain = spikeObj;
- fitObj.minTime = minTime;
- fitObj.maxTime = maxTime;
-
- fitObj.numResults = 0;
- fitObj.configs = configColl;
- fitObj.configNames = configColl.getConfigNames;
- fitObj.covLabels=covLabels;
- fitObj.uniqueCovLabels= getUniqueLabels(covLabels);
-
- fitObj.mapCovLabelsToUniqueLabels;
- fitObj.numHist=numHist;
- fitObj.histObjects = histObjects;
- fitObj.ensHistObjects = ensHistObj;
- fitObj.addParamsToFit(fitObj.neuronNumber,lambda,b, dev, stats,AIC,BIC,logLL,configColl);
- fitObj.Z =[]; %rescaled spikes times - exponentially dist.
- fitObj.U =[]; %rescaled spike times - uniformly dist.
- fitObj.X =[]; %rescaled spike times - gaussian dist.
- fitObj.Residual =[]; %fit residual for PP
- fitObj.KSStats.xAxis =[];
- fitObj.KSStats.KSSorted =[];
- fitObj.KSStats.ks_stat =[];
- fitObj.invGausStats.rhoSig=[];
- fitObj.invGausStats.confBoundSig=[];
- fitObj.plotParams = [];
- fitObj.XvalData = XvalData;
- fitObj.XvalTime = XvalTime;
-
- fitObj.fitType = distribution;
-
- end
- function fitObj = setNeuronName(fitObj,name)
- fitObj.neuronNumber = name;
- end
- function mFitRes = mergeResults(fitObj,newFitObj)
- % mFitRes = mergeResults(fitObj,newFitObj)
- % mFitRes contains the results from fitObj followed by the
- % results of newFitObj in a single new FitResult object
- %
- % newFitObj can be of class 'FitResult' or a cell array of
- % 'FitResult' objects. In the latter case, the results are
- % apppended in the order that they appear in each cell array.
- if(isa(newFitObj,'FitResult'))
-% newFitObj.neuronNumber
- if(fitObj.neuronNumber ==newFitObj.neuronNumber)
- spikeObj = fitObj.neuralSpikeTrain;
- covLabels = fitObj.covLabels(1:fitObj.numResults);
- covLabels((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.covLabels(1:newFitObj.numResults);
- numHist = fitObj.numHist(1:fitObj.numResults);
- numHist((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.numHist(1:newFitObj.numResults);
- histObjects=fitObj.histObjects(1:fitObj.numResults);
- histObjects((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.histObjects(1:newFitObj.numResults);
- ensHistObjects=fitObj.ensHistObjects(1:fitObj.numResults);
- ensHistObjects((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.ensHistObjects(1:newFitObj.numResults);
- b=fitObj.b(1:fitObj.numResults);
- b((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.b(1:newFitObj.numResults);
- dev = [fitObj.dev newFitObj.dev];
- AIC = [fitObj.AIC newFitObj.AIC];
- BIC = [fitObj.BIC newFitObj.BIC];
- logLL = [fitObj.logLL newFit.logLL];
- stats=fitObj.stats(1:fitObj.numResults);
- stats((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.stats(1:newFitObj.numResults);
- lambda = fitObj.lambda.merge(newFitObj.lambda);
-
- for i=1:fitObj.numResults
- config{i}=fitObj.configs.getConfig(i);
- end
- offset=fitObj.numResults;
- for i=1:newFitObj.numResults
- config{i+offset}=newFitObj.configs.getConfig(i);
- end
- configColl= ConfigColl(config);
-
- XvalData = [fitObj.XvalData newFitObj.XvalData];
- XvalTime = [fitObj.XvalTime newFitObj.XvalTime];
- distribution=fitObj.fitType(1:fitObj.numResults);
- distribution((fitObj.numResults+1):(fitObj.numResults+newFitObj.numResults)) = newFitObj.fitType(1:newFitObj.numResults);
- tempZ = zeros(length(fitObj.Z),size(newFitObj.Z,2));
- tempU = zeros(length(fitObj.U),size(newFitObj.U,2));
- tempZ(1:length(newFitObj.Z),:) = newFitObj.Z;
- tempU(1:length(newFitObj.U),:) = newFitObj.U;
- Z=[fitObj.Z tempZ];
- U=[fitObj.U tempU];
- [X,rhoSig,confBoundSig] = Analysis.computeInvGausTrans(Z);
-
- M=fitObj.Residual.merge(newFitObj.Residual);
-
- origLength = size(fitObj.KSStats.xAxis,1);
- currLength = size(newFitObj.KSStats.xAxis,1);
-
- if(currLength~=origLength)
- %we use this because some times the time scales
- %dont match up. In particular when spikeTrain is
- %segmented by steps or windows and the window sizes
- %are normalized to 1.
- newX = fitObj.KSStats.xAxis;
- oldX = newFitObj.KSStats.xAxis;
- oldY = newFitObj.KSStats.KSSorted;
- y = interp1(oldX,oldY,newX(:,1),'spline','extrap');
- xAxis = [fitObj.KSStats.xAxis newX(:,1)];
- KSSorted = [fitObj.KSStats.KSSorted y];
- else
-
- xAxis = [fitObj.KSStats.xAxis newFitObj.KSStats.xAxis];
- KSSorted = [fitObj.KSStats.KSSorted newFitObj.KSStats.KSSorted];
-
- end
- ks_stat = [fitObj.KSStats.ks_stat newFitObj.KSStats.ks_stat];
- mFitRes=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObjects,lambda,b, dev, stats,AIC,BIC,logLL,configColl,XvalData,XvalTime,distribution);
- mFitRes.setKSStats(Z,U, xAxis, KSSorted, ks_stat);
- mFitRes.setInvGausStats(X,rhoSig,confBoundSig);
- mFitRes.setFitResidual(M);
-
-
- elseif(isa(newFitObj,'cell'))
- if(isa(newFitObj{1},'FitResult'))
- for i=1:length(newFitObj)
- if(i==1)
- mFitRes = fitObj.mergeResults(newFitObj{i});
- else
- mFitRes = mFitRes.mergeResults(newFitObj{i});
- end
- end
- end
- end
- end
-
- end
- function subsetFit = getSubsetFitResult(fitObj,subfits)
- %subfits is a row vector with numbers corresponding to the
- %subfits
- if(and(min(subfits)>0,max(subfits)<=fitObj.numResults))
- spikeObj = fitObj.neuralSpikeTrain;
- covLabels = fitObj.covLabels(subfits);
- numHist = fitObj.numHist(subfits);
- histObjects = fitObj.histObjects(subfits);
- ensHistObj = fitObj.ensHistObjects(subfits);
- lambda = fitObj.lambda.getSubSignal(subfits);
- b = fitObj.b(subfits);
- dev = fitObj.dev(subfits);
- stats = fitObj.stats(subfits);
- AIC = fitObj.AIC(subfits);
- BIC = fitObj.BIC(subfits);
- logLL = fitObj.logLL(subfits);
- configColl = fitObj.configs.getSubsetConfigs(subfits);
- XvalData = fitObj.XvalData;
- XvalTime = fitObj.XvalTime;
- distribution = fitObj.fitType;
-
- subsetFit=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,logLL,configColl,XvalData,XvalTime,distribution);
- Z = fitObj.Z(:,subfits);
- U = fitObj.U(:,subfits);
- X = fitObj.X(:,subfits);
- xAxis= fitObj.KSStats.xAxis(:,subfits);
- KSSorted=fitObj.KSStats.KSSorted(:,subfits);
- ks_stat=fitObj.KSStats.ks_stat(subfits);
- rhoSig=fitObj.invGausStats.rhoSig.getSubSignal(subfits);
- confBoundSig=fitObj.invGausStats.confBoundSig;
- M = fitObj.Residual.getSubSignal(subfits);
-
- subsetFit.setKSStats(Z,U, xAxis, KSSorted, ks_stat);
- subsetFit.setInvGausStats(X,rhoSig,confBoundSig);
- subsetFit.setFitResidual(M);
- end
- end
- function addParamsToFit(fitObj,neuronNum,lambda,b, dev, stats,AIC,BIC,logLL,configColl)
- % addParamsToFit(fitObj,neuronNum,lambda,b, dev, stats,AIC,BIC,configColl)
- % Add the specified parameters to the current FitResult object
- % only if the neuronNum matches the neuronNum of this object
- if(fitObj.neuronNumber==neuronNum)
- if(isa(lambda,'cell'))
- newLambda=lambda{1};
- for i=2:length(lambda)
- newLambda = newLambda.merge(lambda{i});
- end
- elseif(isa(lambda,'Covariate')||isa(lambda,'SignalObj'))
- newLambda = lambda;
- end
-
- numNewResults = newLambda.dimension;%number of new elements
- if(nargin<8)
- configColl = cell(1,numNewResults);
- end
-
- if(numNewResults==1)
- fitObj.b{fitObj.numResults+1} = b{1};
-
- fitObj.dev(fitObj.numResults+1) = dev;
- fitObj.stats{fitObj.numResults+1}= stats{1};
- if(nargin<7)
- fitObj.AIC(fitObj.numResults+1) = 2*length(b)+dev;
- fitObj.BIC(fitObj.numResults+1) = length(b)*log(length(newLambda.time))+dev;
- delta = 1/newLambda.sampleRate;
- fitObj.logLL(fitObj.numResults+1) = sum(y.*log(data*delta)+(1-y).*(1-newLambda.data*delta));
- else
- fitObj.AIC(fitObj.numResults+1) = AIC;
- fitObj.BIC(fitObj.numResults+1) = BIC;
- fitObj.logLL(fitObj.numResults+1) = logLL;
- end
-
- fitObj.numCoeffs(fitObj.numResults+1) = length(b);
- else
- for i=1:numNewResults
- fitObj.b{fitObj.numResults+i} = b{i};
-
- fitObj.dev(fitObj.numResults+i) = dev(i);
- fitObj.stats{fitObj.numResults+i}= stats{i};
- if(nargin<7)
- fitObj.AIC(fitObj.numResults+i) = 2*length(b{i})+dev(i);
- fitObj.BIC(fitObj.numResults+i) = length(b{i})*log(length(newLambda.time))+dev(i);
- delta=fitObj.neuralSpikeTrain.sampleRate;
- y=fitObj.neuralSpikeTrain.getSigRep.dataToMatrix;
-
- fitObj.logLL(fitObj.numResults+i)= sum(y.*log(newLambda.data*delta)+(1-y).*(1-newLambda.data*delta));
- else
- fitObj.AIC(fitObj.numResults+i) = AIC(i);
- fitObj.BIC(fitObj.numResults+i) = BIC(i);
- fitObj.logLL(fitObj.numResults+i)= logLL(i);
- end
- fitObj.numCoeffs(fitObj.numResults+i) = length(b{i});
- end
- end
- if(fitObj.numResults ==0)
- fitObj.lambda = newLambda;
- else
- fitObj.lambda = fitObj.lambda.merge(newLambda); %new lambda
- end
-
- fitObj.numResults = fitObj.numResults+numNewResults;
- dataLabels = cell(1,fitObj.numResults);
- for i=1:fitObj.numResults
- dataLabels{i} = strcat('\lambda_{',num2str(i),'}');
- end
- fitObj.lambda.setDataLabels(dataLabels);
-
- fitObj.configs.addConfig(configColl);
- fitObj.configNames = fitObj.configs.getConfigNames;
- else
- error('Neuron number does not match');
- end
- end
- function [lambda, logLL] = computeValLambda(fitObj)
- % lambda = computeValLambda(fitObj)
- % Returns a Covariate object lambda. This is the Conditional
- % intensity function evaluated using the validation data
- lambdaData = zeros(length(fitObj.XvalTime{1}),fitObj.numResults);
- for i=1:fitObj.numResults
- lambdaData(:,i) = fitObj.evalLambda(i,fitObj.XvalData{i});
- end
- lambda=Covariate(fitObj.XvalTime{1},lambdaData,...
- '\lambda(t)',fitObj.lambda.xlabelval,...
- fitObj.lambda.xunits,'Hz',fitObj.lambda.dataLabels);
- delta = 1/lambda.sampleRate;
- y=fitObj.neuralSpikeTrain.getSigRep.dataToMatrix;
- logLL =sum(y.*log(lambda.data*delta)+(1-y).*(1-lambda.data*delta));
- end
-
- function mapCovLabelsToUniqueLabels(fitObj)
- % mapCovLabelsToUniqueLabels(fitObj)
- % Used internally by the FitResult class generate a matrix that
- % maps how covariate labels of the fit object map to unique
- % covariate labels. For example, multiple fits that have a
- % constant baseline term will be assumed to refer to the same
- % "baseline" term and not two separate ones
- flatMask = zeros(length(fitObj.uniqueCovLabels),length(fitObj.covLabels));
- for j=1:length(fitObj.covLabels)
- currLabels = fitObj.covLabels{j};
- index=zeros(1,length(currLabels));
- for i=1:length(currLabels)
- index(i)=strmatch(currLabels{i}, fitObj.uniqueCovLabels, 'exact');
- end
-
- fitObj.indicesToUniqueLabels{j} = index;
- flatMask(index,j) = 1;
- end
- fitObj.flatMask = flatMask;
- end
- function p=getPlotParams(fitObj)
- % p=getPlotParams(fitObj)
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
- p=fitObj.plotParams;
- end
- function plotValidation(fitObj)
- % plotValidation(fitObj)
- % calls plotResults on the validation FitResult object if
- % validation data is present. Note that the GLM coefficients
- % are not recomputed and therefore the same as those obtained
- % from the training data.
- if(~isempty(fitObj.validation))
- fitObj.validation.plotResults;
- else
- display('Validation Data not available to plot');
- end
- end
- function answer = isValDataPresent(fitObj)
- % answer = isValDataPresent(fitObj)
- % returns 1 if validation data is present. This method is used
- % to determine if validation data is available to compute the
- % validation results.
- answer = 0;
- if(~isempty(fitObj.XvalTime) && ~isempty(fitObj.XvalData))
- for i=1:length(fitObj.XvalTime)
- currTime = fitObj.XvalTime{i};
- if(~isempty(currTime))
- if(currTime(end)-currTime(1)>0)
- answer =1;
- break;
- end
- end
- end
-
- end
-
- end
- function lambdaData = evalLambda(fitObj,lambdaIndex,newData)
- % lambdaData = evalLambda(fitObj,lambdaIndex,newData)
- % lambdaIndex: the index of the corresponding lambda to be
- % evaluated with the new data.
- % newData: matrix of covariates in same order as fits without
- % constant term in first column
-% if(isa(newData,'double'))
-% [~,columns] = size(newData);
-% tempData = cell(1,columns);
-% for i=1:columns
-% tempData{i} = newData(:,i);
-% end
-% newData = tempData;
-% end
-
- if(lambdaIndex>0 && lambdaIndex <= fitObj.numResults)
- b=fitObj.b{lambdaIndex}; %coefficient matrix
- if(isempty(newData))
- [rows,~] = size(newData);
- baseline=ones(rows,1);
- lambdaData = exp(b(1)*baseline);
- else
- if(isa(newData,'double')) %matrix, 1 column per coefficient
- baseline=ones(length(newData),1);
- [~,columns] = size(newData);
-
- if(length(b)>=1)
- lambdaData = exp(newData*b(1:end));
- if(strcmp(fitObj.fitType{lambdaIndex},'poisson'))
-% lambdaData = exp(newData*b(1:end));
-% lambdaData = exp(b(1) + newData*b(2:end));
- else
-% lambdaData = exp(b(1) + newData*b(2:end));
- lambdaData = lambdaData./(1+lambdaData);
- end
-% else
-% if(strcmp(fitObj.fitType{lambdaIndex},'poisson'))
-% lambdaData = exp(b(1)*baseline);
-%
-% else
-% lambdaData = exp(b(1)*baseline);
-% lambdaData = lambdaData./(1+lambdaData);
-% end
- end
- lambdaData = lambdaData*fitObj.neuralSpikeTrain.sampleRate;
- elseif(isa(newData,'cell')) % a cell array, each element is matrix of values for each coeff
-% baseline=ones(size(newData{1})); %design matrix
- runSum=0;
- for i=1:(length(newData)) %-fitObj.numHist(lambdaIndex))
-% if(i==1)
-% runSum = b(1)*baseline;
-% else
- if(i<=length(b))
- runSum = runSum+b(i)*newData{i};
- end
-% end
- end
- if(strcmp(fitObj.fitType{lambdaIndex},'poisson'))
- lambdaData = exp(runSum);
- lambdaData = lambdaData*fitObj.neuralSpikeTrain.sampleRate;
- else
- lambdaData = exp(runSum);
- lambdaData = lambdaData./(1+lambdaData);
- lambdaData = lambdaData*fitObj.neuralSpikeTrain.sampleRate;
- end
- else
- error('New data must be cell or a matrix');
- end
-
- end
- else
- error('Index into fit params is incorrect');
- end
-
- end
-% function handle = plotHist(fitObj,fitNum)
-% % handle = plotHist(fitObj,fitNum)
-% % plots the history terms used in this FitResult object
-% % if fitNum is not specified then fitNum=1:numResults
-% if(nargin<2 || isempty(fitNum))
-% fitNum = 1:fitObj.numResults;
-% end
-%
-% for j=fitNum
-% if(j>0 && j <= fitObj.numResults)
-% b=fitObj.b{j}; %coefficient matrix
-% startHistIndex = length(b)-fitObj.numHist(j)+1;
-% if(startHistIndex=windowTimes(i),t<=windowTimes(i+1));
-% histEffect(index)=exp(-bHist(i))-1; %To offset zero coeffs
-% end
-% end
-% else
-% t=[0; 0.00001];
-% histEffect =[0;0];
-% end
-% if(j==fitNum(1))
-% hSig = SignalObj(t,histEffect,'History','time','s','',fitObj.lambda.dataLabels{j});
-% else
-% hSig = hSig.merge(SignalObj(t,histEffect,'History Effect','time','s','',fitObj.lambda.dataLabels{j}));
-% end
-% end
-% end
-% N=floor(length(hSig.time)./70); B=ones(1,N)/N; A=1;
-% handle=hSig.filtfilt(B,A).plot;
-% end
- function computePlotParams(fitObj,fitNum)
- if(nargin<2)
- fitNum = 1:fitObj.numResults;
- end
- index=find(sum(fitObj.flatMask,2)>0);%1:length(fitObj.flatMask(:,1));
- %Only use the labels that appear in at least one fit
- %Otherwise that parameter was not present for any of the
- %regressions and just takes up plot real-estate
-
- sigIndex=zeros(length(index),length(fitNum));
- bAct = nan(length(index),length(fitNum));
- seAct= nan(length(index),length(fitNum));
-
- for i=fitNum
- %this indexing is to avoid extremely large se's from
- %affecting plots
- criteria = find(fitObj.stats{i}.se'<100);
- %indicesForFit = find(fitObj.flatMask(index,i)==1);
- indicesForFit = fitObj.indicesToUniqueLabels{i};
- bVals = fitObj.b{i}(criteria);
- bAct(indicesForFit(criteria),i) = bVals; %sorted according to uniqueLabels
- seVals = fitObj.stats{i}.se(criteria)';
- seAct(indicesForFit(criteria),i)= seVals; %sorted according to uniqueLabels;
- temp = sign([bAct(:,i)-seAct(:,i) bAct(:,i)+seAct(:,i)]);
- productOfSigns = temp(:,1).*temp(:,2); %should be positive
- sIndex=and(productOfSigns>0,seAct(:,i)~=0);
- sigIndex(:,i)=sIndex;
- end
- fitObj.plotParams.bAct = bAct;
- fitObj.plotParams.seAct= seAct;
- fitObj.plotParams.sigIndex = sigIndex;
- fitObj.plotParams.xLabels = cell(length(index),1);
- fitObj.plotParams.xLabels = fitObj.uniqueCovLabels;
-
-% for i=1:(length(index))
-% if(i==1)
-% fitObj.plotParams.xLabels{i} = 'baseline';
-% %text(i, 0,'baseline','interpreter','latex');
-% else
-% fitObj.plotParams.xLabels{i} = fitObj.covLabels{index(i)-1};
-% %text(i, 0,fitObj.covLabels{index(i)-1},'interpreter','latex');
-% end
-% end
- tempVal =sum(fitObj.flatMask,2);
- fitObj.plotParams.numResultsCoeffPresent =tempVal(index);
- end
-
- function [coeffIndex, epochId,numEpochs] = getCoeffIndex(fitObj,fitNum,sortByEpoch)
- if(nargin<3 || isempty(sortByEpoch))
- sortByEpoch=0;
- end
- if(nargin<2 || isempty(fitNum))
- fitNum = 1:fitObj.numResults;
- end
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
- [histIndex, epochId] = fitObj.getHistIndex(fitNum,sortByEpoch);
- allIndex = 1:length(fitObj.uniqueCovLabels);
-
- nonHistIndex = setdiff(allIndex,histIndex);
-% nonNANIndex = find(sum(~isnan(fitObj.plotParams.bAct(:,fitNum)),2)>=1);
- nonNANIndex= allIndex;
- actCoeffIndex = nonHistIndex(ismember(nonHistIndex, nonNANIndex));
- allCoeffTerms = fitObj.uniqueCovLabels(actCoeffIndex);
-% coeffName = cell(size(allCoeffTerms));
- epochStartInd=regexp(allCoeffTerms,'_\{\d*\}','start');
- epochEndInd=regexp(allCoeffTerms,'_\{\d*\}','end');
-
- allCoeffIndex = [];
- nonEpochIndex=[];
-% nonEmptyCoeffNameInd = [];
- epochsExist =0;
- for i=1:length(allCoeffTerms)
- if(~isempty(allCoeffTerms{i}))
- allCoeffIndex = [allCoeffIndex i];
-
- if(~isempty(epochStartInd{i}))
-% nonEmptyCoeffNameInd = [nonEmptyCoeffNameInd i];
- epochsExist=1;
- actStart = epochStartInd{i}+2;
- actEnd = epochEndInd{i}-1;
- numEpoch(i) = str2num(allCoeffTerms{i}(actStart:actEnd));
-% coeffName{i} = allCoeffTerms{i}(1:actStart-3);
-
-
- else
- nonEpochIndex = [nonEpochIndex i];
- numEpoch(i) = 0; % make terms that only appear once part of epoch 0.
-
- end
- end
-
- end
-
-% coeffName = coeffName(nonEmptyCoeffNameInd);
- if(epochsExist && ~sortByEpoch)
- totalEpochs = unique(numEpoch);
- coeffIndex = nonEpochIndex;
- if(nargout>1)
- epochId=zeros(size(nonEpochIndex));
- end
- for i=1:length(totalEpochs)
- if(totalEpochs(i)~=0)
- coeffIndex = [coeffIndex, find(numEpoch==totalEpochs(i))];
-
- if(nargout>1)
- epochId = [epochId, totalEpochs(i)*ones(size(find(numEpoch==totalEpochs(i))))];
- end
- end
- end
- coeffIndex = actCoeffIndex(coeffIndex);
- elseif(epochsExist && sortByEpoch)
- coeffIndex = actCoeffIndex(allCoeffIndex);
- if(nargout>1)
- epochId = numEpoch;
- end
- else
- coeffIndex = actCoeffIndex(allCoeffIndex);
- if(nargout>1)
- epochId = zeros(size(allCoeffIndex)); %no epochs exist so just create same index for all;
- end
- end
-
-
-% nonNANIndex = find(sum(~isnan(fitObj.plotParams.bAct(:,fitNum)),2)>=1);
- nonNANIndex = allIndex;
- coeffIndex = coeffIndex(ismember(coeffIndex, nonNANIndex));
-
- if(nargout>2)
- numEpochs = length(unique(epochId));
- end
-
- end
-
- function h=plotCoeffsWithoutHistory(fitObj,fitNum,sortByEpoch,plotSignificance)
- if(nargin<4 || isempty(plotSignificance))
- plotSignificance=1;
- end
- if(nargin<3 || isempty(sortByEpoch))
- sortByEpoch = 0;
- end
- if(nargin<2 || isempty(fitNum))
- fitNum = 1:fitObj.numResults;
- end
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
-
-
- coeffIndex = fitObj.getCoeffIndex(fitNum,sortByEpoch);
- h=fitObj.plotCoeffs([],fitNum,[],plotSignificance,coeffIndex);
-
-
-
- end
-
- function [histIndex, epochId,numEpochs] = getHistIndex(fitObj,fitNum,sortByEpoch)
- %if sortByEpoch==1 then we group all regression terms with the
- %same name one next to each other by epoch (time interval).
- %Otherwise, we show all epoch one terms, followed by all epoch
- %2 terms, etc.
- if(nargin<3 || isempty(sortByEpoch))
- sortByEpoch = 0;
- end
- if(nargin<2 || isempty(fitNum))
- fitNum = 1:fitObj.numResults;
- end
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
-
-
- allHistTerms = regexp(fitObj.uniqueCovLabels,'^[\w*');
- epochStartInd=regexp(fitObj.uniqueCovLabels,'\]_\{\d*\}','start');
- epochEndInd=regexp(fitObj.uniqueCovLabels,'\]_\{\d*\}','end');
- allHistIndex = [];
- epochsExist =0;
- for i=1:length(allHistTerms)
- if(~isempty(allHistTerms{i}))
- allHistIndex = [allHistIndex i];
- if(~isempty(epochStartInd{i}))
- epochsExist=1;
- actStart = epochStartInd{i}+3;
- actEnd = epochEndInd{i}-1;
- numEpoch(i) = str2num(fitObj.uniqueCovLabels{i}(actStart:actEnd));
- end
- end
-
- end
-
- if(epochsExist && ~sortByEpoch)
- totalEpochs = unique(numEpoch);
- histIndex = [];
- if(nargout>1)
- epochId=[];
- end
- for i=1:length(totalEpochs)
- histIndex = [histIndex, find(numEpoch==totalEpochs(i))];
- if(nargout>1)
- epochId = [epochId, totalEpochs(i)*ones(size(find(numEpoch==totalEpochs(i))))];
- end
- end
- elseif(epochsExist && sortByEpoch)
- histIndex = allHistIndex;
- if(nargout>1)
- epochId = numEpoch;
- end
- else
- histIndex = allHistIndex;
- if(nargout>1)
- epochId = zeros(size(allHistIndex)); %no epochs exist so just create same index for all;
- end
- end
-
-
-% nonNANIndex = find(sum(~isnan(fitObj.plotParams.bAct(:,fitNum)),2)>=1);
-% histIndex = histIndex(ismember(histIndex, nonNANIndex));
-
- if(nargout>2)
- numEpochs = length(unique(epochId));
- end
-
- end
-
- function [coeffMat, labels, SEMat] = getCoeffs(fitObj, fitNum)
- if(nargin<2 || isempty(fitNum))
- fitNum =1:fitObj.numResults;
- end
- sortByEpoch = 0; % Make sure we have different time series if the history is divided into epochs;
- [coeffIndex, epochId, numEpochs] = fitObj.getCoeffIndex(fitNum,sortByEpoch);
- epochNums = unique(epochId);
-
-
- coeffStrings = fitObj.uniqueCovLabels(coeffIndex);
- baseStringEndIndex =regexp(coeffStrings,'_\{\d*\}','start');
-
- for i=1:length(baseStringEndIndex)
- if(~isempty(baseStringEndIndex{i}))
- baseStrings{i} = coeffStrings{i}(1:baseStringEndIndex{i}-1);
- else
- baseStrings{i} = coeffStrings{i};
- end
- end
- uniqueCoeffs = unique(baseStrings);
-
- for i=1:length(uniqueCoeffs)
- coeffStrIndex{i} = coeffIndex(strcmp(baseStrings,uniqueCoeffs{i}));
- if(min(epochId)==0)
- epochIndices{i} = epochId(strcmp(baseStrings,uniqueCoeffs{i}))+1;
- else
- epochIndices{i} = epochId(strcmp(baseStrings,uniqueCoeffs{i}));
- end
- end
-
-%
-% for i=1:numEpochs
-% epochIndices{i} = find(epochId==epochNums(i));
-% epochLength(i) = length(epochIndices{i});
-% end
-
-
-
- coeffIndMat= nan(length(uniqueCoeffs),numEpochs);
-
- labels = cell(size(coeffIndMat));
- for i=1:length(uniqueCoeffs)
- coeffIndMat(i,epochIndices{i}) = coeffStrIndex{i};
- labels(i,epochIndices{i}) = fitObj.uniqueCovLabels(coeffStrIndex{i});
- end
-
-
-% for i=1:numEpochs
-% coeffIndMat(1:epochLength(i),i) = coeffIndex(epochIndices{i});
-% labels(1:epochLength(i),i) = fitObj.uniqueCovLabels(coeffIndMat(1:epochLength(i),i));
-% end
-
-
-
- if(length(fitNum)>1)
- coeffMat = nan(size(coeffIndMat,1),size(coeffIndMat,2), length(fitNum));
- SEMat = nan(size(coeffIndMat,1),size(coeffIndMat,2), length(fitNum));
- for i=1:length(fitNum)
- for j=1:length(uniqueCoeffs)
- bTemp=fitObj.plotParams.bAct(coeffStrIndex{j},i);
- seTemp=fitObj.plotParams.seAct(coeffStrIndex{j},i);
- coeffMat(j,epochIndices{j},i) = bTemp';
- SEMat(j,epochIndices{j},i) = seTemp';
- end
- end
- else
- coeffMat = nan(size(coeffIndMat,1),size(coeffIndMat,2));
- SEMat = nan(size(coeffIndMat,1),size(coeffIndMat,2));
- for j=1:length(uniqueCoeffs)
- bTemp=fitObj.plotParams.bAct(coeffStrIndex{j},fitNum);
- seTemp = fitObj.plotParams.seAct(coeffStrIndex{j},fitNum);
- coeffMat(j,epochIndices{j}) = bTemp';
- SEMat(j,epochIndices{j}) = seTemp';
- end
-
- end
-
- end
-
- function [histMat, labels, SEMat] = getHistCoeffs(fitObj,fitNum)
- if(nargin<2 || isempty(fitNum))
- fitNum =1:fitObj.numResults;
- end
- sortByEpoch = 0; % Make sure we have different time series if the history is divided into epochs;
- [histIndex, epochId, numEpochs] = fitObj.getHistIndex(fitNum,sortByEpoch);
- epochNums = unique(epochId);
-
-
- histcoeffStrings = fitObj.uniqueCovLabels(histIndex);
- baseStringEndIndex =regexp(histcoeffStrings,'_\{\d*\}','start');
- baseStrings = cell(length(baseStringEndIndex),1);
- for i=1:length(baseStringEndIndex)
- if(~isempty(baseStringEndIndex{i}))
- baseStrings{i} = histcoeffStrings{i}(1:baseStringEndIndex{i}-1);
- else
- baseStrings{i} = histcoeffStrings{i};
- end
- end
- uniqueCoeffs = unique(baseStrings);
-
- for i=1:length(uniqueCoeffs)
- histcoeffStrIndex{i} = histIndex(strcmp(baseStrings,uniqueCoeffs{i}));
- if(min(epochId)==0)
- epochIndices{i} = epochId(strcmp(baseStrings,uniqueCoeffs{i}))+1;
- else
- epochIndices{i} = epochId(strcmp(baseStrings,uniqueCoeffs{i}));
- end
- end
-
-%
-% for i=1:numEpochs
-% epochIndices{i} = find(epochId==epochNums(i));
-% epochLength(i) = length(epochIndices{i});
-% end
-
-
-
- histcoeffIndMat= nan(length(uniqueCoeffs),numEpochs);
- labels = cell(size(histcoeffIndMat));
-% SEMat = nan(length(uniqueCoeffs),numEpochs);
- for i=1:length(uniqueCoeffs)
- histcoeffIndMat(i,epochIndices{i}) = histcoeffStrIndex{i};
- labels(i,epochIndices{i}) = fitObj.uniqueCovLabels(histcoeffStrIndex{i});
-% SEMat(i,epochIndices{i}) = fitObj.se;
- end
-
-
-% for i=1:numEpochs
-% coeffIndMat(1:epochLength(i),i) = coeffIndex(epochIndices{i});
-% labels(1:epochLength(i),i) = fitObj.uniqueCovLabels(coeffIndMat(1:epochLength(i),i));
-% end
-
-
-
- if(length(fitNum)>1)
- histMat = nan(size(histcoeffIndMat,1),size(histcoeffIndMat,2), length(fitNum));
- SEMat = nan(size(histcoeffIndMat,1),size(histcoeffIndMat,2), length(fitNum));
- for i=fitNum
- for j=1:length(uniqueCoeffs)
- bTemp=fitObj.plotParams.bAct(histcoeffStrIndex{j},i);
- seTemp = fitObj.plotParams.seAct(histcoeffStrIndex{j},i);
- histMat(j,epochIndices{j},i) = bTemp';
- SEMat(j,epochIndices{j},i) = seTemp';
- end
- end
- else
- histMat = nan(size(histcoeffIndMat,1),size(histcoeffIndMat,2));
- SEMat = nan(size(histcoeffIndMat,1),size(histcoeffIndMat,2));
- for j=1:length(uniqueCoeffs)
- bTemp=fitObj.plotParams.bAct(histcoeffStrIndex{j},fitNum);
- seTemp=fitObj.plotParams.seAct(histcoeffStrIndex{j},fitNum);
- histMat(j,epochIndices{j}) = bTemp';
- SEMat(j,epochIndices{j}) = seTemp';
- end
-
- end
-
-
-%
-% if(nargin<2 || isempty(fitNum))
-% fitNum =1:fitObj.numResults;
-% end
-% sortByEpoch = 0; % Make sure we have different time series if the history is divided into epochs;
-% [histIndex, epochId, numEpochs] = fitObj.getHistIndex(fitNum,sortByEpoch);
-% epochNums = unique(epochId);
-% for i=1:numEpochs
-% epochIndices{i} = find(epochId==epochNums(i));
-% epochLength(i) = length(epochIndices{i});
-% end
-%
-% histIndMat= nan(max(epochLength),numEpochs);
-% labels = cell(size(histIndMat));
-% for i=1:numEpochs
-% histIndMat(1:epochLength(i),i) = histIndex(epochIndices{i});
-% labels(1:epochLength(i),i) = fitObj.uniqueCovLabels(histIndMat(1:epochLength(i),i));
-% end
-%
-%
-%
-% if(length(fitNum)>1)
-% histMat = nan(size(histIndMat,1),size(histIndMat,2), length(fitNum));
-% for i=1:length(fitNum)
-% for j=1:numEpochs
-% bTemp=fitObj.plotParams.bAct(epochIndices{j},i);
-% histMat(1:epochLength(j),j,i) = bTemp;
-% end
-% end
-% else
-% histMat = nan(size(histIndMat,1),size(histIndMat,2));
-%
-% for j=1:numEpochs
-% bTemp=fitObj.plotParams.bAct(epochIndices{j},fitNum);
-% histMat(1:epochLength(j),j) = bTemp;
-% end
-%
-% end
-
- end
- function h=plotHistCoeffs(fitObj,fitNum,sortByEpoch,plotSignificance)
- if(nargin<4 || isempty(plotSignificance))
- plotSignificance=1;
- end
- if(nargin<3 || isempty(sortByEpoch))
- sortByEpoch=0;
- end
- if(nargin<2 || isempty(fitNum))
- fitNum = 1:fitObj.numResults;
- end
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
- histIndex = fitObj.getHistIndex(fitNum,sortByEpoch);
- h=fitObj.plotCoeffs([],fitNum,[],plotSignificance,histIndex);
- end
-
-
- function h=plotCoeffs(fitObj,handle,fitNum,plotProps,plotSignificance,subIndex)
- % h=plotCoeffs(fitObj,handle,fitNum,plotProps,plotSignificance)
- % plots the GLM coefficients for each fit along with the
- % confidence intervals.
- % fitNum: number of the fit to plot. If not specified, all are
- % plotted.
- % plotProps: properties to use for the making the plot
- % plotSignificance: If 1 then an asterix (*) is place above
- % parameters that are statistically different
- % from zero with alpha=5%.
-
-
- if(nargin<5 || isempty(plotSignificance))
- plotSignificance = 1;
- end
-
- if(nargin<4 || isempty(plotProps))
- plotProps = [];
- end
-
- if(nargin<3 || isempty(fitNum))
- fitNum = 1:fitObj.numResults;
- end
-
- if(nargin<2 || isempty(handle))
- handle=gca;
- end
-
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
-
- if(nargin<6 || isempty(subIndex))
- subIndex = [fitObj.getHistIndex, fitObj.getCoeffIndex];
- end
-
- bAct = fitObj.getPlotParams.bAct(subIndex,fitNum);
- seAct= fitObj.getPlotParams.seAct(subIndex,fitNum);
- sigIndex=fitObj.getPlotParams.sigIndex(subIndex,fitNum);
-
- if(~isempty(plotProps))
- for i=1:length(fitNum)
- h(i)=errorbar(handle,1:length(subIndex),bAct(:,i),seAct(:,i),plotProps{i}); hold on;
- set(h(i), 'LineStyle', 'none', 'Marker', '.');%,...
-% 'Linewidth',1,'Marker','o','MarkerSize',6);
- currColor = get(h(i),'Color');
- set(h(i),'MarkerEdgeColor',currColor,'MarkerFaceColor',currColor);
-% hE= get(h(i),'Children');
-% errorbarXData = get(hE(2),'XData');
-% errorbarXData(4:9:end) = errorbarXData(1:9:end) - 0.2;
-% errorbarXData(7:9:end) = errorbarXData(1:9:end) - 0.2;
-% errorbarXData(5:9:end) = errorbarXData(1:9:end) + 0.2;
-% errorbarXData(8:9:end) = errorbarXData(1:9:end) + 0.2;
-% set(hE(2), 'XData', errorbarXData);
- end
- else
- Xaxis=repmat(1:length(bAct(:,1)),[length(bAct(1,:)) 1]);
- h=errorbar(handle,Xaxis',bAct,seAct,'.');%strcat('.',FitResult.colors{mod(i-1,length(FitResult.colors))+1}));
- set(h, 'LineStyle', 'none', 'Marker', '.');%,...
-
- for n=1:length(h)
- currColor = get(h(n),'Color');
- set(h(n),'MarkerEdgeColor',currColor,'MarkerFaceColor',currColor);
-
- end
- end
-
- hold on;
-
-
- if(plotSignificance==1)
- v=axis;
- vdiff = .8*v(4);
-
- for i=1:length(fitNum)
- plot(handle,find(sigIndex(:,i)==1),vdiff*ones(length(find(sigIndex(:,i)==1)),1)-i*.1,strcat('*',FitResult.colors{mod(i-1,length(FitResult.colors))+1})); hold on;
- end
- end
- ylabel('GLM Fit Coefficients','Interpreter','none');
- xtickLabels = fitObj.getPlotParams.xLabels(subIndex);
- xticks = 1:(length(xtickLabels));
-
- set(handle,'xtick',xticks,'xtickLabel',xtickLabels,'FontSize',6);
-% axis tight;
- if(max(fitObj.numCoeffs)>=1)
- xticklabel_rotate([],90,[],'Fontsize',10);
- end
-% hT=rotateticklabel(gca,-90);
- h_legend=legend(handle,fitObj.lambda.dataLabels(fitNum),'Location','NorthEast');
- set(h_legend,'FontSize',14)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)+.05 pos(2) pos(3:4)]);
-
-% axis tight;
- title({'GLM Coefficients with 95% CIs (* p<0.05)'},'FontWeight','bold',...
- 'FontSize',11,...
- 'FontName','Arial');
- set(gca,'FontName', 'Arial' );
- set(gca, ...
- 'TickLength' , [.02 .02] , ...
- 'YGrid' , 'on' , ...
- 'LineWidth' , 1 );
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-
- end
- function h=plotResults(fitObj)
- % plotResults(fitObj)
- % Generates KS plot, auto-correlation function of the inverse
- % gaussian transformed rescaled ISIs, the sequential
- % correlation coefficient between neigboring pairs of the
- % rescaled ISIs (zj vs. zj-1), the GLM regression coefficients,
- % and the Point Process Residual.
- scrsz = get(0,'ScreenSize');
- h=figure('OuterPosition',[scrsz(3)*.01 scrsz(4)*.04 scrsz(3)*.98 scrsz(4)*.95]);
-
- subplot(2,4,[1 2]); fitObj.KSPlot; %make the plot
- ht=text(.45, .95,strcat('Neuron:',num2str(fitObj.neuronNumber)));
- set(ht,'FontName', 'Arial','FontWeight','bold','FontSize',10);
-
- subplot(2,4,3); fitObj.plotInvGausTrans;
- subplot(2,4,4); fitObj.plotSeqCorr;
- subplot(2,4,[7 8]); fitObj.plotResidual;
- subplot(2,4,[5 6]); fitObj.plotCoeffs;
- end
- function handle = KSPlot(fitObj,fitNum)
- % handle = KSPlot(fitObj)
- % computes the K-S plot for each of the the candidate rate
- % functions in this FitResult object. These candidate rate
- % functions are numbered according to the order in which they
- % were added to the FitResult.
- if(nargin<2)
- fitNum=1:fitObj.numResults;
- end
- h=gcf;
- %h=[];
- figure(h);
- % size(xAxis)
- % size(KSSorted)
- N = length(fitObj.KSStats.KSSorted);
- if(~isempty(fitObj.KSStats.xAxis))
- xaxis = fitObj.KSStats.xAxis(:,1);
- % Plot the CIs
- plot(xaxis,xaxis, 'k-.'); hold on;
- plot(xaxis, xaxis+1.36/sqrt(N), 'r','Linewidth',1);
- plot(xaxis,xaxis-1.36/sqrt(N), 'r','Linewidth',1 );
- handle=plot(fitObj.KSStats.xAxis(:,fitNum),fitObj.KSStats.KSSorted(:,fitNum),'Linewidth',2);
-
- %set(gca,'xtick',[],'ytick',[],'ztick', [])
- axis( [0 1 0 1] );
-% dataLabels = cell(1,fitObj.lambda.dimension);
-% for i=1:fitObj.lambda.dimension
- dataLabels = fitObj.lambda.dataLabels(fitNum);
-% end
- h_legend=legend(handle,dataLabels,'Location','SouthEast');
- set(h_legend,'FontSize',14)
- end
- hx=xlabel('Ideal Uniform CDF');
- hy=ylabel('Empirical CDF');
- title({'KS Plot of Rescaled ISIs'; 'with 95% Confidence Intervals'},'FontWeight','bold','FontSize',11,'FontName','Arial');
- set([hx, hy],'FontName', 'Arial','FontWeight','bold','FontSize',12);
-
- set(gca, ...
- 'TickLength' , [.02 .02] , ...
- 'YTick' , 0:.2:1, ...
- 'XTick' , 0:.2:1, ...
- 'LineWidth' , 1 );
- end
-
- function structure = toStructure(fitObj)
- % structure = toStructure(fitObj)
- % Converts FitResult object to a matlab structure than can then
- % be saved. The structure is compatible with the FitResult
- % static method FitResult.fromStructure(structure) that returns
- % the object corresponding structure passed in.
- fnames = fieldnames(fitObj);
-
- for i=1:length(fnames)
-
- currObj = fitObj.(fnames{i});
- if(strcmp(fnames{i},'histObjects')||strcmp(fnames{i},'ensHistObjects'))
- for j=1:fitObj.numResults
- tempObj = fitObj.(fnames{i}){j};
- if(~isempty(tempObj))
- structure.(fnames{i}){j} = tempObj.toStructure;
- else
- structure.(fnames{i}){j} = tempObj;
- end
- end
- elseif(strcmp(fnames{i},'invGausStats'))
- tempNames = fieldnames(fitObj.(fnames{i}));
- for j=1:length(tempNames)
- tempObj = currObj.(tempNames{j});
- if(~isempty(tempObj))
- structure.(fnames{i}).(tempNames{j})= tempObj.dataToStructure;
- else
- structure.(fnames{i}).(tempNames{j})= tempObj;
- end
-
- end
-
- else
-
- if(isa(currObj,'double')||isa(currObj,'cell'))
- structure.(fnames{i}) = currObj;
- elseif(isa(currObj,'Covariate') ||isa(currObj,'ConfigColl')||isa(currObj,'nspikeTrain'))
- structure.(fnames{i}) = currObj.toStructure;
- elseif(isa(currObj,'SignalObj'))
- structure.(fnames{i}) = currObj.dataToStructure;
- elseif(isa(currObj,'struct'))
- structure.(fnames{i}) = currObj;
- end
- end
- end
-
- end
-
-
- function handle = plotSeqCorr(fitObj)
- % handle = plotSeqCorr(fitObj)
- % plot zj+1 against zj
-
- %colors = {'.b','.g','.r','.c','.m','.y','.k'};
- rho=zeros(1,fitObj.numResults);
- pval=zeros(1,fitObj.numResults);
- dataLabels = fitObj.lambda.dataLabels;
- for i=1:fitObj.numResults
- handle = plot(fitObj.U(1:end-1,i),fitObj.U(2:end,i),strcat('.',Analysis.colors{mod(i-1,length(Analysis.colors))+1})); hold on;
- [rhoTemp,p]= corrcoef(fitObj.U(1:end-1,i),fitObj.U(2:end,i));%handle=scatterhist(fitResults.Z(1:end-1,i),fitResults.Z(2:end,i))
-
- [~,columns]=size(rhoTemp);
- if(columns>1)
- rho(i) = rhoTemp(1,2);
- pval(i)= p(1,2);
- else
- rho(i) = rhoTemp;
- pval(i)= p;
- end
- dataLabels{i} = strcat(dataLabels{i},', \rho=',num2str(rho(i),'%0.2g'),' (p=',num2str(pval(i),'%0.2g'),')');
- %get(h,'AlphaData');
- %set(h,'FaceAlpha',0.2,'EdgeAlpha',0.8,'EdgeColor',color{i});
- end
-
-
- h_legend=legend(dataLabels,'Location','NorthEast');
- set(h_legend,'FontSize',14)
- pos = get(h_legend,'position');
- if(~isempty(pos))
- set(h_legend, 'position',[pos(1)+.05 pos(2) pos(3:4)]);
- end
-
- hy=ylabel('u_{j+1}'); hx=xlabel('u_j');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
- axis([0 1 0 1]);
- title({'Sequential Correlation of'; 'Rescaled ISIs'},'FontWeight','bold',...
- 'FontSize',11,...
- 'FontName','Arial');
-
-
- set(gca, ...
- 'TickLength' , [.02 .02] , ...
- 'YTick' , 0:.25:1, ...
- 'XTick' , 0:.25:1, ...
- 'LineWidth' , 1 );
-
-
-
- end
- function handle = plotInvGausTrans(fitObj)
- % handle = plotInvGausTrans(fitObj)
- % Plots the Auto-correlation function of the X_j's where:
- % Z_j: rescaled ISI from the Time Rescaling Theorem.
- % Exponential Rate 1 under true conditional intensity
- % function.
- % U_j: 1-exp(-Z_j). Uniform on the interval [0,1) if Z_j's
- % are exponential rate 1.
- %
- % X_j: norminv(U_j,0,1). Gaussian mean 0, stdev 1 if U_j's are
- % U([0,1))
- %
-
- %[rows,colm] = size(fitObj.X);
- %index=find(fitObj.invGausStats.lags==1);
- %lags=fitObj.invGausStats.lags;
- [fitObj.X,rhoSig,confBoundSig] = Analysis.computeInvGausTrans(fitObj.Z);
-% rhoSig=fitObj.invGausStats.rhoSig;
- n=length(fitObj.X);
-% confBoundSig = fitObj.invGausStats.confBoundSig;
- handle=[];
-% for i=1:colm
-% %i
-% htemp=plot(lags',rho(:,i),strcat('.',FitResults.colors{mod(i-1,length(Analysis.colors))+1}));
-% handle=[handle,htemp];
-% hold on;
-% %labelArray{i} = ['Fit ' num2str(i)];
-% end
- if(~isempty(rhoSig))
- rhoSig.plot;
- end
- h_legend=legend(fitObj.lambda.dataLabels,'Location','NorthEast');
- set(h_legend,'FontSize',14)
- pos = get(h_legend,'position');
- if(~isempty(pos))
- set(h_legend, 'position',[pos(1)+.05 pos(2) pos(3:4)]);
- end
- %legend(h,labelArray);
- hold on;
- if(~isempty(confBoundSig))
- confBoundSig.plot;
- end
- title({'Autocorrelation Function';'of Rescaled ISIs'; 'with 95% CIs'},'FontWeight','bold',...
- 'FontSize',11,...
- 'FontName','Arial');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- set(gca, ...
- 'TickLength' , [.02 .02] , ...
- 'LineWidth' , 1 );
- v=axis;
- maxY = max(abs(v(3:4)))*(1.1); %add 10%
- axis([v(1:2) -maxY maxY]);
- end
- function handle = plotResidual(fitObj)
- % handle = plotResidual(fitObj)
- % Plots the Point Process Residual
- handle=fitObj.Residual.plot;
- legend off;
- h_legend=legend(fitObj.lambda.dataLabels,'Location','NorthEast');
- set(h_legend,'FontSize',14)
- pos = get(h_legend,'position');
-% set(h_legend, 'position',[.91 .41 pos(3:4)]);
- set(h_legend, 'position',[pos(1)+.05 pos(2) pos(3:4)]);
- title('Point Process Residual','FontWeight','bold',...
- 'FontSize',11,...
- 'FontName','Arial');
- xlabel('time [s]','Interpreter','none');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- v=axis;
- maxY = max(abs(v(3:4)))*(1.1); %add 10%
- axis([v(1:2) -maxY maxY]);
- end
-
-
- function setKSStats(fitObj, Z, U, xAxis, KSSorted, ks_stat)
- % setKSStats(fitObj, Z, xAxis, KSSorted, ks_stat)
- % Allows KS statistics to be set after object creation
- % Z: Rescaled ISIs from the Time Rescaling Theorem
- % xAxis: xAxis of the KS plot
- % KSSorted: the sorted values of Uj=1-exp(-zj)
- % ks_stat: the maximum deviation from the 45 degree line for
- % all of the fits.
- %
- fitObj.Z =Z;
- fitObj.U =U;
- fitObj.KSStats.xAxis =xAxis;
- fitObj.KSStats.KSSorted =KSSorted;
-
-
- for i=1:size(xAxis,2);
- [differentDists(i),pVal(i),ks_stat(i)]=kstest2(fitObj.KSStats.xAxis(:,i) ,fitObj.KSStats.KSSorted(:,i));
- end
- if(~exist('differentDists'))
- differentDists=1;
- end
- if(~exist('pVal'))
- pVal=1;
- end
-
- fitObj.KSStats.ks_stat =ks_stat;
-% N = length(fitObj.KSStats.KSSorted);
-% fitObj.KSStats.withinConfInt = ks_stat<1.36/sqrt(N);
- fitObj.KSStats.withinConfInt = ~differentDists;
- fitObj.KSStats.pValue = pVal;
- end
- function setInvGausStats(fitObj, X,rhoSig,confBoundSig)
- % setInvGausStats(fitObj,X,rhoSig,confBoundSig)
- % Sets the inverse gaussian transformed rescaled ISIs and the
- % confidence bounds after the object has been created.
- %fitObj.U=U;
- fitObj.X=X;
- fitObj.invGausStats.rhoSig=rhoSig;
- fitObj.invGausStats.confBoundSig=confBoundSig;
- end
- function setFitResidual(fitObj,M)
- % setFitResidual(fitObj,M).
- % Adds the point process residual to the FitResult object
- fitObj.Residual = M;
- end
-
- function [paramVals, paramSE, paramSigIndex] = getParam(fitObj,paramNames,fitNum)
- % output is a matrix of length equal to the total number of
- % paramNames
- % and one column for each fit
-
- if(nargin<3)
- fitNum = 1:fitObj.numResults;
- end
- if(isempty(fitObj.plotParams))
- fitObj.computePlotParams;
- end
- paramVals = zeros(length(paramNames),length(fitNum));
-
- if(nargout>1)
- paramSE = zeros(length(paramNames),length(fitNum));
- end
-
- if(nargout>2)
- paramSigIndex = zeros(length(paramNames),length(fitNum));
- end
-
- for i=1:length(paramNames)
- paramIndex=find(strcmp(paramNames(i),fitObj.uniqueCovLabels));
- paramVals(i,:) = fitObj.plotParams.bAct(paramIndex,fitNum);
- if(nargout>1)
- paramSE(i,:) = fitObj.plotParams.seAct(paramIndex,fitNum);
- end
- if(nargout>2)
- paramSigIndex(i,:) = fitObj.plotParams.sigIndex(paramIndex,fitNum);
- end
- end
-
- end
-
-
- end
-
- methods (Static)
-
- function fitObj = fromStructure(structure)
- % fitObj = fromStructure(structure)
- % Returns a FitResult object from the input structure.
- % This is used to be able to save and restore FitResult
- if(isa(structure,'struct'))
- if(isa(structure.neuralSpikeTrain,'cell'))
- spikeObj = cell(1,length(structure.neuralSpikeTrain));
- for k=1:length(structure.neuralSpikeTrain)
- spikeObj{k} = nspikeTrain.fromStructure(structure.neuralSpikeTrain{k});
-
- end
- else
- spikeObj=nspikeTrain.fromStructure(structure.neuralSpikeTrain);
- end
- lambda=Covariate.fromStructure(structure.lambda);
- rhoSig=SignalObj.signalFromStruct(structure.invGausStats.rhoSig);
- confBoundSig = SignalObj.signalFromStruct(structure.invGausStats.confBoundSig);
- M = Covariate.fromStructure(structure.Residual);
- for i=1:structure.numResults
- histObjects{i} = History.fromStructure(structure.histObjects{i});
- ensHistObject{i} = History.fromStructure(structure.ensHistObjects{i});
- end
- configColl = ConfigColl.fromStructure(structure.configs);
- fitObj=FitResult(spikeObj,structure.covLabels,structure.numHist,histObjects,ensHistObject,lambda,structure.b, structure.dev, structure.stats,structure.AIC,structure.BIC,configColl,structure.XvalData,structure.XvalTime,structure.fitType);
- fitObj.setKSStats(structure.Z,structure.U, structure.KSStats.xAxis, structure.KSStats.KSSorted, structure.KSStats.ks_stat);
- fitObj.setInvGausStats(structure.X,rhoSig,confBoundSig);
- fitObj.setFitResidual(M);
- fitObj.setNeuronName(structure.neuronNumber);
-
- elseif(isa(structure,'cell')) %cell array of FitResult objects
- fitObj = cell(size(structure));
- for i=1:length(structure)
- fitObj{i} = FitResult.fromStructure(structure{i});
- end
- end
-
- end
-
- function structCell = CellArrayToStructure(fitResObjCell)
- % structCell = CellArrayToStructure(fitResObjCell)
- % For every FitResult structure in the a cell array, it calls
- % FitResults.fromStructure
-
- if(isa(fitResObjCell,'FitResult'))
- structCell = fitResObjCell.toStructure;
- elseif(isa(fitResObjCell,'cell')&&~isempty(fitResObjCell))
- if(isa(fitResObjCell{1},'FitResult'))
- structCell = cell(size(fitResObjCell));
- for i=1:length(fitResObjCell)
- structCell{i} = fitResObjCell{i}.toStructure;
- end
- end
- else
- structCell={};
- end
-
- end
-
- end
-
-end
-
-%Helper functions
-function hText = xticklabel_rotate(XTick,rot,varargin)
- %hText = xticklabel_rotate(XTick,rot,XTickLabel,varargin) Rotate XTickLabel
- %
- % Syntax: xticklabel_rotate
- %
- % Input:
- % {opt} XTick - vector array of XTick positions & values (numeric)
- % uses current XTick values or XTickLabel cell array by
- % default (if empty)
- % {opt} rot - angle of rotation in degrees, 90° by default
- % {opt} XTickLabel - cell array of label strings
- % {opt} [var] - "Property-value" pairs passed to text generator
- % ex: 'interpreter','none'
- % 'Color','m','Fontweight','bold'
- %
- % Output: hText - handle vector to text labels
- %
- % Example 1: Rotate existing XTickLabels at their current position by 90°
- % xticklabel_rotate
- %
- % Example 2: Rotate existing XTickLabels at their current position by 45° and change
- % font size
- % xticklabel_rotate([],45,[],'Fontsize',14)
- %
- % Example 3: Set the positions of the XTicks and rotate them 90°
- % figure; plot([1960:2004],randn(45,1)); xlim([1960 2004]);
- % xticklabel_rotate([1960:2:2004]);
- %
- % Example 4: Use text labels at XTick positions rotated 45° without tex interpreter
- % xticklabel_rotate(XTick,45,NameFields,'interpreter','none');
- %
- % Example 5: Use text labels rotated 90° at current positions
- % xticklabel_rotate([],90,NameFields);
- %
- % Note : you can not re-run xticklabel_rotate on the same graph.
- %
- %
-
-
- % This is a modified version of xticklabel_rotate90 by Denis Gilbert
- % Modifications include Text labels (in the form of cell array)
- % Arbitrary angle rotation
- % Output of text handles
- % Resizing of axes and title/xlabel/ylabel positions to maintain same overall size
- % and keep text on plot
- % (handles small window resizing after, but not well due to proportional placement with
- % fixed font size. To fix this would require a serious resize function)
- % Uses current XTick by default
- % Uses current XTickLabel is different from XTick values (meaning has been already defined)
-
- % Brian FG Katz
- % bfgkatz@hotmail.com
- % 23-05-03
- % Modified 03-11-06 after user comment
- % Allow for exisiting XTickLabel cell array
-
- % Other m-files required: cell2mat
- % Subfunctions: none
- % MAT-files required: none
- %
- % See also: xticklabel_rotate90, TEXT, SET
-
- % Based on xticklabel_rotate90
- % Author: Denis Gilbert, Ph.D., physical oceanography
- % Maurice Lamontagne Institute, Dept. of Fisheries and Oceans Canada
- % email: gilbertd@dfo-mpo.gc.ca Web: http://www.qc.dfo-mpo.gc.ca/iml/
- % February 1998; Last revision: 24-Mar-2003
-
- % check to see if xticklabel_rotate has already been here (no other reason for this to happen)
- if isempty(get(gca,'XTickLabel')),
- error('xticklabel_rotate : can not process, either xticklabel_rotate has already been run or XTickLabel field has been erased') ;
- end
-
- % if no XTickLabel AND no XTick are defined use the current XTickLabel
- %if nargin < 3 & (~exist('XTick') | isempty(XTick)),
- if (nargin < 3 || isempty(varargin{1})) && (~exist('XTick') || isempty(XTick)),
- xTickLabels = get(gca,'XTickLabel') ; % use current XTickLabel
- if ~iscell(xTickLabels)
- % remove trailing spaces if exist (typical with auto generated XTickLabel)
- temp1 = num2cell(xTickLabels,2) ;
- for loop = 1:length(temp1),
- temp1{loop} = deblank(temp1{loop}) ;
- end
- xTickLabels = temp1 ;
- end
- varargin = varargin(2:length(varargin));
- end
-
- % if no XTick is defined use the current XTick
- if (~exist('XTick') | isempty(XTick)),
- XTick = get(gca,'XTick') ; % use current XTick
- end
-
- %Make XTick a column vector
- XTick = XTick(:);
-
- if ~exist('xTickLabels'),
- % Define the xtickLabels
- % If XtickLabel is passed as a cell array then use the text
- if (length(varargin)>0) & (iscell(varargin{1})),
- xTickLabels = varargin{1};
- varargin = varargin(2:length(varargin));
- else
- xTickLabels = num2str(XTick);
- end
- end
-
- if length(XTick) ~= length(xTickLabels),
- error('xticklabel_rotate : must have same number of elements in "XTick" and "XTickLabel"') ;
- end
-
- %Set the Xtick locations and set XTicklabel to an empty string
- set(gca,'XTick',XTick,'XTickLabel','')
-
- if nargin < 2,
- rot = 90 ;
- end
-
- % Determine the location of the labels based on the position
- % of the xlabel
- hxLabel = get(gca,'XLabel'); % Handle to xlabel
- xLabelString = get(hxLabel,'String');
-
- % if ~isempty(xLabelString)
- % warning('You may need to manually reset the XLABEL vertical position')
- % end
-
- set(hxLabel,'Units','data');
- xLabelPosition = get(hxLabel,'Position');
- y = xLabelPosition(2);
-
- %CODE below was modified following suggestions from Urs Schwarz
- y=repmat(y,size(XTick,1),1);
- % retrieve current axis' fontsize
- fs = get(gca,'fontsize');
-
- % Place the new xTickLabels by creating TEXT objects
- hText = text(XTick, y, xTickLabels,'fontsize',fs);
-
- % Rotate the text objects by ROT degrees
- set(hText,'Rotation',rot,'HorizontalAlignment','right',varargin{:})
-
- % Adjust the size of the axis to accomodate for longest label (like if they are text ones)
- % This approach keeps the top of the graph at the same place and tries to keep xlabel at the same place
- % This approach keeps the right side of the graph at the same place
-
- set(get(gca,'xlabel'),'units','data') ;
- labxorigpos_data = get(get(gca,'xlabel'),'position') ;
- set(get(gca,'ylabel'),'units','data') ;
- labyorigpos_data = get(get(gca,'ylabel'),'position') ;
- set(get(gca,'title'),'units','data') ;
- labtorigpos_data = get(get(gca,'title'),'position') ;
-
- set(gca,'units','pixel') ;
- set(hText,'units','pixel') ;
- set(get(gca,'xlabel'),'units','pixel') ;
- set(get(gca,'ylabel'),'units','pixel') ;
-
- origpos = get(gca,'position') ;
-
- % Modified by Iahn Cajigas
- % 3/4/2011 to allow for a single
- % xTickLabel to work properly
- temphText = get(hText,'extent');
- if(isa(temphText,'cell'))
- textsizes = cell2mat(temphText) ;
- else
- textsizes = temphText;
- end
-
- longest = max(textsizes(:,4)) ;
-
- laborigext = get(get(gca,'xlabel'),'extent') ;
- laborigpos = get(get(gca,'xlabel'),'position') ;
-
-
- labyorigext = get(get(gca,'ylabel'),'extent') ;
- labyorigpos = get(get(gca,'ylabel'),'position') ;
- leftlabdist = labyorigpos(1) + labyorigext(1) ;
-
- % assume first entry is the farthest left
- leftpos = get(hText(1),'position') ;
- leftext = get(hText(1),'extent') ;
- leftdist = leftpos(1) + leftext(1) ;
- if leftdist > 0, leftdist = 0 ; end % only correct for off screen problems
-
- botdist = origpos(2) + laborigpos(2) ;
- newpos = [origpos(1)-leftdist longest+botdist origpos(3)+leftdist origpos(4)-longest+origpos(2)-botdist] ;
- set(gca,'position',newpos) ;
-
- % readjust position of nex labels after resize of plot
- set(hText,'units','data') ;
- for loop= 1:length(hText),
- set(hText(loop),'position',[XTick(loop), y(loop)]) ;
- end
-
-
- % adjust position of xlabel and ylabel
- laborigpos = get(get(gca,'xlabel'),'position') ;
- set(get(gca,'xlabel'),'position',[laborigpos(1) laborigpos(2)-longest 0]) ;
-
- % switch to data coord and fix it all
- set(get(gca,'ylabel'),'units','data') ;
- set(get(gca,'ylabel'),'position',labyorigpos_data) ;
- set(get(gca,'title'),'position',labtorigpos_data) ;
-
- set(get(gca,'xlabel'),'units','data') ;
- labxorigpos_data_new = get(get(gca,'xlabel'),'position') ;
- set(get(gca,'xlabel'),'position',[labxorigpos_data(1) labxorigpos_data_new(2)]) ;
-
-
- % Reset all units to normalized to allow future resizing
- set(get(gca,'xlabel'),'units','normalized') ;
- set(get(gca,'ylabel'),'units','normalized') ;
- set(get(gca,'title'),'units','normalized') ;
- set(hText,'units','normalized') ;
- set(gca,'units','normalized') ;
-
- if nargout < 1,
- clear hText
- end
-
-end
-function [uniqueLabels, indexIntoOriginal, restoreIndex] = getUniqueLabels(covLabels)
-% Given a set of covLabels, returns a subset of labels that are unique
- offset = 0;
- for i=1:length(covLabels)
- currLabels = covLabels{i};
- allLabels((1:length(currLabels))+offset) = currLabels;
- offset=length(allLabels);
- end
- [uniqueLabels, indexIntoOriginal, restoreIndex] = unique(allLabels);
-end
-
-
-
\ No newline at end of file
diff --git a/helpfiles/FitResultExamples.html b/helpfiles/FitResultExamples.html
deleted file mode 100644
index 4b9728b9..00000000
--- a/helpfiles/FitResultExamples.html
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
-
-
-
- FitResult Examples
-
-
-
-
-
-
FitResult Examples
-
- Published with MATLAB® 7.8
-
-
-
-
\ No newline at end of file
diff --git a/helpfiles/FitResultExamples.m b/helpfiles/FitResultExamples.m
deleted file mode 100644
index 5b4ca64c..00000000
--- a/helpfiles/FitResultExamples.m
+++ /dev/null
@@ -1 +0,0 @@
-%% FitResult Examples
diff --git a/helpfiles/HippocampalPlaceCellExample.asv b/helpfiles/HippocampalPlaceCellExample.asv
deleted file mode 100644
index b8bae1d4..00000000
--- a/helpfiles/HippocampalPlaceCellExample.asv
+++ /dev/null
@@ -1,293 +0,0 @@
-%% HIPPOCAMPAL PLACE CELL - RECEPTIVE FIELD ESTIMATION
-% Estimation of receptive fields of neurons is a very common data analysis problem in neuroscience.
-% Here we use the nSTAT software to perform an estimation of the receptive fields of hippocampal
-% place cells using a bivariate Gaussian model and Zernike polynomials. The number of zernike polynomials
-% is based on "An Analysis of Hippocampal Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
-% Spike Train Decoding" Barbieri et. al 2005. The data used herein in was
-% provided by Dr. Ricardo Barbieri on 2/28/2011.
-%
-% *Author*: Iahn Cajigas
-%
-% *Date*: 3/1/2011
-%%
-close all
-
-%% Example Data
-% The x and y coordinates of a freely foraging rat in a circular environment (70cm in diameter and 30cm high walls) and a fixed visual cue.
-% The x and y coordinates at the time when a spike was observed are marked
-% in red. The position coordinates have been normalized to be between -1
-% and 1 to allow to simplify the analysis.
- load(strcat('PlaceCellDataAnimal1.mat'));
- exampleCell = 25;
- figure(1);
- plot(x,y,'b',neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- xlabel('x'); ylabel('y');
- title(['Animal#1, Cell#' num2str(exampleCell)]);
-
- %% Analyze All Cells
- numAnimals =2;
-for n=1:numAnimals
- % load the data
- clear x y neuron time nst tc tcc z;
- load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
-
- % Create the spikeTrains for each cell
- for i=1:length(neuron)
- nst{i} = nspikeTrain(neuron{i}.spikeTimes);
- end
-
-
- % Convert to polar coordinates
- [theta,r] = cart2pol(x,y);
-
-
- % Evaluate the Zernike Polynomials
- % Number of polynomials from "An Analysis of Hippocampal
- % Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
- % Spike Train Decoding" Barbieri et. al 2005
- cnt=0;
- for l=0:3
- for m=-l:l
- if(~any(mod(l-m,2))) % otherwise the polynomial = 0
- cnt = cnt+1;
- z(:,cnt) = zernfun(l,m,r,theta,'norm');
- % zernfun by Paul Fricker
- % http://www.mathworks.com/matlabcentral/fileexchange/7687
- end
- end
- end
-
- % Data sampled at 30 Hz but just to be sure
- delta=min(diff(time));
- sampleRate = round(1/delta);
-
- % Define Covariates for the analysis
- baseline = Covariate(time,ones(length(x),1),'Baseline','time','s','',...
- {'mu'});
- zernike = Covariate(time,z,'Zernike','time','s','m',{'z1','z2','z3',...
- 'z4','z5','z6','z7','z8','z9','z10'});
- gaussian = Covariate(time,[x y x.^2 y.^2 x.*y],'Gaussian','time',...
- 's','m',{'x','y','x^2','y^2','x*y'});
- covarColl = CovColl({baseline,gaussian,zernike});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
-
- % Define how we want to analyze the data
- tc{1} = TrialConfig({{'Baseline','mu'},{'Gaussian',...
- 'x','y','x^2','y^2','x*y'}},sampleRate,[]);
- tc{1}.setName('Gaussian');
- tc{2} = TrialConfig({{'Zernike' 'z1','z2','z3','z4','z5','z6',...
- 'z7','z8','z9','z10'}},sampleRate,[]);
- tc{2}.setName('Zernike');
- tcc = ConfigColl(tc);
-
- % Perform Analysis (Commented to since data already saved)
-% results =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
-
- % Save results
-% resStruct =FitResult.CellArrayToStructure(results);
-% filename = ['PlaceCellAnimal' num2str(n) 'Results'];
-% save(filename,'resStruct');
-end
-
-%% View Summary Statistics
-% Note the Zernike Polynomials yield better fits in terms of decreased KS
-% Statistics (less deviation from the 45 degree line), reduced AIC and
-% reduced BIC across the majority of cells and for both animals
-for n=1:numAnimals
- resData=load(strcat('PlaceCellAnimal',num2str(n),'Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
- Summary = FitResSummary(results);
- Summary.plotSummary;
-end
-
-%% Visualize the results
-
-% Define a grid
-[x_new,y_new]=meshgrid(-1:.01:1); %define new x and y
-y_new = flipud(y_new); x_new = fliplr(x_new);
-[theta_new,r_new] = cart2pol(x_new,y_new);
-
-%Data for the gaussian fit
-newData{1} =ones(size(x_new));
-newData{2} =x_new; newData{3} =y_new;
-newData{4} =x_new.^2; newData{5} =y_new.^2;
-newData{6} =x_new.*y_new;
-
-
-% Zernike polynomials only defined on the unit disk
-idx = r_new<=1;
-zpoly = cell(1,10);
-cnt=0;
-for l=0:3
- for m=-l:l
- if(~any(mod(l-m,2)))
- cnt = cnt+1;
- temp = nan(size(x_new));
- temp(idx) = zernfun(l,m,r_new(idx),theta_new(idx),'norm');
- zpoly{cnt} = temp;
- end
- end
-end
-
-
-
-for n=1:numAnimals
-
- clear lambdaGaussian lambdaZernike;
- load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
- resData=load(strcat('PlaceCellAnimal',num2str(n),'Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
-
- for i=1:length(neuron)
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
-
-
-
-
- % Plot the receptive fields
- for i=1:length(neuron)
- % 3d plot of an example place field
-
-
- % 2d plot of all the cell's fields
- if(n==1)
- h4=figure(4);
- if(i==1)
- annotation(h4,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Gaussian Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
- end
- subplot(7,7,i);
- elseif(n==2)
- h6=figure(6);
- if(i==1)
- annotation(h6,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Gaussian Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
- end
- subplot(6,7,i);
- end
- pcolor(x_new,y_new,lambdaGaussian{i}), shading interp
- axis square; set(gca,'xtick',[],'ytick',[]);
-
-
- if(n==1)
- h5=figure(5);
- if(i==1)
- annotation(h5,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Zernike Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
-
- end
- subplot(7,7,i);
- elseif(n==2)
- h7=figure(7);
- if(i==1)
- annotation(h7,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Zernike Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
- end
- subplot(6,7,i);
- end
- pcolor(x_new,y_new,lambdaZernike{i}), shading interp
- axis square;
- set(gca,'xtick',[],'ytick',[]);
- end
-
-
-
-
-end
-
-
-
- clear lambdaGaussian lambdaZernike;
- load(strcat('PlaceCellDataAnimal1.mat'));
- resData=load(strcat('PlaceCellAnimal1Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
-
- for i=1:length(neuron)
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
-
-
-
- exampleCell = 25;
- figure(8);
- plot(x,y,'b',neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- xlabel('x'); ylabel('y');
- title(['Animal#1, Cell#' num2str(exampleCell)]);
-
- figure(9);
- h_mesh = mesh(x_new,y_new,lambdaGaussian{exampleCell},'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.2,'EdgeColor','b');
- hold on;
- h_mesh = mesh(x_new,y_new,lambdaZernike{exampleCell},'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.2,'EdgeColor','g');
-
- legend(results{exampleCell}.lambda.dataLabels);
- plot(x,y,neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- axis tight square;
- xlabel('x position'); ylabel('y position');
- title(['Animal#1, Cell#' num2str(exampleCell)]);
- %%
-
-
-
-% clear x y neuron time nst tc tcc z lambdaCIF;
-% n=1;
-% load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
-%
-% % Create the spikeTrains for each cell
-% for i=1:length(neuron)
-% nst{i} = nspikeTrain(neuron{i}.spikeTimes);
-% end
-%
-%
-% spikeColl = nstColl(nst);
-% spikeColl.resample(1/delta);
-% dN = spikeColl.dataToMatrix;
-%
-% for i=1:length(results)
-%
-% lambdaCIF{i} = CIF(results{i}.b{1}',{'1','x','y','x^2','y^2','x*y'},{'x','y'},'binomial');
-%
-% end
-%
-% figure;
-% % for i=1:length(lambda)
-% % lambda{i}.plot;
-% % end
-%
-%
-% index1=1000;
-% dN2 = dN(1:index1,:);
-% vx=var(x(2:index1)-x(1:index1-1));
-% vy=var(y(2:index1)-y(1:index1-1));
-% Q=[vx 0;0 vy]*10;
-% Px0=.1*eye(2,2); A=1*eye(2,2);
-% [x_p, Pe_p, x_u, Pe_u] = CIF.PPDecodeFilter(A, Q, Px0, dN2',lambdaCIF);
-% figure;
-% plot(x_p(1,1:end-1),x_p(2,1:end-1),'b',x(1:index1),y(1:index1),'k')
-
-
-
diff --git a/helpfiles/HippocampalPlaceCellExample.html b/helpfiles/HippocampalPlaceCellExample.html
deleted file mode 100644
index ab1f4ff7..00000000
--- a/helpfiles/HippocampalPlaceCellExample.html
+++ /dev/null
@@ -1,550 +0,0 @@
-
-
-
-
- HIPPOCAMPAL PLACE CELL - RECEPTIVE FIELD ESTIMATION
HIPPOCAMPAL PLACE CELL - RECEPTIVE FIELD ESTIMATION
Estimation of receptive fields of neurons is a very common data analysis problem in neuroscience. Here we use the nSTAT software to perform an estimation of the receptive fields of hippocampal place cells using a bivariate Gaussian model and Zernike polynomials. The number of zernike polynomials is based on "An Analysis of Hippocampal Spatio-Temporal Representations Using a Bayesian Algorithm for Neural Spike Train Decoding" Barbieri et. al 2005. The data used herein in was provided by Dr. Ricardo Barbieri on 2/28/2011.
The x and y coordinates of a freely foraging rat in a circular environment (70cm in diameter and 30cm high walls) and a fixed visual cue. The x and y coordinates at the time when a spike was observed are marked in red. The position coordinates have been normalized to be between -1 and 1 to allow to simplify the analysis.
numAnimals =2;
-for n=1:numAnimals
- % load the data
- clear xyneurontimensttctccz;
- load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
-
- % Create the spikeTrains for each cell
- for i=1:length(neuron)
- nst{i} = nspikeTrain(neuron{i}.spikeTimes);
- end
-
-
- % Convert to polar coordinates
- [theta,r] = cart2pol(x,y);
-
-
- % Evaluate the Zernike Polynomials
- % Number of polynomials from "An Analysis of Hippocampal
- % Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
- % Spike Train Decoding" Barbieri et. al 2005
- cnt=0;
- for l=0:3
- for m=-l:l
- if(~any(mod(l-m,2))) % otherwise the polynomial = 0
- cnt = cnt+1;
- z(:,cnt) = zernfun(l,m,r,theta,'norm');
- % zernfun by Paul Fricker
- % http://www.mathworks.com/matlabcentral/fileexchange/7687
- end
- end
- end
-
- % Data sampled at 30 Hz but just to be sure
- delta=min(diff(time));
- sampleRate = round(1/delta);
-
- % Define Covariates for the analysis
- baseline = Covariate(time,ones(length(x),1),'Baseline','time','s','',...
- {'mu'});
- zernike = Covariate(time,z,'Zernike','time','s','m',{'z1','z2','z3',...
- 'z4','z5','z6','z7','z8','z9','z10'});
- gaussian = Covariate(time,[x y x.^2 y.^2 x.*y],'Gaussian','time',...
- 's','m',{'x','y','x^2','y^2','x*y'});
- covarColl = CovColl({baseline,gaussian,zernike});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
-
- % Define how we want to analyze the data
- tc{1} = TrialConfig({{'Baseline','mu'},{'Gaussian',...
- 'x','y','x^2','y^2','x*y'}},sampleRate,[]);
- tc{1}.setName('Gaussian');
- tc{2} = TrialConfig({{'Zernike''z1','z2','z3','z4','z5','z6',...
- 'z7','z8','z9','z10'}},sampleRate,[]);
- tc{2}.setName('Zernike');
- tcc = ConfigColl(tc);
-
- % Perform Analysis (Commented to since data already saved)
-% results =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
-
- % Save results
-% resStruct =FitResult.CellArrayToStructure(results);
-% filename = ['PlaceCellAnimal' num2str(n) 'Results'];
-% save(filename,'resStruct');
-end
-
View Summary Statistics
Note the Zernike Polynomials yield better fits in terms of decreased KS Statistics (less deviation from the 45 degree line), reduced AIC and reduced BIC across the majority of cells and for both animals
\ No newline at end of file
diff --git a/helpfiles/HippocampalPlaceCellExample.m b/helpfiles/HippocampalPlaceCellExample.m
deleted file mode 100644
index 91fd04a9..00000000
--- a/helpfiles/HippocampalPlaceCellExample.m
+++ /dev/null
@@ -1,255 +0,0 @@
-%% HIPPOCAMPAL PLACE CELL - RECEPTIVE FIELD ESTIMATION
-% Estimation of receptive fields of neurons is a very common data analysis problem in neuroscience.
-% Here we use the nSTAT software to perform an estimation of the receptive fields of hippocampal
-% place cells using a bivariate Gaussian model and Zernike polynomials. The number of zernike polynomials
-% is based on "An Analysis of Hippocampal Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
-% Spike Train Decoding" Barbieri et. al 2005. The data used herein in was
-% provided by Dr. Ricardo Barbieri on 2/28/2011.
-%
-% *Author*: Iahn Cajigas
-%
-% *Date*: 3/1/2011
-%%
-close all
-
-%% Example Data
-% The x and y coordinates of a freely foraging rat in a circular environment (70cm in diameter and 30cm high walls) and a fixed visual cue.
-% The x and y coordinates at the time when a spike was observed are marked
-% in red. The position coordinates have been normalized to be between -1
-% and 1 to allow to simplify the analysis.
- load(strcat('PlaceCellDataAnimal1.mat'));
- exampleCell = 25;
- figure(1);
- plot(x,y,'b',neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- xlabel('x'); ylabel('y');
- title(['Animal#1, Cell#' num2str(exampleCell)]);
-
- %% Analyze All Cells
- numAnimals =2;
-for n=1:numAnimals
- % load the data
- clear x y neuron time nst tc tcc z;
- load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
-
- % Create the spikeTrains for each cell
- for i=1:length(neuron)
- nst{i} = nspikeTrain(neuron{i}.spikeTimes);
- end
-
-
- % Convert to polar coordinates
- [theta,r] = cart2pol(x,y);
-
-
- % Evaluate the Zernike Polynomials
- % Number of polynomials from "An Analysis of Hippocampal
- % Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
- % Spike Train Decoding" Barbieri et. al 2005
- cnt=0;
- for l=0:3
- for m=-l:l
- if(~any(mod(l-m,2))) % otherwise the polynomial = 0
- cnt = cnt+1;
- z(:,cnt) = zernfun(l,m,r,theta,'norm');
- % zernfun by Paul Fricker
- % http://www.mathworks.com/matlabcentral/fileexchange/7687
- end
- end
- end
-
- % Data sampled at 30 Hz but just to be sure
- delta=min(diff(time));
- sampleRate = round(1/delta);
-
- % Define Covariates for the analysis
- baseline = Covariate(time,ones(length(x),1),'Baseline','time','s','',...
- {'mu'});
- zernike = Covariate(time,z,'Zernike','time','s','m',{'z1','z2','z3',...
- 'z4','z5','z6','z7','z8','z9','z10'});
- gaussian = Covariate(time,[x y x.^2 y.^2 x.*y],'Gaussian','time',...
- 's','m',{'x','y','x^2','y^2','x*y'});
- covarColl = CovColl({baseline,gaussian,zernike});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
-
- % Define how we want to analyze the data
- tc{1} = TrialConfig({{'Baseline','mu'},{'Gaussian',...
- 'x','y','x^2','y^2','x*y'}},sampleRate,[]);
- tc{1}.setName('Gaussian');
- tc{2} = TrialConfig({{'Zernike' 'z1','z2','z3','z4','z5','z6',...
- 'z7','z8','z9','z10'}},sampleRate,[]);
- tc{2}.setName('Zernike');
- tcc = ConfigColl(tc);
-
- % Perform Analysis (Commented to since data already saved)
-% results =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
-
- % Save results
-% resStruct =FitResult.CellArrayToStructure(results);
-% filename = ['PlaceCellAnimal' num2str(n) 'Results'];
-% save(filename,'resStruct');
-end
-
-%% View Summary Statistics
-% Note the Zernike Polynomials yield better fits in terms of decreased KS
-% Statistics (less deviation from the 45 degree line), reduced AIC and
-% reduced BIC across the majority of cells and for both animals
-for n=1:numAnimals
- resData=load(strcat('PlaceCellAnimal',num2str(n),'Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
- Summary = FitResSummary(results);
- Summary.plotSummary;
-end
-
-%% Visualize the results
-
-% Define a grid
-[x_new,y_new]=meshgrid(-1:.01:1); %define new x and y
-y_new = flipud(y_new); x_new = fliplr(x_new);
-[theta_new,r_new] = cart2pol(x_new,y_new);
-
-%Data for the gaussian fit
-newData{1} =ones(size(x_new));
-newData{2} =x_new; newData{3} =y_new;
-newData{4} =x_new.^2; newData{5} =y_new.^2;
-newData{6} =x_new.*y_new;
-
-
-% Zernike polynomials only defined on the unit disk
-idx = r_new<=1;
-zpoly = cell(1,10);
-cnt=0;
-for l=0:3
- for m=-l:l
- if(~any(mod(l-m,2)))
- cnt = cnt+1;
- temp = nan(size(x_new));
- temp(idx) = zernfun(l,m,r_new(idx),theta_new(idx),'norm');
- zpoly{cnt} = temp;
- end
- end
-end
-
-
-
-for n=1:numAnimals
-
- clear lambdaGaussian lambdaZernike;
- load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
- resData=load(strcat('PlaceCellAnimal',num2str(n),'Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
-
- for i=1:length(neuron)
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
-
-
-
-
- % Plot the receptive fields
- for i=1:length(neuron)
- % 3d plot of an example place field
-
-
- % 2d plot of all the cell's fields
- if(n==1)
- h4=figure(4);
- if(i==1)
- annotation(h4,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Gaussian Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
- end
- subplot(7,7,i);
- elseif(n==2)
- h6=figure(6);
- if(i==1)
- annotation(h6,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Gaussian Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
- end
- subplot(6,7,i);
- end
- pcolor(x_new,y_new,lambdaGaussian{i}), shading interp
- axis square; set(gca,'xtick',[],'ytick',[]);
-
-
- if(n==1)
- h5=figure(5);
- if(i==1)
- annotation(h5,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Zernike Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
-
- end
- subplot(7,7,i);
- elseif(n==2)
- h7=figure(7);
- if(i==1)
- annotation(h7,'textbox',...
- [0.343261904761904 0.928571428571418 ...
- 0.392857142857143 0.0595238095238095],...
- 'String',{['Zernike Place Fields - Animal#' ...
- num2str(n)]},'FitBoxToText','on'); hold on;
- end
- subplot(6,7,i);
- end
- pcolor(x_new,y_new,lambdaZernike{i}), shading interp
- axis square;
- set(gca,'xtick',[],'ytick',[]);
- end
-
-
-
-
-end
-
-
-
- clear lambdaGaussian lambdaZernike;
- load(strcat('PlaceCellDataAnimal1.mat'));
- resData=load(strcat('PlaceCellAnimal1Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
-
- for i=1:length(neuron)
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
-
-
-
- exampleCell = 25;
- figure(8);
- plot(x,y,'b',neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- xlabel('x'); ylabel('y');
- title(['Animal#1, Cell#' num2str(exampleCell)]);
-
- figure(9);
- h_mesh = mesh(x_new,y_new,lambdaGaussian{exampleCell},'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.2,'EdgeColor','b');
- hold on;
- h_mesh = mesh(x_new,y_new,lambdaZernike{exampleCell},'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.2,'EdgeColor','g');
-
- legend(results{exampleCell}.lambda.dataLabels);
- plot(x,y,neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- axis tight square;
- xlabel('x position'); ylabel('y position');
- title(['Animal#1, Cell#' num2str(exampleCell)]);
-
-
-
-
diff --git a/helpfiles/HippocampalPlaceCellExample.png b/helpfiles/HippocampalPlaceCellExample.png
deleted file mode 100644
index 9294edd6..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_01.png b/helpfiles/HippocampalPlaceCellExample_01.png
deleted file mode 100644
index 0039f3c7..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_01.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_02.png b/helpfiles/HippocampalPlaceCellExample_02.png
deleted file mode 100644
index c487eeb2..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_02.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_03.png b/helpfiles/HippocampalPlaceCellExample_03.png
deleted file mode 100644
index 85946da4..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_03.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_04.png b/helpfiles/HippocampalPlaceCellExample_04.png
deleted file mode 100644
index 85409dbc..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_04.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_05.png b/helpfiles/HippocampalPlaceCellExample_05.png
deleted file mode 100644
index cd48a6e8..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_05.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_06.png b/helpfiles/HippocampalPlaceCellExample_06.png
deleted file mode 100644
index 8aff8d24..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_06.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_07.png b/helpfiles/HippocampalPlaceCellExample_07.png
deleted file mode 100644
index e21f25aa..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_07.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_08.png b/helpfiles/HippocampalPlaceCellExample_08.png
deleted file mode 100644
index b9d7a7a1..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_08.png and /dev/null differ
diff --git a/helpfiles/HippocampalPlaceCellExample_09.png b/helpfiles/HippocampalPlaceCellExample_09.png
deleted file mode 100644
index 7a8f0756..00000000
Binary files a/helpfiles/HippocampalPlaceCellExample_09.png and /dev/null differ
diff --git a/helpfiles/HistoryExamples.asv b/helpfiles/HistoryExamples.asv
deleted file mode 100644
index 502e368d..00000000
--- a/helpfiles/HistoryExamples.asv
+++ /dev/null
@@ -1,41 +0,0 @@
-%% Test History
-% Generete a nspikeTrain and define a set of history windows of interest.
-% We desire windows from 1-2ms, 2-3ms, 3-5ms, and 5ms-10ms.
-% The history object with this windows in created below and then the
-%
-
-spikeTimes = sort(rand(1,100))*1;
-nst = nspikeTrain(spikeTimes,'n1',.001);
-windowTimes = [.001 .002 .003 .005 .01];
-h=History(windowTimes);
-
-%%
-% The firing activity within each window is computed by calling the
-% computeHistory method on a nspikeTrain, nstColl, or a cell array of
-% nspikeTrains
-
-histn1=h.computeHistory(nst);
-figure; subplot(3,1,1); h.plot; ylabel('History Windows');
-subplot(3,1,2); histn1.plot; ylabel('History Covariate for nst');
-figure; nst.plot; ylabel('Neural Spike Train');
-
-
-%% Example 2: History covariates for a collection of Neural Spikes (nstColl)
-% It is possible to compute history covariates for all the nspikeTrains in
-% a nstColl simultaneously.
-
-%%
-% Generate data and create a nstColl
-clear nst;
-for i=1:7
- spikeTimes = sort(rand(1,100))*1;
- nst{i}=nspikeTrain(spikeTimes,'',.001);
- %nst{i}.setName(strcat('Neuron',num2str(i)));
-end
-spikeColl=nstColl(nst);
-%%
-% generate a CovColl (collection of covariates) by applying the computing
-% the history of the entire nstColl
-
-histColl = h.computeHistory(spikeColl);
-figure; histColl.plot;
diff --git a/helpfiles/HistoryExamples.html b/helpfiles/HistoryExamples.html
deleted file mode 100644
index c765d875..00000000
--- a/helpfiles/HistoryExamples.html
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
- HistoryExamples
Generete a nspikeTrain and define a set of history windows of interest. We desire windows from 1-2ms, 2-3ms, 3-5ms, and 5ms-10ms. The history object with this windows in created below and then the
\ No newline at end of file
diff --git a/helpfiles/HistoryExamples.m b/helpfiles/HistoryExamples.m
deleted file mode 100644
index 1426c797..00000000
--- a/helpfiles/HistoryExamples.m
+++ /dev/null
@@ -1,44 +0,0 @@
-%% Test History
-% Generete a nspikeTrain and define a set of history windows of interest.
-% We desire windows from 1-2ms, 2-3ms, 3-5ms, and 5ms-10ms.
-% The history object with this windows in created below and then the
-%
-
-spikeTimes = sort(rand(1,100))*1;
-nst = nspikeTrain(spikeTimes,'n1',.001);
-windowTimes = [.001 .002 .004];
-h=History(windowTimes);
-
-%% /
-% The firing activity within each window is computed by calling the
-% computeHistory method on a nspikeTrain, nstColl, or a cell array of
-% nspikeTrains
-
-histn1=h.computeHistory(nst);
-figure; subplot(3,1,1); h.plot; ylabel('History Windows');
-subplot(3,1,2); histn1.plot; ylabel('History Covariate for nst');
-figure; nst.plot; ylabel('Neural Spike Train');
-
-
-%% Example 2: History covariates for a collection of Neural Spikes (nstColl)
-% It is possible to compute history covariates for all the nspikeTrains in
-% a nstColl simultaneously.
-
-%%
-% Generate data and create a nstColl
-clear nst;
-for i=1:1
- spikeTimes = sort(rand(1,100))*1;
- nst{i}=nspikeTrain(spikeTimes,'',.001);
- %nst{i}.setName(strcat('Neuron',num2str(i)));
-end
-spikeColl=nstColl(nst);
-
-windowTimes = [.001 .002 .01];
-h=History(windowTimes);
-%%
-% generate a CovColl (collection of covariates) by applying the computing
-% the history of the entire nstColl
-
-histColl = h.computeHistory(spikeColl);
-figure; histColl.plot;
diff --git a/helpfiles/HistoryExamples.png b/helpfiles/HistoryExamples.png
deleted file mode 100644
index 0b01958e..00000000
Binary files a/helpfiles/HistoryExamples.png and /dev/null differ
diff --git a/helpfiles/HistoryExamples_01.png b/helpfiles/HistoryExamples_01.png
deleted file mode 100644
index bcd3d8fc..00000000
Binary files a/helpfiles/HistoryExamples_01.png and /dev/null differ
diff --git a/helpfiles/HistoryExamples_02.png b/helpfiles/HistoryExamples_02.png
deleted file mode 100644
index 5b185b7e..00000000
Binary files a/helpfiles/HistoryExamples_02.png and /dev/null differ
diff --git a/helpfiles/HistoryExamples_03.png b/helpfiles/HistoryExamples_03.png
deleted file mode 100644
index 1d19ebfc..00000000
Binary files a/helpfiles/HistoryExamples_03.png and /dev/null differ
diff --git a/helpfiles/HybridFilterExample.asv b/helpfiles/HybridFilterExample.asv
deleted file mode 100644
index de24b66e..00000000
--- a/helpfiles/HybridFilterExample.asv
+++ /dev/null
@@ -1,186 +0,0 @@
-%% Hybrid Point Process Filter Example
-% This example is based on an implementation of the Hybrid Point Process
-% filter described in _General-purpose filter design for neural prosthetic devices_
-% by Srinivasan L, Eden UT, Mitter SK, Brown EN in J Neurophysiol. 2007 Oct, 98(4):2456-75.
-%
-
-%% Problem Statement
-% Suppose that a process of interest can be modeled as consisting of
-% several discrete states where the evolution of the system under each
-% state can be modeled as a linear state space model. The observations of
-% both the state and the continuous dynamics are not direct, but rather
-% observed through how the continuous and discrete states affect the firing
-% of a population of neurons. The goal of the hybrid filter is to estimate
-% both the continuous dynamics and the underlying system state from only
-% the neural population firing (point process observations).
-%
-% To illustrate the use of this filter, we consider a reaching task. We
-% assume two underlying system states s=1="Not Moving"=NM and s=2="Moving"=M.
-% Under the "Not Moving" the position of the arm remain constant,
-% whereas in the "Moving" state, the position and velocities evolved based
-% on the arm acceleration that is modeled as a gaussian white noise
-% process.
-%
-% Under both the "Moving" and "Not Moving" states, the arm evolution state
-% vector is
-%%
-%
-% $${\bf{x}} = {[x,y,{v_x},{v_y},{a_x},{a_y}]^T}$$
-%
-
-%% Generated Simulated Arm Reach
-
-clear all;
-close all;
-delta=0.001;
-Tmax=2;
-time=0:delta:Tmax;
-A{2} = [1 0 delta 0 delta^2/2 0;
- 0 1 0 delta 0 delta^2/2;
- 0 0 1 0 delta 0;
- 0 0 0 1 0 delta;
- 0 0 0 0 1 0;
- 0 0 0 0 0 1];
-
-A{1} = [1 0 0 0 0 0;
- 0 1 0 0 0 0;
- 0 0 0 0 0 0;
- 0 0 0 0 0 0;
- 0 0 0 0 0 0;
- 0 0 0 0 0 0];
-Px0{2} =.1*eye(6,6);
-Px0{1} =.1*eye(6,6);
-minCovVal = 1e-7;
-Q{2}=[minCovVal 0 0 0 0 0;
- 0 minCovVal 0 0 0 0;
- 0 0 minCovVal 0 0 0;
- 0 0 0 minCovVal 0 0;
- 0 0 0 0 1 0;
- 0 0 0 0 0 1];
-Q{1}=minCovVal*eye(6,6);
-
-
-
-mstate = zeros(1,length(time));
-ind{1}=1:6;
-ind{2}=1:6;
-
-% Acceleration model
-X=zeros(size(A{1},1),length(time));
-p_ij = [.998 .002; .002 .998];
-for i = 1:length(time)
-
- if(i==1)
- mstate(i) = 1+(rand(1,1)>.5);
- else
- if(rand(1,1)1)=1; %Avoid more than 1 spike per bin.
-
-% Starting states are equally probable
-Mu0=.5*ones(size(p_ij,1),1);
-
-% Run the Hybrid Point Process Filter
-[S_est, X_est, W_est, MU_est, X_s, W_s,pNGivenS]=CIF.PPHybridFilter(A, Q, p_ij,Mu0,Px0, dN',lambdaCIF,delta);
-
-%% Plot the results
-% close all;
-figure; subplot(2,2,1);plot(time,mstate,'k',time,S_est,'r-.'); axis tight; v=axis; axis([v(1) v(2) 0 3]);
- set(gca,'xtick',[],'YTick',[1 2],'YTickLabel',{'NM','M'});
- ylabel('state'); l=legend('$s(t)$','$\hat{s}(t)$','Location','Best');
- set(l, 'Interpreter', 'latex');
-
- subplot(2,2,3);plot(time,X_est(1:2,:)','-.'); hold on;plot(time,X(1:2,1:end-1)'); axis tight;
- xlabel('time [s]'); ylabel('[m]');l=legend('$\hat{x}(t)$','$\hat{y}(t)$','x(t)','y(t)','Location','Best');
- set(l, 'Interpreter', 'latex')
-
- subplot(2,2,[2 4]); h1=plot(X_est(1,:)',X_est(2,:)','r-.',X(1,1:end-1)',X(2,1:end-1)','k'); hold on;
- xlabel('X [m]'); ylabel('Y [m]'); plot(X(1,1),X(2,1),'ro','MarkerSize',10); plot(X(1,end),X(2,end),'bo','MarkerSize',10);
- legend(h1,'Estimate','Actual','Location','Best');
-
-
-figure;
-subplot(2,1,1);plot(time,mstate,'k',time,S_est,'r-.');
-title('Estimated vs. Actual State and State Probabilities');
-axis tight; v=axis; axis([v(1) v(2) 0 3]);
-set(gca,'xtick',[],'YTick',[1 2],'YTickLabel',{'NM','M'});
-ylabel('state');
-l=legend('$s(t)$','$\hat{s}(t)$','Location','Best');
-set(l, 'Interpreter', 'latex');
-
-
-subplot(2,1,2); plot(time,MU_est); axis tight;
-xlabel('time'); ylabel('P(s(t)=i | data)');
-legend('P(s(t)=1 | data)','P(s(t)=2 | data)','Location','Best');
-
diff --git a/helpfiles/HybridFilterExample.html b/helpfiles/HybridFilterExample.html
deleted file mode 100644
index 53d0e9cb..00000000
--- a/helpfiles/HybridFilterExample.html
+++ /dev/null
@@ -1,871 +0,0 @@
-
-
-
-
- Hybrid Point Process Filter Example
Hybrid Point Process Filter Example
This example is based on an implementation of the Hybrid Point Process filter described in General-purpose filter design for neural prosthetic devices by Srinivasan L, Eden UT, Mitter SK, Brown EN in J Neurophysiol. 2007 Oct, 98(4):2456-75.
Suppose that a process of interest can be modeled as consisting of several discrete states where the evolution of the system under each state can be modeled as a linear state space model. The observations of both the state and the continuous dynamics are not direct, but rather observed through how the continuous and discrete states affect the firing of a population of neurons. The goal of the hybrid filter is to estimate both the continuous dynamics and the underlying system state from only the neural population firing (point process observations).
To illustrate the use of this filter, we consider a reaching task. We assume two underlying system states s=1="Not Moving"=NM and s=2="Moving"=M. Under the "Not Moving" the position of the arm remain constant, whereas in the "Moving" state, the position and velocities evolved based on the arm acceleration that is modeled as a gaussian white noise process.
Under both the "Moving" and "Not Moving" states, the arm evolution state vector is
In order to understand how the point process GLM framework can be used to estimate the network connectivity within a population of neurons, we simulate a network of 2 neurons.
This block diagram specifies a conditional intensity function of the form
where, . Note that * is the convolution opertator.
Captures how the firing of a neuron at modulates its probability of firing. Captures effects such as the refractory period and bursting. We use the same firing history for both neurons in this example. Note that the firing activity at time n leads to strong inhibition at time n+1 (refractory period) and that this effect becomes smaller over the next two time periods.
Note that the one sample delay in same cell firing is included in the simulink model.
S{1}=tf([1],1,Ts,'Variable','z^-1');
-% Neuron 1 is negatively modulated by the stimulus
-S{2}=tf([-1],1,Ts,'Variable','z^-1');
-
Ensemble Effect
Captures the effect of how neighboring neuron firing modulates the firing of a given neuron.
Note that the one sample delay in firing of the neighbor cell is included in the simulink model.
%Neuron 2 firing positively modulates Neuron 1
-E{1}=tf([1],1,Ts,'Variable','z^-1');
-%Neuron 1 firing has strong inhibitory effect on neuron 2.
-E{2}=tf([-4],1,Ts,'Variable','z^-1');
-
Stimulus
We use a simple sine wave here but we may want to explore other types of inputs to see if they affect the recovery of the network parameters.
f=1; %Stimulus frequency [Hz]
-u = sin(2*pi*f*t)'; %Make this neuron modulated by a sine wave
-stim=Covariate(t',u,'Stimulus','time','s','Voltage',{'sin'});
-
-
-% Map the variables to the Simulink model
-assignin('base','S1',S{1});
-assignin('base','H1',H{1});
-assignin('base','E1',E{1});
-assignin('base','mu1',mu{1});
-assignin('base','S2',S{2});
-assignin('base','H2',H{2});
-assignin('base','E2',E{2});
-assignin('base','mu2',mu{2});
-options = simget;
-
Simulate the Network
Uses a binomial model for the conditional intensity function nSTAT supports poisson model too but this simulink model simulates the firing using a binomial model
Warning: The model 'SimulatedNetwork2' has the 'Configuration Parameters' >
-'Data Import/Export' > 'Signal logging format' parameter set to 'ModelDataLogs'.
-The signal logging save format 'ModelDataLogs' will be removed in a future
-release. To take advantage of new functionality, update models that use
-'ModelDataLogs' signal logging format to use the 'Dataset' format. For help
-with resolving this and other upgrade issues, use the Simulink Upgrade Advisor.
-
GLM Model Fitting Setup
In this section, we create the appropriate structures to fit several GLM models to the data generated above.
% Create a constant covariate representing the mean firing rate $$\mu_{i}$
-baseline=Covariate(t',ones(length(t),1),'Baseline','time','s','',{'mu'});
-
-spikeColl = sC; %Use the generated data as our collection of spikes
-%Use stimulation and baseline as possible covariates
-cc=CovColl({stim,baseline});
-trial = Trial(spikeColl,cc); sampleRate = 1/Ts; %Create trial
-% trial.setTrialPartition([0 tMax/2 tMax]);
-
GLM Model Fitting and Results
clear c;
-% We know the history effect goes back 3 lag orders
-selfHist = [0:1:3]*Ts;
-% only have an effect at the 1ms lag. This captures the effect of the
-% firing of neuron 1 on neuron 2 and vice versa.
-ensHist = [0 1]*Ts;
-
-
-
-sampleRate = 1/Ts;
-%Lets compare three models of increasing complexity for each neuron
-
-% When results are shown, ]ambda_1 corresponds to the CIF obtained from the
-% c{1}, lambda_2 to c{2} etc.
-% Fit only a mean firing rate
-c{1} = TrialConfig({{'Baseline','mu'}},sampleRate,[],[]);
-c{1}.setName('Baseline');
-
-% Fit a constant rate and ensemble model
-c{2} = TrialConfig({{'Baseline','mu'}},sampleRate,[],ensHist);
-c{2}.setName('Baseline+EnsHist');
-
-% Fit the correct/exact model
-c{3} = TrialConfig({{'Baseline','mu'},{'Stimulus','sin'}},sampleRate,...
- selfHist,ensHist);
-c{3}.setName('Stim+Hist+EnsHist');
-
-% Place all configurations together and run analysis for each neuron
-
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0,Algorithm);
-
-% Visualize the Results
-results{1}.plotResults;
-results{2}.plotResults;
-Summary = FitResSummary(results);
-% Summary.plotSummary;
-
-% Construct an image of the Actual vs. Estimated Network
-actNetwork = zeros(numNeurons,numNeurons);
-network1ms = zeros(numNeurons,numNeurons);
-for i=1:numNeurons
- index = 1:numNeurons;
- neighbors = setdiff(index,i);
- [num,den] = tfdata(E{i});
- actNetwork(i,neighbors) = cell2mat(num);
- % Coefficients in the 2rd Analysis correspond to the estimated
- % connection weights.
- % See labels after running command: [coeffs,labels]=results{i}.getCoeffs;
- [coeffs,labels]=results{i}.getCoeffs;
- network1ms(i,neighbors)=coeffs(1:(length(neighbors)),3);
-end
-
-maxVal=max(max(abs(actNetwork)));
-minVal=-maxVal;%min(min(actNetwork));
-CLIM = [minVal maxVal];
-figure;
-colormap(jet);
-subplot(1,2,1);
-imagesc(actNetwork,CLIM);
-set(gca,'XTick',index,'YTick',index);
-title('Actual');
-subplot(1,2,2);
-imagesc(network1ms,CLIM);
-set(gca,'XTick',index,'YTick',index);
-title('Estimated 1ms');
-
Note: by default all neurons are considered to be potential neighbors. If this is not the case, you can call trial.setNeighbors(neighborArray) where neighborArray is a matrix that in the ith row has ones in the columns of those neurons considered to be potential neighbors and zeros otherwise. By default neighborArray has 0 only on the diagonal, so that the ith neuron cannot be its own neighbor, and 1 ones elsewhere.
\ No newline at end of file
diff --git a/helpfiles/NetworkTutorial.m b/helpfiles/NetworkTutorial.m
deleted file mode 100644
index beed6799..00000000
--- a/helpfiles/NetworkTutorial.m
+++ /dev/null
@@ -1,223 +0,0 @@
-% Author: Iahn Cajigas
-% Date: 2/10/2014
-%% Point Process Network Simulation
-% In order to understand how the point process GLM framework can be used to
-% estimate the network connectivity within a population of neurons, we
-% simulate a network of 2 neurons.
-%%
-%
-% <>
-%
-
-%%
-%
-% <>
-%
-%%
-% This block diagram specifies a conditional intensity function of the form
-
-
-%%
-% $$lambda_{i} \cdot \Delta = logistic(\mu_{i} + H*\Delta N_{i}[n] +
-% S*u_{stim}[n] + E*\Delta N_{k}[n]$$
-%
-%%
-% where,
-% $\hbox{\fontsize{14}{16}\selectfont\(logistic(x)=e^{x}/{1+e^{x}}\)}$. Note that * is the convolution opertator.
-%% 2 Neuron Network
-
-clear all;
-close all;
-Ts=.001; %Sample Time
-tMin=0; tMax=50; %Simulation duration
-t=tMin:Ts:tMax;
-numNeurons=2;
-
-%% Baseline firing rate of the neurons being modeled
-mu{1}=-3;
-mu{2}=-3;
-
-%% History Effect
-% Captures how the firing of a neuron at modulates its probability of
-% firing. Captures effects such as the refractory period and bursting. We
-% use the same firing history for both neurons in this example. Note that
-% the firing activity at time n leads to strong inhibition at time n+1
-% (refractory period) and that this effect becomes smaller over the next
-% two time periods.
-%%
-% $$1*h[n]=-4*\Delta N[n-1]-2*\Delta N[n-2] -1*\Delta N[n-3]$$
-%
-% Note that the one sample delay in same cell firing is included
-% in the simulink model.
-H{1}=tf([-4 -2 -1],[1],Ts,'Variable','z^-1');
-H{2}=tf([-4 -2 -1],[1],Ts,'Variable','z^-1');
-
-%% Stimulus Effect
-
-%%
-% $$1*s_{1}[n]=1*u_{stim}[n]$$
-%
-%%
-% $$1*s_{2}[n]=-1*u_{stim}[n]$$
-%
-% Neuron 1 is positively modulated by the stimulus
-S{1}=tf([1],1,Ts,'Variable','z^-1');
-% Neuron 1 is negatively modulated by the stimulus
-S{2}=tf([-1],1,Ts,'Variable','z^-1');
-
-
-%% Ensemble Effect
-% Captures the effect of how neighboring neuron firing modulates the firing
-% of a given neuron.
-%%
-% $$1*e_{1}[n]=1*\Delta N_{2}[n-1]$$
-%
-%%
-% $$1*e_{2}[n]=-4*\Delta N_{1}[n-1]$$
-%
-% Note that the one sample delay in firing of the neighbor cell is included
-% in the simulink model.
-%Neuron 2 firing positively modulates Neuron 1
-E{1}=tf([1],1,Ts,'Variable','z^-1');
-%Neuron 1 firing has strong inhibitory effect on neuron 2.
-E{2}=tf([-4],1,Ts,'Variable','z^-1');
-
-%% Stimulus
-% We use a simple sine wave here but we may want to explore other types of
-% inputs to see if they affect the recovery of the network parameters.
-
-f=1; %Stimulus frequency [Hz]
-u = sin(2*pi*f*t)'; %Make this neuron modulated by a sine wave
-stim=Covariate(t',u,'Stimulus','time','s','Voltage',{'sin'});
-
-
-% Map the variables to the Simulink model
-assignin('base','S1',S{1});
-assignin('base','H1',H{1});
-assignin('base','E1',E{1});
-assignin('base','mu1',mu{1});
-assignin('base','S2',S{2});
-assignin('base','H2',H{2});
-assignin('base','E2',E{2});
-assignin('base','mu2',mu{2});
-options = simget;
-
-%% Simulate the Network
-% Uses a binomial model for the conditional intensity function
-% nSTAT supports poisson model too but this simulink model simulates the
-% firing using a binomial model
-fitType = 'binomial';
-if(strcmp(fitType,'binomial'))
- Algorithm = 'BNLRCG';
-else
- Algorithm ='GLM';
-end
-[tout,~,yout] = sim('SimulatedNetwork2',[stim.minTime stim.maxTime], ...
- options,stim.dataToStructure);
-clear nst;
-
- for i=1:numNeurons
- spikeTimes = tout(yout(:,i)>.5); %find the spike times
- nst{i} = nspikeTrain(spikeTimes);
- end
-
-
-sC=nstColl(nst);
-sC.setMinTime(stim.minTime);
-sC.setMaxTime(stim.maxTime);
-
-
-
-figure;
-subplot(2,1,1); sC.plot; v=axis; axis([0 tMax/10 v(3) v(4)]);
-subplot(2,1,2); stim.plot; v=axis; axis([0 tMax/10 v(3) v(4)]);
-
-%% GLM Model Fitting Setup
-% In this section, we create the appropriate structures to fit several GLM
-% models to the data generated above.
-
-% Create a constant covariate representing the mean firing rate $$\mu_{i}$
-baseline=Covariate(t',ones(length(t),1),'Baseline','time','s','',{'mu'});
-
-spikeColl = sC; %Use the generated data as our collection of spikes
-%Use stimulation and baseline as possible covariates
-cc=CovColl({stim,baseline});
-trial = Trial(spikeColl,cc); sampleRate = 1/Ts; %Create trial
-% trial.setTrialPartition([0 tMax/2 tMax]);
-
-%% GLM Model Fitting and Results
-clear c;
-% We know the history effect goes back 3 lag orders
-selfHist = [0:1:3]*Ts;
-% only have an effect at the 1ms lag. This captures the effect of the
-% firing of neuron 1 on neuron 2 and vice versa.
-ensHist = [0 1]*Ts;
-
-
-
-sampleRate = 1/Ts;
-%Lets compare three models of increasing complexity for each neuron
-
-% When results are shown, ]ambda_1 corresponds to the CIF obtained from the
-% c{1}, lambda_2 to c{2} etc.
-% Fit only a mean firing rate
-c{1} = TrialConfig({{'Baseline','mu'}},sampleRate,[],[]);
-c{1}.setName('Baseline');
-
-% Fit a constant rate and ensemble model
-c{2} = TrialConfig({{'Baseline','mu'}},sampleRate,[],ensHist);
-c{2}.setName('Baseline+EnsHist');
-
-% Fit the correct/exact model
-c{3} = TrialConfig({{'Baseline','mu'},{'Stimulus','sin'}},sampleRate,...
- selfHist,ensHist);
-c{3}.setName('Stim+Hist+EnsHist');
-
-% Place all configurations together and run analysis for each neuron
-
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0,Algorithm);
-
-% Visualize the Results
-results{1}.plotResults;
-results{2}.plotResults;
-Summary = FitResSummary(results);
-% Summary.plotSummary;
-
-% Construct an image of the Actual vs. Estimated Network
-actNetwork = zeros(numNeurons,numNeurons);
-network1ms = zeros(numNeurons,numNeurons);
-for i=1:numNeurons
- index = 1:numNeurons;
- neighbors = setdiff(index,i);
- [num,den] = tfdata(E{i});
- actNetwork(i,neighbors) = cell2mat(num);
- % Coefficients in the 2rd Analysis correspond to the estimated
- % connection weights.
- % See labels after running command: [coeffs,labels]=results{i}.getCoeffs;
- [coeffs,labels]=results{i}.getCoeffs;
- network1ms(i,neighbors)=coeffs(1:(length(neighbors)),3);
-end
-
-maxVal=max(max(abs(actNetwork)));
-minVal=-maxVal;%min(min(actNetwork));
-CLIM = [minVal maxVal];
-figure;
-colormap(jet);
-subplot(1,2,1);
-imagesc(actNetwork,CLIM);
-set(gca,'XTick',index,'YTick',index);
-title('Actual');
-subplot(1,2,2);
-imagesc(network1ms,CLIM);
-set(gca,'XTick',index,'YTick',index);
-title('Estimated 1ms');
-
-%%
-% Note: by default all neurons are considered to be potential neighbors. If
-% this is not the case, you can call trial.setNeighbors(neighborArray)
-% where neighborArray is a matrix that in the ith row has ones in the
-% columns of those neurons considered to be potential neighbors and zeros
-% otherwise. By default neighborArray has 0 only on the diagonal, so that
-% the ith neuron cannot be its own neighbor, and 1 ones elsewhere.
-
diff --git a/helpfiles/NetworkTutorial.png b/helpfiles/NetworkTutorial.png
deleted file mode 100644
index 3e7d12c7..00000000
Binary files a/helpfiles/NetworkTutorial.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_01.png b/helpfiles/NetworkTutorial_01.png
deleted file mode 100644
index 7338c72d..00000000
Binary files a/helpfiles/NetworkTutorial_01.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_02.png b/helpfiles/NetworkTutorial_02.png
deleted file mode 100644
index 3e7b6ba5..00000000
Binary files a/helpfiles/NetworkTutorial_02.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_03.png b/helpfiles/NetworkTutorial_03.png
deleted file mode 100644
index 39440759..00000000
Binary files a/helpfiles/NetworkTutorial_03.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_04.png b/helpfiles/NetworkTutorial_04.png
deleted file mode 100644
index de888417..00000000
Binary files a/helpfiles/NetworkTutorial_04.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq01608.png b/helpfiles/NetworkTutorial_eq01608.png
deleted file mode 100644
index 2adf9a8d..00000000
Binary files a/helpfiles/NetworkTutorial_eq01608.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq05678.png b/helpfiles/NetworkTutorial_eq05678.png
deleted file mode 100644
index ae4a76a3..00000000
Binary files a/helpfiles/NetworkTutorial_eq05678.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq10976.png b/helpfiles/NetworkTutorial_eq10976.png
deleted file mode 100644
index 70a2356d..00000000
Binary files a/helpfiles/NetworkTutorial_eq10976.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq80304.png b/helpfiles/NetworkTutorial_eq80304.png
deleted file mode 100644
index abaeb7b9..00000000
Binary files a/helpfiles/NetworkTutorial_eq80304.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq83377.png b/helpfiles/NetworkTutorial_eq83377.png
deleted file mode 100644
index 2321054d..00000000
Binary files a/helpfiles/NetworkTutorial_eq83377.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq91481.png b/helpfiles/NetworkTutorial_eq91481.png
deleted file mode 100644
index c8863c99..00000000
Binary files a/helpfiles/NetworkTutorial_eq91481.png and /dev/null differ
diff --git a/helpfiles/NetworkTutorial_eq96233.png b/helpfiles/NetworkTutorial_eq96233.png
deleted file mode 100644
index ca221168..00000000
Binary files a/helpfiles/NetworkTutorial_eq96233.png and /dev/null differ
diff --git a/helpfiles/NeuralSpikeAnalysis_top.html b/helpfiles/NeuralSpikeAnalysis_top.html
deleted file mode 100644
index e8a41cad..00000000
--- a/helpfiles/NeuralSpikeAnalysis_top.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
- Neural Spike Train Analysis Toolbox (nSTAT)
Purpose: The Neural Spike Analysis Toolbox is an effort to consolidate many of the data analysis methods of the Point Process/Generalized Linear Model Framework into a coherent and simple to use package.
\ No newline at end of file
diff --git a/helpfiles/NeuralSpikeAnalysis_top.m b/helpfiles/NeuralSpikeAnalysis_top.m
deleted file mode 100644
index 306132ed..00000000
--- a/helpfiles/NeuralSpikeAnalysis_top.m
+++ /dev/null
@@ -1,20 +0,0 @@
-%% Neural Spike Train Analysis Toolbox (nSTAT)
-%
-%
-% <>
-%
-% *Author*: Iahn Cajigas (iahn@mit.edu)
-%
-% *Original Release Date*: 9/10/2009
-%
-% *Current Release Date*: 4/10/2014
-%
-% *Purpose:*
-% The Neural Spike Analysis Toolbox is an effort to consolidate many of the
-% data analysis methods of the Point Process/Generalized Linear Model
-% Framework into a coherent and simple to use package.
-%
-%
-
-
-
diff --git a/helpfiles/PPSimExample-BlockDiagram.png b/helpfiles/PPSimExample-BlockDiagram.png
deleted file mode 100644
index 5e29e610..00000000
Binary files a/helpfiles/PPSimExample-BlockDiagram.png and /dev/null differ
diff --git a/helpfiles/PPSimExample.html b/helpfiles/PPSimExample.html
deleted file mode 100644
index 76012b56..00000000
--- a/helpfiles/PPSimExample.html
+++ /dev/null
@@ -1,242 +0,0 @@
-
-
-
-
- General Point Process Simulation
General Point Process Simulation
In this demo, we show how sample-paths of a point process (PP) can be generated from specification of its conditional intensity function (CIF). We then use the generated PP data to validate the outputs of the Neural Spike Analysis Toolbox.
That both the stimulus effect and ensemble effects can be made into multi-input/multi-output transfer functions to account for more than 1 stimulus effect or multiple neighboring neuron effects. To do this, simply define or to be a row vector of LTI transfer functions. Make sure than the number of dimensions of the input matches the number of transfer functions specified in the row vector.
This block diagram specifies a conditional intensity function of the form
close all;
-Ts=.001; %Sample Time
-tMin=0; tMax=50; %Simulation duration
-t=tMin:Ts:tMax;
-
-mu=-3; %Baseline firing rate of the neurons being modeled
-
History Effect
H=tf([-1 -2 -4],[1],Ts,'Variable','z^-1');
-
Stimulus Effect
S=tf([1],1,Ts,'Variable','z^-1');
-
Ensemble Effect
E=tf([0],1,Ts,'Variable','z^-1');
-
f=1; %Stimulus frequency
-u = sin(2*pi*f*t)'; %Make this neuron modulated by a sine wave
-e = zeros(length(t),1); %No Ensemble input
-
-stim=Covariate(t',u,'Stimulus','time','s','Voltage',{'sin'});
-ens =Covariate(t',e,'Ensemble','time','s','Spikes',{'n1'});
-numRealizations = 5; %Number of sample paths to generate
-fitType = 'binomial';
-sC=CIF.simulateCIF(mu,H,S,E,stim,ens,numRealizations,fitType);
-figure;
-subplot(2,1,1); sC.plot; v=axis; axis([0 tMax/10 v(3) v(4)]);
-subplot(2,1,2); stim.plot; v=axis; axis([0 tMax/10 v(3) v(4)]);
-
GLM Model Fitting Setup
In this section, we create the appropriate structures to fit several GLM models to the data generated above.
% Create a constant covariate representing the mean firing rate $$\mu_{i}$
-baseline=Covariate(t',ones(length(t),1),'Baseline','time','s','',{'mu'});
-
-
-spikeColl = sC; %Use the generated data as our collection of spikes
-cc=CovColl({stim,baseline}); %Use stimulation and baseline as possible covariates
-trial = Trial(spikeColl,cc); sampleRate = 1/Ts; %Create trial
-
GLM Model Fitting and Results
clear c;
-selfHist = [0:0.001:0.003]; %We know the history effect goes back 3 lag orders
-
\ No newline at end of file
diff --git a/helpfiles/PPSimExample.m b/helpfiles/PPSimExample.m
deleted file mode 100644
index 04d3527f..00000000
--- a/helpfiles/PPSimExample.m
+++ /dev/null
@@ -1,121 +0,0 @@
-%% General Point Process Simulation
-% In this demo, we show how sample-paths of a point process (PP) can be
-% generated from specification of its conditional intensity function (CIF).
-% We then use the generated PP data to validate the outputs of the Neural
-% Spike Analysis Toolbox.
-%% Point Process Sample Path Generation
-% That both the stimulus effect and ensemble effects can be made into
-% multi-input/multi-output transfer functions to account for more than 1
-% stimulus effect or multiple neighboring neuron effects. To do this,
-% simply define $$E$ or $$S$ to be a row vector of LTI transfer functions.
-% Make sure than the number of dimensions of the input matches the number
-% of transfer functions specified in the row vector.
-
-%%
-%
-% <>
-%
-
-%%
-% This block diagram specifies a conditional intensity function of the form
-
-%%
-%
-% $$\lambda_{i} \cdot \Delta = exp(\mu_{i} + H*\Delta N_{i}[n] + S*u_{stim}[n] + E*\Delta N_{k}[n])/(1+exp(\mu_{i} + H*\Delta N_{i}[n] + S*u_{stim}[n] + E*\Delta N_{k}[n]))$$
-%
-
-
-
-close all;
-Ts=.001; %Sample Time
-tMin=0; tMax=50; %Simulation duration
-t=tMin:Ts:tMax;
-
-mu=-3; %Baseline firing rate of the neurons being modeled
-
-%% History Effect
-%
-% $$1*h[n]=-1*\Delta N[n-1]-2*\Delta N[n-2] -4*\Delta N[n-3]$$
-%
-H=tf([-1 -2 -4],[1],Ts,'Variable','z^-1');
-
-
-%% Stimulus Effect
-%
-% $$1*s[n]=1*u_{stim}[n]$$
-%
-S=tf([1],1,Ts,'Variable','z^-1');
-
-
-%% Ensemble Effect
-%
-% $$1*e[n]=0*\Delta N_{k}[n]$$
-%
-E=tf([0],1,Ts,'Variable','z^-1');
-
-%%
-f=1; %Stimulus frequency
-u = sin(2*pi*f*t)'; %Make this neuron modulated by a sine wave
-e = zeros(length(t),1); %No Ensemble input
-
-stim=Covariate(t',u,'Stimulus','time','s','Voltage',{'sin'});
-ens =Covariate(t',e,'Ensemble','time','s','Spikes',{'n1'});
-numRealizations = 5; %Number of sample paths to generate
-fitType = 'binomial';
-sC=CIF.simulateCIF(mu,H,S,E,stim,ens,numRealizations,fitType);
-figure;
-subplot(2,1,1); sC.plot; v=axis; axis([0 tMax/10 v(3) v(4)]);
-subplot(2,1,2); stim.plot; v=axis; axis([0 tMax/10 v(3) v(4)]);
-
-%% GLM Model Fitting Setup
-% In this section, we create the appropriate structures to fit several GLM
-% models to the data generated above.
-
-% Create a constant covariate representing the mean firing rate $$\mu_{i}$
-baseline=Covariate(t',ones(length(t),1),'Baseline','time','s','',{'mu'});
-
-
-spikeColl = sC; %Use the generated data as our collection of spikes
-cc=CovColl({stim,baseline}); %Use stimulation and baseline as possible covariates
-trial = Trial(spikeColl,cc); sampleRate = 1/Ts; %Create trial
-
-
-%% GLM Model Fitting and Results
-clear c;
-selfHist = [0:0.001:0.003]; %We know the history effect goes back 3 lag orders
-
-%%
-% Fit only a mean firing rate
-c{1} = TrialConfig({{'Baseline','mu'}},sampleRate,[],[]);
-c{1}.setName('Baseline');
-
-%%
-% Fit a mean firing rate + the stimulus term
-c{2} = TrialConfig({{'Baseline','mu'},{'Stimulus','sin'}},sampleRate,[],[]);
-c{2}.setName('Stim');
-
-%%
-% Fit a mean firing rate, self-history, and stimulus --- Same as true model
-c{3} = TrialConfig({{'Baseline','mu'},{'Stimulus','sin'}},sampleRate,selfHist,[]);
-c{3}.setName('Stim+Hist');
-
-%%
-% Place all configurations together and run analysis for each neuron
-cfgColl= ConfigColl(c);
-if(strcmp(fitType,'binomial'))
- Algorithm = 'BNLRCG'; % BNLRCG - faster Truncated, L-2 Regularized,
- % Binomial Logistic Regression with Conjugate
- % Gradient Solver by Demba Ba (demba@mit.edu).
-else
- Algorithm = 'GLM'; % Standard Matlab GLM (Can be used for binomial or
- % or Poisson CIFs
-end
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0,Algorithm);
-
-%% Results for sample neuron
-results{1}.plotResults;
-
-%% Results for across all sample paths
-
-Summary = FitResSummary(results);
-Summary.plotSummary;
\ No newline at end of file
diff --git a/helpfiles/PPSimExample.png b/helpfiles/PPSimExample.png
deleted file mode 100644
index ba45854a..00000000
Binary files a/helpfiles/PPSimExample.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_01.png b/helpfiles/PPSimExample_01.png
deleted file mode 100644
index 0979ba4e..00000000
Binary files a/helpfiles/PPSimExample_01.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_02.png b/helpfiles/PPSimExample_02.png
deleted file mode 100644
index c98eaf59..00000000
Binary files a/helpfiles/PPSimExample_02.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_03.png b/helpfiles/PPSimExample_03.png
deleted file mode 100644
index 60b7801e..00000000
Binary files a/helpfiles/PPSimExample_03.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq05913.png b/helpfiles/PPSimExample_eq05913.png
deleted file mode 100644
index b519c034..00000000
Binary files a/helpfiles/PPSimExample_eq05913.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq12837.png b/helpfiles/PPSimExample_eq12837.png
deleted file mode 100644
index 6ab5ec4b..00000000
Binary files a/helpfiles/PPSimExample_eq12837.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq43772.png b/helpfiles/PPSimExample_eq43772.png
deleted file mode 100644
index 78ca1196..00000000
Binary files a/helpfiles/PPSimExample_eq43772.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq52469.png b/helpfiles/PPSimExample_eq52469.png
deleted file mode 100644
index de1575d5..00000000
Binary files a/helpfiles/PPSimExample_eq52469.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq58538.png b/helpfiles/PPSimExample_eq58538.png
deleted file mode 100644
index f6801185..00000000
Binary files a/helpfiles/PPSimExample_eq58538.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq62582.png b/helpfiles/PPSimExample_eq62582.png
deleted file mode 100644
index be759863..00000000
Binary files a/helpfiles/PPSimExample_eq62582.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq76278.png b/helpfiles/PPSimExample_eq76278.png
deleted file mode 100644
index d517ad06..00000000
Binary files a/helpfiles/PPSimExample_eq76278.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq82580.png b/helpfiles/PPSimExample_eq82580.png
deleted file mode 100644
index 0a433d32..00000000
Binary files a/helpfiles/PPSimExample_eq82580.png and /dev/null differ
diff --git a/helpfiles/PPSimExample_eq93975.png b/helpfiles/PPSimExample_eq93975.png
deleted file mode 100644
index ed59b9c3..00000000
Binary files a/helpfiles/PPSimExample_eq93975.png and /dev/null differ
diff --git a/helpfiles/PPThinning.html b/helpfiles/PPThinning.html
deleted file mode 100644
index 5a15c1ce..00000000
--- a/helpfiles/PPThinning.html
+++ /dev/null
@@ -1,184 +0,0 @@
-
-
-
-
- Simulate PP via thinning
Simulate PP via thinning
Given a conditional intensity function, we generate a point process consistent with this CIF.
\ No newline at end of file
diff --git a/helpfiles/PPThinning.m b/helpfiles/PPThinning.m
deleted file mode 100644
index 15ab9653..00000000
--- a/helpfiles/PPThinning.m
+++ /dev/null
@@ -1,63 +0,0 @@
-%% Simulate PP via thinning
-% Given a conditional intensity function, we generate a point process
-% consistent with this CIF.
-
-%% Basic Example
-close all;
-delta = 0.001;
-Tmax = 100;
-time = 0:delta:Tmax;
-f=.1;
-lambdaData = 10*sin(2*pi*f*time)+10; %lambda >=0
-lambda = Covariate(time,lambdaData, '\Lambda(t)','time','s','Hz',{'\lambda_{1}'},{{' ''b'', ''LineWidth'' ,2'}});
-
-lambdaBound = max(lambda);
-N=lambdaBound*(1.5*Tmax); %Expected number of arrivals in interval 1.5*Tmax
-u = rand(1,N); %N samples uniform(0,1)
-w = -log(u)./(lambdaBound); %N samples exponential rate lambdaBound (ISIs)
-
-tSpikes = cumsum(w); %Spiketimes;
-tSpikes = tSpikes(tSpikes<=Tmax);%Spiketimes within Tmax
-
-% Thinning
-
-lambdaRatio = lambda.getValueAt(tSpikes)./lambdaBound;
-% lambdaRatio <=1
-
-% draw uniform random number in 0,1
-u2 = rand(length(lambdaRatio),1);
-
-% keep spike if lambda ratio is greater than random number
-tSpikesThin = tSpikes(lambdaRatio>=u2);
-
-%% Compare Constant rate process vs. thinned process
-figure(1);
-n1 = nspikeTrain(tSpikes);
-n2 = nspikeTrain(tSpikesThin);
-subplot(2,2,1); n1.plot; plot(tSpikes,ones(size(tSpikes)),'.');
-v=axis; axis([0 Tmax/4 v(3) v(4)]);
-subplot(2,2,2); n1.plotISIHistogram;
-subplot(2,2,3); n2.plot; plot(tSpikes,ones(size(tSpikes)),'.');
-v=axis; axis([0 Tmax/4 v(3) v(4)]);
-subplot(2,2,4); n2.plotISIHistogram;
-
-figure(2);
-n2.plot;
-scaledProb = lambda*(1./lambdaBound);
-scaledProb.plot;
-v=axis;
-axis([0 Tmax/4 v(3) v(4)]);
-
-%% Simulate multiple realizations of a point process via thinning
-% The CIF class can generated realizations of a point process given
-% a conditional intensity function (defined as a Covariate or SignalObj)
-
-numRealizations = 20;
-spikeColl = CIF.simulateCIFByThinningFromLambda(lambda,numRealizations);
-figure(3);
-spikeColl.plot;
-lambda.plot;
-v=axis;
-axis([0 Tmax/4 v(3) v(4)]);
-
-
diff --git a/helpfiles/PPThinning.png b/helpfiles/PPThinning.png
deleted file mode 100644
index 611d13ff..00000000
Binary files a/helpfiles/PPThinning.png and /dev/null differ
diff --git a/helpfiles/PPThinning_01.png b/helpfiles/PPThinning_01.png
deleted file mode 100644
index 5ae1cf5b..00000000
Binary files a/helpfiles/PPThinning_01.png and /dev/null differ
diff --git a/helpfiles/PPThinning_02.png b/helpfiles/PPThinning_02.png
deleted file mode 100644
index 65d50ec5..00000000
Binary files a/helpfiles/PPThinning_02.png and /dev/null differ
diff --git a/helpfiles/PPThinning_03.png b/helpfiles/PPThinning_03.png
deleted file mode 100644
index 7e593267..00000000
Binary files a/helpfiles/PPThinning_03.png and /dev/null differ
diff --git a/helpfiles/PSTHEstimation.bak b/helpfiles/PSTHEstimation.bak
deleted file mode 100644
index ae66d0b7..00000000
--- a/helpfiles/PSTHEstimation.bak
+++ /dev/null
@@ -1,60 +0,0 @@
-%% PSTH Estimation
-% We illustrate two ways to estimate a peristimulus time histogram using
-% the nSTAT toolbox. One technique is the standard binning in time,
-% averaging across trials, and dividing by the binwidth to estimate the
-% spike rate and the other is based on the method presented in "Analysis of
-% Between-Trial and Within-Trial Neural Spiking Dynamics" by Czanner et al
-% in J Neurophysiology 2008.
-%
-%
-%% Generate a known Conditional Intensity Function
-% We generated a known conditional intensity function (rate function) and
-% generate distinct realizations of point processes consistent with this
-% rate function. We use the method of thinning to simulate a point process.
-
-close all;
-delta = 0.001;
-Tmax = 35;
-time = 0:delta:Tmax;
-f=.1;
-lambdaData = 10*sin(2*pi*f*time)+10; %lambda >=0
-lambda = Covariate(time,lambdaData, '\Lambda(t)','time','s','Hz',{'\lambda_{1}'},{{' ''b'', ''LineWidth'' ,2'}});
-numRealizations = 20; % Use 20 realization so that lamba and raster plot are the same size
-spikeColl = CIF.simulateCIFByThinning(lambda,numRealizations);
-spikeColl.plot;
-lambda.plot;
-
-%% Estimate the PSTH with 200ms windows
-%
-
-figure;
-binsize = .5; %500ms window
-psth = spikeColl.psth(binsize);
-psthGLM = spikeColl.psthGLM(binsize);
-true = lambda*binsize; %rate*delta = expected number of arrivals per bin
-h1=true.plot;
-h2=psth.plot([],{{' ''rx'',''Linewidth'',4'}});
-h3=psthGLM.plotAllVariability('g',2,1/sqrt(psth.dimension));
-legend off;
-legend([h1(1) h2(1) h3(1)],'true','PSTH','PSTH_{glm}');
-
-% Because currently the psthGLM estimated the psth coefficients in each bin
-% for each realization, we want the show the mean and standard error of the
-% cofficient in each bin. We make the upper and lower confidence bounds
-% equal to 1/sqrt(numRealization)=1/sqrt(psth.dimension) to view the
-% standard error instead of the standard deviation
-
-
-%%
-% Note the mean of the PSTH estimated via the GLM model and the PSTH
-% computed via standard methods agree precisely. The benefit of the GLM
-% estimated PSTH is the presence of confidence bounds on the estimate. Both
-% the standard and GLM PSTH are in close agreement with the "true"
-% underlying rate function (conditional intensity function) used in this
-% simulated example. Both the PSTH and PSTHGLM code could be updated in the
-% future to allow for variable bin sizes (e.g. in the vein of Baysian Adaptive Regression
-% Splines by Wallstrom, Leibner and Kass). Alternatively, porting of BARS
-% to Matlab may allow for it to be easily integrated into the nSTAT
-% toolbox.
-
-
diff --git a/helpfiles/PSTHEstimation.html b/helpfiles/PSTHEstimation.html
deleted file mode 100644
index 871e4155..00000000
--- a/helpfiles/PSTHEstimation.html
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
-
-
- PSTH Estimation
PSTH Estimation
We illustrate two ways to estimate a peristimulus time histogram using the nSTAT toolbox. One technique is the standard binning in time, averaging across trials, and dividing by the binwidth to estimate the spike rate and the other is based on the method presented in "Analysis of Between-Trial and Within-Trial Neural Spiking Dynamics" by Czanner et al in J Neurophysiology 2008.
We generated a known conditional intensity function (rate function) and generate distinct realizations of point processes consistent with this rate function. We use the method of thinning to simulate a point process.
close all;
-delta = 0.001;
-Tmax = 10;
-time = 0:delta:Tmax;
-f=.2;
-lambdaData = 10*sin(2*pi*f*time)+10; %lambda >=0
-lambda = Covariate(time,lambdaData, '\Lambda(t)','time','s','Hz',{'\lambda_{1}'},{{' ''b'', ''LineWidth'' ,2'}});
-numRealizations = 20; % Use 20 realization so that lamba and raster plot are the same size
-spikeColl = CIF.simulateCIFByThinningFromLambda(lambda,numRealizations);
-spikeColl.plot; set(gca,'ytickLabel',[]);
-lambda.plot;
-
Estimate the PSTH with 500ms windows
figure;
-binsize = .5; %500ms window
-psth = spikeColl.psth(binsize);
-psthGLM = spikeColl.psthGLM(binsize);
-true = lambda; %rate*delta = expected number of arrivals per bin
-h1=true.plot;
-h3=psthGLM.plot([],{{' ''k'',''Linewidth'',4'}});
-h2=psth.plot([],{{' ''rx'',''Linewidth'',4'}});
-legend off;
-legend([h1(1) h2(1) h3(1)],'true','PSTH','PSTH_{glm}');
-
-% Because currently the psthGLM estimated the psth coefficients in each bin
-% for each realization, we want the show the mean and standard error of the
-% cofficient in each bin. We make the upper and lower confidence bounds
-% equal to 1/sqrt(numRealization)=1/sqrt(psth.dimension) to view the
-% standard error instead of the standard deviation
-
Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-
Note the mean of the PSTH estimated via the GLM model and the PSTH computed via standard methods agree precisely. The benefit of the GLM estimated PSTH is the presence of confidence bounds on the estimate. Both the standard and GLM PSTH are in close agreement with the "true" underlying rate function (conditional intensity function) used in this simulated example. Both the PSTH and PSTHGLM code could be updated in the future to allow for variable bin sizes (e.g. in the vein of Baysian Adaptive Regression Splines by Wallstrom, Leibner and Kass). Alternatively, porting of BARS to Matlab may allow for it to be easily integrated into the nSTAT toolbox.
- Published with MATLAB® 7.13
\ No newline at end of file
diff --git a/helpfiles/PSTHEstimation.m b/helpfiles/PSTHEstimation.m
deleted file mode 100644
index f9947f11..00000000
--- a/helpfiles/PSTHEstimation.m
+++ /dev/null
@@ -1,60 +0,0 @@
-%% PSTH Estimation
-% We illustrate two ways to estimate a peristimulus time histogram using
-% the nSTAT toolbox. One technique is the standard binning in time,
-% averaging across trials, and dividing by the binwidth to estimate the
-% spike rate and the other is based on the method presented in "Analysis of
-% Between-Trial and Within-Trial Neural Spiking Dynamics" by Czanner et al
-% in J Neurophysiology 2008.
-%
-%
-%% Generate a known Conditional Intensity Function
-% We generated a known conditional intensity function (rate function) and
-% generate distinct realizations of point processes consistent with this
-% rate function. We use the method of thinning to simulate a point process.
-
-close all;
-delta = 0.001;
-Tmax = 10;
-time = 0:delta:Tmax;
-f=.2;
-lambdaData = 10*sin(2*pi*f*time)+10; %lambda >=0
-lambda = Covariate(time,lambdaData, '\Lambda(t)','time','s','Hz',{'\lambda_{1}'},{{' ''b'', ''LineWidth'' ,2'}});
-numRealizations = 20; % Use 20 realization so that lamba and raster plot are the same size
-spikeColl = CIF.simulateCIFByThinningFromLambda(lambda,numRealizations);
-spikeColl.plot; set(gca,'ytickLabel',[]);
-lambda.plot;
-
-%% Estimate the PSTH with 500ms windows
-%
-
-figure;
-binsize = .5; %500ms window
-psth = spikeColl.psth(binsize);
-psthGLM = spikeColl.psthGLM(binsize);
-true = lambda; %rate*delta = expected number of arrivals per bin
-h1=true.plot;
-h3=psthGLM.plot([],{{' ''k'',''Linewidth'',4'}});
-h2=psth.plot([],{{' ''rx'',''Linewidth'',4'}});
-legend off;
-legend([h1(1) h2(1) h3(1)],'true','PSTH','PSTH_{glm}');
-
-% Because currently the psthGLM estimated the psth coefficients in each bin
-% for each realization, we want the show the mean and standard error of the
-% cofficient in each bin. We make the upper and lower confidence bounds
-% equal to 1/sqrt(numRealization)=1/sqrt(psth.dimension) to view the
-% standard error instead of the standard deviation
-
-
-%%
-% Note the mean of the PSTH estimated via the GLM model and the PSTH
-% computed via standard methods agree precisely. The benefit of the GLM
-% estimated PSTH is the presence of confidence bounds on the estimate. Both
-% the standard and GLM PSTH are in close agreement with the "true"
-% underlying rate function (conditional intensity function) used in this
-% simulated example. Both the PSTH and PSTHGLM code could be updated in the
-% future to allow for variable bin sizes (e.g. in the vein of Baysian Adaptive Regression
-% Splines by Wallstrom, Leibner and Kass). Alternatively, porting of BARS
-% to Matlab may allow for it to be easily integrated into the nSTAT
-% toolbox.
-
-
diff --git a/helpfiles/PSTHEstimation.png b/helpfiles/PSTHEstimation.png
deleted file mode 100644
index 5c0d5757..00000000
Binary files a/helpfiles/PSTHEstimation.png and /dev/null differ
diff --git a/helpfiles/PSTHEstimation_01.png b/helpfiles/PSTHEstimation_01.png
deleted file mode 100644
index 0c4cff50..00000000
Binary files a/helpfiles/PSTHEstimation_01.png and /dev/null differ
diff --git a/helpfiles/PSTHEstimation_02.png b/helpfiles/PSTHEstimation_02.png
deleted file mode 100644
index e9acde65..00000000
Binary files a/helpfiles/PSTHEstimation_02.png and /dev/null differ
diff --git a/helpfiles/SignalObj.html b/helpfiles/SignalObj.html
deleted file mode 100644
index b78e6fc3..00000000
--- a/helpfiles/SignalObj.html
+++ /dev/null
@@ -1,2797 +0,0 @@
-
-
-
-
-
-
-
- SignalObj
-
-
-
-
-
classdef SignalObj < handle
- %SignalObj Class representing a signal abstraction
- % SignalObj consist of data that is indexed by time (as a default). The
- % indexing variable can be any other type of data and the x-axis labels
- % modified to represent this change.
- %
- % A SignalObj can be multivariate in that the data can have more than one component. The
- % sample rate of the SignalObj is determined by the time increment used
- % in the time sequence used when the SingalObj is created
- %
- % Usage:
- % >> s=SignalObj(time, data, name, xlabelval, xunits, yunits, dataLabels, plotProps)
- %
- % Only time and data need to be specified. Other arguments are optional.
- %
- %
- % time: indexing variable for the data. n x 1 or 1 x n array. The sample
- % rate is determined by the time increment between samples of this vector. Units of
- % [sec] are assumed, but need not be used. If the time vector is
- % in units of [sec], the sampleRate is in units of [Hz]. If the
- % time vector is in units of [msec] then the sampleRate is in
- % units of [1/msec] or 10^3 [Hz].
- %
- % data: n x m or m x n array reprenting the signal at each index of the time vector.
- % The dimension that is compatible with the time vector will be automatically detected.
- % Thus a SignalObj can be created by either passing the data matrix or its transpose. The remaining
- % dimension will determine the dimensionality of the SignalObj.
- %
- % name: string that determines the name of the signal. This is used to
- % label the y-axis of the SignalObj.
- %
- % xlabelval: A string specifying the name of the indexing variable. If
- % this value is not specified, 'time' is used.
- %
- % xunits: A string specifying the name of the units of the indexing
- % variable. In not specified, 'sec' is used.
- %
- % yunits: A string specifying the units of the SignalObj. Used when plotting the SignalObj.
- %
- % dataLabels: If data is multivariate, the names of the components of the SignalObj can be specified.
- % These can be used to reference specific data within the
- % signal (e.g. the x-component of a 3-d vector) and are
- % also used for plotting. SignalObj's will be created for
- % each component of the orignal SignalObj under the
- % vars field. Can be specified all at once or by a cell of
- % strings.
- %
- % plotProps: Can be specified for each component of the SignalObj
- % individually or by a cell of string of same dimension as the
- % number of components in the data.
- %
- %
- %
- % <a href="matlab:web(fullfile(strread(userpath,'%s','delimiter',';'),'Code Development','Signal','trunk','html','SignalObjExamples.html'))">SignalObj Examples</a>
-
-
- properties (SetAccess = private)
- name % name of the SignalObj
- time % time vector
- data % actual SignalObj data
- dimension % number of different components of the SignalObj
- minTime % minimum Time value of the SignalObj
- maxTime % maximum Time value of the SignalObj
- xlabelval % label to use for the x-axis
- xunits % units for x-axis
- yunits % units for y-axis data
- dataLabels % labels for each dimension of the data;
- dataMask % vector same length as SignalObj dimension. a 1 indicates this SignalObj should be output a 0 otherwie
- sampleRate % Hz if time is in seconds
- plotProps % Plotting properties
- end
- properties (Hidden)
- origSampleRate
- originalTime %original timeVector
- originalData %original Data
- end
- properties (Dependent = true)
- vars %Contains subfields of the same names as the dataLabels that contain Signals with only the data corresponding to that label.
- end
- methods
- %Constructor
- function s=SignalObj(time, data, name, xlabelval, xunits, yunits, dataLabels, plotProps)
-
- if(nargin<6)
- yunits='';
- end
- if(nargin<5)
- xunits='s';
- end
- if(nargin<4)
- xlabelval='time';
- end
- if(nargin<3)
- name='';
- end
- [l,w]=size(time);
- if(l>=w);
- if(w>1)
- error('Time vector can only have one dimension');
- else
- s.time=time;
-
- end
- elseif(l<=w)
- if(l>1)
- error('Time vector can only have one dimension');
- else
- s.time=time';
- end
- end
- s.originalTime=s.time;
- [l,w]=size(data);
- if(l==length(s.time));
- s.data=data;
- s.dimension =w;
- elseif(w==length(s.time));
- s.data=data';
- s.dimension=l;
- else
- error('Data dimensions do not match the time vector specified');
- end
- s.originalData = s.data;
- if(nargin <7)
- for i=1:s.dimension
- dataLabels{i} = '';
- end
- end
- s.dataMask = ones(1,s.dimension);
- if(nargin<8)
- plotProps = cell(s.dimension,1);
- end
- s.sampleRate = 1/mean(diff(s.time));
- s.origSampleRate = s.sampleRate;
- s.name=name;
- s.xlabelval=xlabelval;
- s.xunits=xunits;
- s.yunits=yunits;
- s.minTime=min(s.time);
- s.maxTime=max(s.time);
- s.setPlotProps(plotProps);
- s.setDataLabels(dataLabels);
- end
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %Set functions
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function setName(sObj,name) %set the name after construction
- if(isa(name,'char'))
- sObj.name = name;
- else
- error('Name must be a string!');
- end
- end
- function setXlabel(sObj,name)
- sObj.xlabelval = name;
- end
- function setYLabel(sObj,name)
- sObj.setName(name);
- end
- function setUnits(sObj, xUnits, yUnits)
- if(nargin==3)
- if(isa(yUnits,'char'))
- sObj.setYunits(yUnits);
- end
- end
- if(nargin>=2)
- if(isa(xUnits,'char'))
- sObj.setXunits(xUnits);
- end
- end
- end
- function setXUnits(sObj, units)
- if(isa(units, 'char'))
- sObj.xunits = units;
- end
- end
- function setYUnits(sObj, units)
- if(isa(units,'char'))
- sObj.yunits = units;
- end
- end
- function setSampleRate(sObj, sampleRate)
-% sampleRate
-% sObj.sampleRate
-% ~(sampleRate==sObj.sampleRate)
- if(~(floor(sampleRate*100)/100==floor(sObj.sampleRate*100)/100)) %Compare to 2 decimal places (finite precision has caused errors 500.000001 ~= 500.00000x
- if(sampleRate>sObj.sampleRate)
- %fprintf(strcat('SignalObj,',sObj.name',', upsampled to:',num2str(sampleRate)));
- else
- %fprintf(strcat('SignalObj,',sObj.name',', downsampled to:',num2str(sampleRate)));
- end
- sObj.resampleMe(sampleRate);
- end
- end
- function setDataLabels(sObj,dataLabels)
- if(isa(dataLabels,'char'))
- if(sObj.dimension==1)
- sObj.dataLabels{1}=dataLabels;
- else
- error('Adding single dataLabel to a SignalObj with more that 1 dimension');
- end
-
- elseif(isa(dataLabels,'cell'))
- if(length(dataLabels)==sObj.dimension)
- ind=sObj.findIndFromDataMask;
- for i=ind
- sObj.dataLabels{i} = dataLabels{i};
- end
- else
- error('Need the number of labels to match the number of dimensions of the SignalObj');
- end
- end
- end
- function setMinTime(sObj,minTime,holdVals)
- if(nargin<3)
- holdVals=0;
- end
-
- if(nargin<2)
- minTime=sObj.time(1);
- end
- timeVec=sObj.getTime;
- if(minTime<min(timeVec))
- maxTime=max(timeVec);
- newTime=minTime:1/sObj.sampleRate:maxTime;
- numSamples = length(newTime)-length(timeVec);
- if(holdVals==1)
- newData=[ones(numSamples,1)*sObj.data(1,:);sObj.data];
- else
- newData=[zeros(numSamples,sObj.dimension);sObj.data];
- end
- sObj.data=newData;
- sObj.time=newTime;
- sObj.minTime=min(sObj.time);
- elseif(min(timeVec)==minTime)
- %do nothing
- else
- startIndex = sObj.findNearestTimeIndex(minTime);
- sObj.time=sObj.time(startIndex:end);
- sObj.data=sObj.data(startIndex:end,:);
- end
- sObj.minTime=min(sObj.time);
- end
- function setMaxTime(sObj,maxTime, holdVals)
- if(nargin<3)
- holdVals=0;
- end
-
- if(nargin<2)
- maxTime=sObj.time(end);
- end
- timeVec=sObj.getTime;
- if(max(timeVec)<maxTime)
- minTime=min(timeVec);
- newTime=minTime:1/sObj.sampleRate:maxTime;
- numSamples = length(newTime)-length(timeVec);
- if(holdVals==1)
- newData=[sObj.data;ones(numSamples,1)*sObj.data(end,:)];
- else
- newData=[sObj.data;zeros(numSamples,sObj.dimension)];
- end
-
- sObj.data=newData;
- sObj.time=newTime;
- sPnj.maxTime=max(sObj.time);
- elseif(max(timeVec)==maxTime)
- %do nothing
-
- else
- endIndex = sObj.findNearestTimeIndex(maxTime);
- sObj.time=sObj.time(1:endIndex);
- sObj.data=sObj.data(1:endIndex,:);
- end
- sObj.maxTime=max(sObj.time);
- end
- function setPlotProps(sObj, plotProps,index)
- if(nargin<=2)
- if(isa(plotProps,'cell'))
- if(length(plotProps) == sObj.dimension)
- for i=1:sObj.dimension
- sObj.plotProps{i} = cell2str(plotProps{i});
- end
- elseif(length(plotProps)==1)
- for i=1:sObj.dimension
- sObj.plotProps{i} = cell2str(plotProps);
- display('Index not specified. All dimensions set to have same plotting properties');
- end
- else
- error('Index not specified and more than 1 plotProp specified. Need to number of plotProps same as sObj.dimension or length 1');
- end
- elseif(isa(plotProps,'char'))
- for i=1:sObj.dimension
- sObj.plotProps{i} = cell2str(plotProps);
- end
- display('All dimensions set to have same plotting properties')
- end
-
- else
- if(isa(plotProps,'cell') && length(plotProps)==1)
- if(index>0 && index<=sObj.dimension)
- sObj.plotProps{index} = plotProps{:};
- else
- error('Index out of bounds during setPlotProps');
- end
- elseif(isa(plotProps,'char'))
- if(index>0 && index<=sObj.dimension)
- sObj.plotProps{index} = plotProps;
- else
- error('Index out of bounds during setPlotProps');
- end
-
- end
- end
- end
- function setMask(sObj, mask)
- if(nargin<2)
- mask=zeros(1,sObj.dimension);
- sObj.setDataMask(mask);
- return;
- end
- %mask is either a set of indices or names;
- if(isa(mask,'cell'))
- if(isa(mask{1},'char'))
- sObj.setMaskByLabels(mask);
- else
- error('Mask cells must contains strings!');
- end
- elseif(isa(mask,'double'))
- sObj.setMaskByInd(mask);
- else
- error('Can only set datamask with strings or indices')
- end
- end
- function setDataMask(sObj, dataMask)
- %DataMasks affect how the SignalObj is visualized and converted to
- %other representations. It doesnt change the dimensions of the
- %object, nor does it delete data.
- if(length(dataMask)==sObj.dimension)
- sObj.dataMask = dataMask;
- end
-
- end
- function setMaskByInd(sObj,index)
- if(length(index)==sObj.dimension)
- sObj.setDataMask(index);
- else
- mask=zeros(1,sObj.dimension);
- mask(index)=1;
- sObj.setDataMask(mask);
- end
- end
- function setMaskByLabels(sObj,labels)
- ind=sObj.getIndicesFromLabels(labels);
- mask=zeros(1,sObj.dimension);
- mask(ind)=1;
- sObj.setDataMask(mask);
- end
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function tVec = getTime(sObj)
- tVec=sObj.time;
- end
- function data = getData(sObj)
- data=sObj.dataToMatrix;
- end
- function [t,d] = getOriginalData(sObj)
- t=sObj.originalTime;
- d=sObj.originalData;
- end
- function s = getOrigDataSig(sObj)
- [time,data]=sObj.getOriginalData;
- name=sObj.name;
- xlabelval=sObj.xlabelval;
- xunits=sObj.xunits;
- yunits=sObj.yunits;
- dataLabels=sObj.dataLabels;
- plotProps=sObj.plotProps;
- s = SignalObj(time, data,name, xlabelval, xunits, yunits,dataLabels,plotProps);
- end
- function index = getIndexFromLabel(sObj,label)
- index=[];
- for i=1:length(sObj.dataLabels)
- if(strcmp(label, sObj.dataLabels{i}))
- index = [index i];
- end
- end
- end
- function indices = getIndicesFromLabels(sObj,label)
- %Returns a cell array if the label appears for various point
- %int the SignalObj
- %Returns an array if the SignalObj label appears only once in the
- %SignalObj
- if(isa(label,'cell'))
- indices =cell(1,length(label));
- numInd =zeros(1,length(label));
- for i=1:length(label)
- tempInd = sObj.getIndexFromLabel(label{i});
- if(~isempty(tempInd))
- numInd(i) = length(tempInd);
- indices{i}=tempInd;
- else
- error('Label does not exist!');
- end
-
- end
- elseif(isa(label,'char'))
- indices = getIndexFromLabel(label);
- numInd = length(indices);
- end
- if(max(numInd)==1) %For backwards compatibility if assuming only on index per label
- for i=1:length(label)
- tempInd(i) = indices{i};
- end
- indices = tempInd;
- end
- end
- function val = getValueAt(sObj,x)
- ind=sObj.findNearestTimeIndex(x);
- val=sObj.data(ind,:);
- end
- function PropsStr = getPlotProps(sObj,index)
- if(index>0 && index<=sObj.dimension)
- PropsStr = cell2str(sObj.plotProps{index});
- else
- error('index is out of bounds!');
- end
- end
-
-
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Operand Definitions and other mathematical operations
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function s3 = plus(s1,s2)
- if(isa(s1,'SignalObj') && isa(s2,'SignalObj'))
- % What is s2 is a constant or double?
- if(s1.dimension == s2.dimension)
- [s1c,s2c] = makeCompatible(s1,s2);
- s3=s1c.copySignal;
- s3.data = s1c.data+s2c.data;
-
- for i=1:length(s3.dataLabels)
- if(strcmp(s2c.dataLabels{i}(1),'-'))
- s3.dataLabels{i} = [s1c.dataLabels{i} '-' s2c.dataLabels{i}(2:end)];
- else
- s3.dataLabels{i} = [s1c.dataLabels{i} '+' s2c.dataLabels{i}];
- end
- end
- else
- error('Can only add signals if they have the same dimension');
- end
- elseif(isa(s1,'double') || isa(s2,'double'))
- if(isa(s1,'double'))
- s3=s2.copySignal;
- [l,w] = size(s1);
- if(w==s3.dimension && l==1)
- s3.data = s3.data+ones(length(s3.data),1)*s1;
- for i=1:length(s3.dataLabels)
- if(sign(s1(i))==-1)
- s3.dataLabels{i} = [s2.dataLabels{i} '-' num2str(abs(s1(i)))];
- else
- s3.dataLabels{i} = [s2.dataLabels{i} '+' num2str(abs(s1(i)))];
- end
- end
- else
- s3.data = s3.data+s1;
- %dont modify dataLabels since s1 is a matrix;
-
- %for i=1:length(s3.dataLabels)
- % s3.dataLabels{i} = [s2.dataLabels{i} '+' num2str(s1(i))];
- %end
- end
- else
- s3=s1.copySignal;
- [l,w] = size(s2);
- %size(s3.data)
- if(w==s3.dimension && l==1)
- s3.data = s3.data+ones(length(s3.data),1)*s2;
- for i=1:length(s3.dataLabels)
- if(sign(s2(i))==-1)
- s3.dataLabels{i} = [s1.dataLabels{i} '-' num2str(abs(s2(i)))];
- else
- s3.dataLabels{i} = [s1.dataLabels{i} '+' num2str(abs(s2(i)))];
- end
- end
- else
-
- s3.data = s3.data+s2;
- %dont modify dataLabels since s2 is a matrix;
- %for i=1:length(s3.dataLabels)
- % s3.dataLabels{i} = [s1.dataLabels{i} '+' num2str(s2)];
- %end
- end
- end
- else
- error('only Signals or doubles are currently supported');
- end
- end
- function s3 = minus(s1,s2)
- s3=plus(s1,-s2);
- end
- function s3 = uplus(s1) %+s1
- s3=s1.copySignal;
- end
- function s3 = uminus(s1) %-s1
-
- s3=s1.copySignal;
- s3.data=-s3.data;
- for i=1:length(s3.dataLabels)
- s3.dataLabels{i} = strcat('-',s1.dataLabels{i});
- end
- end
- function s3 = times(s1,s2) %s1.*s2
- if(isa(s1,'SignalObj') && isa(s2,'SignalObj'))
- if(s1.dimension == s2.dimension)
- [s1c,s2c] = makeCompatible(s1,s2);
- s3 = s1c;
- s3.data = s1c.data.*s2c.data;
- %can multiply units
- else
- error('can only multiply signals with same dimension');
- end
- elseif(isa(s1,'double') || isa(s2,'double'))
- if(isa(s1,'double'))
- s3=s2.copySignal;
- [l,w] = size(s1);
- if(w==s3.dimension && l==1)
- s3.data = s3.data.*(ones(length(s3.data),1)*s1);
- else
- s3.data = s3.data.*s1;
- end
- else
- s3=s1.copySignal;
- [l,w] = size(s2);
- if(w==s3.dimension && l==1)
- s3.data = s3.data.*(ones(length(s3.data),1)*s2);
- else
- s3.data = s3.data.*s2;
- end
- end
- end
- end
- function s3 = mtimes(s1,s2) %s1*s2
- if(isa(s1,'SignalObj') && isa(s2,'SignalObj'))
- %[s1c,s2c] = makeCompatible(s1,s2);
- s3 = s1.copySignal;
- s3.data = s1.data.*s2.data;
- %can multiply units
- elseif(isa(s1,'double') || isa(s2,'double'))
- if(isa(s1,'double'))
- s3=s2.copySignal;
- s3.data = (s1*s3.data')';
- else
- s3=s1.copySignal;
- s3.data = (s3.data'*s2)';
- end
- end
- end
- function s3 = rdivide(s1,s2)
- if(isa(s1,'SignalObj') && isa(s2,'SignalObj'))
- if(s1.dimension == s2.dimension)
- [s1c,s2c] = makeCompatible(s1,s2);
- s3 = s1c;
- s3.data = s1c.data./s2c.data;
- %can multiply units
- else
- error('can only multiply signals with same dimension');
- end
- elseif(isa(s1,'double') || isa(s2,'double'))
- if(isa(s1,'double'))
- s3=s2.copySignal;
- s3.data = s1./s3.data;
- else
- s3=s1.copySignal;
- s3.data = s3.data./s2;
- end
- end
- end
- function s3 = ldivide(s1,s2)
- if(isa(s1,'SignalObj') && isa(s2,'SignalObj'))
- if(s1.dimension == s2.dimension)
- [s1c,s2c] = makeCompatible(s1,s2);
- s3 = s1c;
- s3.data = s1c.data.\s2c.data;
- %can multiply units
- else
- error('can only multiply signals with same dimension');
- end
- elseif(isa(s1,'double') || isa(s2,'double'))
- if(isa(s1,'double'))
- s3=s2.copySignal;
- s3.data = s1.\s3.data;
- else
- s3=s1.copySignal;
- s3.data = s3.data.\s2;
- end
- end
- end
- function s3 = ctranspose(s1)
- s3=s1.copySignal;
- s3.data=s3.data.';
- [l,w]=size(s3.data);
- s3.dimension=w;
- end
- function s3 = transpose(s1)
- s3=s1.copySignal;
- s3.data=s3.data.';
- [l,w]=size(s3.data);
- s3.dimension=w;
- end
- function s3 = derivative(sObj)
-% B=[1 -1]*sObj.sampleRate;
-% A=1;
-% s3=sObj.filter(B,A);
- s3=sObj.copySignal;
- tData=diff(s3.data)*s3.sampleRate;
- tData=[zeros(1,s3.dimension); tData];
- s3.data=tData;
-
- s3.setYUnits(strcat('\frac{',s3.yunits,'}{',s3.xunits,'}'));
- denomstr = strcat('d', s3.xlabelval(1));
-
- s3.setName(strcat('\frac{d}{',denomstr,'}',s3.name));
- for i=1:s3.dimension
- if(~strcmp(sObj.dataLabels{i},''))
- s3.dataLabels{i}= strcat('\frac{d}{',denomstr,'}',s3.dataLabels{i});
- end
- end
- end
- function val = derivativeAt(sObj,x0)
- sTemp = sObj.derivative;
- val = sTemp.getValueAt(x0);
- end
- function s3 = integral(sObj,t0,tf)
- if(nargin<3)
- tf=sObj.maxTime;
- end
- if(nargin<2)
- t0=sObj.minTime;
- end
-
- %y[n] = y[n-1] + x[n]*deltaT
- B=1*1/sObj.sampleRate;
- A=[1 -1];
- s3=sObj.getSigInTimeWindow(t0,tf);
- s3=s3.filter(B,A);
- s3.setYUnits(strcat(s3.yunits,'*',s3.xunits));
- dtstr = strcat(' d','\tau');
- s3.setName(['\int_',num2str(s3.minTime),'^',s3.xlabelval(1),'\!\!{',[s3.name dtstr],'}']);
- for i=1:s3.dimension
- if(~strcmp(sObj.dataLabels{i},''))
- s3.dataLabels{i}= ['\int_',num2str(s3.minTime),'^',s3.xlabelval(1),'\!\!{',[s3.dataLabels{i} dtstr],'}'];
- end
- end
- end
- function s3 = filter(sObj, B,A)
- s3=sObj.copySignal;
- s3.data = filter(B,A,s3.data);
- end
- function s3 = filtfilt(sObj,B,A)
- s3=sObj.copySignal;
- s3.data = filtfilt(B,A,s3.data);
- end
- function [s1c,s2c] = makeCompatible(s1,s2,holdVals)
- if(nargin<3)
- holdVals=0;
- end
- s1c = s1.copySignal; s2c = s2.copySignal;
- minTime=min(s1c.minTime,s2c.minTime);
- maxTime=max(s1c.maxTime,s2c.maxTime);
- sampleRate=max(s1c.sampleRate,s2c.sampleRate);
- s1c.setSampleRate(sampleRate); s2c.setSampleRate(sampleRate);
- s1c.setMinTime(minTime,holdVals); s2c.setMinTime(minTime,holdVals);
- s1c.setMaxTime(maxTime,holdVals); s2c.setMaxTime(maxTime,holdVals);
-
- %pause
-% for i=1:s2c.dimension
- data = spline(s2c.time,s2c.data',s1c.time);
-% end
- s2c.time = s1c.time;
- [nrows,ncolumns] = size(data);
- if(nrows>ncolumns)
- s2c.data = data;
- else
- s2c.data = data';
- end
- end
- function m=mean(sObj,varargin)
- mdata=mean(sObj.data,varargin{:});
- [nrows,ncolumns]=size(mdata);
- if( (nrows==length(sObj.time)) && (ncolumns==1) ) %mean across dimensions
- m=SignalObj(sObj.time, mdata, ['Mean of ' sObj.name],sObj.xlabelval, sObj.xunits,sObj.yunits);
- elseif( (nrows==1) && (ncolumns == sObj.dimension) ) %mean of each dimension
- if(~sObj.areDataLabelsEmpty)
- dataLabels = cell(size(sObj.dataLabels));
- for i=1:sObj.dimension
- dataLabels{i} = strcat('\mu(',sObj.dataLabels{i},')');
- end
- m=SignalObj([sObj.time(1); sObj.time(end)], [mdata;mdata], ['Mean of ' sObj.name],sObj.xlabelval, sObj.xunits,sObj.yunits,dataLabels);
- else
- m=SignalObj([sObj.time(1); sObj.time(end)], [mdata;mdata], ['Mean of ' sObj.name],sObj.xlabelval, sObj.xunits,sObj.yunits);
- end
- end
- end
- function m=max(sObj,varargin)
- m=max(sObj.data,varargin{:});
- end
- function m=min(sObj,varargin)
- m=min(sObj.data,varargin{:});
- end
- function periodogram = periodogram(sObj)
- fs = sObj.sampleRate; % Sampling frequency
- periodogram = cell(1,sObj.dimension);
- for i=1:sObj.dimension
- xn = sObj.data(:,i);
- Hs = spectrum.periodogram('rectangular');
- switch sObj.dimension
- case 2
- subplot(1,2,i)
- case 3
- subplot(1,3,i)
- case 4
- subplot(2,2,i)
- case 5
- subplot(3,2,i)
- case 6
- subplot(3,2,i)
- otherwise
- h=gcf;figure(h);
- end
- periodogram{i}=psd(Hs,xn,'Fs',fs,'NFFT',1024);
- h=periodogram{i}.plot;legend(h, sObj.dataLabels{i});
- end
- end
- function mtmSpec = MTMspectrum(sObj,NW,NFFT,Pval)
- if(nargin<4)
- Pval=.95;
- end
- if(nargin<3)
- NFFT=[];
- end
- if(nargin<2)
- NW=4;
- end
-
- Fs=sObj.sampleRate;
- mtmSpec = cell(1,sObj.dimension);
- for i=1:sObj.dimension
- xn=sObj.data(:,i);
- [Pxx,Pxxc,f] = pmtm(xn,NW,NFFT,Fs,Pval);
- hpsd = dspdata.psd([Pxx Pxxc],'Fs',Fs);
- mtmSpec{i} = hpsd;
- switch sObj.dimension
- case 2
- subplot(1,2,i)
- case 3
- subplot(1,3,i)
- case 4
- subplot(2,2,i)
- case 5
- subplot(3,2,i)
- case 6
- subplot(3,2,i)
- otherwise
- h=gcf;figure(h);
- end
- str1=strcat(num2str(Pval*100), '% Conf. Int.');
- h=plot(hpsd); legend(h, sObj.dataLabels{i},strcat('-',str1),strcat('+',str1));
- end
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %Utility Functions
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function mergedSig = merge(sObj,varargin)
- numToMerge=0;
- holdVals=0;
- for i=1:length(varargin)
- if(isa(varargin{i},'SignalObj'))
- numToMerge = numToMerge+1;
- end
- if(isa(varargin{i},'double')&&i==length(varargin)) %expect only one double at the end
- holdVals = varargin{i};
- end
- end
-
- if(numToMerge == 1)
- [s1c, s2c] = sObj.makeCompatible(varargin{1},holdVals);
- data=[s1c.dataToMatrix, s2c.dataToMatrix];
- dataLabels = cell(s1c.dimension+s2c.dimension,1);
- for i=1:s1c.dimension
- dataLabels{i} = s1c.dataLabels{i};
- end
- for i=1:s2c.dimension
- dataLabels{s1c.dimension+i}=s2c.dataLabels{i};
- end
- name = [s1c.name, ',', s2c.name];
- mergedSig = SignalObj(s1c.time, data, name, s1c.xlabelval,s1c.xunits, s1c.yunits, dataLabels);
- else
- mergedSig = sObj.merge(varargin{1},holdVals);
- for i=2:numToMerge
- mergedSig = mergedSig.merge(varargin{i},holdVals);
- end
- end
- end
- function sigOut=copySignal(sigIn)
- time=sigIn.time;
- data=sigIn.data;
- name=sigIn.name;
- xlabelval=sigIn.xlabelval;
- xunits=sigIn.xunits;
- yunits=sigIn.yunits;
- dataLabels=sigIn.dataLabels;
- plotProps=sigIn.plotProps;
- sigOut = SignalObj(time, data,name, xlabelval, xunits, yunits,dataLabels,plotProps);
- sigOut.dataMask = sigIn.dataMask;
- end
- function sObjOut=resample(sObj, newSampleRate)
- sObjOut = sObj.copySignal;
- sObjOut.resampleMe(newSampleRate);
- end
- function resampleMe(sObj, newSampleRate)
- sObj.restoreToOriginal; %use default data for changing samplerate
- %Change the sampling rate of this object
- minTime=sObj.minTime;
- maxTime=sObj.maxTime;
- newTime=minTime:1/newSampleRate:maxTime;
- newData=zeros(length(newTime),sObj.dimension);
- for i=1:sObj.dimension
- newData(:,i)= spline(sObj.time,sObj.data(:,i),newTime);
- end
- sObj.time=newTime;
- sObj.data=newData;
- sObj.sampleRate=newSampleRate;
- end
- function restoreToOriginal(sObj,rMask)
- if(nargin<2)
- rMask = 0; %keep mask even when data reset
- end
- [time,data]=sObj.getOriginalData;
- sObj.time=time;
- sObj.data=data;
- sObj.minTime=min(time);
- sObj.maxTime=max(time);
- sObj.sampleRate = 1/mean(diff(time));
- if(rMask==1)
- sObj.resetMask;
- end
- end
- function resetMask(sObj)
- sObj.dataMask = ones(1,sObj.dimension);
- end
- function ind = findIndFromDataMask(sObj)
- ind = find(sObj.dataMask ==1);
-% if(isempty(ind))
-% error('All data masked out of SignalObj');
-% end
- end
- function ind=findNearestTimeIndex(sObj, time)
- if(time<sObj.minTime)
- ind=1;
- elseif(time>sObj.maxTime)
- ind=length(sObj.time);
- else
- ind1=find(sObj.time>=time,1,'first');
- ind2=find(sObj.time<=time,1,'last');
- if(abs(sObj.time(ind1)-time)<=abs(sObj.time(ind2)-time))
- ind=ind1;
- else
- ind=ind2;
- end
-% if(time-sObj.minTime < sObj.maxTime-time) %Time is close to beginning
-% ind=min([ind1, ind2]);
-% else
-% ind=max([ind1, ind2]);
-% end
- end
- end
- function sOut = shift(sObj, deltaT)
-
- %returns s shift by deltaT. If deltaT is positive
- %the SignalObj is moved deltaT time steps forward
- %if deltaT is negative, the SignalObj is moved deltaT units
- %backwards.
- %compute number of samples delayed
- sOut=sObj.copySignal;
- newMinTime = sOut.minTime+deltaT;
- newMaxTime = sOut.maxTime+deltaT;
- newTime=newMinTime:1/sOut.sampleRate:newMaxTime;
- sOut.time = newTime;
- sOut.minTime = newMinTime;
- sOut.maxTime = newMaxTime;
- end
- function shiftMe(sObj,deltaT)
- sTemp = sObj.shift(deltaT);
- sObj.data=sTemp.data;
- sObj.time=sTemp.time;
- end
- function alignTime(sObj, timeMarker,newTime)
- if(sObj.minTime<=timeMarker && sObj.maxTime>=timeMarker)
- deltaT=newTime-timeMarker;
- sObj.shiftMe(deltaT);
- end
- end
- function answer = plotPropsSet(sObj)
- answer =0;
- for i=1:sObj.dimension
- if(~strcmp(sObj.getPlotProps(i),''))
- answer=1;
- break;
- end
- end
- end
- function answer = areDataLabelsEmpty(sObj)
- answer = 1;
- for i=1:length(sObj.dataLabels);
- if(~strcmp(sObj.dataLabels{i},''))
- answer = 0;
- break;
- end
- end
- end
- function answer = isLabelPresent(sObj, label)
- if(isa(label,'char'))
- if(strcmp(label,'all')||~isempty(sObj.getIndexFromLabel(label)))
- answer=1;
- else
- answer=0;
- end
- else
- error('Labels must be a char');
- end
- end
- function answer = isMaskSet(sObj)
- answer=~isempty(sObj.dataMask==0);
- end
- function sArray = convertNamesToIndices(sObj, selectorArray)
- if(sObj.areDataLabelsEmpty)
- sArray = 1:sObj.dimension; % Return all the data;
- fprintf('tried to find data by labels but data doesnot have labels assigned');
- else
- if(isa(selectorArray, 'char'))
- if(strcmp(selectorArray,'all'))
- sArray=1:sObj.dimension;
- elseif(sObj.isLabelPresent(selectorArray))
- sArray=sObj.getIndexFromLabel(selectorArray);
- else
- error('Specified label does not match data label');
- end
-
- elseif(isa(selectorArray, 'double'))
- sArray=selectorArray;
- elseif(isa(selectorArray, 'cell'))
- sArray = zeros(1, length(selectorArray));
- for i=1:length(sArray)
- if(sObj.isLabelPresent(selectorArray{i}))
- sArray(i) = sObj.getIndexFromLabel(selectorArray{i});
- end
- end
- else
- error('selectorArray cells must contain text');
- end
- end
- end
- function [indices, values] = findPeaks(sObj,type)
- if(nargin<2)
- type='maxima';
- end
- values=cell(1,sObj.dimension);
- indices=cell(1,sObj.dimension);
- if(strcmp(type,'maxima'))
- for i=1:w
- [values{i},indices{i}] = findPeaks(sObj.data(:,i));
- end
- elseif(strcmp(type,'minima'))
- for i=1:w
- [values{i},indices{i}] = findPeaks(sObj.data(:,i));
- end
- end
- end
- function [indices, values] = findMaxima(sObj)
- [indices,values]=sObj.findPeaks('maxima');
- end
- function [indices, values] = findMinima(sObj)
- [indices,times,values]= sObj.findPeaks('minima');
- end
- function clearPlotProps(sObj,index)
- if(nargin<2)
- index=1:sObj.dimension;
- end
- tempCell = cell(length(index),1);
- for i=index
- sObj.plotProps{i} = cell2str(tempCell{i});
- end
-
- end
- function v=get.vars(sObj)
- if(~sObj.areDataLabelsEmpty)
- UniqueSigLabels = unique(sObj.dataLabels);
-
- for i=1:length(UniqueSigLabels)
- eval(strcat('v.(''',UniqueSigLabels{i},''')=sObj.getSubSignal(''',UniqueSigLabels{i},''');'));
- end
- %sObj.vars=v;
- else
- for i=1:sObj.dimension
-
- eval(strcat('v.(''',sObj.dataLabels{i},''')=sObj.getSubSignal(i);'))
- end
- end
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %Change of Representation Functions
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function structure=dataToStructure(sObj,selectorArray)
- if(nargin<2)
- if(sObj.isMaskSet)
- selectorArray=sObj.findIndFromDataMask;
- else
- selectorArray=1:sObj.dimension;
- end
- end
- %Convert to a standard matlab structure
- structure.time=sObj.time;
- structure.signals.values=sObj.dataToMatrix(selectorArray);
- end
- function dataMat=dataToMatrix(sObj,selectorArray)
- if(nargin<2)
- if(sObj.isMaskSet)
- selectorArray=sObj.findIndFromDataMask;
- else
- selectorArray=1:sObj.dimension;
- end
- end
- % Convert data to a standard matrix.
- % The matrix is length(times)x dimension
- dataMat=sObj.data(:,selectorArray);
- end
- function sOut = getSubSignal(sObj,identifier)
- if(isa(identifier,'cell'))
- if(isa(identifier{1},'char'))
- sOut = sObj.getSubSignalFromNames(identifier);
- elseif(isa(identifier{1},'double'))
- sOut = sObj.getSubSignalFromInd(identifier);
- else
- error('Cells must contain strings!');
- end
- elseif(isa(identifier,'double'))
- sOut = sObj.getSubSignalFromInd(identifier);
- end
- end
- function wSignal = getSigInTimeWindow(sObj,wMin,wMax)
- wSignal = sObj.copySignal;
- if(wMin<wSignal.minTime)
- %if the window starts before the SignalObj pad with zeros
- %and set as new starttime
- wSignal.setMinTime(wMin);
- end
- if(wMax>wSignal.maxTime)
- %if wMax is too big, pad with zeros at end and set as new
- %end
- wSignal.setMaxTime(wMax);
- end
-
- startIndex= wSignal.findNearestTimeIndex(wMin);
- endIndex = wSignal.findNearestTimeIndex(wMax);
- wSignal.time=wSignal.time(startIndex:endIndex); wSignal.data=wSignal.data(startIndex:endIndex,:);
- wSignal.setMinTime;
- wSignal.setMaxTime;
- end
- function sOut = getSubSignalFromInd(sObj, selectorArray)
- if(nargin<2)
- if(sObj.isDataMaskSet)
- selectorArray=sObj.findIndFromDataMask;
- else
- selectorArray=1:sObj.dimension;
- end
- end
- s3 = sObj.copySignal;
- time = s3.time;
- if(isa(selectorArray,'cell'))
- data=[];
- for i=1:length(selectorArray)
- offset=0;
- data = [data s3.data(:,selectorArray{i})];
- for j=1:length(selectorArray{i})
- dataLabels{offset + j} = s3.dataLabels{selectorArray{i}(j)};
- if(~isempty(s3.plotProps))
- plotProps{offset+ j} = s3.plotProps{selectorArray{i}(j)};
- end
- end
- offset = offset + length(selectorArray{i});
- end
- else
- data = s3.data(:,selectorArray);
- dataLabels = cell(1,length(selectorArray));
- plotProps = [];
- for i=1:length(selectorArray)
- dataLabels{i}= s3.dataLabels{selectorArray(i)};
- if(~isempty(s3.plotProps))
- plotProps{i} = s3.plotProps{selectorArray(i)};
- end
- end
- end
-
-
-
-
- name = s3.name;
- xlabelval = s3.xlabelval; xunits=s3.xunits; yunits = s3.yunits;
- sOut=SignalObj(time, data, name, xlabelval, xunits, yunits, dataLabels, plotProps);
-
- end
- function sOut = getSubSignalFromNames(sObj,labels)
- ind = sObj.getIndicesFromLabels(labels);
- if(isa(ind,'cell'))
- if(length(ind)>1)
- for i=1:length(ind)
- s{i} = getSubSignalFromInd(ind{i});
- end
- sOut = s{1}.merge(s{2:end});
- else
- sOut = sObj.getSubSignalFromInd(ind{1});
- end
- elseif(isa(ind,'double'))
- sOut = sObj.getSubSignalFromInd(ind);
- end
- end
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %Plotting Functions
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % plotProps: is a cell array with strings in each a entry.
- % The strings must evaluate to parameters that can be
- % passed to the standard matlab plot function.
- % example: To plot a three dimensional signals with each line
- % with specific properties (not the use of double quotes on the
- % color entries so that the actual arguments have a quotes around
- % them.
- %
- % >> plotProps = {{' ''-.g'', ''LineWidth'' ,2'},...
- % {' ''k'', ''LineWidth'' ,2'},...
- % {' ''-.b'' '}};
- %
- % selectorArrray: is either an numeric array indexing the
- % elements within the SignalObj data or a cell array
- % of characters that refers to the data elements
- % by their labels.
- % % 8-25-09 : Legend wont plot is SignalObj dimension >10;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function h=plot(sObj,selectorArray,plotProps,handle)
- if(nargin<4)
- handle=gca;
- end
- if(nargin<3)
- plotProps=sObj.plotProps;
- end
- if(nargin<2)
- if(sObj.isMaskSet)
- selectorArray=sObj.findIndFromDataMask;
- if(isempty(selectorArray))
- h=[];
- return;
- end
- else
- selectorArray=1:sObj.dimension;
- end
- end
-
-
- if(isa(selectorArray,'cell'))
- sArray = sObj.convertNamesToIndices(selectorArray);
- elseif(isa(selectorArray,'char'))
- sArray = sObj.convertNamesToIndices(selectorArray);
- elseif(isa(selectorArray,'double'))
- sArray = selectorArray;
- else
- error('selectorArray must contain either dataLabels or their indices');
- end
-
-
-
- if(length(plotProps)==length(sArray))
- for i=1:length(sArray)
- sObj.setPlotProps(plotProps{i},sArray(i));
- end
- elseif(length(plotProps)<=length(sArray) && length(plotProps)==1)
- for i=1:length(sArray)
- sObj.setPlotProps(plotProps,sArray(i));
- end
- end
-
-
-
-
- %If the dimensions of the data are larger than one can specify
- %the plot style for each dimension by placing their values in
- %an cell array.
- h=gcf;figure(h);
- if(nargin>=3) %is we got called with parameter use those
- %sObj.setPlotProps(plotProps); %Only accepts entire cell of plotting properties as input
- %if(length(plotCell)>=length(sArray)) %if we specified plot parameters for each dimension
- for i=sArray
- %plotStr=cell2str(plotCell{:,find(sArray==i)});
- plotStr=cell2str(sObj.getPlotProps(i));
- if(~strcmp(plotStr,'') && ~isempty(plotStr))
- evalstring = strcat('h(',num2str(find(sArray==i)),')=plot(handle,sObj.time,sObj.data(:,',num2str(i),'),', plotStr,');');
- else
- evalstring = strcat('h(',num2str(find(sArray==i)),')=plot(handle,sObj.time,sObj.data(:,',num2str(i),'));');
- end
- %evalstring
- eval(evalstring); hold on;
- end
- elseif(sObj.plotPropsSet) %% We use the values that have been set previously
- %plotCell = cell2str(sObj.getPlotProps(i));
- %fprintf('varargin is not empty')
- for i=sArray
- plotStr =cell2str(sObj.getPlotProps(i));
- %plotStr=cell2str(plotCell{:,1});
- if(~strcmp(plotStr,'') && ~isempty(plotStr))
- evalstring = strcat('h(',num2str(i),')=plot(handle,sObj.time,sObj.data(:,',num2str(i),'),', plotStr,');');
- else
- evalstring = strcat('h(',num2str(i),')=plot(handle,sObj.time,sObj.data(:,',num2str(i),'));');
- end
- %evalstring
- eval(evalstring); hold on;
- end
- else%We didnt get any plotting properties. Use matlab default
- %plotCell{1} = '''';
- %fprintf('varargin is empty')
- h=plot(handle,sObj.time,sObj.data(:,sArray));
- end
-
- if(~strcmp(sObj.xunits,''))
- xunitsStr=strcat('\; [',sObj.xunits,']'); %\; is a large space in latex
- else
- xunitsStr='';
- end
-
- if(~strcmp(sObj.yunits,''))
- yunitsStr=strcat('\; [',sObj.yunits,']');
- else
- yunitsStr='';
- end
-
- if(strcmp(sObj.xlabelval,''))
- xlabel(strcat('$$',xunitsStr,'$$'),'Interpreter','latex');
-
- else
-% strcat(['$$' sObj.xlabelval xunitsStr '$$'])
- xlabel(strcat('$$',[sObj.xlabelval xunitsStr],'$$'),'Interpreter','latex');
-
- end
- if(~strcmp(sObj.name,''))
- if(~strcmp(yunitsStr,''))
- %strcat('$$',sObj.name,yunitsStr,'$$')
- ylabel(strcat('$$',[sObj.name yunitsStr],'$$'),'Interpreter','latex');
-
- else
-
- ylabel(strcat('$$',sObj.name,'$$'),'Interpreter','latex');
- %ylabel(sObj.name,'Interpreter','none');
-
- end
- end
-
- if(~sObj.areDataLabelsEmpty && sObj.dimension<10)
- labelArray= cell(1,length(sArray));
- for i=1:length(sArray)
- labelArray{i} = strcat('$$',sObj.dataLabels{sArray(i)},'$$');
-
- end
- legend(labelArray,'Interpreter','latex');
- end
- axis tight;
- end
-
- function h=plotVariability(sObj,linewidth,faceColor,ciUpper,ciLower)
- if(nargin<3)
- faceColor='red';
- end
- if(nargin<3)
- linewidth=3;
- end
- if(nargin<2)
- if(sObj.isMaskSet)
- selectorArray=sObj.findIndFromDataMask;
- if(isempty(selectorArray))
- h=[];
- return;
- end
- else
- selectorArray=1:sObj.dimension;
- end
- end
-
-
- if(isa(selectorArray,'cell'))
- sArray = sObj.convertNamesToIndices(selectorArray);
- elseif(isa(selectorArray,'char'))
- sArray = sObj.convertNamesToIndices(selectorArray);
- elseif(isa(selectorArray,'double'))
- sArray = selectorArray;
- else
- error('selectorArray must contain either dataLabels or their indices');
- end
-
- %Take the unique dataLabels and compute the variability of
- %these signals
-
- UniqueSigLabels = unique(sObj.getSubSignal(sArray).dataLabels);
-
-
- for i=1:length(UniqueSigLabels)
- meanSig = mean(sObj.getSubSignal(UniqueSigLabels{i}),2);
-
- if(nargin<4)
- ci2=meanSig.data+std(meanSig.dataToMatrix);
- else
- ci2=meanSig.data+ciUpper;
- end
-
- if(nargin<5)
- ci1=meanSig.data-std(meanSig.dataToMatrix);
- else
- ci1=meanSig.data+ciLower;
- end
-
-
- plot(sObj.time,meanSig.dataToMatrix,'k-','linewidth',linewidth);
- hold on;
- p=patch([reshape(sObj.time,[1 length(sObj.time)]) reshape(fliplr(sObj.time'),[1 length(sObj.time)])],...
- [reshape(ci1',[1 length(sObj.time)]) reshape(fliplr(ci2'),[1,length(sObj.time)])],strcat('',faceColor{1},''));
- set(p,'facecolor',faceColor,'edgecolor','none');
- alpha(.5);
- end
- end
- end% public methods
-
-
-
-
-end%classdef
-
-% Helper function
-function stringout=cell2str(input)
- if(isempty(input))
- stringout = '';
- else
- if(isa(input,'char'))
- stringout=input;
- elseif(isa(input,'cell'))
- stringout=cell2str(input{1});
- end
- end
-end
-
Input argument "time" is undefined.
-
-Error in ==> SignalObj>SignalObj.SignalObj at 96
- [l,w]=size(time);
-
- Published with MATLAB® 7.8
-
-
-
-
\ No newline at end of file
diff --git a/helpfiles/SignalObjExamples.asv b/helpfiles/SignalObjExamples.asv
deleted file mode 100644
index 66972a39..00000000
--- a/helpfiles/SignalObjExamples.asv
+++ /dev/null
@@ -1,160 +0,0 @@
-%% Using the SignalObj Class
-% In this file we will give several examples of how the SignalObj can be
-% used. A description of all of the properties of SignalObj can be found
-% at:
-
-
-%% Example 1: Defining and Plotting Signals
-% Define a two dimensional SignalObj, $s$, representing two voltage signals that were
-% $v1$ and $v2$ aquired simultaneously at 100Hz. Another SignalObj,$s1$,
-% is created from just $v1$. Both signals are plotted.
-close all;
-sampleRate=100; t=0:1/sampleRate:10; freq=2;
-v1=sin(2*pi*freq*t); v2=sin(v1.^2); v=[v1;v2];
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-s1=SignalObj(t,v1,'Voltage','time','s','V',{'v1'});
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s1.plot;
-
-%%
-% Note how the legend show the appropriate labels. If the dataLabels had
-% not been set, the legend would not appear.
-%
-% Instead of defining a new SignalObj, $s1$, the $v2$ data in $s$ can be
-% masked away and then the plot will only show the data of interest. It is
-% important to note that setMask is used to set which signals should remain
-% visible. Also note that when a data is masked, converting the SignalObj
-% to a Matrix only returns the visible data. A new SignalObj can be
-% created from the orignal SignalObj which only contains the data of interest.
-% Lastly, the all labeled components can be accessed independently via the
-% vars subfield.
-
-subplot(2,1,1); s.setMask({'v1'}); s.plot; s.resetMask;
-subplot(2,1,2); s.setMask({'v2'}); s.plot; size(s.dataToMatrix)
-s.resetMask;
-
-%%
-figure
-subplot(2,1,1); s.getSubSignal({'v1'}).plot;
-subplot(2,1,2); s.vars.v1.plot;
-
-%%
-% _Note about repeated dataLabels_
-% It is possible to use SignalObj's to store different realizations of the
-% same physical signal. For example, independent measurements of
-% $v1$ at two distinct experiments.
-s=SignalObj(t,[v1; v1; v2] ,'Voltage','time','s','V',{'v1','v1','v2'});
-s.getSubSignal({'v1'}); %returns a SignalObj with both realizations of v1
-
-%% Example 2: Changing Signal Properties
-figure
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s.setXlabel('distance'); s.setXUnits('cm'); s.plot;
-
-%%
-figure
-subplot(2,1,1); s.setDataLabels({'r1','r2'}); s.setYLabel('Temperature'); s.setYUnits('C'); s.plot;
-subplot(2,1,2); s.setMaxTime(14); s.setMinTime(-2); s.plot;
-
-s.setName('testName'); %should work since we are using a method
-if(strcmp(s.name,'testName'))
- fprintf('Name successfully set \n');
-else
- fprintf('Could not set name \n');
-end
-% s.name = 'testName'; %returns an error because the field is private;
-
-%%
-% setMaxTime and setMinTime can be given a second parameter, holdVals, that
-% determines whether the endpoint values are kept or set to zero if the
-% times being set are outside the original window of the data.
-%
-% Plotting properties for individual components of the data can be set via
-% the when plotting or by call the setPlotProps method.
-
-figure
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-subplot(2,1,1); s.plot('v1',{{' ''k'' '}});
-subplot(2,1,2); s.plot('all',{{' ''k'' '},{' ''-.g'' '}});
-
-%%
-figure
-subplot(2,1,1); s.plot({'v1','v2'});
-subplot(2,1,2); s.plot({'v1','v2'},{{' ''k'' '},{' ''-.g'' '}});
-
-%% Example 3: Resampling and Windowing SignalObjs
-figure
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-s1=s.resample(.1*sampleRate);
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s1.plot;
-
-%%
-figure
-subplot(2,1,1); s.getSigInTimeWindow(-2,3).plot;
-subplot(2,1,2); s.plot;
-%% Example 4: SignalObj Mathematical Operations
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-figure
-s2=mean(s); %mean of each dimension;
-s5=s-s2; %zero mean version of s;
-s5.plot;
-
-figure
-s2=mean(s,2); %mean of s across its dimensions;
-s2.plot;
-
-%%
-% SignalObj's can be added, subtracted, and multiplied.\
-figure
-s4=2*s+s5;
-s4.plot;
-
-figure
-subplot(3,1,1);
-s.integral.plot;
-subplot(3,1,2);
-s.derivative.plot;
-subplot(3,1,3);
-s6=s.integral.derivative-s; %should equal zero;
-s6.plot;
-
-%% Example 5: Spectra
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-figure;
-s.MTMspectrum;
-
-figure
-s.periodogram;
-
-%% Example 6: View signal variability
-% We can look at the variability of signals with regards to their labels or
-% or irrespective of their labels. Lets create a SignalObj that has several
-% components, and some noise. We mislabel two signals to add alot of
-% variability for illustration
-sampleRate=5000; t=0:1/sampleRate:1; t=t'; freq=2;
-v1=sin(2*pi*freq*t); v2=sin(v1.^2);
-noise=.1*randn(length(t),6); %gaussian random noise
-data= [v1 v2 v2 v1 v2 v1] + noise;
-s=SignalObj(t,data,'Voltage','time','s','V',{'v1','v2','v2','v1','v1','v2'});
-figure;
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s.plotAllVariability; %disregards labels;
-s.plotVariability; %creates two figures, one for 'v1' and one for 'v2'
-
-%%
-%plotAllVariability assumes that all the data can be considered together.
-%It also allows more custimization of the plotting properties.
-%Example we can specify a different faceColor by passing the color in the
-%same format as plot. Assymetric confidence intervals can be specified. If
-%the CIs are single numbers, they specify the multiple of the standard
-%deviations to use (default is 1). If they are the same length as the
-%SignalObj, then it specifies the actual values above and/or below the mean
-%at each point in time. If ciLower is not specifed, it is assumed to equal
-%ciUpper. For convinience the inputs to plotAllVariability are:
-%s.plotAllVariability(sObj,faceColor,linewidth,ciUpper,ciLower)
-
-s.plotAllVariability('b'); %blue color for CI patch;
-s.plotAllVariability('g',2); %green color and lineWidth=2;
-s.plotAllVariability('c',3,2,1);%cyan,
diff --git a/helpfiles/SignalObjExamples.html b/helpfiles/SignalObjExamples.html
deleted file mode 100644
index 8279a31c..00000000
--- a/helpfiles/SignalObjExamples.html
+++ /dev/null
@@ -1,325 +0,0 @@
-
-
-
-
- Using the SignalObj Class
Using the SignalObj Class
In this file we will give several examples of how the SignalObj can be used. A description of all of the properties of SignalObj can be found at: SignalObj Class Definition
Define a two dimensional SignalObj, , representing two voltage signals that were and aquired simultaneously at 100Hz. Another SignalObj, , is created from just . Both signals are plotted.
Note how the legend show the appropriate labels. If the dataLabels had not been set, the legend would not appear.
Instead of defining a new SignalObj, , the data in can be masked away and then the plot will only show the data of interest. It is important to note that setMask is used to set which signals should remain visible. Also note that when a data is masked, converting the SignalObj to a Matrix only returns the visible data. A new SignalObj can be created from the orignal SignalObj which only contains the data of interest. Lastly, the all labeled components can be accessed independently via the vars subfield.
Note about repeated dataLabels It is possible to use SignalObj's to store different realizations of the same physical signal. For example, independent measurements of at two distinct experiments.
s=SignalObj(t,[v1; v1; v2] ,'Voltage','time','s','V',{'v1','v1','v2'});
-s.getSubSignal({'v1'}); %returns a SignalObj with both realizations of v1
-figure
-s.getSubSignal({'v1'}).plot;
-
figure
-subplot(2,1,1); s.setDataLabels({'r1','r2'}); s.setYLabel('Temperature'); s.setYUnits('C'); s.plot;
-subplot(2,1,2); s.setMaxTime(14); s.setMinTime(-2); s.plot;
-
-s.setName('testName'); %should work since we are using a method
-if(strcmp(s.name,'testName'))
- fprintf('Name successfully set \n');
-else
- fprintf('Could not set name \n');
-end
-% s.name = 'testName'; %returns an error because the field is private;
-
Name successfully set
-
setMaxTime and setMinTime can be given a second parameter, holdVals, that determines whether the endpoint values are kept or set to zero if the times being set are outside the original window of the data.
Plotting properties for individual components of the data can be set via the when plotting or by call the setPlotProps method.
s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-figure
-s2=mean(s); %mean of each dimension;
-s5=s-s2; %zero mean version of s;
-s5.plot;
-
-figure
-s2=mean(s,2); %mean of s across its dimensions;
-s2.plot;
-
SignalObj's can be added, subtracted, and multiplied.\
We can look at the variability of signals with regards to their labels or or irrespective of their labels. Lets create a SignalObj that has several components, and some noise. We mislabel two signals to add alot of variability for illustration
sampleRate=5000; t=0:1/sampleRate:1; t=t'; freq=2;
-v1=sin(2*pi*freq*t); v2=sin(v1.^2);
-noise=.1*randn(length(t),6); %gaussian random noise
-data= [v1 v2 v2 v1 v2 v1] + noise;
-s=SignalObj(t,data,'Voltage','time','s','V',{'v1','v2','v2','v1','v1','v2'});
-figure;
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s.plotAllVariability; %disregards labels;
-s.plotVariability; %creates two figures, one for 'v1' and one for 'v2'
-
sObj.plotAllVariability assumes that all the data can be considered together. It also allows more custimization of the plotting properties. Example we can specify a different faceColor by passing the color in the same format as plot. Assymetric confidence intervals can be specified. If the CIs are single numbers, they specify the multiple of the standard deviations to use (default is 1). If they are the same length as the SignalObj, then it specifies the actual values above and/or below the mean at each point in time. If ciLower is not specifed, it is assumed to equal ciUpper. For convinience the inputs to plotAllVariability are: s.plotAllVariability(sObj,faceColor,linewidth,ciUpper,ciLower)
figure;
-%blue color for CI patch;
-subplot(3,1,1); s.plotAllVariability('b');
-%green color and lineWidth=2;
-subplot(3,1,2); s.plotAllVariability('g',2);
-%cyan, lineWidth=3, 2*std for top CI, and 1*std for bottom CI
-subplot(3,1,3); s.plotAllVariability('c',3,2,1);
-
- Published with MATLAB® 7.13
\ No newline at end of file
diff --git a/helpfiles/SignalObjExamples.m b/helpfiles/SignalObjExamples.m
deleted file mode 100644
index 22343267..00000000
--- a/helpfiles/SignalObjExamples.m
+++ /dev/null
@@ -1,162 +0,0 @@
-%% Using the SignalObj Class
-% In this file we will give several examples of how the SignalObj can be
-% used. A description of all of the properties of SignalObj can be found
-% at:
-
-
-%% Example 1: Defining and Plotting Signals
-% Define a two dimensional SignalObj, $s$, representing two voltage signals that were
-% $v1$ and $v2$ aquired simultaneously at 100Hz. Another SignalObj, $s1$ ,
-% is created from just $v1$. Both signals are plotted.
-close all;
-sampleRate=100; t=0:1/sampleRate:10; freq=2;
-v1=sin(2*pi*freq*t); v2=sin(v1.^2); v=[v1;v2];
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-s1=SignalObj(t,v1,'Voltage','time','s','V',{'v1'});
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s1.plot;
-
-%%
-% Note how the legend show the appropriate labels. If the dataLabels had
-% not been set, the legend would not appear.
-%
-% Instead of defining a new SignalObj, $s1$, the $v2$ data in $s$ can be
-% masked away and then the plot will only show the data of interest. It is
-% important to note that setMask is used to set which signals should remain
-% visible. Also note that when a data is masked, converting the SignalObj
-% to a Matrix only returns the visible data. A new SignalObj can be
-% created from the orignal SignalObj which only contains the data of interest.
-% Lastly, the all labeled components can be accessed independently via the
-% vars subfield.
-
-subplot(2,1,1); s.setMask({'v1'}); s.plot; s.resetMask;
-subplot(2,1,2); s.setMask({'v2'}); s.plot; size(s.dataToMatrix)
-s.resetMask;
-
-
-%%
-% _Note about repeated dataLabels_
-% It is possible to use SignalObj's to store different realizations of the
-% same physical signal. For example, independent measurements of
-% $v1$ at two distinct experiments.
-s=SignalObj(t,[v1; v1; v2] ,'Voltage','time','s','V',{'v1','v1','v2'});
-s.getSubSignal({'v1'}); %returns a SignalObj with both realizations of v1
-figure
-s.getSubSignal({'v1'}).plot;
-
-%% Example 2: Changing Signal Properties
-figure
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s.setXlabel('distance'); s.setXUnits('cm'); s.plot;
-
-%%
-figure
-subplot(2,1,1); s.setDataLabels({'r1','r2'}); s.setYLabel('Temperature'); s.setYUnits('C'); s.plot;
-subplot(2,1,2); s.setMaxTime(14); s.setMinTime(-2); s.plot;
-
-s.setName('testName'); %should work since we are using a method
-if(strcmp(s.name,'testName'))
- fprintf('Name successfully set \n');
-else
- fprintf('Could not set name \n');
-end
-% s.name = 'testName'; %returns an error because the field is private;
-
-%%
-% setMaxTime and setMinTime can be given a second parameter, holdVals, that
-% determines whether the endpoint values are kept or set to zero if the
-% times being set are outside the original window of the data.
-%
-% Plotting properties for individual components of the data can be set via
-% the when plotting or by call the setPlotProps method.
-
-figure
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-subplot(2,1,1); s.plot('v1',{{' ''k'' '}});
-subplot(2,1,2); s.plot('all',{{' ''k'' '},{' ''-.g'' '}});
-
-%%
-figure
-subplot(2,1,1); s.plot({'v1','v2'});
-subplot(2,1,2); s.plot({'v1','v2'},{{' ''k'' '},{' ''-.g'' '}});
-
-%% Example 3: Resampling and Windowing SignalObjs
-figure
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-s1=s.resample(.1*sampleRate);
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s1.plot;
-
-%%
-figure
-subplot(2,1,1); s.getSigInTimeWindow(-2,3).plot;
-subplot(2,1,2); s.plot;
-%% Example 4: SignalObj Mathematical Operations
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-figure
-s2=mean(s); %mean of each dimension;
-s5=s-s2; %zero mean version of s;
-s5.plot;
-
-figure
-s2=mean(s,2); %mean of s across its dimensions;
-s2.plot;
-
-%%
-% SignalObj's can be added, subtracted, and multiplied.\
-figure
-s4=2*s+s5;
-s4.plot;
-
-figure
-subplot(3,1,1);
-s.integral.plot;
-subplot(3,1,2);
-s.derivative.plot;
-subplot(3,1,3);
-s6=s.integral.derivative-s; %should equal zero;
-s6.plot;
-
-%% Example 5: Spectra
-s=SignalObj(t,v,'Voltage','time','s','V',{'v1','v2'});
-figure;
-s.MTMspectrum;
-
-figure
-s.periodogram;
-
-%% Example 6: View signal variability
-% We can look at the variability of signals with regards to their labels or
-% or irrespective of their labels. Lets create a SignalObj that has several
-% components, and some noise. We mislabel two signals to add alot of
-% variability for illustration
-sampleRate=5000; t=0:1/sampleRate:1; t=t'; freq=2;
-v1=sin(2*pi*freq*t); v2=sin(v1.^2);
-noise=.1*randn(length(t),6); %gaussian random noise
-data= [v1 v2 v2 v1 v2 v1] + noise;
-s=SignalObj(t,data,'Voltage','time','s','V',{'v1','v2','v2','v1','v1','v2'});
-figure;
-subplot(2,1,1); s.plot;
-subplot(2,1,2); s.plotAllVariability; %disregards labels;
-s.plotVariability; %creates two figures, one for 'v1' and one for 'v2'
-
-%%
-% sObj.plotAllVariability assumes that all the data can be considered together.
-% It also allows more custimization of the plotting properties.
-% Example we can specify a different faceColor by passing the color in the
-% same format as plot. Assymetric confidence intervals can be specified. If
-% the CIs are single numbers, they specify the multiple of the standard
-% deviations to use (default is 1). If they are the same length as the
-% SignalObj, then it specifies the actual values above and/or below the mean
-% at each point in time. If ciLower is not specifed, it is assumed to equal
-% ciUpper. For convinience the inputs to plotAllVariability are:
-% s.plotAllVariability(sObj,faceColor,linewidth,ciUpper,ciLower)
-figure;
-%blue color for CI patch;
-subplot(3,1,1); s.plotAllVariability('b');
-%green color and lineWidth=2;
-subplot(3,1,2); s.plotAllVariability('g',2);
-%cyan, lineWidth=3, 2*std for top CI, and 1*std for bottom CI
-subplot(3,1,3); s.plotAllVariability('c',3,2,1);
-
diff --git a/helpfiles/SignalObjExamples.png b/helpfiles/SignalObjExamples.png
deleted file mode 100644
index 5cccdce0..00000000
Binary files a/helpfiles/SignalObjExamples.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_01.png b/helpfiles/SignalObjExamples_01.png
deleted file mode 100644
index d9fdf71a..00000000
Binary files a/helpfiles/SignalObjExamples_01.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_02.png b/helpfiles/SignalObjExamples_02.png
deleted file mode 100644
index ec65ee57..00000000
Binary files a/helpfiles/SignalObjExamples_02.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_03.png b/helpfiles/SignalObjExamples_03.png
deleted file mode 100644
index 2bca2948..00000000
Binary files a/helpfiles/SignalObjExamples_03.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_04.png b/helpfiles/SignalObjExamples_04.png
deleted file mode 100644
index fc15a7f0..00000000
Binary files a/helpfiles/SignalObjExamples_04.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_05.png b/helpfiles/SignalObjExamples_05.png
deleted file mode 100644
index 7f10bdd6..00000000
Binary files a/helpfiles/SignalObjExamples_05.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_06.png b/helpfiles/SignalObjExamples_06.png
deleted file mode 100644
index 8f18fbf2..00000000
Binary files a/helpfiles/SignalObjExamples_06.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_07.png b/helpfiles/SignalObjExamples_07.png
deleted file mode 100644
index 37cbd109..00000000
Binary files a/helpfiles/SignalObjExamples_07.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_08.png b/helpfiles/SignalObjExamples_08.png
deleted file mode 100644
index 1a169f0f..00000000
Binary files a/helpfiles/SignalObjExamples_08.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_09.png b/helpfiles/SignalObjExamples_09.png
deleted file mode 100644
index 6e826198..00000000
Binary files a/helpfiles/SignalObjExamples_09.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_10.png b/helpfiles/SignalObjExamples_10.png
deleted file mode 100644
index 6a5ff9f3..00000000
Binary files a/helpfiles/SignalObjExamples_10.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_11.png b/helpfiles/SignalObjExamples_11.png
deleted file mode 100644
index 033dba6e..00000000
Binary files a/helpfiles/SignalObjExamples_11.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_12.png b/helpfiles/SignalObjExamples_12.png
deleted file mode 100644
index 0193d3e2..00000000
Binary files a/helpfiles/SignalObjExamples_12.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_13.png b/helpfiles/SignalObjExamples_13.png
deleted file mode 100644
index 6dd0e3a0..00000000
Binary files a/helpfiles/SignalObjExamples_13.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_14.png b/helpfiles/SignalObjExamples_14.png
deleted file mode 100644
index af99c751..00000000
Binary files a/helpfiles/SignalObjExamples_14.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_15.png b/helpfiles/SignalObjExamples_15.png
deleted file mode 100644
index b614e134..00000000
Binary files a/helpfiles/SignalObjExamples_15.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_16.png b/helpfiles/SignalObjExamples_16.png
deleted file mode 100644
index d33e38a6..00000000
Binary files a/helpfiles/SignalObjExamples_16.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_17.png b/helpfiles/SignalObjExamples_17.png
deleted file mode 100644
index 9207998d..00000000
Binary files a/helpfiles/SignalObjExamples_17.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq03690.png b/helpfiles/SignalObjExamples_eq03690.png
deleted file mode 100644
index 4b381288..00000000
Binary files a/helpfiles/SignalObjExamples_eq03690.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq14139.png b/helpfiles/SignalObjExamples_eq14139.png
deleted file mode 100644
index e5f70104..00000000
Binary files a/helpfiles/SignalObjExamples_eq14139.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq34998.png b/helpfiles/SignalObjExamples_eq34998.png
deleted file mode 100644
index 3a2377fe..00000000
Binary files a/helpfiles/SignalObjExamples_eq34998.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq40692.png b/helpfiles/SignalObjExamples_eq40692.png
deleted file mode 100644
index a68903e1..00000000
Binary files a/helpfiles/SignalObjExamples_eq40692.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq57658.png b/helpfiles/SignalObjExamples_eq57658.png
deleted file mode 100644
index c41ae2ac..00000000
Binary files a/helpfiles/SignalObjExamples_eq57658.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq68144.png b/helpfiles/SignalObjExamples_eq68144.png
deleted file mode 100644
index e96626fd..00000000
Binary files a/helpfiles/SignalObjExamples_eq68144.png and /dev/null differ
diff --git a/helpfiles/SignalObjExamples_eq72999.png b/helpfiles/SignalObjExamples_eq72999.png
deleted file mode 100644
index 326db91b..00000000
Binary files a/helpfiles/SignalObjExamples_eq72999.png and /dev/null differ
diff --git a/helpfiles/SimulatedNetwork2.mdl b/helpfiles/SimulatedNetwork2.mdl
deleted file mode 100644
index 7c4d2a4a..00000000
--- a/helpfiles/SimulatedNetwork2.mdl
+++ /dev/null
@@ -1,2220 +0,0 @@
-Model {
- Name "SimulatedNetwork2"
- Version 8.2
- MdlSubVersion 0
- SavedCharacterEncoding "ISO-8859-1"
- GraphicalInterface {
- NumRootInports 1
- Inport {
- BusObject ""
- SignalName "input"
- Name "Stimulus"
- }
- NumRootOutports 2
- Outport {
- BusObject ""
- BusOutputAsStruct "off"
- Name "pp"
- }
- Outport {
- BusObject ""
- BusOutputAsStruct "off"
- Name "pp1"
- }
- ParameterArgumentNames ""
- ComputedModelVersion "1.32"
- NumModelReferences 0
- NumTestPointedSignals 0
- }
- SaveDefaultBlockParams on
- ScopeRefreshTime 0.035000
- OverrideScopeRefreshTime on
- DisableAllScopes off
- DataTypeOverride "UseLocalSettings"
- DataTypeOverrideAppliesTo "AllNumericTypes"
- MinMaxOverflowLogging "UseLocalSettings"
- MinMaxOverflowArchiveMode "Overwrite"
- FPTRunName "Run 1"
- MaxMDLFileLineLength 120
- Object {
- $PropName "BdWindowsInfo"
- $ObjectID 1
- $ClassName "Simulink.BDWindowsInfo"
- Array {
- Type "Simulink.WindowInfo"
- Dimension 2
- Object {
- $ObjectID 2
- IsActive [0]
- Location [276.0, 77.0, 1083.0, 601.0]
- Object {
- $PropName "ModelBrowserInfo"
- $ObjectID 3
- $ClassName "Simulink.ModelBrowserInfo"
- Visible [0]
- DockPosition "Left"
- Width [50]
- Height [50]
- Filter [10]
- }
- Object {
- $PropName "ExplorerBarInfo"
- $ObjectID 4
- $ClassName "Simulink.ExplorerBarInfo"
- Visible [1]
- }
- Object {
- $PropName "EditorsInfo"
- $ObjectID 5
- $ClassName "Simulink.EditorInfo"
- IsActive [1]
- ViewObjType "SimulinkSubsys"
- LoadSaveID "45"
- Extents [1049.0, 431.0]
- ZoomFactor [1.0]
- Offset [0.0, 0.0]
- }
- }
- Object {
- $ObjectID 6
- IsActive [1]
- Location [8.0, 142.0, 1636.0, 1028.0]
- Object {
- $PropName "ModelBrowserInfo"
- $ObjectID 7
- $ClassName "Simulink.ModelBrowserInfo"
- Visible [0]
- DockPosition "Left"
- Width [50]
- Height [50]
- Filter [10]
- }
- Object {
- $PropName "ExplorerBarInfo"
- $ObjectID 8
- $ClassName "Simulink.ExplorerBarInfo"
- Visible [1]
- }
- Object {
- $PropName "EditorsInfo"
- $ObjectID 9
- $ClassName "Simulink.EditorInfo"
- IsActive [1]
- ViewObjType "SimulinkTopLevel"
- LoadSaveID "0"
- Extents [1602.0, 858.0]
- ZoomFactor [1.0]
- Offset [0.0, 0.0]
- }
- }
- PropName "WindowsInfo"
- }
- }
- Created "Tue Feb 08 12:34:27 2011"
- Creator "Developer"
- UpdateHistory "UpdateHistoryNever"
- ModifiedByFormat "%"
- LastModifiedBy "iahncajigas"
- ModifiedDateFormat "%"
- LastModifiedDate "Mon Feb 10 13:14:16 2014"
- RTWModifiedTimeStamp 230568673
- ModelVersionFormat "1.%"
- ConfigurationManager "none"
- SampleTimeColors off
- SampleTimeAnnotations off
- LibraryLinkDisplay "none"
- WideLines off
- ShowLineDimensions off
- ShowPortDataTypes off
- ShowDesignRanges off
- ShowLoopsOnError on
- IgnoreBidirectionalLines off
- ShowStorageClass off
- ShowTestPointIcons on
- ShowSignalResolutionIcons on
- ShowViewerIcons on
- SortedOrder off
- ExecutionContextIcon off
- ShowLinearizationAnnotations on
- BlockNameDataTip off
- BlockParametersDataTip off
- BlockDescriptionStringDataTip off
- ToolBar on
- StatusBar on
- BrowserShowLibraryLinks off
- BrowserLookUnderMasks off
- SimulationMode "normal"
- PauseTimes "5"
- NumberOfSteps 1
- SnapshotBufferSize 10
- SnapshotInterval 10
- NumberOfLastSnapshots 0
- LinearizationMsg "none"
- Profile off
- ParamWorkspaceSource "MATLABWorkspace"
- AccelSystemTargetFile "accel.tlc"
- AccelTemplateMakefile "accel_default_tmf"
- AccelMakeCommand "make_rtw"
- TryForcingSFcnDF off
- Object {
- $PropName "DataLoggingOverride"
- $ObjectID 10
- $ClassName "Simulink.SimulationData.ModelLoggingInfo"
- model_ "SimulatedNetwork2"
- Array {
- Type "Cell"
- Dimension 1
- Cell "SimulatedNetwork2"
- PropName "logAsSpecifiedByModels_"
- }
- Array {
- Type "Cell"
- Dimension 1
- Cell ""
- PropName "logAsSpecifiedByModelsSSIDs_"
- }
- }
- RecordCoverage off
- CovPath "/"
- CovSaveName "covdata"
- CovMetricSettings "dw"
- CovNameIncrementing off
- CovHtmlReporting on
- CovForceBlockReductionOff on
- CovEnableCumulative on
- covSaveCumulativeToWorkspaceVar on
- CovSaveSingleToWorkspaceVar on
- CovCumulativeVarName "covCumulativeData"
- CovCumulativeReport off
- CovReportOnPause on
- CovModelRefEnable "Off"
- CovExternalEMLEnable off
- ExtModeBatchMode off
- ExtModeEnableFloating on
- ExtModeTrigType "manual"
- ExtModeTrigMode "normal"
- ExtModeTrigPort "1"
- ExtModeTrigElement "any"
- ExtModeTrigDuration 1000
- ExtModeTrigDurationFloating "auto"
- ExtModeTrigHoldOff 0
- ExtModeTrigDelay 0
- ExtModeTrigDirection "rising"
- ExtModeTrigLevel 0
- ExtModeArchiveMode "off"
- ExtModeAutoIncOneShot off
- ExtModeIncDirWhenArm off
- ExtModeAddSuffixToVar off
- ExtModeWriteAllDataToWs off
- ExtModeArmWhenConnect on
- ExtModeSkipDownloadWhenConnect off
- ExtModeLogAll on
- ExtModeAutoUpdateStatusClock on
- BufferReuse on
- ShowModelReferenceBlockVersion off
- ShowModelReferenceBlockIO off
- Array {
- Type "Handle"
- Dimension 1
- Simulink.ConfigSet {
- $ObjectID 11
- Version "1.13.1"
- Array {
- Type "Handle"
- Dimension 8
- Simulink.SolverCC {
- $ObjectID 12
- Version "1.13.1"
- StartTime "0.0"
- StopTime "10"
- AbsTol "auto"
- FixedStep "Ts"
- InitialStep "auto"
- MaxNumMinSteps "-1"
- MaxOrder 5
- ZcThreshold "auto"
- ConsecutiveZCsStepRelTol "10*128*eps"
- MaxConsecutiveZCs "1000"
- ExtrapolationOrder 4
- NumberNewtonIterations 1
- MaxStep "auto"
- MinStep "auto"
- MaxConsecutiveMinStep "1"
- RelTol "1e-3"
- SolverMode "Auto"
- EnableConcurrentExecution off
- ConcurrentTasks off
- Solver "FixedStepDiscrete"
- SolverName "FixedStepDiscrete"
- SolverJacobianMethodControl "auto"
- ShapePreserveControl "DisableAll"
- ZeroCrossControl "UseLocalSettings"
- ZeroCrossAlgorithm "Nonadaptive"
- AlgebraicLoopSolver "TrustRegion"
- SolverResetMethod "Fast"
- PositivePriorityOrder off
- AutoInsertRateTranBlk off
- SampleTimeConstraint "Unconstrained"
- InsertRTBMode "Whenever possible"
- }
- Simulink.DataIOCC {
- $ObjectID 13
- Version "1.13.1"
- Decimation "1"
- ExternalInput "[t, u]"
- FinalStateName "xFinal"
- InitialState "xInitial"
- LimitDataPoints on
- MaxDataPoints "1000"
- LoadExternalInput off
- LoadInitialState off
- SaveFinalState off
- SaveCompleteFinalSimState off
- SaveFormat "Array"
- SignalLoggingSaveFormat "ModelDataLogs"
- SaveOutput on
- SaveState off
- SignalLogging on
- DSMLogging on
- InspectSignalLogs off
- SaveTime on
- ReturnWorkspaceOutputs off
- StateSaveName "xout"
- TimeSaveName "tout"
- OutputSaveName "yout"
- SignalLoggingName "logsout"
- DSMLoggingName "dsmout"
- OutputOption "RefineOutputTimes"
- OutputTimes "[]"
- ReturnWorkspaceOutputsName "out"
- Refine "1"
- }
- Simulink.OptimizationCC {
- $ObjectID 14
- Version "1.13.1"
- Array {
- Type "Cell"
- Dimension 8
- Cell "BooleansAsBitfields"
- Cell "PassReuseOutputArgsAs"
- Cell "PassReuseOutputArgsThreshold"
- Cell "ZeroExternalMemoryAtStartup"
- Cell "ZeroInternalMemoryAtStartup"
- Cell "OptimizeModelRefInitCode"
- Cell "NoFixptDivByZeroProtection"
- Cell "UseSpecifiedMinMax"
- PropName "DisabledProps"
- }
- BlockReduction on
- BooleanDataType on
- ConditionallyExecuteInputs on
- InlineParams off
- UseIntDivNetSlope off
- UseFloatMulNetSlope off
- DefaultUnderspecifiedDataType "double"
- UseSpecifiedMinMax off
- InlineInvariantSignals off
- OptimizeBlockIOStorage on
- BufferReuse on
- EnhancedBackFolding off
- StrengthReduction off
- ExpressionFolding on
- BooleansAsBitfields off
- BitfieldContainerType "uint_T"
- EnableMemcpy on
- MemcpyThreshold 64
- PassReuseOutputArgsAs "Structure reference"
- ExpressionDepthLimit 2147483647
- FoldNonRolledExpr on
- LocalBlockOutputs on
- RollThreshold 5
- SystemCodeInlineAuto off
- StateBitsets off
- DataBitsets off
- ActiveStateOutputEnumStorageType "Native Integer"
- UseTempVars off
- ZeroExternalMemoryAtStartup on
- ZeroInternalMemoryAtStartup on
- InitFltsAndDblsToZero off
- NoFixptDivByZeroProtection off
- EfficientFloat2IntCast off
- EfficientMapNaN2IntZero on
- OptimizeModelRefInitCode off
- LifeSpan "inf"
- MaxStackSize "Inherit from target"
- BufferReusableBoundary on
- SimCompilerOptimization "Off"
- AccelVerboseBuild off
- ParallelExecutionInRapidAccelerator on
- }
- Simulink.DebuggingCC {
- $ObjectID 15
- Version "1.13.1"
- RTPrefix "error"
- ConsistencyChecking "none"
- ArrayBoundsChecking "none"
- SignalInfNanChecking "none"
- SignalRangeChecking "none"
- ReadBeforeWriteMsg "UseLocalSettings"
- WriteAfterWriteMsg "UseLocalSettings"
- WriteAfterReadMsg "UseLocalSettings"
- AlgebraicLoopMsg "warning"
- ArtificialAlgebraicLoopMsg "warning"
- SaveWithDisabledLinksMsg "warning"
- SaveWithParameterizedLinksMsg "warning"
- CheckSSInitialOutputMsg on
- UnderspecifiedInitializationDetection "Classic"
- MergeDetectMultiDrivingBlocksExec "none"
- CheckExecutionContextPreStartOutputMsg off
- CheckExecutionContextRuntimeOutputMsg off
- SignalResolutionControl "UseLocalSettings"
- BlockPriorityViolationMsg "warning"
- MinStepSizeMsg "warning"
- TimeAdjustmentMsg "none"
- MaxConsecutiveZCsMsg "error"
- MaskedZcDiagnostic "warning"
- IgnoredZcDiagnostic "warning"
- SolverPrmCheckMsg "warning"
- InheritedTsInSrcMsg "warning"
- DiscreteInheritContinuousMsg "warning"
- MultiTaskDSMMsg "error"
- MultiTaskCondExecSysMsg "error"
- MultiTaskRateTransMsg "error"
- SingleTaskRateTransMsg "none"
- TasksWithSamePriorityMsg "warning"
- SigSpecEnsureSampleTimeMsg "warning"
- CheckMatrixSingularityMsg "none"
- IntegerOverflowMsg "warning"
- Int32ToFloatConvMsg "warning"
- ParameterDowncastMsg "error"
- ParameterOverflowMsg "error"
- ParameterUnderflowMsg "none"
- ParameterPrecisionLossMsg "warning"
- ParameterTunabilityLossMsg "warning"
- FixptConstUnderflowMsg "none"
- FixptConstOverflowMsg "none"
- FixptConstPrecisionLossMsg "none"
- UnderSpecifiedDataTypeMsg "none"
- UnnecessaryDatatypeConvMsg "none"
- VectorMatrixConversionMsg "none"
- InvalidFcnCallConnMsg "error"
- FcnCallInpInsideContextMsg "UseLocalSettings"
- SignalLabelMismatchMsg "none"
- UnconnectedInputMsg "warning"
- UnconnectedOutputMsg "warning"
- UnconnectedLineMsg "warning"
- SFcnCompatibilityMsg "none"
- FrameProcessingCompatibilityMsg "warning"
- UniqueDataStoreMsg "none"
- BusObjectLabelMismatch "warning"
- RootOutportRequireBusObject "warning"
- AssertControl "UseLocalSettings"
- EnableOverflowDetection off
- ModelReferenceIOMsg "none"
- ModelReferenceMultiInstanceNormalModeStructChecksumCheck "error"
- ModelReferenceVersionMismatchMessage "none"
- ModelReferenceIOMismatchMessage "none"
- ModelReferenceCSMismatchMessage "none"
- UnknownTsInhSupMsg "warning"
- ModelReferenceDataLoggingMessage "warning"
- ModelReferenceSymbolNameMessage "warning"
- ModelReferenceExtraNoncontSigs "error"
- StateNameClashWarn "warning"
- SimStateInterfaceChecksumMismatchMsg "warning"
- SimStateOlderReleaseMsg "error"
- InitInArrayFormatMsg "warning"
- StrictBusMsg "ErrorLevel1"
- BusNameAdapt "WarnAndRepair"
- NonBusSignalsTreatedAsBus "none"
- LoggingUnavailableSignals "error"
- BlockIODiagnostic "none"
- SFUnusedDataAndEventsDiag "warning"
- SFUnexpectedBacktrackingDiag "warning"
- SFInvalidInputDataAccessInChartInitDiag "warning"
- SFNoUnconditionalDefaultTransitionDiag "warning"
- SFTransitionOutsideNaturalParentDiag "warning"
- SFUnconditionalTransitionShadowingDiag "warning"
- SFUndirectedBroadcastEventsDiag "warning"
- SFTransitionActionBeforeConditionDiag "warning"
- }
- Simulink.HardwareCC {
- $ObjectID 16
- Version "1.13.1"
- ProdBitPerChar 8
- ProdBitPerShort 16
- ProdBitPerInt 32
- ProdBitPerLong 32
- ProdBitPerLongLong 64
- ProdBitPerFloat 32
- ProdBitPerDouble 64
- ProdBitPerPointer 32
- ProdLargestAtomicInteger "Char"
- ProdLargestAtomicFloat "None"
- ProdIntDivRoundTo "Undefined"
- ProdEndianess "Unspecified"
- ProdWordSize 32
- ProdShiftRightIntArith on
- ProdLongLongMode off
- ProdHWDeviceType "32-bit Generic"
- TargetBitPerChar 8
- TargetBitPerShort 16
- TargetBitPerInt 32
- TargetBitPerLong 64
- TargetBitPerLongLong 64
- TargetBitPerFloat 32
- TargetBitPerDouble 64
- TargetBitPerPointer 64
- TargetLargestAtomicInteger "Char"
- TargetLargestAtomicFloat "None"
- TargetShiftRightIntArith on
- TargetLongLongMode on
- TargetIntDivRoundTo "Zero"
- TargetEndianess "LittleEndian"
- TargetWordSize 64
- TargetTypeEmulationWarnSuppressLevel 0
- TargetPreprocMaxBitsSint 32
- TargetPreprocMaxBitsUint 32
- TargetHWDeviceType "MATLAB Host"
- TargetUnknown off
- ProdEqTarget off
- }
- Simulink.ModelReferenceCC {
- $ObjectID 17
- Version "1.13.1"
- UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange"
- CheckModelReferenceTargetMessage "error"
- EnableParallelModelReferenceBuilds off
- ParallelModelReferenceErrorOnInvalidPool on
- ParallelModelReferenceMATLABWorkerInit "None"
- ModelReferenceNumInstancesAllowed "Multi"
- PropagateVarSize "Infer from blocks in model"
- ModelReferencePassRootInputsByReference on
- ModelReferenceMinAlgLoopOccurrences off
- PropagateSignalLabelsOutOfModel off
- SupportModelReferenceSimTargetCustomCode off
- }
- Simulink.SFSimCC {
- $ObjectID 18
- Version "1.13.1"
- SFSimEnableDebug on
- SFSimOverflowDetection on
- SFSimEcho on
- SimBlas on
- SimCtrlC on
- SimExtrinsic on
- SimIntegrity on
- SimUseLocalCustomCode off
- SimParseCustomCode on
- SimBuildMode "sf_incremental_build"
- SimGenImportedTypeDefs off
- }
- Simulink.RTWCC {
- $BackupClass "Simulink.RTWCC"
- $ObjectID 19
- Version "1.13.1"
- Array {
- Type "Cell"
- Dimension 7
- Cell "IncludeHyperlinkInReport"
- Cell "GenerateTraceInfo"
- Cell "GenerateTraceReport"
- Cell "GenerateTraceReportSl"
- Cell "GenerateTraceReportSf"
- Cell "GenerateTraceReportEml"
- Cell "GenerateSLWebview"
- PropName "DisabledProps"
- }
- SystemTargetFile "grt.tlc"
- TLCOptions ""
- GenCodeOnly off
- MakeCommand "make_rtw"
- GenerateMakefile on
- PackageGeneratedCodeAndArtifacts off
- PackageName ""
- TemplateMakefile "grt_default_tmf"
- PostCodeGenCommand ""
- Description "Generic Real-Time Target"
- GenerateReport off
- SaveLog off
- RTWVerbose on
- RetainRTWFile off
- ProfileTLC off
- TLCDebug off
- TLCCoverage off
- TLCAssert off
- ProcessScriptMode "Default"
- ConfigurationMode "Optimized"
- ProcessScript "grt_make_rtw_hook"
- ConfigurationScript ""
- ConfigAtBuild off
- RTWUseLocalCustomCode off
- RTWUseSimCustomCode off
- CustomSourceCode ""
- CustomHeaderCode ""
- CustomInclude ""
- CustomSource ""
- CustomLibrary ""
- CustomInitializer ""
- CustomTerminator ""
- Toolchain "Automatically locate an installed toolchain"
- BuildConfiguration "Faster Builds"
- IncludeHyperlinkInReport off
- LaunchReport off
- PortableWordSizes off
- GenerateErtSFunction off
- CreateSILPILBlock "None"
- CodeExecutionProfiling off
- CodeExecutionProfileVariable "executionProfile"
- CodeProfilingSaveOptions "SummaryOnly"
- CodeProfilingInstrumentation off
- SILDebugging off
- TargetLang "C"
- IncludeBusHierarchyInRTWFileBlockHierarchyMap off
- IncludeERTFirstTime off
- GenerateTraceInfo off
- GenerateTraceReport off
- GenerateTraceReportSl off
- GenerateTraceReportSf off
- GenerateTraceReportEml off
- GenerateCodeInfo off
- GenerateWebview off
- GenerateCodeMetricsReport off
- GenerateCodeReplacementReport off
- RTWCompilerOptimization "On"
- RTWCustomCompilerOptimizations ""
- CheckMdlBeforeBuild "Off"
- CustomRebuildMode "OnUpdate"
- DataInitializer ""
- SharedConstantsCachingThreshold 1024
- Array {
- Type "Handle"
- Dimension 2
- Simulink.CodeAppCC {
- $ObjectID 20
- Version "1.13.1"
- Array {
- Type "Cell"
- Dimension 21
- Cell "IgnoreCustomStorageClasses"
- Cell "IgnoreTestpoints"
- Cell "InsertBlockDesc"
- Cell "InsertPolySpaceComments"
- Cell "SFDataObjDesc"
- Cell "MATLABFcnDesc"
- Cell "SimulinkDataObjDesc"
- Cell "DefineNamingRule"
- Cell "SignalNamingRule"
- Cell "ParamNamingRule"
- Cell "InlinedPrmAccess"
- Cell "CustomSymbolStr"
- Cell "CustomSymbolStrGlobalVar"
- Cell "CustomSymbolStrType"
- Cell "CustomSymbolStrField"
- Cell "CustomSymbolStrFcn"
- Cell "CustomSymbolStrFcnArg"
- Cell "CustomSymbolStrBlkIO"
- Cell "CustomSymbolStrTmpVar"
- Cell "CustomSymbolStrMacro"
- Cell "ReqsInCode"
- PropName "DisabledProps"
- }
- ForceParamTrailComments off
- GenerateComments on
- IgnoreCustomStorageClasses on
- IgnoreTestpoints off
- IncHierarchyInIds off
- MaxIdLength 31
- PreserveName off
- PreserveNameWithParent off
- ShowEliminatedStatement off
- OperatorAnnotations off
- IncAutoGenComments off
- SimulinkDataObjDesc off
- SFDataObjDesc off
- MATLABFcnDesc off
- IncDataTypeInIds off
- MangleLength 1
- CustomSymbolStrGlobalVar "$R$N$M"
- CustomSymbolStrType "$N$R$M_T"
- CustomSymbolStrField "$N$M"
- CustomSymbolStrFcn "$R$N$M$F"
- CustomSymbolStrFcnArg "rt$I$N$M"
- CustomSymbolStrBlkIO "rtb_$N$M"
- CustomSymbolStrTmpVar "$N$M"
- CustomSymbolStrMacro "$R$N$M"
- CustomSymbolStrUtil "$N$C"
- DefineNamingRule "None"
- ParamNamingRule "None"
- SignalNamingRule "None"
- InsertBlockDesc off
- InsertPolySpaceComments off
- SimulinkBlockComments on
- MATLABSourceComments off
- EnableCustomComments off
- InternalIdentifier "Shortened"
- InlinedPrmAccess "Literals"
- ReqsInCode off
- UseSimReservedNames off
- }
- Simulink.GRTTargetCC {
- $BackupClass "Simulink.TargetCC"
- $ObjectID 21
- Version "1.13.1"
- Array {
- Type "Cell"
- Dimension 16
- Cell "GeneratePreprocessorConditionals"
- Cell "IncludeMdlTerminateFcn"
- Cell "CombineOutputUpdateFcns"
- Cell "SuppressErrorStatus"
- Cell "ERTCustomFileBanners"
- Cell "GenerateSampleERTMain"
- Cell "GenerateTestInterfaces"
- Cell "ModelStepFunctionPrototypeControlCompliant"
- Cell "CPPClassGenCompliant"
- Cell "PortableWordSizes"
- Cell "PurelyIntegerCode"
- Cell "SupportComplex"
- Cell "SupportAbsoluteTime"
- Cell "SupportContinuousTime"
- Cell "SupportNonInlinedSFcns"
- Cell "GenerateAllocFcn"
- PropName "DisabledProps"
- }
- TargetFcnLib "ansi_tfl_table_tmw.mat"
- TargetLibSuffix ""
- TargetPreCompLibLocation ""
- CodeReplacementLibrary "ANSI_C"
- UtilityFuncGeneration "Auto"
- ERTMultiwordTypeDef "System defined"
- ERTMultiwordLength 256
- MultiwordLength 2048
- GenerateFullHeader on
- GenerateSampleERTMain off
- GenerateTestInterfaces off
- IsPILTarget off
- ModelReferenceCompliant on
- ParMdlRefBuildCompliant on
- CompOptLevelCompliant on
- ConcurrentExecutionCompliant on
- IncludeMdlTerminateFcn on
- GeneratePreprocessorConditionals "Disable all"
- CombineOutputUpdateFcns off
- CombineSignalStateStructs off
- SuppressErrorStatus off
- ERTFirstTimeCompliant off
- IncludeFileDelimiter "Auto"
- ERTCustomFileBanners off
- SupportAbsoluteTime on
- LogVarNameModifier "rt_"
- MatFileLogging on
- MultiInstanceERTCode off
- SupportNonFinite on
- SupportComplex on
- PurelyIntegerCode off
- SupportContinuousTime on
- SupportNonInlinedSFcns on
- SupportVariableSizeSignals off
- EnableShiftOperators on
- ParenthesesLevel "Nominal"
- MATLABClassNameForMDSCustomization "Simulink.SoftwareTarget.GRTCustomization"
- ModelStepFunctionPrototypeControlCompliant off
- CPPClassGenCompliant off
- AutosarCompliant off
- GRTInterface on
- GenerateAllocFcn off
- UseMalloc off
- ExtMode off
- ExtModeStaticAlloc off
- ExtModeTesting off
- ExtModeStaticAllocSize 1000000
- ExtModeTransport 0
- ExtModeMexFile "ext_comm"
- ExtModeIntrfLevel "Level1"
- RTWCAPISignals off
- RTWCAPIParams off
- RTWCAPIStates off
- RTWCAPIRootIO off
- GenerateASAP2 off
- }
- PropName "Components"
- }
- }
- PropName "Components"
- }
- Name "Configuration"
- CurrentDlgPage "Optimization"
- ConfigPrmDlgPosition [ 360, 285, 1498, 915 ]
- }
- PropName "ConfigurationSets"
- }
- Simulink.ConfigSet {
- $PropName "ActiveConfigurationSet"
- $ObjectID 11
- }
- Object {
- $PropName "DataTransfer"
- $ObjectID 22
- $ClassName "Simulink.GlobalDataTransfer"
- DefaultTransitionBetweenSyncTasks "Ensure deterministic transfer (maximum delay)"
- DefaultTransitionBetweenAsyncTasks "Ensure data integrity only"
- DefaultTransitionBetweenContTasks "Ensure deterministic transfer (minimum delay)"
- DefaultExtrapolationMethodBetweenContTasks "None"
- AutoInsertRateTranBlk [0]
- }
- ExplicitPartitioning off
- BlockDefaults {
- ForegroundColor "black"
- BackgroundColor "white"
- DropShadow off
- NamePlacement "normal"
- FontName "Helvetica"
- FontSize 10
- FontWeight "normal"
- FontAngle "normal"
- ShowName on
- BlockRotation 0
- BlockMirror off
- }
- AnnotationDefaults {
- HorizontalAlignment "center"
- VerticalAlignment "middle"
- ForegroundColor "black"
- BackgroundColor "white"
- DropShadow off
- FontName "Helvetica"
- FontSize 10
- FontWeight "normal"
- FontAngle "normal"
- UseDisplayTextAsClickCallback off
- }
- LineDefaults {
- FontName "Helvetica"
- FontSize 9
- FontWeight "normal"
- FontAngle "normal"
- }
- MaskDefaults {
- SelfModifiable "off"
- IconFrame "on"
- IconOpaque "on"
- RunInitForIconRedraw "off"
- IconRotate "none"
- PortRotate "default"
- IconUnits "autoscale"
- }
- MaskParameterDefaults {
- Evaluate "on"
- Tunable "on"
- NeverSave "off"
- Internal "off"
- ReadOnly "off"
- Enabled "on"
- Visible "on"
- ToolTip "on"
- }
- BlockParameterDefaults {
- Block {
- BlockType Constant
- Value "1"
- VectorParams1D on
- SamplingMode "Sample based"
- OutMin "[]"
- OutMax "[]"
- OutDataTypeStr "Inherit: Inherit from 'Constant value'"
- LockScale off
- SampleTime "inf"
- FramePeriod "inf"
- PreserveConstantTs off
- }
- Block {
- BlockType Delay
- DelayLengthSource "Dialog"
- DelayLength "2"
- DelayLengthUpperLimit "100"
- InitialConditionSource "Dialog"
- InitialCondition "0.0"
- ExternalReset "None"
- PreventDirectFeedthrough off
- DiagnosticForOutOfRangeDelayLength "None"
- RemoveProtectionDelayLength off
- InputProcessing "Elements as channels (sample based)"
- UseCircularBuffer off
- SampleTime "-1"
- StateMustResolveToSignalObject off
- CodeGenStateStorageClass "Auto"
- }
- Block {
- BlockType FrameConversion
- InheritSamplingMode off
- OutFrame "Frame-based"
- }
- Block {
- BlockType Inport
- Port "1"
- OutputFunctionCall off
- OutMin "[]"
- OutMax "[]"
- OutDataTypeStr "Inherit: auto"
- LockScale off
- BusOutputAsStruct off
- PortDimensions "-1"
- VarSizeSig "Inherit"
- SampleTime "-1"
- SignalType "auto"
- SamplingMode "auto"
- LatchByDelayingOutsideSignal off
- LatchInputForFeedbackSignals off
- Interpolate on
- }
- Block {
- BlockType Math
- Operator "exp"
- OutputSignalType "auto"
- SampleTime "-1"
- OutMin "[]"
- OutMax "[]"
- OutDataTypeStr "Inherit: Same as first input"
- LockScale off
- RndMeth "Floor"
- SaturateOnIntegerOverflow on
- IntermediateResultsDataTypeStr "Inherit: Inherit via internal rule"
- AlgorithmType "Newton-Raphson"
- Iterations "3"
- }
- Block {
- BlockType Outport
- Port "1"
- OutMin "[]"
- OutMax "[]"
- OutDataTypeStr "Inherit: auto"
- LockScale off
- BusOutputAsStruct off
- PortDimensions "-1"
- VarSizeSig "Inherit"
- SampleTime "-1"
- SignalType "auto"
- SamplingMode "auto"
- SourceOfInitialOutputValue "Dialog"
- OutputWhenDisabled "held"
- InitialOutput "[]"
- }
- Block {
- BlockType Product
- Inputs "2"
- Multiplication "Element-wise(.*)"
- CollapseMode "All dimensions"
- CollapseDim "1"
- InputSameDT on
- OutMin "[]"
- OutMax "[]"
- OutDataTypeStr "Inherit: Same as first input"
- LockScale off
- RndMeth "Zero"
- SaturateOnIntegerOverflow on
- SampleTime "-1"
- }
- Block {
- BlockType RelationalOperator
- Operator ">="
- InputSameDT on
- OutDataTypeStr "Inherit: Logical (see Configuration Parameters: Optimization)"
- ZeroCross on
- SampleTime "-1"
- }
- Block {
- BlockType Reshape
- OutputDimensionality "1-D array"
- OutputDimensions "[1,1]"
- }
- Block {
- BlockType SignalViewerScope
- Floating off
- ModelBased off
- TickLabels "OneTimeTick"
- ZoomMode "on"
- Grid "on"
- TimeRange "auto"
- YMin "-5"
- YMax "5"
- SaveToWorkspace off
- SaveName "ScopeData"
- DataFormat "Array"
- LimitDataPoints on
- MaxDataPoints "5000"
- Decimation "1"
- SampleInput off
- SampleTime "0"
- Disabled off
- ScrollMode on
- }
- Block {
- BlockType SubSystem
- ShowPortLabels "FromPortIcon"
- Permissions "ReadWrite"
- PermitHierarchicalResolution "All"
- TreatAsAtomicUnit off
- CheckFcnCallInpInsideContextMsg off
- SystemSampleTime "-1"
- RTWFcnNameOpts "Auto"
- RTWFileNameOpts "Auto"
- FunctionInterfaceSpec "void_void"
- RTWMemSecFuncInitTerm "Inherit from model"
- RTWMemSecFuncExecute "Inherit from model"
- RTWMemSecDataConstants "Inherit from model"
- RTWMemSecDataInternal "Inherit from model"
- RTWMemSecDataParameters "Inherit from model"
- SimViewingDevice off
- DataTypeOverride "UseLocalSettings"
- DataTypeOverrideAppliesTo "AllNumericTypes"
- MinMaxOverflowLogging "UseLocalSettings"
- SFBlockType "NONE"
- Variant off
- GeneratePreprocessorConditionals off
- ContentPreviewEnabled off
- }
- Block {
- BlockType Sum
- IconShape "rectangular"
- Inputs "++"
- CollapseMode "All dimensions"
- CollapseDim "1"
- InputSameDT on
- AccumDataTypeStr "Inherit: Inherit via internal rule"
- OutMin "[]"
- OutMax "[]"
- OutDataTypeStr "Inherit: Same as first input"
- LockScale off
- RndMeth "Floor"
- SaturateOnIntegerOverflow on
- SampleTime "-1"
- }
- Block {
- BlockType UnitDelay
- InitialCondition "0"
- InputProcessing "Inherited"
- SampleTime "1"
- StateMustResolveToSignalObject off
- CodeGenStateStorageClass "Auto"
- HasFrameUpgradeWarning on
- }
- }
- System {
- Name "SimulatedNetwork2"
- Location [8, 142, 1644, 1170]
- Open on
- ModelBrowserVisibility off
- ModelBrowserWidth 200
- ScreenColor "white"
- PaperOrientation "landscape"
- PaperPositionMode "auto"
- PaperType "usletter"
- PaperUnits "inches"
- TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
- TiledPageScale 1
- ShowPageBoundaries off
- ZoomFactor "100"
- ReportName "simulink-default.rpt"
- SIDHighWatermark "96"
- Block {
- BlockType Inport
- Name "Stimulus"
- SID "37"
- Position [115, 153, 145, 167]
- ZOrder -1
- IconDisplay "Port number"
- Port {
- PortNumber 1
- Name "input"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType SubSystem
- Name "Neuron 1"
- SID "45"
- Ports [2, 1]
- Position [375, 123, 540, 272]
- ZOrder -2
- MinAlgLoopOccurrences off
- PropExecContextOutsideSubsystem off
- RTWSystemCode "Auto"
- FunctionWithSeparateData off
- Opaque off
- RequestExecContextInheritance off
- MaskHideContents off
- Object {
- $PropName "MaskObject"
- $ObjectID 23
- $ClassName "Simulink.Mask"
- Array {
- Type "Simulink.MaskParameter"
- Dimension 4
- Object {
- $ObjectID 24
- Type "edit"
- Name "H"
- Prompt "History Filter"
- Value "H1"
- }
- Object {
- $ObjectID 25
- Type "edit"
- Name "E"
- Prompt "Ensemble Filter"
- Value "E1"
- }
- Object {
- $ObjectID 26
- Type "edit"
- Name "S"
- Prompt "Stimulus Filter"
- Value "S1"
- }
- Object {
- $ObjectID 27
- Type "edit"
- Name "mu"
- Prompt "Baseline Firing Rate"
- Value "mu1"
- }
- PropName "Parameters"
- }
- }
- System {
- Name "Neuron 1"
- Location [276, 77, 1359, 678]
- Open on
- ModelBrowserVisibility off
- ModelBrowserWidth 200
- ScreenColor "white"
- PaperOrientation "landscape"
- PaperPositionMode "auto"
- PaperType "usletter"
- PaperUnits "inches"
- TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
- TiledPageScale 1
- ShowPageBoundaries off
- ZoomFactor "100"
- Block {
- BlockType Inport
- Name "stimulus"
- SID "47"
- Position [45, 228, 75, 242]
- ZOrder -1
- IconDisplay "Port number"
- }
- Block {
- BlockType Inport
- Name "ensemble"
- SID "48"
- Position [45, 303, 75, 317]
- ZOrder -2
- Port "2"
- IconDisplay "Port number"
- }
- Block {
- BlockType Sum
- Name "Add"
- SID "3"
- Ports [4, 1]
- Position [265, 155, 295, 195]
- ZOrder -3
- Inputs "++++"
- InputSameDT off
- OutDataTypeStr "Inherit: Inherit via internal rule"
- SaturateOnIntegerOverflow off
- }
- Block {
- BlockType Sum
- Name "Add1"
- SID "32"
- Ports [2, 1]
- Position [430, 240, 460, 270]
- ZOrder -4
- IconShape "round"
- Inputs "|++"
- InputSameDT off
- OutDataTypeStr "Inherit: Inherit via internal rule"
- SaturateOnIntegerOverflow off
- }
- Block {
- BlockType Constant
- Name "Constant"
- SID "1"
- Position [205, 80, 235, 110]
- ZOrder -5
- BlockRotation 270
- BlockMirror on
- BackgroundColor "magenta"
- NamePlacement "alternate"
- Value "mu"
- }
- Block {
- BlockType Constant
- Name "Constant1"
- SID "33"
- Position [430, 330, 460, 360]
- ZOrder -6
- BlockRotation 270
- BackgroundColor "magenta"
- }
- Block {
- BlockType Product
- Name "Divide"
- SID "31"
- Ports [2, 1]
- Position [505, 157, 535, 188]
- ZOrder -7
- Inputs "*/"
- InputSameDT off
- OutDataTypeStr "Inherit: Inherit via internal rule"
- RndMeth "Floor"
- SaturateOnIntegerOverflow off
- Port {
- PortNumber 1
- Name "s2"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType Reference
- Name "Ensemble Effect"
- SID "43"
- Ports [1, 1]
- Position [100, 292, 195, 328]
- ZOrder -8
- BackgroundColor "darkGreen"
- LibraryVersion "1.108"
- SourceBlock "cstblocks/LTI System"
- SourceType "LTI Block"
- ContentPreviewEnabled off
- sys "E"
- IC "[]"
- }
- Block {
- BlockType FrameConversion
- Name "Frame Status Conversion"
- SID "11"
- Ports [1, 1]
- Position [815, 165, 870, 205]
- ZOrder -9
- OutFrame "Sample-based"
- }
- Block {
- BlockType Delay
- Name "Integer Delay"
- SID "22"
- Ports [1, 1]
- Position [100, 28, 135, 62]
- ZOrder -10
- BlockMirror on
- UserDataPersistent on
- UserData "DataTag0"
- InputPortMap "u0"
- DelayLength "1"
- }
- Block {
- BlockType Math
- Name "Math\nFunction"
- SID "8"
- Ports [1, 1]
- Position [365, 160, 395, 190]
- ZOrder -11
- Port {
- PortNumber 1
- Name "s1"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType Reference
- Name "Random Source"
- SID "12"
- Ports [0, 1]
- Position [676, 265, 714, 300]
- ZOrder -12
- BlockRotation 270
- LibraryVersion "1.733"
- UserDataPersistent on
- UserData "DataTag1"
- Diagnostics "AllowInheritedTsInSrc"
- SourceBlock "dspsrcs4/Random\nSource"
- SourceType "Random Source"
- SrcType "Uniform"
- NormMethod "Ziggurat"
- CltLength "12"
- MinVal "0"
- MaxVal "1"
- MeanVal "0"
- VarVal "1"
- RepMode "Not repeatable"
- rawSeed "seed"
- IsInherit on
- SampMode "Continuous"
- SampTime "Ts"
- SampFrame "dsp_sampFrame"
- DataType "Double"
- OutComplex "Real"
- }
- Block {
- BlockType RelationalOperator
- Name "Relational Operator"
- SID "13"
- Ports [2, 1]
- Position [720, 167, 750, 198]
- ZOrder -13
- ShowName off
- Operator ">"
- OutDataTypeStr "float('double')"
- }
- Block {
- BlockType Reshape
- Name "Reshape"
- SID "14"
- Ports [1, 1]
- Position [910, 173, 940, 197]
- ZOrder -14
- ShowName off
- OutputDimensions "[sampPerFrame,max(length(P),length(seed))]"
- Port {
- PortNumber 1
- Name "spike process"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType Reference
- Name "Self-History"
- SID "5"
- Ports [1, 1]
- Position [100, 152, 195, 188]
- ZOrder -15
- BackgroundColor "orange"
- LibraryVersion "1.108"
- SourceBlock "cstblocks/LTI System"
- SourceType "LTI Block"
- ContentPreviewEnabled off
- sys "H"
- IC "[]"
- }
- Block {
- BlockType Reference
- Name "Stimulus Effect"
- SID "6"
- Ports [1, 1]
- Position [100, 217, 195, 253]
- ZOrder -16
- BackgroundColor "darkGreen"
- LibraryVersion "1.108"
- SourceBlock "cstblocks/LTI System"
- SourceType "LTI Block"
- ContentPreviewEnabled off
- sys "S"
- IC "[]"
- }
- Block {
- BlockType Outport
- Name "spikeTrain"
- SID "46"
- Position [990, 178, 1020, 192]
- ZOrder -17
- IconDisplay "Port number"
- }
- Line {
- ZOrder 1
- SrcBlock "Constant"
- SrcPort 1
- Points [0, 45]
- DstBlock "Add"
- DstPort 1
- }
- Line {
- ZOrder 2
- SrcBlock "Self-History"
- SrcPort 1
- DstBlock "Add"
- DstPort 2
- }
- Line {
- ZOrder 3
- SrcBlock "Stimulus Effect"
- SrcPort 1
- Points [15, 0; 0, -55]
- DstBlock "Add"
- DstPort 3
- }
- Line {
- ZOrder 4
- SrcBlock "Add"
- SrcPort 1
- DstBlock "Math\nFunction"
- DstPort 1
- }
- Line {
- ZOrder 5
- SrcBlock "Frame Status Conversion"
- SrcPort 1
- DstBlock "Reshape"
- DstPort 1
- }
- Line {
- Name "spike process"
- ZOrder 6
- SrcBlock "Reshape"
- SrcPort 1
- Points [25, 0]
- Branch {
- ZOrder 7
- Labels [1, 0]
- Points [0, -140]
- DstBlock "Integer Delay"
- DstPort 1
- }
- Branch {
- ZOrder 8
- DstBlock "spikeTrain"
- DstPort 1
- }
- }
- Line {
- ZOrder 9
- SrcBlock "Relational Operator"
- SrcPort 1
- DstBlock "Frame Status Conversion"
- DstPort 1
- }
- Line {
- ZOrder 10
- SrcBlock "Random Source"
- SrcPort 1
- Points [0, -70]
- DstBlock "Relational Operator"
- DstPort 2
- }
- Line {
- ZOrder 11
- SrcBlock "Integer Delay"
- SrcPort 1
- Points [-65, 0; 0, 125]
- DstBlock "Self-History"
- DstPort 1
- }
- Line {
- ZOrder 12
- SrcBlock "Constant1"
- SrcPort 1
- DstBlock "Add1"
- DstPort 2
- }
- Line {
- Name "s1"
- ZOrder 13
- Labels [0, 0]
- SrcBlock "Math\nFunction"
- SrcPort 1
- Points [5, 0]
- Branch {
- ZOrder 14
- Points [0, 80]
- DstBlock "Add1"
- DstPort 1
- }
- Branch {
- ZOrder 15
- Labels [1, 0]
- Points [85, 0]
- DstBlock "Divide"
- DstPort 1
- }
- }
- Line {
- ZOrder 16
- SrcBlock "Add1"
- SrcPort 1
- Points [10, 0; 0, -75]
- DstBlock "Divide"
- DstPort 2
- }
- Line {
- Name "s2"
- ZOrder 17
- Labels [0, 0]
- SrcBlock "Divide"
- SrcPort 1
- DstBlock "Relational Operator"
- DstPort 1
- }
- Line {
- ZOrder 18
- SrcBlock "Ensemble Effect"
- SrcPort 1
- Points [25, 0; 0, -120]
- DstBlock "Add"
- DstPort 4
- }
- Line {
- ZOrder 19
- SrcBlock "stimulus"
- SrcPort 1
- DstBlock "Stimulus Effect"
- DstPort 1
- }
- Line {
- ZOrder 20
- SrcBlock "ensemble"
- SrcPort 1
- DstBlock "Ensemble Effect"
- DstPort 1
- }
- Annotation {
- SID "89"
- Name "GLM Model \n\n "
- " \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n. "
- Position [104, 166, 507, 588]
- AutoSize on
- WordWrap off
- BackgroundColor "lightBlue"
- ZOrder -1
- FontName "Arial Narrow"
- FontSize 18
- }
- Annotation {
- SID "90"
- Name "Coin flip with\np= \\lambda \\cdot \\Delta\n\n\n\n\n\n\n\n\n\n\n."
- Position [724, 261, 806, 534]
- AutoSize on
- WordWrap off
- Interpreter "tex"
- TeXMode on
- ZOrder -2
- FontName "Arial Narrow"
- FontSize 18
- }
- Annotation {
- SID "91"
- Name "Inverse of Logistic Link Function\n \n\n\n\n\n\n\n\n\n\n"
- ". "
- Position [459, 251, 671, 505]
- AutoSize on
- WordWrap off
- BackgroundColor "yellow"
- ZOrder -3
- FontName "Arial Narrow"
- FontSize 18
- }
- Annotation {
- SID "92"
- Name "\\lambda \\cdot \\Delta= e^{X \\cdot \\beta}/(1+e^{X\\cdot \\beta})"
- Position [449, 401, 584, 426]
- AutoSize on
- WordWrap off
- Interpreter "tex"
- TeXMode on
- ZOrder -4
- FontName "Arial Narrow"
- FontSize 18
- }
- }
- }
- Block {
- BlockType SubSystem
- Name "Neuron 2"
- SID "68"
- Ports [2, 1]
- Position [375, 353, 540, 502]
- ZOrder -3
- MinAlgLoopOccurrences off
- PropExecContextOutsideSubsystem off
- RTWSystemCode "Auto"
- FunctionWithSeparateData off
- Opaque off
- RequestExecContextInheritance off
- MaskHideContents off
- Object {
- $PropName "MaskObject"
- $ObjectID 28
- $ClassName "Simulink.Mask"
- Array {
- Type "Simulink.MaskParameter"
- Dimension 4
- Object {
- $ObjectID 29
- Type "edit"
- Name "H"
- Prompt "History Filter"
- Value "H2"
- }
- Object {
- $ObjectID 30
- Type "edit"
- Name "E"
- Prompt "Ensemble Filter"
- Value "E2"
- }
- Object {
- $ObjectID 31
- Type "edit"
- Name "S"
- Prompt "Stimulus Filter"
- Value "S2"
- }
- Object {
- $ObjectID 32
- Type "edit"
- Name "mu"
- Prompt "Baseline Firing Rate"
- Value "mu2"
- }
- PropName "Parameters"
- }
- }
- System {
- Name "Neuron 2"
- Location [276, 77, 1359, 678]
- Open off
- ModelBrowserVisibility off
- ModelBrowserWidth 200
- ScreenColor "white"
- PaperOrientation "landscape"
- PaperPositionMode "auto"
- PaperType "usletter"
- PaperUnits "inches"
- TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
- TiledPageScale 1
- ShowPageBoundaries off
- ZoomFactor "100"
- Block {
- BlockType Inport
- Name "stimulus"
- SID "69"
- Position [45, 228, 75, 242]
- ZOrder -1
- IconDisplay "Port number"
- }
- Block {
- BlockType Inport
- Name "ensemble"
- SID "70"
- Position [45, 303, 75, 317]
- ZOrder -2
- Port "2"
- IconDisplay "Port number"
- }
- Block {
- BlockType Sum
- Name "Add"
- SID "71"
- Ports [4, 1]
- Position [265, 155, 295, 195]
- ZOrder -3
- Inputs "++++"
- InputSameDT off
- OutDataTypeStr "Inherit: Inherit via internal rule"
- SaturateOnIntegerOverflow off
- }
- Block {
- BlockType Sum
- Name "Add1"
- SID "72"
- Ports [2, 1]
- Position [430, 240, 460, 270]
- ZOrder -4
- IconShape "round"
- Inputs "|++"
- InputSameDT off
- OutDataTypeStr "Inherit: Inherit via internal rule"
- SaturateOnIntegerOverflow off
- }
- Block {
- BlockType Constant
- Name "Constant"
- SID "73"
- Position [205, 80, 235, 110]
- ZOrder -5
- BlockRotation 270
- BlockMirror on
- BackgroundColor "magenta"
- NamePlacement "alternate"
- Value "mu"
- }
- Block {
- BlockType Constant
- Name "Constant1"
- SID "74"
- Position [430, 330, 460, 360]
- ZOrder -6
- BlockRotation 270
- BackgroundColor "magenta"
- }
- Block {
- BlockType Product
- Name "Divide"
- SID "75"
- Ports [2, 1]
- Position [505, 157, 535, 188]
- ZOrder -7
- Inputs "*/"
- InputSameDT off
- OutDataTypeStr "Inherit: Inherit via internal rule"
- RndMeth "Floor"
- SaturateOnIntegerOverflow off
- Port {
- PortNumber 1
- Name "s2"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType Reference
- Name "Ensemble Effect"
- SID "76"
- Ports [1, 1]
- Position [100, 292, 195, 328]
- ZOrder -8
- BackgroundColor "darkGreen"
- LibraryVersion "1.108"
- SourceBlock "cstblocks/LTI System"
- SourceType "LTI Block"
- ContentPreviewEnabled off
- sys "E"
- IC "[]"
- }
- Block {
- BlockType FrameConversion
- Name "Frame Status Conversion"
- SID "77"
- Ports [1, 1]
- Position [815, 165, 870, 205]
- ZOrder -9
- OutFrame "Sample-based"
- }
- Block {
- BlockType Delay
- Name "Integer Delay"
- SID "78"
- Ports [1, 1]
- Position [100, 28, 135, 62]
- ZOrder -10
- BlockMirror on
- UserDataPersistent on
- UserData "DataTag2"
- InputPortMap "u0"
- DelayLength "1"
- }
- Block {
- BlockType Math
- Name "Math\nFunction"
- SID "79"
- Ports [1, 1]
- Position [365, 160, 395, 190]
- ZOrder -11
- Port {
- PortNumber 1
- Name "s1"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType Reference
- Name "Random Source"
- SID "80"
- Ports [0, 1]
- Position [676, 265, 714, 300]
- ZOrder -12
- BlockRotation 270
- LibraryVersion "1.733"
- UserDataPersistent on
- UserData "DataTag3"
- Diagnostics "AllowInheritedTsInSrc"
- SourceBlock "dspsrcs4/Random\nSource"
- SourceType "Random Source"
- SrcType "Uniform"
- NormMethod "Ziggurat"
- CltLength "12"
- MinVal "0"
- MaxVal "1"
- MeanVal "0"
- VarVal "1"
- RepMode "Not repeatable"
- rawSeed "seed"
- IsInherit on
- SampMode "Continuous"
- SampTime "Ts"
- SampFrame "dsp_sampFrame"
- DataType "Double"
- OutComplex "Real"
- }
- Block {
- BlockType RelationalOperator
- Name "Relational Operator"
- SID "81"
- Ports [2, 1]
- Position [720, 167, 750, 198]
- ZOrder -13
- ShowName off
- Operator ">"
- OutDataTypeStr "float('double')"
- }
- Block {
- BlockType Reshape
- Name "Reshape"
- SID "82"
- Ports [1, 1]
- Position [910, 173, 940, 197]
- ZOrder -14
- ShowName off
- OutputDimensions "[sampPerFrame,max(length(P),length(seed))]"
- Port {
- PortNumber 1
- Name "spike process"
- RTWStorageClass "Auto"
- DataLoggingNameMode "SignalName"
- }
- }
- Block {
- BlockType Reference
- Name "Self-History"
- SID "83"
- Ports [1, 1]
- Position [100, 152, 195, 188]
- ZOrder -15
- BackgroundColor "orange"
- LibraryVersion "1.108"
- SourceBlock "cstblocks/LTI System"
- SourceType "LTI Block"
- ContentPreviewEnabled off
- sys "H"
- IC "[]"
- }
- Block {
- BlockType Reference
- Name "Stimulus Effect"
- SID "84"
- Ports [1, 1]
- Position [100, 217, 195, 253]
- ZOrder -16
- BackgroundColor "darkGreen"
- LibraryVersion "1.108"
- SourceBlock "cstblocks/LTI System"
- SourceType "LTI Block"
- ContentPreviewEnabled off
- sys "S"
- IC "[]"
- }
- Block {
- BlockType Outport
- Name "spikeTrain"
- SID "85"
- Position [990, 178, 1020, 192]
- ZOrder -17
- IconDisplay "Port number"
- }
- Line {
- ZOrder 1
- SrcBlock "Constant"
- SrcPort 1
- Points [0, 45]
- DstBlock "Add"
- DstPort 1
- }
- Line {
- ZOrder 2
- SrcBlock "Self-History"
- SrcPort 1
- DstBlock "Add"
- DstPort 2
- }
- Line {
- ZOrder 3
- SrcBlock "Stimulus Effect"
- SrcPort 1
- Points [15, 0; 0, -55]
- DstBlock "Add"
- DstPort 3
- }
- Line {
- ZOrder 4
- SrcBlock "Add"
- SrcPort 1
- DstBlock "Math\nFunction"
- DstPort 1
- }
- Line {
- ZOrder 5
- SrcBlock "Frame Status Conversion"
- SrcPort 1
- DstBlock "Reshape"
- DstPort 1
- }
- Line {
- Name "spike process"
- ZOrder 6
- SrcBlock "Reshape"
- SrcPort 1
- Points [25, 0]
- Branch {
- ZOrder 7
- Labels [1, 0]
- Points [0, -140]
- DstBlock "Integer Delay"
- DstPort 1
- }
- Branch {
- ZOrder 8
- DstBlock "spikeTrain"
- DstPort 1
- }
- }
- Line {
- ZOrder 9
- SrcBlock "Relational Operator"
- SrcPort 1
- DstBlock "Frame Status Conversion"
- DstPort 1
- }
- Line {
- ZOrder 10
- SrcBlock "Random Source"
- SrcPort 1
- Points [0, -70]
- DstBlock "Relational Operator"
- DstPort 2
- }
- Line {
- ZOrder 11
- SrcBlock "Integer Delay"
- SrcPort 1
- Points [-65, 0; 0, 125]
- DstBlock "Self-History"
- DstPort 1
- }
- Line {
- ZOrder 12
- SrcBlock "Constant1"
- SrcPort 1
- DstBlock "Add1"
- DstPort 2
- }
- Line {
- Name "s1"
- ZOrder 13
- Labels [0, 0]
- SrcBlock "Math\nFunction"
- SrcPort 1
- Points [5, 0]
- Branch {
- ZOrder 14
- Points [0, 80]
- DstBlock "Add1"
- DstPort 1
- }
- Branch {
- ZOrder 15
- Labels [1, 0]
- Points [85, 0]
- DstBlock "Divide"
- DstPort 1
- }
- }
- Line {
- ZOrder 16
- SrcBlock "Add1"
- SrcPort 1
- Points [10, 0; 0, -75]
- DstBlock "Divide"
- DstPort 2
- }
- Line {
- Name "s2"
- ZOrder 17
- Labels [0, 0]
- SrcBlock "Divide"
- SrcPort 1
- DstBlock "Relational Operator"
- DstPort 1
- }
- Line {
- ZOrder 18
- SrcBlock "Ensemble Effect"
- SrcPort 1
- Points [25, 0; 0, -120]
- DstBlock "Add"
- DstPort 4
- }
- Line {
- ZOrder 19
- SrcBlock "stimulus"
- SrcPort 1
- DstBlock "Stimulus Effect"
- DstPort 1
- }
- Line {
- ZOrder 20
- SrcBlock "ensemble"
- SrcPort 1
- DstBlock "Ensemble Effect"
- DstPort 1
- }
- Annotation {
- SID "93"
- Name "GLM Model \n\n "
- " \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n. "
- Position [104, 166, 507, 588]
- AutoSize on
- WordWrap off
- BackgroundColor "lightBlue"
- ZOrder -1
- FontName "Arial Narrow"
- FontSize 18
- }
- Annotation {
- SID "94"
- Name "Coin flip with\np= \\lambda \\cdot \\Delta\n\n\n\n\n\n\n\n\n\n\n."
- Position [724, 261, 806, 534]
- AutoSize on
- WordWrap off
- Interpreter "tex"
- TeXMode on
- ZOrder -2
- FontName "Arial Narrow"
- FontSize 18
- }
- Annotation {
- SID "95"
- Name "Inverse of Logistic Link Function\n \n\n\n\n\n\n\n\n\n\n"
- ". "
- Position [459, 251, 671, 505]
- AutoSize on
- WordWrap off
- BackgroundColor "yellow"
- ZOrder -3
- FontName "Arial Narrow"
- FontSize 18
- }
- Annotation {
- SID "96"
- Name "\\lambda \\cdot \\Delta= e^{X \\cdot \\beta}/(1+e^{X\\cdot \\beta})"
- Position [449, 401, 584, 426]
- AutoSize on
- WordWrap off
- Interpreter "tex"
- TeXMode on
- ZOrder -4
- FontName "Arial Narrow"
- FontSize 18
- }
- }
- }
- Block {
- BlockType UnitDelay
- Name "Unit Delay"
- SID "88"
- Position [310, 218, 345, 252]
- ZOrder -4
- InputProcessing "Elements as channels (sample based)"
- SampleTime "-1"
- }
- Block {
- BlockType UnitDelay
- Name "Unit Delay1"
- SID "87"
- Position [310, 448, 345, 482]
- ZOrder -5
- InputProcessing "Elements as channels (sample based)"
- SampleTime "-1"
- }
- Block {
- BlockType Outport
- Name "pp"
- SID "26"
- Position [610, 193, 640, 207]
- ZOrder -6
- IconDisplay "Port number"
- }
- Block {
- BlockType Outport
- Name "pp1"
- SID "67"
- Position [610, 423, 640, 437]
- ZOrder -7
- Port "2"
- IconDisplay "Port number"
- }
- Block {
- BlockType SignalViewerScope
- Name "Scope"
- SID "28"
- Ports []
- Position [20, 15, 60, 55]
- ZOrder -8
- IOType "viewer"
- List {
- ListType IOSignalStrings
- set0ParseKeys "19,27"
- set0Sigs "Neuron 1/Reshape:o1Neuron 1/Stimulus Effect:o1"
- }
- Location [1, 53, 1601, 1151]
- Open off
- NumInputPorts "1"
- List {
- ListType AxesTitles
- axes1 "%"
- }
- ShowDataMarkers off
- ShowLegends off
- MaxDataPoints "7500"
- RefreshTime 0.035000
- }
- Block {
- BlockType SignalViewerScope
- Name "Scope1"
- SID "29"
- Ports []
- Position [20, 15, 60, 55]
- ZOrder -9
- IOType "viewer"
- List {
- ListType IOSignalStrings
- set0ParseKeys "25,18"
- set0Sigs "Neuron 1/Math Function:o1Neuron 1/Divide:o1"
- }
- Location [1, 53, 1601, 1151]
- Open off
- NumInputPorts "1"
- List {
- ListType AxesTitles
- axes1 "%"
- }
- ShowDataMarkers off
- ShowLegends off
- SaveName "ScopeData1"
- MaxDataPoints "7500"
- RefreshTime 0.035000
- }
- Block {
- BlockType SignalViewerScope
- Name "Scope2"
- SID "38"
- Ports []
- Position [20, 15, 60, 55]
- ZOrder -10
- IOType "viewer"
- List {
- ListType IOSignalStrings
- set0ParseKeys "24"
- set0Sigs "Neuron 1/Self-History:o1"
- }
- Location [5, 53, 1605, 1151]
- Open off
- NumInputPorts "1"
- List {
- ListType AxesTitles
- axes1 "%"
- }
- ShowDataMarkers off
- ShowLegends off
- SaveName "ScopeData2"
- MaxDataPoints "7500"
- RefreshTime 0.035000
- }
- Line {
- Name "input"
- ZOrder 1
- Labels [0, 0]
- SrcBlock "Stimulus"
- SrcPort 1
- Points [45, 0]
- Branch {
- ZOrder 2
- DstBlock "Neuron 1"
- DstPort 1
- }
- Branch {
- ZOrder 3
- Points [0, 230]
- DstBlock "Neuron 2"
- DstPort 1
- }
- }
- Line {
- ZOrder 4
- SrcBlock "Neuron 1"
- SrcPort 1
- Points [25, 0]
- Branch {
- ZOrder 5
- DstBlock "pp"
- DstPort 1
- }
- Branch {
- ZOrder 6
- Points [0, 100; -275, 0]
- DstBlock "Unit Delay1"
- DstPort 1
- }
- }
- Line {
- ZOrder 7
- SrcBlock "Neuron 2"
- SrcPort 1
- Points [35, 0]
- Branch {
- ZOrder 8
- DstBlock "pp1"
- DstPort 1
- }
- Branch {
- ZOrder 9
- Points [0, -100; -285, 0]
- DstBlock "Unit Delay"
- DstPort 1
- }
- }
- Line {
- ZOrder 10
- SrcBlock "Unit Delay1"
- SrcPort 1
- DstBlock "Neuron 2"
- DstPort 2
- }
- Line {
- ZOrder 11
- SrcBlock "Unit Delay"
- SrcPort 1
- DstBlock "Neuron 1"
- DstPort 2
- }
- }
-}
-MatData {
- NumRecords 4
- DataRecord {
- Tag DataTag0
- Data " %)30 . B 8 ( @ % \" $ ! 0 % 0 $P $ 3 :&%S26"
- "YH97)I=&5D3W!T:6]N #@ # & \" D\" !0 @ ! 0 $ @ ! $ "
- }
- DataRecord {
- Tag DataTag1
- Data " %)30 . V 8 ( @ % \" $ ! 0 % 0 \"0 $ 2 4V5E9"
- " 4V5E9$9L86< #@ #@ & \" 0 !0 @ ! !0 $ $ 4 R,S$Q,P "
- "X ! !@ @ $ 4 ( 0 T ! ! - 1&].;W13879E4V5E9 "
- }
- DataRecord {
- Tag DataTag2
- Data " %)30 . B 8 ( @ % \" $ ! 0 % 0 $P $ 3 :&%S26"
- "YH97)I=&5D3W!T:6]N #@ # & \" D\" !0 @ ! 0 $ @ ! $ "
- }
- DataRecord {
- Tag DataTag3
- Data " %)30 . V 8 ( @ % \" $ ! 0 % 0 \"0 $ 2 4V5E9"
- " 4V5E9$9L86< #@ #@ & \" 0 !0 @ ! !0 $ $ 4 R,S$Q,P "
- "X ! !@ @ $ 4 ( 0 T ! ! - 1&].;W13879E4V5E9 "
- }
-}
diff --git a/helpfiles/SimulatedNetwork2.png b/helpfiles/SimulatedNetwork2.png
deleted file mode 100644
index 0a872a41..00000000
Binary files a/helpfiles/SimulatedNetwork2.png and /dev/null differ
diff --git a/helpfiles/StimulusDecode2D.html b/helpfiles/StimulusDecode2D.html
deleted file mode 100644
index 041984f9..00000000
--- a/helpfiles/StimulusDecode2D.html
+++ /dev/null
@@ -1,259 +0,0 @@
-
-
-
-
- StimulusDecode2D
Here we simulate hippocampal place cell receptive fields and their firing during a 2-d spatial task. We then use the ensemble firing activity to estimate the path based on the only the point process observations
vx=10*std(px(2:end)-px(1:end-1));
-vy=10*std(py(2:end)-py(1:end-1));
-Q=[vx 0;0 vy];
-Px0=.1*eye(2,2); A=1*eye(2,2);
-% The PPDecodeFilter uses the matlab symbolic toolbox to evaluate the
-% gradient and hessian of the CIF. It is currently not working properly.
-[x_p, Pe_p, x_u, Pe_u] = DecodingAlgorithms.PPDecodeFilter(A, Q, Px0, dN',lambdaCIF,delta);
-figure;
-plot(x_u(1,:),x_u(2,:),'b',px,py,'k')
-legend('predicted path','actual path');
-
First we want to show that when neural firing activity is generated from a constant rate poisson process, the algorithm is able to estimate the value of this constant rate.
clear all;
-close all;
-
-p=0.01; % bernoilli probability
-N=100001; % Number of coin flips
-delta = 0.001; % binsize
-T=N*delta; % total time window
-lambda=N*p/T % lambda*T = N*p
-
-mu = log(lambda*delta/(1-lambda*delta))
-
-lambda =
-
- 10
-
-
-mu =
-
- -4.5951
-
-
Now generate data for two neurons based on this constant rate
for i=1:2
- t=linspace(0,T,N);
- ind=rand(1,N)<p; %generate the coin-flip indices for heads or 1's
- spikeTimes = t(ind); %get time spikes based on indices
- nst{i}=nspikeTrain(spikeTimes,'',delta); % create neuron spike train
- nst{i}.setMinTime(0);
- nst{i}.setMaxTime(T);
-end
-
For a sanity check we can plot the ISI histogram for the two neurons and verify that they are exponentially distributed with \lambda = N*p/T;
nst{1}.plotISIHistogram;
-
Setup the analysis using the Neural Spike Analysis Toolbox Since we are going to try to fit a constant rate model, we create a baseline covariate that is constant and equal to 1 for the duration of the trial. This data in the covarate will be labeled 'constant';
spikeColl=nstColl(nst); %create a nstColl - a collection of spikeTrains
-cov=Covariate(t,ones(length(t),1),'Baseline','s','','',{'mu'});
-cc=CovColl({cov}); % Gather all the covariates
-trial=Trial(spikeColl, cc); %Create the trial
-
-% Specify how we want to perform the analysis
-clear c;
-sampleRate=1000;
-%Try just using the 'constant' data from the baseline covariate
-c{1} = TrialConfig({{'Baseline','mu'}},sampleRate,[],[]);
-c{1}.setName('Baseline');
-cfgColl= ConfigColl(c); %place desired configurations in a ConfigColl structure
-
Make a joint process be the sum of two independet and non-overlapping Poisson processes with different rates. During the first interval, only observer arrivals from process 1, and during the second interval only observe arrivals from the second process. Compare the results of estimate the complete process as the sum of two distinct independent and non-overlapping Poisson processes versus a single constant rate process.
% Process 1
-p1=0.001; % bernoilli probability of process 1
-N1=100000; %
-delta = 0.001;
-T1=N1*delta;
-lambda1=N1*p1/T1 % lambda*T = N*p
-mu1 = log(lambda1*delta/(1-lambda1*delta))
-%Process 2
-p2=0.01; % bernoilli probability of process 1
-N2=100000;
-T2=N2*delta;
-lambda2=N2*p2/T2 % lambda*T = N*p
-mu2 = log(lambda2*delta/(1-lambda2*delta))
-
-%Estimate of constant rate process:
-lambdaConst = (N1*p1 + N2*p2)/(T1+T2)
-muConst = log(lambdaConst*delta/(1-lambdaConst*delta))
-
spikeColl=nstColl(nst); %create a nstColl
-cov=Covariate(tTot,[ones(length(tTot),1), tTot<=max(t1), tTot>max(t1)],'Baseline','s','','',{'muConst','mu1','mu2'});
-cc=CovColl({cov});
-
-% Specify how we want to perform the analysis
-sampleRate=1000;
-trial=Trial(spikeColl, cc);
-clear c;
-% Constant rate throughout
-c{1} = TrialConfig({{'Baseline','muConst'}},sampleRate,[],[]);
-c{1}.setName('Baseline');
-% Constant rate for epoch1 and Constat rate for epoch2 but distinct
-c{2} = TrialConfig({{'Baseline','mu1','mu2'}},sampleRate,[],[]);
-c{2}.setName('Variable');
-cfgColl= ConfigColl(c);
-
\ No newline at end of file
diff --git a/helpfiles/ValidationDataSet.m b/helpfiles/ValidationDataSet.m
deleted file mode 100644
index 2ae7de95..00000000
--- a/helpfiles/ValidationDataSet.m
+++ /dev/null
@@ -1,141 +0,0 @@
-%% Software Validation Data Set
-% The purpose of this example is to two important test cases of data to
-% validate the Neural Spike Analysis Toolbox.
-
-
-%% Case #1: Constant Rate Poisson Process
-% First we want to show that when neural firing activity is generated from
-% a constant rate poisson process, the algorithm is able to estimate the
-% value of this constant rate.
-
-clear all;
-close all;
-
-p=0.01; % bernoilli probability
-N=100001; % Number of coin flips
-delta = 0.001; % binsize
-T=N*delta; % total time window
-lambda=N*p/T % lambda*T = N*p
-
-mu = log(lambda*delta/(1-lambda*delta))
-%%
-% Now generate data for two neurons based on this constant rate
-for i=1:2
- t=linspace(0,T,N);
- ind=rand(1,N)
T1);
- ind2=rand(1,N2)max(t1)],'Baseline','s','','',{'muConst','mu1','mu2'});
-cc=CovColl({cov});
-
-% Specify how we want to perform the analysis
-sampleRate=1000;
-trial=Trial(spikeColl, cc);
-clear c;
-% Constant rate throughout
-c{1} = TrialConfig({{'Baseline','muConst'}},sampleRate,[],[]);
-c{1}.setName('Baseline');
-% Constant rate for epoch1 and Constat rate for epoch2 but distinct
-c{2} = TrialConfig({{'Baseline','mu1','mu2'}},sampleRate,[],[]);
-c{2}.setName('Variable');
-cfgColl= ConfigColl(c);
-
-%%
-% Run the analysis
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-results{1}.plotResults;
-results{2}.plotResults;
-figure;
-subplot(1,2,1); results{1}.lambda.plot;
-subplot(1,2,2); results{2}.lambda.plot;
-%%
-% Compare the results across the two neurons
-Summary = FitResSummary(results);
-Summary.plotSummary;
-
-
-
diff --git a/helpfiles/ValidationDataSet.png b/helpfiles/ValidationDataSet.png
deleted file mode 100644
index d3ccbad3..00000000
Binary files a/helpfiles/ValidationDataSet.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_01.png b/helpfiles/ValidationDataSet_01.png
deleted file mode 100644
index f25c2f7f..00000000
Binary files a/helpfiles/ValidationDataSet_01.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_02.png b/helpfiles/ValidationDataSet_02.png
deleted file mode 100644
index 16c76fc3..00000000
Binary files a/helpfiles/ValidationDataSet_02.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_03.png b/helpfiles/ValidationDataSet_03.png
deleted file mode 100644
index ecf27ab4..00000000
Binary files a/helpfiles/ValidationDataSet_03.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_04.png b/helpfiles/ValidationDataSet_04.png
deleted file mode 100644
index c1e77c46..00000000
Binary files a/helpfiles/ValidationDataSet_04.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_05.png b/helpfiles/ValidationDataSet_05.png
deleted file mode 100644
index fcf7cfc6..00000000
Binary files a/helpfiles/ValidationDataSet_05.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_06.png b/helpfiles/ValidationDataSet_06.png
deleted file mode 100644
index 496bc74e..00000000
Binary files a/helpfiles/ValidationDataSet_06.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_07.png b/helpfiles/ValidationDataSet_07.png
deleted file mode 100644
index 2eb42156..00000000
Binary files a/helpfiles/ValidationDataSet_07.png and /dev/null differ
diff --git a/helpfiles/ValidationDataSet_08.png b/helpfiles/ValidationDataSet_08.png
deleted file mode 100644
index 18d1a82e..00000000
Binary files a/helpfiles/ValidationDataSet_08.png and /dev/null differ
diff --git a/helpfiles/helpsearch-v3/_3.cfe b/helpfiles/helpsearch-v3/_3.cfe
deleted file mode 100644
index bb5b1b33..00000000
Binary files a/helpfiles/helpsearch-v3/_3.cfe and /dev/null differ
diff --git a/helpfiles/helpsearch-v3/_3.cfs b/helpfiles/helpsearch-v3/_3.cfs
deleted file mode 100644
index e0f67f19..00000000
Binary files a/helpfiles/helpsearch-v3/_3.cfs and /dev/null differ
diff --git a/helpfiles/helpsearch-v3/_3.si b/helpfiles/helpsearch-v3/_3.si
deleted file mode 100644
index 22088fd7..00000000
Binary files a/helpfiles/helpsearch-v3/_3.si and /dev/null differ
diff --git a/helpfiles/helpsearch-v3/segments.gen b/helpfiles/helpsearch-v3/segments.gen
deleted file mode 100644
index f142fa92..00000000
Binary files a/helpfiles/helpsearch-v3/segments.gen and /dev/null differ
diff --git a/helpfiles/helpsearch-v3/segments_4 b/helpfiles/helpsearch-v3/segments_4
deleted file mode 100644
index 9c4eaa17..00000000
Binary files a/helpfiles/helpsearch-v3/segments_4 and /dev/null differ
diff --git a/helpfiles/helpsearch/_11.cfs b/helpfiles/helpsearch/_11.cfs
deleted file mode 100644
index 03ec8264..00000000
Binary files a/helpfiles/helpsearch/_11.cfs and /dev/null differ
diff --git a/helpfiles/helpsearch/_15.cfs b/helpfiles/helpsearch/_15.cfs
deleted file mode 100644
index f53b8a2c..00000000
Binary files a/helpfiles/helpsearch/_15.cfs and /dev/null differ
diff --git a/helpfiles/helpsearch/deletable b/helpfiles/helpsearch/deletable
deleted file mode 100644
index 593f4708..00000000
Binary files a/helpfiles/helpsearch/deletable and /dev/null differ
diff --git a/helpfiles/helpsearch/segments b/helpfiles/helpsearch/segments
deleted file mode 100644
index 2b34b0e0..00000000
Binary files a/helpfiles/helpsearch/segments and /dev/null differ
diff --git a/helpfiles/helptoc.xml b/helpfiles/helptoc.xml
index 08eba0da..5314082e 100644
--- a/helpfiles/helptoc.xml
+++ b/helpfiles/helptoc.xml
@@ -1,43 +1,41 @@
-
-
-
-
-
-Neural Spike Analysis Toolbox
-
-Class Definitions
-
-Examples
- Using the SignalObj Class
- Using the Covariate Class
- Using the CovColl Class
- Using the nSpikeTrain Class
- Using the nstColl Class
- Using the Events Class
- Using the History Class
- Using the Trial Class
- Using the TrialConfig Class
- Using the ConfigColl Class
- Using the Analysis Class
- Using the FitResult Class
- Using the FitResSummary Class
- Point Process simulation via Thinning
- Example Data Analysis - Simulated Data - Computing a Peri-Stimulus Time Histogram (PSTH)
- Example Data Analysis - Simulated Constant (Piecewise Constant) Rate Poisson
- Example Data Analysis - Miniature Excitatory Post-Synaptic Currents (mEPSCs)
- Example Data Analysis - Simulated Explicit Stimulus and History
- Example Data Analysis - Explicit Stimulus
- Example Data Analysis - Hippocampal Place Cell Receptive Field Estimation
- Example Data Analysis - Decoding Univariate Simulated Stimuli (No History Effect)
- Example Data Analysis - Decoding Univariate Simulated Stimuli with and without History Effect
- Example Data Analysis - Decoding Bivariate Simulated Stimuli
- Example Data Analysis - Two Neuron Network Simulation and Estimation of Ensemble Effect
- nSTAT Paper Examples
-
-
-
-
-Neuroscience Statistics Research Laboratory
-
-
+
+
+ nSTAT Neural Spike Train Analysis Toolbox
+ Overview
+ MATLAB 2025b Help Integration
+
+ Class Definitions
+ SignalObj Reference
+ FitResult Reference
+
+ Examples
+ Using the SignalObj Class
+ Using the Covariate Class
+ Using the CovColl Class
+ Using the nSpikeTrain Class
+ Using the nstColl Class
+ Using the Events Class
+ Using the History Class
+ Using the Trial Class
+ Using the TrialConfig Class
+ Using the ConfigColl Class
+ Using the Analysis Class
+ Using the FitResult Class
+ Using the FitResSummary Class
+ Point Process Simulation via Thinning
+ Example Data Analysis - Simulated Data - Computing a Peri-Stimulus Time Histogram (PSTH)
+ Example Data Analysis - Simulated Constant (Piecewise Constant) Rate Poisson
+ Example Data Analysis - Miniature Excitatory Post-Synaptic Currents (mEPSCs)
+ Example Data Analysis - Simulated Explicit Stimulus and History
+ Example Data Analysis - Explicit Stimulus
+ Example Data Analysis - Hippocampal Place Cell Receptive Field Estimation
+ Example Data Analysis - Decoding Univariate Simulated Stimuli (No History Effect)
+ Example Data Analysis - Decoding Univariate Simulated Stimuli with and without History Effect
+ Example Data Analysis - Decoding Bivariate Simulated Stimuli
+ Example Data Analysis - Two Neuron Network Simulation and Estimation of Ensemble Effect
+ nSTAT Paper Examples
+
+
+ Neuroscience Statistics Research Laboratory
+
diff --git a/helpfiles/mEPSCAnalysis.html b/helpfiles/mEPSCAnalysis.html
deleted file mode 100644
index 62981f60..00000000
--- a/helpfiles/mEPSCAnalysis.html
+++ /dev/null
@@ -1,391 +0,0 @@
-
-
-
-
- MINIATURE EXCITATORY POST-SYNAPTIC CURRENTS (mEPSCs)
Data from Marnie Phillips marnie.a.phillips@gmail.com This analysis is based on a partial version of the dataset used in
Phillips MA, Lewis LD, Gong J, Constantine-Paton M, Brown EN. 2011 Model-based statistical analysis of miniature synaptic transmission. J Neurophys (under consideration)
When the magnesium concentration of the bath decreased (i.e. magnesium is removed), the rate of mEPSCs begin to increase in frequency. This can be modeled in a many different ways (using the change in Magnesium directly as a model covariate, etc.) Here we approximate the rate as being constant during certain portions of the experiment. These segments can in principle be estimated (using heirarchical Bayesian methods), but here we select them via visual inspection. We compare three models: a constant rate model (from above), a piecewise constant rate model, and a piecewise constant rate model with history.
Visual inspection of the spike train is used to pick three regions where the firing rate appears to be different. Here we do not estimate where these transitions happen but pick times in an ad-hoc manner.
figure;
- nst.plot;
-
Define Covariates for the analysis
timeInd1 =find(time<495,1,'last'); %0-495sec first constant rate
- timeInd2 =find(time<765,1,'last'); %495-765 second constant rate epoch
- %765 onwards third constant rate
- %epoch
- constantRate = ones(length(time),1);
- rate1 = zeros(length(time),1); rate1(1:timeInd1)=1;
- rate2 = zeros(length(time),1); rate2((timeInd1+1):timeInd2)=1;
- rate3 = zeros(length(time),1); rate3((timeInd2+1):end)=1;
- baseline = Covariate(time,[constantRate,rate1, rate2, rate3],'Baseline','time','s','',{'\mu','\mu_{1}','\mu_{2}','\mu_{3}'});
- covarColl = CovColl({baseline});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
- %30ms history in logarithmic spacing (chosen after using
- %Analysis.computeHistLagForAll for various window lengths)
- maxWindow=.3; numWindows=20;
- delta=1/sampleRate;
- windowTimes =unique(round([0 logspace(log10(delta),...
- log10(maxWindow),numWindows)]*sampleRate)./sampleRate);
- windowTimes = windowTimes(1:11);
-
We see that the piece-wise constant rate model (with and without history, outperform the constant baseline model in terms of AIC, BIC, and KS-statistic. While addition of the history effect yields a model that falls within the 95% confidence interval of the KS plot, it results in increases of the AIC and BIC because of the increased number of parameters.
\ No newline at end of file
diff --git a/helpfiles/mEPSCAnalysis.m b/helpfiles/mEPSCAnalysis.m
deleted file mode 100644
index ec12054d..00000000
--- a/helpfiles/mEPSCAnalysis.m
+++ /dev/null
@@ -1,199 +0,0 @@
-%% MINIATURE EXCITATORY POST-SYNAPTIC CURRENTS (mEPSCs)
-% Data from Marnie Phillips
-% This analysis is based on a partial version of the dataset used in
-%
-% Phillips MA, Lewis LD, Gong J, Constantine-Paton M, Brown EN. 2011
-% _Model-based statistical analysis of miniature synaptic transmission._
-% J Neurophys (under consideration)
-%
-% *Author*: Iahn Cajigas
-%
-% *Date*: 03/01/2011
-
-%% Data Description
-% *epsc2.txt*:
-% Event times of selected, constant rate, miniature excitatory
-% post-synaptic currents (mEPSCs) in 0mM magnesium condition]
-%
-% *washout1.txt*:
-% Variable rate recording: Event times of selected events, beginning
-% approximately 260 seconds after magnesium is first removed.
-%
-% *washout2.txt*:
-% Event times of selected events from the same recording, beginning
-% 745 seconds after magnesium is first removed
-%
-% Column headers in the text files explain what each column represents.
-%
-% Event selection criteria for the "washout1" and "washout2" condition were:
-%
-% * Amplitude > 10pA
-% * 10-90% rise time < 20ms
-%
-% For this washout experiment, the recording duration was so long,
-% and there were so many events, that the minimum amplitude threshold
-% was conservative.
-%
-% The mean RMS noise was only 1.36pA, and a usual threshold would be
-% 5*RMS = 6.8pA.
-%
-
-%% Constant Magnesium Concentration - Constant rate poisson
-% Under a constant Magnesium concentration, it is seen that the mEPSCs
-% behave as a homogeneous poisson process (constant arrival rate).
- close all;
- epsc2 = importdata('epsc2.txt');
- sampleRate = 1000;
- spikeTimes = epsc2.data(:,2)*1/sampleRate; %in seconds
- nst = nspikeTrain(spikeTimes);
- time = 0:(1/sampleRate):nst.maxTime;
-
- % Define Covariates for the analysis
- baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',{'\mu'});
- covarColl = CovColl({baseline});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
-
- % Define how we want to analyze the data
- clear tc tcc;
- tc{1} = TrialConfig({{'Baseline','\mu'}},sampleRate,[]); tc{1}.setName('Constant Baseline');
- tcc = ConfigColl(tc);
-
- % Perform Analysis (Commented to since data already saved)
- results =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
- results.plotResults;
-
-
- %% Varying Magnesium Concentration - Piecewise Constant rate poisson
- % When the magnesium concentration of the bath decreased (i.e. magnesium
- % is removed), the rate of mEPSCs begin to increase in frequency. This can
- % be modeled in a many different ways (using the change in Magnesium
- % directly as a model covariate, etc.) Here we approximate the rate as
- % being constant during certain portions of the experiment. These segments
- % can in principle be estimated (using heirarchical Bayesian methods), but
- % here we select them via visual inspection. We compare three models: a
- % constant rate model (from above), a piecewise constant rate model, and a
- % piecewise constant rate model with history.
-
- % load the data;
- washout1 = importdata('washout1.txt');
- washout2 = importdata('washout2.txt');
-
- sampleRate = 1000;
- % Magnesium removed at t=0
- spikeTimes1 = 260+washout1.data(:,2)*1/sampleRate; %in seconds
- spikeTimes2 = sort(washout2.data(:,2))*1/sampleRate + 745;%in seconds
- nst = nspikeTrain([spikeTimes1; spikeTimes2]);
- time = 260:(1/sampleRate):nst.maxTime;
-
- %% Data Visualization
- % Visual inspection of the spike train is used to pick three regions
- % where the firing rate appears to be different. Here we do not
- % estimate where these transitions happen but pick times in an ad-hoc
- % manner.
- figure;
- nst.plot;
-
-
- %% Define Covariates for the analysis
- timeInd1 =find(time<495,1,'last'); %0-495sec first constant rate
- timeInd2 =find(time<765,1,'last'); %495-765 second constant rate epoch
- %765 onwards third constant rate
- %epoch
- constantRate = ones(length(time),1);
- rate1 = zeros(length(time),1); rate1(1:timeInd1)=1;
- rate2 = zeros(length(time),1); rate2((timeInd1+1):timeInd2)=1;
- rate3 = zeros(length(time),1); rate3((timeInd2+1):end)=1;
- baseline = Covariate(time,[constantRate,rate1, rate2, rate3],'Baseline','time','s','',{'\mu','\mu_{1}','\mu_{2}','\mu_{3}'});
- covarColl = CovColl({baseline});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
- %30ms history in logarithmic spacing (chosen after using
- %Analysis.computeHistLagForAll for various window lengths)
- maxWindow=.3; numWindows=20;
- delta=1/sampleRate;
- windowTimes =unique(round([0 logspace(log10(delta),...
- log10(maxWindow),numWindows)]*sampleRate)./sampleRate);
- windowTimes = windowTimes(1:11);
-
- %% Define how we want to analyze the data
- clear tc tcc;
- tc{1} = TrialConfig({{'Baseline','\mu'}},sampleRate,[]); tc{1}.setName('Constant Baseline');
- tc{2} = TrialConfig({{'Baseline','\mu_{1}','\mu_{2}','\mu_{3}'}},sampleRate,[]); tc{2}.setName('Diff Baseline');
-% tc{3} = TrialConfig({{'Baseline','\mu_{1}','\mu_{2}','\mu_{3}'}},sampleRate,windowTimes); tc{3}.setName('Diff Baseline+Hist');
- tcc = ConfigColl(tc);
-
- %% Perform Analysis
- % We see that the piece-wise constant rate model (with and without
- % history, outperform the constant baseline model in terms of AIC, BIC,
- % and KS-statistic. While addition of the history effect yields a model
- % that falls within the 95% confidence interval of the KS plot, it
- % results in increases of the AIC and BIC because of the increased
- % number of parameters.
- results =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
- results.plotResults;
- Summary = FitResSummary(results);
- Summary.plotSummary;
-
-
- %% Decode Rate using Point Process Filter
-
-% clear lambdaCIF;
-% delta = .001;
-%
-% washout1 = importdata('washout1.txt');
-% washout2 = importdata('washout2.txt');
-%
-% sampleRate = 1000;
-% % Magnesium removed at t=0
-% spikeTimes1 = 260+washout1.data(:,2)*1/sampleRate; %in seconds
-% spikeTimes2 = sort(washout2.data(:,2))*1/sampleRate + 745;%in seconds
-% nst = nspikeTrain([spikeTimes1; spikeTimes2]);
-% time = 260:(1/sampleRate):nst.maxTime;
-% spikeColl = nstColl(nst);
-%
-% clear lambdaCIF;
-% lambdaCIF = CIF([1],{'mu'},{'mu'},'poisson');
-% spikeColl.resample(1/delta);
-% dN=spikeColl.dataToMatrix;
-% Q=.001;
-% Px0=.1; A=1;
-% [x_p, Pe_p, x_u, Pe_u] = CIF.PPDecodeFilter(A, Q, Px0, dN',lambdaCIF);
-% figure;
-% tNew = 260:delta:(length(x_p(1:end-1))*delta+260);
-% plot(tNew,exp(x_p)./delta);
-%
-% %%
-% close all;
-% N=30000; A=1; B=ones(1,N)./N;
-% xfilt = filtfilt(B,A,x_p);
-% figure;
-% plot(tNew,x_p,'-.b');
-% hold on; plot(tNew,xfilt,'k','Linewidth',3);
-% %%
-% close all;
-% figure;
-% index = find(tNew<280,1,'last');
-% subplot(2,1,1);
-% plot(tNew(index:end),x_p(index:end),'-.b'); hold on;
-% plot(tNew(index:end),xfilt(index:end),'k','Linewidth',3);
-% xlabel('time [s]');
-% ylabel('\mu');
-% axis tight;
-% v=axis;
-% axis([v(1) v(2) -9 -5]);
-%
-% subplot(2,1,2);
-% plot(tNew(index:end),exp(x_p(index:end))./delta,'-.b'); hold on;
-% plot(tNew(index:end),exp(xfilt(index:end))./delta,'k','Linewidth',3);
-% axis tight;
-% v=axis;
-% axis([v(1) v(2) 0 5]);
-% xlabel('time [s]');
-% ylabel('\lambda(t) [Hz]');
\ No newline at end of file
diff --git a/helpfiles/mEPSCAnalysis.png b/helpfiles/mEPSCAnalysis.png
deleted file mode 100644
index 6cd23483..00000000
Binary files a/helpfiles/mEPSCAnalysis.png and /dev/null differ
diff --git a/helpfiles/mEPSCAnalysis_01.png b/helpfiles/mEPSCAnalysis_01.png
deleted file mode 100644
index af39dc3f..00000000
Binary files a/helpfiles/mEPSCAnalysis_01.png and /dev/null differ
diff --git a/helpfiles/mEPSCAnalysis_02.png b/helpfiles/mEPSCAnalysis_02.png
deleted file mode 100644
index f5079af3..00000000
Binary files a/helpfiles/mEPSCAnalysis_02.png and /dev/null differ
diff --git a/helpfiles/mEPSCAnalysis_03.png b/helpfiles/mEPSCAnalysis_03.png
deleted file mode 100644
index f0351237..00000000
Binary files a/helpfiles/mEPSCAnalysis_03.png and /dev/null differ
diff --git a/helpfiles/mEPSCAnalysis_04.png b/helpfiles/mEPSCAnalysis_04.png
deleted file mode 100644
index 72ec564d..00000000
Binary files a/helpfiles/mEPSCAnalysis_04.png and /dev/null differ
diff --git a/helpfiles/nSTATPaperExamples.html b/helpfiles/nSTATPaperExamples.html
deleted file mode 100644
index fa02d037..00000000
--- a/helpfiles/nSTATPaperExamples.html
+++ /dev/null
@@ -1,81945 +0,0 @@
-
-
-
-
- nSTAT J. Neuroscience Methods Paper Examples
MINIATURE EXCITATORY POST-SYNAPTIC CURRENTS (mEPSCs) Data from Marnie Phillips marnie.a.phillips@gmail.com This analysis is based on a partial version of the dataset used in
Phillips MA, Lewis LD, Gong J, Constantine-Paton M, Brown EN. 2011 Model-based statistical analysis of miniature synaptic transmission. J Neurophys (under consideration)
Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Analyzing Configuration #1: Neuron #1
-
When the magnesium concentration of the bath decreased (i.e. magnesium is removed), the rate of mEPSCs begin to increase in frequency. This can be modeled in a many different ways (using the change in Magnesium directly as a model covariate, etc.) Here we approximate the rate as being constant during certain portions of the experiment. These segments can in principle be estimated (using heirarchical Bayesian methods), but here we select them via visual inspection. We compare three models: a constant rate model (from above), a piecewise constant rate model, and a piecewise constant rate model with history.
Visual inspection of the spike train is used to pick three regions where the firing rate appears to be different. Here we do not estimate where these transitions happen but pick times in an ad-hoc manner.
EXPLICIT STIMULUS EXAMPLE - WHISKER STIMULATION/THALAMIC NEURON In the worksheet with analyze the stimulus effect and history effect on the firing of a thalamic neuron under a known stimulus consisting of whisker stimulation. Data from Demba Ba (demba@mit.edu)
Fit a constant baseline and Find Stimulus Lag We fit a constant rate (Poisson) model to the data and use the look at the cross-covariance function of between the stimulus and the fit residual to determine the appropriate lag for the stimulus.
clear c; close all;
-selfHist = [] ; NeighborHist = []; sampleRate = 1000;
-c{1} = TrialConfig({{'Baseline','constant'}},sampleRate,selfHist,NeighborHist);
-c{1}.setName('Baseline');
-cfgColl= ConfigColl(c);
-results = Analysis.RunAnalysisForAllNeurons(trial,cfgColl,0);
-
-% Find Stimulus Lag (look for peaks in the cross-covariance function less
-% than 1 second
-scrsz = get(0,'ScreenSize');
-h=figure('Position',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.8]);
-
-subplot(7,2,[1 3 5])
-results.Residual.xcov(stim).windowedSignal([0,1]).plot;
-
-ylabel('');
-[m,ind,ShiftTime] = max(results.Residual.xcov(stim).windowedSignal([0,1]));
-title(['Cross Correlation Function - Peak at t=' num2str(ShiftTime) ' sec'],'FontWeight','bold',...
- 'FontSize',12,...
- 'FontName','Arial');
-hold on;
-h=plot(ShiftTime,m,'ro','Linewidth',3);
-set(h, 'MarkerFaceColor',[1 0 0], 'MarkerEdgeColor',[1 0 0]);
-hx=xlabel('Lag [s]','Interpreter','none');
-set(hx,'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-
-%Allow for shifts of less than 1 second
-stim = Covariate(time,stimData,'Stimulus','time','s','V',{'stim'});
-stim = stim.shift(ShiftTime);
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
- {'\mu'});
-
-nst = nspikeTrain(spikeTimes);
-nspikeColl = nstColl(nst);
-cc = CovColl({stim,baseline});
-trial2 = Trial(nspikeColl,cc);
-
Analyzing Configuration #1: Neuron #1
-
Compare constant rate model with model including stimulus effect
Addition of the stimulus improves the fits in terms of the KS plot and the making the rescaled ISIs less correlated. The Point Process Residula also looks more "white"
% Generate a known Conditional Intensity Function
-% We generated a known conditional intensity function (rate function) and
-% generate distinct realizations of point processes consistent with this
-% rate function. We use the method of thinning to simulate a point process.
-clear all;
-close all;
-delta = 0.001;
-Tmax = 1;
-time = 0:delta:Tmax;
-f=2;
-mu = -3;
-
-tempData = 1*sin(2*pi*f*time)+mu; %lambda >=0
-lambdaData = exp(tempData)./(1+exp(tempData))*(1/delta);
-lambda = Covariate(time,lambdaData, '\lambda(t)','time','s',...
- 'spikes/sec',{'\lambda_{1}'},{{' ''b'', ''LineWidth'' ,2'}});
-numRealizations = 20;
-spikeCollSim = CIF.simulateCIFByThinningFromLambda(lambda,numRealizations);
-
-
-scrsz = get(0,'ScreenSize');
-h=figure('Position',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.8]);
-
-subplot(2,2,3);spikeCollSim.plot;
-set(gca,'YTick',0:5:numRealizations,'YTickLabel',0:5:numRealizations);
-title({[num2str(numRealizations) ' Simulated Point Process Sample Paths']},...
- 'FontWeight','bold','Fontsize',14,'FontName','Arial');
-xlabel('time [s]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-ylabel('Trial [k]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-
-subplot(2,2,1);lambda.plot;
-title({'Simulated Conditional Intensity Function (CIF)'},...
- 'FontWeight','bold','FontSize',14,'FontName','Arial');
-xlabel('time [s]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-hy=get(gca,'YLabel');
-set(hy,'FontName', 'Arial','FontSize',14,'FontWeight','bold');
-
-fileLocation = which('nSTAT_Install');
-index = strfind(fileLocation,'nSTAT_Install.m')-1;
-nSTATDir =fileLocation(1:index);
-
-rootDir = [nSTATDir 'data' filesep 'PSTH' filesep];
-filename = 'Results.mat';
-x=load(strcat(rootDir,filename));
-numTrials = x.Results.Data.Spike_times_STC.balanced_SUA.Nr_trials;
-cellNum=6; clear nst;
-for i=1:numTrials
- spikeTimes{i}=x.Results.Data.Spike_times_STC.balanced_SUA.spike_times{1,i,cellNum};
- nst{i} = nspikeTrain(spikeTimes{i});
- nst{i}.setName(num2str(cellNum));
-end
-
-spikeCollReal1=nstColl(nst);
-spikeCollReal1.setMinTime(0); spikeCollReal1.setMaxTime(2);
-subplot(2,2,2);spikeCollReal1.plot; set(gca,'YTick',0:2:numTrials,...
- 'YTickLabel',0:2:numTrials);
-%set(gca,'xtick',[0:.5:2],'xtickLabel',{'0','0.5','1','1.5','2'});
-xlabel('time [s]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-ylabel('Trial [k]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-title('Response to Moving Visual Stimulus (Neuron 6)',...
- 'FontWeight','bold','Fontsize',14,'FontName','Arial');
-
-cellNum=1; clear nst;
-for i=1:numTrials
- spikeTimes{i}=x.Results.Data.Spike_times_STC.balanced_SUA.spike_times{1,i,cellNum};
- nst{i} = nspikeTrain(spikeTimes{i});
- nst{i}.setName(num2str(cellNum));
-end
-
-spikeCollReal2=nstColl(nst);
-spikeCollReal2.setMinTime(0); spikeCollReal2.setMaxTime(2);
-subplot(2,2,4);spikeCollReal2.plot;
-set(gca,'YTick',0:2:numTrials,'YTickLabel',0:2:numTrials);
-%set(gca,'xtick',[0:.5:2],'xtickLabel',{'0','0.5','1','1.5','2'});
-xlabel('time [s]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-ylabel('Trial [k]','Interpreter','none','FontName', 'Arial',...
- 'Fontsize',12,'FontWeight','bold');
-title('Response to Moving Visual Stimulus (Neuron 1)','FontWeight',...
- 'bold','Fontsize',14,'FontName','Arial');
-
Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-
Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #6
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-
Example 3b - SSGLM Example
Example of estimating with-in and across trial dynamics Methods from: G. Czanner, U. T. Eden, S. Wirth, M. Yanike, W. A. Suzuki, and E. N. Brown, "Analysis of between-trial and within-trial neural spiking dynamics.," Journal of neurophysiology, vol. 99, no. 5, pp. 2672?2693, May. 2008.
close all;
-clear all;
-% set(0,'DefaultFigureRenderer','ZBuffer')
-delta = 0.001; Tmax = 1;
-time = 0:delta:Tmax;
-Ts=.001;
-numRealizations = 50; %Each realization corresponds to a distinct trial
-
-for i=1:numRealizations
- % The within trial dynamics are sinusoidal
- % For each trial the stimulus effect increases
- f=2; b1(i)=3*((i)/numRealizations);b0=-3;
- u = sin(2*pi*f*time);
- e = zeros(length(time),1); %No Ensemble input
-
- stim=Covariate(time',u,'Stimulus','time','s','Voltage',{'sin'});
- ens =Covariate(time',e,'Ensemble','time','s','Spikes',{'n1'});
-
- mu=b0;
- histCoeffs=[-4 -1 -.5];
- H=tf(histCoeffs,[1],Ts,'Variable','z^-1');
-
- S=tf([b1(i)],1,Ts,'Variable','z^-1');
- E=tf([0],1,Ts,'Variable','z^-1');
- simTypeSelect='binomial'; %Parameters are used to compute
- %binomial conditional intensity function
- %
-
- % Obtain a realization of the point process with the current
- % stimulus and history effect
- [sC, lambdaTemp]=CIF.simulateCIF(mu,H,S,E,stim,ens,1,simTypeSelect);
-
- if(i==1)
- lambda=lambdaTemp; %Store the conditional intensity function
- else
- lambda = lambda.merge(lambdaTemp); %Add it to the other realizations
- end
-
- nst{i} = sC.getNST(1); %get the neural spikeTrain from the collection
- nst{i} = nst{i}.resample(1/delta); %make sure that it is sampled at the current samplerate
-end
-
-spikeColl = nstColl(nst); %Create a collection of the spike trains across trials
-
Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-
% Create the covariates that will be used for the GLM regression
-stim = Covariate(time,sin(2*pi*f*time),'Stimulus','time','s','V',{'stim'});
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
- {'constant'});
-
-% Specify the windows of the history coefficients to be estimated
-windowTimes=[0:.001:.003];
-% Number of bins to discrtize time into (used both for the PSTH and for
-% thec
-% SSGLM model.
-numBasis = 25;
-
-spikeColl.resample(1/delta); % Enforce sampleRate
-spikeColl.setMaxTime(Tmax); % Make all spikeTrains end at time Tmax
-
-
-dN=spikeColl.dataToMatrix'; % Convert the spikeTrains into a matrix
- % of 1's and 0's corresponding to the presence
- % or absense of a spike in each time window.
-dN(dN>1)=1; % One should sample finely enough so there is
- % one spike per bin. Here we make sure that
- % this is the case regardless of the
- % sampleRate
-
-% The width of each rectangular basis pulse is determined by Tmax and by the
-% number of basis pulses to use.
-basisWidth=(spikeColl.maxTime-spikeColl.minTime)/numBasis;
-
-if(simTypeSelect==0)
- fitType='binomial';
-else
- fitType='poisson';
-end
-if(strcmp(fitType,'binomial'))
- Algorithm = 'BNLRCG'; % BNLRCG - faster Truncated, L-2 Regularized,
- % Binomial Logistic Regression with Conjugate
- % Gradient Solver by Demba Ba (demba@mit.edu).
-else
- Algorithm = 'GLM'; % Standard Matlab GLM (Can be used for binomial or
- % or Poisson CIFs
-end
-
-% Use the values obtained from a PSTH to initialize the SSGLM filter
-[psthSig, ~, psthResult] =spikeColl.psthGLM(basisWidth,windowTimes,fitType);
-gamma0=psthResult.getHistCoeffs';%+.1*randn(size(histCoeffs));
-gamma0(isnan(gamma0))=-5; % Depending on the amount of data the
- % the psth may not identify all parameters
- % Just make sure that the estimates are real
- % numbers
-
-x0=psthResult.getCoeffs; %The initial estimate for the SSGLM model
-
-% Estimate the variance within each time bin across trials
-numVarEstIter=10;
-Q0 = spikeColl.estimateVarianceAcrossTrials(numBasis,windowTimes,...
- numVarEstIter,fitType);
-A=eye(numBasis,numBasis);
-delta = 1/spikeColl.sampleRate;
-
Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-Running in batch mode: neurons with same name are fit simultaneously
-Analyzing Configuration #1: Neuron #1
-A=eye(numBasis,numBasis);
-delta = 1/spikeColl.sampleRate;
-
Run the SSGLM Filter
CompilingHelpFile=1;
- % Commented out to speed up help file creation ...
- if(~CompilingHelpFile)
- Q0d=diag(Q0);
- neuronName = psthResult.neuronNumber;
- [xK,WK, WkuFinal,Qhat,gammahat,fitResults,stimulus,stimCIs,logll,...
- QhatAll,gammahatAll,nIter]=DecodingAlgorithms.PPSS_EMFB(A,Q0d,x0,...
- dN,fitType,delta,gamma0,windowTimes, numBasis,neuronName);
-
- fR = fitResults.toStructure;
- psthR = psthResult.toStructure;
- end
-% save SSGLMExampleData psthR fR xK WK WkuFinal Qhat gammahat fitResults stimulus stimCIs logll QhatAll gammahatAll nIter;
-
-%% Run the SSGLM Filter
-CompilingHelpFile=1;
- % Commented out to speed up help file creation ...
- if(~CompilingHelpFile)
-
close all;
-% Generate the actual stimulus effect
-minTime=0; maxTime = Tmax;
-stimData = stim.data*b1;
-if(strcmp(fitType,'poisson'))
- actStimEffect=exp(stimData + b0)./delta;
-elseif(strcmp(fitType,'binomial'))
- actStimEffect=exp(stimData + b0)./(1+exp(stimData + b0))./delta;
-end
-%
-
-% Generate the basis function so that the estimated effect can be plotted
-% at the same temporal resolution as the theoretical effect
- if(~isempty(numBasis))
- basisWidth = (maxTime-minTime)/numBasis;
- sampleRate=1/delta;
- unitPulseBasis=nstColl.generateUnitImpulseBasis(basisWidth,minTime,...
- maxTime,sampleRate);
- basisMat = unitPulseBasis.data;
- end
-
-% Generate the estimated stimulus effect
-if(strcmp(fitType,'poisson'))
- estStimEffect=exp(basisMat*xK)./delta;
-elseif(strcmp(fitType,'binomial'))
- estStimEffect=exp(basisMat*xK)./(1+exp(basisMat*xK))./delta;
-end
-
-
-scrsz = get(0,'ScreenSize');
-h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.4 scrsz(4)*.8]);
-
-% Plot the actual and estimated stimulus effect as a function of trial and
-% time
-subplot(3,1,[1 2 3]);
-lighting gouraud
-surf((1:length(b1))',stim.time,actStimEffect,'FaceAlpha',0.1,...
- 'EdgeAlpha',0.1,'AlphaData',0.1);
-hx=xlabel('Trial [k]'); hy=ylabel('time [s]');
-hz=zlabel('Stimulus Effect [spikes/sec]'); hold all;
-set([hx hy hz],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-surf((1:length(b1))',stim.time,estStimEffect(:,1:length(b1)),...
- 'FaceAlpha',0.5,'EdgeAlpha',0.1,'AlphaData',0.5); %xlabel('Trial [k]'); ylabel('time [s]'); zlabel('Stimulus Effect');
-set(gca,'YDir','reverse');
-set(gca,'ytick',0:.1:Tmax,'ytickLabel',0:.1:Tmax);
-
-title('SSGLM Estimated vs. Actual Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-
-close all;
-h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.4 scrsz(4)*.8]);
-
-% The actual stimulus effect
-subplot(3,1,1);
-lighting gouraud
-mesh((1:length(b1))',stim.time,actStimEffect);
-hx=xlabel('Trial [k]'); hy=ylabel('time [s]');
-zlabel('Stimulus Effect [spikes/sec]'); hold all;
-set([hx hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-% title('True Stimulus Effect');
-title('True Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-set(gca,'xtick',[],'xtickLabel',[]);
-set(gca,'ytick',[],'ytickLabel',[]);
-CLIM = [min(min(stimData./delta)) max(max(stimData./delta))];
-view(gca,[90 -90]);
-
-
-
-% The PSTH estimate
-subplot(3,1,2);
-lighting gouraud
-mesh((1:length(b1))',stim.time,repmat(psthSig.data, [1 numRealizations]));
-hx=xlabel('Trial [k]'); hy=ylabel('time [s]');
-hz=zlabel('Stimulus Effect [spikes/sec]'); hold all;
-set([hx hy hz],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-% title('PSTH Estimated Stimulus Effect');
-title('PSTH Estimated Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-
-set(gca,'xtick',[],'xtickLabel',[]);
-set(gca,'ytick',[],'ytickLabel',[]);
-CLIM = [min(min(stimData./delta)) max(max(stimData./delta))];
-view(gca,[90 -90]);
-
-% The SSGLM estimated stimulus effect
-subplot(3,1,3);
-lighting gouraud
-mesh((1:length(b1))',stim.time,estStimEffect);
-xlabel('Trial [k]'); ylabel('time [s]');
-zlabel('Stimulus Effect [spikes/sec]'); hold all;
-hx=get(gca,'XLabel'); hy=get(gca,'YLabel'); hz=get(gca,'ZLabel');
-set([hx hy hz],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-% title('SSGLM Estimated Stimulus Efferct');
-title('SSGLM Estimated Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-set(gca,'xtick',[],'xtickLabel',[]);
-set(gca,'ytick',[],'ytickLabel',[]);
-set(gca, 'YDir','normal')
-view(gca,[90 -90]);
-
-
-%%
-close all;
-% Generate the actual stimulus effect
-minTime=0; maxTime = Tmax;
-stimData = stim.data*b1;
-if(strcmp(fitType,'poisson'))
-elseif(strcmp(fitType,'binomial'))
- actStimEffect=exp(stimData + b0)./(1+exp(stimData + b0))./delta;
-end
-%
-
-% Generate the basis function so that the estimated effect can be plotted
-% at the same temporal resolution as the theoretical effect
- if(~isempty(numBasis))
- basisWidth = (maxTime-minTime)/numBasis;
- sampleRate=1/delta;
- unitPulseBasis=nstColl.generateUnitImpulseBasis(basisWidth,minTime,...
- maxTime,sampleRate);
- basisMat = unitPulseBasis.data;
- end
-
-% Generate the estimated stimulus effect
-if(strcmp(fitType,'poisson'))
-elseif(strcmp(fitType,'binomial'))
- estStimEffect=exp(basisMat*xK)./(1+exp(basisMat*xK))./delta;
-end
-
-
-scrsz = get(0,'ScreenSize');
-h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.4 scrsz(4)*.8]);
-
-% Plot the actual and estimated stimulus effect as a function of trial and
-% time
-subplot(3,1,[1 2 3]);
-lighting gouraud
-surf((1:length(b1))',stim.time,actStimEffect,'FaceAlpha',0.1,...
- 'EdgeAlpha',0.1,'AlphaData',0.1);
-hx=xlabel('Trial [k]'); hy=ylabel('time [s]');
-hz=zlabel('Stimulus Effect [spikes/sec]'); hold all;
-set([hx hy hz],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-surf((1:length(b1))',stim.time,estStimEffect(:,1:length(b1)),...
- 'FaceAlpha',0.5,'EdgeAlpha',0.1,'AlphaData',0.5); %xlabel('Trial [k]'); ylabel('time [s]'); zlabel('Stimulus Effect');
-set(gca,'YDir','reverse');
-set(gca,'ytick',0:.1:Tmax,'ytickLabel',0:.1:Tmax);
-
-title('SSGLM Estimated vs. Actual Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-
-close all;
-h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.4 scrsz(4)*.8]);
-
-% The actual stimulus effect
-subplot(3,1,1);
-lighting gouraud
-mesh((1:length(b1))',stim.time,actStimEffect);
-hx=xlabel('Trial [k]'); hy=ylabel('time [s]');
-zlabel('Stimulus Effect [spikes/sec]'); hold all;
-set([hx hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-% title('True Stimulus Effect');
-title('True Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-set(gca,'xtick',[],'xtickLabel',[]);
-set(gca,'ytick',[],'ytickLabel',[]);
-CLIM = [min(min(stimData./delta)) max(max(stimData./delta))];
-view(gca,[90 -90]);
-
-
-
-% The PSTH estimate
-subplot(3,1,2);
-lighting gouraud
-mesh((1:length(b1))',stim.time,repmat(psthSig.data, [1 numRealizations]));
-hx=xlabel('Trial [k]'); hy=ylabel('time [s]');
-hz=zlabel('Stimulus Effect [spikes/sec]'); hold all;
-set([hx hy hz],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-% title('PSTH Estimated Stimulus Effect');
-title('PSTH Estimated Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-
-set(gca,'xtick',[],'xtickLabel',[]);
-set(gca,'ytick',[],'ytickLabel',[]);
-CLIM = [min(min(stimData./delta)) max(max(stimData./delta))];
-view(gca,[90 -90]);
-
-% The SSGLM estimated stimulus effect
-subplot(3,1,3);
-lighting gouraud
-mesh((1:length(b1))',stim.time,estStimEffect);
-xlabel('Trial [k]'); ylabel('time [s]');
-zlabel('Stimulus Effect [spikes/sec]'); hold all;
-hx=get(gca,'XLabel'); hy=get(gca,'YLabel'); hz=get(gca,'ZLabel');
-set([hx hy hz],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-% title('SSGLM Estimated Stimulus Efferct');
-title('SSGLM Estimated Stimulus Effect','FontWeight','bold',...
- 'Fontsize',14,...
- 'FontName','Arial');
-set(gca,'xtick',[],'xtickLabel',[]);
-set(gca,'ytick',[],'ytickLabel',[]);
-set(gca, 'YDir','normal')
-view(gca,[90 -90]);
-
Compare differences across trials
close all;
- minTime=0; maxTime = Tmax;
-% Generate the basis function so that the estimated effect can be plotted
-% at the same temporal resolution as the theoretical effect
- if(~isempty(numBasis))
- basisWidth = (maxTime-minTime)/numBasis;
- sampleRate=1/delta;
- unitPulseBasis=nstColl.generateUnitImpulseBasis(basisWidth,...
- minTime,maxTime,sampleRate);
- basisMat = unitPulseBasis.data;
- end
-
-
-% close all;
-
-t0=0; tf=Tmax;
-[spikeRateBinom, ProbMat,sigMat]=DecodingAlgorithms.computeSpikeRateCIs(xK,...
- WkuFinal,dN,t0,tf,fitType,delta,gammahat,windowTimes);
-
-lt=find(sigMat(1,:)==1,1,'first');
-display(['The learning trial (compared to the first trial) is trial #'...
- num2str(find(sigMat(1,:)==1,1,'first'))]);
-scrsz = get(0,'ScreenSize');
-h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.8]);
-
-subplot(2,3,1);
-spikeRateBinom.setName(['(' num2str(Tmax) '-0)^-1*\Lambda(0,'...
- num2str(Tmax) ')']);
-spikeRateBinom.plot([],{{' ''k'',''Linewidth'',4'}});
-% e = Events(lt,{''});
-% e.plot;
-v=axis;
-plot(lt*[1;1],v(3:4),'r','Linewidth',2);
-hx=xlabel('Trial [k]','Interpreter','none'); hold all;
-hy=ylabel('Average Firing Rate [spikes/sec]','Interpreter','none');
-set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-title(['Learning Trial:' num2str(lt)],'FontWeight','bold',...
- 'Fontsize',12,...
- 'FontName','Arial');
-
-
-
-h=subplot(2,3,[2 3 5 6]);
-K=size(dN,1);
-colormap(flipud(gray));
-imagesc(ProbMat); hold on;
-for k=1:K
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
-%
-set(h,'XAxisLocation','top','YAxisLocation','right');
-hx=xlabel('Trial Number','Interpreter','none'); hold all;
-hy=ylabel('Trial Number','Interpreter','none');
-set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-subplot(2,3,4)
-stim1 = Covariate(time, basisMat*stimulus(:,1),'Trial1','time','s',...
- 'spikes/sec');
-temp = ConfidenceInterval(time, basisMat*squeeze(stimCIs(:,1,:)));
-stim1.setConfInterval(temp);
-stimlt = Covariate(time, basisMat*stimulus(:,lt),'Trial1','time','s',...
- 'spikes/sec');
-temp = ConfidenceInterval(time, basisMat*squeeze(stimCIs(:,lt,:)));
-temp.setColor('r');
-stimlt.setConfInterval(temp);
-stimltm1 = Covariate(time, basisMat*stimulus(:,lt-1),'Trial1','time','s',...
- 'spikes/sec');
-temp = ConfidenceInterval(time, basisMat*squeeze(stimCIs(:,lt-1,:)));
-temp.setColor('r');
-stimltm1.setConfInterval(temp);
-
-% figure;
-h1=stim1.plot([],{{' ''k'',''Linewidth'',4'}}); hold all;
-h2=stimlt.plot([],{{' ''r'',''Linewidth'',4'}});
-hx=xlabel('time [s]','Interpreter','none'); hold all;
-hy=ylabel('Firing Rate [spikes/sec]','Interpreter','none');
-set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-title({'Learning Trial Vs. Baseline Trial';'with 95% CIs'},'FontWeight','bold',...
- 'Fontsize',12,...
- 'FontName','Arial');
-h_legend=legend([h1(1) h2(1)],'\lambda_{1}(t)',['\lambda_{' num2str(lt) '}(t)']);
-pos = get(h_legend,'position');
-set(h_legend, 'position',[pos(1)+.03 pos(2)+.01 pos(3:4)]);
-
-
-
-%% Compare differences across trials
-close all;
- minTime=0; maxTime = Tmax;
-% Generate the basis function so that the estimated effect can be plotted
-% at the same temporal resolution as the theoretical effect
- if(~isempty(numBasis))
- basisWidth = (maxTime-minTime)/numBasis;
- sampleRate=1/delta;
- unitPulseBasis=nstColl.generateUnitImpulseBasis(basisWidth,...
- minTime,maxTime,sampleRate);
- basisMat = unitPulseBasis.data;
- end
-
-
-% close all;
-
-t0=0; tf=Tmax;
-[spikeRateBinom, ProbMat,sigMat]=DecodingAlgorithms.computeSpikeRateCIs(xK,...
- WkuFinal,dN,t0,tf,fitType,delta,gammahat,windowTimes);
-
-lt=find(sigMat(1,:)==1,1,'first');
-display(['The learning trial (compared to the first trial) is trial #' ...
- num2str(find(sigMat(1,:)==1,1,'first'))]);
-The learning trial (compared to the first trial) is trial #12
-scrsz = get(0,'ScreenSize');
-h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.8]);
-
-subplot(2,3,1);
-spikeRateBinom.setName(['(' num2str(Tmax) '-0)^-1*\Lambda(0,' ...
- num2str(Tmax) ')']);
-spikeRateBinom.plot([],{{' ''k'',''Linewidth'',4'}});
-% e = Events(lt,{''});
-% e.plot;
-v=axis;
-plot(lt*[1;1],v(3:4),'r','Linewidth',2);
-hx=xlabel('Trial [k]','Interpreter','none'); hold all;
-hy=ylabel('Average Firing Rate [spikes/sec]','Interpreter','none');
-set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-title(['Learning Trial:' num2str(lt)],'FontWeight','bold',...
- 'Fontsize',12,...
- 'FontName','Arial');
-
-
-
-h=subplot(2,3,[2 3 5 6]);
-K=size(dN,1);
-colormap(flipud(gray));
-imagesc(ProbMat); hold on;
-for k=1:K
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
- if(sigMat(k,m)==1)
- plot3(m,k,1,'r*'); hold on;
- end
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
- if(sigMat(k,m)==1)
- end
-end
- for m=(k+1):K
-end
-%
-set(h,'XAxisLocation','top','YAxisLocation','right');
-hx=xlabel('Trial Number','Interpreter','none'); hold all;
-hy=ylabel('Trial Number','Interpreter','none');
-set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-subplot(2,3,4)
-stim1 = Covariate(time, basisMat*stimulus(:,1),'Trial1','time','s',...
- 'spikes/sec');
-temp = ConfidenceInterval(time, basisMat*squeeze(stimCIs(:,1,:)));
-stim1.setConfInterval(temp);
-stimlt = Covariate(time, basisMat*stimulus(:,lt),'Trial1','time','s',...
- 'spikes/sec');
-temp = ConfidenceInterval(time, basisMat*squeeze(stimCIs(:,lt,:)));
-temp.setColor('r');
-stimlt.setConfInterval(temp);
-stimltm1 = Covariate(time, basisMat*stimulus(:,lt-1),'Trial1','time','s',...
- 'spikes/sec');
-temp = ConfidenceInterval(time, basisMat*squeeze(stimCIs(:,lt-1,:)));
-temp.setColor('r');
-stimltm1.setConfInterval(temp);
-
-% figure;
-h1=stim1.plot([],{{' ''k'',''Linewidth'',4'}}); hold all;
-h2=stimlt.plot([],{{' ''r'',''Linewidth'',4'}});
-hx=xlabel('time [s]','Interpreter','none'); hold all;
-hy=ylabel('Firing Rate [spikes/sec]','Interpreter','none');
-set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-title({'Learning Trial Vs. Baseline Trial';'with 95% CIs'},'FontWeight','bold',...
- 'Fontsize',12,...
- 'FontName','Arial');
-h_legend=legend([h1(1) h2(1)],'\lambda_{1}(t)',['\lambda_{' num2str(lt) '}(t)']);
-pos = get(h_legend,'position');
-set(h_legend, 'position',[pos(1)+.03 pos(2)+.01 pos(3:4)]);
-
Example 4 - HIPPOCAMPAL PLACE CELL - RECEPTIVE FIELD ESTIMATION
Estimation of receptive fields of neurons is a very common data analysis problem in neuroscience. Here we use the nSTAT software to perform an estimation of the receptive fields of hippocampal place cells using a bivariate Gaussian model and Zernike polynomials. The number of zernike polynomials is based on "An Analysis of Hippocampal Spatio-Temporal Representations Using a Bayesian Algorithm for Neural Spike Train Decoding" Barbieri et. al 2005. The data used herein in was provided by Dr. Ricardo Barbieri on 2/28/2011.
Author: Iahn Cajigas
Date: 3/1/2011
Example Data
The x and y coordinates of a freely foraging rat in a circular environment (70cm in diameter and 30cm high walls) and a fixed visual cue. The x and y coordinates at the time when a spike was observed are marked in red. The position coordinates have been normalized to be between -1 and 1 to allow to simplify the analysis.
-%% Example 4 - HIPPOCAMPAL PLACE CELL - RECEPTIVE FIELD ESTIMATION
-% Estimation of receptive fields of neurons is a very common data analysis problem in neuroscience.
-% Here we use the nSTAT software to perform an estimation of the receptive fields of hippocampal
-% place cells using a bivariate Gaussian model and Zernike polynomials. The number of zernike polynomials
-% is based on "An Analysis of Hippocampal Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
-% Spike Train Decoding" Barbieri et. al 2005. The data used herein in was
-% provided by Dr. Ricardo Barbieri on 2/28/2011.
-%
-% *Author*: Iahn Cajigas
-%
-% *Date*: 3/1/2011
-%%
-
-
-%% Example Data
-% The x and y coordinates of a freely foraging rat in a circular environment (70cm in diameter and 30cm high walls) and a fixed visual cue.
-% The x and y coordinates at the time when a spike was observed are marked
-% in red. The position coordinates have been normalized to be between -1
-% and 1 to allow to simplify the analysis.
- close all;
- load(strcat('PlaceCellDataAnimal1.mat'));
- exampleCell = [2 21 25 49];
-% exampleCell = 1:length(neuron);
-% figure(1);
- scrsz = get(0,'ScreenSize');
- h=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.6 scrsz(4)*.9]);
-
- for i=1:length(exampleCell)
- subplot(2,2,i);
- h1=plot(x,y,'b','Linewidth',.5); hold on;
- h2=plot(neuron{exampleCell(i)}.xN,neuron{exampleCell(i)}.yN,'r.',...
- 'MarkerSize',7);
- hx=xlabel('X Position'); hy=ylabel('Y Position');
-% title(['Animal#1, Cell#' num2str(exampleCell(i))]);
- title(['Cell#' num2str(exampleCell(i))],'FontWeight','bold',...
- 'Fontsize',12,'FontName','Arial');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- set(gca,'xTick',-1:.5:1,'yTick',-1:.5:1); axis square;
- if(i==4)
- end
- subplot(2,2,i);
- h1=plot(x,y,'b','Linewidth',.5); hold on;
- h2=plot(neuron{exampleCell(i)}.xN,neuron{exampleCell(i)}.yN,'r.',...
- 'MarkerSize',7);
- hx=xlabel('X Position'); hy=ylabel('Y Position');
-% title(['Animal#1, Cell#' num2str(exampleCell(i))]);
- title(['Cell#' num2str(exampleCell(i))],'FontWeight','bold',...
- 'Fontsize',12,'FontName','Arial');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- set(gca,'xTick',-1:.5:1,'yTick',-1:.5:1); axis square;
- if(i==4)
- end
- subplot(2,2,i);
- h1=plot(x,y,'b','Linewidth',.5); hold on;
- h2=plot(neuron{exampleCell(i)}.xN,neuron{exampleCell(i)}.yN,'r.',...
- 'MarkerSize',7);
- hx=xlabel('X Position'); hy=ylabel('Y Position');
-% title(['Animal#1, Cell#' num2str(exampleCell(i))]);
- title(['Cell#' num2str(exampleCell(i))],'FontWeight','bold',...
- 'Fontsize',12,'FontName','Arial');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- set(gca,'xTick',-1:.5:1,'yTick',-1:.5:1); axis square;
- if(i==4)
- end
- subplot(2,2,i);
- h1=plot(x,y,'b','Linewidth',.5); hold on;
- h2=plot(neuron{exampleCell(i)}.xN,neuron{exampleCell(i)}.yN,'r.',...
- 'MarkerSize',7);
- hx=xlabel('X Position'); hy=ylabel('Y Position');
-% title(['Animal#1, Cell#' num2str(exampleCell(i))]);
- title(['Cell#' num2str(exampleCell(i))],'FontWeight','bold',...
- 'Fontsize',12,'FontName','Arial');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- set(gca,'xTick',-1:.5:1,'yTick',-1:.5:1); axis square;
- if(i==4)
- h_legend = legend([h1 h2],'Animal Path',...
- 'Location at time of spike');
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)+.09 pos(2)+.06 pos(3:4)]);
- end
- end
-
Analyze All Cells
numAnimals=2;
-CompilingHelpFile=1;
-if(~CompilingHelpFile)
- for n=1:numAnimals
- % load the data
- clear xyneurontimensttctccz;
- load(strcat('PlaceCellDataAnimal',num2str(n),'.mat'));
-
- % Create the spikeTrains for each cell
- for i=1:length(neuron)
- nst{i} = nspikeTrain(neuron{i}.spikeTimes);
- end
-
-
- % Convert to polar coordinates
- [theta,r] = cart2pol(x,y);
-
-
- % Evaluate the Zernike Polynomials
- % Number of polynomials from "An Analysis of Hippocampal
- % Spatio-Temporal Representations Using a Bayesian Algorithm for Neural
- % Spike Train Decoding" Barbieri et. al 2005
- cnt=0;
- for l=0:3
- for m=-l:l
- if(~any(mod(l-m,2))) % otherwise the polynomial = 0
- cnt = cnt+1;
- z(:,cnt) = zernfun(l,m,r,theta,'norm');
- % zernfun by Paul Fricker
- % http://www.mathworks.com/matlabcentral/fileexchange/7687
- end
- end
- end
-
- % Data sampled at 30 Hz but just to be sure
- delta=min(diff(time));
- sampleRate = round(1/delta);
- % Define Covariates for the analysis
- baseline = Covariate(time,ones(length(x),1),'Baseline','time','s','',...
- {'mu'});
- zernike = Covariate(time,z,'Zernike','time','s','m',{'z1','z2','z3',...
- 'z4','z5','z6','z7','z8','z9','z10'});
- gaussian = Covariate(time,[x y x.^2 y.^2 x.*y],'Gaussian','time',...
- 's','m',{'x','y','x^2','y^2','x*y'});
- covarColl = CovColl({baseline,gaussian,zernike});
-
- % Create the trial structure
- spikeColl = nstColl(nst);
- trial = Trial(spikeColl,covarColl);
-
-
- % Define how we want to analyze the data
- tc{1} = TrialConfig({{'Baseline','mu'},{'Gaussian',...
- 'x','y','x^2','y^2','x*y'}},sampleRate,[]);
- tc{1}.setName('Gaussian');
- tc{2} = TrialConfig({{'Zernike''z1','z2','z3','z4','z5','z6',...
- 'z7','z8','z9','z10'}},sampleRate,[]);
- tc{2}.setName('Zernike');
- tcc = ConfigColl(tc);
-
- % Perform Analysis (Commented to since data already saved)
- results =Analysis.RunAnalysisForAllNeurons(trial,tcc,0);
-
- % Save results
- resStruct =FitResult.CellArrayToStructure(results);
- filename = ['PlaceCellAnimal' num2str(n) 'Results'];
- save(filename,'resStruct');
- end
-end
-
-
- %% Analyze All Cells
-numAnimals=2;
-CompilingHelpFile=1;
-if(~CompilingHelpFile)
-
View Summary Statistics
Note the Zernike Polynomials yield better fits in terms of decreased KS Statistics (less deviation from the 45 degree line), reduced AIC and reduced BIC across the majority of cells and for both animals
-
-%%
- clear lambdaGaussian lambdaZernike;
- load(strcat('PlaceCellDataAnimal1.mat'));
- resData=load(strcat('PlaceCellAnimal1Results.mat'));
- results = FitResult.fromStructure(resData.resStruct);
-
- for i=1:length(neuron)
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
- % Evaluate our fits using the new data and the estimated parameters
- lambdaGaussian{i} = results{i}.evalLambda(1,newData);
- lambdaZernike{i} = results{i}.evalLambda(2,zpoly);
- end
-
-
-
-% h1=plot(x,y,'b');
-% h2=plot(x,y,'g');
- %
- exampleCell = 25;
-% figure(8);
-% plot(x,y,'b',neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
-% xlabel('x'); ylabel('y');
-% title(['Animal#1, Cell#' num2str(exampleCell)]);
-%
- close all;
- h9=figure(9);
- h_mesh = mesh(x_new,y_new,lambdaGaussian{exampleCell},'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.2,'EdgeColor','b');
- hold on;
- h_mesh = mesh(x_new,y_new,lambdaZernike{exampleCell},'AlphaData',0);
- get(h_mesh,'AlphaData');
- set(h_mesh,'FaceAlpha',0.2,'EdgeAlpha',0.2,'EdgeColor','g');
-
-
-% h_legend=legend('\lambda_{Gaussian}','\lambda_{Zernike}');
-% set(h_legend,'FontSize',20);
- plot(x,y,neuron{exampleCell}.xN,neuron{exampleCell}.yN,'r.');
- axis tight square;
- xlabel('x position'); ylabel('y position');
- title(['Animal#1, Cell#' num2str(exampleCell)],'FontWeight','bold',...
- 'Fontsize',12,'FontName','Arial');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
Example 5 - STIMULUS DECODING
In this example we show how to decode a univariate and a bivariate stimulus based on a point process observations using nSTAT. Even though due to the simulated nature of the data, we know the exact condition intensity function, we estimate the parameters before moving on to the decoding stage.
-
-
-%% Example 5 - STIMULUS DECODING
-% In this example we show how to decode a univariate and a bivariate
-% stimulus based on a point process observations using nSTAT. Even though
-% due to the simulated nature of the data, we know the exact condition
-% intensity function, we estimate the parameters before moving on to the
-% decoding stage.
-%% Generate the conditional Intensity Function
-
- close all; clear all;
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
- delta = 0.001; Tmax = 1;
- time = 0:delta:Tmax;
- numRealizations = 20;
- f=2; b1=randn(numRealizations,1);b0=log(10*delta)+randn(numRealizations,1);
- x = sin(2*pi*f*time);
- clear nst;
- for i=1:numRealizations
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- lambda = Covariate(time,lambdaData./delta, ...
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- expData = exp(b1(i)*x+b0(i));
- lambdaData = expData./(1+expData);
-
- if(i==1)
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- else
- tempLambda = Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',{'\lambda_{1}'},...
- {{' ''b'', ''LineWidth'' ,2'}});
- lambda = lambda.merge(tempLambda);
- end
-
- spikeColl = CIF.simulateCIFByThinningFromLambda(...
- lambda.getSubSignal(i),1);
- nst{i} = spikeColl.getNST(1);
- end
- spikeColl = nstColl(nst);scrsz = get(0,'ScreenSize');
- h=figure('Position',[scrsz(3)*.1 scrsz(4)*.1 ...
- scrsz(3)*.6 scrsz(4)*.8]);
-% figure;
- subplot(3,1,1); plot(time,x,'k');
- set(gca,'xtick',[],'xtickLabel',[]); ylabel('Stimulus');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- title('Driving Stimulus','FontWeight','bold',...
- 'FontSize',14,'FontName','Arial');
- subplot(3,1,2); lambda.plot([],{{' ''k'',''Linewidth'',1'}});
- legend off;
- hy=ylabel('Firing Rate [spikes/sec]', 'Interpreter','none');
- hx=xlabel('','Interpreter','none');
- set([hx, hy],'FontName', 'Arial','FontSize',12,...
- 'FontWeight','bold');
- set(gca,'xtickLabel',[]);
- title('Conditional Intensity Functions','FontWeight',...
- 'bold','FontSize',14,'FontName','Arial');
-
- subplot(3,1,3); spikeColl.plot;
- set(gca,'ytick',0:10:numRealizations,'ytickLabel',...
- 0:10:numRealizations);
- xlabel('time [s]','Interpreter','none');
- ylabel('Cell Number','Interpreter','none');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- title('Point Process Sample Paths','FontWeight',...
- 'bold','FontSize',14,'FontName','Arial');
-
-stim = Covariate(time,sin(2*pi*f*time),'Stimulus','time','s','V',{'stim'});
-baseline = Covariate(time,ones(length(time),1),'Baseline','time','s','',...
-
close all;
-
-clear lambdaCIF;
-spikeColl.resample(1/delta);
-dN=spikeColl.dataToMatrix;
-
-% Make noise according to the dynamic range of the stimulus
-Q=std(stim.data(2:end)-stim.data(1:end-1));
-Px0=.1; A=1;
-x0 = x(:,1); yT=x(:,end);
-Pi0 = eps*eye(size(x0,1),size(x0,1));
-PiT = eps*eye(size(x0,1),size(x0,1));
-
-
-[x_p, W_p, x_u, W_u] = DecodingAlgorithms.PPDecodeFilterLinear(A, ...
- Q, dN',b0,b1','binomial',delta);
-%
-h=figure('Position',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.6]);
-zVal=1.96;
-ciLower = min(x_u(1:end)-zVal*sqrt(squeeze(W_u(1:end)))',...
- x_u(1:end)+zVal*sqrt(squeeze(W_u(1:end))'));
-ciUpper = max(x_u(1:end)-zVal*sqrt(squeeze(W_u(1:end)))',...
- x_u(1:end)+zVal*sqrt(squeeze(W_u(1:end))'));
-
-estimatedStimulus = Covariate(time,x_u(1:end),'\hat{x}(t)','time','s','');
-CI= ConfidenceInterval(time,[ciLower', ciUpper'],'\hat{x}(t)','time','s','');
-estimatedStimulus.setConfInterval(CI);
-
-% hold all;
-% hEst=plot(time,x_u(1:end),'b','Linewidth',2); hold on;
-% plot(time, [ciUpper', ciLower'],'b');
-
-hEst = estimatedStimulus.plot([],{{' ''k'',''Linewidth'',4'}});
-hStim=stim.plot([],{{' ''b'',''Linewidth'',4'}});
-legend off;
-h_legend=legend([hEst(1) hStim],'Decoded','Actual');
-set(h_legend,'Interpreter','none');
-set(h_legend,'FontSize',22);
-title(['Decoded Stimulus +/- 95% CIs with ' num2str(numRealizations) ' cells'],...
- 'FontWeight','bold','Fontsize',22,'FontName','Arial');
-xlabel('time [s]','Interpreter','none');
-ylabel('Stimulus','Interpreter','none');
-hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
-set([hx, hy],'FontName', 'Arial','FontSize',22,'FontWeight','bold');
-
{'constant'});
-
-% close all;
-%%
-close all;
-
-clear lambdaCIF;
-spikeColl.resample(1/delta);
-dN=spikeColl.dataToMatrix;
-
-% Make noise according to the dynamic range of the stimulus
-Q=std(stim.data(2:end)-stim.data(1:end-1));
-Px0=.1; A=1;
-x0 = x(:,1); yT=x(:,end);
-Pi0 = eps*eye(size(x0,1),size(x0,1));
-PiT = eps*eye(size(x0,1),size(x0,1));
-
-
-[x_p, W_p, x_u, W_u] = DecodingAlgorithms.PPDecodeFilterLinear(A, ...
- Q, dN',b0,b1','binomial',delta);
-%
-h=figure('Position',[scrsz(3)*.1 scrsz(4)*.1 scrsz(3)*.8 scrsz(4)*.6]);
-zVal=1.96;
-ciLower = min(x_u(1:end)-zVal*sqrt(squeeze(W_u(1:end)))',...
- x_u(1:end)+zVal*sqrt(squeeze(W_u(1:end))'));
-ciUpper = max(x_u(1:end)-zVal*sqrt(squeeze(W_u(1:end)))',...
- x_u(1:end)+zVal*sqrt(squeeze(W_u(1:end))'));
-
-estimatedStimulus = Covariate(time,x_u(1:end),'\hat{x}(t)','time','s','');
-CI= ConfidenceInterval(time,[ciLower', ciUpper'],'\hat{x}(t)','time','s','');
-estimatedStimulus.setConfInterval(CI);
-
-% hold all;
-% hEst=plot(time,x_u(1:end),'b','Linewidth',2); hold on;
-% plot(time, [ciUpper', ciLower'],'b');
-
-hEst = estimatedStimulus.plot([],{{' ''k'',''Linewidth'',4'}});
-hStim=stim.plot([],{{' ''b'',''Linewidth'',4'}});
-legend off;
-h_legend=legend([hEst(1) hStim],'Decoded','Actual');
-set(h_legend,'Interpreter','none');
-set(h_legend,'FontSize',22);
-title(['Decoded Stimulus +/- 95% CIs with ' num2str(numRealizations) ' cells'],...
- 'FontWeight','bold','Fontsize',22,'FontName','Arial');
-xlabel('time [s]','Interpreter','none');
-ylabel('Stimulus','Interpreter','none');
-hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
-set([hx, hy],'FontName', 'Arial','FontSize',22,'FontWeight','bold');
-
Example 5b - Arm reaching to target Simulation
See L. Srinivasan, U. T. Eden, A. S. Willsky, and E. N. Brown, "A state-space analysis for reconstruction of goal-directed movements using neural signals.," Neural computation, vol. 18, no. 10, pp. 2465?2494, Oct. 2006.
close all;
- clear all;
- %Process noise covariance only drives the movement velocity
- q=1e-4;
- Q=diag([1e-12 1e-12 q q]);
-
- delta = .001; % Time increment
- r=1e-6; % in meters^2
- p=1e-6; % in meters^2/s^2
- PiT=diag([r r p p]); % Uncertainty in the target state
- Pi0=PiT;
- T=2; % Reach Duration
-
- x0 = [0;0;0;0]; % Initial Position and velocities (states)
- xT = [-.35;.2; 0;0];% Final Target
- time=0:delta:T; % time vector
-
- A=[1 0 delta 0 ; %State transition matrix
- 0 1 0 delta;
- 0 0 1 0 ;
- 0 0 0 1 ];
-
- x=zeros(4,length(time));
-
-
-% Simulate a reach trajectory
-% Differs from reference by multiplication by delta instead of division so
-% that the velocity has units of meters per second
- R=chol(Q);
- L=chol(PiT);
- for k=1:length(time)
- if(k==1)
- x(:,k)=x0;
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- xT =x(:,end); % The target generated by the model
- yT=xT; % Assume we have observed the actual target position with uncertainty PiT
-
- %Define Q according to the dynamic range of the movement above
- Q=diag(var(diff(x,[],2),[],2))*100;
-
- % Plot the movement trajectories and the hand path
- scrsz = get(0,'ScreenSize');
- fig1=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 ...
- scrsz(3)*.8 scrsz(4)*.8]);
- %Plot The movement path
- subplot(4,2,[1 3]);
- plot(100*x(1,:),100*x(2,:),'k','Linewidth',2);
- xlabel('X Position [cm]'); ylabel('Y Position [cm]');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- title('Reach Path','FontWeight','bold','Fontsize',14,'FontName','Arial');
- hold on;
- axis([sort([100*x0(1)+5, 100*xT(1)-5]), sort([100*x0(2)-5, 100*xT(2)+5])]);
- h1=plot(100*x(1,1),100*x(2,1),'bo','MarkerSize',14);
- h2=plot(100*x(1,end),100*x(2,end),'ro','MarkerSize',14);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5); h1=plot(time,100*x(1,:),'k','Linewidth',2); hold on;
- h2=plot(time,100*x(2,:),'k-.','Linewidth',2);
- h_legend=legend([h1,h2],'x','y','Location','NorthEast');
- set(h_legend,'FontSize',14)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)+.06 pos(2)+.01 pos(3:4)]);
- hx=xlabel('time [s]'); hy=ylabel('Position [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- % Plot the velocity profiles
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','Linewidth',2); hold on;
- h2=plot(time,100*x(4,:),'k-.','Linewidth',2);
- h_legend=legend([h1 h2],'v_x','v_y','Location','NorthEast');
- xlabel('time [s]');
- set(h_legend,'FontSize',14);
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)+.06 pos(2)+.01 pos(3:4)]);
- hx=xlabel('time [s]'); hy=ylabel('Velocity [cm/s]');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- %
-
- gamma=0;
- windowTimes=[0, 0.001];
-
-
-% Simulate neural responses
- % logit(lambda_i*delta) = mu_i + b_x_i*v_x + b_y_i*v_y
- % logit(lambda_i*delta) = X_i*beta_i;
- numCells = 20;
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate -10Hz
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst;
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- lambdaData = tempData;
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- title('Neural Conditional Intensity Functions','FontWeight',...
- 'bold','Fontsize',14,'FontName','Arial');
- hx=xlabel('time [s]','Interpreter','none');
- hy=ylabel('Firing Rate [spikes/sec]','Interpreter','none');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- subplot(4,2,[2,4]); spikeColl.plot;
- set(gca,'xtick',[],'xtickLabel',[]);
- title('Neural Raster','FontWeight','bold','Fontsize',14,...
- 'FontName','Arial');
- hx=xlabel('time [s]','Interpreter','none');
- hy=ylabel('Cell Number','Interpreter','none');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
-% close all;
-
-
-
-%% Example 5b - Arm reaching to target Simulation
-% See
-% L. Srinivasan, U. T. Eden, A. S. Willsky, and E. N. Brown,
-% "A state-space analysis for reconstruction of goal-directed movements
-% using neural signals.," Neural computation, vol. 18, no. 10, pp. 2465?2494, Oct. 2006.
-
- close all;
- clear all;
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\private\evalmxdom.m' could not be
-cleared because it contains MATLAB code that is currently executing.
-Warning: The file
-'C:\Users\Developer\Dropbox\GitHub\nSTAT\helpfiles\nSTATPaperExamples.m' could
-not be cleared because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\mdbpublish.m' could not be cleared
-because it contains MATLAB code that is currently executing.
-Warning: The file 'C:\Program
-Files\MATLAB\R2017a\toolbox\matlab\codetools\publish.p' could not be cleared
-because it contains MATLAB code that is currently executing.
- %Process noise covariance only drives the movement velocity
- q=1e-4;
- Q=diag([1e-12 1e-12 q q]);
-
- delta = .001; % Time increment
- r=1e-6; % in meters^2
- p=1e-6; % in meters^2/s^2
- PiT=diag([r r p p]); % Uncertainty in the target state
- Pi0=PiT;
- T=2; % Reach Duration
-
- x0 = [0;0;0;0]; % Initial Position and velocities (states)
- xT = [-.35;.2; 0;0];% Final Target
- time=0:delta:T; % time vector
-
- A=[1 0 delta 0 ; %State transition matrix
- 0 1 0 delta;
- 0 0 1 0 ;
- 0 0 0 1 ];
-
- x=zeros(4,length(time));
-
-
-% Simulate a reach trajectory
-% Differs from reference by multiplication by delta instead of division so
-% that the velocity has units of meters per second
- R=chol(Q);
- L=chol(PiT);
- for k=1:length(time)
- if(k==1)
- x(:,k)=x0;
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- if(k==1)
- else
- x(:,k)=A*x(:,k-1)+...
- delta/(2)*(pi/T)^2*cos(pi*time(k)/T)*[0;0;...
- xT(1)-x0(1);xT(2)-x0(2)]; %Reach to target model
- %x(:,k)=A*x(:,k-1)+R*randn(size(x,1),1); %Random walk model
- end
-
- end
- xT =x(:,end); % The target generated by the model
- yT=xT; % Assume we have observed the actual target position with uncertainty PiT
-
- %Define Q according to the dynamic range of the movement above
- Q=diag(var(diff(x,[],2),[],2))*100;
-
- % Plot the movement trajectories and the hand path
- scrsz = get(0,'ScreenSize');
- fig1=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 ...
- scrsz(3)*.8 scrsz(4)*.8]);
- %Plot The movement path
- subplot(4,2,[1 3]);
- plot(100*x(1,:),100*x(2,:),'k','Linewidth',2);
- xlabel('X Position [cm]'); ylabel('Y Position [cm]');
- hx=get(gca,'XLabel'); hy=get(gca,'YLabel');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- title('Reach Path','FontWeight','bold','Fontsize',14,'FontName','Arial');
- hold on;
- axis([sort([100*x0(1)+5, 100*xT(1)-5]), sort([100*x0(2)-5, 100*xT(2)+5])]);
- h1=plot(100*x(1,1),100*x(2,1),'bo','MarkerSize',14);
- h2=plot(100*x(1,end),100*x(2,end),'ro','MarkerSize',14);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5); h1=plot(time,100*x(1,:),'k','Linewidth',2); hold on;
- h2=plot(time,100*x(2,:),'k-.','Linewidth',2);
- h_legend=legend([h1,h2],'x','y','Location','NorthEast');
- set(h_legend,'FontSize',14)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)+.06 pos(2)+.01 pos(3:4)]);
- hx=xlabel('time [s]'); hy=ylabel('Position [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- % Plot the velocity profiles
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','Linewidth',2); hold on;
- h2=plot(time,100*x(4,:),'k-.','Linewidth',2);
- h_legend=legend([h1 h2],'v_x','v_y','Location','NorthEast');
- xlabel('time [s]');
- set(h_legend,'FontSize',14);
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)+.06 pos(2)+.01 pos(3:4)]);
- hx=xlabel('time [s]'); hy=ylabel('Velocity [cm/s]');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- %
-
- gamma=0;
- windowTimes=[0, 0.001];
-
-
-% Simulate neural responses
- % logit(lambda_i*delta) = mu_i + b_x_i*v_x + b_y_i*v_y
- % logit(lambda_i*delta) = X_i*beta_i;
- numCells = 20;
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate -10Hz
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst;
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
-
- if(strcmp(fitType,'poisson'))
- else
- lambdaData = tempData./(1+tempData); % Conditional Intensity Function for ith cell
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- lambdaCIF{i} = CIF([MuCoeffs(i) 0 0 bCoeffs(i,:)],...
- {'1','x','y','vx','vy'},{'x','y','vx','vy'},fitType);
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1); nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
- subplot(4,2,[6 8]);
- h2=lambda{i}.plot([],{{' ''k'', ''LineWidth'' ,.5'}});
- legend off; hold all; % Plot the CIF
-
-
-
- end
- title('Neural Conditional Intensity Functions','FontWeight',...
- 'bold','Fontsize',14,'FontName','Arial');
- hx=xlabel('time [s]','Interpreter','none');
- hy=ylabel('Firing Rate [spikes/sec]','Interpreter','none');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- subplot(4,2,[2,4]); spikeColl.plot;
- set(gca,'xtick',[],'xtickLabel',[]);
- title('Neural Raster','FontWeight','bold','Fontsize',14,...
- 'FontName','Arial');
- hx=xlabel('time [s]','Interpreter','none');
- hy=ylabel('Cell Number','Interpreter','none');
- set([hx, hy],'FontName', 'Arial','FontSize',12,'FontWeight','bold');
-
close all;
-numExamples=20;
-scrsz = get(0,'ScreenSize');
-fig1=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 ...
- scrsz(3)*.6 scrsz(4)*.9]);
-for k=1:numExamples
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nstlambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- lambdaData = tempData;
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h1=plot(100*x(1,:),100*x(2,:),'k','LineWidth',3);
- hold on;
- axis([sort([100*x0(1)+5, 100*xT(1)-5]), ...
- sort([100*x0(2)-5, 100*xT(2)+5])]);
- title('Estimated vs. Actual Reach Paths',...
- 'FontWeight','bold','Fontsize',12,'FontName','Arial');
- end
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
-
-% close all;
-
-% close all;
-
-
-%%
-close all;
-numExamples=20;
-scrsz = get(0,'ScreenSize');
-fig1=figure('OuterPosition',[scrsz(3)*.1 scrsz(4)*.1 ...
- scrsz(3)*.6 scrsz(4)*.9]);
-for k=1:numExamples
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
- bCoeffs=10*(rand(numCells,2)-.5); % b_i = [b_x_i b_y_i] ~ U(-5, 5);
- phiMax = atan2(bCoeffs(:,2),bCoeffs(:,1)); % Maximal firing direction of cell
- phiMaxNorm = (phiMax+pi)./(2*pi);
- meanMu = log(10*delta); % baseline firing rate
- MuCoeffs = meanMu+randn(numCells,1); % mu_i ~ G(meanMu,1)
-
- dataMat = [ones(length(time),1) x(3,:)' x(4,:)']; % design matrix: X (
- coeffs = [MuCoeffs bCoeffs]; % coefficient vector: beta
- fitType='binomial';
- clear nst lambda;
-
-
- for i=1:numCells
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
- tempData = exp(dataMat*coeffs(i,:)');
- if(strcmp(fitType,'poisson'))
- else
- % Conditional Intensity Function for ith cell
- lambdaData = tempData./(1+tempData);
- end
- lambda{i}=Covariate(time,lambdaData./delta, ...
- '\Lambda(t)','time','s','spikes/sec',...
- {strcat('\lambda_{',num2str(i),'}')},{{' ''b'' '}});
- lambda{i}=lambda{i}.resample(1/delta);
-
- % Generate CIF representation in case we want to use the symbolic
- % versions of the PPDecodeFilter (i.e. not PPDecodeFilterLinear
- % generate one realization for each cell
- tempSpikeColl{i} = CIF.simulateCIFByThinningFromLambda(lambda{i},1);
- nst{i} = tempSpikeColl{i}.getNST(1); % grab the realization
- nst{i}.setName(num2str(i)); % give each cell a unique name
-
- end
-
- % Plot the neural raster across all the cells
- spikeColl = nstColl(nst); % Create a neural spike train collection
-
- % Based on the temporal resolution defined by delta, bin the data and get
- % a matrix representation of the neural firing
- dN=spikeColl.dataToMatrix';
- dN(dN>1)=1; % more than one spike per bin will be treated as one spike. In
- % general we should pick delta small enough so that there is
- % only one spike per bin
-
- [C,N] = size(dN); % N time samples, C cells
-
- beta=[zeros(2,numCells); bCoeffs'];
-
-
- %Use the Goal Directed Movement Version of the Point Process adaptive
- %Filter
- [x_p, W_p, x_u, W_u,x_uT,W_uT,x_pT,W_pT] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0, Pi0, yT,PiT,0);
-
- %Use the Free Movement Version of the Point Process adaptive
- %Filter
- [x_pf, W_pf, x_uf, W_uf] = ...
- DecodingAlgorithms.PPDecodeFilterLinear(A, Q, dN,...
- MuCoeffs,beta,fitType,delta,gamma,windowTimes,x0);
-
-
- if(k==numExamples)
- subplot(4,2,1:4);h1=plot(100*x(1,:),100*x(2,:),'k','LineWidth',3);
- hold on;
- axis([sort([100*x0(1)+5, 100*xT(1)-5]), ...
- sort([100*x0(2)-5, 100*xT(2)+5])]);
- title('Estimated vs. Actual Reach Paths',...
- 'FontWeight','bold','Fontsize',12,'FontName','Arial');
- end
- subplot(4,2,1:4);h2=plot(100*x_u(1,:)',100*x_u(2,:)','b'); hold all;
- subplot(4,2,1:4);h3=plot(100*x_uf(1,:)',100*x_uf(2,:)','g');
- hx=xlabel('x [cm]'); hy=ylabel('y [cm]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- h1=plot(100*x0(1),100*x0(2),'bo','MarkerSize',10); hold on;
- h2=plot(100*xT(1),100*xT(2),'ro','MarkerSize',10);
- legend([h1 h2],'Start','Finish','Location','NorthEast');
-
-
- subplot(4,2,5);
- h1=plot(time,100*x(1,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(1,:)','b');
- h3=plot(time,100*x_uf(1,:)','g');
- hy=ylabel('x(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,6);
- h1=plot(time,100*x(2,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(2,:)','b');
- h3=plot(time,100*x_uf(2,:)','g');
- h_legend=legend([h1(1) h2(1) h3(1)],'Actual','PPAF+Goal',...
- 'PPAF','Location','SouthEast');
- hy=ylabel('y(t) [cm]'); hx=xlabel('time [s]');
- set(gca,'xtick',[],'xtickLabel',[]);
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Position','FontWeight','bold','Fontsize',12,'FontName','Arial');
- set(h_legend,'FontSize',10)
- pos = get(h_legend,'position');
- set(h_legend, 'position',[pos(1)-.63 pos(2)+.23 pos(3:4)]);
-
- subplot(4,2,7);
- h1=plot(time,100*x(3,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(3,:)','b');
- h3=plot(time,100*x_uf(3,:)','g');
- hy=ylabel('v_{x}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('X Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
- subplot(4,2,8);
- h1=plot(time,100*x(4,:),'k','LineWidth',3); hold on;
- h2=plot(time,100*x_u(4,:)','b');
- h3=plot(time,100*x_uf(4,:)','g');
- hy=ylabel('v_{y}(t) [cm/s]'); hx=xlabel('time [s]');
- set([hx, hy],'FontName', 'Arial','FontSize',10,'FontWeight','bold');
- title('Y Velocity','FontWeight','bold','Fontsize',12,'FontName','Arial');
-
-
-end
-
Experiment 6 - Hybrid Point Process Filter Example
NOTE THIS EXAMPLE WAS NOT INCLUDED IN THE FINAL VERSION OF THE PAPER This example is based on an implementation of the Hybrid Point Process filter described in General-purpose filter design for neural prosthetic devices by Srinivasan L, Eden UT, Mitter SK, Brown EN in J Neurophysiol. 2007 Oct, 98(4):2456-75.
Problem Statement
Suppose that a process of interest can be modeled as consisting of several discrete states where the evolution of the system under each state can be modeled as a linear state space model. The observations of both the state and the continuous dynamics are not direct, but rather observed through how the continuous and discrete states affect the firing of a population of neurons. The goal of the hybrid filter is to estimate both the continuous dynamics and the underlying system state from only the neural population firing (point process observations).
To illustrate the use of this filter, we consider a reaching task. We assume two underlying system states s=1="Not Moving"=NM and s=2="Moving"=M. Under the "Not Moving" the position of the arm remain constant, whereas in the "Moving" state, the position and velocities evolved based on the arm acceleration that is modeled as a gaussian white noise process.
Under both the "Moving" and "Not Moving" states, the arm evolution state vector is
\ No newline at end of file
diff --git a/helpfiles/nSpikeTrainExamples.m b/helpfiles/nSpikeTrainExamples.m
deleted file mode 100644
index 5b505327..00000000
--- a/helpfiles/nSpikeTrainExamples.m
+++ /dev/null
@@ -1,30 +0,0 @@
-%% Test the nspikeTrain Class
-
-%% Example 1: Using the nspikeTrain Class
-% Lets create some pseudo data and plot it.
-
-spikeTimes = sort(rand(1,100))*1;
-spikeTimes = unique(round(spikeTimes*10000)./10000); %round off;
-nst=nspikeTrain(spikeTimes,'n1',.001,0,1);
-figure; nst.plot;
-
-%%
-% We can now change the signal representation of the nspikeTrain and see
-% what effects it has.
-%
-% 100ms bins from 0 to 10 sec. Actual SignalObj representation of the
-% nspikeTrain is not changed because are using getSigRep
-figure; nst.resample(1/.1);
-nst.getSigRep.plot;
-
-%%
-% 10ms bins from 0 to 10 sec. Actually changing the representation of the
-% signal.
-figure; nst.resample(1/.01);
-nst.getSigRep.plot;
-
-%%
-% Get the largest binsize that still maintains a binary signal
-% representation
-figure; nst.resample(1/nst.getMaxBinSizeBinary);
-nst.getSigRep.plot;
\ No newline at end of file
diff --git a/helpfiles/nSpikeTrainExamples.png b/helpfiles/nSpikeTrainExamples.png
deleted file mode 100644
index 14473e83..00000000
Binary files a/helpfiles/nSpikeTrainExamples.png and /dev/null differ
diff --git a/helpfiles/nSpikeTrainExamples_01.png b/helpfiles/nSpikeTrainExamples_01.png
deleted file mode 100644
index c925f3f5..00000000
Binary files a/helpfiles/nSpikeTrainExamples_01.png and /dev/null differ
diff --git a/helpfiles/nSpikeTrainExamples_02.png b/helpfiles/nSpikeTrainExamples_02.png
deleted file mode 100644
index 1cd324d9..00000000
Binary files a/helpfiles/nSpikeTrainExamples_02.png and /dev/null differ
diff --git a/helpfiles/nSpikeTrainExamples_03.png b/helpfiles/nSpikeTrainExamples_03.png
deleted file mode 100644
index 3cc685aa..00000000
Binary files a/helpfiles/nSpikeTrainExamples_03.png and /dev/null differ
diff --git a/helpfiles/nSpikeTrainExamples_04.png b/helpfiles/nSpikeTrainExamples_04.png
deleted file mode 100644
index 68b0536a..00000000
Binary files a/helpfiles/nSpikeTrainExamples_04.png and /dev/null differ
diff --git a/helpfiles/nstCollExamples.html b/helpfiles/nstCollExamples.html
deleted file mode 100644
index 70f89e49..00000000
--- a/helpfiles/nstCollExamples.html
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
-
- nstCollExamples
It is possible to obtain nspikeTrains from the collection;
figure;
-n1=spikeColl.getNST(1); %get the first nspikeTrain in the collection
-subplot(3,1,1); n1.plot;
-subplot(3,1,2); n1.getSigRep.plot; %plot current sigRep
-
-% get a SignalObj representation 1ms bins from 0 to 10 sec
-s1=n1.getSigRep(.001,0,1);
-subplot(3,1,3); s1.plot;
-
% Neearest Symmetric, Positive Definite matrices
-%
-% This tool saves your covariance matrices, turning them into something
-% that really does have the property you will need. That is, when you are
-% trying to use a covariance matrix in a tool like mvnrnd, it makes no
-% sense if your matrix is not positive definite. So mvnrnd will fail in
-% that case.
-%
-% But sometimes, it appears that users end up with matrices that are NOT
-% symmetric and positive definite (commonly abbreviated as SPD) and they
-% still wish to use them to generate random numbers, often in a tool like
-% mvnrnd. A solution is to find the NEAREST matrix that has the desired
-% property of being SPD.
-%
-% I see the question come up every once in a while, so I looked in the file
-% exchange to see what is in there. All I found was nearest_posdef. While
-% this usually almost works, it could be better. It actually failed
-% completely on most of my test cases, and it was not as fast as I would
-% like, using an optimization. In fact, in the comments to nearest_posdef,
-% a logical alternative was posed. That alternative too has its failures,
-% so I wrote nearestSPD.
-
nearestSPD works on any matrix, and it is reasonably fast.
As a test, randn generates a matrix that is not symmetric nor is it at all positive definite in general.
U = randn(100);
-
nearestSPD will be able to convert U into something that is indeed SPD, and for a 100 by 100 matrix, do it quickly enough
tic,Uj = nearestSPD(U);toc
-
Elapsed time is 0.005662 seconds.
-
The ultimate test of course, is to use chol. If chol returns a second argument that is zero, then MATLAB (and mvnrnd) will be happy!
nearest_posdef would have failed here, as U was not even symmetric, nor does it even have positive diagonal entries.
A realistic test case
Next I'll try a simpler test case. This one will have positive diamgonal entries, and it will indeed be symmetric. So this matrix is much closer to a true covariance matrix than that first mess we tried. And since nearest_posdef was quite slow on a 100x100 matrix, I'll use something smaller.
U = rand(25);
-U = (U + U')/2;
-
Really, it is meaningless as a covariance matrix, because it is clearly not positive definite. We can see many negative eigenvalues, and chol gets upset. So mvnrnd would fail here.
nearest_posdef took a bit of time, about 9 seconds on my machine. Admittedly, much of that time was wasted in doing fancy graphics that nobody actually needs if they just need a result.
tic,Um = nearest_posdef(U);toc
-
Elapsed time is 8.768167 seconds.
-
Is Um truly positive definite according to chol? Sadly, it is usually not.
[R,p] = chol(Um);
-p
-
p =
- 18
-
We can see how it failed, by looking at what eig returns.
There will usually be some tiny negative eigenvalues
min(real(eig(Um)))
-
ans =
- -1.8002e-16
-
and sometimes even some imaginary eigenvalues. All usually tiny, but still enough to upset chol.
max(imag(eig(Um)))
-
ans =
- 2.2548e-16
-
The trick suggested by Shuo Han is pretty fast, but it too fails. Since U is already symmetric, we need not symmetrize it first, but chol still gets upset.
Note that the slash used by Shuo was not a good idea. transpose would have been sufficient.
nearestSPD returns a solution that is a bit closer to the original matrix U too. Thus comparing 1,2,inf and Frobenious norms, nearestSPD was better under all norms in my tests, even though it is designed only to optimize the Frobenious norm.
\ No newline at end of file
diff --git a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/html/nearestSPD_demo.png b/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/html/nearestSPD_demo.png
deleted file mode 100755
index d1f1f950..00000000
Binary files a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/html/nearestSPD_demo.png and /dev/null differ
diff --git a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/html/nearestSPD_demo_01.png b/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/html/nearestSPD_demo_01.png
deleted file mode 100755
index 6b92f62f..00000000
Binary files a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/html/nearestSPD_demo_01.png and /dev/null differ
diff --git a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD.m b/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD.m
deleted file mode 100755
index caf1a5ef..00000000
--- a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD.m
+++ /dev/null
@@ -1,65 +0,0 @@
-function Ahat = nearestSPD(A)
-% nearestSPD - the nearest (in Frobenius norm) Symmetric Positive Definite matrix to A
-% usage: Ahat = nearestSPD(A)
-%
-% From Higham: "The nearest symmetric positive semidefinite matrix in the
-% Frobenius norm to an arbitrary real matrix A is shown to be (B + H)/2,
-% where H is the symmetric polar factor of B=(A + A')/2."
-%
-% http://www.sciencedirect.com/science/article/pii/0024379588902236
-%
-% arguments: (input)
-% A - square matrix, which will be converted to the nearest Symmetric
-% Positive Definite Matrix.
-%
-% Arguments: (output)
-% Ahat - The matrix chosen as the nearest SPD matrix to A.
-
-if nargin ~= 1
- error('Exactly one argument must be provided.')
-end
-
-% test for a square matrix A
-[r,c] = size(A);
-if r ~= c
- error('A must be a square matrix.')
-elseif (r == 1) && (A <= 0)
- % A was scalar and non-positive, so just return eps
- Ahat = eps;
- return
-end
-
-% symmetrize A into B
-B = (A + A')/2;
-
-% Compute the symmetric polar factor of B. Call it H.
-% Clearly H is itself SPD.
-[U,Sigma,V] = svd(B);
-H = V*Sigma*V';
-
-% get Ahat in the above formula
-Ahat = (B+H)/2;
-
-% ensure symmetry
-Ahat = (Ahat + Ahat')/2;
-
-% test that Ahat is in fact PD. if it is not so, then tweak it just a bit.
-p = 1;
-k = 0;
-while p ~= 0
- [R,p] = chol(Ahat);
- k = k + 1;
- if p ~= 0
- % Ahat failed the chol test. It must have been just a hair off,
- % due to floating point trash, so it is simplest now just to
- % tweak by adding a tiny multiple of an identity matrix.
- mineig = min(eig(Ahat));
- Ahat = Ahat + (-mineig*k.^2 + eps(mineig))*eye(size(A));
- end
-end
-
-
-
-
-
-
diff --git a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD_demo.m b/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD_demo.m
deleted file mode 100755
index c4209cba..00000000
--- a/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD_demo.m
+++ /dev/null
@@ -1,111 +0,0 @@
-% Neearest Symmetric, Positive Definite matrices
-%
-% This tool saves your covariance matrices, turning them into something
-% that really does have the property you will need. That is, when you are
-% trying to use a covariance matrix in a tool like mvnrnd, it makes no
-% sense if your matrix is not positive definite. So mvnrnd will fail in
-% that case.
-%
-% But sometimes, it appears that users end up with matrices that are NOT
-% symmetric and positive definite (commonly abbreviated as SPD) and they
-% still wish to use them to generate random numbers, often in a tool like
-% mvnrnd. A solution is to find the NEAREST matrix (based on minimizing the
-% Frobenius norm of the difference) that has the desired property of being
-% SPD.
-%
-% I see the question come up every once in a while, so I looked in the file
-% exchange to see what is in there. All I found was nearest_posdef. While
-% this usually almost works, it could be better. It actually failed
-% completely on most of my test cases, and it was not as fast as I would
-% like, using an optimization. In fact, in the comments to nearest_posdef,
-% a logical alternative was posed. That alternative too has its failures,
-% so I wrote nearestSPD.
-
-%% nearestSPD works on any matrix, and it is reasonably fast.
-% As a test, randn generates a matrix that is not symmetric nor is it at
-% all positive definite in general.
-U = randn(100);
-
-%%
-% nearestSPD will be able to convert U into something that is indeed SPD,
-% and for a 100 by 100 matrix, do it quickly enough
-tic,Uj = nearestSPD(U);toc
-
-%%
-% The ultimate test of course, is to use chol. If chol returns a second
-% argument that is zero, then MATLAB (and mvnrnd) will be happy!
-[R,p] = chol(Uj);
-p
-
-%%
-% As you can see, mvnrnd did not complain at all.
-mvnrnd(zeros(1,100),Uj,1)
-
-%%
-% nearest_posdef would have failed here, as U was not even symmetric, nor
-% does it even have positive diagonal entries.
-
-%% A realistic test case
-% Next I'll try a simpler test case. This one will have positive diamgonal
-% entries, and it will indeed be symmetric. So this matrix is much closer
-% to a true covariance matrix than that first mess we tried. And since
-% nearest_posdef was quite slow on a 100x100 matrix, I'll use something
-% smaller.
-U = rand(25);
-U = (U + U')/2;
-
-%%
-% Really, it is meaningless as a covariance matrix, because it is clearly
-% not positive definite. We can see many negative eigenvalues, and chol
-% gets upset. So mvnrnd would fail here.
-eig(U)'
-[R,p] = chol(U);
-p
-
-%%
-% nearest_posdef took a bit of time, about 9 seconds on my machine.
-% Admittedly, much of that time was wasted in doing fancy graphics that
-% nobody actually needs if they just need a result.
-tic,Um = nearest_posdef(U);toc
-
-%%
-% Is Um truly positive definite according to chol? Sadly, it is usually not.
-[R,p] = chol(Um);
-p
-
-%%
-% We can see how it failed, by looking at what eig returns.
-eig(Um)
-%%
-% There will usually be some tiny negative eigenvalues
-min(real(eig(Um)))
-%%
-% and sometimes even some imaginary eigenvalues. All usually tiny, but
-% still enough to upset chol.
-max(imag(eig(Um)))
-
-%%
-% The trick suggested by Shuo Han is pretty fast, but it too fails. Since
-% U is already symmetric, we need not symmetrize it first, but chol still
-% gets upset.
-%
-% Note that the slash used by Shuo was not a good idea. transpose would
-% have been sufficient.
-[V,D] = eig(U);
-U_psd = V * max(D,0) / V;
-[R,p] = chol(U_psd);
-p
-
-%%
-% Whereas nearestSPD works nicely.
-Uj = nearestSPD(U);
-[R,p] = chol(Uj);
-
-%%
-% nearestSPD returns a solution that is a bit closer to the original
-% matrix U too. Thus comparing 1,2,inf and Frobenius norms, nearestSPD was
-% better under all norms in my tests, even though it is designed only to
-% optimize the Frobenius norm.
-[norm(U - Um,1), norm(U - Um,2), norm(U - Um,inf), norm(U - Um,'fro')]
-[norm(U - Uj,1), norm(U - Uj,2), norm(U - Uj,inf), norm(U - Uj,'fro')]
-
diff --git a/libraries/NearestSymmetricPositiveDefinite/license.txt b/libraries/NearestSymmetricPositiveDefinite/license.txt
deleted file mode 100644
index 2ab3ed6a..00000000
--- a/libraries/NearestSymmetricPositiveDefinite/license.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2013, John D'Errico
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the distribution
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/libraries/fixPSlinestyle.m b/libraries/fixPSlinestyle.m
deleted file mode 100644
index 61261354..00000000
--- a/libraries/fixPSlinestyle.m
+++ /dev/null
@@ -1,88 +0,0 @@
-function fixPSlinestyle(varargin)
-
-%FIXPSLINESTYLE Fix line styles in exported post script files
-%
-% FIXPSLINESTYLE(FILENAME) fixes the line styles in the postscript file
-% FILENAME. The file will be over-written. This takes a .PS or .EPS file
-% and fixes the dotted and dashed line styles to be a little bit more
-% esthetically pleasing. It fixes the four default line styles (line,
-% dotted, dashed, dashdot).
-%
-% FIXPSLINESTYLE(FILENAME, NEWFILENAME) creates a new file NEWFILENAME.
-%
-% This is meant to be used with postscript files created by MATLAB
-% (print, export).
-%
-% Example:
-% x = 1:.1:10;
-% y1 = sin(x);
-% y2 = cos(x);
-% h = plot(x, y1, '--', x, y2, '-.');
-% set(h, 'LineWidth', 2);
-% grid on;
-% legend('line 1', 'line2');
-%
-% print -depsc test.eps
-% fixPSlinestyle('test.eps', 'fixed_test.eps');
-%
-% See also PRINT.
-
-% Copyright 2005-2010 The MathWorks, Inc.
-
-% Error checking
-error(nargchk(1, 2, nargin));
-if ~ischar(varargin{1}) || (nargin == 2 && ~ischar(varargin{2}))
- error('Input arguments must be file names (char).');
-end
-
-% Make sure the files specified are postscript files
-[p1, n1, e1] = fileparts(varargin{1});
-if isempty(e1) || ~ismember(lower(e1), {'.ps', '.eps'})
- error('The extension has to be .ps or .eps');
-end
-
-% Open file and read it in
-fid = fopen(varargin{1}, 'r');
-str = fread(fid);
-str = char(str');
-fclose(fid);
-
-% Find where the line types are defined
-id = strfind(str, '% line types:');
-if isempty(id)
- error('Could not locate line type definitions in PostScript file.');
-end
-id = id(1);
-str1 = str(1:id-1);
-[line1 , remline ] = strtok(str(id:end), '/');
-[replacestr, remline2] = strtok(remline , '%');
-
-% Define the new line styles
-solidLine = sprintf('/SO { [] 0 setdash } bdef\n');
-dotLine = sprintf('/DO { [3 dpi2point mul 3 dpi2point mul] 0 setdash } bdef\n');
-dashedLine = sprintf('/DA { [6 dpi2point mul] 0 setdash } bdef\n');
-dashdotLine = sprintf('/DD { [2 dpi2point mul 2 dpi2point mul 6 dpi2point mul 2 dpi2point mul] 0 setdash } bdef\n');
-
-% Construct the new file with the new line style definitions
-newText = [str1, line1, solidLine, dotLine, dashedLine, dashdotLine, remline2];
-
-% Check for output file name
-if nargin == 2
- [p2, n2, e2] = fileparts(varargin{2});
- if isempty(e2)
- fname = fullfile(p2, [n2, e1]);
- else
- if strcmpi(e1, e2)
- fname = varargin{2};
- else
- error('Output file must have same file extension.');
- end
- end
-else % if not defined, over-write
- fname = varargin{1};
-end
-
-% Write out to file
-fid = fopen(fname, 'w');
-fprintf(fid, '%s', newText);
-fclose(fid);
\ No newline at end of file
diff --git a/libraries/rotateXLabels.zip b/libraries/rotateXLabels.zip
deleted file mode 100644
index ba882d59..00000000
Binary files a/libraries/rotateXLabels.zip and /dev/null differ
diff --git a/libraries/rotateXLabels/license.txt b/libraries/rotateXLabels/license.txt
deleted file mode 100644
index 984f36bb..00000000
--- a/libraries/rotateXLabels/license.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2010-2011, The MathWorks, Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the distribution
- * Neither the name of the The MathWorks, Inc. nor the names
- of its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/libraries/rotateXLabels/rotateXLabels.m b/libraries/rotateXLabels/rotateXLabels.m
deleted file mode 100644
index eefc292f..00000000
--- a/libraries/rotateXLabels/rotateXLabels.m
+++ /dev/null
@@ -1,415 +0,0 @@
-function hh = rotateXLabels( ax, angle, varargin )
-%rotateXLabels: rotate any xticklabels
-%
-% hh = rotateXLabels(ax,angle) rotates all XLabels on axes AX by an angle
-% ANGLE (in degrees). Handles to the resulting text objects are returned
-% in HH.
-%
-% hh = rotateXLabels(ax,angle,param,value,...) also allows one or more
-% optional parameters to be specified. Possible parameters are:
-% 'MaxStringLength' The maximum length of label to show (default inf)
-%
-% Examples:
-% >> bar( hsv(5)+0.05 )
-% >> days = {'Monday','Tuesday','Wednesday','Thursday','Friday'};
-% >> set( gca(), 'XTickLabel', days )
-% >> rotateXLabels( gca(), 45 )
-%
-% See also: GCA, BAR
-
-% Copyright 2006-2013 The MathWorks Ltd.
-
-error( nargchk( 2, inf, nargin ) );
-if ~isnumeric( angle ) || ~isscalar( angle )
- error( 'RotateXLabels:BadAngle', 'Parameter ANGLE must be a scalar angle in degrees' )
-end
-angle = mod( angle, 360 );
-
-[maxStringLength] = parseInputs( varargin{:} );
-
-% Get the existing label texts and clear them
-[vals, labels] = findAndClearExistingLabels( ax, maxStringLength );
-
-% Create the new label texts
-h = createNewLabels( ax, vals, labels, angle );
-
-% Reposition the axes itself to leave space for the new labels
-repositionAxes( ax );
-
-% If an X-label is present, move it too
-repositionXLabel( ax );
-
-% Store angle
-setappdata( ax, 'RotateXLabelsAngle', angle );
-
-% Only send outputs if requested
-if nargout
- hh = h;
-end
-
-%-------------------------------------------------------------------------%
- function [maxStringLength] = parseInputs( varargin )
- % Parse optional inputs
- maxStringLength = inf;
- if nargin > 0
- params = varargin(1:2:end);
- values = varargin(2:2:end);
- if numel( params ) ~= numel( values )
- error( 'RotateXLabels:BadSyntax', 'Optional arguments must be specified as parameter-value pairs.' );
- end
- if any( ~cellfun( 'isclass', params, 'char' ) )
- error( 'RotateXLabels:BadSyntax', 'Optional argument names must be specified as strings.' );
- end
- for pp=1:numel( params )
- switch upper( params{pp} )
- case 'MAXSTRINGLENGTH'
- maxStringLength = values{pp};
-
- otherwise
- error( 'RotateXLabels:BadParam', 'Optional parameter ''%s'' not recognised.', params{pp} );
- end
- end
- end
- end % parseInputs
-%-------------------------------------------------------------------------%
- function [vals,labels] = findAndClearExistingLabels( ax, maxStringLength )
- % Get the current tick positions so that we can place our new labels
- vals = get( ax, 'XTick' );
-
- % Now determine the labels. We look first at for previously rotated labels
- % since if there are some the actual labels will be empty.
- ex = findall( ax, 'Tag', 'RotatedXTickLabel' );
- if isempty( ex )
- % Store the positions and labels
- labels = get( ax, 'XTickLabel' );
- if isempty( labels )
- % No labels!
- return
- else
- if ~iscell(labels)
- labels = cellstr(labels);
- end
- end
- % Clear existing labels so that xlabel is in the right position
- set( ax, 'XTickLabel', {}, 'XTickMode', 'Manual' );
- setappdata( ax, 'OriginalXTickLabels', labels );
- else
- % Labels have already been rotated, so capture them
- labels = getappdata( ax, 'OriginalXTickLabels' );
- set(ex, 'DeleteFcn', []);
- delete(ex);
- end
- % Limit the length, if requested
- if isfinite( maxStringLength )
- for ll=1:numel( labels )
- if length( labels{ll} ) > maxStringLength
- labels{ll} = labels{ll}(1:maxStringLength);
- end
- end
- end
-
- end % findAndClearExistingLabels
-%-------------------------------------------------------------------------%
- function restoreDefaultLabels( ax )
- % Restore the default axis behavior
- removeListeners( ax );
-
- % Try to restore the tick marks and labels
- set( ax, 'XTickMode', 'auto', 'XTickLabelMode', 'auto' );
- rmappdata( ax, 'OriginalXTickLabels' );
-
- % Try to restore the axes position
- if isappdata( ax, 'OriginalAxesPosition' )
- set( ax, 'Position', getappdata( ax, 'OriginalAxesPosition' ) );
- rmappdata( ax, 'OriginalAxesPosition' );
- end
- end
-%-------------------------------------------------------------------------%
- function textLabels = createNewLabels( ax, vals, labels, angle )
- % Work out the ticklabel positions
- zlim = get(ax,'ZLim');
- z = zlim(1);
-
- % We want to work in normalised coords, but this doesn't print
- % correctly. Instead we have to work in data units even though it
- % makes positioning hard.
- ylim = get( ax, 'YLim' );
- if strcmpi( get( ax, 'XAxisLocation' ), 'Top' )
- y = ylim(2);
- else
- y = ylim(1);
- end
-
- % Now create new text objects in similar positions.
- textLabels = -1*ones( numel( vals ), 1 );
- for ll=1:numel(vals)
- textLabels(ll) = text( ...
- 'Units', 'Data', ...
- 'Position', [vals(ll), y, z], ...
- 'String', labels{ll}, ...
- 'Parent', ax, ...
- 'Clipping', 'off', ...
- 'Rotation', angle, ...
- 'Tag', 'RotatedXTickLabel', ...
- 'UserData', vals(ll));
- end
- % So that we can respond to CLA and CLOSE, attach a delete
- % callback. We only attach it to one label to save massive numbers
- % of callbacks during axes shut-down.
- set(textLabels(end), 'DeleteFcn', @onTextLabelDeleted);
-
- % Now copy font properties into the texts
- updateFont();
- % Update the alignment of the text
- updateAlignment();
-
- end % createNewLabels
-
-%-------------------------------------------------------------------------%
- function repositionAxes( ax )
- % Reposition the axes so that there's room for the labels
- % Note that we only do this if the OuterPosition is the thing being
- % controlled
- if ~strcmpi( get( ax, 'ActivePositionProperty' ), 'OuterPosition' )
- return;
- end
-
- % Work out the maximum height required for the labels
- labelHeight = getLabelHeight(ax);
-
- % Remove listeners while we mess around with things, otherwise we'll
- % trigger redraws recursively
- removeListeners( ax );
-
- % Change to normalized units for the position calculation
- oldUnits = get( ax, 'Units' );
- set( ax, 'Units', 'Normalized' );
-
- % Not sure why, but the extent seems to be proportional to the height of the axes.
- % Correct that now.
- set( ax, 'ActivePositionProperty', 'Position' );
- pos = get( ax, 'Position' );
- axesHeight = pos(4);
- % Make sure we don't adjust away the axes entirely!
- heightAdjust = min( (axesHeight*0.9), labelHeight*axesHeight );
-
- % Move the axes
- if isappdata( ax, 'OriginalAxesPosition' )
- pos = getappdata( ax, 'OriginalAxesPosition' );
- else
- pos = get(ax,'Position');
- setappdata( ax, 'OriginalAxesPosition', pos );
- end
- if strcmpi( get( ax, 'XAxisLocation' ), 'Bottom' )
- % Move it up and reduce the height
- set( ax, 'Position', pos+[0 heightAdjust 0 -heightAdjust] )
- else
- % Just reduce the height
- set( ax, 'Position', pos+[0 0 0 -heightAdjust] )
- end
- set( ax, 'Units', oldUnits );
- set( ax, 'ActivePositionProperty', 'OuterPosition' );
-
- % Make sure we find out if axes properties are changed
- addListeners( ax );
-
- end % repositionAxes
-
-%-------------------------------------------------------------------------%
- function repositionXLabel( ax )
- % Try to work out where to put the xlabel
- removeListeners( ax );
- labelHeight = getLabelHeight(ax);
-
- % Use the new max extent to move the xlabel. We may also need to
- % move the title
- xlab = get(ax,'XLabel');
- titleh = get( ax, 'Title' );
- set( [xlab,titleh], 'Units', 'Normalized' );
- if strcmpi( get( ax, 'XAxisLocation' ), 'Top' )
- titleExtent = get( xlab, 'Extent' );
- set( xlab, 'Position', [0.5 1+labelHeight-titleExtent(4) 0] );
- set( titleh, 'Position', [0.5 1+labelHeight 0] );
- else
- set( xlab, 'Position', [0.5 -labelHeight 0] );
- set( titleh, 'Position', [0.5 1 0] );
- end
- addListeners( ax );
- end % repositionXLabel
-
-%-------------------------------------------------------------------------%
- function height = getLabelHeight(ax)
- height = 0;
- textLabels = findall( ax, 'Tag', 'RotatedXTickLabel' );
- if isempty(textLabels)
- return;
- end
- oldUnits = get( textLabels(1), 'Units' );
- set( textLabels, 'Units', 'Normalized' );
- for ll=1:numel(vals)
- ext = get( textLabels(ll), 'Extent' );
- if ext(4) > height
- height = ext(4);
- end
- end
- set( textLabels, 'Units', oldUnits );
- end % getLabelExtent
-
-%-------------------------------------------------------------------------%
- function updateFont()
- % Update the rotated text fonts when the axes font changes
- properties = {
- 'FontName'
- 'FontSize'
- 'FontAngle'
- 'FontWeight'
- 'FontUnits'
- };
- propertyValues = get( ax, properties );
- textLabels = findall( ax, 'Tag', 'RotatedXTickLabel' );
- set( textLabels, properties, propertyValues );
- end % updateFont
-
- function updateAlignment()
- textLabels = findall( ax, 'Tag', 'RotatedXTickLabel' );
- angle = get( textLabels(1), 'Rotation' );
- % Depending on the angle, we may need to change the alignment. We change
- % alignments within 5 degrees of each 90 degree orientation.
- if strcmpi( get( ax, 'XAxisLocation' ), 'Top' )
- if 0 <= angle && angle < 5
- set( textLabels, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Bottom' );
- elseif 5 <= angle && angle < 85
- set( textLabels, 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Bottom' );
- elseif 85 <= angle && angle < 95
- set( textLabels, 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Middle' );
- elseif 95 <= angle && angle < 175
- set( textLabels, 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Top' );
- elseif 175 <= angle && angle < 185
- set( textLabels, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Top' );
- elseif 185 <= angle && angle < 265
- set( textLabels, 'HorizontalAlignment', 'Right', 'VerticalAlignment', 'Top' );
- elseif 265 <= angle && angle < 275
- set( textLabels, 'HorizontalAlignment', 'Right', 'VerticalAlignment', 'Middle' );
- elseif 275 <= angle && angle < 355
- set( textLabels, 'HorizontalAlignment', 'Right', 'VerticalAlignment', 'Bottom' );
- else % 355-360
- set( textLabels, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Bottom' );
- end
- else
- if 0 <= angle && angle < 5
- set( textLabels, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Top' );
- elseif 5 <= angle && angle < 85
- set( textLabels, 'HorizontalAlignment', 'Right', 'VerticalAlignment', 'Top' );
- elseif 85 <= angle && angle < 95
- set( textLabels, 'HorizontalAlignment', 'Right', 'VerticalAlignment', 'Middle' );
- elseif 95 <= angle && angle < 175
- set( textLabels, 'HorizontalAlignment', 'Right', 'VerticalAlignment', 'Bottom' );
- elseif 175 <= angle && angle < 185
- set( textLabels, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Bottom' );
- elseif 185 <= angle && angle < 265
- set( textLabels, 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Bottom' );
- elseif 265 <= angle && angle < 275
- set( textLabels, 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Middle' );
- elseif 275 <= angle && angle < 355
- set( textLabels, 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Top' );
- else % 355-360
- set( textLabels, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Top' );
- end
- end
- end
-
-%-------------------------------------------------------------------------%
- function onAxesFontChanged( ~, ~ )
- updateFont();
- repositionAxes( ax );
- repositionXLabel( ax );
- end % onAxesFontChanged
-
-%-------------------------------------------------------------------------%
- function onAxesPositionChanged( ~, ~ )
- % We need to accept the new position, so remove the appdata before
- % redrawing
- if isappdata( ax, 'OriginalAxesPosition' )
- rmappdata( ax, 'OriginalAxesPosition' );
- end
- if isappdata( ax, 'OriginalXLabelPosition' )
- rmappdata( ax, 'OriginalXLabelPosition' );
- end
- repositionAxes( ax );
- repositionXLabel( ax );
- end % onAxesPositionChanged
-
-%-------------------------------------------------------------------------%
- function onXAxisLocationChanged( ~, ~ )
- updateAlignment();
- repositionAxes( ax );
- repositionXLabel( ax );
- end % onXAxisLocationChanged
-
-%-------------------------------------------------------------------------%
- function onAxesLimitsChanged( ~, ~ )
- % The limits have moved, so make sure the labels are still ok
- textLabels = findall( ax, 'Tag', 'RotatedXTickLabel' );
- xlim = get( ax, 'XLim' );
- ylim = get( ax, 'YLim' );
- if strcmpi( get( ax, 'XAxisLocation'), 'Bottom' )
- pos = [0 ylim(1)];
- else
- pos = [0 ylim(2)];
- end
- for tt=1:numel( textLabels )
- xval = get( textLabels(tt), 'UserData' );
- pos(1) = xval;
- % If the tick is off the edge, make it invisible
- if xvalxlim(2)
- set( textLabels(tt), 'Visible', 'off', 'Position', pos )
- elseif ~strcmpi( get( textLabels(tt), 'Visible' ), 'on' )
- set( textLabels(tt), 'Visible', 'on', 'Position', pos )
- else
- % Just set the position
- set( textLabels(tt), 'Position', pos );
- end
- end
-
- repositionXLabel( ax );
- end % onAxesPositionChanged
-
-%-------------------------------------------------------------------------%
- function onTextLabelDeleted( ~, ~ )
- % The final text label has been deleted. This is likely from a
- % "cla" or "close" call, so we should remove all of our dirty
- % hacks.
- restoreDefaultLabels(ax);
- end
-
-%-------------------------------------------------------------------------%
- function addListeners( ax )
- % Create listeners. We store the array of listeners in the axes to make
- % sure that they have the same life-span as the axes they are listening to.
- axh = handle( ax );
- listeners = [
- handle.listener( axh, findprop( axh, 'FontName' ), 'PropertyPostSet', @onAxesFontChanged )
- handle.listener( axh, findprop( axh, 'FontSize' ), 'PropertyPostSet', @onAxesFontChanged )
- handle.listener( axh, findprop( axh, 'FontWeight' ), 'PropertyPostSet', @onAxesFontChanged )
- handle.listener( axh, findprop( axh, 'FontAngle' ), 'PropertyPostSet', @onAxesFontChanged )
- handle.listener( axh, findprop( axh, 'FontUnits' ), 'PropertyPostSet', @onAxesFontChanged )
- handle.listener( axh, findprop( axh, 'OuterPosition' ), 'PropertyPostSet', @onAxesPositionChanged )
- handle.listener( axh, findprop( axh, 'XLim' ), 'PropertyPostSet', @onAxesLimitsChanged )
- handle.listener( axh, findprop( axh, 'YLim' ), 'PropertyPostSet', @onAxesLimitsChanged )
- handle.listener( axh, findprop( axh, 'XAxisLocation' ), 'PropertyPostSet', @onXAxisLocationChanged )
- ];
- setappdata( ax, 'RotateXLabelsListeners', listeners );
- end % addListeners
-
-%-------------------------------------------------------------------------%
- function removeListeners( ax )
- % Rempove any property listeners whilst we are fiddling with the axes
- if isappdata( ax, 'RotateXLabelsListeners' )
- delete( getappdata( ax, 'RotateXLabelsListeners' ) );
- rmappdata( ax, 'RotateXLabelsListeners' );
- end
- end % removeListeners
-
-
-
-end % EOF
\ No newline at end of file
diff --git a/libraries/xticklabel_rotate.m b/libraries/xticklabel_rotate.m
deleted file mode 100644
index f01eadc2..00000000
--- a/libraries/xticklabel_rotate.m
+++ /dev/null
@@ -1,212 +0,0 @@
-function hText = xticklabel_rotate(XTick,rot,varargin)
-%hText = xticklabel_rotate(XTick,rot,XTickLabel,varargin) Rotate XTickLabel
-%
-% Syntax: xticklabel_rotate
-%
-% Input:
-% {opt} XTick - vector array of XTick positions & values (numeric)
-% uses current XTick values or XTickLabel cell array by
-% default (if empty)
-% {opt} rot - angle of rotation in degrees, 90° by default
-% {opt} XTickLabel - cell array of label strings
-% {opt} [var] - "Property-value" pairs passed to text generator
-% ex: 'interpreter','none'
-% 'Color','m','Fontweight','bold'
-%
-% Output: hText - handle vector to text labels
-%
-% Example 1: Rotate existing XTickLabels at their current position by 90°
-% xticklabel_rotate
-%
-% Example 2: Rotate existing XTickLabels at their current position by 45° and change
-% font size
-% xticklabel_rotate([],45,[],'Fontsize',14)
-%
-% Example 3: Set the positions of the XTicks and rotate them 90°
-% figure; plot([1960:2004],randn(45,1)); xlim([1960 2004]);
-% xticklabel_rotate([1960:2:2004]);
-%
-% Example 4: Use text labels at XTick positions rotated 45° without tex interpreter
-% xticklabel_rotate(XTick,45,NameFields,'interpreter','none');
-%
-% Example 5: Use text labels rotated 90° at current positions
-% xticklabel_rotate([],90,NameFields);
-%
-% Note : you can not re-run xticklabel_rotate on the same graph.
-%
-%
-
-
-% This is a modified version of xticklabel_rotate90 by Denis Gilbert
-% Modifications include Text labels (in the form of cell array)
-% Arbitrary angle rotation
-% Output of text handles
-% Resizing of axes and title/xlabel/ylabel positions to maintain same overall size
-% and keep text on plot
-% (handles small window resizing after, but not well due to proportional placement with
-% fixed font size. To fix this would require a serious resize function)
-% Uses current XTick by default
-% Uses current XTickLabel is different from XTick values (meaning has been already defined)
-
-% Brian FG Katz
-% bfgkatz@hotmail.com
-% 23-05-03
-% Modified 03-11-06 after user comment
-% Allow for exisiting XTickLabel cell array
-
-% Other m-files required: cell2mat
-% Subfunctions: none
-% MAT-files required: none
-%
-% See also: xticklabel_rotate90, TEXT, SET
-
-% Based on xticklabel_rotate90
-% Author: Denis Gilbert, Ph.D., physical oceanography
-% Maurice Lamontagne Institute, Dept. of Fisheries and Oceans Canada
-% email: gilbertd@dfo-mpo.gc.ca Web: http://www.qc.dfo-mpo.gc.ca/iml/
-% February 1998; Last revision: 24-Mar-2003
-
-% check to see if xticklabel_rotate has already been here (no other reason for this to happen)
-if isempty(get(gca,'XTickLabel')),
- error('xticklabel_rotate : can not process, either xticklabel_rotate has already been run or XTickLabel field has been erased') ;
-end
-
-% if no XTickLabel AND no XTick are defined use the current XTickLabel
-%if nargin < 3 & (~exist('XTick') | isempty(XTick)),
-if (nargin < 3 || isempty(varargin{1})) & (~exist('XTick') | isempty(XTick)),
- xTickLabels = get(gca,'XTickLabel') ; % use current XTickLabel
- if ~iscell(xTickLabels)
- % remove trailing spaces if exist (typical with auto generated XTickLabel)
- temp1 = num2cell(xTickLabels,2) ;
- for loop = 1:length(temp1),
- temp1{loop} = deblank(temp1{loop}) ;
- end
- xTickLabels = temp1 ;
- end
-varargin = varargin(2:length(varargin));
-end
-
-% if no XTick is defined use the current XTick
-if (~exist('XTick') | isempty(XTick)),
- XTick = get(gca,'XTick') ; % use current XTick
-end
-
-%Make XTick a column vector
-XTick = XTick(:);
-
-if ~exist('xTickLabels'),
- % Define the xtickLabels
- % If XtickLabel is passed as a cell array then use the text
- if (length(varargin)>0) & (iscell(varargin{1})),
- xTickLabels = varargin{1};
- varargin = varargin(2:length(varargin));
- else
- xTickLabels = num2str(XTick);
- end
-end
-
-if length(XTick) ~= length(xTickLabels),
- error('xticklabel_rotate : must have same number of elements in "XTick" and "XTickLabel"') ;
-end
-
-%Set the Xtick locations and set XTicklabel to an empty string
-set(gca,'XTick',XTick,'XTickLabel','')
-
-if nargin < 2,
- rot = 90 ;
-end
-
-% Determine the location of the labels based on the position
-% of the xlabel
-hxLabel = get(gca,'XLabel'); % Handle to xlabel
-xLabelString = get(hxLabel,'String');
-
-% if ~isempty(xLabelString)
-% warning('You may need to manually reset the XLABEL vertical position')
-% end
-
-set(hxLabel,'Units','data');
-xLabelPosition = get(hxLabel,'Position');
-y = xLabelPosition(2);
-
-%CODE below was modified following suggestions from Urs Schwarz
-y=repmat(y,size(XTick,1),1);
-% retrieve current axis' fontsize
-fs = get(gca,'fontsize');
-
-% Place the new xTickLabels by creating TEXT objects
-hText = text(XTick, y, xTickLabels,'fontsize',fs);
-
-% Rotate the text objects by ROT degrees
-set(hText,'Rotation',rot,'HorizontalAlignment','right',varargin{:})
-
-% Adjust the size of the axis to accomodate for longest label (like if they are text ones)
-% This approach keeps the top of the graph at the same place and tries to keep xlabel at the same place
-% This approach keeps the right side of the graph at the same place
-
-set(get(gca,'xlabel'),'units','data') ;
- labxorigpos_data = get(get(gca,'xlabel'),'position') ;
-set(get(gca,'ylabel'),'units','data') ;
- labyorigpos_data = get(get(gca,'ylabel'),'position') ;
-set(get(gca,'title'),'units','data') ;
- labtorigpos_data = get(get(gca,'title'),'position') ;
-
-set(gca,'units','pixel') ;
-set(hText,'units','pixel') ;
-set(get(gca,'xlabel'),'units','pixel') ;
-set(get(gca,'ylabel'),'units','pixel') ;
-
-origpos = get(gca,'position') ;
-textsizes = cell2mat(get(hText,'extent')) ;
-longest = max(textsizes(:,4)) ;
-
-laborigext = get(get(gca,'xlabel'),'extent') ;
-laborigpos = get(get(gca,'xlabel'),'position') ;
-
-
-labyorigext = get(get(gca,'ylabel'),'extent') ;
-labyorigpos = get(get(gca,'ylabel'),'position') ;
-leftlabdist = labyorigpos(1) + labyorigext(1) ;
-
-% assume first entry is the farthest left
-leftpos = get(hText(1),'position') ;
-leftext = get(hText(1),'extent') ;
-leftdist = leftpos(1) + leftext(1) ;
-if leftdist > 0, leftdist = 0 ; end % only correct for off screen problems
-
-botdist = origpos(2) + laborigpos(2) ;
-newpos = [origpos(1)-leftdist longest+botdist origpos(3)+leftdist origpos(4)-longest+origpos(2)-botdist] ;
-set(gca,'position',newpos) ;
-
-% readjust position of nex labels after resize of plot
-set(hText,'units','data') ;
-for loop= 1:length(hText),
- set(hText(loop),'position',[XTick(loop), y(loop)]) ;
-end
-
-
-% adjust position of xlabel and ylabel
-laborigpos = get(get(gca,'xlabel'),'position') ;
-set(get(gca,'xlabel'),'position',[laborigpos(1) laborigpos(2)-longest 0]) ;
-
-% switch to data coord and fix it all
-set(get(gca,'ylabel'),'units','data') ;
-set(get(gca,'ylabel'),'position',labyorigpos_data) ;
-set(get(gca,'title'),'position',labtorigpos_data) ;
-
-set(get(gca,'xlabel'),'units','data') ;
- labxorigpos_data_new = get(get(gca,'xlabel'),'position') ;
-set(get(gca,'xlabel'),'position',[labxorigpos_data(1) labxorigpos_data_new(2)]) ;
-
-
-% Reset all units to normalized to allow future resizing
-set(get(gca,'xlabel'),'units','normalized') ;
-set(get(gca,'ylabel'),'units','normalized') ;
-set(get(gca,'title'),'units','normalized') ;
-set(hText,'units','normalized') ;
-set(gca,'units','normalized') ;
-
-if nargout < 1,
- clear hText
-end
-
diff --git a/libraries/zernike.zip b/libraries/zernike.zip
deleted file mode 100644
index acd84426..00000000
Binary files a/libraries/zernike.zip and /dev/null differ
diff --git a/libraries/zernike/zernfun.m b/libraries/zernike/zernfun.m
deleted file mode 100644
index d62c54fb..00000000
--- a/libraries/zernike/zernfun.m
+++ /dev/null
@@ -1,203 +0,0 @@
-function z = zernfun(n,m,r,theta,nflag)
-%ZERNFUN Zernike functions of order N and frequency M on the unit circle.
-% Z = ZERNFUN(N,M,R,THETA) returns the Zernike functions of order N
-% and angular frequency M, evaluated at positions (R,THETA) on the
-% unit circle. N is a vector of positive integers (including 0), and
-% M is a vector with the same number of elements as N. Each element
-% k of M must be a positive integer, with possible values M(k) = -N(k)
-% to +N(k) in steps of 2. R is a vector of numbers between 0 and 1,
-% and THETA is a vector of angles. R and THETA must have the same
-% length. The output Z is a matrix with one column for every (N,M)
-% pair, and one row for every (R,THETA) pair.
-%
-% Z = ZERNFUN(N,M,R,THETA,'norm') returns the normalized Zernike
-% functions. The normalization factor sqrt((2-delta(m,0))*(n+1)/pi),
-% with delta(m,0) the Kronecker delta, is chosen so that the integral
-% of (r * [Znm(r,theta)]^2) over the unit circle (from r=0 to r=1,
-% and theta=0 to theta=2*pi) is unity. For the non-normalized
-% polynomials, max(Znm(r=1,theta))=1 for all [n,m].
-%
-% The Zernike functions are an orthogonal basis on the unit circle.
-% They are used in disciplines such as astronomy, optics, and
-% optometry to describe functions on a circular domain.
-%
-% The following table lists the first 15 Zernike functions.
-%
-% n m Zernike function Normalization
-% --------------------------------------------------
-% 0 0 1 1
-% 1 1 r * cos(theta) 2
-% 1 -1 r * sin(theta) 2
-% 2 -2 r^2 * cos(2*theta) sqrt(6)
-% 2 0 (2*r^2 - 1) sqrt(3)
-% 2 2 r^2 * sin(2*theta) sqrt(6)
-% 3 -3 r^3 * cos(3*theta) sqrt(8)
-% 3 -1 (3*r^3 - 2*r) * cos(theta) sqrt(8)
-% 3 1 (3*r^3 - 2*r) * sin(theta) sqrt(8)
-% 3 3 r^3 * sin(3*theta) sqrt(8)
-% 4 -4 r^4 * cos(4*theta) sqrt(10)
-% 4 -2 (4*r^4 - 3*r^2) * cos(2*theta) sqrt(10)
-% 4 0 6*r^4 - 6*r^2 + 1 sqrt(5)
-% 4 2 (4*r^4 - 3*r^2) * cos(2*theta) sqrt(10)
-% 4 4 r^4 * sin(4*theta) sqrt(10)
-% --------------------------------------------------
-%
-% Example 1:
-%
-% % Display the Zernike function Z(n=5,m=1)
-% x = -1:0.01:1;
-% [X,Y] = meshgrid(x,x);
-% [theta,r] = cart2pol(X,Y);
-% idx = r<=1;
-% z = nan(size(X));
-% z(idx) = zernfun(5,1,r(idx),theta(idx));
-% figure
-% pcolor(x,x,z), shading interp
-% axis square, colorbar
-% title('Zernike function Z_5^1(r,\theta)')
-%
-% Example 2:
-%
-% % Display the first 10 Zernike functions
-% x = -1:0.01:1;
-% [X,Y] = meshgrid(x,x);
-% [theta,r] = cart2pol(X,Y);
-% idx = r<=1;
-% z = nan(size(X));
-% n = [0 1 1 2 2 2 3 3 3 3];
-% m = [0 -1 1 -2 0 2 -3 -1 1 3];
-% Nplot = [4 10 12 16 18 20 22 24 26 28];
-% y = zernfun(n,m,r(idx),theta(idx));
-% figure('Units','normalized')
-% for k = 1:10
-% z(idx) = y(:,k);
-% subplot(4,7,Nplot(k))
-% pcolor(x,x,z), shading interp
-% set(gca,'XTick',[],'YTick',[])
-% axis square
-% title(['Z_{' num2str(n(k)) '}^{' num2str(m(k)) '}'])
-% end
-%
-% See also ZERNPOL, ZERNFUN2.
-
-% Paul Fricker 11/13/2006
-
-
-% Check and prepare the inputs:
-% -----------------------------
-if ( ~any(size(n)==1) ) || ( ~any(size(m)==1) )
- error('zernfun:NMvectors','N and M must be vectors.')
-end
-
-if length(n)~=length(m)
- error('zernfun:NMlength','N and M must be the same length.')
-end
-
-n = n(:);
-m = m(:);
-if any(mod(n-m,2))
- error('zernfun:NMmultiplesof2', ...
- 'All N and M must differ by multiples of 2 (including 0).')
-end
-
-if any(m>n)
- error('zernfun:MlessthanN', ...
- 'Each M must be less than or equal to its corresponding N.')
-end
-
-if any( r>1 | r<0 )
- error('zernfun:Rlessthan1','All R must be between 0 and 1.')
-end
-
-if ( ~any(size(r)==1) ) || ( ~any(size(theta)==1) )
- error('zernfun:RTHvector','R and THETA must be vectors.')
-end
-
-r = r(:);
-theta = theta(:);
-length_r = length(r);
-if length_r~=length(theta)
- error('zernfun:RTHlength', ...
- 'The number of R- and THETA-values must be equal.')
-end
-
-% Check normalization:
-% --------------------
-if nargin==5 && ischar(nflag)
- isnorm = strcmpi(nflag,'norm');
- if ~isnorm
- error('zernfun:normalization','Unrecognized normalization flag.')
- end
-else
- isnorm = false;
-end
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Compute the Zernike Polynomials
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-% Determine the required powers of r:
-% -----------------------------------
-m_abs = abs(m);
-rpowers = [];
-for j = 1:length(n)
- rpowers = [rpowers m_abs(j):2:n(j)];
-end
-rpowers = unique(rpowers);
-
-% Pre-compute the values of r raised to the required powers,
-% and compile them in a matrix:
-% -----------------------------
-if rpowers(1)==0
- rpowern = arrayfun(@(p)r.^p,rpowers(2:end),'UniformOutput',false);
- rpowern = cat(2,rpowern{:});
- rpowern = [ones(length_r,1) rpowern];
-else
- rpowern = arrayfun(@(p)r.^p,rpowers,'UniformOutput',false);
- rpowern = cat(2,rpowern{:});
-end
-
-% Compute the values of the polynomials:
-% --------------------------------------
-y = zeros(length_r,length(n));
-for j = 1:length(n)
- s = 0:(n(j)-m_abs(j))/2;
- pows = n(j):-2:m_abs(j);
- for k = length(s):-1:1
- p = (1-2*mod(s(k),2))* ...
- prod(2:(n(j)-s(k)))/ ...
- prod(2:s(k))/ ...
- prod(2:((n(j)-m_abs(j))/2-s(k)))/ ...
- prod(2:((n(j)+m_abs(j))/2-s(k)));
- idx = (pows(k)==rpowers);
- y(:,j) = y(:,j) + p*rpowern(:,idx);
- end
-
- if isnorm
-% y(:,j) = y(:,j)*sqrt((1+(m(j)~=0))*(n(j)+1)/pi);
-
- if m(j)==0
- y(:,j) = y(:,j)*sqrt((n(j)+1));
- else
- y(:,j) = y(:,j)*sqrt(2*(n(j)+1));
- end
-
- end
-end
-% END: Compute the Zernike Polynomials
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-% Compute the Zernike functions:
-% ------------------------------
-idx_pos = m>0;
-idx_neg = m<0;
-
-z = y;
-if any(idx_pos)
- z(:,idx_pos) = y(:,idx_pos).*sin(theta*m(idx_pos)');
-end
-if any(idx_neg)
- z(:,idx_neg) = y(:,idx_neg).*cos(theta*m(idx_neg)');
-end
-
-% EOF zernfun
\ No newline at end of file
diff --git a/libraries/zernike/zernfun2.m b/libraries/zernike/zernfun2.m
deleted file mode 100644
index 0674cb0c..00000000
--- a/libraries/zernike/zernfun2.m
+++ /dev/null
@@ -1,76 +0,0 @@
-function z = zernfun2(p,r,theta,nflag)
-%ZERNFUN2 Single-index Zernike functions on the unit circle.
-% Z = ZERNFUN2(P,R,THETA) returns the Pth Zernike functions evaluated
-% at positions (R,THETA) on the unit circle. P is a vector of positive
-% integers between 0 and 35, R is a vector of numbers between 0 and 1,
-% and THETA is a vector of angles. R and THETA must have the same
-% length. The output Z is a matrix with one column for every P-value,
-% and one row for every (R,THETA) pair.
-%
-% Z = ZERNFUN2(P,R,THETA,'norm') returns the normalized Zernike
-% functions, defined such that the integral of (r * [Zp(r,theta)]^2)
-% over the unit circle (from r=0 to r=1, and theta=0 to theta=2*pi)
-% is unity. For the non-normalized polynomials, max(Zp(r=1,theta))=1
-% for all p.
-%
-% NOTE: ZERNFUN2 returns the same output as ZERNFUN, for the first 36
-% Zernike functions (order N<=7). In some disciplines it is
-% traditional to label the first 36 functions using a single mode
-% number P instead of separate numbers for the order N and azimuthal
-% frequency M.
-%
-% Example:
-%
-% % Display the first 16 Zernike functions
-% x = -1:0.01:1;
-% [X,Y] = meshgrid(x,x);
-% [theta,r] = cart2pol(X,Y);
-% idx = r<=1;
-% p = 0:15;
-% z = nan(size(X));
-% y = zernfun2(p,r(idx),theta(idx));
-% figure('Units','normalized')
-% for k = 1:length(p)
-% z(idx) = y(:,k);
-% subplot(4,4,k)
-% pcolor(x,x,z), shading interp
-% set(gca,'XTick',[],'YTick',[])
-% axis square
-% title(['Z_{' num2str(p(k)) '}'])
-% end
-%
-% See also ZERNPOL, ZERNFUN.
-
-% Paul Fricker 11/13/2006
-
-
-% Check and prepare the inputs:
-% -----------------------------
-if min(size(p))~=1
- error('zernfun2:Pvector','Input P must be vector.')
-end
-
-if any(p)>35
- error('zernfun2:P36', ...
- ['ZERNFUN2 only computes the first 36 Zernike functions ' ...
- '(P = 0 to 35).'])
-end
-
-% Get the order and frequency corresonding to the function number:
-% ----------------------------------------------------------------
-p = p(:);
-n = ceil((-3+sqrt(9+8*p))/2);
-m = 2*p - n.*(n+2);
-
-% Pass the inputs to the function ZERNFUN:
-% ----------------------------------------
-switch nargin
- case 3
- z = zernfun(n,m,r,theta);
- case 4
- z = zernfun(n,m,r,theta,nflag);
- otherwise
- error('zernfun2:nargin','Incorrect number of inputs.')
-end
-
-% EOF zernfun2
\ No newline at end of file
diff --git a/libraries/zernike/zernpol.m b/libraries/zernike/zernpol.m
deleted file mode 100644
index 1083779a..00000000
--- a/libraries/zernike/zernpol.m
+++ /dev/null
@@ -1,180 +0,0 @@
-function z = zernpol(n,m,r,nflag)
-%ZERNPOL Radial Zernike polynomials of order N and frequency M.
-% Z = ZERNPOL(N,M,R) returns the radial Zernike polynomials of
-% order N and frequency M, evaluated at R. N is a vector of
-% positive integers (including 0), and M is a vector with the
-% same number of elements as N. Each element k of M must be a
-% positive integer, with possible values M(k) = 0,2,4,...,N(k)
-% for N(k) even, and M(k) = 1,3,5,...,N(k) for N(k) odd. R is
-% a vector of numbers between 0 and 1. The output Z is a matrix
-% with one column for every (N,M) pair, and one row for every
-% element in R.
-%
-% Z = ZERNPOL(N,M,R,'norm') returns the normalized Zernike poly-
-% nomials. The normalization factor Nnm = sqrt(2*(n+1)) is
-% chosen so that the integral of (r * [Znm(r)]^2) from r=0 to
-% r=1 is unity. For the non-normalized polynomials, Znm(r=1)=1
-% for all [n,m].
-%
-% The radial Zernike polynomials are the radial portion of the
-% Zernike functions, which are an orthogonal basis on the unit
-% circle. The series representation of the radial Zernike
-% polynomials is
-%
-% (n-m)/2
-% __
-% m \ s n-2s
-% Z(r) = /__ (-1) [(n-s)!/(s!((n-m)/2-s)!((n+m)/2-s)!)] * r
-% n s=0
-%
-% The following table shows the first 12 polynomials.
-%
-% n m Zernike polynomial Normalization
-% ---------------------------------------------
-% 0 0 1 sqrt(2)
-% 1 1 r 2
-% 2 0 2*r^2 - 1 sqrt(6)
-% 2 2 r^2 sqrt(6)
-% 3 1 3*r^3 - 2*r sqrt(8)
-% 3 3 r^3 sqrt(8)
-% 4 0 6*r^4 - 6*r^2 + 1 sqrt(10)
-% 4 2 4*r^4 - 3*r^2 sqrt(10)
-% 4 4 r^4 sqrt(10)
-% 5 1 10*r^5 - 12*r^3 + 3*r sqrt(12)
-% 5 3 5*r^5 - 4*r^3 sqrt(12)
-% 5 5 r^5 sqrt(12)
-% ---------------------------------------------
-%
-% Example:
-%
-% % Display three example Zernike radial polynomials
-% r = 0:0.01:1;
-% n = [3 2 5];
-% m = [1 2 1];
-% z = zernpol(n,m,r);
-% figure
-% plot(r,z)
-% grid on
-% legend('Z_3^1(r)','Z_2^2(r)','Z_5^1(r)','Location','NorthWest')
-%
-% See also ZERNFUN, ZERNFUN2.
-
-% A note on the algorithm.
-% ------------------------
-% The radial Zernike polynomials are computed using the series
-% representation shown in the Help section above. For many special
-% functions, direct evaluation using the series representation can
-% produce poor numerical results (floating point errors), because
-% the summation often involves computing small differences between
-% large successive terms in the series. (In such cases, the functions
-% are often evaluated using alternative methods such as recurrence
-% relations: see the Legendre functions, for example). For the Zernike
-% polynomials, however, this problem does not arise, because the
-% polynomials are evaluated over the finite domain r = (0,1), and
-% because the coefficients for a given polynomial are generally all
-% of similar magnitude.
-%
-% ZERNPOL has been written using a vectorized implementation: multiple
-% Zernike polynomials can be computed (i.e., multiple sets of [N,M]
-% values can be passed as inputs) for a vector of points R. To achieve
-% this vectorization most efficiently, the algorithm in ZERNPOL
-% involves pre-determining all the powers p of R that are required to
-% compute the outputs, and then compiling the {R^p} into a single
-% matrix. This avoids any redundant computation of the R^p, and
-% minimizes the sizes of certain intermediate variables.
-%
-% Paul Fricker 11/13/2006
-
-
-% Check and prepare the inputs:
-% -----------------------------
-if ( ~any(size(n)==1) ) || ( ~any(size(m)==1) )
- error('zernpol:NMvectors','N and M must be vectors.')
-end
-
-if length(n)~=length(m)
- error('zernpol:NMlength','N and M must be the same length.')
-end
-
-n = n(:);
-m = m(:);
-length_n = length(n);
-
-if any(mod(n-m,2))
- error('zernpol:NMmultiplesof2','All N and M must differ by multiples of 2 (including 0).')
-end
-
-if any(m<0)
- error('zernpol:Mpositive','All M must be positive.')
-end
-
-if any(m>n)
- error('zernpol:MlessthanN','Each M must be less than or equal to its corresponding N.')
-end
-
-if any( r>1 | r<0 )
- error('zernpol:Rlessthan1','All R must be between 0 and 1.')
-end
-
-if ~any(size(r)==1)
- error('zernpol:Rvector','R must be a vector.')
-end
-
-r = r(:);
-length_r = length(r);
-
-if nargin==4
- isnorm = ischar(nflag) & strcmpi(nflag,'norm');
- if ~isnorm
- error('zernpol:normalization','Unrecognized normalization flag.')
- end
-else
- isnorm = false;
-end
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Compute the Zernike Polynomials
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-% Determine the required powers of r:
-% -----------------------------------
-rpowers = [];
-for j = 1:length(n)
- rpowers = [rpowers m(j):2:n(j)];
-end
-rpowers = unique(rpowers);
-
-% Pre-compute the values of r raised to the required powers,
-% and compile them in a matrix:
-% -----------------------------
-if rpowers(1)==0
- rpowern = arrayfun(@(p)r.^p,rpowers(2:end),'UniformOutput',false);
- rpowern = cat(2,rpowern{:});
- rpowern = [ones(length_r,1) rpowern];
-else
- rpowern = arrayfun(@(p)r.^p,rpowers,'UniformOutput',false);
- rpowern = cat(2,rpowern{:});
-end
-
-% Compute the values of the polynomials:
-% --------------------------------------
-z = zeros(length_r,length_n);
-for j = 1:length_n
- s = 0:(n(j)-m(j))/2;
- pows = n(j):-2:m(j);
- for k = length(s):-1:1
- p = (1-2*mod(s(k),2))* ...
- prod(2:(n(j)-s(k)))/ ...
- prod(2:s(k))/ ...
- prod(2:((n(j)-m(j))/2-s(k)))/ ...
- prod(2:((n(j)+m(j))/2-s(k)));
- idx = (pows(k)==rpowers);
- z(:,j) = z(:,j) + p*rpowern(:,idx);
- end
-
- if isnorm
- z(:,j) = z(:,j)*sqrt(2*(n(j)+1));
- end
-end
-
-% EOF zernpol
\ No newline at end of file
diff --git a/license.txt b/license.txt
deleted file mode 100644
index 1301cdfa..00000000
--- a/license.txt
+++ /dev/null
@@ -1,300 +0,0 @@
-
-nSTAT v1 Copyright (C) 2012 Masschusetts Institute of Technology
-Cajigas, I, Malik, WQ, Brown, EN
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published
-by the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-
\ No newline at end of file
diff --git a/matlab_port/Analysis.py b/matlab_port/Analysis.py
new file mode 100644
index 00000000..ab56f9e7
--- /dev/null
+++ b/matlab_port/Analysis.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: Analysis.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class Analysis:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'Analysis.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/CIF.py b/matlab_port/CIF.py
new file mode 100644
index 00000000..b4c63244
--- /dev/null
+++ b/matlab_port/CIF.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: CIF.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class CIF:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'CIF.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/ConfidenceInterval.py b/matlab_port/ConfidenceInterval.py
new file mode 100644
index 00000000..4afcfbeb
--- /dev/null
+++ b/matlab_port/ConfidenceInterval.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: ConfidenceInterval.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class ConfidenceInterval:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'ConfidenceInterval.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/ConfigColl.py b/matlab_port/ConfigColl.py
new file mode 100644
index 00000000..94ed331e
--- /dev/null
+++ b/matlab_port/ConfigColl.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: ConfigColl.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class ConfigColl:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'ConfigColl.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/CovColl.py b/matlab_port/CovColl.py
new file mode 100644
index 00000000..7361212b
--- /dev/null
+++ b/matlab_port/CovColl.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: CovColl.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class CovColl:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'CovColl.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/Covariate.py b/matlab_port/Covariate.py
new file mode 100644
index 00000000..75c2ebac
--- /dev/null
+++ b/matlab_port/Covariate.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: Covariate.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class Covariate:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'Covariate.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/DecodingAlgorithms.py b/matlab_port/DecodingAlgorithms.py
new file mode 100644
index 00000000..bfa9eee2
--- /dev/null
+++ b/matlab_port/DecodingAlgorithms.py
@@ -0,0 +1,15 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: DecodingAlgorithms.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+from nstat.decoding_algorithms import DecodingAlgorithms
+
+__all__ = ['DecodingAlgorithms']
diff --git a/matlab_port/Events.py b/matlab_port/Events.py
new file mode 100644
index 00000000..0fb6dce3
--- /dev/null
+++ b/matlab_port/Events.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: Events.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class Events:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'Events.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/FitResSummary.py b/matlab_port/FitResSummary.py
new file mode 100644
index 00000000..e686f7db
--- /dev/null
+++ b/matlab_port/FitResSummary.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: FitResSummary.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class FitResSummary:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'FitResSummary.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/FitResult.py b/matlab_port/FitResult.py
new file mode 100644
index 00000000..836accde
--- /dev/null
+++ b/matlab_port/FitResult.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: FitResult.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class FitResult:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'FitResult.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/History.py b/matlab_port/History.py
new file mode 100644
index 00000000..425eb9c1
--- /dev/null
+++ b/matlab_port/History.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: History.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class History:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'History.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/PointProcessSimulationThinning_mdl_r2011a.py b/matlab_port/PointProcessSimulationThinning_mdl_r2011a.py
new file mode 100644
index 00000000..1d95f24f
--- /dev/null
+++ b/matlab_port/PointProcessSimulationThinning_mdl_r2011a.py
@@ -0,0 +1,27 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: PointProcessSimulationThinning.mdl.r2011a
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+SOURCE_MODEL = Path(r'/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local/PointProcessSimulationThinning.mdl.r2011a')
+
+def load_text(path: str | Path | None = None) -> str:
+ p = Path(path) if path is not None else SOURCE_MODEL
+ return p.read_text(encoding='utf-8', errors='ignore')
+
+def summarize(path: str | Path | None = None) -> dict[str, object]:
+ text = load_text(path)
+ lines = text.splitlines()
+ frame = pd.DataFrame({'line_number': np.arange(1, len(lines) + 1), 'line_text': lines})
+ return {
+ 'source': 'PointProcessSimulationThinning.mdl.r2011a',
+ 'line_count': int(frame.shape[0]),
+ 'block_count_guess': int(frame['line_text'].str.contains('Block {', regex=False).sum()),
+ }
diff --git a/matlab_port/PointProcessSimulation_mdl_r2010b.py b/matlab_port/PointProcessSimulation_mdl_r2010b.py
new file mode 100644
index 00000000..4ef6bf73
--- /dev/null
+++ b/matlab_port/PointProcessSimulation_mdl_r2010b.py
@@ -0,0 +1,27 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: PointProcessSimulation.mdl.r2010b
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+SOURCE_MODEL = Path(r'/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local/PointProcessSimulation.mdl.r2010b')
+
+def load_text(path: str | Path | None = None) -> str:
+ p = Path(path) if path is not None else SOURCE_MODEL
+ return p.read_text(encoding='utf-8', errors='ignore')
+
+def summarize(path: str | Path | None = None) -> dict[str, object]:
+ text = load_text(path)
+ lines = text.splitlines()
+ frame = pd.DataFrame({'line_number': np.arange(1, len(lines) + 1), 'line_text': lines})
+ return {
+ 'source': 'PointProcessSimulation.mdl.r2010b',
+ 'line_count': int(frame.shape[0]),
+ 'block_count_guess': int(frame['line_text'].str.contains('Block {', regex=False).sum()),
+ }
diff --git a/matlab_port/PointProcessSimulation_mdl_r2011a.py b/matlab_port/PointProcessSimulation_mdl_r2011a.py
new file mode 100644
index 00000000..90cfcb65
--- /dev/null
+++ b/matlab_port/PointProcessSimulation_mdl_r2011a.py
@@ -0,0 +1,27 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: PointProcessSimulation.mdl.r2011a
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+SOURCE_MODEL = Path(r'/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local/PointProcessSimulation.mdl.r2011a')
+
+def load_text(path: str | Path | None = None) -> str:
+ p = Path(path) if path is not None else SOURCE_MODEL
+ return p.read_text(encoding='utf-8', errors='ignore')
+
+def summarize(path: str | Path | None = None) -> dict[str, object]:
+ text = load_text(path)
+ lines = text.splitlines()
+ frame = pd.DataFrame({'line_number': np.arange(1, len(lines) + 1), 'line_text': lines})
+ return {
+ 'source': 'PointProcessSimulation.mdl.r2011a',
+ 'line_count': int(frame.shape[0]),
+ 'block_count_guess': int(frame['line_text'].str.contains('Block {', regex=False).sum()),
+ }
diff --git a/matlab_port/PointProcessSimulation_mdl_r2011b.py b/matlab_port/PointProcessSimulation_mdl_r2011b.py
new file mode 100644
index 00000000..c0b8f25b
--- /dev/null
+++ b/matlab_port/PointProcessSimulation_mdl_r2011b.py
@@ -0,0 +1,27 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: PointProcessSimulation.mdl.r2011b
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+SOURCE_MODEL = Path(r'/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local/PointProcessSimulation.mdl.r2011b')
+
+def load_text(path: str | Path | None = None) -> str:
+ p = Path(path) if path is not None else SOURCE_MODEL
+ return p.read_text(encoding='utf-8', errors='ignore')
+
+def summarize(path: str | Path | None = None) -> dict[str, object]:
+ text = load_text(path)
+ lines = text.splitlines()
+ frame = pd.DataFrame({'line_number': np.arange(1, len(lines) + 1), 'line_text': lines})
+ return {
+ 'source': 'PointProcessSimulation.mdl.r2011b',
+ 'line_count': int(frame.shape[0]),
+ 'block_count_guess': int(frame['line_text'].str.contains('Block {', regex=False).sum()),
+ }
diff --git a/matlab_port/PointProcessSimulation_mdl_r2013a.py b/matlab_port/PointProcessSimulation_mdl_r2013a.py
new file mode 100644
index 00000000..5be503e9
--- /dev/null
+++ b/matlab_port/PointProcessSimulation_mdl_r2013a.py
@@ -0,0 +1,27 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: PointProcessSimulation.mdl.r2013a
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+SOURCE_MODEL = Path(r'/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local/PointProcessSimulation.mdl.r2013a')
+
+def load_text(path: str | Path | None = None) -> str:
+ p = Path(path) if path is not None else SOURCE_MODEL
+ return p.read_text(encoding='utf-8', errors='ignore')
+
+def summarize(path: str | Path | None = None) -> dict[str, object]:
+ text = load_text(path)
+ lines = text.splitlines()
+ frame = pd.DataFrame({'line_number': np.arange(1, len(lines) + 1), 'line_text': lines})
+ return {
+ 'source': 'PointProcessSimulation.mdl.r2013a',
+ 'line_count': int(frame.shape[0]),
+ 'block_count_guess': int(frame['line_text'].str.contains('Block {', regex=False).sum()),
+ }
diff --git a/matlab_port/SignalObj.py b/matlab_port/SignalObj.py
new file mode 100644
index 00000000..bbcd09d6
--- /dev/null
+++ b/matlab_port/SignalObj.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: SignalObj.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class SignalObj:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'SignalObj.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/TRANSLATION_MAP.json b/matlab_port/TRANSLATION_MAP.json
new file mode 100644
index 00000000..7ec83165
--- /dev/null
+++ b/matlab_port/TRANSLATION_MAP.json
@@ -0,0 +1,339 @@
+{
+ "repo_root": "/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local",
+ "output_root": "/Users/iahncajigas/Library/CloudStorage/Dropbox/Research/Matlab/nSTAT_currentRelease_Local/python/matlab_port",
+ "counts": {
+ "total": 64,
+ "by_kind": {
+ "class_scaffold": 16,
+ "alias": 1,
+ "mdl_scaffold": 6,
+ "function_scaffold": 8,
+ "examples_script": 14,
+ "script_scaffold": 18,
+ "paper_examples_entrypoint": 1
+ },
+ "helpfile_notebooks": 32
+ },
+ "entries": [
+ {
+ "source": "Analysis.m",
+ "target": "python/matlab_port/Analysis.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "CIF.m",
+ "target": "python/matlab_port/CIF.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "ConfidenceInterval.m",
+ "target": "python/matlab_port/ConfidenceInterval.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "ConfigColl.m",
+ "target": "python/matlab_port/ConfigColl.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "CovColl.m",
+ "target": "python/matlab_port/CovColl.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "Covariate.m",
+ "target": "python/matlab_port/Covariate.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "DecodingAlgorithms.m",
+ "target": "python/matlab_port/DecodingAlgorithms.py",
+ "kind": "alias"
+ },
+ {
+ "source": "Events.m",
+ "target": "python/matlab_port/Events.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "FitResSummary.m",
+ "target": "python/matlab_port/FitResSummary.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "FitResult.m",
+ "target": "python/matlab_port/FitResult.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "History.m",
+ "target": "python/matlab_port/History.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "PointProcessSimulation.mdl.r2010b",
+ "target": "python/matlab_port/PointProcessSimulation_mdl_r2010b.py",
+ "kind": "mdl_scaffold"
+ },
+ {
+ "source": "PointProcessSimulation.mdl.r2011a",
+ "target": "python/matlab_port/PointProcessSimulation_mdl_r2011a.py",
+ "kind": "mdl_scaffold"
+ },
+ {
+ "source": "PointProcessSimulation.mdl.r2011b",
+ "target": "python/matlab_port/PointProcessSimulation_mdl_r2011b.py",
+ "kind": "mdl_scaffold"
+ },
+ {
+ "source": "PointProcessSimulation.mdl.r2013a",
+ "target": "python/matlab_port/PointProcessSimulation_mdl_r2013a.py",
+ "kind": "mdl_scaffold"
+ },
+ {
+ "source": "PointProcessSimulationThinning.mdl.r2011a",
+ "target": "python/matlab_port/PointProcessSimulationThinning_mdl_r2011a.py",
+ "kind": "mdl_scaffold"
+ },
+ {
+ "source": "SignalObj.m",
+ "target": "python/matlab_port/SignalObj.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "Trial.m",
+ "target": "python/matlab_port/Trial.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "TrialConfig.m",
+ "target": "python/matlab_port/TrialConfig.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "data/Explicit Stimulus/GenCovMat.m",
+ "target": "python/matlab_port/data/Explicit Stimulus/GenCovMat.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "helpfiles/AnalysisExamples.m",
+ "target": "python/matlab_port/helpfiles/AnalysisExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/AnalysisExamples2.m",
+ "target": "python/matlab_port/helpfiles/AnalysisExamples2.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/ClassDefinitions.m",
+ "target": "python/matlab_port/helpfiles/ClassDefinitions.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/ConfigCollExamples.m",
+ "target": "python/matlab_port/helpfiles/ConfigCollExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/CovCollExamples.m",
+ "target": "python/matlab_port/helpfiles/CovCollExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/CovariateExamples.m",
+ "target": "python/matlab_port/helpfiles/CovariateExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/DecodingExample.m",
+ "target": "python/matlab_port/helpfiles/DecodingExample.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/DecodingExampleWithHist.m",
+ "target": "python/matlab_port/helpfiles/DecodingExampleWithHist.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/EventsExamples.m",
+ "target": "python/matlab_port/helpfiles/EventsExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/Examples.m",
+ "target": "python/matlab_port/helpfiles/Examples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/ExplicitStimulusWhiskerData.m",
+ "target": "python/matlab_port/helpfiles/ExplicitStimulusWhiskerData.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/FitResSummaryExamples.m",
+ "target": "python/matlab_port/helpfiles/FitResSummaryExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/FitResult.m",
+ "target": "python/matlab_port/helpfiles/FitResult.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "helpfiles/FitResultExamples.m",
+ "target": "python/matlab_port/helpfiles/FitResultExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/HippocampalPlaceCellExample.m",
+ "target": "python/matlab_port/helpfiles/HippocampalPlaceCellExample.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/HistoryExamples.m",
+ "target": "python/matlab_port/helpfiles/HistoryExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/HybridFilterExample.m",
+ "target": "python/matlab_port/helpfiles/HybridFilterExample.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/NetworkTutorial.m",
+ "target": "python/matlab_port/helpfiles/NetworkTutorial.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/NeuralSpikeAnalysis_top.m",
+ "target": "python/matlab_port/helpfiles/NeuralSpikeAnalysis_top.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/PPSimExample.m",
+ "target": "python/matlab_port/helpfiles/PPSimExample.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/PPThinning.m",
+ "target": "python/matlab_port/helpfiles/PPThinning.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/PSTHEstimation.m",
+ "target": "python/matlab_port/helpfiles/PSTHEstimation.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/SignalObjExamples.m",
+ "target": "python/matlab_port/helpfiles/SignalObjExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/SimulatedNetwork2.mdl",
+ "target": "python/matlab_port/helpfiles/SimulatedNetwork2_mdl.py",
+ "kind": "mdl_scaffold"
+ },
+ {
+ "source": "helpfiles/StimulusDecode2D.m",
+ "target": "python/matlab_port/helpfiles/StimulusDecode2D.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/TrialConfigExamples.m",
+ "target": "python/matlab_port/helpfiles/TrialConfigExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/TrialExamples.m",
+ "target": "python/matlab_port/helpfiles/TrialExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/ValidationDataSet.m",
+ "target": "python/matlab_port/helpfiles/ValidationDataSet.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/mEPSCAnalysis.m",
+ "target": "python/matlab_port/helpfiles/mEPSCAnalysis.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "helpfiles/nSTATPaperExamples.m",
+ "target": "python/matlab_port/helpfiles/nSTATPaperExamples.py",
+ "kind": "paper_examples_entrypoint"
+ },
+ {
+ "source": "helpfiles/nSpikeTrainExamples.m",
+ "target": "python/matlab_port/helpfiles/nSpikeTrainExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/nstCollExamples.m",
+ "target": "python/matlab_port/helpfiles/nstCollExamples.py",
+ "kind": "examples_script"
+ },
+ {
+ "source": "helpfiles/temp.m",
+ "target": "python/matlab_port/helpfiles/temp.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD.m",
+ "target": "python/matlab_port/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD_demo.m",
+ "target": "python/matlab_port/libraries/NearestSymmetricPositiveDefinite/NearestSymmetricPositiveDefinite/nearestSPD_demo.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "libraries/fixPSlinestyle.m",
+ "target": "python/matlab_port/libraries/fixPSlinestyle.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "libraries/rotateXLabels/rotateXLabels.m",
+ "target": "python/matlab_port/libraries/rotateXLabels/rotateXLabels.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "libraries/xticklabel_rotate.m",
+ "target": "python/matlab_port/libraries/xticklabel_rotate.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "libraries/zernike/zernfun.m",
+ "target": "python/matlab_port/libraries/zernike/zernfun.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "libraries/zernike/zernfun2.m",
+ "target": "python/matlab_port/libraries/zernike/zernfun2.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "libraries/zernike/zernpol.m",
+ "target": "python/matlab_port/libraries/zernike/zernpol.py",
+ "kind": "function_scaffold"
+ },
+ {
+ "source": "nSTAT_Install.m",
+ "target": "python/matlab_port/nSTAT_Install.py",
+ "kind": "script_scaffold"
+ },
+ {
+ "source": "nspikeTrain.m",
+ "target": "python/matlab_port/nspikeTrain.py",
+ "kind": "class_scaffold"
+ },
+ {
+ "source": "nstColl.m",
+ "target": "python/matlab_port/nstColl.py",
+ "kind": "class_scaffold"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/matlab_port/Trial.py b/matlab_port/Trial.py
new file mode 100644
index 00000000..5a2830b3
--- /dev/null
+++ b/matlab_port/Trial.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: Trial.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class Trial:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'Trial.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/TrialConfig.py b/matlab_port/TrialConfig.py
new file mode 100644
index 00000000..b0b8764d
--- /dev/null
+++ b/matlab_port/TrialConfig.py
@@ -0,0 +1,25 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: TrialConfig.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+class TrialConfig:
+ """Scaffold translated from MATLAB classdef."""
+
+ def __init__(self, *args, **kwargs) -> None:
+ self.args = args
+ self.kwargs = kwargs
+
+ def metadata(self) -> dict[str, object]:
+ return {
+ 'source': 'TrialConfig.m',
+ 'args_count': len(self.args),
+ 'kwargs': sorted(list(self.kwargs.keys())),
+ }
diff --git a/matlab_port/__init__.py b/matlab_port/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/matlab_port/data/Explicit Stimulus/GenCovMat.py b/matlab_port/data/Explicit Stimulus/GenCovMat.py
new file mode 100644
index 00000000..0f536f3f
--- /dev/null
+++ b/matlab_port/data/Explicit Stimulus/GenCovMat.py
@@ -0,0 +1,22 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: data/Explicit Stimulus/GenCovMat.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+def GenCovMat(*, t=None, J=None, y=None, K=None) -> dict[str, object]:
+ frame = pd.DataFrame({'row': np.arange(3, dtype=int)})
+ return {
+ 'source': 'data/Explicit Stimulus/GenCovMat.m',
+ 'function': 'GenCovMat',
+ 'rows': int(frame.shape[0]),
+ }
+
+def run(**kwargs) -> dict[str, object]:
+ return GenCovMat(**kwargs)
diff --git a/matlab_port/data/Explicit Stimulus/__init__.py b/matlab_port/data/Explicit Stimulus/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/matlab_port/data/__init__.py b/matlab_port/data/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/matlab_port/helpfiles/AnalysisExamples.py b/matlab_port/helpfiles/AnalysisExamples.py
new file mode 100644
index 00000000..6ab1229c
--- /dev/null
+++ b/matlab_port/helpfiles/AnalysisExamples.py
@@ -0,0 +1,64 @@
+"""Auto-generated MATLAB-to-Python scaffold.
+
+Source: helpfiles/AnalysisExamples.m
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+import numpy as np
+import pandas as pd
+from scipy.io import loadmat, savemat
+
+import html as _html
+import json
+import re
+
+from nstat import SpikeTrain, fit_poisson_glm, psth
+
+def _parse_html_reference(html_path: Path) -> dict[str, object]:
+ if not html_path.exists():
+ return {'title': html_path.stem, 'sections': [], 'figures': [], 'code_outputs': []}
+ text = html_path.read_text(encoding='utf-8', errors='ignore')
+ title_m = re.search(r'(.*?)', text, flags=re.I | re.S)
+ title = _html.unescape(re.sub(r'<[^>]+>', '', title_m.group(1))).strip() if title_m else html_path.stem
+ sections = [_html.unescape(re.sub(r'<[^>]+>', '', s)).strip() for s in re.findall(r'
]*>(.*?)
', text, flags=re.I | re.S)]
+ sections = [s for s in sections if s]
+ figures = sorted(dict.fromkeys(re.findall(r'src="([^"]+_\d+\.png)"', text, flags=re.I)))
+ raw_outputs = re.findall(r'