text stringlengths 8 6.12M |
|---|
function y1=threeanurbes(a0,a1,da0,da1,dda0,dda1,k)
J=[1,0,0,0,0,0;0,0,1,0,0,0;0,0,0,0,1/2,0;-10/k^3,10/k^3, -6/k^2, -4/k^2,-3/(2*k),1/(2*k);15/k^4, -15/k^4,8/k^3,7/k^3,3/(2*k^2),-1/k^2;-6/k^5,6/k^5,-3/k^4,-3/k^4,-1/(2*k^3),1/(2*k^3)];
a=[a0;a1;da0;da1;dda0;dda1];
y1=J*a;
end |
% A = pedm2adj(P)
%
% This returns the adjacency matrix of a partial distance matrix P
function A = pedm2inc(P)
A = P;
[n,n] = size(P);
for i=1:n
for j=1:n
if (P(i,j) <= 0)
A(i,j) = 0;
else
A(i,j) = 1;
end
end
end
end
|
%%% Simulates the steady-state signal for a bSSFP sequence with multiple
%%% single-band (1B) and multi-band (MB) pulses.
function Mss_Total = Dictionary_function_CRLB(Theta,flips,TR,Dur,dphi,Delta,TBW,nMB,n1B,b1sqrd,G_1B,G_2B,G_3B,wloc_1B,wloc_2B,wloc_3B)
T1x = [Theta(1),Theta(2),Theta(3)*1e-3];
T2x = [Theta(4),The... |
function spectralSpread = compute_spectralSpread(feature_structure,soundsets)
% Combination feature estimator for spectralSpread descriptor
sc_matrix = feature_structure.data.spectralCentroid(soundsets);
ss_matrix = feature_structure.data.spectralSpread(soundsets);
ener_matrix = feature_structure.data.melMeanEnergy(s... |
%% Iteration 0
simul_res0 = load("Results\SimulationResults_17-Mar-2021_PLacIter0ValidationSet.mat");
it0 = zeros(288,4);
it0(:,1) = simul_res0.simul_res.resultsPL.sim.tsim{1};
it0(:,2) = simul_res0.simul_res.resultsPL.sim.states{1}(:,4);
it0(:,3) = simul_res0.simul_res.resultsPL.sim.states{2}(:,4);
it0(:,4) = simu... |
%%
% <latex>
% \begin{center}\vspace{-1em}
% \Large\textbf{Experiments on polynomial (chaos) approximation of
% maximum eigenvalue functions: Tutorial}\\
% \large\textit{Luca Fenzi\footnote{\texttt{luca.fenzi@kuleuven.be},
% \textit{Department of Computer Science, KU Leuven, Belgium}. }
% \& Wim Michi... |
function [T,I,Y]=perfusionResponsepotentP2X4pool(y0,ton,toff,Ttot)
ode=modelODEpotentP2X4pool(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:33));
I=getTotalCurrentpotentP2X4pool(Y);
end |
% B-dy plot
load ./NonlinearCyclicExample_L181.mat
% Ap = [floor(length(A)/4) floor(2*length(A)/4) floor(3*length(A)/4) length(A)];
% Bp = [floor(length(B)/4) floor(2*length(B)/4) floor(3*length(B)/4) length(B)];
%
% for Astep = 1:1:length(Ap),
% for Bstep = 1:1:length(Bp),
%
% data = reshape(lea... |
function MUA = getMUA(cfg_in,S)
% function MUA = getMUA(cfg,S)
%
% INPUT:
% ts with spike trains
%
% OUTPUT:
% tsd with multi-uinit activity
%
% cfg options with defaults:
%
% cfg.sigma = 0.05; % standard deviation of gaussian for convolution
% cfg.tvec = []; % MUST BE SPECIFIED: timebase for output tsd
% cfg.dt = 0.00... |
%%
imageLena = double(imread('lena.tif'));
%%
%pmfLena =
%HLena =
%fprintf('--------------Using individual code table--------------\n');
%fprintf('lena.tif H = %.2f bit/pixel\n', HLena);
|
%% 10U20F
clear
close all
clc
load 10U20F.mat
avg_mystrategy = 68.3250010153;
std_mystrategy = 6.04530597015;
hc = figure();
set(hc,'PaperUnits','Points');
set(hc,'PaperPosition',[650,550,350,300]);
set(hc,'Units','Points');
set(hc,'Position',[650,550,350,300]);
plot(Iteration, AverageDiscountedReturn);
hold on
... |
function aff_vec = max_affinity(aff_mat)
n = size(aff_mat,1);
aff_vec = max(aff_mat,[],2);
% normalize
max_item = max(aff_vec);
min_item = min(aff_vec);
for i = 1:length(aff_vec)
aff_vec(i) = (aff_vec(i) - min_item)*10/(max_item - min_item);
end
end |
%capacity using random patterns
%result: The capacity of Hopfield network is around 0.138
clc, clear, pict
x = [];
create = 300; %test through 300 random patterns
N=1024;
capacity = [];
for i = 1 : create
x= [x;sgn(randn(1,1024))]; %bias
W = x' * x;
c=0;
for j = 1:i
if i... |
close all
clc
clear
S = load('dataMatrixMCF10ASet1');
dataMatrixMCF10ASet1 = S.data_matrix;
S = load('MCF10AP4HealthyMedia');
dataMatrixMCF10ASet2 = S.data_matrix;
dataMatrixMCF10ASet2((3:4),:) = [];
x = [1801:-1:603];
[rows1,t1] = size(dataMatrixMCF10ASet1);
[pc1,zscores1,pcvars1] = princomp(dataMatrixMCF10ASe... |
%% Update trial
if (decCounter == 0) && trial <= 64
trial = trial + 1;
catNumTrial(trial) = catNum;
%fprintf('Trial # %1i - Rule set %s - %1.0f corrects in a row\n', trial, category(catNum),correctCounter);
%fprintf(fileID, 'Trial # %1i\n', trial);
end
correctProportion = sum... |
function [ afIncidentDirectRadiations, ... % [ W / m2 ]
afIncidentDiffuseRadiations, ... % [ W / m2 ]
afIncidentReflectedRadiations, ... % [ W / m2 ]
afTotalIncidentRadiations ] = ... % [ W / m2 ]
ComputeIncidentRadiationsOnJulianDates( ...
tEnvelope, ...
afCurrentJulianDates, ... |
%% Kanji Reading Test Code
%% Read scrap.txt
fid = fopen('scrap.txt', 'r', 'n', 'Shift_JIS');
str = fread(fid, '*char')';
fclose(fid);
disp(str);
%% Display str in figures
uicontrol('Style','text', 'String',str, ...
'Units','normalized', 'Position',[0 0 1 1], ...
'FontName','Arial Unicode MS') |
function[G1,b,Nant,Ngen,arcnum,employee,empnum,empsknum,task,tasknum,tasksknum,wcost,wdur,wover,wpenal,wreqsk,wt_cost,wt_dur,wundt]=InitialInstances(filenameTask,filenameEmployee)
tasknum=-1; %number of the tasks
empnum=-1; %number of the employees
empsknum=-1; %number of... |
function [propiedadesGrafica] = graficarIsotermaP(ax,T, p_inicial, p_final, n)
%pV=nRT
p=linspace(p_inicial,p_final,250);
R=8.3144598; %8.3144598(48) J?mol?1?K?1
V=n*R*T./p;
propiedadesGrafica=plot(ax,V,p,'LineWidth', 2);
end
|
%% load the data
clear all; pack
%cd('C:\Users\mvdm\Dropbox\teaching\CoSMo2014\R042-2013-08-18'); % isidro
%cd('D:\My_Documents\Dropbox\teaching\CoSMo2014\R042-2013-08-18'); % equinox
cd('D:\My_Documents\My Dropbox\teaching\CoSMo2014\R042-2013-08-18'); % athena
load(FindFile('*vt.mat'));
load(FindFile('*times.mat')); ... |
function varargout = drawNodeLabels(nodes, value, varargin)
%DRAWNODELABELS Draw values associated to graph nodes.
%
% Usage:
% drawNodeLabels(NODES, VALUES);
% NODES: array of double, containing x and y values of nodes
% VALUES is an array the same length of EDGES, containing values
% associated to e... |
function normalized = normalExt(array, max)
normalized = array/max;
end |
function error = output_allelemap(families, ...
assignment, parameters, option)
suc = 0;
error = 0;
directory = [pwd, '\alleleMap'];
if( exist(directory, 'dir') == 0 )
suc = mkdir(directory);
else
suc = 1;
end
if( suc ~= 1 )
error = 1;
disp('cannot create output folder');
return;
end
disp(... |
clc; close all;
window_left = 0;
window_bottom = 0;
window_width = 1024;
window_height = 768;
fovy = 45;
aspect = window_width / window_height;
zNear = 0.1;
zFar = 10.0;
camera_center = [2.0, 2.0, 2.0];
image_center = [0.0, 0.0, 0.0];
camera_up = [0.0, 0.0, 1.0];
%{
world_positions = [
-1, -1, 0;
1, -1, 0;
... |
if (ZT)
MADR = bitshift(ART+1,4) + ARG+1; % +1 since matlab counts from 1
else
MADR = bitshift(ARG+1,4) + ART+1;
end
MDDR = dMEM(1, MADR); |
function answer = isEmptyFile(filename)
fileID = fopen(filename,'r');
if fseek(fileID, 1, 'bof') == -1
% empty file
answer = true;
else
frewind(fileID)
% ready to read
answer = false;
end
fclose(fileID);
|
function ret=secant(f,x1,x2)
%solve f(x)=0 using newtons method where df holds the derivative starting
%at input x.
err=1; n=0;
while err>1e-10 &&n<50
newx=x2-f(x2)*(x2 - x1)/(f(x2)-f(x1));
x1=x2;
x2=newx;
err=abs((x2-x1)/x2);
disp(x1);
n=n+1;
end
disp(n);
disp(f(x1));
ret=x1; |
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyright_1_1.html
function s = dictionaryToStruct(d)
s = {};
if isa(d, 'GenericDictiona... |
function energy = extract_energy_results_from_wake_data(wake_data)
% wake data (structure): contains all the data from the wake postprocessing
%
energy = wake_data.raw_data.Energy .* 1E9; |
function out = repeatBestsection(x)
min = inf;
bestSection = 0;
for i=6:size(x,2)-4
d = tswopN(cat(2,x(:,1:5),x(:,i:i+4)));
if d < min
min = d;
bestSection = x(:,i:i+4);
end
end
out=zeros(size(x));
for i=1:5:size(x,2)-4
if(i+4 <= size(x,2))
out(:,i:i+4) = bestSection(:,:);
... |
function sd = show(this)
sd = displayer(this);
show(sd);
end |
% Generate plots based upon the summary input files
function [] = plot_treatment_data(directory, startDate)
files = dir(directory);
for ndx = 1:length(files)
% Skip anything that is not the directories we are looking for
if ~files(ndx).isdir, continue; end
if strcmp(files(ndx).name(1), '... |
%function verificaciones(x,y)
function verificaciones
%main
clf
clear
%generar números aleatorios y almancenarlos en un archivo de excel
[XAleatorio YAleatorio]=vectoresAleatorios(150,-10,10); %vector columna
[archivoEntrada hojaEntrada]=escribirExcelAleatorio(XAleatorio,YAleatorio); %vectores columna
%leer los ... |
% Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%
% function g = gcv_function(alpha,s2,beta,delta0,mn)
%
% Auxiliary routine for GCV calculations
%
% INPUT
% alpha -
% s2 - the square of the gamma from the gsvd
% function; these are in d... |
% Read all MPCLab data out and write to mat files
% Kaifei Chen - kaifei@berkeley.edu
fid = fopen('MPCtrends.csv');
format = '%s %s %s %s %s %s';
colnames = textscan(fid, format, 1, 'delimiter', ',');
data = textscan(fid, format, 'delimiter', ',');
fclose(fid);
system = struct('type', 'mysqlMPC', 'url', '192.168.1.10... |
mname = '002.tif';
ml = 100;
msize = size(imread(mname));
img = zeros([msize ml],'uint16');
for fr = 1:ml
img(:,:,fr) = uint16(imread(mname,fr));
end
%%
nstack = 5;
img3d = zeros([msize ml nstack],'uint16');
stf = @(fr)2*sin(2*pi*fr/ml)+2.5;
gaus = @(st,fr)exp(-(st-stf(fr))^2/(2*2^2));
for fr = 1:ml
... |
function [Tnum, app] = downloadPDB(pdbid)
%DOWNLOADPDB Download the au pdb file of a virus from the viperDB.
ejovo.fn.cd2pkg;
cd +v/coordinates/pdb
%This Perl script will ONLY run if the user has the modules WWW::Mechanize
%and IO::Uncompress::Gunzip installed. To learn how to install these
%modules look up "in... |
% INTRODUCTION
% Script to process image data of Atlantis phantom.
%function [] = Proton(VarFile)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PREPARATION
% Prepare workspace:
clearvars -excep... |
%% Written By Twan Burg %%
% Obtained from MATLAB File Exchange %
function Shapley=Shappie(v)
%Calculates the Shapley value for individual a
n=log2(length(v)+1);
M=zeros(1,2^n-2);
M(1,1)=v(1)*factorial(n-1);
c=2; i=1;
while i<n
for j=c:c+nchoosek(n-1,i)-1
M(1,j)=(v(j+nchoosek(n-1,i))-v(j))*((factorial(n-1))/(nchoosek... |
%%
%%
clear all
%
% load('/home/djoroya/Documentos/Data/DarioData.mat')
% load('/home/djoroya/Documentos/Data/tspan.mat')
load('/home/djoroya/Documentos/GitHub/Data/DarioData2Reduce.mat')
load('/home/djoroya/Documentos/GitHub/Data/tspan2.mat')
allsolution = solution;
[Nexp, Nt, Nvar] = size(solution);
indexspace = [2:... |
function figure=plot_tidal_phase_exceedance(data, flood, ebb, ...
options)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Returns a stacked area plot of the exceedance probability for the
% flood and ebb tidal phases.
%
% Parameters
% ------------
% da... |
% File: Example2_14.m for Example 2-14
% Plot the spectrum of a square wave using the corresponding
% complex Fourier Series coefficients and Eq (2-109).
% Plot over the frequency range of -Nfo to Nfo,
% where N is selected to give a the desired frequency range.
% AlsoPlot the spectrum of a rectangular pulse ov... |
% LoadStimuli.m
function [audiodata, samplingrate, duration, jitkey, eventkey, anskey, speechkey] = ...
LoadStimuliAndKeys(fileloc, events, numSpeech)
% Loads audio data from stimuli.wav into two cell arrays; one for the
% waveform (audiodata) and one for the sampling rate (samplingrate). Now
% generates the ans... |
global nPeriods
UnitLenght=15;
h1=[1.5 ;4.5 ;7.5; 10.5 ;13.5 ];
h2=cat(1,h1(2:5),h1(1));
h3=cat(1,h1(3:5),h1(1:2));
h4=cat(1,h1(4:5),h1(1:3));
h5=cat(1,h1(5),h1(1:4));
hh=[1.5; 4.5; 7.5; 10.5 ;13.5 ];
InitPos=cat(1,h1,h1,h1,h1,h1,h1,h2,h3,h4,h5);
for Temp=0:0.1:3;
F=@BrwDynFunction;
G = @(t,xycoord)(... |
function [nQuads,value] = integrate2d(filename,integrand,ordergauss)
% -----------------------------------------------------------------------------%
% integrate2d integrates a function integrand(x,y) over a mesh
% Input:
% filename: The filename of a gambit neutral file that contains the mesh
% information and bounda... |
function [h, p, stat] = mcChannelEquality(x1, w1, x2, w2)
% [h p stat] = MC_data_equality(mcData,mcWeights, exData, exWeights)
%
% data already have to be only from 1 channel and Weighted
%
[numOfData, dimData]= size(x1);
typeOfTest = 'kolm-smirn';
typeOfTest = 'cramer';
%typeOfTest = 'kolm-smirn-2D';
testDim = 1;
... |
%Computer Integrated Surgery, EN.600.445
%Alperen Degirmenci, Saumya Gurbani
%Copyright 2010 Johns Hopkins University.
function F = getTransformation(a, b)
%a is a vector of struct point3D
%b is a vector of struct point3D
%calculate the transformation F such that b = F*a
%Debug mode: enables/disables some ... |
img = imread('q3.png');
subplot(3,3,1), imshow(img),title('Level 0 - Original Image');
%% Level 1
[L_img, res] = pyramid(img);
subplot(3,3,2), imshow(L_img),title('Level 1');
subplot(3,3,3), imshow(res),title('Level 0 residual');
%% Level 2
[L_img, res] = pyramid(L_img);
subplot(3,3,5), imshow(L_img),title('L... |
function [generation_cross] = crossover(generation_selet,crossover_probability,parameter)
nvar = parameter.nvar;
xmin = parameter.xmin;
xmax = parameter.xmax;
m = parameter.m;
num_part = parameter.num_part;
idex_cross = reshape(randperm(num_part,num_part),[num_part/2 2]);
for i=1:num_part/2
x_bi_a = [g... |
% function [sigline, logep] = significance(imfs, percenta)
%
% that is used to obtain the "percenta" line based on Wu and
% Huang (2004).
%
% NOTE: For this program to work well, the minimum data length is 36
%
% INPUT:
% percenta: a parameter having a value between 0.0 ~ 1.0, e.g., 0.05
% ... |
figure(1)
plot(Time,IrradianceWm2)
grid on
xlabel('Time [hr]')
ylabel('Solar Irradiation [W/m^2]')
title('Solar Irradiation')
figure(2)
range = 0:95
t = cumtrapz(range,IrradianceWm2/4)
plot(Time,t/10^3)
grid on
xlabel('Time [hr]')
ylabel('Solar Insolation [kWh/m^2]')
title('Solar Insolation') |
%% An illustration of the use of MLFFIT1
%
% Igor Podlubny
%
% Technical University of Kosice, Slovakia
%% Introduction
%
% Several examples of the use of the
% one-parameter Mittag-Leffler function
%
% $$y(x) = C E_{\alpha,\beta}(a x^\alpha)$$
%
% for fitting data are provided below.
%
%% 1. Fittin... |
function [ keys ] = des_key_schedule( key64 )
%DES_KEY_SCHEDULE Generate 16 subkeys from a 64 bits master key
des_shift_number = [ 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1 ];
[ Cn Dn ] = des_permuted_choice_1(key64);
keys = zeros(16, 48);
for i = [1 : 16]
Dn = des_shift(Dn, des_shift_number(i));
Cn = des_shift(Cn, d... |
clearvars;
clc;
fs = 30720000;%Signal sample rate
format long;
numSamps = 50000;
%Get real input filter data for PSD calcs.
fp = fopen('./LTE_input_real.dat', 'r');
filter_input_real = fscanf(fp, '%f');
fclose(fp);
%Get imaginary input filter data for PSD calcs.
fp = fopen('./LTE_input_imag.dat', 'r');
filter_input... |
function [ tout, z, flag, varargout ] = exphvfun(arg1,arg2,arg3,arg4,arg5)
%-------------------------------------------------------------------------------------------
%
% exphvfun (needs hfun.f90)
%
% Description
%
% Computes the chronological exponential of the Hamiltonian vector field hv
% defin... |
function pixelwise_similarity_matrix_gray
num_stim=6;
Root = 'C:\Users\OWNER\Dropbox\Lab.Oded\SEL\SEL10_pilot_scanner2\stimuli';
output = 'C:\Users\OWNER\Dropbox\Lab.Oded\SEL\SEL10_pilot_scanner2\stimuli\pixelwise_sim';
if ~isdir(output)
mkdir (output)
end
famous_M=zeros(320*290,num_stim);
famous_F=zeros(32... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
Theta1 = reshape(nn_params(1:hidden_layer_size * (inp... |
%/
% Step 4: reg_fit
% input: step 1-3 data, pix size
% output: many tests
% final graph - muy importante
%/
clear
clc
format
% pix size from DS9
pix_size=0.000223611*3600;
% load data from steps 1 and 3
% on home pc
load('C:\Users\nit_n\Documents\MATLAB\h_alpha\n4321\matlab_data\pa_fit.mat')
load('C:\Users\nit_n\Do... |
clc
clear all
close all
% initial conditions of the robot
motors0 = [0; 40; 3695; 9537; -5807; -334; 18810;-2000; 1; 8801; 0; 40; -3730; -9537; 5807; 425; -18800; 2000; 0; -8800; 418; 60; 60]; %initial pose arms down
conversion = pi/180/209;
q0 = motors0*conversion;
q0_right_leg = q0(1:6);
q0_right_arm = q0... |
function [XD,YV,ZPlus] = doubleVesselBeElbowChangLengthDiameterRatioAndV(resIndex,varargin)
% 双罐第二个缓冲罐作为弯头迭代双罐中间连接管长距离
% resIndex 是测点的索引
if 0 == nargin
resIndex = 'end';
end
pp = varargin;
massflowData = nan;
param.acousticVelocity = 345;%声速
param.isDamping = 1;%是否计算阻尼
param.coeffFri... |
clear;
close all
% Setup grids
L = 2.0;
ds = 2*L/17;
x = -L:ds:+L;
y = -L:ds:+L;
% Contour grid
xc = linspace(-L,L,500);
yc = linspace(-L,L,500);
[xxc,yyc] = meshgrid(xc,yc);
% Quiver grid
[xx,yy] = meshgrid(x,y);
[tt,rr] = cart2pol(xx,yy);
% Psi
psi = -4.*yyc./((4.*xxc - 4).^2 + 16.*yyc.^2) - yyc./(4.*(xxc.^2 + y... |
% calculates Availability of a path
function avail = calculateAvailability(Avail, path)
avail = 1;
for i = 1:(length(path) - 1)
avail = avail * Avail(path(i), path(i+1));
end
end |
function ct = countrns(sst,nst)
%
sstd = diff(sst);
ct = zeros(nst);
for tr = [sst(1:end-1);sst(2:end)]
ct(tr(1),tr(2)) = ct(tr(1),tr(2)) + 1;
end
|
function [ theta ] = linear_sgd( data, labels )
nrSamples = size(data, 2);
% iterations
n = nrSamples * 10;
% learning rate
alpha = 0.01;
dim = size(data, 1);
theta = zeros(dim, 1);
errors = zeros(1, n);
% iterate
for i = 1:n
% pick random sample
index = floor( nrSamples * rand(1)) + 1;
% calculate... |
function [partition_coefficent_estimate] = VBSBAT_nerual_network_estimate_v1(...
Cj_sat_ugPm3, Cj_ugPm3, O2C, molecular_weight_gPmol, mass_fraction_water_beta ,a_water, VBSBAT_NN_options)
%%
% Created by Kyle Gorkowski [GORKOWFALCON] on 2019-Jan-19 2:01 PM
% Copyright 2019 Kyle Gorkowski
%% one data set at ... |
% the value of water saturation at pc=0
% Written by Ali A. Eftekhari
function res=sw_zero_pc_imb(swc, sor, teta, labda, b)
if teta~=pi
res=((1-swc)^2+swc*(1-sor)*((1-cos(teta))/(1+cos(teta)))^(b*labda))...
/((1-swc)+(1-sor)*((1-cos(teta))/(1+cos(teta)))^(b*labda));
else
res=swc;
... |
% get which samples should be clustered together and which should be the
% prior on the origin
clear;fclose('all');
% read in the metadata (contains information about which individuals are
% dublicates
f = fopen('../NonSequenceData/Master_table_processed.csv');
c = 1;
% skip first line (headers)
fgets(f);
while ~feof... |
function [sz1,sz2] = lme_plannedSampleSize(Zi,ZiCol,Dhat,phisqhat,effsz,...
dr,pw,alpha,gr_pr)
% [sz1,sz2] = lme_plannedSampleSize(Zi,ZiCol,Dhat,phisqhat,effsz,dr,pw,alpha,gr_pr) ... |
function computeEnvironment(parameter, id)
%* env((yj,zi),(yi,zj)) = sum_{x1,z1,x2,y2}(TA(x1,yj,z1)*TB(x1,yi,z1)*TA(x2,y2,zj)*TB(x2,y2,zi))
createInitialEnvironment(parameter, id) ;
n = parameter.environmentSize ;
while n > 0
%* env1((yj1,zi1),(yi1,zj1)) = sum_{yi2,zi2,yj2,zj2,x1,x2}(env2(yj2,zi2,yi2,zj2... |
%-------------------------------------------------------------------------
% Computes finite difference Hessian
%-------------------------------------------------------------------------
function H = numhess( f,x,varargin )
k = length( x );
f0 = feval( f, x, varargin{:} );
% Compute the stepsiz... |
[ x0 lower upper ] = manhattan_optimization_bounds();
% precompute payoff features
evaluate_manhattan_dp(x0, 1);
% start optimizing
f = @(x) evaluate_manhattan_dp([1 exp(x)]);
x0 = log(x0(2:length(x0)));
lower = log(lower(2:length(lower)));
upper = log(upper(2:length(upper)));
[ymin xmin] = gpgo(f, x0, lower, upp... |
load('E:\Machine Learning\Final Project\kit_latest\kit\train\train.mat');
load('E:\Machine Learning\Final Project\kit\train\Chi_squared_all_training_and_image_features_ka_indices_sort_kiya_hua.mat');
data=[words_train image_features_train];
a=chi_squared_sorted_indices';
|
function XYZ_est = Polynomial_regression(RGB,A)
% function XYZ_est = Polynomial_regression(RGB,A)
% Returns the 3xT matrix XYZ_est with estimated XYZ-values for T samples,
% computed from RGB using a second order mixed polynomial + RGB-term
% and the weight in the matrix A
%
% RGB is device data for T samples, in th... |
function simulation_single_cycle (hObject, handles)
% SIMULATION_SINGLE_CYCLE führt einen einzelnen Simulationslauf aus
% SIMULATION_SINGEL_CYCLE(HOBJECT, HANDLES) führt einen einzelnen
% Simulationsdurchlauf aus. HOBJECT liefert den Zugriff auf das aufrufende
% GUI, in dessen Statuszeile aktuelle Informati... |
% Simulates up to t time steps, and searches for an orbit. Returns the
% period if one is found.
function p = period(S, t)
p = 0;
s = size(S);
St = zeros(s(1), s(2), t+1);
St(:,:,1) = S;
for i = 2:t+1
S = step(S);
for j = i-1:-1:1
if all(S == St(:,:,j), 'all')
... |
function [imgRes,rbbs] = RotateRBBs(img,rbbs,angle)
imgRes = RotateImageWithCornerFilled(img,-angle);
cx = size(img,2)/2;
cy = size(img,1)/2;
cxRes = size(imgRes,2)/2;
cyRes = size(imgRes,1)/2;
angle = angle*pi/180;
XY = [cos(angle) -sin(angle);sin(angle) cos(angle)]*[rbbs(:,1)'-cx;rb... |
function C = choiceC(x, y)
% CHOICEC Chooses the best value for constant C using cross
% validation depending on samples.
% C = choiceC(x, y) Picks out the best value for C for
% samples (x, y) in range 1 to 10.
%load crossvalidation.m;
% Bounds for C
c_max=3;
c_min=1;
C = c_min;
mini = crossvalidation(C, x, y);
for ... |
function [M,Vr,Vc] = meanShiftIm( X,sigSpt,sigRng,softFlag,maxIter,minDel )
% Applies the meanShift algorithm to a joint spatial/range image.
%
% See "Mean Shift Analysis and Applications" by Comaniciu & Meer for info.
%
% Assumes X is an MxNxP array, where an X(i,j,:) represents the range data
% at locations (i,j). T... |
cpu = [1 1 1 ];
gpu1 = [27 1.5 19 ];
gpu2 = [50 1.8 36];
gpu4 = [94 2 62];
sum(cpu)
sum(gpu1)
sum(gpu2)
data = [cpu; gpu1; gpu2; gpu4];
bar(data);
legend({'Commp.', 'Extract & save', 'Total'}, 'Location','Best');
title('Speedup of GPUs over CPUs', 'fontsize', 14);
set(gca, 'xticklabel', {'24-core C... |
function mapX=experimentnldr(FILE, method, D, nn)
% FILE- Give .mat file name containing
% 1. data- nxd format where n=#of observations and d=ambient dimension
% 2. D- target dimension if explicitly D not passed to function or D=0
% method- method name lap, lap_ad, lle, isomap, ltsa
% nn- #of nearest neighborhood f... |
%% 准备工作空间
clc
clear all
close all
%% 加载vlfeat
run('.\vlfeat-0.9.21-bin\vlfeat-0.9.21\toolbox\vl_setup.m')
%测试vlfeat是否加载成功
vl_version verbose
%% 加载图片
%图片1
img1ori = imread('JapanCrane.jpg');
img1 = single(rgb2gray(img1ori));
%图片2
img2ori = imread('Crane.jpg');
% img2ori = imread('Snowball.jpg');
img2 = ... |
%% Test spike
close all
clear all
%% Test 1
Fs = 10;
dur = 10; % sec
x = 0:(1/Fs):dur; % sec
a = 4.30; % peak time 4.5 s after stim, shape
b = 0.75; % scale
sigma = 0.1;
y = gampdf(x,a,b);
y = y+sigma*randn(size(y));
figure(666)
subplot(221)
plot(x,y)
xlabel('Time (s)'... |
%% Constructing a schedule from a given sequence
function sch = constructingschedule(X,st)
global Jobsinfo;
X = X';
for j=1:size(X,1);
X(j,2) = st;
X(j,3) = Jobsinfo(X(j,1),2);
X(j,4) = X(j,2) +X(j,3);
X(j+1:size(X,1),2) = X(j,4);
X(j,5) = Jobsinfo(X(j,1),3);
X(j,6) = max(0,(X(j,4)-X(j,5))); ... |
function result = nthetas( u, q)
%NTS Neville theta function S
if isnan(u) || isnan(q) || q >= 1 || q < 0
result = NaN;
return
end
if u == 0
result = 0;
return
end
s = sign(u);
u = abs(u);
k = ielnome(q);
v = pi*u/2/elK(k);
result = 2*s*elK(k)*jtheta1(... |
function model = standardGP(initModel,X,Y,Xtest,Ytest,zeromean)
%STANDARDGP model = standardGP(initModel,X,Y,Xtest,Ytest,zeromean)
% Quick wrapper for a standard GP model.
% No data pre-processing for input is performed by this method. The
% output is transformed to have zero mean.
%
% INPUT
% - initModel : ini... |
function [basisVs,feature] = gram_schmidt(img)
% GRAM_SCHMIDT: conducts cross-validation using svm via the specified kernel
%
% [trn_fold, tst_fold, ...] = CLASSIFY_CV(data,trn_fold,tst_fold,kernel)
%
% ARGUMENTS
%
% OUPUTS
[M N]= size(img);
basisVs=[]; %basisVectors are in rows; if all brain imgs add one nov... |
function [ghat,W]=SM(X,logY,beta,h,t,n)
%t=X*beta;
%n=length(t);
%kerf = @(u,h)exp(-u.^2/(2*h^2))/sqrt(2*pi)/h;
%kerf = @(u,h)0.75*(1-(u/h)^2)/h;
kerf = @(u,h)EpanechnikovKernel(u,h);
T=t*ones(1,n);
temp=T-T';
S0=kerf(temp,h);
S1=temp.*S0;
S2=temp.^2.*S0;
S0Mean=ones(n,1)*mean(S0);
S1Mean=ones(n,1)*mean(S1);
S2Mean=... |
function [L0, LE, Lab, num] = findLargestConnComponent(I,r,CONN)
%L0: opened largest component
%LE: connected object with largest volume after eroding
%Lab: Labelled connected objects after eroding
%num: number connected objects after eroding
if ~isnumeric(I) && ~islogical(I)
err... |
function p = setup(p)
%pds.git.setup retrieves and stores git info about relevant directories
%
% gets and eylink time estimate and send a TRIALSTART message to eyelink
% sets up the git information about the used code.
% at the moment this hold all changes of the PLDAPS and huklabBasics repo
% should probably change... |
clc;
close all;
clear all;
a = colormap(jet(22));
Path1 = dir('/Users/alex/Desktop/TFM Videos/Sincronizados/Recording 3/Semantic Images/Camera 3/*.png');
Path2 = dir('/Users/alex/Desktop/TFM Videos/Sincronizados/Recording 3/Frame Sequence/Camera 3/*.jpg');
load('objectName150.mat')
for i = 1 : numel(Path1)
... |
function f = ibpmultigpLowerBoundOptimise(model)
% IBPMULTIGPLOWERBOUND FOR IBP Parameters
% IBPMULTIGP
f = 0;
if strcmp(model.sparsePriorType,'ibp') || strcmp(model.sparsePriorType,'spikes')
EZS2 = model.etadq.*(model.varSdq + model.muSdq.^2);
EZS = model.etadq.*model.muSdq;
else
EZS2 = model.varSdq + m... |
function [y t] = ct_conv (f1, f2, TDOM, Ts)
% Dr. Tony Richardson
% University of Evansville
t = [TDOM(1):Ts:TDOM(2)];
L = length(t);
i = round(abs(TDOM(1) - 2*TDOM(1))/Ts) + 1;
ytmp = Ts*conv(f1(t),f2(t));
if(TDOM(1) <= 0)
y = ytmp(i:i+L-1);
else
y = [zeros(1,i) ytmp(1:L-i)];
end
end |
%Load whisking and neural time series struct
load('C:\Users\jacheung\Dropbox\LocationCode\DataStructs\excitatory_all.mat') %L5b excitatory cells
% load('C:\Users\jacheung\Dropbox\LocationCode\DataStructs\interneurons.mat') %L5b inhibitory cells
%% Top level parameters and definitions
% U = defTouchResponse(U,.95,'of... |
function [CofGrid ] = GridCentroid()
for i=1:8
for j=1:8
CofGrid(i,j,2)=(i-1)*60+30;
CofGrid(i,j,1)=(j-1)*60+30;
end
end
CofGrid;
end
|
%% Ívning 1
al = log(2)/8;
beta = 0.00600;
L = 1.6825e-5;
y0 = [1; beta./al/L];
[t,y] = ode45(@pointk,[0 60],y0);
figure(1)
subplot(2,1,1)
plot(t,y(:,1))
legend('Prompt neutrons ')
subplot(2,1,2)
plot(t,y(:,2))
legend('Delayed neutrons')
%% Ívning 2
al=log(2)/8;
beta=0.00600;
L=1.6825e-05;
raa=80e-6;
A = [(raa-bet... |
function bool = streq(S1, S2)
% bool = streq(S1, S2)
%
% returns true if S1 == S2 and false otherwise
%
% Status: PROMOTED (Release version)
% See documentation for copyright (owned by original authors) and warranties (none!).
% This code released as part of MClust 3.0.
% Version control M3.0.
bool = strcmp(S1, S2) ... |
function [] = HFSS_Setup(fileID,Setup_label,freq)
% HFSS_Setup generates a script to generate a setup
%
% It will create the setup with the following configurations:
% Maximum Number of Passes = 20
% Maximum Delta S = 0.02
% Minimum Number of Passes = 2
% Minimum Converged Passes = 2
% everything else will be ... |
classdef lab_http_client < handle
% Matlab Http client for SynthAI lab
properties
remote_base
end
properties (SetAccess = private)
webopt
end
methods (Access = private)
% Parse a JSON response, and return a (struct) on resp_data
% For more information about usin... |
%QR decomposition of Gram-Schmidt Reorthonormalization:
%To decompose a matrix of m-by-n size into a orthonormal matrix Q of
%size m-by-n and a upper-triangle matrix R of size n-by-n:
% A = (a1,...,an)
% Q = (q1,...,qn)
% |r11 r12 ... r1n|
% R = |0 r22 ... r2n|
% |0 0 ... rmn|
%
%Algorithm:
% ... |
function [ sBbox ] = bbox2Str( bbox, downloadFormatting )
%BBOX2STR Convert a bounding box from the standard format in the pipeline
%to a string that can be copied to wk.
% INPUT bbox: [3x2] int or [1x6] int
% Bounding box in the format [minX, maxX; minY, maxY; minZ, maxZ]
% or the linearized versio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.