text stringlengths 8 6.12M |
|---|
function [V,D] = scf_eigen(H, S)
H_prime = (S^(-1/2))' * H * S^(-1/2);
[V_prime, D] = eig(H_prime, 'vector');
[D, ind] = sort(D);
V_prime = V_prime(:, ind);
V = (S^(-1/2)) * V_prime;
end |
function [R1,R2,R3,R4,R5,R6,tmp_gg_t,tmp_ee_t] = rp_cont_HEOM2(sz_params,...
rho_eg,V_ge_t,V_ef_t,prop_op_gg,prop_op_ee,t2_range,e1,e2,...
calc_rp,calc_nr,av1_g,av1_f,av2_g,av2_f,H_trunc,tol) ;
%Calculated the re/nonrephasing contribution to a 2D signal given the coherence
%part of the densi... |
function q = pnCharge2(Uj, Cj, Vj, Mj)
% This function computes the pn-junction depletion charge with no
% linearization factor given.
if (Uj <= 0)
q = Cj * Vj / (1 - Mj) * (1 - exp ((1 - Mj) * log (1 - Uj / Vj)));
else
q = Cj * Uj * (1 + Mj * Uj / 2 / Vj);
end
end |
%% Function that returns disparity Disparity Maps
% Output : DispMap (Disparity without sub pixel estimation)
% DispMap1 (Disparity with sub pixel estimation)
% DispMap_norm ( Disparity normalized to 0-255).
% Input: left : left image
% right : right image
% BlockSize : Size ... |
function core=stampVsource(core, m, I, j, jb)
if(j~=0),
core.Y(m,j) = core.Y(m,j)+1;
core.Y(j,I) = core.Y(j,I)+1;
end
if(jb~=0),
core.Y(m,jb) = core.Y(m,jb)-1;
core.Y(jb,I) = core.Y(jb,I)-1;
end
end
|
function [y,isterm,dir ] = option_fun_ish_both_on(t,x)
% event function for isham model occurs if both mean and variance exceed
% set value - event is shown by change in y value from y=-1 to y=1.
%set global variables
global phi alpha mu_M p r u1 tu MT VT T_start
dx_m=@(t,x)isham(t,x);
x
% if treatment has not... |
clc;
DP = full(DP);
ent = 0;
for i = 1:size(DP,1)
dr = sum(DP(i,:));
if dr ~= 0
DP(i,:) = DP(i,:)/dr;
temp = DP(i,DP(i,:) > 0);
ent = ent + sum(temp .* log(temp));
end
end
fprintf('entropy of topic distribution: %f \n', (-1 * ent)/200);
WP = full(WP);
WP = [WP;ze... |
% 一个基于matlab的改进的灰度图像分水岭分割算法,该算法改进了普通的分水岭算法的
% 过分割等问题,经过一系列处理可是分割结果更加准确。
close all; clear all;clc;
%% 读取原图像
% load ('CjwData\CjwData.mat');
% for imN=6;
% switch imN
% case 7
% Img1=CjwData(1:340,:,imN);
% case 8
% Img1=CjwData(1:340,:,imN);
% case 10
% I... |
%Tyler Matthews
%System Simulation Problem 9
clc; %clear console and close figures
num = [5.269 3.076 -0.731];
den = [1 6.81 -9 1.193];
integrator_zeros = roots(num)
integrator_poles = roots(den)
%derviative of den/num = newNum/newDen
newNum = [5.267 6.15 66.138 -22.517 2.91]
newDen = [27.742 32.39 1.755 -4.49 0.53... |
%% MCMC Sampling from a multivariate Gaussian conditioned on data
% We use a N(0, sigma*eye(2)) proposal and see the effect of changing sigma
% We also compare to Gibbs sampling
% This code calls mcmc sampling directly, not via inference engines.
% See mcmcMvn2dConditioning for the simpler infengine version.
set... |
%%%%%%%%%%%%%% Manipulate data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Part 1 : Create matrix/ vector
a = [1 2 3; 4 5 6;7 8 9];
b = rand(3); % create random number of uniform distribution from 0 to 1
c = zeros(3); %create a matrix of 3 by 3 of zero number
v = [1:10]; % create a vector with the number from 1 to 10
... |
function single_item_ROI_compute_mat_files()
%type that before running: addpath(genpath('/Volumes/data/Bein/Software/spm12'));
%+---------------------------------------
%|
%| Robert C. Welsh
%| 2002.10.20
%|
%| University of Michigan
%| Department of Radiology
%|
%| A little toolbox to apply a mask to
%| a ... |
function [ geandert ] = skalierung_stromzange( ids )
%SKALIERUNG_STROMZANGE Skalierung der Stromzange ggf anpassen
global instruments
% Spannungabschwächung des Transformators/Spannungsteilers (1 wenn keiner dran ist)
%instruments.transformer=10; Wird jetzt über GUI eingestellt
% Mögliche "... |
%
% uitable_OCT(varargin)
%
% Fonction pour palier au manque par rapport à Matlab --> uitable()
%
% En entrée on devra avoir des "paires" {propriété,valeur}, ex. 'tag','ma_UItable'
%
% On va donc se servir d'un uipanel comme "cadre" et les cellules de la uitable
% seront des "uicontrol('style','text' ou 'edit')
%
% Dan... |
function num = mydatedoyi (doy, year)
myassert(length(year)==length(doy) || isscalar(year))
%% define the epoch corresponding to the beginning to that year:
vec0 = zeros(max(length(year),length(doy)), 3);
vec0(:,1) = year;
num0 = mydatenum(vec0);
%%
num = num0 + doy .* (3600 * 24)... |
function [h,ax,BigAx,patches,pax] = plotmatrix_spaced(varargin)
%PLOTMATRIX Scatter plot matrix.
% PLOTMATRIX(X,Y) scatter plots the columns of X against the columns
% of Y. If X is P-by-M and Y is P-by-N, PLOTMATRIX will produce a
% N-by-M matrix of axes. PLOTMATRIX(Y) is the same as PLOTMATRIX(Y,Y)
% except ... |
% Mode transport
% 19 mai 2006
% Written by Laurent S. Nadolski
global THERING
BPMindex = family2atindex('BPMx');
spos = getspos('BPMx');
X00 = [0 0 0 0 0 0]';
X01 = linepass(THERING, X00(:,end), 1:length(THERING)+1);
h1 = subplot(5,1,[1 2]);
plot(spos,X01(1,BPMindex)*1e3,'.-');
ylabel('X (mm)')
h2 = subplot(5,1,[4... |
clc;
clear all;
close all;
num_bit=10000;%number of bit
data=randi([0,1],1,num_bit);%random bit generation (1 or 0)
SNRdB=0:10; % SNR in dB
SNR=10.^(SNRdB/10);
for(k=1:length(SNRdB))%BER (error/bit) calculation for different SNR%
y=awgn(complex(data),SNRdB(k));
error=0;
R=0;
M=[];
for(c=1:1:num_bit)
if (y(... |
function snr = output_snr(system_temperature, bandwidth, noise_factor, losses, peak_power, antenna_gain, frequency, target_rcs, target_range)
%% Calculate the signal to noise ratio at the output of the receiver.
% :param system_temperature: The system temperature (K).
% :param bandwidth: The operating bandwidth... |
function [WavePolyFitCoeff,wavelength]=CalibrateWavelengthLine(x,KnownLines,PeakLocations)
if length(PeakLocations)<3
Order=1;
else
Order=2;
end
WavePolyFitCoeff=polyfit(PeakLocations,KnownLines,Order);
wavelength=polyval(WavePolyFitCoeff,x);
end
|
function res = f_symb(n)
% - utility program for selecting plot symbols
%
% USAGE res = f_symb(n)
%
% n = interger value selecting
% res = symbol specifying linespec for plots
%
% SEE ALSO: f_rgb, f_style
% -----Author:-----
% by David L. Jones, Apr-2002
%
% This file is part of the FATHOM Toolbox for Matlab and
% i... |
function obj = successorXML(obj,successor)
%successorXML Parsing the XML to the corresponding classes and properties
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernández
% All rights res... |
function makeUserStudySlides
%makeUserStudySlides creates figures for userStudy.tex
% setup
rootDir = fileparts(fileparts(fileparts(mfilename('fullpath'))));
run(fullfile(rootDir, 'setup.m'));
datasetDir = fullfile(rootDir, 'data' );
imageDir = fullfile(datasetDir, 'images' );
groundTruthDir = fullfile(datasetDir, 'im... |
clear all;
close all;
% w0=0.05*pi;
% N=10^4;
% phi=rand*2*pi;
% Nrea=10;
% D_mat=[];
%
% % traçage de MOY_th et Puiss_th ainsi que la moyenne statistique et la puissance calculée
% for i=1:Nrea
% for n=1:N
% phi=rand*2*pi;
% x(n)=sin(n*w0+phi);
% end
% D_mat=[D_mat;x];
% end
% for i=1:N
% ... |
function [statlist, docinfo] = doxyread(filename)
%DOXYREAD Read a 'search.idx' file generated by DOXYGEN
% STATLIST = DOXYREAD(FILENAME) reads FILENAME (Doxygen search.idx
% format) and returns the list of keywords STATLIST as a cell array.
% [STATLIST, DOCINFO] = DOXYREAD(FILENAME) also returns a cell array
% con... |
%% COMPARE GASTRULATION
clear all
%Path = '/Users/julia/Google Drive jf565/comp MS2/OnOff/';
MetaFile = '';
MetaFile = ' enhprom';
%MetaFile = ' ecNICD';
MetaFile = ' mutBG';
%MetaFile = ' margherita';
%MetaFile = ' all';
%MetaFile = ' 2c';
%MetaFile = ' other';
PathF = ['/Users/julia/Google Drive jf565/comp gast/... |
function lsim_plot(slope_dist,alphas_dist)
% LSIM_PLOT(SLOPE_DIST,ALPHAS_DIST,TYPES) - Plot output of
% bootstrap_linear_slectivity_increasem_model.m
%
% INPUTS:
% slopes_dist -
% alphas_dist -
% types -
%
%
% NOTES:
%
%
figure();
for i = 1:3,
subplot(3,1,i);
hold on;
histogra... |
% Copyright [2021] [Adam Berrington]
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by appli... |
function ret=bisect(f,a,b)
%function to solve f(x)=0 on interval [a,b]
fa=f(a); fb=f(b);
if (fa>0 && fb>0) || (fa<0 && fb<0)
error('Function must change sign in interval')
end
n=0;
e=(b-a)/2;
while e>1e-10
m=(a+b)/2; e=e/2; fm=f(m);
if f(m)==0
a=m; b=m; e=0;
elseif (fb>0 && fm<0) || (fb<0 && f... |
function [ E_1,E_2,E_3 ] = compute_err( w, sample_num, Y, L_1, L_2, L_3, x_1, x_2, x_3, s_1, s_2, s_3 )
E_1 = [];
E_2 = [];
E_3 = [];
for i=1:sample_num
E_1 =[E_1; (1/s_1)*w(i,1)*(Y(:,i)-L_1*x_1(:,i))'*(Y(:,i)-L_1*x_1(:,i))];
E_2 =[E_2; (1/s_2)*w(sample_num+i,1)*(Y(:,i)-L_2*x_2(:,i))'*(Y(:,i)-L_2*x_2(:,i))];... |
function [pp] = noise(p,t)
pr=p+randn(size(p));
p_hat=fft(pr);
pp=2/length(p)*ifft(conj(p_hat).*p_hat);
plot(t, [pp; p]);
end
|
function [Num, img_fig] = contar_figuras(img)
% Función que devuelve el nº de figuras que contiene una carta
% Rellenamos los agujeros e invertimos para quedarnos sólo con el fondo
fondo = imfill(img,'holes');
fondo = 1 - fondo;
% Sumamos el fondo a la imagen original e invertimos para extraer... |
function [meanValue] = get_training_mean(data, Tr, Td, Gr, Gd)
%GET_TRAINING_MEAN Returns the mean value over all training cells
%
% Arguments:
% data: matrix of size (2*Tr + 2*Gr+1)x(2*Td + 2*Gd+1) from which we want to extract the mean from the training cells.
% Tr: number of training cells (on each side) in the ran... |
function M = imgCl2Key(M0)
% Convert image-based label to video-based label.
%
% Input
% hr - segmentation input handle
% parSeg - segmentation parameter
%
% Output
% Ls - segment label, h x w x nF
% mSeg - #segments
%
% History
% create - Feng Zhou (zhfe99@gmail.com), 05-23-2013
% modif... |
function [xVec,fxy,gradF,H,eaVec,numIter]= myModSecOptim2D_ggrable(myfunc,x0Vec,es,maxIter)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function file: myModSecOptim2D_username.m
%
%Purpose:
% To determine the optimum value of function f(x,y) associated with myfunc
% using Modified... |
%
% Image segmentation detector
%
classdef SegmentObjectDetector < ObjectDetector
%SEGMENTOBJECTDETECTOR Summary of this class goes here
% Detailed explanation goes here
properties
greycthredshold;
eccentricity;
controller;
foundObject;
fixedA... |
%
load actif_fullstrayfield.mat;
%stray5 % effet stray actif initiale, sans blindage
% filtre
a = 1;
n = 100; % nombre de point pour moyenne
b = ones(n,1)/n;
bunch=0;
fprintf('************************* \n')
for i=1:1
%tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent');
pause(1)
temp... |
addpath(genpath(pwd));
Ddir='./data/';
fname={'NLDRPuncturedSphere','NLDRSineHyperboloid',...
'NLDRSwissRollwHole','NLDRTwinPeakwHole',...
'usps','Hasy2','BciHaLT_A','LegoBricks'};
for i=1:length(fname)
tmp=cell2mat(fname(i));
if ~exist([tmp '.mat'],'file')
disp(['Downloading ' tmp '.mat']);
... |
function [model] = M3D_load_model1_Iter1()
model.input_model_type='charmodelC';
model.n_st=4;
model.n_par=9;
model.n_stimulus=1;model.st_names=char('Cit_mrna','Cit_foldedP','Cit_fluo','Cit_AU');
model.par_names=char('alpha1','Vm1','h1','Km1','d1','alpha2','d2','Kf','sc_molec');
model.stimulus_names=char('IPTG')... |
function gui_clearvars()
%
% function gui_clearvars()
% Used by GUI_CALLBACK
%
% Clears global variables
clear global hf_MAIN;
% Handles to other controls in this main window
clear global ht_loadStatus;
clear global ht_weightsStatus
clear global ht_channelsStatus;
clear global ht_samplesStatus;
clear glo... |
function histograma( video_fullname)
disp('--- Siga começar Histograma ---');
video=VideoReader(video_fullname);
%Create new scenes video
outputVideo = VideoWriter('scenes_histogram.mp4','MPEG-4');
outputVideo.FrameRate = 3;
open(outputVideo);
%Create number of frame file
fid = fopen( 'scenes_histogram.txt', 'wt... |
% Rerturns ratio of incorrect classification in a linear classifier
function r=verifyVector(X, y, w)
n = 0;
[l, N] = size(y);
for i=1:N
if w'*X(:,i)*y(i) < 0
n = n+1;
end
end
r = n/N;
end
|
% Add fieldtrip and its subfolders to the path
addpath /home/mdynamics/Documents/Matlab_offcampus/fieldtrip
ft_defaults;
%% For each new participant:
%%% CHANGE EVERYTIME %%%
parnum = 5; % Choose ind. all the KRLearn files by changing number
partfolder = 5; % Choose the comp-eeg-master participant number
%%% CHANGE E... |
function [] = saved_plot_fig1(save_name,Nk)
% Creates a plot as the one reported in Figure 1
% save_name = name of the mat file containing the results from main;
% Nk = pick one of the signal resolutions reported in the saved data
% Load saved data
load(save_name,'Gen_U','Gen_S','Gen_U_par','Gen_S_par','mm','... |
function SANS = calcSANSIBLResult(SANS, Xfoil_a, Xfoil_w, param, nelem, domainName)
SANS.UeVinf = zeros(size(SANS.x));
switch domainName
case 'airfoilANDwake'
SANS.UeVinf(1:2:2*nelem-1) = Xfoil_a.UeVinf(1:end-1);
SANS.UeVinf(2:2:2*nelem) = Xfoil_a.UeVinf(2:end);
[row,~] = find(~isn... |
function [ DF,DF_epsilon] = DFHN_beta(epsilon, beta, u)
% function [ DF, DF_epsilon] = DFHN_beta(epsilon, beta, u)
%
% INPUT
% beta scalar, fixed parameter
% epsilon scalar
% u Fourier_2D
%
% OR
% INPUT
% beta scalar, fixed parameter
% xi Xi_vector
%
% OUTPUT
% DF ... |
function [] = savePDFfunction(fid, filename)
f1 = fid;
set(f1,'PaperOrientation','landscape');
set(f1,'PaperUnits','normalized');
set(f1,'PaperPosition', [0 0 1 1]);
print(f1,filename,'-dpdf','-r0')
|
%Dfuzzy x,y,image no,class,class no
clearvars;
Dfuzzy=zeros(0,0,0,0,0);
load('finalTestcase.mat');
for i=1:23
src=D(:,:,i);
i
%#### algorithm ####
check=0;
c=sum(sum(src>0));
k=3;
while k<=20
[L,C,U,LUT,H]=FastFCMeans(uint16(src*(2^16-1)),k);
Umap=FM2map(uint16(src*(2^16-1))... |
function cppro = burner(T2,T3,alpha)
gam=0.5;
yvap=2-gam;
ycarp=1-gam;
yn2p=(3.76*alpha)/4.76;
yo2p=(alpha/4.76+(3*gam)/2-2);
ytot=yvap+ycarp+yn2p+yo2p;
%T3=2000; %Guess
Tavg=(T2+T3)/2;
%to find cp of nitrogen
anit=28.9;
bnit=-0.1571*10^-2;
cnit=0.8081*10^-5;
dnit=-2.873*10^-9;
%to find cp of oxyg... |
function varargout = Main(varargin)
% MAIN MATLAB code for Main.fig
% MAIN, by itself, creates a new MAIN or raises the existing
% singleton*.
%
% H = MAIN returns the handle to a new MAIN or the handle to
% the existing singleton*.
%
% MAIN('CALLBACK',hObject,eventData,handles,...) cal... |
StoreVariables;
ReferenceModel; % Makes sure Reference Region is defined
% Inhibit model image (which is triggered by existence of functionHandle)
keepFunctionHandle = imlook4d_current_handles.model.functionHandle;
imlook4d_current_handles.model.functionHandle = [];
guidata( imlook4d_current_handle, imlook4d_current_... |
%% Written by Armeen Taeb, California Institute of Technology, Oct 2018
%% This is a code generates quantities for Figure 5b in the linear measurement setting
%% In particular, `vanilla_FD' number of false discoveries
%% for top 10 ranks with the no-subsampling procedure and `WS_top_projection'
%% finds the number of f... |
function h=sigmoid(a)
h=1./(1+exp(-a));
|
% script to load all files and calculate size and abundance distributions
% TODO: load using matfiles? Save longitude as field
% NOTE: min size is commented out
% Note: runs fixWaterDistribuion automatically afterwards
%% params
clear
addpath D:\Dropbox\Matlab\DownloadedCode\MinBoundSphere&Circle\MinBoundSphere... |
function drawBox3D(h,object,corners,face_idx,orientation)
% set styles for occlusion and truncation
occ_col = {'g','y','r','w'};
trun_style = {'-','--'};
trc = double(object.truncation>0.1)+1;
% draw projected 3D bounding boxes
if ~isempty(corners)
for f=1:4
line([corners(1,face_idx(... |
function [labels peaks] = segmentImage (image, params)
x_size = size(image,1);
y_size = size(image,2);
d = 3; % size(data,2);
data = zeros(x_size*y_size, d); %floor(x_size/10), floor(y_size/10));
labels = zeros(x_size,y_size);
% Prepare the spectral datapoints
index = 1;
for i=1:x_size ... |
function [yhat, beta, ehat, rsqr] = regress_hamid(X, Y)
model = 'logistic_hamid';
temp = corrcoef(X,Y);
if (temp(1,2)>0)
beta0(3) = mean(X);
beta0(1) = abs(max(Y) - min(Y));
beta0(4)= mean(Y);
beta0(2) = 1/std(X);
beta0(5)=1;
else
beta0(3) = mean(X);
beta0(1) = - abs(max(Y) - min(Y));
... |
function [ zwracam ] = fibonacci( n )
%FIBONACCI Podaje pierwsze n wyrazow ciagu Fibonacciego
% dla zadanego n ? N zwraca pierwsze n wyrazów ci?gu
% Fibbonaciego. Funkcja u?ywa funkcji fib1 oraz fib2, a u?ytkownik
% ma kontrol?, która z funkcji ma by? u?ywana
prompt = 'Ktora funkcje uzyc? \n 1 - ... |
% close all
image_number = 190;
path1 = 'C:\Users\Berk\Desktop\images\'; % input folder
path3 = 'C:\Users\Berk\Desktop\images\'; % output folder
ii = image_number;
if length(num2str(ii)) == 2
name1 = ['B00' num2str(ii) '.bmp'];
name2 = ['B00' num2str(ii) '_cropped.bmp'];
elseif length(num2str(... |
clear all, close all, clc
addpath('../utils/');
load VORTSNAPSHOTS.mat
p = 1000;
X = VORTALL;
X2 = [VORTALL(:,2:end) VORTEXTRA];
[U,S,V] = svd(X,'econ');
% projType = 1; % uniform random projection
projType = 2; % Gaussian random projection
% projType = 3; % Single pixel measurement
C = zeros(p,m*n);
Theta = zeros(p,... |
%Reads in the Data and the class labeles and aligns them with the Data pts.
data = [features(:,1),features(:,2),classlabels];
%selects the instances of the two classes.
class1 = classlabels(:) ~= 2;
class2 = classlabels(:) ~= 1;
%8000x2 matrix that contains the data points for class 1 and 2 respective.
%The matrices ... |
function [ steps, walk, walkSeg ] = stepsNoZeroCross( ap, turns )
%Method for calculating steps when the zero crossing method causes errors
ln = length(ap);
minStep = 40;
steps = [];
for jj=minStep+1:ln-minStep
a=ap(jj-minStep:jj+minStep);
if ap(jj) == max(a)
steps = [steps jj];
end
end
nTurns = si... |
%--------------------------------------------------------------------------
%---------------------- Validation of the result -------------------------
%--------------------------------------------------------------------------
% With this function you can re-estimated the CCR for the optimal Feature
% Subset found by... |
h=pi/4;
x=0:h:pi/2;
y=4*cos(x).^3.*sin(x);
yf=h*trapz(y) |
function [ cost_map ] = waveCostMap(map,start_pos,end_pos)
cost_map = zeros(size(map));
end
|
[y1 y3]=shiftmul1(20,40) |
function [H] = entropia(contagem)
%limite mínimo teórico para o número médio de bits por símbolo
H = 0;
%Fórmula da Entropia:
%H = somatorio * (probabilidade(ai)*log2(1/prob(ai)) )
% = - somatorio * (probabilidade(ai)*log2(prob(ai))
total=sum(contagem);
probabilidade= contagem/total;
proba... |
classdef parameter_2018_08_11
%PARAMETER_2018_08_11 Summary of this class goes here
% Additional parameters for the data of the night 2020 August 5th
% Path: location (folder) of the data
% Heater: data of the heating during that night [start; end]
% Heater_int: intervall, in ... |
function [metric, output_log] = train_xing(images, labels, parms)
%
%
%
[xing_maxiter,parms] = take_from_struct(parms,'xing_maxiter', 100);
[xing_D_density,parms] = take_from_struct(parms,'xing_D_density', 0.15);
[xing_threshold2,parms] = take_from_struct(parms,'xing_threshold2', 0.0000001);
[xing_do_forc... |
function [fgSeedIxs bgSeedIxs matchingCost matchingCostMatrix] = ...
matchToPatternDescFile( patternDescFile, patternSeedPtsNo, ...
spinImgs, selIxs, options)
%Dopasowuje deskryptory analizowanego obrazu do deskryptorów wzorca.
%
%Parametry:
% patternDescFile - plik zawierający deskryptor... |
% -*- matlab -*-
% val is data or stats.
function class = bkm_mkclass(val,xi,p1,p2,p3,p4);
global bkm_mkclass_last_id;
if isempty(bkm_mkclass_last_id)
bkm_mkclass_last_id = 0;
end
mu0 = p1;
eta0 = p2;
B0 = p3;
phi0 = p4;
D = length(mu0);
class.updated = 1;
% global mkkdtree_last_id
% class.h(1:mkkdtree_last_id)... |
function[d] = literacydata(year)
d = xlsread('~/Documents/Topological_Crime_Analysis/Literacy/testing.xls');
if year == 2011
d = d(1:end,2);
else
if year == 2001
d = d(1:end,1);
end
end
end |
clc
clear
close all
randn('seed',2020);rand('seed',2020)
D = 9;
K = 3;
parms = rand_parms_spec();
parms.D = D;
parms.K = K;
parms.alpha = 1;
parms.r = 0.3;
t_dpcp = 0;
t_pca = 0;
t_cop = 0;
T = 100;
maxiter = 100;
for num_datasets = 1:T
num_datasets
info = info_compute(parms);
init = normc(randn(D, ... |
function Wt=WeightKernel(frames,Qn,iter)
% iter is to start the iterations from the iter of new frame and used in allocating the point xl
[m,n,~] = size(frames);
Wt=[];
h=1.6;
st=(Qn+1)/2;
st
w=(st-1)+iter; % w = st,st+4,st+8.....;
w
for i=st:4:m-(Qn+st)+1
for j=st:4:n-(Qn+st)+1
i
... |
% function H = IMG05_ButterworthMask(N,M,Do,n)
%
% Construccion de mascara H en el dominio de la frecuencia para un filtro
% Butterworth.
%
% El tamano de la matriz H es NxM
% NxM debe ser del tamano de la imagen.
% La frecuencia de corte es Do.
% El ordel del filtro Butterworh es n.
%
% D.Mery, DCC-PUC, Octubre 2018
... |
clear all, close all, clc
iR = cell(4); rR = cell(4);
for i = 1 : 4
iR{i} = im2double(rgb2gray(imread(strcat('i', int2str(i), '.tif'))));
rR{i} = im2double(rgb2gray(imread(strcat('r', int2str(i), '.tif'))));
end
[f c] = size(iR{1});
% Grafica perfil
figure(1);
subplot(221); plot(iR{1}(round(f / 2), :), 'b')... |
function ui_run_sim
sim_options = ui_read_options;
feval('runsim', sim_options);
|
function show_figure(figure_name)
figure_scale = 0.7;
switch figure_name
case 'plot_gp_CV_EMPA_theory'
% plot_gp_CV.m
load(fullfile(get_mat_dir(), 'agg_gp_CV_us=1_glm=1_model=EMPA_theory_nsamples=100_project=1_fast=1.mat')); %
assert(use_smooth);
EXP... |
data = ones(100, 100, 3);
data = imnoise(data, 'gaussian', 0, 0.3);
imwrite(data, 'input_gaussian_zeros_0_0-1.jpeg');
hdrwrite(data, 'input_gaussian_ones_0_0-3.hdr'); |
%% import map
rawData1 = importdata('or1.pgm');
[~,name] = fileparts('or1.pgm');
newData1.(genvarname(name)) = rawData1;
vars = fieldnames(newData1);
for i = 1:length(vars)
assignin('base', vars{i}, newData1.(vars{i}));
end
%% map parameters from yaml
map_raw = or1;
threashold = 205;
obsticle_vector... |
% imgdata = DumpFrames(myobj, frameNumber, count)
% imgdata = DumpFrames(myobj, frameNumber, count, cropRect, downsample_pix)
% Retrieve count frames starting at 'frameNumber' from the currently
% running plugin. The returned matrix is a matrix of
% unsigned chars wit... |
function [forwBackVel, leftRightVel, rotVel, finish] = solution0b(pts, contacts, position, orientation)
% The control loop callback function - the example solution for task 0B
% declare the persistent variable that keeps the state of the Finite
% State Machine (FSM)
persistent state;
if isempty(state),... |
function [estimator,variance,conf_interval] = monte_carlo(rv_generator, n, alpha, T, niveau)
% n, alpha: sampling parameters
% niveau: niveau for confidence_interval
% rv_generator: function which generates 1-dim random variables
% :return: monte carlo estimator, estimated variance and confidence
% ... |
function [w, obj, wset] = train_linear_primal_sg(features,costs, lambda, surrogate_loss, w0)
%TRAIN_LINEAR_SCORER
%
% weights = TRAIN_LINEAR_SCORER(features,costs,lambda)
%
% features - Cell array of length N. features{i} is [L,d]
% costs - Array of size [N,L]
% lambda - Regularization constant.
%
% weights - ... |
function plot_selection(~,~,hvar,filenames)
selec=get(hvar,'value');
varnames=get(hvar,'String');
AppendixPlot(filenames,varnames(selec));
|
function ind = SWUCB(reward, pulls, tt, T, gamma)
win_size = round(2*sqrt((T*log(T))/gamma));
xi = 0.5;
if tt > win_size
N = sum(pulls((tt-win_size+1):tt,:));
cum_r = sum(reward((tt-win_size+1):tt,:));
B = sqrt(xi * log(win_size) ./ N);
else
N = sum(pulls);
cum_r = sum(reward);
B = sqrt(xi * l... |
function y = measure( u )
%MEASURE
pos = u(1:3);
L1 = u(4:5);
L2 = u(6:7);
r1 = hypot(pos(1)-L1(1), pos(2)-L1(2));
r2 = hypot(pos(1)-L2(1), pos(2)-L2(2));
b1 = atan2(L1(2)-pos(2), L1(1)-pos(1)) - pos(3);
b2 = atan2(L2(2)-pos(2), L2(1)-pos(1)) - pos(3);
y = [r1; r2; b1; b2];
end
|
%finds the specified 3 files to be joined together to form a 45 min file and used as a function
% This is one of the test functions used to make the final findfile program
function [infile1,infile2,infile3,erf] = findfilex(matlabday,xcen)
erf = 0;
shpcen15 = ((xcen*5)-900)/86400;
times = datevec(matlabday - shpcen1... |
% Set Up Once
testCase = matlab.unittest.FunctionTestCase.fromFunction(@(x)x);
%{
Model>>>>>
!variables
a, b, c, d
!equations
a = 0;
b = 0;
c = 0;
d = 0;
!log-variables
!all-but a
% Legacy keywords
!log_variables
!all_but b
<<<<<Model
%}
fileName = 'allbutTest.model';
parser.grabTextFrom... |
function [modeshape,k_term] = ObliqueMode(n1,n2,n3,l1,l2,l3,rA,rB,rC,r0A,r0B,r0C,k)
%--------------------------------------------------------------
% Compute the Oblique Mode in a room.
% Syntax: [modeshape,k_term] =
% ObliqueMode(n1,n2,n3,l1,l2,l3,rA,rB,rC,r0A,r0B,r0C,k)
%--------------------------------... |
function constraint = atlinconstraint(refpts,params,vmin,vmax,weight)
%ATLINCONSTRAINT Generate a constraint on linear optics for atmatch
%
%CONSTRAINT=ATLINCONSTRAINT(REFPTS,PARAMS,VMIN,VMAX,WEIGHT)
%
%REFPTS Row vector of selected positions
%PARAMS Cell array describing the desired value at each position
% The ... |
clear all
p.physics = 'twoDimensionalTurbulence_slow';
p.dt = 1e-1;
p.Lx = 2*pi;
p.nu = 1e-4;
p.nuN = 2;
p.dnPrint = 0;
p.dnPlot = p.dnPrint;
p.dnSave = 0;
p.timeStepper = 'RK4';
p.nSteps = 2e2;
p.homeDir = pwd;
p.mat2PeriodicDir = [pwd... |
function [base10] = base_8_to_10(base8)
% Variables
base8 = num2str(base8); %Convert base8 number to string
base10 = 0; %placeholder
counter_l = 0; %counter for left
counter_r = 0; %counter for right
% Finding number of digits to the left of decimal point
for ii = 1:length(base8) %go over each character
... |
function [magnitude] = extract_magnitude(data)
magnitude = zeros(size(data,1),1);
for item = 1:1:size(data,1) %Time steps
sum = 0;
for vector = 1:1:size(data,2)
sqr = data(item,vector)^2;
sum = sum + sqr; %a*a+b*b+c*c
end
magnitude(item) = sqrt(sum);
end
return;
end |
classdef LaplaceDistribution < prob.ToolboxFittableParametricDistribution
% This is a sample implementation of the Laplace distribution. You can use
% this template as a model to implement your own distribution. Create a
% directory called '+prob' somewhere on your path, and save this file in
% that directory using... |
% assuming each folder has generated the matrices which contains the
% feature vectors. This file writes the knn friendly matrices
% writes all the feature matrices in one place and creates the labels file
image_folders = 'scene_categories';
%variables
number_of_kernels = 48;
number_of_windows = 4;
nw2 = number_of_wi... |
function [mBestImage, mBestMembership, bestObjVal, cvObjVal, cvKKTResidual, ccvGroundComparison, ccmImage, ccmMembership, totalIterNum] =...
binaryMembershipMatFactMult(mAdj, k, runNum, sUpdateFunc, sDistanceFunc,...
sUpdateMembershipFunc, sImageInit, sMemInit, cfValidMeasFunc, bDiscretiseMembership, bColNo... |
clear; clc;
%% htk configuration
n_all_mix = 200;
separate_dir = ['mix' num2str(n_all_mix)];
svhn_vars_mix;
hmm_dir = fullfile(vars.hmm_dir, 'flat'); % start with flat hmms
%% decoding
hmm_defs_path = fullfile(hmm_dir, vars.hmm_defs);
floor_path = fullfile(hmm_dir, vars.hmm_vfloors);
cmd_d... |
% clc;
clear;
close all;
N = 128;
% Problem constants of Newton's Law of Cooling
[k, TempAmb, Temp0, tStart, tMax] = ProblemConstants;
% Problem's analytical solution
[TempExact, TempAsymp] = AnalyticalSol(k, TempAmb, Temp0);
% Problem's numerical solution using sentral difference schema
[timeDisc, T... |
function varargout = gaspriceplotter(varargin)
% GASPRICEPLOTTER M-file for gaspriceplotter.fig
% GASPRICEPLOTTER, by itself, creates a new GASPRICEPLOTTER or raises the existing
% singleton*.
%
% H = GASPRICEPLOTTER returns the handle to a new GASPRICEPLOTTER or the handle to
% the existing singlet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.