text stringlengths 8 6.12M |
|---|
%对数据进行重抽样
clear all;
infile=char('dt.cc'); %双差数据文件
out=char('dt.cc');
num=200; %重采样次数
%eband=0.027 ; %误差范围
epair=char('#');
fid=fopen(infile,'rt');
disp('Step 1')
i=1;j=1;k=1;
while ~feof(fid)
txt=fgetl(fid);
if ~isempty(txt) %判断是否为空行
e=strfind(txt,epair);%p=strfind(txt,'P');s=strfind(txt,'... |
classdef Vehicle < handle
properties
type
v
vmax
gewechselt
length
troedelwsnlkt
ueberholwsnlkt
end
methods
function obj = Vehicle(type, length, v, vmax, tp , uep)
obj.type = type;
obj.v = v;
obj... |
function eda_behave_prepare_all_long
% Prepare all_eda_behav.csv for merge with all_online_scl_behav.csv. We
% have to:
% - change column names (ID, trial condition, index_within_trial,
% time_within_trial, zdt_scl, heat, wm, slope, <interactions>
%
% - CHANGE CONDITION NAMES (VERY IMPORTANT): see subject and fubject f... |
function [Operators] = equality()
Operators.solve=@(control,active_indices,fidelity) solve(control,active_indices,fidelity);
Operators.applyInverseJacobianState=@(state,control,rhs) applyInverseJacobianState(state,control,rhs);
Operators.applyInverseAdjointJacobianState=@(state,control,rhs) applyInverseAdjointJacobianS... |
function GLS2BED(S,filename,mode,name,score)
%% Read BED file into a Genome Locus Set structure
% translate n entries in BED file to a range matrix with rows
% [segID, start, stop] of int32
% segID are indices into S.segNames
if nargin < 3
mode = 'w';
end
try
fdbed = fopen(filename,mode);
catch fex
disp([... |
function [image,y1,y2,x1,x2] = crop_image_around_centre(image, width, height)
% Given an image, crops it to the given width and height, around it's centre point
image_size = [size(image, 2), size(image, 1)];
image_center = [round(image_size(1) * 0.5), round(image_size(2) * 0.5)];
if(width > image_s... |
function DrawPlane(P,u)
t=u(1);
state=u(2:13);
ctrl=u(14:size(u,1));
pn=state(1);
pe=state(2);
pd=state(3);
phi=state(7);
theta=state(8);
psi=state(9);
fs=1000;
ps=100;
persistent hplane;
R=[
0 1 0;
1 0 0;
0 0 -1;
];
[V... |
function [ Phi_sum ] = MPS_FromPhiSum( Phi )
%Both A and B are left orientation MPS
%D of Phi_sum is equal to the sample size of Phi
[N, D] = size(Phi);
Phi_sum = cell(N, 1);
[d, ~] = size(Phi{1});
Phi_sum{1} = zeros(D, d);
Phi_sum{N} = zeros(d, D);
for kk=1:D
... |
clear; clc; close all
%% Quantum Key Distribution
[ak,bk] = QKD(100,0);
Text_filename = 'plain.txt';
Algorithm = 'kLSB';
k = 0;
if string(Algorithm) == "kLSB"
%k = input("Enter k in kLSB : ");
k=4;
end
%% Transmitter side
LZ78_compression(Text_filename,'comp_tx.LZ78');
encrypt('comp_tx.L... |
function [ H,Q,i1,i2 ] = backsearch2( H,Q,z )
%GORKA ERAŅA ROBLES - This function finds for deflating rows on a real
%Schur form matrix.
% It is based on the ideas developed in 5.2.
normH = norm(H,'fro');
i1 = z;
i2 = z;
while i1>1
if ( abs(H(i1,i1-1)) > eps*normH && i2 ~= 2 )
i1 = i1 - 1; ... |
%% *5.3.6. "H" - Disjointed Line Laser Path*
% This is the instruction to describe the laser beam disjointed-line
% toolpath, to be executed with last set technological parameters
% (see instructions "S", "F","P")
% The total size of this instruction can be computed as is:
% 1 + 4 + (4 + 4) x POINT_COUNT... |
%% Performs Keypoint Localization (Assumes bboxes are provided)
% clear;
% startup;
% Declaring global varaibles
globals;
% Loading the train/test split for Pascal
load(fullfile(cachedir,'pascalTrainValIds'));
% Matrix to hold performance parameters for each of the 20 classes
% perf = zeros(20,5);
% But, we're here... |
function drawRanger(z,p)
% drawRanger(z,p)
%
% Draws ranger
clf; hold on;
colorFootOne = [0.8, 0.0, 0.2];
colorFootTwo = [0.2, 0.0, 0.8];
colorLegOne = [0.7,0.0,0.3];
colorLegTwo = [0.3,0.0,0.7];
colorGround = [0.4,0.1,0.1];
SizeJoint = 25;
[p1,p2] = kinematics(z,[],[],p);
x = z(1);
y = z(2);
qf1 = z(3);
qf2 = z... |
%Jack Collins 13388696, 13th Nov 2014
%This program makes a graph of the (x,y) position of a motorcyclist as
% he drives off a 20 metre high cliff at 40 m/s and lands on ground with
% a constant slope of 10 degrees below the horizontal
%----------------------------------------------------------------------
%Quantitie... |
function params = initParams(moviefile, gridfile, ncorners, corner_idx,...
cornerfile, default_mean)
if nargin < 6
default_mean = 1;
end
if nargin < 5
cornerfile = moviefile;
end
if nargin < 4
corner_idx = 1;
end
% init paths
rootdir = fileparts(fileparts(mfilename('fullpath'))... |
function [Q] = CalcLoads(l1,l2,l3,Fx,Fy,M,q1max,q1min,q2max,q2min,q3max,q3min)
%P is the 3x1 vector of external loads, Q is the maximum load on each joint
if (l1 > 0 && l2 > 0 && l3 > 0)
P = [Fx;Fy;M];
if (q1min > q1max)
q1max = 360+q1max;
end
if (q2min > q2max)
q2max = 360+q2m... |
% TextureLighting - This allows for the toggling the light on the texture.
% Viewer.TextureLighting(lightOn)
% LightOn - This is a double, (0,1) where a zero means no light and a one means there is a directional light.
function TextureLighting(lightOn)
D3d.Viewer.Mex('TextureLighting',lightOn);
end
|
function [squared_LP_metric, LP_metric_loc, LP_metric_mis, LP_metric_fal, LP_metric_switch]=ComputeLP_metric_error(X_estimate,t_b_estimate, length_estimate,X_truth,t_birth,t_death,c_gospa,gamma_track_metric,k,Nx)
%This function computes the squared error of the alive trajectories and its decomposition using the LP
%Tr... |
%% operation_crossover.m
function operation_crossover(pop_size, chromo_size, cross_rate)
% 函数功能:单点交叉操作
% pop_size: 种群大小
% chromo_size: 染色体长度
% cross_rate: 交叉概率
global pop;
for i = 1: 2: pop_size
if(rand < cross_rate)
% cross_position: 交叉位置
cross_pos = round(rand * chromo_size);
% 若交叉位置为0/1,... |
%% 1. Specify parameters
%Specify echotimes
t=1:0.1:10;
%Specify pw and pf
pw=1;
pf=1;
%Specify R2*
R2=0.01;
% Specify known fat amplitudes and frequencies
r= [ 0.087; 0.694; 0.128; 0.004; 0.039; 0.048];
freqs= [-0.498; -0.447; -0.345; -0.261; -0.063; 0.064];
%% 2. Calculate signal from each fat peak (could also... |
function [result] = get_j_display_string(j)
result = '';
for i=1:1:length(j)
result = [result,' $j_',num2str(i),'=',num2str(j(i)),'$'];
end
end
|
function [S,ixnodes,M] = streamorder(M,W)
% Derive Strahler Stream Order from Flow Direction Matrix
%
% [S,nodes] = streamorder(M,W)
%
% The Strahler Stream Order is a way to classify rivers based on a
% hierarchy of tributaries. First-order streams don't have tributaries.
% When two first-order streams come t... |
function [K,h] = lqrsp_newton(A,B,W,Q,R,Lambda,K0,params)
% Solve LQRSP using Newton-Lasso
K = K0;
J = Inf;
% Count the number of steps with nu < 0
tnu = 1;
tic;
for t=1:params.max_iters
[At,U,S,V,nu] = lqrsp_eig_deflate(A, B*K, params.max_eig_limit);
% L = lyap_fast(U, S, V, W);
% P = lyap_fast(V.', S, U.', Q... |
%% Stelling 4
%
% De functie ones(4,8) genereert een matrix met 4 kolommen,
% gevuld met enen.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
for i = 1:maxt
inted = find(t == 1);
np(i) = max(inted);
end
cot = max(np); |
% setInfo_Xstim
% combines callbacks for Xstim
global XStimParams
XStimParams.ephone_flag = get(H.ephoneuseit,'Value');
XStimParams.ap_pos = str2num(get(H.ap_pos,'String'));
XStimParams.ml_pos = str2num(get(H.ml_pos,'String'));
XStimParams.depth = str2num(get(H.depth,'String'));
if ~strcmp(XStimParams.record... |
% Copyright (c) 2017 The Johns Hopkins University/Applie?d Physics Laboratory
% This software was developed at The Johns Hopkins University/Applied Physics
% Laboratory (“JHU/APL”) that is the author thereof under the “work made for hire”
% provisions of the copyright law. Permission is hereby granted, free of cha... |
%% 3.1
% Initialize DH table template
DH = @(theta1,theta2,theta3,theta4,theta5,theta6)[pi/2 25 theta1 400;
0 315 theta2 0;
pi/2 35 theta3 0;
-pi/2 0 theta4 365;
pi/2 0 theta5 0;
0 -156 theta6 161.44];
DH_forces = @(theta1,theta2,theta3,theta4,theta5,theta6)[pi/2 25 theta1 400;
0 315 ... |
testOH = AcidBase();
pH = [1:0.1:14];
pK_OH = 16;
pK_OH2 = -2.4;
% Calculate scaled rate constant
label1 = { 'H_2O', 'OH^-', 'H_2PO_4^-', 'HPO_4^{2-}', 'PO_4^{3-}' };
[krate1_H2O] = testOH.rateReactionPerCatalyst(pK_OH, 'H2O', pH);
[krate1_OH] = testOH.rateReactionPerCatalyst(pK_OH, 'OH-', pH);
[krate1_H2PO4] = tes... |
function [Mat,Index,Cand] = decode_anew(cellstouse,spikedata,InFR,OutFR,Cand)
EstBin = .02;
Cell_Number = cellstouse;
Spike = [spikedata(:,2) spikedata(:,1)];
InFR = InFR(Cell_Number,:);
OutFR = OutFR(Cell_Number,:);
Cand = [Cand(:,1) Cand(:,2)+.005];
CandSeq = Cand;
N=round(diff(Cand')/EstBin)';
t=find(mo... |
clear all
close all
pulses = [230];
T0s = [80];
fpath = '/home/kyle/2TB_HDD/OPTDATA/INPUTS/FixedExperimental.mat';
%fpath = '/media/2TB_HDD/OPTDATA/LOCAL_VER/EXTEND_T0/RESULTS/MANY_NEGATIVE_TIME_DELAY/FINAL_FIXED/OldExperimental.mat';
Np = length(pulses);
Nt0 = length(T0s);
xfracs = zeros(Nt0, Np);
errf = zeros(Nt0,... |
function value = util_get_value_by_percent( input, percent, isAscending )
%UTIL_GET_VALUE_BY_PERCENT Get the value level in the input vector or
%matrix by a percentage of the whole.
% Input:
% input: Vector or matrix.
% percent: Thresholding percentage.
% isAscending: If... |
%% prt_my_pet_eco
% writes html table with model, COMPLETE, MRE, SMRE and eco-codes
%%
function prt_my_pet_eco(metaData, metaPar, destinationFolder)
% created 2018/05/05 by Bas Kooijman, modified 2018/06/21, 2018/12/05, 2019/12/28, 2022/04/06
%% Syntax
% <prt_my_pet_eco *prt_my_pet_eco*>(metaData, metaPar, destinati... |
classdef DC_GP_EKF_Q_DQ_DDQ < EKF
%Dual chain constrained gain projection EKF
properties
%Constraint Bounds
upper_state_bound = [];
lower_state_bound = [];
upper_mes_bound = [];
lower_mes_bound = [];
%Model Handle for the second chain
mode... |
function []=testStreamSVM_2(fileName,svmStruct)
windowSize = 18000;
overlapSize = 9000;
nMinFrame = 30;
data = wavread(fileName);
data = data(:,1);
%-----------------------parameters------------------------------------
Tw = 25; % analysis frame duration (ms)
Ts = 10; % analysis frame shift (ms)
al... |
function [ y ] = dgrad( x )
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
y = zeros(1,length(x));
for i = 2:length(x)
y(i) = x(i)-x(i-1);
end
end
|
function out = rld_cumsum(vals,runlens)
index = zeros(1,sum(runlens));
index([1 cumsum(runlens(1:end-1))+1]) = 1;
out = vals(cumsum(index));
end |
%% To run this script you need first to download MALSAR toolbox, and to add its path to your MATLAB search paths.
%% Parameters
clear all;
subjects_train = 1:5;
foldNum = 10;
parameterRange = [0 0.001 0.01 0.1 1 10 50 100];
timeInterval = 76:325; % -200ms to 800ms
fileAddress = '';
%% Single Subject - Multi task - E... |
springParamHWA % load parameters
% instantiate reference input classes
zRef = signalGenerator(1.5, 0.5);
rRef = signalGenerator(1, 0.5);
fRef = signalGenerator(.5,.4);
movieBool = false;
image_array = [];
iteration = 1;
% instantiate the data plots and animation
dataPlot = plotDataSpring(P);
animation = springAni... |
function make_singleandjointreplay_fromPosterior(thisdir,label)
load(thisdir,[label '_InMatrix'],[label '_OutMatrix'],[label '_Index'],[label '_CandEventTimes'],'armposindex')
[~,armpos] = max(armposindex,[],2);
eval(['InMatrix = ' label '_InMatrix;'])
eval(['OutMatrix = ' label '_OutMatrix;'])
eval(['Index = ... |
function [max_element,x] = maxused(a)
s = size(a); row = s(1,1); column = s(1,2); maxx = 0; max_el = 0;
for i = 1: row
for j = 1:column
r = rep(a(i,j),a);
if r > maxx
maxx = r;
max_el = a(i,j);
end
end
end
x = maxx;
max_element = max_el;
end |
function [mods orthmods] = rdm_neurom(kap,off,gnorm);
%(c) Bernhard Spitzer, 2016
%% %%%%%%%%%%%%%%%%%%%% psychometric models %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f=[-1:0.4:1];
psym=abs((off+f).^kap).*sign(off+f);
if gnorm
g=sum(abs(f+off).^kap) / sum(abs(f));
psym=psym./g;
end
psym=[-psym;psym];
%%... |
function [allResp, allTarg,allRep,allPrev,sdRand]=Exp1_restruc(data,numAnalyze,center)
% Turn the data into responses and targets
% 4.8.2015-Created
allResp=nan(length(data),numAnalyze,10,2); % subj x session x objects x dim
allTarg=nan(length(data),numAnalyze,10,2);
allRep=nan(length(data),numAnalyze,10,2); % subj x ... |
function [v] = remove_drift(data, drift_start_time,drift_end_time)
% subtracts center-of-mass motion from tracking data
% original remove_drift.m (jcribb) was saved as remove_drift_DBH.m 01/14/08
% This file does not have linear drift option
% Modified for insertion before msd calculation with msd2
% g. holzwarth 01/1... |
function Q = qcalc(gam,x_cond,mu_cond,N_lgwt,k,p1,l,p2)
% calculate the expression Q in (5.6)
%
K = length(mu_cond);
[x_int, c_int] = lgwt(N_lgwt,x_cond(1),x_cond(end));
% different g_x depending on the number of input arguments
if nargin == 6
g_x = polycalc(K,x_int,k,p1);
elseif nargin == 8
if p2 == 1
... |
% CLASS2LAB Convert RNN classes back to labels
% Before training a NN all the labels from the dataset are converted to
% internal classes that are used during the optimization. This function
% convert back classes to the equivalent labels
%
% Copyright (c) 2011 Roberto Calandra
% $Revision: 0.11 $
function... |
%% look at data from the big pop sims, ask whether a certain population is
% the best
%% load data
cd 'C:\Users\Shreejoy\Desktop\shreejoy\neural_diversity\ST_machinelearn\reconKP\populationsims\bigPopSims1\run_4\';
load 'dataPostAnalysis1';
%% find temp errors for each of the relevant pops
currPopSize = 5;
%find ind... |
function dataout = op_randselectinData(datain,number)
% datain输入为一个行向量或者一个列向量,从其中随机选取 number 个值,不放回选取
% number < numel(datain)
Num = size(datain,1);
if Num < number
dataout = [];
disp('输入数据长度小于要选取长度')
return;
end
p = randperm(Num);
dataout = datain(p(1:number),:);
end |
function y=zfunf17(x)
%****************************************
% funzione test per la ricerca degli zeri
% y=sin(x)-x def. in [-1,1]
%****************************************
if (nargin==0)
y(1)=-1;
y(2)=1;
else
y=sin(x)-x;
end
|
function Pr = intersectionTwoLines(line1, line2)
x1 = line1(1);
y1 = line1(2);
dx1 = line1(3) - x1;
dy1 = line1(4) - y1;
x2 = line2(1);
y2 = line2(2);
dx2 = line2(3) - x2;
dy2 = line2(4) - y2;
Pr(1) = -(dx2*dy1*x1 - dx1*dy2*x2 - dx1*dx2*y1 + dx1... |
clear all
close all
clc
warning off
%%
if exist('gradientinit')==0
cd AD10
Start;
cd ..
end
% cd AD10
% startup;
% cd ..
%% Inputs
[AC, T, G, P] = Inputs_A320;
%% defining the design variables
DV = 7; % 1 only structure variables (aeroelastic optimization)
... |
function T = Tfunction(x, Cm, Alp1, Bet1, ww1, Alp2, Bet2, ww2, Alp3, Bet3, ww3, Alp4, Bet4, ww4, Alp5, Bet5, ww5, Alp6, Bet6, ww6, p, ww, type)
% Tfunction.m
% 4th-order Green tensor T
% Qu et al., 2016
% Input: x, three semi-axes of the inclusion, 3*1 matrix;
% Cm, stiffness of the matrix, 4th order ma... |
clear all
close all
points_along_z=100;
Source_start=1;%SOURCE START POINT
no_iterations=1000;%No. of iterations
c0=3.e8;%EM wave travels in speed of light
dx=0.01;
dt=dx/(2.*c0);%time step along z direction
cc=c0*dt/dx;
Ex = zeros(1,points_along_z);%E field matrix filled with zeros
Hy= zeros(1,points_along_z);%H filed... |
function [matchedObjMaps, euclideanStruct] = displayMatchingObjs(inputImages,globalIDs,varargin)
% Displays information on matching cells across sessions.
% Biafra Ahanonu
% started: 2014.01.03 [19:13:01]
% inputs
% inputImages - cell array {1, N} N = each trial of [x y nFilters] matrices contai... |
function [B_Index] = b_index(score,Y)
%B_INDEX Calculates the B Index
%
% input -----------------------------------------------------------------
%
% o score : (N x K), Predicted class posterior probabilities.
% N is the number of observations(number of test data samples).
% ... |
#Evolution operators Ue and Ug are directly calculated in their diagonal form.
#A vector storing the energy values are stored into temp. Then temp is used to
#create a diagonal matrix.
load('R_gstate.m','phig_z');
global sigma_x=[0 1; 1 0];
global sigma_z=[1 0;0 -1];
global sigma_y=[0 -i;i 0];
t_step=0.01;
J=1;
a=0;... |
function psnr=appraise_PSNR(img1,img2 )
%APPRAISE Summary of this function goes here
% Detailed explanation goes here
img1=double(img1);
img2=double(img2);
L=length(img1(:));
mse = sum((img1(:)-img2(:)).^2)/L;
psnr=10*log10(255*255/mse);
|
function normset = Normalize(set, icol, irow)
%NORMALIZE Normalizes each image in the dataset
% It recieves:
% set: The set of images that will be normalized
%
% It returns:
% set: The ser of normalized images
%Get size of dataset
m = size(set,2);
ustd = 1;
um = 0;
normset = double(zeros(size(set... |
function S = short(A,p)
%SHORT Randomly add entries (shortcuts) to a matrix
%
% Input A: n by n adjacency matrix
% p: probability that an entry is added to a given row
%
% Output S: n by n adjacency matrix with the attribute sparse.
%
% Description: A symmetric matrix of shortcuts i... |
function [swf] = spikefeature2(waveforms,chmask,maxch,chcoords,fs)
%SPIKEFEATURE2 2D Spike Waveforms Feature
% Detailed explanation goes here
maskedchs = find(chmask);
maxmaskedch = find(maskedchs==maxch);
chwavefeature = cell(length(maskedchs),1);
for i=1:length(maskedchs)
chwavefeature{i} = NeuroAnalysis.Base... |
function varargout = test(varargin)
% TEST M-file for test.fig
% TEST, by itself, creates a new TEST or raises the existing
% singleton*.
%
% H = TEST returns the handle to a new TEST or the handle to
% the existing singleton*.
%
% TEST('CALLBACK',hObject,eventData,handles,...) calls the local
... |
function irpTestLabel(Bb)
% irpTestLabel(Bb)
% Testet die Funktion 'irpLabel' und stellt das Labelbild als
% RGB-Bild unterhalb des Binärbildes dar.
%
% Parameter:
% 'Bb' Binärbild für Bauteile
%
% Rückgabewerte:
% -
% Berechne Labelbild.
Lb = irpLabel(Bb);
% Berechne RGB-Bild aus Labelbild (z.B. per l... |
clear
clc
DSmat='dataset/DSmat.txt';
RSmat='dataset/RSmat.txt';
RDmat='dataset/RDmat.txt';
DS=load(DSmat);
RS=load(RSmat);
RD=load(RDmat);
Adj=[RS,RD;RD',DS];
% disease
% 624:Breast neoplasms
% 633:Hepatocellular carcinoma
% 636:Renal cell carcinoma
% 638:Squamous cell carcinoma
% 662:Colorectal neoplasms
% 706:Glio... |
function Y = MetSubsDesc(L,B)
%Copyright (C) Andreas Mihalea
%Rezolvarea sistemului de ecuatii intr-un mod extrem de eficient
%a unei matrici superior triunghiulare.
n=rank(L);
Y=B;
for i=2:n
for j=i:n
Y(j, :) = Y(j, :) - L(j,i-1) * Y(i-1, :);
end
end |
%% -------------------- SET UP THE PROBLEM ------------------- %%
% ------------------------ KARTHIK MOHAN, EE, UW. --------------- %
% ------------------------ LAST UPDATE: 8/28/2012 --------------- %
%% CHOOSE DATA TYPE - SYNTHETIC DATA OR USER-INPUT DATA
type = 1; % CHOOSE 1 for testing on synthetic data.
... |
function h = PACK_entropy(arch)
ninstr = PACK_ninstr_per_sat(arch);
h = sum(-(ninstr{1}./sum(ninstr{1})).*log2(ninstr{1}./sum(ninstr{1})))./log2(length(arch));
end |
function JSpherical = computeSphericalJacobian(ui, quat)
% computeSphericalJacobian analytical computation of the jacobian
% for the spherical joint.
% The spherical constraint is f = x + wRi * ui.
% \dot{f} = \dot{x} + \dot{wRi} * ui
% = \dot{x} + w x (wRi * ui)
% = \dot{x} - (wRi * ui) x w
... |
function OpenApp()
persistent app
% Call the AddPaths scripts to make sure all the necessary files are
% accessible to matlab.
AddPaths;
if isempty(app) || isa(app,'LocalMessage') && ~isValid(app) % using a custom isvalid function
% Open app
app = LocalMessage();
end
end |
addpath(genpath('~/GitHub/GBLM_SMOOTH/helper'));
addpath(genpath('~/GitHub/GBLM_SMOOTH/core'));
%% set up true parameters
clc;clear all;close all;
T = 20*60;
dt = 0.001;
Q = diag([1e-5 1e-5]);
trueParam = [0 0 3 1 0]'*(-0.04);
beta0 = ones(1, T/dt)'*6;
wt_long = [repmat(-9, 1, round(T/(dt*2))) repmat(-3, 1, T/dt - r... |
function [xMin, xMax, yMin, yMax, zMin, zMax] = imROIcrop(imgT, padLen)
lineX = sum(sum(sum(imgT,4),3),2);
locationNZ = find(lineX);
xMin = locationNZ(1)-padLen;
xMax = locationNZ(end)+padLen;
lineY = sum(sum(sum(imgT,4),3),1);
locationNZ = find(lineY);
yMin = locationNZ(1)-padLen;
yMax = locationNZ(end)+padLen;
l... |
function [Q, R] = qr_givens(A)
% [Q,R] = qr_givens(A) berechnet die QR-Zerlegung einer Matrix A mit n>=m
% mittels Givens-Rotationen. Die Matrix R ist die
% gesuchte oberen Dreiecksmatrix und Q ist eine orthogonale Matrix.
% Groesse von A ermitteln
[n,m]= size (A);
% Q initialisieren
Q = eye(n);
% Schleife ueber di... |
c = [-13 -7];
A = [-14 -13; -9 -19; -1 0; 0 -1];
b = [-61 -60 0 0]';
x = [-1; -1];
BaseIniziale = [4 5];
format compact
format rat
mode = 'frombase'; %'fromx' o 'frombase'
maxiter = 4;
disp("######################### INIZIO #########################");
n_vincoli = size(A,1);
% Trova la base dato ... |
for si=1:numel(out_nrow)%[1 2 3 4 5]% 6:10]%[9 5 1 2 3 4 6 7 8 10]
idx_fpr=find(out_nrow{si}.out.bias<=-bias_nrowA(si));
amfpr(si)=out_nrow{si}.out.fpr.nrow(m2,idx_fpr(end)-cheating_bias);
amtpr(si)=out_nrow{si}.out.tpr.nrow(m2,idx_fpr(end)-cheating_bias);
end
|
function lf_mag = likelihood(rho, eta, gamma, alpha, timeSteps, Wmap, Amap)
S = 1;
disp(['rho = ' num2str(rho) '; eta = ' num2str(eta) ...
'; gamma = ' num2str(gamma) '; alpha = ' num2str(alpha)])
if ~exist('initialConditionCell','var')
fprintf('Using default initial condition\n')
try
[result,mode... |
function psi = stream1(Nyl,dy,k,lam2,zeta)
% Function to invert vorticity for streamfunction for single zonal
% wavenumber.
% Ny = Nyl+1 is number of grid points in y.
% Ly is domain width.
% zeta is the wave vorticity specified on the Ny grid.
% Use finite Differences in y.
psi=zeros(size(zeta));
K2 = k^2+lam2;
dy2 =... |
function [tstart,tend,idx,vel] = findPursuit(d,varargin)
% Find pursuit eye movements in eye position signals...
%
% Available arguments include:
%
% order - low-pass digital differentiating filter order (default: 128)
% Wn - low-pass filter corner freq, and transition band as a
% perce... |
function [cfr,ptr]=rst_sub(bin,qcf,delta,ptr)
%This code is to test the effect from the triming operation!
if bin(ptr)==1
ptr=ptr+1;
if bin(ptr)==1 %trim
ptr=ptr+1;
delt=delta; T=0.8*delt;
nc=hist(abs(qcf)+1,[1:max(abs(qcf))+1]);
cfr=rstTHDctr(qcf,T,delt,nc);
else %no trim
ptr=p... |
tic
r0 = 0.0725; % Outer radius of the rotor
Tenv = 20; % Temperature of the environment
meshfile = 'arkkio_rotor.msh'; % Filename of the mesh file
num_gauss = 12; % Number of gauss points
bforder = 1; % Order of the basis functions.
dt =... |
function glmb_update= updating(glmb_predict,model,filter,meas,k)
%gating by tracks
m_tracks= [];
P_tracks= [];
for tabidx=1:length(glmb_predict.tt)
m_tracks= cat(2,m_tracks,glmb_predict.tt{tabidx}.m);
P_tracks= cat(3,P_tracks,glmb_predict.tt{tabidx}.P);
end
meas.Z{k}= gate_meas_gms(meas.Z{k},filter.gamma,model,... |
function res = stelling_16_versie_4_CHECK(absPathStudentSol)
res = runChecksOnMCAssignment(absPathStudentSol,mfilename('fullpath'));
end
|
function [M1, M2, M3] = moments_from_data_no_debias_1D(y, list2, list3)
% y is a signal (a vector)
% list2 has size n2 x 1
% list3 has size n3 x 2
% Each row of list2 and list3 contains integers (shifts) -- can be negative
y = y(:);
n = size(y, 1);
gpuFlag = (gpuDeviceCount > 0);
% gpuFlag = false... |
function [] = listLength_createSim(firstRat, lastRat)
%% Creates a run_sim file for a single, yoked-pair simulation.
if exist('p', 'var')
clear p
end
outerDir = strcat(pwd, '/graphsAndSession');
if ~exist(outerDir, 'dir'),
mkdir(outerDir);
end
fprintf('\nSetting new seed by clock.\n');
rng('shuffle');
fo... |
function [ T ] = rotz( gamma )
gamma=deg2rad(gamma);
T = [cos(gamma), -sin(gamma), 0, 0;
sin(gamma), cos(gamma), 0, 0;
0, 0, 1, 0;
0, 0, 0, 1];
end
|
% I try to make this work with the functions and matrices!
%% Level set method, HY example for one slice! case n=2
% This modified level set method allows target to change in time.
% Tomographic reconstruction is found as a minimizer of a nonlinear
% functional, which contains a regularization term penalizing the L^2 n... |
% Runs simulation once and plots displacement
% Solve for displacments
FrameData = SteeringSupportsGeometryAndLoading_2019Frame;
[~,V,~] = DirectStiffnessSolver(FrameData);
xDisp = V(1,3);
zDisp = V(3,3);
totalDisp = sqrt((xDisp^2)+(zDisp^2));
fprintf("\nSteering Supports Displacement:\t"+totalDisp+" inches\n");
%... |
% Gaussian Elimination, column pivoting
M = size( A, 1 ) % rows
N = size( A, 2 ) % cols
K = min( M, N ) % min = steps
U = A; % U will be K x N
L = eye( M, K ); % L will be M x K
% iterative version: k=steps m=rows n=cols
if 0
for k = 1:(K-1)
% choose pivot
[ Y, Index ] = max(abs(U(k... |
function output = blur(img,w)
image = double(img);
[rows,columns] = size(image);
output = uint8(zeros([rows,columns]));
for row =1:rows
for column = 1:columns
if row + w <= rows && column + w <= columns
if row - w > 0 && column - w > 0
a = image(row-w:row+w,column-w:column+w);
... |
%% % parameters for reconstruction
fltrate=0.01;%sampled at 10Hz
timewindow=10;%size in seconds of the sliding window
stepslid=4;%step in seconds of the sliding window
maxdurationtrial=60;%duration maximum for trials for the sliding window (to be able to have the same size for each trial)
%function to get the segments... |
%% Load the data matrices
%main;
load('gamma10.mat');
load('normal10.mat');
load('lognormal10.mat');
%% Which is a better distribution for each gene?
%we answer that by calculating the area under the curve for the following
%curve: number of conditions that are greater than a certain threshold vs
%the threshold. we no... |
function [ trajectory ] = condensation_step( images, frame_num, coords, hist, trajectories)
%CONDENSATION_STEP Iterates a step for a given condensation tracker.
% If no third argument is given, the function assumes that this is the
% first iteration of this method and initialises values for the tracking
% target.... |
function bestX=Desiered_point(z,vd)
% z=[5 700 pi/2 0 0 0 0 0 0 0];
% vd=1;
persistent Xd
% vd=1;
acc=.1/vd;
vd=1000*vd;
vs=1*vd; %velocity of the path
vu=2*vd;
ls=1600; %straight length
ru=1000; %circle radius
Tf=round(2*ls/vs+4*pi*ru/vu)+.5;
t=0:acc:Tf;
if max(size(... |
% Compute the upper-triangular part of the (symmetric) Hessian of img with
% smoothing constant sigma. Also return the kernels used in the computation
% if enough output arguments are provided
function [H, skernel, dkernel] = Hessian(img, sigma)
% Assign a default standard deviation if needed
if nargin < 2 || isempty... |
function [p,Questsession,Questpars] = runQuestionnaires(paramFiles,study,subID,group,screenNum,screenParams,clearFlag,thePath)
% Possible inputs to runQuest (run Self-Report Measure):
% 1) paramFiles - parameter files that you have already saved for your Quest(s) (e.g., {'BFIparams','NFCparams'})
% 2) study - i... |
ARDUINO = serial('/dev/ttyACM0');
ARDUINO.BaudRate = 115200;
FListOpen=fopen('all'); %get the names of the open files
if(~ismember('ARDUINO',FListOpen))
fopen(ARDUINO);
end
time=[];
input=[];
output=[];
count = 0;
while(count~=3)
s = fscanf(ARDUINO);
[values,count] = sscanf(s,"%f,%f,%f\n");
end
time ... |
function [ boundaryUV ] = embedBoundary( mesh, mode )
% [ boundaryUV ] = embedBoundary( mesh, mode )
% [Ryan Schmidt rms@dgp.toronto.edu 09/2008]
% - valid modes are:
% 'circle' - arc-length embedding on circle
% 'copy' - current UV values
boundary = mesh.loops{1};
boundaryUV = [];
% find p... |
function data = read_terrain_data(data_dir, trim, sampling_rate)
%READ_TERRAIN_DATA Read a directory of OctoRoACH telemetry files
% Ryan C. Julian and Austin Buchan
data_files = dir(sprintf('%s/*.txt',data_dir));
n_files = length(data_files);
fprintf('Found %d files.\n',n_files)
for i = 1:n_files
dat... |
% This script performs analyses and plots of the data presented in
% "Striatal Dopamine Mediates Hallucination-Like Perception in Mice" by
% Schmack et al. 2020. Figures and statistical results are stored in the
% 'results' folder. Simulations of statistical confidence are stored in the
% 'confidenceSimulation' folder... |
function [trajData, chiLinearTerm] = stateControlMat(X, trajData)
nState =12; nControl = 4; nOptim = nState + nControl;
if strcmp(trajData.shape, 'loiter')
if strcmp(trajData.type, 'not-same')
N = (length(X)-3)/nOptim;
chiLinearTerm = X(N*nOptim+3);
VR = X(nOptim*N+2)... |
function result = Newton(fun, x0, ftol, dftol, maxit)
x = x0;
i = 0;
while i <= maxit
i = i + 1;
f = feval(fun,x);
dfdx = diff(fun);
df = feval(dfdx,x);
if abs(df) < dftol
result = [];
warning('dfdx is too small!');
return;
end
dx = f/df;
x = x - dx;
if abs(f)... |
function out(s,source, eventdata)
%Callback function for the 'Exit' button on the GUI
% 's' is an object that carries the GUI's music
stop(s) % Stops the GUI music
close all % Closes the GUI window
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.