text stringlengths 8 6.12M |
|---|
function hmm = hsupdate(Xi,Gamma,T,hmm)
%
% updates hidden state parameters of an HMM
%
% INPUT:
%
% Xi probability of past and future state cond. on data
% Gamma probability of current state cond. on data
% T length of observation sequences
% hmm single hmm data structure
%
% OUTPUT
% hmm single hmm da... |
% main9.a MATLAB main program for Kernel pdf estimation
% Course 02457, November 2007, LKH
%
clear
%
Nx=50; % dimensions of 2D data
Ny=50;
N=300; % training set size
Nval=200; % test set size
width=10; % std of simulation normal distribution
%
% Normal distributed data fo... |
clear;
clc;
num=[0.25 1];%分子
den=[0.5 1 0];%分母
GH=tf(num,den);%开环系统的传递函数
sys=feedback(GH,1);%加负反馈,闭环系统
p=roots(sys.den{1});%闭环系统的极点
z=roots(sys.num{1});%闭环系统的零点
pzmap(sys,'r');%画出系统的零极点图
grid on;%画栅格
[p,z]=pzmap(sys)%输出零极点数据
|
function [Q, R] = qr_givens_fast(A)
[n,m]= size (A);
Q = eye(n);
temp = zeros(2,m);
for l = 1:m
for k = n:-1:l+1
if A(k,l) == 0
continue
end
r = sign(A(l,l))*sqrt(A(l,l)^2 + A(k,l)^2);
s = A(k,l)/r;
c = A(l,l)/r;
G = gfast(c,s);
G*[A(l,:);A(k,:)... |
clear
clc
%% TEST TYPE (modify here)
% rawPath = 'C:\Users\XJLM\Documents\MATLAB\3DSCD\resource\TestSet\';
CameraType = 'SENZ3D'; % 'SR4K' | 'SENZ3D'
WithMovement = 'Y'; % 'Y' | 'N'
ChangeType = 'S'; % ['0NoChange1' to '0NoChange10']
% 'S' | 'D' | '1' | '2' | '3' | '4' | '5'
% 'SH' | '... |
clear all; close all; clc;
rng(72);
hsize_gauss = 15; %
val_perc = 0.03; % validation percentage
base_path = '../../data/cc_sjtu';
in_train_rgb_path = 'train_frame';
in_train_gt_path = 'train_label';
out_train_rgb_path = 'train';
out_train_gt_path = 'train_gam';
out_train_vis_path = 'train_gam_vis';
out_val_rgb_pat... |
% big tester
% runs through many iterations of run_modetest, sweeping params
%
% 12/17/13
%
base = "/media/joe/Milarepa/residual_test/";
numrep = 1000;
for index=1:10;
mscale = index / 20;
mshift = 1-mscale;
directory = [base, "trial_", num2str(index)];
if exist(directory) != 7
printf("making ... |
function plot_data(src, event)
persistent tempData
persistent tempTimeStamps
plotDur = 15;
smWin = 5;
if isempty(tempData)
tempData = [];
tempTimeStamps = [];
end
tempData = [tempData; event.Data];
tempTimeStamps = [tempTimeStamps; event.TimeStamps];
nS... |
function [the,re] = fproptdr(the,re,BL1,BL2,ww,nc,nr)
% segments
th1nr = mean(the(1:BL1,nr));
th1nc = mean(the(1:BL1,nc));
th2nc = mean(the(BL1+1:BL2,nc));
th2nr = mean(the(BL1+1:BL2,nr));
r1nr = mean(re(1:BL1,nr));
r1nc = mean(re(1:BL1,nc));
... |
clc;
close all;
clear all;
%
%
% %% --------- Read .px4log and convert to .csv file then load to Matlab ---------------
% % log_file = '151221.Small_Size_Fixed_Wing_1.px4log';
% % log_file = '160107.Small_Size_Fixed_Wing_1.px4log';
log_file = '161219.LPE_with_VICION.px4log';
% log_file = '161222.UAV_2_Circle.px4log... |
function [dxi,stop_condition,energy] = coordinates_based_rendezvous(L,xi)
% This function implements a linear consensus controller using the
% coordinates information as the control inputs based on the following reference:
% A. Jadbabaie, J. Lin, and A. S. Morse, “Coordination of groups of mobile
% autonomous agents us... |
function b = strstrtswith(model,test)
%function b = strstrtswith(model,test)
%
%returns a binary vector indecating whether model is the beginning of any
%of the strings in cell array of strings test (or just test, if test is a string)
if(iscell(model) && not(iscell(test)))
tmp = test;
test = model;
model = tmp... |
function [metadata, headers] = load_metadata(metadata_file)
% [METADATA, HEADERS] = load_metadata(METADATA_FILE)
%
% Load metadata, for further processing / reading by READ_METADATA function.
%
% METADATA_FILE: Full path to metadata file.
%
% METADATA: The data contained in the metadata spreadsheet as a large ... |
% testing MCMC with Gaussian target
% high dimensional Gaussian target with positivity constraint
addpath([pwd,filesep,'utils']);
npar = 20; % dimension of the target
drscale = 20; % DR shrink factor
adascale = 2.4/sqrt(npar); % scale for adaptation
nsimu = 10000; % number of simulations
pos = 1; ... |
%WORLD2MICROSCOPE_ACCURACY converts world coordinates into local robot
%coordinates
%
% [x_output, y_output, z_output] = world2Microscope_Accuracy(x_input, y_input, z_input,x_origin,y_origin,z_origin)
% takes the location of the surgical tip output from the tracking system
% and translates them into the local coo... |
function [caughtData, escapedData] = loadDataResults(gammaVal, betaVal)
PATH = 'C:/AirSimOct/thesis/JavaClient/AirSimJavaPlayer';
folderName = sprintf('%s/type-1_g-%.3f_b-%.3f/', PATH, gammaVal, ...
betaVal);
caughtData = load(strcat(folderName, 'caught.txt'));
escapedData = load(strcat(folderNa... |
%GEN DOT SOURCE
%Generates various foci points depending on the needs of the research
function cells = genDotSource(cells)
rows = size(cells,1)
cols = size(cells,2)
sourceVal = 5000;
%Set Source concentrations
cells(rows/2, cols/2 + 70) = sourceVal;
cells(rows/2, cols/2 - 10) = sourceVal;
end |
function [ indOprnDayFinal,indOprnDayInter] = EvalYY( YY)
%EVAL2 Evaluation based on Position
%{
%% pre - check
if ~isa(pos, TsMatrix) | ~isa(price, TsMatrix) return; end
%}
%% Calculate intermediate day operation indicators
indOprnDayInter = SingleAsset;
indOprnDayInter.dates = YY.dates;
% TotBuys 1
%... |
function varargout = liveretinaGui(varargin)
%LIVERETINAGUI MATLAB code file for liveretinaGui.fig
% LIVERETINAGUI, by itself, creates a new LIVERETINAGUI or raises the existing
% singleton*.
%
% H = LIVERETINAGUI returns the handle to a new LIVERETINAGUI or the handle to
% the existing singleton*.
... |
[sigma_BRs, Bomega_BRs] = refError(0, LMO.init_att, LMO.init_rot, @(t) LMO.RsNDCM(t), LMO.omegaRsN(0));
[sigma_BRn, Bomega_BRn] = refError(0, LMO.init_att, LMO.init_rot, @(t) LMO.RnNDCM(t), LMO.omegaRnN(0));
[sigma_BRc, Bomega_BRc] = refError(0, LMO.init_att, LMO.init_rot, @(t) LMO.RcNDCM(GMO, t), LMO.omegaRcN(GMO, 0... |
function EDB2main(EDsetupfile)
% EDB2main - Calculates the specular and edge diffraction IRs and saves them in a file.
% Calculates the specular and edge diffraction IRs and saves them in a file or
% a series of files, if there are many sources and receivers.The
% calculation goes through three stages:
% 1. Geometric... |
% Mesh Flattening
% http://www.numerical-tours.com/matlab/meshdeform_3_flattening/
getd = @(p)path(p,path);
getd('toolbox_signal/');
getd('toolbox_general/');
getd('toolbox_graph/');
% First load a mesh.
name = 'nefertiti';
options.name = name;
[vertex,faces] = read_mesh(name);
n = size(vertex,2);
% Format of ver... |
function showspectrumdirect(varargin)
switch nargin
case 0
colorname = 'skyblue';
case 1
colorname = varargin(1);
end
params;
shiftvec = shiftvecdirect;
load(fullfile(matrixpth,figdir,'direct.mat'), 'evals')
figure(111)
hold on
%plot(real(shiftvec), imag(shiftvec), ...
% 'o', 'Color', rgb('beige'), 'Mar... |
close;
fig=gcf;
fig.Position= [250 450 650 200];
fig.Color=[1 1 1];
fig.Name='Transcriber';
fig.ToolBar='none';
fig.MenuBar='none';
fig.NumberTitle='off';
[XY, FS] = audioread('music.wav');
w = 32668;
h = 16284;
q = 8092;
note = [];
i = 1;
freqs = [];
while(i <= length(XY))
j=0;
if(XY(i+q) == 0 || all(XY(i:i+q+100-1)... |
clear all
perf_ms = [];
perf_m = [];
rounds = 1;
for i = 1:rounds
standard = 0;
numbits=2e5; %length of bitsteam to send
bits=randi([0 1],numbits,1); %bitstream
if (standard == 1)
x = senc(bits);
else
x = enc(bits);
end
% create random L0 and L1 pauses from uniform distrib... |
function [ revol ] = tick2revolution( tick )
% TICK2REVOLUTION calculates the revolution starting from the encoder tics
% according to equation theta(n) = tick(n)) * (2 * pi / res_encoder)
% Preallocate local variable
revol = double.empty;
% Encoder resolution (multiplied by gear train ratio)
res_encoder = 16384 * 25... |
function [Wi,Wo] = nr_extract(WW,D)
%NR_EXTRACT Extraction weight matrices from the reshaped vector
% [Wi,Wo] = extract(WW,D)
%
% Input:
% WW : the vector of the dimensions D(1)+D(2)+D(3)+D(4)
% D : the vector with stored dimensions of weight matrices
% Output:
% Wi : the matrix with ... |
classdef Track2 < handle
properties
blue
yellow
mids
vectors
angles
distances
widths
checkpoints
len
num
traj
friction
end
methods
%% CONSTRUCTOR
... |
close all;
clear all;
this_file_path = fileparts(mfilename('fullpath'));
data_path = [this_file_path '/ngspice.log'];
fid = fopen (data_path);
lines = strsplit(fileread(data_path), '\n');
fclose(fid);
u=0;
vector = [];
for n = 1:length(lines)
if strfind(lines{n}, '_VAL')
u=1;
endif
if (strfind... |
function bookmark(string)
%
% bookmark displays the current linenumber in the m.file with hypertext function and input string.
%
% How to use:
% bookmark('String')
%
% Author: Frederic Rudawski
% Original Date: 01.12.2016 - edited 06.10.2020
% Version 1.0
try
% get stack
Stack = dbstack('-completenames');
... |
function label_color = Get_Label_Color(class_id)
colors = [0, 0, 0;... % Black (undefined classes)
0, 102, 0; ... % dark green (Grass)
170, 170, 170; ... % Grey (concrete)
64, 64, 64; ... % Dark grey (Asphalt)
0, 255, 0; ... % ... |
% Python Questions Question 8
% takes in a string of comma separated names via console,
%..then sorts alphabetically and prints
function [] = python_q8 ()
%Take names
words_str = input('Enter a comma separated list of names:','s');
raw_cell = split(words_str,',');
rc = size(raw_cell);
r = rc... |
function nelbo = varObjectiveSigmaFixed(mu_q, y, fwdFunc, mu_p, invSigma_p, ...
logdetSigma_p, logdetSigma_q, sigmay)
%VAROBJECTIVESIGMAFIXED Variational objective for Fixed Sigma
%
N = size(y,1);
fwdval = feval(fwdFunc, mu_q); % fwd model and Jacobian
% Quadratic term com... |
function pdf = readTbiPdf(measurementType, subjectType)
load(strcat('Regression_age_',measurementType,'_noneg.mat'));
% for meas = [5 6 7 8]
% switch measurementType
% case 'fa',
% % load(sprintf('%s/tbi_fa_noneg','.'));
% load(sprintf('%s/Regression_age_fa_noneg.mat','.'));
% % fn =... |
tic
names = {'laure', 'kevin', 'francesco', 'gregor', 'gregor2', 'ricardo', 'jm', 'alex', 'omar'};
if ~exist('recordingsOutdoor', 'var')
recordingsOutdoor = [];
end
for n = 1:length(names)
name = names{n};
if ~isfield(recordingsOutdoor, name)
recordingsOutdoor.(name) = [];
end
for r = 1:6
... |
clear;
im_dir = dir('G:\LFW_HPEN\LFW_Norm_Demo\*.jpg');
filepath = 'G:\LFW_HPEN\LFW_Norm_Demo\';
selIdx = [18 22 23 27 37 69 40 43 70 46 31 32 36 49 52 55];
scale = [300 212 150 106 75] / 250;
fp = fopen('lfw_13233.txt', 'r');
highlbp_lfw = uint8(zeros(75520, 13233));
for i = 1 : length(im_dir)
% im = imread([filep... |
fs = 16000;
x=wavrecord(5*fs,fs,1);
wavplay(x, fs);
Tam_Total = length(x);
Energia_Total = 0;
for n=1:Tam_Total
Energia_Total = x(n)^2+Energia_Total;
end
Energia_Total = Energia_Total / Tam_Total;
Energia_Segmentada = 0;
Silencios_rec = 0;
y=100;
Tam_Parciales = Tam_Total/80;
for Segmento=1:(Tam_Total/Tam_Parciales... |
% Test échantillonnage sur le système de Mackey - Glass
% *****************************************************
clc; clear; close all;
T_tot = 10; % Intégration sur [0 T_tot]
load('CibleMG.mat'); % Précalcul de MG où T_tot = 35000
% Echantillonnage de pas h
Cible0p5 = deval(MG,0:0.5:T_tot)';
Cible1 = deval(MG,0:1:T_... |
clear
Rootcata=input('输入待处理文件所在目录','s');%输入文件路径,注意输入路径最后要加反斜杠\
str5='*.xlsx';
Open=sprintf('%s%s',Rootcata,str5);
filename=dir(Open);%获取目录下全部的.xlsx文件
n=length(filename);%文件数目
for count=1:n
name=filename(count).name;
Proceeding=sprintf('%s%s',Rootcata,name)%准备打开路径文件名
storage=xlsread(Proceeding,1,'C2:C200');%执行打开,并将数据存于数... |
function ring = atsetcavity(ring,varargin)
%ATSECAVITY Set the cavity parameters
%
%WARNING: This function modifies the time reference,
%this should be avoided
%
%ATSETCAVITY may be used in two modes:
%
%Upgrade mode
%===================================================
%NEWRING=ATSETCAVITY(RING,...,'Frequency',FREQUENC... |
function createEmptyFile(obj, fileName)
% CREATEEMPTYFILE creates an empty file
%
% Copyright 2018 The MathWorks, Inc.
import com.microsoft.azure.datalake.store.ADLStoreClient;
% Create a logger object
%logObj = Logger.getLogger();
% validate input
p = inputParser;
p.CaseSensitive = false;
p.FunctionName = 'createE... |
function x = affineMap(x)
n = length(x);
e = ones(n,1);
minx = min(x);
x = e + 1/(1-minx)*(x-e);
end
|
classdef VGG < handle
%VGG Class implementing VGG (Oxford Visual Geometry Group) descriptor
%
% Trained end to end using "Descriptor Learning Using Convex Optimisation"
% (DLCO) aparatus described in [Simonyan14].
%
% ## References
% [Simonyan14]:
% > K. Simonyan, A. Vedaldi, and A. Zis... |
function [Sig, answer] = CMR_randMod_clicky_3AFC(noise_bands,target_f,SNRdB,n_mod_cuts,target_mod_f,fs,tlen,coh,risetime,silence_period)
% This function will generate a CMR stimulus with 3 noise bands which have
% a random moudlation and a modulated tone embedded in the noise
%noise_bands = 3 x 2 matrix providing the ... |
function [A,b1,b2,r] = Construct_A_b(x,z,del,r)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Construct_A_b build a linear system Au = b for solving the homogenisation
% problem numerically, where u is the solution to the problem.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function prob = online_decoding(features,classifier)
%% Normalization
features = normalize_feature(features,classifier);
%% PCA
if classifier.applyPCA
features = features * classifier.coeff;
end
%% Regularization sLDA
% if classifier.regularization
% features = features * classifier.Beta;
% else
%% Feature... |
function poly_list = make_poly(x,y,rounds)
%x,y lists of points, column vectors
%fills in extra points along a ploygon
p = [x, y];
c = [mean(x) mean(y)];% center point
v = p-c ; % vectors connecting the central point and the given points
th = atan2(v(:,2),v(:,1));
[th, idx] = sort(th); % sort angles
p = p(idx,:);... |
function [E,wh,pairs] = EGO(info,pairs,w,bestID,nq)
% calculate A
if ~isempty(pairs)
count_set = appDistribution(info,pairs,[]);
A = info.theta'*count_set;
probability_obj = info.theta.*count_set/A;
else
probability_obj = info.theta;
A = 1;
end
... |
function [ys,check] = SimpleModel_steadystate(ys,exe)
global M_ lgy_
if isfield(M_,'param_nbr') == 1
NumberOfParameters = M_.param_nbr;
for i = 1:NumberOfParameters
paramname = deblank(M_.param_names(i,:));
eval([ paramname ' = M_.params(' int2str(i) ');']);
end
check = 0;
end
%% Enter model equations here
c1 = ... |
format compact
%problem variables
time = 0; % total time spent on the road to go student i
n1 = 5;
size1 = n1 + 1; % professor is also included in the timetravel matrix
completionTime1 = randi([300 500],n1,1); %this array will hold the completion time for homework of each student
finalTravelTime1 = zeros(size1);%... |
function [w_i, cost_i, e_i] = SGD_LR_everyBatch(y, X, w0,batch_size, interval_between_errorbar)
% variables
n = size(X, 1); % number of examples
m = size(X, 2); % how many parameters (features)
d = m; % dimension
lambda = 0.0001; % regularization parameter
alpha = 1; % priv... |
% mps_cond_from_template: find conditional data within template
%
% Call:
% [d_cond,n_cond]=mps_cond_from_template(SIM,ix,iy,iz,T,n_cond_max)
%
% SIM: simulation grid (NaN-> non simulated nodes)
% [ix,iy,iz]: index of center node in TI
% T: template
% c_cond_max: find maximum number of conditional points
%
% See al... |
### Skript zur LR-Zerlegung einer quadratischen Matrix A mit Rang n ###
function LR = LR_decompose(A)
n = length(sum(A)) - 1;
LR = A;
for j = 1:1:n
for i = j:1:n
### Speichern der Rechenoperation ###
L_Element = LR(i + 1, j) ./ LR(j, j);
### Berechnen der Elemente d... |
nSamples = 1e3;
nRps = 1e2;
coefAr = [0.1 0.8];
orderAr = length(coefAr);
variance = 0.25;
delay = 1;
step = [0.05; 0.01];
nSteps = length(step);
leak = 0;
arModel = arima('AR', coefAr, 'Variance', variance, 'Constant', 0);
arSignal = simulate(arModel, nSamples, 'NumPaths', nRps);
arSignal = arSignal';
weightLms = ce... |
function [ LL ] = wblloglike(X, c, k)
% WBLLOGLIKE Log-likelihood function for the Weibull distribution.
% Input:
% - X : vector of the points to be evaluated
% - c : scale parameter
% - k : shape parameter
% Output:
% - LL : logarithmic likelihood estimator
% Size of the vector
n = length(... |
function r = plus(p,q,varargin)
%@jointevents/plus Overloaded plus function for Jointevents objects.
% je = plus(P,Q) combines joint events objects P and Q and returns the
% JointEvents object R.
% get name of class
classname = mfilename('class');
% check if first input is the right kind of object
if(~isa(p,classn... |
function [X, a, b] = normalCircle(angles, angleOffset, a, b)
% This function rotates a 2D circle in 3D to be orthogonal with
% a normal vector.
%
% Inputs:
% angles The location of vertices around the circle (degrees)
% angleOffset The (in plane) rotation to apply to the vertices
% ... |
function [out_std,out_mean,out_min,out_max,out_range] = mm_statnan(in)
%MM_STATNAN Calculate basic statistics for data with NaN
% Input:
% in ... data with NaN. Matrix or vector. If Matrix, output shows
% results for columns.
% Output
% out_std ... standard deviation
% out_mean... mean value
% ... |
%% repair_data01
% edit mydata_my_pet, write results_my_pet.mat, save zip, writes entries_web/my_pet/my_pet_res.html
%%
function nm = repair_data01(entries)
% created 2023/03/17 by Bas Kooijman
%% Syntax
% [WD, nm] = <repair_data01 *repair_data01*>(entries)
%% Description
% Checks if fields data.Wi or Wp or Wb are p... |
function [ features ] = extractFeaturesFromData( data , featureType )
%EXCTRACTFEATURESFROMDATA Summary of this function goes here
% Detailed explanation goes here
switch featureType
case 'grayscale'
features = reshape(data,size(data,1),128*128);
case 'gabor'
MAG = zeros(size... |
%function result = constraint_J(params, params_i, delta_t)
%
% Constraint function for molecular fluxes, J
%
% Inputs -
% params -> current system state
% params_i -> initial system state -> not actually used
% delta_t -> time step between initial and current state
%
% Outputs -
% result -> J - param... |
function VBA_disp(str,options)
% conditional display function
if options.verbose
if iscell(str)
n = length(str);
for i=1:n
disp(str{i})
end
else
disp(str)
end
end |
%%This function computes kappa of the typical user given
%%N: number of BS antennas
%%Channel: a realization of the channel matrix of dimension M*N
%%K: number of high-resolution ADC pairs
%%SNR: transmit signal-to-noise ratio, defined as \mathcal{E}_s/1
%%Norm-based ADC assignment
function [kappa_multiuser_optimized]... |
function write_vtk1(option,value,idx, varargin)
% option = 'v', tetra; 's', surface
% value = the vector to be written 1xN.
% varargin: idx to indicate epi vs. endo vs. mfree node. Used when trying
% to write surface results from mfree outcome;
% for example, varargin{1} = find(idx==3);
%%%%%%%%%%%%%%%%%%%%%%... |
function [tccout,indxout] = CrossCorrRec(t1,t2,tmax,nbins)
% CrossCorrRec: compute spike crosscorrelations for vectors in a cell array
% [tccout,indxout] = CrossCorrRec(t1,t2,tmax,nbins)
% Calling syntax is just like CrossCorr, except t1 & t2 may be cell arrays
% of spike time vectors
binning = 0;
if (nargin == 4)
b... |
function [gestures motion_scores] = temporal_segment(depth, rgb, parameters)
%[gestures motion_scores] = temporal_segment(depth, rgb, parameters)
% Function performing temporal segmentation of a video based on motion,
% without using dynamic time warping. The method can be used in on-line
% mode, ie without waiting... |
%Ravdeep Pasricha , Ekta Gujral, Vagelis Papalexakis 2018
%Computer Science and Engineering, University of California, Riverside
function [Facts, maxfit] = runCPALS(X, R)
iter = 4;
Facts_cell = cell(iter, 1);
out_fit = zeros(iter,1);
for i = 1:iter
[Facts_cell{i}, ~, out] = cp_als(X, R, 'tol',1.0e-7, 'maxiters', 1000... |
function cost = f(input)
global s_init
[R, ~] = multiple_shooting(input, s_init);
cost = 0.5*(R.'*R);
end |
function [ density_value ] = NormalDist( X, mu, sigma )
%%X can be a 1*P example
% mu has to be a 1*P vector too
%sigma will be P*P matrix
d = size(X,2);
sigma = diag(diag(sigma));
%density_value = (1/(((2*pi)^(d/2))*(det(sigma)^(1/2))))*exp((-1/2)*(X-mu)*(sigma\(X'-mu')));
density_value = mvnpdf(X,mu,s... |
function result = random_number(lowest, highest)
% function result = random_number(lowest, highest)
%
% returns a random integer uniformly distributed in the range
% {lowest, lowest+1, lowest+2, ..., highest}
random_number = rand(1);
range = highest - lowest +1;
step = 1/range;
result = floor(random_nu... |
function ROIData = selectCellROIs(data,params)
if params.holdFigureCheckbox;
figure(params.figureHandle);
hold all;
else
figure;
end
%initialise data structure
tempStruct = ...
struct( 'localizationData',zeros(1,2),...
'tracks',zeros(1,2),...
'nMolecules',zeros(1,1),...
'impolyVertices'... |
%PYRAMID_ALIGN_NCC Align high resolution color channels with Normalized
% Cross Correlation
%
% Ke Wang (kewang@cs.unc.edu)
function [offset] = pyramid_align_ncc(template, A)
if size(template, 1) > 128
I1 = impyramid(template, 'reduce');
I2 = impyramid(A, 'reduce');
coarse_offset = p... |
function [J_val] = LRCFnonR(x,y,theta)
%LRCFNONR Summary of this function goes here
% Detailed explanation goes here
m = length(y);
J_val = (x * theta - y)' * (x * theta - y);
end
|
classdef I_Solid
%I_Part class
properties
name
volume
material
mass
density
boundingBox
surface
end
methods
function obj = I_Solid(name,volume, material, mass, density, boundingBox, surface)
... |
function fclose2(fid)
% A version of fclose that errors on failure
status = fclose(fid);
if status ~= 0
if isequal(fid, 'all')
file = '<all filehandles>';
else
file = fopen(fid);
end
error('Failed doing fclose on file %s. Error message unavailable.', file);
end
end
|
% This script creates an animation showing the population distribution as a
% function of year.
for i = 1:length(logsout.getElement('P').Values.Time)
P_total = logsout.getElement('P').Values.Data(:,1,i) + logsout.getElement('P').Values.Data(:,2,i);
plot(0:119,P_total)
axis([0 100 0 6E6])
legend(nu... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Read photos
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Specify photo path
clc
clear all
close all
% load deck;
% Specify path for directory containing sub_directories of all images
path = 'C:\Users\vbui\Google Drive\CUA Fall 2014\ENGR652\Final-ENGR652-Vy\ORL\'
% Get images sub_di... |
%==========================================================================
% MOTION_PREPRO Preprocessing template object
%==========================================================================
% a=motion_prepro(hyper)
%
% This preprocessing converts a video into a sequence of feature vectors,
% one p... |
De Matlab functie length() geeft bij een
kolomvector het aantal RIJEN van de vector terug. |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2018 Crypto4a Technologies Inc.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction,... |
function [order]=nominateJ(A, observe, k, d, embedFun)
% INPUTS:
% A :: the adjacency matrix (n-by-n, for vertices 1,2...n)
% observe ::observe(i) is -1 if vertex i is ambiguous (block membership unknown),
% and observe(i) is otherwise 1,2,...K according as vertex i is known to be in blocks 1,2,...K, respectively
% ... |
function getPCAxes(gui,source)
% ask the user which trials to use for PCA (and how many PCs to include?)
m = gui.data.info.mouse;
sess = gui.data.info.session;
use = gui.allPopulated(:,1)==m & gui.allPopulated(:,2)==str2double(strrep(sess,'session',''));
trList = gui.allPopulated(use,3);
stringList = {}... |
function [errorCode,errorMsg,packet] = queryFutMargin(self)
% 期货查询保证金的方法
% function [errorCode,errorMsg,packet] = queryFutMargin(self)
% --------------------------
% 吴云峰,20170106
connection = self.connection;
token = self.token;
accountCode = self.accountCode;
combiNo = self.combiNo;
[errorCode, errorMsg... |
function [] = maxRelMinRed(data,class,str)
% Function to generate mRMR scores for a dataset
temp = zeros(size(class,1),1);
for i=1:size(data,1)
temp(i,1)=find(class(i,:),1);
end
class = temp;
clear temp;
bin = 10;
num = size(data,2);
redundancy = zeros(num);
... |
function [gridList] = InitializeGridList()
% initialize a 2D array of Grids.
gridList = repmat(Grid(1, 1), 6, 8);
rowGridList = 6;
colGridList = 8;
for i = 1:rowGridList
for j = 1:colGridList
gridList(i, j) = Grid(i, j);
end
end
end
|
function im = imread_double(imfile,bits)
im = imread(imfile);
im = double(im)./((2^bits) - 1); |
function [A] = genpd(n)
%generate nXn positive definite matrix
temp = gensys(n);
[v, d] = eigs(-temp);
min_eigvalue = max(diag(d));
if min_eigvalue < 0
A = temp;
else
A = temp + (min_eigvalue + 0.5)*eye(size(temp));
end
|
function time = getInsertionTime(obj)
% GETINSERTIONTIME Gets the time that the message was inserted
% The time is returned as a datetime.
% Copyright 2019 The MathWorks, Inc.
timeJ = obj.Handle.getInsertionTime();
time = datetime(timeJ.getTime()/1000,'convertfrom','posixtime','TimeZone','UTC');
end
|
%
% Prof. Zeferino Parada
% Optimización Númerica
%
% Omar Trejo Navarro, 119711
% Juan Pedro Luengas Garcia, 119493
% Natalia Orozco Urquijo, 111008
%
% ITAM, 2015
%
% Input:
% x: vector en R^3*np
% fx: escalar
%
function fx = esfera(x)
n = length(x);
np = floor(n/3);
x = x(1:3*np);
fx = 0;
for ... |
function DiffSolver
syms x y
e = 0.001
a = 0.5
m = 2
lb = 0
ub = 1
h = 0.1
h2 = h/2
y1 = a*(1-y^2)/((1+m)*x*x+y*y+1)
%%%%% Euler Method
e1 = EulerMethod(y1,lb,ub,h)
e2 = EulerMethod(y1,lb,ub,h2)
%%%%%
%%%%% RungeMethod
r1 = RungeMethod(y1,lb,ub,h)
r2 = RungeMethod(y1,lb,ub,h2)
%%%%%
%%%%% AdamsMethod
a1 = AdamsM... |
function omega = objective(x)
rho = 997;
I = (1/12)*0.85*0.5*0.5;
omega(1) = 0;
t(1) = 0;
alpha(1) = 0;
f_total(1) = 0;
j=1;
Kn = 1;
while sum(omega)==0 || round(omega(j),5) ~= round(omega(j-1),5)
total = 0;
for i = 1:x(2)
force = Kn*(rho*pi/(2*x(2)))... |
function [ Params ] = Config()
% This function performs parameter configuration
% Author : Zhibin Zhao
% Place : Xi'an Jiaotong University
% Email : zhibinzhao1993@gmail.com
% Date : 2018.6
%% Set the random seed to make sure the reproducibility
Params.random_seed = 25; % The random state
%% Parameters o... |
classdef (InferiorClasses = {?matlab.graphics.axis.Axes}) MPlot < handle
properties
size = [1000 700]
fontsize = 12
limy = 1e-4
title = ''
legend = {}
axNV = {}
lineNV = {}
ev = false
vSpace = 0
borderFactor = 0
... |
function [outvec] = vecize(inMat)
% "vectorizes" the matrix Mat by by placing the columns tip to tail
m = length(inMat(:,1));
n = length(inMat(1,:));
for i = 1:n
k = (i-1)*m+1;
outvec(k:k+m-1) = inMat(:,i);
end |
%%
[PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, VA, ...
BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
[F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = id... |
% y = [x y u v]', b vektor ober av y
% D_t x = u; D_t y = v -- Tidsderivatorna
%% a) Skriv upp systemet av differentialekvationer
% y' = Ay + b, d�r
A = [0 0 1 0
0 0 0 1
0 0 0 1
0 0 -1 0];
b = [0 0 1 0]';
%% b) L�s problem 1 med ode45 och rita graf
[t, y] = ode45(@(t, y) odefun(t, y, A, b), [0 2], [1 0... |
function selectAnimal(pb,src,event)
a = getListSelected(src);
w = fetch(common.MpSlice(['animal_id=' a]));
set(pb.sliceList, 'val',0,'string','');
set(pb.sessList, 'val',0,'string','');
pb.key.animal_id = str2num(a);
pb.key.mp_slice = [];
pb.key.mp_sess = [];
if ~isempty(w)
set(pb.sliceList, 'val',1,'string',[w.... |
function mm = mono(music0)
mm = (music0(:,1) + music0(:,2))/2; |
function [bestscore, bgamma, bC] = svmclassify_local(data, class, indcs)
best = 0;
result = zeros(size(class, 1), 1);
for gamma = -15:1:3
for C = -5:1:15
for i=1:10
i
test = indcs == i;
model = svmtrain(class(~test, :), data(~test, :), strcat('-g', 32, num2s... |
function [ TimeStamp ] = GetTimeStamp( TemplateDirectory )
TemplateLocation = regexp(TemplateDirectory, '[^\\]*(.dat)', 'split');
TemplateLocation = TemplateLocation{1};
templateName = '\Time_template.inc';
FileToRead = fileread(strcat(TemplateLocation,templateName));
expr = '*DATE';
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.