text stringlengths 8 6.12M |
|---|
%--------------------------------------------------------------------------
% this function is used to convert feature vectors into FaceSpace vectors.
% Written by Christoffer Nellaker 140205
% adapted from createSuperClassFromPath
%
% HACK AT THE MOMENT ONLY USES INTENSITY - design choice needed separate
% tables or ... |
function X = LinearTriangulation(K, C1, R1, C2, R2, x1, x2)
%triangulates points from two images in 3D space
if size(x1,2) == 2 || size(x2,2)==2
x1 = [x1, ones(size(x1,1),1)];
x2 = [x2, ones(size(x2,1),1)];
end
P1 = K*R1*[eye(3) -C1];
P2 = K*R2*[eye(3), -C2];
vec2skew = @(v) [0, -v(3), v(2); v(3), 0, -v(1); -v... |
% ringwidth_import_v107.m
% This function imports decadal format tree ring data for manipulation
% as a matrix in Matlab. The number of header lines must be specified
% as an input by the user. The end of each series must be flagged
% with 999. Measurements are stored as one thousandth of a
% millimeter. Th... |
classdef Route < handle
properties
config_space
theta_res
start
dest
map
route
end
methods
function obj = Route(map, start, dest)
obj.map = map; % intilaized Map object
obj.start = start;
obj.dest = dest; %... |
g1 = @(x) (5 - log(x)) / 3;
g2 = @(x) exp(-3 * x + 5);
x0 = 1;
tol = 10^(-9);
c1 = zeros(1, 20);
c2 = zeros(1, 20);
for max1 = 1:20
c1(max1) = fixedpoint(g1, x0, tol, max1);
c2(max1) = fixedpoint(g2, x0, tol, max1);
end
fprintf('Root: %.9f\n', c1(18))
figure(1); plot(c1)
figure(2); plot(c2) |
function TrainTextonBoost()
dataInfo=SetMSRC21DataInfo();
[modelLocation, modelColor]=TrainColorLocation(dataInfo);
% figure(1);set(gcf,'position',[200,200,500,500]);
% for kk=1:dataInfo.numClass
% imagesc(modelLocation(:,:,kk));
% title(dataInfo.className(kk));
% pause;
% end
TrainTextureLayout(dataInfo)... |
function x = swap(x,i,j)
% Swap x(i) and x(j)
% Helper function for clgBubbleSort and clgSelectionSort
temp = x(i);
x(i) = x(j);
x(j) = temp; |
clear all;
omega = 7.292E-5;
phi = 50;
g = 9.81;
l = 8;
wo = sqrt(g/l);
r = 6371397; %m
time = 2*60*60; %2 hours in sec
h = 0.1;
t = 0;
x = zeros(time/h+1,0);
y = zeros(time/h+1,0);
m = zeros(time/h+1,0);
n = zeros(time/h+1,0);
T = zeros(time/h+1,0);
x(1) = 1;
y(1) = 0;
m(1) = 1;
n(1) = 0;
i=1;
T(i) = t;
while ... |
%This is for power utility
o=Merton(2,1)
% from explicit formula we know that v(T,XT)=2.9, In order to verify, run
simulateTradings(o,100000,2000,0)
% To plot #
e=[-1:0.5:1]
for i=1:length(e)
terminal(i)=simulateTradings(o,100000,2000,e(i))
end
plot(e,terminal)
%for exponential utility
%first change the utility to... |
%Q6*
function [image, correctLabel, predictedLabel] = PredictFace (n)
load('Train.mat','trainData', 'trainLabels');
mdl = fitcknn(trainData, trainLabels);
load('Test.mat','testData', 'testLabels');
imageTest = testData( n,:);
predictedLabel = predict(mdl, imageTest);
correc... |
clear all
close all
clc
%% Fixed parameters across all simulations
dt = 0.00001; %time step
N = 2000; %Network Size
td = 0.05; %decay time
tr = 0.002; %Rise time
%%
T = 15;
nt = round(T/dt);
tx = (1:1:nt)*dt;
%% Van der Pol
T = 15; nt = round(T/dt);
mu = 0.5; %Sets the behavior
MD = 10; %Sc... |
% Transformation der Folge in den z-Bereich
X =ztrans(x,k,z) |
reps = 100;
eps = 2000;
num_arms = 2:6;
mu = zeros(numel(num_arms),reps);
v = zeros(numel(num_arms),reps);
begin = 0.005;
endin = 0.01;
% costs = begin:(endin-begin)/20:endin;
costs = 0.007;
for c=1:numel(costs)
cost = costs(c)
for n=1:numel(num_arms)
n_arms = num_arms(n);
er = zeros(eps,reps/10);
for i=1:e... |
% Handout 2, problem 4
% solving C*h = r to get H (and H^-1)
function b = ex2(x);
% 4 pts. from original / rectified image ???
B = [44, 147, 1;
43, 254, 1;
495, 153, 1;
495, 246, 1];
% 4 pts. from mapped image ???
A = [51, 58,1;
49, 160,1;
444, 102, 1;
449, 180, 1];
A = A';
B = B';
%... |
function cpic = ShowClassifier(Cparams,H,W)
cpic = zeros(H,W);
for i=1:size(Cparams.Thetas,1)
cpic = cpic + MakeFeaturePic(Cparams.all_ftypes(Cparams.Thetas(i,1),:),W,H)*Cparams.alphas(i,1)*Cparams.Thetas(i,3);
end
end
|
filename = 'data.txt';
data = load(filename);
%colors = [0 0 1; 0 0.5 0; 1 0 0; 0 0.75 0.75; 0.75 0 0.75; 0.75 0.75 0; 0 0 0];
figure('Name', '0_nactena_data')
scatter(data(:,1), data(:,2))
title('Načtená data')
clear filename |
function [ index_to_send ] = plan_with_factors(string_array, error_dynamic_percentage)
% @author: Tal Regev
paremater_size = 9;
robot_location = gtsam.Pose3.string_deserialize(string_array{2});
next_goal = gtsam.Pose3.string_deserialize(string_array{3});
paths_actions = gtsam.Acti... |
function [ p ] = calc_recognition( p, selec_forComp, trial)
%% calc_recognition: calcs recognition socres
%%
if p.layer == 2
tmp_prc = squeeze(selec_forComp(2,1,:));
tmp_caudal = squeeze(mean(selec_forComp(1,:,:),2));
p.recogByLayer(trial,2) = (tmp_prc(1) - tmp_prc(2)) / (tmp_prc(1) + tmp_prc(2));
... |
% if there are multiple blocks, save the processed data for each block
% separately in its own folder
function handles = SaveROI(handles)
for j = 1:length(handles.files)
clear proc;
% folder path
[savefolder,savefile0,~] = fileparts(handles.files{j});
%proc.suffix = handles.suffix;
proc.files... |
function [ Data, Info ] = rpca2d_gl_l2( X, varargin)
%RPCA2D_GL_L2 Solves NO2DRPCA with a L2 penalty on T and Group Lasso
% min (1/2)*(alpha_c*||Uc||_F^2 + alpha_c*||Ur||_F^2 +
% alpha_r*sum(||Tn||_F^2) + sum(labmda_n*||En||_1)
% s.t for all n Xn = UcTnUr^T + En
%
% Mehdi Bahri - Imperial College Lon... |
function [xhat, error, A] = gngd(x, in, mu, order, eps, rho)
N = length(x);
A = zeros(order,N);
error = zeros(1,N);
for i=order+1:N
inpast = in(i:-1:i-order+1);
inpastprev = in(i-1:-1:i-order);
xhat(i) = A(:,i)'*inpast';
error(i) = x(i)-xhat(i);
A(:,i+1) ... |
function [ H ] = Homog( tx,ty,tz,rx,ry,rz,f,d )
K= [f 0 0;0 f 0;0 0 1];
t = [tx;ty;tz];
Rz = [cos(rz) -sin(rz) 0; sin(rz) cos(rz) 0; 0 0 1];
Ry = [cos(ry) 0 sin(ry) ; 0 1 0;-sin(ry) 0 cos(ry) ];
Rx = [1 0 0;0 cos(rx) -sin(rx) ;0 sin(rx) cos(rx) ];
R = Rx*Ry*Rz;
n=[0;0;1];
H = K*(R + t*n'/d)*inv(K);
e... |
function Params = stimdefSCHR(EXP);
% stimdefSCHR - definition of stimulus and GUI for HARHAR stimulus paradigm
% P=stimdefSCHR(EXP) returns the definition for the SCHR
% stimulus paradigm (Cedolin & Delgutte 2010). The definition P is a GUIpiece that can be rendered
% by GUIpiece/draw. Stimulus definition lik... |
clc;
close all;
clear all;
rng('default');
%% step1. load groundtruth data
tpMatrix = load('./tpMatrix');
% usermatrix = load('/Users/rui/PycharmProjects/webservice-core/dataset2/tpMatrix');
%% step2. form sparse data with sparse_rate
[num_usr,num_service] = size(tpMatrix);
sparse_rate = [0.1 0.3 0.5 1.0];
sparse_nu... |
clear
close all
path ='./Data/video.mp4' ;
n=3;
vidObj=VideoReader(path);
N=get(vidObj, 'numberOfFrames');
fs=get(vidObj, 'FrameRate');
N=300;
frame00 = read(vidObj,1);
heig2t = size(frame00,1);
width = size(frame00,2);
display('Select the ROI');
% [~, rect] = imcrop(frame00);
close;
nof=(fs*120);
% rmin0 = rect(2... |
N=6;M=6;
numOfBaseStations=5;
numOfTransmiters=10;
TxRxPlain= zeros(N,M);
randLocatBaseStations=randperm(numel(TxRxPlain), numOfBaseStations);
randLocatTransmiters=randperm(numel(TxRxPlain), numOfTransmiters);
%Also support the case we have R & T in the same area unit
cellMembers=ElementsTypeInCell( randLocatB... |
% Implementa el método de Romberg.
%
% Parámetros:
% -----------
% f: Puntero a la función que cuya integral se desea aproximar.
% a: Inicio del intervalo de integración.
% b: Fin del intervalo de integración.
% p: Número de filas.
% Salidas:
% --------
% I: Valor de la integral aprox... |
function [ t ] = intquad( a,b )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
q = zeros(a,b);
% for a zero matrix
w= ones(a,b);
% all element = 1s matrix
e= 2*w;
r=3*w;
t=[q , w ;e , r];
% stack them together
end
|
clc
clear all
close all;
num=1;
Batch_size=20;
LIMITmin=-inf;
alpha=0.98;
sss=0;
Threshold1=-inf;
starii=[];
load('D:\LEVIS\video_clips_pca\label__PETsView1.mat')
label=label__PETsView1;
load('D:\LEVIS\NEVIL1.0\UBM\FK_Data_PETsView1.mat')
Data=FK_Data_PETsView1;
final_niter = 10;
nmix=2;Thresholdtemp... |
function [profile_data] = timevp_construct_temporal_profile(input)
% This function generates temporal profile of a group of continue variables
% or one cstream profile chunked by one cevent variable.
%
% For detailed user guide one this function, please go to demo script at:
%
%
% Last update by Linger, txu@indiana.e... |
function es = VRredefineOutcome(es)
tolerancediff = 0.1;
es.outcome = zeros(size(es.outcome)) + 2;
roomlength = round(max(es.traj));
es.firstgoodlick = 0 * es.lick;
es.firstrewlick = 0 * es.lick;
es.goodlick = 0 * es.lick;
es.preRewlick = 0 * es.lick;
es.postRewlick = 0 * es.lick;
es.passivelick = 0 * es.lick;
es.firs... |
function [ mass ] = Mass( bruttoWeight, tankLevel, tankVolume )
% bruttoWeight is the weight without fuel in tonnes
% tankLevel is percentage of tankVolume filled (0.0-1.0)
% tankVolume is the maximum weight of the filled tank in tonnes
mass = 1000 * (bruttoWeight + tankLevel * tankVolume);
end
|
function freq = computeStat(data, Methods, idx)
%%%Input
%data: binary data, each row is the methods used. 1 if used 0 otherwise
%Methods: all the method names
%idx: partition matrix of the data
%%%%output:
%freq =
%%sort the order of cluster according to
tab = tabulate(idx);
[dummy, clu... |
function filtered = FilterStartTimes(epochStartTimes,maxRange,durations,runLength)
[numEpochs,numFlies] = size(epochStartTimes);
filtered = cell(numEpochs,numFlies);
for epoch = 1:numEpochs
for fly = 1:numFlies
startTimes = epochStartTimes{epoch,fly};
adjustedStartTimes... |
function flecha(i,j,k,color)
quiver3(0,0,0,i,j,k,1,color);
hold on
% y=quiver3(0,0,0,0,j,0,1,'g');
% z=quiver3(0,0,0,0,0,k,1,'b');
% legend('x','y','z');
% x2=quiver3(0,0,1,1,0,0,1,'r');
% hold on
% y2=quiver3(0,0,1,0,1,0,1,'g');
% z2=quiver3(0,0,1,0,0,1,1,'b');
% xlabel('Y');
% ... |
clear
clc
load('T and V.mat');
load('faces32x400.mat');
result = T42*V42;
results = [];
k=1;
for i=1:5
A=[];
for j=1:5
T = imresize(reshape(result(:,k),[32,32]),2);
A=[A,T];
k = k + 4;
end
results = [results;A];
end
faces = [];
k=1;
for i=1:5
A=[]... |
classdef CloudQueueMessage < azure.object
% CLOUDQUEUEMESSAGE Class to represent a CloudQueueMessage
% Messages are added and retrieved from queues.
%
% Example:
% message = azure.storage.queue.CloudQueueMessage('my message');
% queue.addMessage(message);
%
% retrievedMessage = queue.retrieveMessage();
% Copy... |
function p=zero_stat(A)
jedinicaMatrix = sum(sum(A));
[a,b] = size(A);
moguceJedinica = a * b;
p = 100 - (jedinicaMatrix /moguceJedinica * 100);
%pct = 100 * (numel(A) - sum(A(:))) / numel(A); |
function [H, U] = zfrancisqr(A)
%compute one of the step by implicitly shifted QR step
[m, n] = size(A);
if m ~= n
error('support square matrix only')
end
m = n-1;
s = A(m, m) + A(n, n);
t = A(m, m)*A(n, n) - A(m, n)*A(n, m);
x = A(1,1)*A(1,1) + A(1,2)*A(2,1) - s*A(1,1) + t;
y = A(2,1)*(A(1,1) + A(2,2) - s);
z... |
%Fs--------------------------------------------------------------------
%
%script setupCryoNew
% set up parameters for CryoDet<xyz>.slx
% Original 2-3-2016 / SSmith
% Copied & Modlfied for new AMC HW Alg / JED May 2017
%
% Update History:
% <07-31-2017 JED>: added simulink_period var
%
%------------------... |
function [LMNControl,xyzcurrent] = ComputeControl(state,time)
%%%Extract State Vector
q0123 = state(1:4);
pqr = state(5:7);
p = pqr(1);
q = pqr(2);
r = pqr(3);
%%%%Magnetorquer parameters
n = 84; %%%number of turns
A = 0.02; %%%area(m^2)
max_current = 0.04; %%%Amps
%%%First thing we need is the magnetic field streng... |
function implementDisp(this)
TYPE = @int8;
n = [ ...
sum(this.Type==TYPE(1)), ...
sum(this.Type==TYPE(2)), ...
sum(this.Type==TYPE(3) & ~cellfun(@isempty, this.Input)), ...
sum(this.Type==TYPE(4)), ...
sum(this.Type==TYPE(5)), ...
];
fprintf('\tnumber of equations: [%g %g %g %g %g]\n', n);
end
|
clear;
close all;
%%% Parameters
CrossoverProbability = 1;
MutationProbability = 0.8;
Generations = 300;
PopulationSize = 30;
SequenceLength = 30;
Environment = 'muir_world.txt';
Population = zeros(PopulationSize, SequenceLength);
%%% Generate random population
for i = 1:PopulationSize
TempChromosome = zeros(1, ... |
%
% This file investigates the structure of nonlinearities in the F/A-18
% Model. All the trig functions will be approximated as Taylor series for
% this investigation purpose . This is only to see where the nonlinearity is
% dominant.
%
% Abhijit 03/04/2010
%
%========================================================... |
function f=mass_evaluate(f, M, V)
%evaluate objectives for multiple chromosome in parallel by submitting jobs
%to LSF. Modify function submit_job, check_job and get_job_data to use.
%
%f, N x (V+M), chromosome
%M, integer, number of objectives
%V, integer, number of variables
% created 10/12/2011, Xiaobiao Huang
%
... |
function [ phi ] = getPhiGHC( tcm, pcm, udl_m,udv_m, am, bm,tc,pc,...
b,udl,udv, T, P, XF, Zm, findMinZ, beta,denom,Comps )
% This function calculates the derivative given by:
% $ \frac{\partial am}{\partial n_{i} } $ and uses it
% to calculate mixture fugacity coefficients
phi = 0;
R = 83.3144;
% dimensionles... |
function varargout = anamasas(varargin)
% ANAMASAS MATLAB code for anamasas.fig
% ANAMASAS, by itself, creates a new ANAMASAS or raises the existing
% singleton*.
%
% H = ANAMASAS returns the handle to a new ANAMASAS or the handle to
% the existing singleton*.
%
% ANAMASAS('CALLBACK',hObject,ev... |
function rms_vecs = RBES_altimetry_error_budget()
r = global_jess_engine();
r.eval('(bind ?result (run-query* SYNERGIES::get-error-budget "3.2.1 Sea level height"))');
r.eval('(?result next)');
% id = r.eval('(?result getFactId)').floatValue(r.getGlobalContext());
rms_vecs(1) = r.eval('(?result getFloat rms-POD)').floa... |
%Author: REDJAN F. SHABANI
%Universita' degli studi di Roma "LA SAPIENZA"
%Ingegneria Informatica - Intelligenza Artificiale
%Version: Dec. 2009
%%
%DATASETS GENRATION
clc;
clear;
%Class 1
m1=[2;3];%means vector of distribution
s1=[1;1];%standard deviations of distribution
N1=450;%number of data
[x1,y1]=gaussDistrib2... |
%% Problem 3
% Program to find temperature of 3 tanks in series for heating oil using
% steam
clear all
close all
clc
global M C UA Tst T0 W
M=1000;
T0=20;
Tst=250;
W=100; % in kg/min
C=2 ; % in KJ/kg
UA=10;
[T,Y] = ode15s(@diff2,[0 100],[20 20 20])
hold on
figure(1)
xlabel('Time');
ylabel('Temperature');
plot(T,... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Copyright (C) 2016 N. Eamon Gaffney
%%
%% This program is free software; you can resdistribute and/or modify it under
%% the terms of the MIT license, a copy of which should have been included with
%% this program at https://github.com/... |
%This was adapted by AKC from code written by JS on 11-24-2012.
%It returns the success and failure biases as well as the regular offset.
%Usage: [bs bf b0] = mouse_prob_choice('am014',3,'26-Nov-2012')
function [bs bf b0] = mouse_prob_choice_ko(mousename,ndays,theDate)
if nargin < 2
mousename = 'am014';
... |
function [TL] = db_timeLimits(db_index, p2g)
%% [TL] = db_timeLimits(db_index, p2g)
%
% This function extracts all usefull time limits from omg.sqlite
%
% INPUT
% db_index : index of instrument in the instrument table
% p2g : path 2 ganges
%
% OUTPUT
% TL ... |
% Zscore maps
for i=1:Npc
GM1vn(:,i)=GM(:,i)/(sqrt(var(GM(:,i))));
end
GMz=GM;
GMz(GM1vn<2.5)=0;
% Remove bad PCs
Id=[1,3,5];
Rnew=R-u(:,Id)*s(Id,Id)*v(:,Id)';
for j=1:Npc
parfor i=1:S1(4)
TSzmap(i,j)=mean(Rnew(i,:).*GMz(:,j)');
end
j
end
TSzmapo=TSzmap(:,Order(Npc:-1:1));
save(strcat(file(1:size(file,2)-4),num2... |
function [smoothingMtx] = surfaceBasedSmooth(mesh,sigma);
%nVert = length(mesh.faces)/2+2;
nVert = length(mesh.vertices);
% surfArea = mesh_face_area(mesh);
% totalArea = sum(surfArea)
% patchArea = .5*(totalArea/nSources)
mesh.uniqueVertices = mesh.vertices;
mesh.uniqueFaceIndexList = mesh.faces;
[mesh.connectionM... |
function Q5
clc; clear;
EqulibriumFunc = @(q)func(q,1.6);
n=[2;5;10];
for i =1:length(n)
ini_Jac=eye(n(i));
ini_val = ones(n(i),1);
eps = 1.e-10;
del = 1.e-10;
max_it = 10000;
stop_crit = [eps,del,max_it];
q = Broyden_Method(EqulibriumFunc,ini_Jac,ini_val,stop_crit);
disp(['Equilibrium Output q = ',num2str(q'... |
function varargout = serial_GUI(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @serial_GUI_OpeningFcn, ...
'gui_OutputFcn', @seri... |
function [ grid_vector ] = thecannon_reshape_ndgrid_to_vector( gms )
% Written by: Bo Zhang (NAOC, bozhang@nao.cas.cn)
% Last modified: 21-Jun-2016
%
% Aim:
% - reshape ndgrid to column vectors
% Example:
% -
% -
% INPUT:
% - gms: the ndgrid
% -
% OUTPUT:
% -
% -
% HISTORY:
% -
% -
% sha... |
%%%
% Creates Figures on cell bias towards aggreagtes
%%%
addpath('Libraries/Utils')
PROJECT_BASENAME = ['/Volumes/Scratch/Chris/Paper2_Rippling/Paper2/'];
run('ENVS.m')
% How many bootstrap samples
% 1000 for publication, set to 10 to keep things moving quickly for testing
NBOOT = 1000;
% Density cutoff defining ins... |
% Analyse step stimulation data
clear all
close all
%% Open Folder and loading Data
path = '/home/ljp/Science/Projects/Rolling/2018-03//2018-03-12/';
folder1= '/Run.02/';
%load data from record
load([path folder1 'data.mat'], 'Data')
% if the video is analyzed for 2 ellipses, use this:
load([path folder1 'AngleDi... |
clear;
load('data.mat');
data{1} = training00;
data{2} = training01;
data{3} = training02;
data{4} = training03;
data{5} = training04;
gamma = [10,1,0.1,0.01,0.001,0.0001];
C = [10,1,0.1,0.01,0.001,0.0001];
tree = baggingtree( traindata, 100, 3 ,100);
[list, errors] = visitNode(tree, testdata); |
classdef EngineFactory < Factory
properties (Constant, Access = protected)
defaults = {
'', @Engine, ...
'XYZ', @Engine, ...
'RLL', @EngineRLL, ...
'Aero', @EngineAero, ...
'AeroDelta', @EngineAeroDelta, ...
'Ctrl', @EngineCtrl, 'Control', @EngineCtrl, ...
'Guid', @EngineGuid, 'Guidance', @Engin... |
% !revisions Block of steady-state revision equations.
%
% Syntax
% =======
%
% !revisions
% ParameterName1 = Expression1;
% ParameterName2 = Expression2;
% ParameterName3 = Expression3;
% ...
%
%
% Description
% ============
%
%
% Example
% ========
%
%
% -I... |
clear all; close all;
load('parameters.mat');
addpath(code_path);
%---input---
idiag = 71;
zdiag = 12;
l_max = 30;
%-----------
data_file = fullfile('data', ['dat', sprintf('%4.4d', idiag)]);
load(data_file);
den = den - filter_z(den, 0);
fig = figure();
build_grid;
denp = field2pol(den);
denp_pert = get_pert(den... |
function [ nablaj ] = nablaJ( spline, Jx, l )
%NABLAJ Gradient of J evaluated at spline points.
%
% INPUTS
% spline: (struct) spline
% Jx:
% l:
%
% OUTPUTS
% nablaj:
%
% CALLEE functions
% splineValue
%
% @author Roger Zou
% @date 6/2/15
cJgr = splineValue(spline, Jx{1}, l);
cJgc = splineValue(spline, Jx{2}, l);
... |
%% stabilityAnalysis.m
% This analysis uses several measures to test the stability of a unit's
% response over the course of the 7-cycle movements. Each measure (change
% in preferred direction [velocity], correlation, Mean squared error (MSE),
% and MSE corrected for sampling error) compares a window of data to a
% re... |
function equation = readEquations(equation, euc)
% readEqtns Post-parse measurement and transition equations.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
TYPE = @int8;
%--------------------------------------------------------... |
clear,close,clc
fidin=fopen('initial.txt');
fidout=fopen('mkmatlab.txt','w');
while ~feof(fidin)
tline=fgetl(fidin);
if double(tline(1))==32
fpri... |
function drawLens(figHandler,lens)
axis_current = get(figHandler,'currentaxes');
view(axis_current,[0 0]);
%
%axis(axis_current,'vis3d');
%
%hold(axis_current ,'on');
hold on;
axis equal;
plot3( lens.frontSurfDrawData.xy(1,:),lens.frontSurfDrawData.xy(2,:),lens.frontSurfDrawData.xy(3,:) ,'r');
plot3(l... |
newtime = i6_js_t_normalized;
newtime = newtime./1000;
plot(table10(:,1), 'b');
hold on
plot(newtime, 'r');
timelimit = max(table10(:,1));
indx = find(newtime>timelimit);
newtime = newtime(1:indx(1));
plot(newtime, 'g');
ts10 = timeseries(table10(:,2), table10(:,1));
newt10 = resample(ts10, newtime);
[newpxx, newf] =... |
close all
clear all
clc
r12=0.5;
r13=0.5;
r23=0.5;
muX=[1 1 1]
SigX=[1 r12 r13; r12 1 r23; r13 r23 1];
b=[0 0]';
A=[4 -2 1; 2 5 -1];
%n=8192;
%X=mvnrnd(muX,SigX,n);
ns=[100 400 500 1000 10000 20000 100000];
mm=@(n) min(ceil(n^(2/(7+tanh((1500-n)/500)))),48);
k=3;
%%
lambda=1;
tic
for q=1:length(ns... |
Lr = [0.2159 0.2159];
Lp = [0.3365 0.3365];
clear A B C D
clc
for i=1:2
for j=1:2
A{2*(i-1)+j} = [0 0 1 0;
0 0 0 1;
0 Mp^2*(Lp(j)/2)^2*Lr(i)*g/Jt -Dr*(Jp+Mp*(Lp(j)/2)^2)/Jt -Mp*(Lp(j)/2)*Lr(i)*Dp/Jt;
0 Mp*g*(Lp(j)/2)*(Jr+Mp*Lr(i)^2)... |
function bbox = Mask2BBox(mask)
%function bbox = Mask2BBox(mask)
%
%
row = sum(mask,1);
col = sum(mask,2);
row = row > 0;
col = col > 0;
bbox(1) = min(find(row));
bbox(3) = max(find(row)) - bbox(1) + 1;
bbox(2) = min(find(col));
bbox(4) = max(find(col)) - bbox(2) + 1;
|
function pics = recognizePics(picscell)
load('picscell.mat');
[h,w] = size(picscell);
pics = zeros(h,w);
% it = 1;
% for m = 1:h
% for n = 1:w
% subplot(h,w,it);imshow(picscell{m,n});
% it = it + 1;
% end
% end
% 每个pic的大小
[h_,w_,~] = size(picscell{1,1});
indexh = round([h_*0.25,h_*0.5,h_*0.75... |
function [Fsame,NMI,Q,t] = CoDDA(maxIter,data,coordinate,realresult,k,T,d,theta,colorArray)
% -------基本参数----------------
data(data>0) = 1; % 检查数据集,确保内容为0-1邻接矩阵
S = theta(1,1);
sigema = theta(1,2); % 衰减因子
beta = theta(1,3);
Lambda = theta(1,4);
picNum = theta(1,5); % 显示图像的编号
[~,m] = size(data);
Fsame... |
% Made by Ryan R. Rich in Partial Fulfillment of the Requirements for the
% Degree of Bachelor of Arts with Honors in Psychology from the University of Michigan, 2021
% Mentor: Thad Polk, Graduate Student Mentor: Pia Lalwani, Additional
% thanks: Nathan Brown
% Contact Ryan: ryrich@umich.edu
%%
clear
cl... |
function [A,u,v]=read_yuv(infile,h,w,f1,Nframe,fmt,bitdepth)
hh=h/2; hw=w/2;
if bitdepth==10
tp='uint16'; nby=2;
else %bitdepth=8
tp='uint8'; nby=1;
end
fm_cnt=0;
A=zeros(h,w,Nframe);
fid=fopen(infile);
for ia=f1:f1+Nframe-1
if fmt==444
fseek(fid,(ia-1)*w*h*3*nby,'bof');
Y=fread(fid, [w,h],tp)'... |
x = input('enter x\n');
y = input('enter y\n');
r = (x^(2) + y^(2))^(1/2);
rad = atan(y/x);
deg =(180*rad)/pi;
fprintf('The polar coordinates are ( %6.2f ,%6.2f ).\n',r,deg); |
%This lab makes use of matlab rvcrobot toolkit by peter corke
%Please make sure you have install the rvcrobot tookit before excute
%this program
format short;
%% Modified DH Parameter Initilization
a = [0,-0.3,-3,-2];
alpha = [0,pi/2,0,0];
d = [1,0,0,0];
Theta = [0;-pi/4;pi/4;0]; %(-5,0,3)
%% Define robot link comp... |
classdef LinearRegression < BaseEstimator & RegressorMixin
% Ordinary least squares Linear Regression.
properties (GetAccess = 'public', SetAccess = 'public')
% parameters
end
properties (GetAccess = 'public', SetAccess = 'private')
% attributes
coef_; % coefficients fo... |
function [ir, tstep, err, errmsg] = spimpulse1207(sp,fstep,sdc)
%% returns impulse response of S-parameter "sp"
% input variables
% sp: (column vecotor of complex double numbers)
% S-parameter.
% must contain at least two data points.
% must start from non-DC frequency.
% ... |
% funzione che toglie le colonne e le righe della sincronizzazione
function [mat] = tolgoSinc(mat)
N=length(mat);
mat(:,N)=[];
mat(N,:)=[];
mat(:,1)=[];
mat(1,:)=[];
N=length(mat); %aggiorno la dimensione della matrice
if (N>=30) %se sono nel caso in qui la DM ha più regioni
n=N/2;
%tolgo la "croce"
... |
t = 0:0.1:10;
f = 4 * sin(2*pi*t);
sys = tf([2,1],[1,4,3]);
x = lsim(sys, f, t);
plot(t, x); |
function plot_log_l2_norm(y,t,x)
%plot_log_l2_norm Plotting the logarithm of the l2 norm of the solution
y1 = y(1:end/2,:);
y2 = y(end/2+1:end,:);
x_step = x(2)-x(1);
e1 = log10(sqrt(sum(abs(y1).^2,1).*x_step));
e2 = log10(sqrt(sum(abs(y2).^2,1).*x_step));
%fpr... |
function [VciaNew, VstatesNew, VpropagationNew] = propagateAttack2(Mserv, MservInd, Vstates, Vpropagation, VattackEffect, Vcia, opt)
%STATES
STATE_OPERATIVE = 0;
STATE_ATTACKED = 1;
STATE_IMPACTED = 2;
NO_SPREAD = 0;
SPREAD = 1;
VciaNew= Vcia;
VstatesNew = Vstates;
VpropagationNew = Vpr... |
%==========================================================================
% Booth1997_function.m
% Author: Akira Nagamori
% Last update: 8/14/19
% Descriptions:
%==========================================================================
function [binary,V_s,V_d] = Booth1997_function(time,input,Fs,noise_amp,inputOpt,... |
tm = [1:600];
sind = zeros(1,10);
aavintia5 = aavinti(:,5);
%aavinti3 = aavinti(:,30);
%aavinti5 = aavinti(:,50);
%aavinti7 = aavinti(:,70);
ind = find(aavintia5>0);
aavintia5 = aavintia5(ind);
tma = tm(ind);
sind(1) = length(tma);
bavintia5 = bvinti(:,5);
%bavinti3 = bvinti(:,30);
%bavinti5 = bvinti(:,50);
%bavint... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% AFM-NI: Script for relating the indentation modulus to the elastic constants.
%
% This code generate the figures of the manuscript
% Estimation of the in-situ elastic constants of wood pulp fibers in freely
% dried paper via AFM experi... |
load data/fbank-invariance-features-bigarray-compact-debug.mat
trainlab_mg = 1+floor((trainlab-1)/3);
devsetlab_mg = 1+floor((devsetlab-1)/3);
W = LDA(features_tr, trainlab_mg);
L = [ones(length(trainlab_mg), 1) features_tr] * W';
[~,I] = max(L, [], 2);
accuracy = sum(I' == trainlab_mg)/length(trainlab_mg);
fprintf(... |
% Subroutine for boundary layer calculation
% using Approximation method: Karman-Pohlhausen
% NOTE: *BL calculation only for laminar region
% *transition checked using Cebeci and Smith (1974) method
% which is an improvement of Michel's method
% *turbulent region is neglected
function [del... |
function orthospm4(roi, threshold, onsets, window ,spm_file, anat_file, tseries_path, func_root )
% function result = orthospm4(
% roi_size,
% threshold ,
% onsets,
% window
% [,spm_file ,
% ... |
classdef TensorUtils
% set of classes for building, manipulating, and computing on
% high-d (or arbitrary-d) matrices easily
%
% Daniel J. O'Shea, 2019
methods(Static) % Simple internalized utils
function v = wrapCell(v)
% v = wrapCell(v)
% Wrap v as cell {v} if ~iscell(v)
if ~i... |
%PLOTSHERPATTMOTION Given results from the single leg planner in the form
%of a structure of results contained in plannerResults, this function plots
%the robot executing the planned path.
%
%Inputs:
%-plannerResults: A struct containing information about the planned
%trajectory.
%-dt: The sample time at which the plan... |
image_read=imread('A:\Study material\ECE 592 Data Science\projects\luna.jpg');
image_gray = rgb2gray(image_read);
number_of_rows = size(image_gray,1);
number_of_columns = size(image_gray,2);
m = 1024;%input('specify the number of rows in the resized image: ');
n = 1024;%input('specify the number of columns in the ... |
% KF Kalman Filter
%
% I. System
%
% x+ = F_x * x + F_u * u + F_n * n
% y = H * x + v
%
% x : state vector - P : covariance matrix (known)
% u : control vector -
% n: perturbation vector (not known) - Q : cov. matrix
% y: measurement vector
% v: measurement nois... |
rng(3061);
clear all
close all
%Import Config and Training images
cd util
config = importConfig('config.txt');
cd ../import
disp("Loading Training Images..."); % - Takes a couple of minutes to load all 3000
%images is in the form of a vector where each row is an image of length
%image_width * image_height. i.e. 96... |
%% Create figures
function Createfig(errormaps,errormaps1,errormaps2)
%function Createfig(errormaps,errormaps1,errormaps2)
% Input: errormaps, errormaps1, errormaps2
% This function takes the outputs from Simulate_Values as inputs and uses
% them to generate FF maps showing effect of different sigma estimations
% ... |
function [ average_accuracy,average_precision,average_recall ]=result( confusion_matrix,dataset_idx,cross_validation_idx )
% recognition rates
average_accuracy=0;
accuracy=zeros(size(confusion_matrix,1),1);
precision=zeros(size(confusion_matrix,1),1);
recall=zeros(size(confusion_matrix,1),1);
... |
clc, clear all, format compact, %close all
tic % start computation time
%% for calling helper functions
addpath(genpath('\\172.27.216.40\Contreras-UH\Infantdata\Infantdata\code\Zachs_Infant_decoding_files'))
%% Opening directory path for Prasad's position files
cd('yourdirectorypath')
%% Import Kinematics ... |
function s = cross(s,m,p)
%此处的p是转弯概率
turn=s{1}.*(m==5|m==6);
[turn_1,turn_2]=find(turn);
rdp=randperm(length(turn_1));
turn_1=turn_1(rdp);
turn_2=turn_2(rdp);
for i=1:length(turn_1)
vx=abs(s{2}(turn_1(i),turn_2(i)));
vy=abs(s{3}(turn_1(i),turn_2(i)));
loc=fun_loc(m,turn_1(i),turn_2(i));
if (abs(vx)+abs(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.