text stringlengths 8 6.12M |
|---|
function [x] = metodo_espacio_nulo_1(Q, A, c, b)
%
% Solución del problema
%
% min 1/2 x'Qx + c'x
% s.a. Ax = b
%
% Se usa el espacio nulo con:
% a) Solución particular de Ax=b con la pseudo-inversa de A.
% b) Base de null(A) con la inversa de [B N; zeros(n, m) eye(n)];
%
% I... |
function[energy] = energyfunc(im)
energy =abs(imfilter(im,[-1,1],'replicate'))+abs(imfilter(im,[-1;1],'replicate'));
end
|
%% Demo for PAA codes
% copyright (c) Sohan Seth, sohan.seth@hiit.fi
%% Poisson observation
close all
rng default,
options = generate_options();
options.verbose = true;
options.display = true;
options.eps = 10^-10;
options.maxIter = 100000;
options.matFeatLat = [];
n = 100;
% Generating data
matFeatSam = [ceil(ran... |
function out1 = hess_grf_ceq_heel1414(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL1414
% OUT1 = HESS_GRF_CEQ_HEEL1414(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:33:44
out1 = 0.0;
|
%二路归并函数:
%1.申请一个大小为两个有序子数组大小之和的数组空间
%2.设定两个指针,分别指向两个有序子数组的起始位置
%3.比较两个指针所指元素,将小的元素放入合并空间,并向后移动小元素的指针一个位置。
% 重复步骤3,直到某一指针超出子数组尾,将另一子数组剩下的所有元素复制到合并数组尾。
function A = Merge(A,l,r,mid)
i = l;
j = mid+1;
k = 1;
while i<=mid && j<=r %当i,j都没有超出子数组尾时
if A(i)<A(j) %比较i,j所指元素的大小,将小数放入A中
B(k)... |
function SparceDTW()
LowerBound = 0;
UpperBound = Res;
for LowerBound = 0:0.1:(1-(Res/2))
IdxS = find(LowerBound <= sDash <= UpperBound);
IdxQ = find(LowerBound <= qDash <= UpperBound);
LowerBound = LowerBound + (Res/2);
UpperBound = LowerBound + Res;
end
|
%aState=adaptStart(pD)
%starts GaussMixD object adaptation to observed data,
%by initializing accumulator data structure for sufficient statistics,
%to be used in subsequent calls to method adaptAccum and adaptSet.
%
%Input:
%pD= GaussMixD object or array of GaussD objects
%
%Result:
%aState= data structure t... |
global saveProcess
%% Epoching
varExist = exist('spect2Plot','var');
if varExist == 0
spec2Plot = true;
end
alignEvent_MI = spectrogramData{1}.state.ST_HOLD;
alignEvent_MIT = spectrogramData{1}.state.ST_STOP;
alignEvent_Base = spectrogramData{1}.state.ST_HOLD;
params.params_epoching.timeBeforeEventMI = 0;
param... |
format long
X = [-1 0 2 5 6 9 10]; % Get x values
Y = [1 1 0 -1 -2 -5 -18]; % Get y values
DividedDifferences(X,Y);
function DividedDifferences(X,Y)
n = length(X); % Get length of the input
B = zeros(n,n); % Initiate matrix B to speed up operations
B(:,1) = Y(:);
for j = 2:n
for i = 1:n-j+1
... |
% this function lets u find the number of the country (when plotting stuff)
function number=findCountry(country)
% this isnt the nicest looking code, but it gets the job done
% array of countries, its position in it will be returned and used
countries={'Country',
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function pList = primeList(maxVal)
% Use sieve of Eratosthenes to get a list of primes up to a limiting value.
pList = 1:maxVal;
inds = true(size(pList));
% 1 is not a prime.
inds(1) = 0;
i = 1;
while i <= sqrt(maxVal)
while i <= maxVal &... |
%% EX Basics
pm = 50;
wc = 0.4;
r = 0.00001;
ti = 10/wc; %%Tau_i
% EX1
s = tf('s');
G = 3*(-s+1)/((5*s+1)*(10*s+1));
F_lag = (ti*s+1)/(ti*s+r);
[mag, p_G] = bode(G, wc);
[mag, p_lag] = bode(F_lag, wc);
p_lead = pm -(p_G+p_lag-360+180);
p_lead = deg2rad(p_lead);
b = (1-sin(p_lead))/(1+sin(p_lead));
td = 1/(wc*sqrt(b));
... |
% [structure, rotations, basis, coeff] =
% nrsfm_homogeneous_alternation(projections, rotations, basis, max_iter)
%
% Parameters:
% projections -- 2 x P x F
% rotations -- 2 x 3 x F
% basis -- 3 x K x P
% max_iter -- Number of iterations of alternation to do
%
% Returns:
% structure -- 3 x P x F
% rotations -- 2 x 3 ... |
x=0:2:24
y=[12 9 9 10 18 24 28 27 25 20 18 15 13]
x1=13
y1=interpl(x,y,x1,'spline')
xi=0:1/3600:24
yi=interpl(x,y,xi,'spline')
plot(x,y,'*',xi,yi,'#') |
function T = pevalIndex2(poly,vars)
% Get the cell arrays of the variable names.
polyNames = poly.varname;
varNames = vars.varname;
% Determine where vars are used in poly
[logicalIndex,locationIndex] = ismember(varNames,polyNames);
% Change logical index into a subscript index.
nVars = length(vars);
varList = (1:... |
function [RX_measure_report, RX_log_measure_report, Beam_index_report,t_tr_o,t_fb_o] = training_period(user_loc,K)
% COMPLETE SIMULATION OF THE TRAINING PERIOD OF K-level
% RX_report: Complete Received Power Measurement
% t_tr_o: Vector of overhead of AP transmitting training beacons at each
% codebook level
% t_fb_o: ... |
function output = readFilesInFolder(folder, ext)
%READFILESINFOLDER
% This script reads the files in the SUBFOLDER of a folder.
% It returns a cell variable in which the different files presented
% relative to the 'folder' parameter
%
% EXAMPLE USE:
% files = readFilesInFolder(basedir,'.m');
%
% EXAMPLE OUTP... |
%{
wcon_tests
1) array of labs
%} |
%% Figure and Stats Code for JDST: Multi-Timescale Rhythmicity of Blood Glucose and INsulin Delivery Reveals Key Advantages of Hybrid Closed Loop Therapy
%Azure D. Grant, Dana M. Lewis, Lance J. Kriegsfeld
%Figure Code by Azure Grant. Wavelet base code by Dr. Tanya Leise. Wavelet
%coherence tools by Dr. Aslak Grin... |
%% Acheive Scale Factor correction
scale_factor = 512;
Ak_scaled_no_round = Ak * scale_factor;
Bk_scaled_no_round = Bk * scale_factor;
Akscaled = round(Ak * scale_factor)./scale_factor;
Bksclaed = round(Bk * scale_factor)./scale_factor;
%disp(['Ak_scaled coefficients are equal to ',num2str(Akscaled),'.']) %Print Ak... |
% load comsol_data_standing_wave_25THZ.mat
close all;clf;figure(1)
% %
% N = 5;
% axes('ColorOrder',brewermap(N,'Set1'),'NextPlot','replacechildren')
% h1 = plot(x,y1, 'linewidth',1.4);
% hold on
% % h2 = plot(x,y2, 'linewidth',1.4);
% h3 = plot(x,y3, 'linewidth',1.4);
% % h4 = plot(x,y4, 'linewidth',1.4);
% h5 = plot... |
function saveNew( fg, name, dims, ax_dims)
if nargin < 3
set(fg,'Position',[100 100 900 300]);
set(fg,'PaperOrientation','portrait', ...
'PaperSize',[9 3], ...
'PaperPositionMode', 'auto', ...
'PaperType','<custom>');
saveas(fg,[name '.png'], 'png')
elseif nargin < 4
s... |
clc,clear
load data3
mf = @(cs)1/sqrt(2*pi)/cs(2)*exp(-(x-cs(1)).^2/cs(2)^2/2)-y0;
cs0 = rand(2,1);
cs = lsqnonlin(mf,cs0)
|
function Plot3D(x,y,z)
mx=min(x);%求x的最小值
Mx=max(x);%求x的最大值
my=min(y);
My=max(y);
Nx=150; %定义x轴插值数据点数,根据实际情况确定
Ny=150;%定义y轴插值数据点数,根据实际情况确定
cx=linspace(mx,Mx,Nx);%在原始x数据的最大值最小值之间等间隔生成Nx个插值点
cy=linspace(my,My,Ny);%在原始数据y的最大值最小值之间等间隔生成Ny个插值点
cz=griddata(x,y,z,cx,cy','cubic');%调用matlab函数进行立方插值
figure;
set(gcf,'outerpositio... |
%% deal with interiorfloor surface, which acts as a floor instead of a top
function [Q_floor,Tp,Tp_interior] = getFloor_heat(i_surface,G_space,T_space,R3,C,Infor_space_simp,Tp,Tp_interior,i_time,i_space,A,Infor_surface_simp)
% global Infor_surface Tp Tp_interior...
% i_time i_space
dt=3600;
Tp_interior(i_surfac... |
% This file illustrates a basic use case for the code in the repository. It
% loads lfp and event data from sample files and performs a simple
% time-frequency analysis
%% Load data
% note that all times are already in seconds
load sample_events
load sample_lfp
%% Plot raw data
[T, C] = size(lfp);
tstamps = (1:T)/sr;... |
function [ranked_edges, gene_influence] = SINGE(Data,gene_list,outdir,hyperparameter_file)
% Standalone SINGE implementation.
% Inputs:
% Data = string representing the path of mat file containing the expression
% data corresponding to above gene_list in the form of cell array X.
% gene_list = file path of N x 1 cell ... |
function Be = bezierOneUp(B)
% Opis :
% bezierelv izvede visanje stopnje dane Bezierjeve krivulje
%%Definicija :
% Be = bezierelv (B,k)
%%Vhodna podatka :
% B matrika velikosti (n +1) x d, v kateri vsaka vrstica
% predstavlja d- dimenzionalno kontrolno tocko
% Bezierjeve krivulje stopnje n,
% dane Bezierjeve krivulje
%... |
function [value, rowIx, colIx] = max2( matrix )
%MAX2 Get the 2D max (row and column) for a 2D matrix
[maxRow, rowIxs] = nanmax(matrix);
[value, colIx] = nanmax(maxRow);
rowIx = rowIxs(colIx);
end
|
% 3.6 from 3 .csv file of trimming data, analysis and compare each other
table_trim_no_redundant = readtable('trim_result_no_redundant.csv');
table_trim_redundant_prop = readtable('trim_result_redundant_prop.csv');
%table_trim_redundant_full = readtable('trim_result_redundant_full_jde_con_fix_03_09_19_38.csv');
array... |
function [sinoAtt, sinoPC, flatFieldPhotonCounts ] = loadTableTopData( dataPath, geom, flatFieldIntensity, ffieldIndexX, ffieldIndexY, offsetX, offsetY )
%% Load projection data from the table top system. The varian .seq
% data is firstly converted to .raw data using Viv_ind.m
% inputs:
% dataPath - directory of the ... |
function plotHotspot(pointscan)
% This function plots the peak g/r value for each point in pointscan
% (created by importPointScan)
% REQUIREMENTS
% shadedErrorBar.m
% Align the points to the correct order
tempMean = pointscan.hotspotMean;
tempSEM = pointscan.hotspotSEM;
for i=1:length(pointscan.hotspotMean)
po... |
classdef RootSIFT < vicos.descriptor.SIFT
% RootSIFT - RootSIFT descriptor extractor
%
% (C) 2017, Rok Mandeljc <rok.mandeljc@fri.uni-lj.si>
methods
function self = RootSIFT (varargin)
% self = RootSIFT (varargin)
%
% Creates RootSIFT descriptor extractor... |
function Kind = KindOfVector(Vector)
Shape = size(Vector);
if (Shape(1) == 1)
Kind = 'Row';
elseif (Shape(2) == 1)
Kind = 'Column';
elseif (isempty(Vector))
Kind = 'Empty';
else
Kind = 'Not';
end
end |
function [r,ptr]=decode_stationary_source_r_invr(bin,cbk,lenr,inv,ptr)
if inv==0
[r,ptr]=decode_stationary_source_lenr(bin,cbk,lenr,ptr);
else
[r,ptr]=decode_stationary_source_leninvr(bin,cbk,lenr,ptr);
end
|
%15-47
mA = 1000 * input("mass of train car A in Mg: ");
vA = input("velocity of train A in km/h: ") * 1000 / 3600;
mB = 1000 * input("mass of train car B in Mg: ");
vB = input("velocity of train B in km/h: ") * 1000 / 3600;
k = 1000000 * input("spring constant in MN/m: ");
% conservation of momentum
syms v
V = solve(... |
function [ energy ] = energy( xi, n1, n2, n3, n4, yi, h, beta, eta )
%ENERGY Summary of this function goes here
% Detailed explanation goes here
% output_args = energy_bias_term(cp) + energy_neighbor_term(cp, n1, n2, n3, n4) + energy_diff_term(xi, yi);
%energy = h * xi - beta * (xi * (n1 + n2 + n3 + n4) ... |
function [pout,Vout]=einschrk(pin,bound,Vin)
% [pout,Vout]=einschrk(pin,bound,Vin)
% if Vin specified, then pout is untransformed, otherwise pout is transformed
% M. Paolella, 1997
welche=bound.which;
if all(welche==0) % no bounds!
pout=pin;
if nargin==3, Vout=Vin; end
return
end
lo=bound.lo; hi=bo... |
function [ output_args ] = makeEmailadres(numbers,postfix)
%MAKEEMAILADRES creates a list of e-mailadresses based on a list of
%studentnumbers and the postfix.
%
% ------------------------------------------------------------------------
% Copyright (C) 2017 M. Schrauwen (markschrauwen@gmail.com)
%
% This program... |
function pop= petmutation( Propo,pop,N,DIA )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
h=size(pop);
tes=init(Propo);
%variable de calcul
% pop(1).affiche();
for in=1:Propo
tes(in).egalite(pop(round(1+(h(2)-1)*rand)));
tes(in).petmutationnet();
end
forcasted= f... |
function figureKeyPress(source,eventdata,panel,d,overrideCurrentKey)
global fHandles displayStatus panels
if nargin<3
panel=[];
end
if nargin<4
d=[];
end
if nargin >= 5
currentKey=overrideCurrentKey;
source=fHandles.browsefig;
else
currentK... |
clear
dates={'Oct_28_11' 'Nov_10_11' 'Nov_11_11' 'Nov_18_11' 'Nov_23_11' 'Nov_25_11'};
cellnum={'A' 'A' 'A' 'A' 'A' 'A'};
start_current=10; % Starting current in pA
finish_current=150; % Finishing current in pA
increments=10;
celldata=zeros(numel(dates),3,7);
matrixnames={'control_pf_all_' 'control_pf_init_' 'con... |
function out = en_standarize(x,mu,std,dzdy)
% Standarizes the layer based on the layer mean and standerd deviation
% Author: Rahaf Aljundi
%
% See the COPYING file.
initial_dimensions=size(x);
temp=uint8(mu);
x=reshape(x,size(temp,1),size(temp,2),size(temp,3),[]);
x= bsxfun(@minus,x,mu);
y= bsxfun(@rdivide, x,std);
... |
clear all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Values that can be edited to improve performance of the adaptive PCA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fdim = [28,28]; %Dimentsion to show the image
m = 28*28; %m dimension
l = ... |
function P = wipread_modified(directory_Mz, directory_M0)
% ** function P = wipread_modified(directory_Mz, directory_M0)
%
% Writes parameters of Mz and M0 images to structure 'P'.
% Modified for compatibility with Bruker/Paravision data format.
%
% CT 20161205
try
methodpath = fullfile(directory_Mz, 'method');
... |
function qubitFreqDiagram(qubits)
%
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
error('todo...');
if nargin < 1
qubits = {};
end
try
QS = qes.qSettings.GetInstance();
catch
throw(MException('QOS_readoutFre... |
%% Opdracht 8
% Maak een functie aan met de naam 'opdracht_8'.
%
% De input van deze functie bestaat uit twee vectoren.
% De eerste vector geef je de naam 'bovenbeen' en de tweede vector
% de naam 'onderbeen'.
%
% De output van de functie is de waarde van het laatste element
% van 'bovenbeen' gedeeld door het twee... |
im = imread('C:\Users\user\Desktop\Fig0427(a)(woman).tif');
im_dft = fft2(im);
im_dft_center = fftshift(im_dft);
mag = abs(im_dft_center);
phase = angle(im_dft_center);
phase = mat2gray(phase);
mag = mat2gray(mag);
figure;
imshow(mag,[]);
figure;
imshow(phase,[]);
|
function [bool] = ValidateLagrangeInterpInput(x,y)
bool = false;
if length(x) ~= length(unique(x))
fprintf("Error: some x value appears twice in the sample!")
bool = true;
end
if length(x) ~= length(y)
fprintf("Error: x and y of different length")
bool = true;
en... |
function p = predict(Theta1, Theta2, X)
%PREDICT Predict the label of an input given a trained neural network
% p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the
% trained weights of a neural network (Theta1, Theta2)
% Useful values
m = size(X, 1);
num_labels = size(Theta2, 1);
% You need ... |
function fs = scatteringFct(R, delta, omegaM)
% function fs = scatteringFct(R, delta, omegaM) returns the
% scattering function for a bubbles of a given radius
%
% INPUTS:
% R : the radius of each bubble
% delta : the damping term
% omegaM : the Minnaert frequency
omega = 57.5e3*(2*pi); % working frequency (found ... |
function [WS, TW] = SEP(H_Segment, Vinf, dhdt, dVinfdt, alpha, beta, n, AspectRatio, e, C_D0)
% This is the specific excess power equation which can be used for point
% performance. This can be applied to cruise, diversion and loiter
% segments. Could probably be applied to climb segments as well once we can
% figu... |
% Andrew Mullen
% 5/4/2018
close all
clear all
fname = 'data/sw/spgr/I.082';
A = mri_read(fname);
display_image(A,'I.082')
saveas(gcf,'Question1/original','png')
AthreshLow = A;
AthreshHigh = A;
% Segment based on a threshold
threshold = 67;
AthreshLow(AthreshLow<threshold) = 0;
AthreshHigh(AthreshHigh>threshold) = ... |
classdef Steady < solver.blazer.Blazer
properties
IxZero % Index of level and growth quantities set to zero.
PosFix % Positions of level and growth quantities fixed by user.
Reuse % Use values from previous variant as initial condition.
Warning % Throw warnings.
end
... |
function newcom = getcom()
newcom = 'COM6'; |
clear;
p_folder = '/Users/ryanlab/Desktop/AliT/Scripts/saliency_analysis/output/corr_data/';
participants = dir(p_folder);
participants = participants(5:end);
p_file = 'participant_';
output = {};
for participant_num = 1:length(participants)
participant_info = participants(participant_num);
pname = participant_... |
%%% Set check to true for validation %%%
check=true;
% Number of simulations
%%%
% TODO : assess the impact fot this parameter on the results
% of the reconstruction
Nens = 50;
% Wind parameter
GW = 1;
% TODO : assess the impact of this parameter on the results
% of the reconstruction
percentInfo = 0.95;
% Generate... |
function [OldSumDominantMatrix,LeftSum2,LeftSum1,RightSum2,RightSum1,BreakPoint,OldTFNumber,OldRightAscendData,OldLeftAscendData]=AddOldTFuzzyFusionResults(Data)
size1=size(Data);
RowSize=size1(1);
M=IncrementalDominantMatrix(Data);
NewRank=SumRank(M);
if mod(RowSize,2)==1
MedianOdd=(1+RowSize)/2;
... |
function [sol, t, x, C] = LPM_linear(feedProf, parameter, L, Di, epsb, epsp, Rp, Q, Cfeed, keff, Dax, tpulse, tfinal, opt)
% Lumped Pore Model (LPM) considering mass transfer resistence and axial dispersion.
% Linear isotherm
% Change feed profile between pulse (e.g.: chromatografic peak) and step (e.g.: breakthrough e... |
%script9_12.m
for i=1:4
b(i,:)=[1 2 3];
end
disp(b) |
function R = RotationMatrix(vec_dir)
% This function calculates the rotation matrix for a rotation that takes
% the unit vector in the 'z' direction ([0 0 1]) and rotates it to point in the
% direction of input vector 'vec_dir', for which the components are [x y
% z].
% From section 9.2 of Modelling CPV by Ian Ric... |
function [vf,dvdpar]= fadderiv(v,par0)
% [vf,dvdpar]= fadderiv(v,par0)
% input --v: wavenumber
% --par0: initial parameters. 4 by g matrix,first row is peak
% position, second row is intensity,third row is Gaussain width(HWHM),
% fourth row is Lorentzian width(HWHM)
% output -- ... |
%% Initial
clear all; addpath('../../routines');
input_file_folder='input';
%%
input_file_name='lognormal_cumulative.es';
p=f_read_input(input_file_folder, input_file_name);
p=f_set_gauss_parameter(p);
p.hitting_set.thresholds=f_set_thresholds(-4,4,0.01, 'log10');
gmf= @(k) f_gaussian_minkowski_functionals(k,p.rf_di... |
function [value] = g(x,mean,stdev)
% this calculates a gaussian (normal) distribution
% x - input value or array
% mean - mean of the gaussian
% stdev - standard deviation of the gaussian
% value - value of the the gaussian at the input value(s)
% if input is array, output is an array
valu... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A Two-Lane Cellular Automaton Traffic Flow Model with the Keep-Right Rule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear all;
close all;
B=3; % The number of the lanes
plazalength=100; % Th... |
clear all
close all
clc
syms x
Q1f(x)=3*cos(x)^2-2*x;
Q1d(x)=diff(Q1f);
vx=-2*pi:pi/1000:2*pi;
plot(vx,double(Q1f(vx)),vx,double(Q1d(vx)),'--')
clear vx x
keyboard
|
function R = CS5320_gen_R(u,theta)
% generate a rotation matrix about an arbitrary vector
% On input:
% u (3x1 vector): unit vector about which to rotate
% theta (float): amount to rotate (in radians)
% On output:
% R (3x3 matrix): rotation matrix
% Call:
% R = CS5320_gen_R([0;0;1],pi/2);
% Author:
% Shantnu... |
function [ Error ] = synthetic_simulation(param)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wasserstein Inverse covariance Shrinkage Estimator
% Viet Anh NGUYEN, Daniel KUHN, Peyman MOHAJERIN ESFAHANI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sigma = param.Sigma;
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nathan Herr
% ASEN 4057-Midterm
% Simulate pseudochaotic particle motion (Part 1.1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [t,r] = simulate_particle(tspan, r0, sigma, rho, beta)
%define inputs as global variables
global sigma1 rho1 beta1
s... |
function [prims] = Cons2Prims(glob)
prims = zeros(glob.nvars, glob.nx+2*glob.nguard, glob.ny+2*glob.nguard);
end
|
% Change the value to choose the feature to represent in the plotbox
% 1-x 2-y 3-z
% 4-roll 5-thumb 6-bending value 7-fore bending value 8-index bending value 9-ring bending value
app;
arrFeatures =["x" "y" "z" "roll" "thumb bending value" "fore bending value" "index bending value" "ring bending value"];
... |
startup;
% Load all the images
nii1 = load_nii('coreg/ct.nii');
nii2 = load_nii('coreg/Head_CV_UTE_AC_WIP_719 - 13.nii');
nii3 = load_nii('coreg/Head_CV_UTE_AC_WIP_719 - 14.nii');
nii4 = load_nii('coreg/Head_CV_UTE_AC_WIP_719_18deg - 18.nii');
nii5 = load_nii('coreg/Head_CV_UTE_AC_WIP_719_18deg - 19.nii');
nii6 = load... |
plot(tableNums, queryAverageTimes, '*k-');
axis([16,96,0,180]);
set(gca,'XTick',[16:16:96]);
xlabel('Code Length');
ylabel('Average Query Time(ms)');
box on;
|
% this is some kind of attempt at analyzing ping pong noises with fourier
% transforms or something like that, looks like it plots the raw signal
% too, I don't remember, basically scratch work
[y,Fs] = audioread( 'Wav Files/PingPongSong.wav' );
close all
u=4;
a=2;
dt = 1/Fs;
t = 0:dt:(length(y)*dt)-dt;
f1 = figur... |
function [IBI,time]=ibi1JKG(N,xcord,ycord,thresh)
%this funciton computes interbeat intervals of a timeseries
%Make sure you truncate your control
close all;
sr=40;
timeseries=N(xcord,ycord,:);
lt=length(timeseries);
for i=1:length(timeseries);
times(i)=timeseries(1,1,i);
threshvec(i)=thresh;
end
t=0:1/s... |
function frm = init_det(detec, IM)
frm = detec.detect(IM);
if ~isempty(frm) && ~isempty(frm(1).fittingScore)
[~,ind] = max([frm.fittingScore]);
% [~,ind] = max([frm.Area]);
if isempty(ind)
return
end
frm = frm(ind);
end
|
function varargout = PDV_flux_3(varargin)
% PDV_FLUX_3 MATLAB code for PDV_flux_3.fig
% PDV_FLUX_3, by itself, creates a new PDV_FLUX_3 or raises the existing
% singleton*.
%
% H = PDV_FLUX_3 returns the handle to a new PDV_FLUX_3 or the handle to
% the existing singleton*.
%
% n (singleton)".
%
%... |
function stop(controller)
% STOP Disconnects the controller from the DataTurbine.
% STOP(CONTROLLER) stops the CONTROLLER from receiving data from the
% DataTurbine and forwarding information to the registered functions.
% CONTROLLER is the MatlabController object that is to be stopped.
%
% This function... |
% Anchored Neighborhood Regression for Face Super-Resolution
% using Bicubic, GR, ANR, A+(0.5 mil), A+.
% version2.0 add locality constrain
%clc
%clear;
addpath('./utilities');
verbose = 0;
% % make sure you have make ompbox and ksvdbox already,
% % if not run the code, and before make you should have a ... |
%DAGNN.UNIFORMSCALINGGRIDGENERATOR Generate an iso-tropic scaling + translation
% grid for bilinear resampling.
% This layer maps 1 x 1 x 3 x N transformation parameters corresponding to
% the scale and translation y and x respectively, to 2 x Ho x Wo x N
% sampling grids compatible with dagnn.BlilinearSampler... |
function BdaTpaList = getallBDATPA(pth, files)
% files = {'2_21_17\2_21_17_1','2_22_17/2_22_17_1' '4_2_17/4_2_17_1' '2_27_17/2_27_17_1stAndThird' '3_1_17/3_1_17_1' ...
% '2_23_17\2_23_17_1_1stAndThird'};
% pth = 'C:\Users\Hadas\Dropbox\biomedData\Den6';
L=[];
l=1;
n=1;
for f=1:length(files)
list=di... |
function [cluster stateCounts] = sample_c(data_struct,stateSeq,dist_struct,stateCounts)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sample the cluster labels %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% alpha0 = hyperparams.alpha0_p_kappa0*(1-hyperparams.rho0);
% kappa0 = hyperparams.alpha0_p_kappa0... |
function [ status, message ] = op_NTC( data_handle, option, varargin )
%OP_NTC Calculate Normalised Total Count from traces or images
%--------------------------------------------------------------------------
% 1. Using normalised total count to estimate calcium
%
%---Batch process-----------------------------------... |
function K = KalmanPredictionSolution (K)
% PREDICTIoN
% State
K.x_pred = K.D * K.x_pred;
% Covariance
K.C_pred = K.D * K.C_pred * transpose(K.D)+ K.Q;
|
function hmm = updateOmega(hmm,Gamma,Gammasum,residuals,T,XX,XXGXX,XW,Tfactor)
is_gaussian = hmm.train.order == 0; % true if Gaussian observation model is being used
K = length(hmm.state); ndim = hmm.train.ndim;
S = hmm.train.S==1; regressed = sum(S,1)>0;
if nargin<9, Tfactor = 1; end
Tres = sum(T) - length(T)*hmm.tr... |
classdef ImageHandler < handle
%IMAGEHANDLER allows to read, write images with formatted titles
properties
filenamer
readImage
writeImage
end
methods
function obj = ImageHandler(space, solution, experiment, runId)
obj.filenamer = Filenamer(space, solution, experiment, runId);
if strcmp(space, 'HDR... |
%-------------------------------------------------------------
% plik kreślący wyniki
%-------------------------------------------------------------
% Hubert Gawryś 2014-03-16
% Instytut Zarządzania w Budownictwie i Transporcie (L-3)
% Wydział Inżynierii Lądowej
% Politechnika Krakowska im. Tadeusza Kościuszki
... |
function [data_continuity_score,data_continuity_measurement_scores,data_continuity_matrix] = check_data_continuity(r,params)
%% check_data_continuity.m
% This function:
% uses the info in the parms structure about the data continuity requirements
% puts a query in the rule based system to get all the measurements in t... |
% This function is use do calculate (d PSI)/(d theta).
%
%As you can see that there are a lot of calculation, but we won't use spmd
% or parfor, which means that no parellel computing here, because nest spmd
% or nest parfor is not allowed.
function [dpsidtheta,dpsidr,dpsidthetadr] = dpsid(R,mu,betac,r,theta)
... |
% IMPORTANT - This script requires the Matlab symbolic toolbox
% The code is the implementations of Double-Stage Kalman.
% Author: Xinzhe Gui
% Email: lwft@qq.com
%% environment config
clear all;
reset(symengine);
load('./Mat/StatePrediction.mat');
addpath(genpath(pwd));
%% derive the covariance prediction equations
%... |
%{
trace_opt : smallint unsigned #
---
activ_func="ReSqu" : enum('ReLu','ReSqU','biReLu','biReSqU','divNorm') # activation function nonlinearity
%}
classdef ActivityParams < dj.Lookup
methods
function activ_func = getActivation(self)
switch fetch1(self,'activ_fu... |
% ======================================
% Cycle-slip detection
%
% zhen.dai@dlr.de
%
% last modified: 2011.Oct
% ======================================
% Check the cycle-slips by differencing phase measurements with a higher
% order. The order can be determined automatically or identified by the
% user himself.
fun... |
%I calculator rectangular tube
function [I,A] = IRT(b,d,t)
h = b- 2*t;
k = d -2*t;
I = (b*(d^3) - h*(k^3))/12;
%A = (b*d) - (h*k);
end |
% M101x.m
% help file for M101x.dll
% Three main commands.
% returns -1 on error
%
% C_INIT sets all bits as output
%
% C_DATA is the main command
% second arg specifies performance on byte (M_BYTE) or bit (M_BIT)
% third arg specifies:
% M_.READ input data from port
% M_.SET output data to port
% M... |
function fig_save(figFn, saveFigures, figOptInS, setNo)
% IN:
% figFn
% Do NOT include path
% ---------------------------------------------
cS = const_cpsearn(setNo);
figDir = cS.dirS.figDir;
if isempty(figOptInS)
figS = const_fig_cpsearn;
figOptS = figS.figOptS;
else
figOptS = figOptInS;
... |
function [nextStep] = NextStep(positions, i, destination, p, previousStep, positionOfCars, positionOfBikes, state, position_critical_agent)
sideOfRoad = p.cityMap(positions(i,1),positions(i,2));
sideOfRoad_destination = p.cityMap(destination(i,1),destination(i,2));
if destination(i,2)+1 < p.N
if p.cityMap(destina... |
function features = extract_temporal_features_new(params,data,covmatrixUse)
features = [];
channelID = params.channel2Keep.temporal;
fs = size(data,2);
Dstep = fs/params.classifier.training.features.Dtemp;
for iChannel = 1: length(channelID)
ch = channelID(iChannel);
signal = data(ch,:);
%% resampling
... |
%% Compare performance of Global Optimization Solvers
% Copyright (c) 2012, The MathWorks, Inc.
% All rights reserved.
%% Setup Problem
options = optimset('Disp','none','Algorithm','interior-point');
x0 = [0 1.5];
lb = [-3 -3];
ub = [ 3 3];
%% MultiStart
fprintf('MultiStart Running ...\n\n');
tic
proble... |
clear
close all
clc
file_name=dir('CheckCode');
len=length(file_name);
X=[];
for i=3:15
X=[X,extract_image(strcat('CheckCode\',file_name(i).name))];
end
Y=[6 3 1 4 6 7 8 3 4 6 0 5 3 2 2 0 3 0 1 6 0 4 3 8 8 1 0 6 0 8 ...
1 8 6 0 2 3 0 1 0 2 2 0 3 5 0 1 1 6 4 0 8 8 0 8 7 2 8 0 2 2 ...
6 8 7 3 2];
save hack_... |
%Casey Nolte
%% Trying to Solve Analytically
syms a(t) b(t) c(t) d(t) e(t)
ODEvector = [-5 0 0 0 .01 ; ...
5 -15 0 0 0 ; ...
5 0 -.5*3.241 -.5*3.2451 -.01 ; ...
0 15 -.5*3.241 -.5*3.2451 0 ; ...
0 0 .5*3.241 .5*3.2451 -.01];
Y = [a; b; c; d; e];
C = Y(0) == [5 0 0 .5 1]';
odes = diff(Y) == ODEvector... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.