text stringlengths 8 6.12M |
|---|
function testout(step,upper)
% step=0.05;
% upper=0.95;
% capa=zeros(floor(upper/step),1);
% dens=zeros(floor(upper/step),1);
%
% for i=1:floor(upper/step)
% [capa(i,1),dens(i,1)]=cellular(i*step);
% end
% csvwrite('capa_dens.csv',[dens,capa]);
% plot(dens,capa);
op=csvread('capa_dens.csv');
figure;
... |
function [newM,ActP] = smotherData(Maps, per)
if per >1; per = per/100; end
% if isfield(Maps,'E11') == 1
if size(Maps,2) == 5
alldata = Maps; clearvars Maps
[~,Maps] = reshapeData(alldata(:,1:4));
x = Maps.X1; y = Maps... |
%% find_closest.m
% For a given value and array, return the index of the closest value in
% the array
% author: hxp<hxp201406@gmail.com>
% Version: MATLAB R2019b Linux
function index_closest = find_closest(target, target_array)
distance = abs(target - target_array);
index_closest = find(distance == min(di... |
function [ X ] = cartLineEqual( Pstart,Pend,dt, vp )
% Interpolate a linear path in cartesian space based on initial and end position
% [x,y,z] and orientation angles [theta,phi,psi]
% Output:
% X = cartesian 3 x n vector of position
%% Setup
Length = norm(Pend-Pstart);
tarray = 0:dt:round(Length/vp/dt)*dt;
X = zero... |
function [file_list nfiles] = iasi_l1c_filenames(sdate, edate, asldata, datatype)
% function [file_list nfiles] = iasi_noaa_ops_filenames(sdate, edate, asldata, datatype)
%
% Look for the CRIS "datatype" files that span the time interval between
% sdate and edade (matlab times) in the $asldata/iasi/$datatype/yyyy/m... |
% 1 left_mouse
% 2 right_mouse
% 4 middle_mouse
% 8 backspace
% 9 tab
% 12 clear
% 13 return
% 16 shift
% 17 control
% 18 alt
% 20 capslock
% 27 esc
% 32 space
% 33 pageup
% 34 pagedown
% 35 end
% 36 home
% 37 left
% 38 up
% 39 right
% 40 down
% 45 insert
% 46 delete
% 47 help
% 48 0)
% 49... |
function [error_train, error_val] = learningCurveRand(X, y, Xval, yval, lambda)
m = size(X, 1);
numberOfTests = 20;
lambda_null = 0;
error_train = zeros(m, 1);
error_val = zeros(m, 1);
%error_train = zeros(m, 1);
%error_val = zeros(m, 1);
%i = number of training examples
for n = 1:numberOfTests
for i... |
function [q]=exptIBIplots(pixel)
%this function plots all IBIs from the different conditions
%set up condition strings
s1='spont1';
c1='cont2';
d1='drug1';
d2='drug2';
%set up combined ibi varname and pixel string
all='allIBI';
pix=num2str(pixel);
%glue them together
s1p=strcat(s1,pix);
c1p=strcat(c1,pix);
d1p=strca... |
function [ Hd ] = dual_hessian_free( obj,Y,d,Z)
%
% This function approximate the hessian without calcuating the dual Hessian
%
%
% Hd = [G(y+ed)-Gy]/e
%
% Syntax : [ Hd ] = dual_hessian_free( obj,Y,d,x0)
%
% INPUT : Y : Dual vector
% d : Updated vector
% Z ... |
function stereo_with_xy = LoadStereoWithXY(stereo_with_xy_values)
% Loads stereo values from a log
% #stereo-octomap <class 'lcmt_stereo_with_xy.lcmt_stereo_with_xy'> :
% #[
% #1- timestamp
% #2- number_of_points
% #3- frame_number
% #4- video_number
% #5- x(0)
% #5- y(0)
% #5- z(0)
% #5- frame_x(0)
% #5- frame_y(0)
... |
% 1. The ParEGO algorithm[1] decomposes a multiobjective problem into multiple
% single-objective problems and solves one sinlge-objective problem
% randomly in each iteration.
% 2. The dace toolbox [2] is used for building the Kriging models in the
% implementations.
% 3. The non-dominated sorting method b... |
% Demo of fitting both RTs and errors by minimizing the function
% asr_errorCorErr(parm,corrtscon,corrtsinc,errrtscon,errrtsinc,varargin)
%
% Warning: This is quite slow!
%% *********** This section generates some example data: You would have your own data to fit.
% True parameter values:
TauA = 75; % Mean time... |
%region
x1=0;
x2=10858;
y1=0;
y2=10858;
rectangle('Position',[x1,y1,x2-x1,y2-y1],'FaceColor',[1 1 1],'EdgeColor','b','LineWidth',1);
%ppm1
x1=0;
x2=3186;
y1=0;
y2=1832;
rect = rectangle('Position',[x1,y1,x2-x1,y2-y1],'FaceColor',[.1 .5 .5],'EdgeColor','b','LineWidth',1);
text(x1+5,y2-((y2-y1)/4),'ppm');
%mod... |
function [p d1] = ibuildsp(bm,varargin)
% ibuildsp - builds the data spreadsheet for a benchmark
numvarargs = length(varargin);
if (numvarargs > 2)
error('iprediction: too many optional arguments');
end
optargs = {0 0};
if (numvarargs > 0)
optargs(1:numvarargs) = varargin;
end
... |
%% PROJECT2: GENERATE CUBIC SPLINE
% YONGJIN SHIN, 20090488, IME
%% Solver function calls several functions
% to generate cubic splin with given dataset
% 1)cspline: find S's coefficients
% 2)csplin_eval: return estimated y-value by cubic spline
solver(1);
solver(2);
%% SOLVER
% input: problem type (1:clamped/ 2:natu... |
function [B,mu,ERR,SP] = learnPoseDict(S_train,skel,K,lam)
% Input:
% K: size of dictionary
% lam: regularization weight
%% normalization and alignment
S_train = normalizeS(S_train);
S_train = alignHuman(S_train,skel.torso);
[F,P] = size(S_train);
F = F/3;
%% run dictionary learning
Y = reshape(S_train',3*P,F);
[D... |
% 典型相关分析
% if size(X)=[n,m1]
% size(Y)==[n,m2];
% end
% X有m1个指标,Y有m2个指标,即比较两个矩阵的相关性
function [u,v]=Typical(X,Y)
warning off all
%disp ('对数据进行标准化处理,并计算样本的协方差矩阵')
All=[zscore(X) zscore(Y)];
DXY=cov(All);
%disp ('计算矩阵A和B')
V11=DXY(1:size(X,2),1:size(X,2));
V12=DXY(1:size(X,2),(size(X,2)+1):size(All,2));
V2... |
function EXP = ComputeBayesAverage(EXP,Nperm)
es = EXP.data.es;
EXP.Bayes.Ave = [];
cbase = find(EXP.SubsetVal.contrast == mode(EXP.data.es.contrast));
gbase = find(EXP.SubsetVal.gain == mode(EXP.data.es.gain));
rbase = find(EXP.SubsetVal.roomlength == mode(EXP.data.es.roomLength));
obase = find(EXP.SubsetVal.outcome ... |
clf
clear
%chemin = "D:\Documents Importants\Professionnel\Stage 2A\daphnies\2021-07-19 premanips remi\trajectoires (4).xlsx";
chemin = "D:\Documents Importants\Professionnel\Stage 2A\daphnies\2021-07-22 agitateurs remi\trajectoires (11).xlsx";
fps = 10;
R = readmatrix(chemin);
id = R(:,1);
T = R(:,2);
T ... |
function al
clearvars
clc
addpath(genpath(fullfile('..','Symoro')));
addpath(genpath(fullfile('..','Model')));
addpath(genpath(fullfile('..','Common')));
addpath(genpath(fullfile('..','..','Toolboxes')));
addpath(genpath('C:\Users\kgwester\Documents\ResearchWork\MarkerSwappingEKF\2018_07_04')); % w... |
% calculateFrameAverages.m: this is a script to calculate frame averages for the images in this folder,
% for the corresponding frames analysed.
frameAverage2('563',13,100,1);
frameAverage2('564',12,100,1);
frameAverage2('565',19,100,1);
frameAverage2('566',17,100,1); |
function [D]=dist_test(i,x)
[m,n]=size(x);
D1 =((sum((((ones(m,1)*i)-x).^2)')));
D = sqrt(D1);
if n==1
D=abs((ones(m,1)*i-x))';
end |
function extinction(soundfrequency,soundduration)
% duration = 20;%seconds of the tone
tone = tonegenerator(soundfrequency,soundduration,8192);
% sound(tone);
%% make sound object, set parameters, put data in
ao = analogoutput('winsound', 0); %make sound output object
addchannel(ao, [1 2]);%add channels
ou... |
function [bus_sol,line_sol,line_flow,Jac] = ...
loadflow(bus,line,tol,iter_max,acc,display,flag)
% Syntax: [bus_sol,line_sol,line_flow] =
% loadflow(bus,line,tol,iter_max,acc,display,flag)
% 8/12/97
% Purpose: solve the load-flow equations of power systems
% modified to eliminate do loops and improve... |
% Script for plotting results for SDM project
clear
clc
close all
load('wkr_12_auction.mat')
load('wkr_12_greedy.mat')
load('wkr_12_replan.mat')
load('wkr_12_yawei.mat')
x = [2,4,6,8,10,12,14,16,18,20];
figure()
errorbar(x,wkr_12_picked_mean_greedy,wkr_12_picked_std_greedy,'LineWidth',1);
hold on
errorbar(x,wkr_... |
% Converts the brightness from the fluorescence signal of a stretching measurement into height units
% Stores them in stretch_study(i).bright_cal
function stretch_study = brightness_z_calibration(stretch_study)
% Graph displaying ramps and maximum stretch amplitude
f1 = figure; ax1 = gca; title('r [px... |
function [event_index,event_peak,amps,der_index] = EPSC_detection(W,si,amp_thre,if_2der,diff_gap,diff_thre,event_duration)
%% calculate the difference with 240us as "1st derivative" to detect event
diff_gap = diff_gap/si;
event_duration =event_duration/si;
data_s = smooth(W); %smooth the data
diff_ = data_s(1+diff_gap... |
function imgOut = ColorChannelCorrelations4(img)
numRow = size(img,1);
numColumn = size(img,2);
imgOut = zeros(numRow,numColumn,3);
%*************************************************************************
%Set parameters
%*************************************************************************
gammaRemoval = 1;
th... |
function [status]=c_std_bry(S)
%
% C_STD_FRC: Creates ROMS open boundary conditions error covariance
% standard deviation NetCDF file
%
% [status]=c_std_bry(S)
%
% This function creates ROMS 4D-Var open boundary conditions error
% covariance standard deviation NetCDF file using specified parameters
% in s... |
function rotatedPoint = calculateRotatedG54Point(point, angleB, angleC)
rotationBAxis = [0; 0; 193.24+16.75-8+7];
rotatedPointAroundAxisC = rotate_3D(point, 'any', angleC, [0; 0; 1]);
relativePointPosition = rotatedPointAroundAxisC - rotationBAxis;
relativeRotatedPointAroundAxisBC = rotate_3D(relativ... |
function [kde_cen,fuzzy_weight]=cen_value(fi,xi,n_cl)
%dec_fi = sort(fi,'descend');
gmfit = gmdistribution.fit(fi',n_cl)
for i=1:n_cl
[c index] = min(abs(fi-gmfit.mu(i)));
% k = find(fi==gmfit.mu(i));
% if kden(k)==0
% wck(i)=1;
% else... |
function [ phi ] = LimiterVanAlbada( a,b )
% VanAlbada Limiter
N=length(a);
N1=length(b);
if N~=N1
error('Dimension Error!');
end
phi=zeros(1,N);
for i=1:N
flag=a(i)*b(i);
if flag<=0
phi(i)=0;
else
phi(i)=flag*(a(i)+b(i))/(a(i)^2+b(i)^2);
end
end
end
|
function [ status, message ] = data_batchdelete( obj, selected_data, askforparam, defaultparam )
%DATA_BATCHDELETE delete dataitem, use for batch processing
%--------------------------------------------------------------------------
% 1. Can be used for batch deleting with using fimdata_handle.data_delete
%
% 2. Ma... |
clear
clc
n = 6;
m = 6;
k1 = 10;
k2 = 0.1;
k1o = 1000;
k2o = 100;
alpha_Slid = 0.01;
R = 1e+0*eye(m);
Q = 1e-1*eye(n);
B = 1e+0*eye(n);
BBT_inv = ((B'*B)^(-1))*B';
alpha_P = 0.01;
alpha_V = 0.001;
%%
gamma_1 = 1e+2*diag([1e-3*ones(3,1);1e-0*ones(3,1)]);
rho_1 = 1e-0;
gamma_0 = 1e-0*diag([1e... |
%solution for HM 6
% Problem 1
close all;
clear all;
N = 200;
x(1) = rand(1);
%sample from V
tmpv = 0.1*randn(1);
y(1) = x(1)^2 + tmpv;
for i = 2:N
%sample for ut
tmp = 0.1*randn(1);
x(i) = sqrt(abs(x(i-1)))+tmp;
tmpv = 0.1*randn(1);
y(i) = x(i)^2 + tmpv;
end;
... |
oldpath = path;
path(oldpath,fullfile(pwd,'..\\'));
conn = dbconn();
query = 'delete from users where id = 12345';
execute(conn,query);
%% Test 1
%setup
modelLocation = strrep(fullfile(pwd,'data','deeplabv3net2.mat'),'\','/');
dataLocation=strrep(fullfile(pwd,'data','dataset_prediction.zip'),'\','/');
mkdir(tempdir,'... |
function [rnd,loglik] = full_cond(c_design,y_proj,gp_cov)
a = size(c_design,1);
b = size(c_design,2);
inv_cov = inv(gp_cov(a+1:end,a+1:end));
mu = gp_cov(1:a,a+1:end)*inv_cov*[reshape(c_design,a*b,1);y_proj];
full_cov = gp_cov(1:a,1:a)-gp_cov(1:a,a+1:end)*inv_cov*gp_cov(a+1:end,1:a);
full_... |
%{
allele: varchar(63) # informal name
-----
standard_name='': varchar(255) # standard name
-> subject.Source
original_allele_source: varchar(255) # original source of the allele
allele_description='': varchar(1023) # description of the allele
%}
classdef Allele < dj.Lookup
... |
function [grid]=makegrid(mpar,grid)
%% Quadruble Log Grid
m_min = 0;
m_max = 10*grid.K;
% grid.m = (exp(exp(exp(exp(linspace(0,log(log(log(log(m_max - m_min+1)+1)+1)+1),mpar.nm))-1)-1)-1)-1+m_min);
grid.m = exp(linspace(0,log(m_max - m_min+1),mpar.nm))-1+m_min;
|
function plot_smoothed_ts(data,smoothing)
% function to plot smoothed behavioral data from the two-step task
if ~exist('smoothing','var')
smoothing = 15;
end
choices = double(data.sides1=='r');
smoothed_choices = smooth(choices,smoothing);
leftprobs = smooth(data.leftprobs,7);
rightprobs = smooth(data.rightprobs,... |
load('lsdata.mat','-ascii')
x = lsdata(1,:)';
y = lsdata(2,:)';
A = ones(20,4);
i = 1:20;
for n = 1:20
for i = 1:4
A(n,i)=x(n)^(i-1);
end
end
c = [0,1,2,3]';
err = A*c-y;
min(err)
|
function armacc = get_behavior_accuracy(thisdir)
load(thisdir,'laps_singlepass','armpos','rundat')
[~,rn] = max(rundat,[],2);
armacc = [];
for irun = 1:max(rn)
il = min(laps_singlepass(rn==irun));
currarm = armpos(find(laps_singlepass==il,1,'first')); % 3 is center
nextarm = armpos(find(laps_single... |
load('../labels.mat');
load('../available.mat');
load('../add.mat');
for i=1:length(available)
labels = setDEd(available(i), labels);
end
save('../labels.mat', 'labels');
% for i=1:length(add)
% labels = aetOffset(add(i), labels);
% end
|
function [ResultsAverageActivity, ResultsAverageActivityVoxelsCount, ResultsAverageActivityOnlyNum,ActiveVoxels]=ActivityNumChanges_SeparateTask_allregs(engram)
warning('off','all')
rmpath('/Volumes/Oded/Bein/fMRI_course/AnalysisScripts');
if engram
mydir='/data/Bein';
else
mydir='/Volumes/data/Bein';
end
pr... |
function Cfg = ctap_auto_config(Cfg, fun_args)
%CTAP_AUTO_CONFIG - Processes configuration file/struct with respect to the
% desired analysis pipe.
%
% Does the following:
% * adds canonical locations to Cfg
% * adds some CTAP conventions (default settings)
% * assigns pipeline function parameters to Cfg.ctap
%... |
% Stroop(window, fgcolor, bgcolor, subno, outputfolder)
%
% Performs a Stroop task with 2 components: reading colored words (easy)
% and naming the color of words (hard). The task is displayed on window
% WINDOW with background color BGCOLOR and foreground color FGCOLOR.
% BGCOLOR and FGCOLOR only affect the instructi... |
%problema 4
% Nu am inteles daca z are un pathern sau are doar un '1' in compozitie, am
% luat prima varianta.
z = [0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0];
length(z)
n = 0:20;
m = -5:15;
subplot(2,1,1),stem(n,z),grid
subplot(2,1,2),stem(m,z),grid
%se inchide graficul
t = abs(10-n);
figure(2)
plot(n,t),g... |
function alpha = testlabelcom(Pfile, doGetraw)
% function alpha = testlabelcom(Pfile, doGetraw)
%
% calculate inversion efficiency at every voxel
%
% this program takes the k-space Pfile as input
% and recons it as complex data.
% complex subtractions are done pairwise.
% alpha = abs(con-tag) / 2*abs(con)
%
% progr... |
% posterior predictive simulation
clear
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load data, partition sample
% A = xlsread('C:\paolo2\programs\UK\UKdata','Price Data','c2:c804');
% y =(log(A(2:end))-log(A(1:end-1)));
% [T,N] = size(y);
% date = 1210 + [0:1:T-1]';
%
... |
%% boolean_print_TT_fn.m
% a function to print the boolean truth table for a given
% supplied function 'func'
%
% INPUT
% func: the supplied function (e.g. OR, NAND, XOR)
% input_num: number of inputs
function [] = boolean_print_TT_fn(func,input_num)
switch input_num
case 1
lineout = @(a) [num... |
% calcola la propabilitÓ di finire nello slot l per ciascuna taglia dato un vettore n di taglie
function y=fG(p,n,l)
if(length(p)<l)
error('vettore p troppo corto');
end
sfG0=sfG(l);
sfG0=strrep(sfG0,'*','.*');
sfG0=strrep(sfG0,'^','.^');
sfG0=strrep(sfG0,'/','./');
f=inline(sfG0,'p'... |
xyloObj = VideoReader('/data/AAMs/Tracking/OriginalVideos/IntheWild/6937.flv');
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
% Preallocate movie structure.
mov(1:nFrames) = ...
struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
'colormap', [])... |
function filepath = experiment_generateExpSetFilepath( CameraType, WithMovement, ChangeType, resourceFolderPath )
filepath = strcat(resourceFolderPath, ...
CameraType, '_', ...
WithMovement, '_', ...
ChangeType ...
);
end |
%set time span and initial conditions
%current values are for healthy eye, changed timespan upper limit and c0
%for DES eye
timespan=[0 5.97];
h0=3*10^(0-6);
c0=300;
f0=[h0;c0];
%call ode45 and odefun to get f matrix
[t,f]=ode45(@odefuntears,timespan,f0);
f1=f(:,1);
f2=f(:,2);
%create f3=production over ... |
% CHEME 5440, Prelim 1
% Problem 2
AMP_concen=[0.000; 0.055; 0.093; 0.181; 0.405; 0.990]; % mM
Rate=[3.003; 6.302; 29.761; 52.002; 60.306; 68.653]; % microM/hr
err=[0.59; 1.20; 5.7; 10.2; 11.8; 13.3]; % 95% confidence for exp data
Rate_mM_hr=zeros(6,1);
for i=1:6
Rate_mM_hr(i,1)=Rate(i,1)*0.001; %convert to microm... |
clear; clc; setup; config_re_quantization;
%% ! R-E region vs quantization bits
reNoIrsSample = cell(nChannels, 1);
reIrsSample = cell(nChannels, 1);
reQuantizedSample = cell(nChannels, length(Variable.nQuantizeBits));
reNoIrsSolution = cell(nChannels, 1);
reIrsSolution = cell(nChannels, 1);
reQuantizedSolution = cel... |
function gn = egm(GM, Re, wie, f, C, S, lat, lon, hgt)
% See also egmwgs84.
% Yangongmin, 11/06/2016
N = length(C)-1; % order
C = [C(:,1)*sqrt(2),C(:,2:end)*2]; S = [S(:,1)*sqrt(2),S(:,2:end)*2];
slat = sin(lat); clat = cos(lat); slon = sin(lon); clon = cos(lon);
e2 = 2*f-f^2; RN = Re/sqrt(1-e2*s... |
function [A,B,C]= bcdLL1_init(X,R,L,init_type)
%BCDLL1_INIT Initialization of the loading matrices for the BCD-(L,L,1)
% INPUTS:
% - X: 3rd order tensor of size (IxJxK)
% - R: Number of rank-(L,L,1) components
% - init_type='gevd' to initialize by generalized EVD if possible,
% otherwise randomly,
% - init_type='ran... |
classdef Student
% класс студентов в системе агентного моделирования
properties
id;
in_time;
start_prep_time;
prep_time;
start_answer_time;
answer_time;
flag;
ability;
end
methods
function st = Student(id,in... |
function [status, err] = OCX_2_AVI(vol, ffname, wb)
%OCX_2_AVI Writes out the volume as a .tiff stack
% Defaults
err = [];
status = false;
% Get file name parts for display
[~, tiff_name, tiff_ext] = fileparts(ffname);
try
for ii=1:size(vol, 3)
if ii==1
wm = 'overwrite';
else
... |
function csiMatrix = getReadingFromDatFile(filepath)
%% This function is simply reading the .dat file.
% ==============================================================
% Reading and transforming the raw csi data
% ===========================================================================
%% Syntax:
% csiMatrix = getR... |
function SMAP_precompute_scores()
%% SMAP_precompute_scores.m
%
% This function computes the scores of all subsets of instrument in all
% possible orbits
% scores.get([orbit, subset]) = [facts(),cost]
global scores params
scores = java.util.HashMap;
orbs = params.orbit_list;norb = length(orbs);
instr = params.instrumen... |
%% learnPolicy.m
% *Summary:* Script to perform the policy search
%
% Copyright (C) 2008-2013 by
% Marc Deisenroth, Andrew McHutchon, Joe Hall, and Carl Edward Rasmussen.
%
% Last modified: 2013-03-06
%
%% High-Level Steps
% # Learn the policy (call optimizer)
% # Predict trajectory from a sampled start state and compu... |
function idx = findClosestCentroids(X, centroids)
%FINDCLOSESTCENTROIDS computes the centroid memberships for every example
% idx = FINDCLOSESTCENTROIDS (X, centroids) returns the closest centroids
% in idx for a dataset X where each row is a single example. idx = m x 1
% vector of centroid assignments (i.e. eac... |
%DRAWKEYLINES Draws keylines
%
% outImg = cv.drawKeylines(im, keylines)
% outImg = cv.drawKeylines(im, keylines, 'OptionName', optionValue, ...)
%
% ## Input
% * __im__ input image.
% * __keypoints__ keylines to be drawn.
%
% ## Output
% * __outImg__ output image to draw on.
%
% ## Options
% * __Color__ color of... |
function cellprop = BatchCellInfo
SetDirs;
cellprop = [];
strlistvarname = {'2p data','electrophys data'};
[varnamesel,ok] = listdlg('ListString',strlistvarname, 'Name', 'dataset', 'SelectionMode', 'single', 'InitialValue', 1);
if ok && varnamesel == 1
batch2p = true;
expt = getExperimentList2p;
datadir =... |
% Makes a variable allKWsortedIdx which has the indices of the largest to
% the smallest KWs
sizeS=cellfun(@size,allKW,'uniform',false);
[trash allKWsortedIdx]=sortrows(cat(1,sizeS{:}),-[1 2]);
|
function sol = svm(X,Y,C,ktype,kparam)
siz = size(X);
n = siz(1);
m = siz(2)
K = kernel(X,X,ktype,kparam);
q = (Y*Y').*K;
% disp('Q computation completed')
% ue = max(eig(q));
% le = min(eig(q));
% connum = max(eig(q))/min(eig(q));
q = q + (0.00001/C)*eye(m);
c = -ones(m,1);
a = Y';
blc = 0;
buc = 0;
blx = 0*ones(m,1);... |
function pop=crowding_distance(pop,F)
%Função retirada da internet, verifiquei que há um problema com
%a função que eu desenvolvi (comentada abaixo). Posteriormente
%irei verificar.
nF=numel(F);
for k=1:nF
Costs=[pop(F{k}).cost];
nObj=size(Costs... |
% FUNCTION: costMat
%
% Calculate cost between contour points
% Use euclidean distance for calcualtions
% ---------
% Author: Dinithi Bamnuarachchi
% e-mail: mailtodinithi@gmail.com
% created the 02/07/2013.
% ---------
function [CM3] = costMat(cp, ccp)
x = cp(:,1);
y = cp(:,2);
scatter(x, y, 3 ,'f... |
% Tracker performance evaluation tool for MDOT
% 1/23/2019 by Jiayu Zheng
close all;
clear, clc;
warning off all;
disp('**************config***************');
%g=gpuDevice(4);
%reset(g);
addpath(genpath('.'));
datasetPath = '/root/sot/data/MDOT'; % the dataset path
% datasetPath = 'E:/multi-drone/data/MDOT';
data... |
function [ error_opt_array, error_const_array, error_RF_compensated_array, ...
error_T1_effective_array, error_SNR_array ] = robustness_experiment( model, ...
parameters_to_vary, parameter_value_array, num_trials, thetas_opt, ...
thetas_const, thetas_RF_compensated, thetas_T1_effective, thetas_SNR, ...
... |
function plotCoverageSimulationResults( ...
pathToSaveResults, simState, simConfigs)
%PLOTCOVERAGESIMULATIONRESULTS Generate plots for the simulation results
%from simulateChannelForExtendedTipp.m.
%
% Inputs:
% - pathToSaveResults
% The full path to the directory for saving plots.
% - simState, simConfigs
... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 3/3/2020
addpath('E:\Chrome Download\EE569\Week3\basicOperations');
raw_left = readraw('left.raw');
ori_left = uint8(raw2img3(raw_left, 720, 480));
imwrite(ori_left, 'ori_left.tif');
raw_right = readraw('right.raw');
o... |
function plots = plotResults(pixelLength,particleDiameterClean,particle_storage,nameOfSample,l,...
pixelWidthPicture,pixelLengthPicture,control0)
%%%% Ploting results and returning desired data
surfacePicture = (pixelWidthPicture/pixelLength)*(pixelLengthPicture/pixelLength)*10^-8; % cm2
% Mean particle s... |
function dF = cdiff(L,F,TYPE);
%This function calculates the central difference derivative of field F
%with respect to variable L in direction TYPE with locations L. L
%should be 2D (L=x or L=y) if x and y or L should be 1D (L=z) matching
%the respective dimension size of F.
%type = 'x'; take x derivative F 2D or 3D.
%... |
function convertData
%% Reset MATLAB
close all
clear
clc
%% Enable dependencies
[githubDir,~,~] = fileparts(pwd);
d12packDir = fullfile(githubDir,'d12pack');
addpath(d12packDir);
%% Map paths
timestamp = datestr(now,'yyyy-mm-dd_HHMM');
rootDir = '\\root\projects';
calPath = fullfile(rootDir,'DaysimeterAndDimesi... |
%% Clean up
clearvars
close all
%% Define constants
%define the layers
layer_c = {[1 2],[3 4 5 6],[7 8 9],10:16};
%get the number of layers
layer_num = length(layer_c);
%define the layer names
layer_name = {'L1','L2/3','L4','DL'};
%% Load the files
%loading path (might have to edit this, depending on you... |
function [LP, Limage] = FrameExtract(img)
LP = [];
LP_num = BORDER(img);
if(isempty(LP_num))
LP='e';
Limage=0;
return;
end;
LP_num = LP_num{1};
LP_num = Binarization(LP_num);
R_TEMP = label(LP_num);
Limage = LP_num;
R_TEMP = dip_array(R_TEMP);
R_TEMP = ... |
%clear all
%fname = 'D:\MatData\umeda data2\modified_motion01_03.mat';
%%load(fname)
%
%ydata = ydata(2:3,:,:);
%
%xdata(:,:,ind) = [];
%ydata(:,:,ind) = [];
%fsave = 'test_spike.mat';
%
%load(fsave)
ypred = predict_output(xtest, Model, parm);
ydev = predict_variance(xtest, Model, parm);
ymin = mi... |
function im = imtranslate(i,perc)
%perc: 0..1
if nargin < 2
perc = .2
end
siz = size(i);
% sizout = floor(siz * .79);
sizout = floor(siz * (1.01 - perc));
% o_x = randi(floor(siz(1) * .1),1,1);
% o_y = randi(floor(siz(2) * .1),1,1);
o_x = randi(floor(siz(1) * perc/2),1,1);
o_y = randi(floor(siz(2) * perc/2),1,1);... |
close all;
clear all;
%% Loading Data and Plotting it
load fisheriris_data.mat;
% figure
% spread(X',ones(1,150));
% title('Original Data');
% xlabel 'Sepal Lengths (cm)';
% ylabel 'Sepal Widths (cm)';
% zlabel 'Petal Lengths (cm)';
%
% figure
% spread(X', labels);
% title('True Clusters');
% xlabel 'Sepal Lengths (cm... |
% ***** User Changable Variables ***** %
pop = 40; %population size
gen = 200; %number of generations
pcntsel = 1; %fraction of candidates selected for next generation
% breed_method = 'uniform'; % select crossover method
breed_method = '1-point';
cross_over_index = 4; ... |
clc
clear all
close all
pict=imread("pepper.bmp");
pict=rgb2gray(pict)
[M,N]=size(pict)
msb1=248;%128+64+32+16+8
lg_mtx=[]
torus_mtx=[]
K=13
x=0.15;
u=3.8;
N=64
for i=1:164
x=u*x*(1-x)
lg_mtx(i)=x
end
lg64=lg_mtx(101:164)
[a,b]=sort(lg64)
bh=(reshape(b,[8,8]))'
for i=1:64
torus_mtx(i)=mod((K*b(i)... |
function [sol_con_obj1, sol_con_obj2, sol_con_both] = constrainAA_gluc_and_test_for_sol_equality(model, loose_mediumAA, gluc_level, obj1, obj2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is exactly the same function as
% constrainOnlyOne_and_test_for_sol_equality but it will further constra... |
function T = matchSamplingTimes(varargin)
%Private utility function for the POLYSYS class.
%
%MATCHSAMPLINGTIMES Computes the sampling time for a group of polysys objects.
%
% T = matchSamplingTimes(sys1,sys2,...) compares the type
% (continuous-time or discrete-time) of each system and then computes the
% samp... |
function [udv,beta ] = getPureUDV( T, P, av_pure, Z_pure_vap, b,...
tc, pc, zc)
% This function returns pure component vapor internal energy
% of departure.
udv = 0;
R = 83.3144;
vc = (zc.*R.*tc)./pc; % estimate vc
vv_pure = (Z_pure_vap.*R.*T )./ P; %pure comp volume
beta = (vv_pure+b)./vv_pure;
vlog = log(bet... |
function [A, B] = computeCondKernel(X, theta, Kn);
n = size(Kn,1);
A = kernel(X(1:n,:), X(n+1:end,:), theta);
B = kernel(X(n+1:end,:), X(n+1:end,:), theta) + eye(size(X(n+1:end,:), 1))*1/theta(end);
|
function [V] = CliquePotentials(Segments, labels, Cliques, mrf)
V = zeros(size(Cliques));
for c=1:size(Cliques,1)
ind = find(labels(Cliques{c})==1);
% ?i?c , l_i=0
if(size(ind,1)==0)
V(c) = 0;
% ?!i?c | l_i=1
... |
%% Visualisation of effect of fB and FF variations on the likelihood function
%% 1. Generate the noise-free forward model
% 1.1 set the tissue parameters
% R2* (kHz or ms^-1)
R2star = 0.1;
% field strength offset (kHz)
fieldStrengthOffset = 0;
% S0 (arbitrary unit) - corresponding to the theoretical signal at TE ... |
function [ status, message ] = display_datamap( obj, fig_handle, varargin )
% display_datamap
% Input Argument:
% fig_handle: is the handle object of GUI, if empty create new figure with
% appropriate subplots positions
% Optional Input Argument:
% data_idx: is the index of the data for plotting, if e... |
%----------------------------------------------------------------------------
% make_climo.m
%
% this script creates a climatology data set for sst and ice. this means that
% the output should have 12 time steps, one for each month.
%
% file(s) are read with sst and ice data over some range of times. The desired
%... |
function domeigvectors(obj1,obj2,datafolder)
% generates a scatterplot of points which are projections of lead/
% difference vectors of obj1 and obj2 to their respective domain
% INPUTS:
% obj1, obj2: two leadinfo objects, should have different subject
% types, but the same sessions and runs
% ... |
# PUNTO A: load data
data = load('dataset/FlujoVehicular2019.dat');
# mapeo nombres - columnas del dataset
mes = 1;
diames = 2;
hora = 3;
diasemana = 4;
estacion = 5;
sentido = 6;
tipovehiculo = 7;
formapago = 8;
cantidadpasos = 9;
cantidad_de_filas = rows(data);
#punto E
#Se crean las matrices v... |
function [lp, lpd, lN] = getML_RLFig2Lapse(Monk, NSEN, NTUNE, ELN, DIRS, SIMNUM, BINS, SIMNAME, recompute, POW)
% get lapse rate for reinforcement learning simulation data
%%
if nargin<10
POW = 1;
end
if ~strcmp(SIMNAME, 'NonLinPool')
[h] = dirnames;
fn = ['getML_RLSuppDocLapse_' SIMNAME Monk '.mat'];
... |
t_outer = logspace(3, 9, 61);
x_outer = logspace(1, 6, 51);
t = logspace(4.5, 7.5, 31); %% in seconds
x = logspace(3, 5, 21); %% in meters
|
% DI_DFDerivada2 Derivação Numérica - fórmula das diferenças finitas em 3 pontos para a 2º derivada
% Formúla das Diferenças finitas em 3 pontos para a 2º derivada
% f''(xi)=(f(x(i+1)) - 2*f(x(i)) - f(x(i-1))/(h^2)
% INPUT: f - função
% [a, b] - intervalo de derivação
% h - passo da discretização
% ... |
function [x, its, dk, ek, fk] = func_Greedy_FISTA(para, ProxJ,GradF, ObjPhi, xsol)
% Greddy FISTA
verbose = para.verbose;
if verbose
itsprint(sprintf(' step %08d: residual = %.3e', 1,1), 1);
end
n = para.n;
% J = para.J;
mu = para.mu;
gamma0 = para.gamma;
gamma = para.c_gamma* gamma0;
tol = para.tol;
maxit... |
function grey = greyscale(img)
grey = img(:,:,1) * 0.2989 + img(:,:,2) * 0.5870 + img(:,:,3) * 0.1140;
end |
h = 0.25;
x=[0:h:1];
y=[0:h:1];
[X,Y] = meshgrid(x,y);
tri = delaunay(X,Y);
triplot(tri,X,Y);
z = zeros(size(X));
z(1,1) = 1;
trisurf(tri,X,Y,z) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.