text stringlengths 8 6.12M |
|---|
addpath(genpath('C:\Users\Jake\Repos\KiloSort')) % path to kilosort folder
addpath(genpath('C:\Users\Jake\Repos\npy-matlab')) % path to npy-matlab scripts
addpath(genpath('C:\Users\Jake\Repos\spikes')) % path to npy-matlab scripts
addpath(genpath('C:\Users\Jake\Repos\sortingQuality')) % path to npy-matlab scripts
... |
function BaiTap20()
imgI = imread('cameraman.jpg');
points = detectHarrisFeatures(imgI);
[features, validPoints] = extractFeatures(imgI, points);
figure;
imshow(imgI);
subValidPoints = validPoints.selectStrongest(20);
hold on;
plot(subValidPoints);
end
|
function [D,S,W,A,status] = smrf_sspca(X,Y,D,S,W,A,param,hMRF)
%% function for mrf structured sparse PCA
updateS = 1;
cntST = 0;
status = 0;
%%%%%%%%%%%%%%%%%% step1: get the structure %%%%%%%%%%%%%%%%%%%%
for iter = 1: param.MaxIte
oldD = D;
oldS = S;
%%%%% compute A %%%%%%%%
[sD, stat... |
function [ T ,ambi] = Top1_classifieur(data )
% calculer la performance de top n
% RecoTop1 = nombre d'elements pour lesquels la bonne solution apparait en 1ere
% proposition nombre total d'elements
% ambi: nombre de ambiguite
N_element = size(data,1);
ambi = 0;
conf = 0;
reco = 0;
for i = 1:N_element
% tro... |
function [limita_inf, limita_sup] = LimiteValProprii(d, s)
%Intrari: d-> diagonala principala a matricei tridiagonale simetrice;
% s-> supradiagonala matricei tridiagonale simetrice.
%Iesiri: [limita_inf, limita_sup]-> limitele incadratoare pentru
% valoriile proprii ale matricei tridiago... |
%This is a macro to run func_BLEACHPOLvsVEL for many different data sets
%and pool them together
%time between frames in seconds, you'll want to replace this with actual
%timing data from the microscope
global timeStep;
timeStep = 1;
%Size per Pixel, again you'll want to replace this with real data that may
%change f... |
function [x, std_coeff, t_stat, fval] = maxVraissemblance(x0)
%Fonction permettant de maximiser, à l'aide d'un algorithme d'optimisation
%numérique, la fonction de vraissemblance d'un modèle MS-AR, et par la même
%d'en calculer les probabilités filtrées
global choice;
warning('off');
% Options de l'Optimi... |
%Author:Eduardo Alho
%date:04/09/2016
%Uses ANTs Registration for registering 3D volumes
%It can be used for Histo/MRI registration or MRI/MRI
%root_dir:full path of the directory containing the volumes ref and mov
%ref0= reference volume
%mov0=volume to be registered
%outp= name under transforms should be stored
%out=... |
y= audioread('fil');
fs=1000;
Fs=14000;
FS=44100;
fc=20; fc0=180; fc1=200; fc2=480; fc3=500; fc4=980; fc5=1000; fc6=3980; fc7=4000;
fc8=6980; fc9=7000; fc10=9980; fc11=10000; fc12=14800; fc13=15000; fc14=22000;
[a,b] = butter(10,[(fc/fs), (fc0/fs)]);
freqz(a,b)
dataIn = (y);
do = filter(b,a,dataIn);
[c,d] = butter(1... |
function [ Z,W ] = Hirschberg( sek1,sek2, match, mismatch, gap, Z, W )
%% Hirschbergův algoritmus
% sek1 ... sekvence jedna
% sek2 ... druhá sekvence
% match ... skórovací parametr shody
% mismatch .. skórovací parametr neshody
% gap ... mezera
% Z ... první zarovaná sekvence
% W ... druhá zarovaná sekven... |
clc;
clear all;
close all;
x=[6,4,3,7,8];
h=[1,2,3,4];
l=conv(x,h);
disp('linear convolution of x(n) and h(n) is= ');
disp(l);
subplot(2,1,1);stem(l);
title('linear convolution');
xlabel('n');
ylabel('l');
grid on;
c=cconv(x,h);
disp('circular convolution of x(n) and h(n) is= ');
disp(c);
subplot(2,1,2);
stem(c);
title... |
clear;
close all;
% data analysis for this model
% baseline
base = load('07121516').result.x;
base_v = gradient(base);
% data1: knee efficient (5 times more)
data1 = load('07121703').result.x;
data1_v = gradient(data1);
% data2: knee efficient (10 times more)
data2 = load('07122303').result.x;
data2_v = gradient(data... |
function im_transformed = affine_transform(im, nPoints, target_nPoints)
trans_matrix = find_transform(nPoints, target_nPoints);
tform = maketform('affine', trans_matrix);
[im_transformed, xdata, ydata] = imtransform(im, tform, 'XYScale', 1);
if(xdata(1) > 0)
temp = round(xdata(1));
if(t... |
function commit(varargin)
%JGIT.COMMIT Commit files to the repository.
% JGIT.COMMIT(PARAMETER,VALUE,...) uses any combination of the following
% PARAMETER, VALUE pairs.
% 'all' <logical> [false] Automatically stage files that have been modified or
% deleted before commit.
% 'message' <char> [] Commit wit... |
%% fn_readxmllabview
%% Syntax
% x = fn_readxmllabview(fname)
%% Source
% Thomas Deneux
%
% Copyright 2008-2012
%
|
function obj = setOption(obj, varargin)
% Sets the object options, and return the complete list of option
% structure including unchanged default options.
%
% Parameters:
% varargin: name-value pairs of option field value
%
% Return values:
% options: the complete list of final option st... |
function T1_stack = load_T1(varargin)
% ** function T1_stack = load_T1(directory_TI_1, directory_TI_2, ... directory_TI_N)
%
% Inputs are the directory names of all Inversion Recovery images, one for
% each inversion time (TI).
% Output 'T1_stack' has dimensions (x,y,1,TI).
%
% CT 20170312
if nargin<1
error('Must ... |
function = [cols] = BigColumns(bigArray, idx)
cols = zeros(bigArray.NumItems(),numel(idx));
mBegin = 0;
for i = 1:bigArray.NumBlocks()
M = bigArray.ReadBlock(i);
M = M(idx,:);
cols(mBegin+1:mBegin+size(M,1),:) = M';
mBegin = mBegin + size
end
|
h = 2^(-6);
x = 0:h:2 * pi;
f = zeros(length(x),1);
u = zeros(length(x),1); % Represents u at time 1.
for j = 1:length(x)
if x(j) <= pi
f(j) = x(j);
u(mod(j - 1/h, length(x)) + 1) = x(j);
else
f(j) = 2 * pi - x(j);
u(mod(j - 1/h, length(x)) + 1) = 2 * pi - x(j);
end
end
%... |
% 3.7 Rotorcraft trim using surrogate model
clear all
clc
h = 100; % flight altitude
[~,~,~,rho] = atmosisa(h);
table_trim_states = readtable('trim_result_no_redundant.csv');
%% build object
run init_build.m
%% hover/foward trim X,Y,Z,L,M,N=0,[theta_0,theta_diff,theta_1c,theta_1s,theta,phi,v_i1,v_i2]
Rotorcraft.Double... |
%base work directory, where the preprocessing is saved
work_dir='/nfs/jong_exp/EEG_4POP/subjects/pilot_02012013/';
load([work_dir 'workspace.mat']);
addpath(genpath('/home/cui/eeg_4pop/test_1/scripts'));
addpath(genpath('/home/cui/scripts/EEGLABv11'));
%% Exploration 1: Spectrogram
load([work_dir 'Data/ERSP_pilot_991_... |
function enhancement_matrix = compute_MR_enhancement_from_MR_signal(signal_matrix, varargin)
enhancement_matrix = [];
if isempty(signal_matrix)
disp(sprintf('%s: empty signal matrix passed...', mfilename));
return;
end
[N,T] = size(signal_matrix);
if length(varargin)
is_pre_injection_volume = varargin{1};
else... |
% mrSges [%NL%x3]
% first moment of all robot links (mass times center of mass in body frames)
% rows: links of the robot (starting with base)
% columns: x-, y-, z-coordinates
|
function ret = d_loss_by_d_model(model, data, wd_coefficient)
% model.input_to_hid is a matrix of size <number of hidden units> by <number of inputs i.e. 256>
% model.hid_to_class is a matrix of size <number of classes i.e. 10> by <number of hidden units>
% data.inputs is a matrix of size <number of inputs i.e... |
clc;
clear all;
close all;
t=-5:0.1:5;
x1=t.*t-2.*t;
x2=t;
x3=conv(x1,x2);
plot(x3);
x3_lap=(t.^4)./12-(t.^3)./3;
plot(x3_lap);
|
%% Stable_LogDensity_Financials
% Compares parametric densities of Normal, Stable and Cauchy with
% empirical financial market returns on log-scale to emphasize
% non-normal behavior.
%% Global Commands
% ver % verify the version of Matlab
clear;clc; % clear
% set global commands for font size ... |
function hexagi_behaviour_learning(Subjects,ProcPath,StatsPath,FigPath)
% Define and evaluate learning
% Learning = Change in drop error from over time
% Exclude backward movements for the correlation with navigation strategy
if nargin<1
Subjects = load('hexagi_subjects')';
ProcPath = 'C:\... |
% picking a number for rock paper sccisors
% picking a random number
rng('shuffle');
randNumber = randi(3);
% raking 1 from the random number
finalRand = randNumber - 1;
% using the random number to pick rock paper or scissors
switch finalRand
case 0
disp('rock');
case 1
disp('paper');
... |
clear; clc; close all;
%% Bilinear Interpolation I
% I = imread('boat.png');
% I = double(I);
% imagesc(I); colormap gray;
% % % Down sample 1x
% Id = I(1:2:size(I),1:2:size(I));
% % I = ones(10,10);
% biI = BilinearInterpolation(Id);
% nnI = nearestneighbors(Id);
% figure('Name','downsmapled_Im');
% imagesc(I)... |
function [f,fraw,p,isbadch,isbadtr]=apply_erp_clsfr(X,clsfr,verb)
% apply a previously trained classifier to the input data
%
% [f,fraw,p]=apply_erp_clsfr(X,clsfr,verb)
%
% Inputs:
% X - [ ch x time (x epoch) ] data set
% clsfr - [struct] trained classifier structure as given by train_1bitswitch
% verb - [int] ver... |
function loadgammaCalib(wPtr,const)
% ----------------------------------------------------------------------
% loadgammaCalib(wPtr,const)
% ----------------------------------------------------------------------
% Goal of the function :
% Measure/Find and load gamma correction for luminance
% ---------------------------... |
clc
close all
%% gear ratio data
rw=0.025; %%radius of wheel [m] ????
m=0.3; %%mass of car [kg]
G=m*9.81;
mu=0.54; %% friction coefficient ????
Tm=0.0047; %%motor torque [Nm] - from torque
a=20; %% acceleration [m/s^2]
%% linking the track slope degrees ;
trackLength = 7;
track = Track(rand(1)*(trackLength-2.2),2.2... |
function Show_Output(t,p,I)
global M_dot_in phi1 cells x dt frac_second
drawnow
subplot(221)
plot(t,p);
title(strcat('Air flow : ',num2str(M_dot_in*1000),' g/s, Phi : ',num2str(phi1),' Control Fuel % :',num2str(frac_second*100)));
xlabel('Time')
ylabel('Pressure (Pa)')
fprintf('Avg. Comb. Temp. (at %2.4f se... |
function m = pylargecountsapproxrnd(theta, sigma, n, K)
% Sample the K's first counts for a Pitman-Yor process with parameter theta
% and sigma with n observations
% Uses a CLT approximation + stick-breaking
if n<10000 %
warning('Large-scale approximation may be invalid')
end
weights = pystickbreaking(... |
function [nav] = pelican_proc_nav(N)
%% Transform intra-file line numbers into cumulative inter-file line numbers
lnum_max = 0;
prefix = setdiff(fields(N),{'files'});
for i = 1:length(N.files)
lnum_max = 0;
for ip = 1:length(prefix)
idx = N.(prefix{ip}).fnum == i-1;
lnum_max = nanmax([lnum_max... |
function sgmga_point_test ( dim_num, importance, level_weight, ...
level_max_min, level_max_max, rule, growth, np, p, tol )
%****************************************************************************80
%
%% SGMGA_POINT_TEST tests SGMGA_POINT.
%
% Licensing:
%
% This code is distributed under the GNU LGPL licen... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Author: Josh Smith
%% Discription : setup a gyroscope
%%
%% INPUTS
%% clientID: returned from vrepInit()
%% vrep: vrep object returned from vrepInit()
%% sensorName: A string containing the name of your sensors string Data(must match vrep) example: 'g... |
function [Prob,neighbor] = ProbFunc1(zoneNumber,preProb,TRANSITIONPnorm, DELTAPnorm)
loadFiles;
neighbor = findNeighbours(zoneNumber,ZONE);
Prob = zeros(8,162);
for s=1:1:8
if neighbor(s,1)~=0
Prob(s,:) = TRANSITIONPnorm(zoneNumber,neighbor(s,1)) * DELTAPnorm(zoneNumber,neighbor(s,1)... |
im = double(rgb2gray(imread('test_points.png')));
[px, py] = hessian_detector(im, 1, 100);
figure(1); clf;
imagesc(im);
drawpoints(px, py); |
function output_img = spatial_conv(input_img, conv_kernel)
% input_img: type double
% conv_kernel: type double
% output_img: type double, size same as input_img
%% Write your function here
[RI,CI]=size(input_img);
[RK,CK]=size(conv_kernel);
R_new=RI+2*RK-2;
C_new=CI+2*CK-2;
v_pad=RK-1;
h_pad=CK-1;
padd... |
function plotCircle(P,r)
len = 40;
x = zeros(len,0);
y = zeros(len,0);
th = linspace(0,2*pi,len);
for i = 1:len
x(i) = r*cos(th(i));
y(i) = r*sin(th(i));
end
x = x + P(1);
y = y + P(2);
plot(x,y,'linewidth',2)
axis([-r r -r r])
|
function Z = zznulltol(A,tol)
%NULL Null space.
% Z = zznulltol(A) is an orthonormal basis for the null space of A obtained
% from the singular value decomposition. That is, A*Z has negligible
% elements, size(Z,2) is the nullity of A, and Z'*Z = I.
%
if nargin==1
tol=1e-10;
end
[m,n] = size(A... |
function [asgndQty, asgndStdCorr] = assigned(this, vecAlt)
% assigned Get vector of assigned quantities and vector of assigned std deviations and cross-correlations.
%
% Syntax
% =======
%
% [asgndQty, asgndStdCorr] = assigned(m)
%
%
% Input arguments
% ================
%
% * `m` [ model ] - Model object whose ass... |
function [states, controls, timings, status, num_iters] = acado_run(N, Ts, W, WN, Fmax, x0, num_sim_iters)
clear GLOBAL
DifferentialState p theta v dtheta;
Control Force;
% Export of an optimization routine:
acadoSet('problemname', 'pendulum');
ocp = acado.OCP(0.0, N*Ts, N);
h = [p; theta; v; dtheta; Force];
hN = ... |
clear all
close all
clc
%% Ejercicio 5
% Aplicar el método del punto fijo a la función f = x^7 +11x -1
% Declaramos la funcion
f = @(x) x.^7 + 11.*x -1;
%% Hacemos una prueba
%g = @(x) x - f(x);
g = @(x) x - 0.01*(x.^7 + 11.*x -1);
x0 = 0.5; t = 1e-4; nmax = 1000;
[c, n] = punto_fijo(g, x0, t, nmax);
% Mostramos ... |
function total_length = calculate_length(T)
%% Calculate the length of the trajectory
total_length = 0;
k = length(T);
for i=1:k-1
px1 = T(i,1);
px2 = T(i+1,1);
py1 = T(i,2);
py2 = T(i+1,2);
pz1 = T(i,3);
pz2 = T(i+1,3);
distance = sqrt((px1-px2)^2+(py1-py2)^2+(pz1-pz2)^2);
total_lengt... |
clear;clc;
%Funktion, um die es geht
f1 = @(x) tan(x)+x;
f2 = @(x1,x2) x1 - ((x2 - x1) / (f1(x2) - f1(x1))) * f1(x1);
x = linspace(0.1,15,400);
y = f1(x);
nullstellen = [];
for i = 1:(length(x)-1)
%printf('%.2f * %.2fl \n',y(i),y(i+1));
vorzeichen = sign(y(i)) * sign(y(i+1));
if vorzeichen == -1
%printf('OK... |
function results = pull(varargin)
%JGIT.PULL Pull from remote repository
% JGIT.PULL(PARAMETER,VALUE,...) uses any combination of the
% following PARAMETER, VALUE pairs.
% 'setRebase' <logical> [false] use rebase.
% 'progressMonitor' <ProgressMonitor> [MATLABProgressMonitor] Display progress.
% 'gitDir' <char... |
function result = vari_bad_chans(EEG, EEGchan, bounds, varargin)
%VARI_BAD_CHANS detects bad channels by variance
%
% Description:
% vari_bad_chans takes an input EEG data struct and calculates the
% base e logarithmic variance relative to the median channel average.
% Channels are then compared with the bounds... |
%generate_gem
clear
input_file = '/public/home/ciac_liwb/metabolism/result/gem.csv';
gem_name = textread(input_file, '%s', 'delimiter', '\t');
gem_name = reshape(gem_name,2,length(gem_name)/2);
gem_name = gem_name';
num1 = 0;
num2 = 0;
num3 = 0;
for i = 1:size(gem_name,1)
if strcmp(gem_name{i,2},'g')
num... |
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
% monika.bakosova@stuba.sk
% ------------------------------------------------------------------------... |
function [Polinomio] = Poli4_Pos(t0,t1,x_0,v_0,v_1,a_0,a_1)
syms t ;
A=[t0^4 t0^3 t0^2 t0 1 ;
4*t0^3 3*t0^2 2*t0 1 0;
4*t1^3 3*t1^2 2*t1 1 0
12*t0^2 6*t0 2 0 0;
12*t1^2 6*t1 2 0 0;];
%X=[a1; b1; c1; d1; e1];
A=sym(A); %Conversion a simbolico
B=[x_0 v_0 v_1 a_0 a_1];
detA=det(A);
A1=A; A1(:... |
clc
clear
data_file = 'E:\chenjun\test_ntu\dynamic_mutil_general';
data_file_name = dir([data_file,'\*.jpg']);
test_file = 'E:\chenjun\dynamic\data\ntu_all\test';
train_file = 'E:\chenjun\dynamic\data\ntu_all\train';
file_train = 'train_label.txt';
f_train = fopen(file_train,'wt');
file_test = 'test_label.txt';
f_t... |
% Cinemática direta
% Daniel Fortunato (81498), Teodoro Dias (81723), Pedro Santos (84162)
function [x, y, z, oa, ob, oc] = direct_kin(th0, th1, th2, th3, th4, th5)
sym(pi)
a1=0; a2=0; a3=40; a4=-120; a5=0; a6=0; a7=20; a8=0; a9=0; a10=0;
alpha1=0; alpha2=0; alpha3=-pi/2; alpha4=0; alpha5=0; alpha6=-pi/2; alpha7... |
function [EEG, varargout] = ctapeeg_stats_table(EEG, varargin)
%CTAPEEG_STATS_TABLE make and save stats of EEG data
%
% Description:
% basic_stats() outputs:
% rng - range: signal maximum minus minimum
% M - mean
% med - median
% SD - standard deviation
% vr - var... |
% generate random matrix of size q and fixed rank
q = 50;
rank = 10;
A = randn(q,rank)*randn(rank,q);
% specify number of entries
start=500;
endi=2000;
gap=50;
norm_sol = zeros(1,(endi-start)/gap);
% solve for each size of entry
iters=1;
for i=start:gap:endi
A_sol = nuclear_SDP_min(A,i);
norm_sol(iters) = no... |
%% DOUBLE STEP KNN CLASSIFICATION
% Used in |drillPressML_main.m|
tic
clearvars
load folderPaths.mat
%% Train model for distinguishing between no-Load and Load conditions
disp('- Extracting features from Load and no-Load data (double-step classification)...')
disp('--> STEP 1')
featureExtraction_NorP
% featureExtra... |
% main Excution function
clc
clear
close all
% Policy Iteration
figure(1)
initstateP = 3;
WalkPolicyIteration(initstateP);
%Q Learning
figure(2)
initstateQ = 12;
WalkQlearning(initstateQ);
|
function days = get_days(varargin)
% GET_DAYS -- Get days in the given path.
%
% days = ... get_days( 'Signals', 'wideband', 'magcue' ); returns a
% cell array of day labels associated with the path components
% 'Signals', 'wideband', and 'magcue'.
%
% days = ... get_days( ..., 'config', conf ) uses ... |
function f=Asian_CN(T, r,sigma,N_time,N_space,xmax)
%**********************************************************
%C-N Scheme for Equation(1) with the transform T-t=tau.
%This guarentees
%**********************************************************
delta_t=T/N_time; %step in time variable
delta_x=2*xmax/N_space; %st... |
%% Read CEOS Thuiller Spectrum and resample for MODTRAN
% Must also convert irradiance from mW/m^2/nm to W/cm^2/cm^-1
clear all
close all
WvUnits = 'nm';
RadUnits = 'mW/m^2/nm';
Thui = dlmread('Solar_irradiance_Thuillier_2002.csv');
Wv = Thui(:,1);
ThuiRad = Thui(:,2);
plot(Wv, ThuiRad);
%% Code in this cell is obsolet... |
function [labels, gesture_starts, gesture_finishes] = spot_gestures(scores, start_frames, threshold, dataset);
% [labels, gesture_starts, gesture_finishes] = spot_gestures(scores, start_frames, threshold, model_labels);
%
% model_labels(i) is the class label of the i-th model
number_of_models = size(scores, 1);... |
classdef WindModelLoadData < handle
properties
name
Data
end
methods
function obj = WindModelLoadData(name,path)
obj.name = name;
DataImported = load(path);
DataNew = DataImported(~all(DataImported(:,3:4)==999,2)&~any(DataImported(:,2)==99.99,... |
% ADVISOR data file: TX_1SPD.m
%
% Data source:
%
% Data confirmation:
%
% Notes:
% This file defines a 1-speed gearbox by defining a gear ratio and gear number,
% and calling TX_VW to define loss characteristics.
%
% Created on: 24-Jun-1998
% By: MRC, NREL, matthew_cuddy@nrel.gov
%
% Revision history at end of file... |
function [posVis, qtVis, timeVis, scaleGT] = readVisual(dataset)
%
% Read camera poses and timestamps from the input files.
% See the README.txt for more information about the input format.
%
% INPUT: dataset : Name of the dataset (string)
%
% OUTPUT: posVis : Visual positions (Nx3 matrix)
% qt... |
function sel_features=SBS(x,t,t_label,sigm,distance_mode,score_mode)
%
% Syntax: sel_features=SBS(x,t,t_label,sigm,distance_mode,score_mode)
%
% Inputs: x is an (n x d) matrix of traning set containing n samples of d-dimensional
%
% t is an (n x d) matrix of test s... |
function [predict, error]=lgc(data,gnd,labeled_ind,graph)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% This code is the implementation of the graph transductive learning algorithm
%%% Dependency [neighborhood, weights] = LLE_Weights(X, K, WeightModel);
%%% Input:
%%% --- data: ... |
function[sal,temp,tide,nut,other] = get_enviro(y,i,f0,f1,f2,f3,f4);
if i~=1;
i=i-1;
end
%This function is called by Markov_walk_sturgeon.m
%It loads 5 environmental variable vectors created and stored by stur_env.m
%After the calling function looks up the river latitude y at which a
%particel resides in the current... |
%% 把holdinglist变成nav
DH
%% 时间
sdt = datenum(2015,1,1);
edt = datenum(2015,5,15);
dts = DH_D_TR_MarketTradingday(1, sdt, edt);
dtsCell = {};
for i = 1:length(dts)
dtsCell{i,1} = dts(i,:);
end
%% assets
assetsCell{1} = 'cash';
tmpCell = dhIndexCompsAlltime('000300.SH', sdt, edt);
for i = 2:length(tmpCell)+1
as... |
function [desirability] = calcDesirability (possibleEdges, adjacencyMatrix)
% this function calculates the least invalidated future moves heuristic.
% this is done by going through all the moves, hypothetically making those
% moves and checking how many of the other moves have now become
% inpossible. The higher th... |
%
% Usage: Z =mexCalcXYt(X,Y);
%
% Name: mexCalcXYt
%
% Description: Compute Z=XY' using the BLAS library used by SPAMS.
%
% Inputs: X: double m x n matrix
% Y: double p x n matrix
%
% Output: Z: double m x p matrix
%
% Author: Julien Mairal, 2009
|
function b=block2band_wholeLF(a,M)
N=size(a); w=floor(N/M); md=N-M*w;
b=zeros(N);
%for rows: ----------------------------------------------------------------------
n=N(1); m=md(1); ww=w(1);
b((M-m)*ww+1:(ww+1):n,:)=a(1:m,:);
p=zeros(1,M); p(M-m+1:M)=p(M-m+1:M)+[1:m];
for ia=1:M
b((ia-1)*ww+1+p(ia):ia*ww+p(ia)... |
function data = dimfun(fun, data, dims)
% Apply function along several dimensions. Example:
% dimfun(@sum, data, [1 3 4]) % sum along dimensions 1 3 4
%
% NB:
% For flipdim, fftshift, ifftshift etc., their variants flipdims, fftshift_dims, ifftshift_dims are faster than dimfun!
% For min and max, use @(x,dims)min... |
%% Intilization file for ANDESITE simulink model
% Modified heavily by J. Brent Parham 5/27/2016
clear all
close all
clc
%% Constants
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mu = 3.986004415e14; %Earth's gravitational parameter (m^3/s^2)
Re = 6378.1363e3; %Earth's radius (m)
ee ... |
function regr_table(gNo)
% Show table with regression results
%{
Omit time dummies
%}
cS = const_data_so1(gNo);
qS = var_load_so1(cS.varNoS.vQuarticModel, cS);
% No of experience polynomials (clunky)
if cS.quarticS.ageEffects.equals('poly4')
nx = 4;
elseif cS.quarticS.ageEffects.equals('poly2')
nx = 2;
else... |
%EDIT_MEASURES adds new and edits current user-defined measures to the
% interface.
%
% Syntax
% ------
% ui.edit_measures( ~, ~, type );
%
% Details
% -------
% 'type' is defined by what the user clicked. 'add' adds a new measure
% to the list, while 'edit' allows the user to edit a current measure.
%
%... |
cla, close all;
l = 0.5;
C = [1 0 0 ;
0 1 0
0 0 1];
D = [0 0;
0 0;
0 0];
states = {'x' 'y' 'theta'};
inputs = {'v' 'phi'};
outputs = {'x' 'y' 'theta'};
R = [ 1 0;
0 1 ];
Q = [10 0 0;
0 10 0;
0 0 0];
ts = 0.05;
r = [2,1,0];
t = [0:ts:10];
N =... |
function output_result = extract_string( x )
v = '';
[ row_size , column_size ] = size( x );
for i = 1:1:column_size
t = x(i);
if not( isNumber(t) || t == '(' || t == ')' )
v = [ v , t ];
end
end
output_result = v;
|
clear
clc
XOParametersMatrices
%% Helper Functions
Rxd = @ (theta) [1 0 0 ; 0 cos(theta) -sin(theta); 0 sin(theta) cos(theta)];
Ryd = @ (theta) [cos(theta) 0 sin(theta); 0 1 0 ; -sin(theta) 0 cos(theta)];
Rzd = @ (theta) [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1];
NB = length(INER(:,1));
for i = 1:NB... |
function [jan2012_ace_data, jan2012_ace_model,...
jan2012_ace_data_5min,...
mar2015_ace_data, mar2015_ace_model,...
mar2015_ace_data_5min] = load_allevents_fun(x)
yn = 2*x;
%--------------------------------------------------------------------------
%----------------------------------- JAN2012 EVENT --... |
clear;
close all;
%%
Data_dist = csvread('Data_distribution(02).csv');
xr = Data_dist(1, :);
Treward = Data_dist(2, :);
xc = Data_dist(3, :);
Tcost = Data_dist(4, :);
colsWithZeros = any(xc==0, 1);
xc = xc(:, ~colsWithZeros);
Tcost = Tcost(:, ~colsWithZeros);
%% Plot %%
% plot properties
label_Fontsize = 20;
tick_Fon... |
function [indices, means] = plotKMeans(data, k, plotType, mod_period)
if nargin < 3
plotType = 'none';
end
if nargin <4
mod_period = 0;
end
[indices,means] = kmeans(mod(data,mod_period), k);
if strcmp(plotType, 'point')
figure();
hold on
colors = hsv(k);
for i = 1:k
plot(data(indice... |
function Heatmap_DEI(lsDEI,lblPixel_Exp)
iMax = max(lsDEI)+1;
figure()
matColor = jet(iMax);
matColor(end,:) = [1,1,1];
[nRow,nCol] = size(lblPixel_Exp);
nOrgan = max(lblPixel_Exp(:));
matX = iMax * ones(nRow*nCol,1);
nTem = 0;
cvLbl = lblPixel_Exp(:);
matX(cvLbl==0)=1;
for k=1:nOrgan
nPixel = sum... |
function q = quality(p,t)
%*****************************************************************************80
%
% QUALITY: Approximate triangle quality.
%
% q = quality(p,t);
%
% p: Nx2 array of nodal XY coordinates, [x1,y1; x2,y2; etc]
% t: Mx3 array of triangles as indices, [n11,n12,n13; n21,n22,n23; etc]... |
alpha=[-pi/2,0,pi/2,-pi/2,pi/2,0]; % Twist angles (in radians)
l=[0,0.5,0,0,0,0]; % Link lengths a (in metres), called l to distinguish from the a component of DH matrix
d=[0,0.25,0,1,0,0.5]; % Offset distances (in metres)
T06=[-sqrt(2)/2,0,sqrt(2)/2,1;0,-1,0,1;sqrt(2)/2,0,sqrt(2)/2,0;0,0,0,1]; % Composite Denavit-H... |
function [m,s,ok]=ReadMovie(name,start,numSlices)
% function [m,s,ok]=ReadMovie(name,start,numSlices)
% simplest: m=ReadMovie; % put up file selector.
% File reader for k2 or f2 camera movies, .mrc, .tif, z.tif, .stk
% Based on the file extension, read the image and return the struct s
% which has fields nx,ny,nz a... |
t_plot1 = 0;
t_plot2 = 0.01*tf;
t_plot3 = 0.2*tf;
t_plot4 = 0.3*tf;
t_plot5 = 0.5*tf;
t_plot6 = 0.75*tf;
|
%%
im1 = double(imread('D:\Users\Lenovo\Desktop\pic\36.gif'));
im2 = double(imread('D:\Users\Lenovo\Desktop\pic\39.gif'));
subplot(1,2,1);
image(im1);
subplot(1,2,2);
image(im2);
colormap(gray(256));
%% NRMSE
temp = (im2 - im1).^2;
upper = sum(sum(temp));
bottom = sum((sum((im1).^2)));
NRMSE = (upper/bo... |
% MLBAUTOSOL Imports and plots data from multiple files.
%
%% Read in the file names
filelist = dir('mlb07al_*.dat');
files = { filelist.name };
n = length(files);
% Process each file
for k = 1:n
fn = files{k};
[wins,losses,teamNames] = mlbAutoRead(fn);
region = fn(9:end-4);
mlbAutoPlot(wins,losses,te... |
function y=quadeg4up(x)
%微积分例4上界函数
%dblquad2使用
y=sqrt(1-x.^2);
|
%
% ROMS Open Boundary Conditions
% =============================
%
% These functions are used for preparing ROMS open boundary conditions
% NetCDF file.
%
%
% c_boundary - Creates ROMS open boundary conditions NetCDF
% file.
%
% d_obc_mercator - Driver to extract open boundary condition... |
function [result,WCL,Irrigation_3] = Threshold_5_ind(ET,Precipitation,t,d)
corn_price = 0.2;
water_price =1;
WCL_3 = zeros(25,1);
WCL_3(1) = 540;
WCL = zeros(74,1);
WCL(1) = 540;
Irrigation_3 = zeros(25,1);
for i = 1:25
if WCL_3(i) < t
Irrigation_3(i) = d;
end
... |
function [res]=gemi_sself( source)
members=properties(source);
idx=strmatch('all',members);
members(idx)=[];
for i=1:numel(members)
if ( strcmp( class( source.( members{ i } ) ) , 'Subject' ) && ~strcmp( members{ i } , 'all' ) )
source.combine_subjects('name','all','exclusion',{'all',members{i}});
... |
function [HN,HP]=LTP2alpha(I,direction)
Ltp2=zeros(3, 3, size(I,1)^2);
directions={[0 ,1] , [-1 , 1] , [-1, 0], [-1 , 0]};
angles = {[0 , -1], [-1 , -1], [-1, 0], [-1, 1], [0, 1], [1, 1], [1, 0] [1, -1]};
count = 1;
for i=1:size(I,1)
for j=1:size(I,2)
Ltp2(2,1,count) = G(Iprime(I,[i, j],[i +... |
% Verify raw measurement data (UWB ranging and wheel encoders)
% Read and Parse UWB range and SLAM data
clc; close all; clear all;
format long;
set(0,'defaultAxesFontSize',16)
%% User input variables
% ---------------------
% All UWB IDs = anchorIDs + robotIDs
UWBIDs = [0 1 2 3 4];
% Robot IDs
robotIDs = [1 3 4];
% 1,... |
function probs=exp_score(networkOutput)
exp_scores=exp(networkOutput);
probs=exp_scores./repmat(sum(exp_scores), 2, 1);
end |
function [residual, g1, g2] = main_code_FGKR_static(y, x, params)
%
% Status : Computes static model for Dynare
%
% Inputs :
% y [M_.endo_nbr by 1] double vector of endogenous variables in declaration order
% x [M_.exo_nbr by 1] double vector of exogenous variables in declaration order
% p... |
% store position x, y, vehicle parameters form [cm] to [m]
function [ coordinateX, coordinateY, vehicleparamsM ] = centimeter2meter ( data, vehicleparams )
% CENTIMETER2METER convert value from [cm] in [m]
%
% from centimeters [cm] to [m] diviede by factor 100
factor = 100;
% Convert data
coordinateX = data.pose.x / ... |
function W = getGaussianBlur(sigma,imsize)
length = imsize(1) * imsize(2);
a = 0; b= 0;
syms a b;
curcol = 1;
W = zeros(length);
for y = 1:imsize(1)
for x = 1:imsize(2)
[r,c] = ndgrid(1:imsize(1), 1:imsize(2));
f = sym(1/sqrt(2*pi*sigma^2) * exp(- ((x-b)^2 + (y-a)^2)/(2*sigma^2))); ... |
function [conv] = update_conv(conv,x,sc,target_dag,i)
% Update convergence behavior structure.
[f1,se,sp] = eval_dags({x},target_dag,1);
conv.f1(1,i) = conv.f1(1,i) + f1;
conv.se(1,i) = conv.se(1,i) + se;
conv.sp(1,i) = conv.sp(1,i) + sp;
conv.sc(1,i) = conv.sc(1,i) + sc;
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.