text stringlengths 8 6.12M |
|---|
addpath(genpath('../toolbox/'));
% Load both features and training images
load train_feats;
load train_imgs;
% %% --browse through the images, and show the feature visualization beside
% % -- You should explore the features for the positive and negative
% % examples and understand how they resemble the original ima... |
% -------------------------------------------------------------------------
% Book: MVA
% -------------------------------------------------------------------------
% Quantlet: MVApcabanki
% -------------------------------------------------------------------------
% Description: MVApcabanki shows a screeplo... |
function [alpha,curr_x] = armijo(params,x0,fx0,grad,alpha0)
% [alpha,fn,gn,neval,perf] = linesearch('nn_val',params,
% x,f,gradphi,-gradphi, lpar);
beta0 = 1/10;
sigma0 = 0.01;
curr_x = x0;
if ~exist('alpha0','var') | alpha0==-1
alpha0 = 1000;
end
l = 0;
curr_fx = fx0;
while ((curr_fx-fx0)>sigma0*dot(grad,(curr... |
function Callbacks_autocorrelation_estimates_GUI25(f,C,start_path)
%SENSE COMPUTER AND SET FILE DELIMITER
switch(computer)
case 'MACI64', char= '/';
case 'GLNX86', char='/';
case 'PCWIN', char= '\';
case 'PCWIN64', char='\';
case 'GLNXA64', char='/';
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function T78=T78(h)
T78=-3.94e-3*h+495.2; |
%%% Southfield,Michigan
%%% May 23, 2016
%%% Potential Fields for Robot Path Planning
%
%
% Initially proposed for real-time collision avoidance [Khatib 1986].
% Hundreds of papers published on APF
% A potential field is a scalar function over the free space.
% To navigate, the robot applies a force proportional to t... |
function [X]=myLinSolnWithLU (A,B) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Purpose:
% To determine the solution to AX=B using LU decomposition from
% [L,U]=myLUFact_username(A)
%Main Variables:
%INPUTS:
% A - (n
%columns
% B - (n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
clear;
imtool close all;
%%
% add path section
addpath(genpath('../finetune'));
addpath('../../matconvnet-1.0-beta23/TextAnalysis/CommonFunctions');
%%
% load first layer features
load models/detectorCentroids_96.mat
% load detector model
load models/CNN-B64.mat
%%
icdarDir = '../../matconvnet-1.0-beta23/TextAnaly... |
function [f grad_f] = GMMMPEC_f_ktr(x0)
% GMMMPEC_f
% GMM Objective function for the random coefficients Logit esitmated via
% MPEC.
global W K prods T
theta1 = x0(1:K+1, 1); % mean tastes
theta2 = x0(K+2:2*K+2, 1); % st. deviation of tastes
Pi = x0(2*K+3,1); ... |
function make_ROI_weight_map(ROIweight_fname,ROItemplate_root,working_dir)
% Map a set of N values to a template set of N ROIs
%% ------------------------- SCRIPT INFORMATION ---------------------------
%
% This script will take a set of N ROIs and assign a custom set of N values
% to them - e.g. for plotting or prese... |
% =================================================================================
% MINQ5
% =================================================================================
% W. Huyer and A. Neumaier
% MINQ8 - General Definite and Bound Constrained Indefinite Quadratic Programming
% Manuscript (2017). http://www... |
function a = swap(a, i1, i2)
h = a(i1);
a(i1) = a(i2);
a(i2) = h;
end
|
function [means, stds, others] = chunk_features(features, states_voiced, states_speaking, minutes_per_chunk)
% features = chunk_features(features, states_voiced, states_speaking, minutes_per_chunk)
%
% Returns various features over minutes_per_chunk minutes, default 5.
%
% If minutes_per_chunk is inf, then entire ... |
pwd='C:\Users\jianwu\Desktop\gadget_matlab';
addpath(pwd);
r65=[pwd '\Run\Run77_8_29'];
disp(r65)
cd(r65)
fplot_R_change_v2(6,16,0.5,7,14,77);
clf
clear
pwd='C:\Users\jianwu\Desktop\gadget_matlab';
addpath(pwd);
r65=[pwd '\Run\Run75_8_22'];
disp(r65)
cd(r65)
fplot_R_change_v2(6,16,0.5,7,14,75);
cl... |
Ts_SimpleUavMotion.Ts_base = 0.036; |
function pc=OverlayBinaryPlot(PTCA,haxes,fignum)
%
% function OverlayBinaryPlot(CellArray,haxes,fignum)
%
%% Will use the BinaryInputTrace array calculated by detecting the high/low
% transitions in the InputTrace and overlay that on the axes3 plot of the
% present InputTrace
%
% CellArray == e.g. Cell array for data ... |
x = audioTransmit('0012001502.wav');
%parity
N = 6; %how many columns
[parity_encoded, dummy_bits] = encoder_parity(x,N);
parity_wave = generateBINwave(0,length(parity_encoded));
parity_channel_out = channelSimulation(parity_encoded,parity_wave);
parity_decoded = decoder_parity(parity_channel_out,N,dummy_bits);... |
% start measuring time
tic
% convert laz to las
laz_name = '/Users/scholl/geo_uzh/data/KantonAargau/LeafOff/668000_258000.laz';
las_name = [laz_name(1:end-1) 's'];
aszip = '/Users/scholl/LAStools/bin/laszip';
unix([laszip ' -i ' laz_name ' -o ' las_name]);
%% load las and dtm
%raw_off_all = readlas('/Users/scholl/g... |
function [T,DTAB] = procsb10(stag,pr,SStab,CL,Dd,Ds)
%
% [T,DTAB] = procsb10(stag,pr,SStab,CL,Dd,Ds)
%
% example:
% load /tag/matlab/data/md08_289asoundspeed
% load /tag/tag2/metadata/clicks/md08_289acl_dive3
% load /tag/tag2/metadata/clicks/md08_289abuoy
% T=procsb10('md10_163a',200,SStab,CL,Da,Dsa);
%
% pr is t... |
function [lags, xcc] = plot_EI_current_corr(R)
% plot E-I current correlation
text_fontsize = 12;
% Dump fields
dt = R.dt;
neuron_sample = R.neuron_sample;
XCC = [];
for pop = 1:length(neuron_sample.neuron_ind)
n = length(neuron_sample.neuron_ind{pop});
for i = 1:n
x = neuron_sample.I_AMPA{pop... |
function data = ET_with_ics(ORNtrace, ORNsamplingrate, inputgain, gL, vL, ics)
%% set up params
PARS = ET_pars_short;
PARS.ET.gL = gL;
PARS.ET.vL = vL;
%% set initial conditions
odeopts = odeset('Events',@spikedetect);
data = integrator_noRI(@vfield_ET, odeopts, ics,... |
function [points, image] = import_face(fileIndex)
fid = fopen(['database/' int2str(fileIndex) '.keypoints']);
points = [];
for it = 1 : 3
x = str2num(fgetl(fid));
y = str2num(fgetl(fid));
points = [points x y];
end
fclose(fid);
image = im2double(imread(['database/' int2str(fileIndex) '.png']));
if(si... |
%Vandana Anand
%CS 4033
%Homework 5 Problem 3
%defining the function at given x point
f= @(x) x^2*exp(-x^2);
%computing trapezoidal rule
trapezoidal = (0.25/2) * (f(0)+2*(f(0.25)+f(0.5)+f(0.75)+f(1)+f(1.25)+f(1.50)+f(1.75))+f(2))
%computing simpson's rule
simpsons = (0.25/3) * (f(0)+2*(f(0.5)+f(1)+f(1.50))+4*(f(0.... |
function [info] = info_compute(parms)
%% basic info
info.N = 50*(parms.D-1)*parms.K; % total number of inliers
if parms.alpha == 1
info.N1 = ceil(info.N / parms.K);
else
info.N1 = ceil(info.N*(1-parms.alpha)/(1-parms.alpha^parms.K));
end
info.b1 = normc(randn(parms.D,1));
info.M ... |
close all; clearvars; clc;
O = 4;
offset = 6;
L = 2^(O)-1;
sig = prbs(O,L);
% sig = sig*2-1;
sigP = -0.5 * circshift(sig, -offset);
sumSig = (sig+sigP);
bit_stream_prbs = zeros(1, length(sig));
bit_stream_prbs(find(sumSig == -1.5)) = -1;
bit_stream_prbs(find(sumSig == -.5)) = -1/3;
bit_stream_prbs(find(sumSig == .5... |
function X = sgplvmPointOut(model,index_in,index_out,Y,type,N,Nopt,verbose,varargin)
% SGPLVMPOINTOUT Output latent location for observation
% FORMAT
% DESC Takes a sgplvm model and finds latent location
% ARG model : sgplvm model
% ARG index_in : model component index of observation generating
% model
% ARG index_out... |
clear
clc
num = [30,31,31];
y = 2011;
Tmax = null(460);
Temperature = null(3);
lon = 31;
lat = 16;
n = 1;
for year = y:y+4
for i = 6:8
for k = 1:num(i-5)
if k > 9
filename15 = ['H:/Output files/2011-2015-d4/wrfout_d04_',num2str(year),'... |
function [Y] = classify(Model, data)
cellSize = 8 ;
X = [];
for i = 1:size(data,1)
im = reshape(single(data(i, :)), [32 32 ,3]);
hog = vl_hog(im, cellSize, 'verbose') ;
X = cat(1, X, hog(:)');
end
X = double(X);
y = zeros(size(X,1), length(Model));
for n = 1:size(X,1)
for i = 1:length(Model)
model = Mod... |
function r = dynamic_problem_S0(m,s,r,k,v_initial,ac_iter,dispn)
% Comments (24.02.2014):
% This function solves problem for S=0 for a given export status and initial value function and
% returns policies and value function
z_P = r.z_P(1:s.z_grid_size/2,1:s.z_grid_size/2);
exporter_ff = r.pi_export>=r.... |
function Wg = kyu_BN_FindRobustStruct(MCMCresults,data_in,ProbsObject)
% build a summarizing graph showing robust links and polarity of the links
% inputs
% this function can be called after a parameter training is finished
% MCMCresults: output of MCMC simulation (output of kyu_BN_GraphLearning_collect.m)
% data_in: ... |
function [m] = derivative(coeffs, x)
% function [m] = derivative(coeffs)
%
% Description:
% computes the gradient of a polynomial at a given point
%
% Inputs
% COEFFS: the coefficients for the polynomial ax^n + bx^(n-1) +
% ... + k as a vector [a, b,..., k
%
% Outputs
% M: the gradient of the tangent
%
% Last modifie... |
function [img_fin]=use_z_img(chan_tmp,ff,pos,mask_allnuc)
raw_img=struct;
img_fin=struct;
bg=[];
for jj=1:size(chan_tmp,2)
if ispc
fntmp = getAndorFileName(ff,pos,[],[],ff.w(chan_tmp(jj)));
raw_img(jj).dat =imread(fntmp);%%%%%%% jj
disp(fntmp);
else
raw_img(jj).dat =... |
%n odd or even
%if odd then left upper
%if even then right down
%must less the 32768
function project17(n)
tic
format long
% 1
summ=n^2;
remain=n^2;
A=ones(n,n);
if n<=20 && rem(n,2)==1 %n is odd
start=n^2;
for jj=0:(n-3)/2
for ii=1:n-(1+2*jj) %右上橫
A(jj+1,n+1-ii-jj)=start;
start=... |
function std_dev_plot_for_NC_fn(TUV,p)
hold on
mag = sqrt(TUV.u.^2 + TUV.v.^2); %
% Pcolor the standard deviation
% pcolor(TUV.LON,TUV.LAT,TUV.rawstd);
% pcolor(TUV.LON,TUV.LAT,TUV.(p.HourPlot.plotType));
% pcolor the standard error
pcolor(TUV.LON,TUV.LAT,TUV.std_error);
% shading flat
shading interp
%clim ... |
function result = initial_fun(x,t)
result = 1 + x^2;
end |
function Ytest_hat = WeightedKNN(Xtest, K, w, Xtrain, Ytrain)
% Implement K-nearest neighorhood classification.
%
% Input:
% -- Xtest: feature of test data (a n X d matrix; each row is an instance, each column is a feature)
% -- K: number of nearest neighorhood points
% -- Xtrain: feature of training data (... |
function LoadandGetData(datadir)
%Questa funzione parte dai segnali del kinect e ricostruisce caricando la mappa i movimenti del cursore
%ORGANIZZAZIONE VARIABILI NELLA MATRICE DATA
% Data rows:
% 1- Simulink time
% 2- CPU time
% 3-Cursor-X
% 4- Cursor-Y
% 5- Main Menu State
% 6- Reaching State
%%6. Horizontal reaching... |
function call_price=european_call_futures_currcy(S, X, r, r_f, sigma, time)
%--------------------------------------------------------------------------
%
% DESCRIPTION:
%
% European futures call option on currency
%
%
% Reference:
%
% John Hull, "Options, Futures and other Derivative Securities",
% P... |
function [poles, ar] = AR_detection( signal, ordre )
x = xcorr(signal);
p = ordre;
Rxx = zeros(p);
for i=1:p
for j=1:p
Rxx(i,j) = x(fix((length(x))/2)+1+j-i);
end
end
rxx_vect = x(fix((length(x)+1)/2)+1:fix((length(x)+1)/2)+p);
Rxx
rxx_vect
[j, ... |
%Berechnen der Transformationsmatrix am Gelenk j mit den Gelenkwinkeln ang
%und den Denavit-Hartenberg Parametern DH
function [A] = TransMatrix(j, ang, DH)
A = [
[cos(ang + DH(j, 1)) -sin(ang + DH(j, 1))*cos(DH(j, 4)) sin(ang + DH(j, 1))*sin(DH(j, 4)) DH(j, 3)*cos(ang + DH(j, 1))];
[sin(ang + D... |
function [ label ] = MakeLabels( data, event )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
label = zeros(length(data),1);
for i = 1:length(event)
if event(i,1)==771
label(event(i,2):(event(i,2)+event(i,3)+event(i+1,3)),1)=771;
elseif event(i,1)==773
label(ev... |
function B = SMMatrixConverter(A)
%SMMatrixConverter Convert S matrix to M matrix and M matrix to S matrix
B = [A(1,1) * A(2,2) - A(2,1)* A(1,2), A(1,2); -A(2,1), 1] / A(2,2);
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for testing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
return;
%Estimate an ARI model.
load iddata9 z9
y = z9.y;
model = ar(y, 4, 'ls');
compare(y,model,2);
return;
% %Use option set to choose 'ls' estimation approach
% % and to specify that covariance matrix should not be estimated.
% y = ... |
classdef StringVector < SwigRef
methods
function varargout = pop(self,varargin)
[varargout{1:max(1,nargout)}] = CoolProp_wrap(69, self, varargin{:});
end
function varargout = paren(self,varargin)
[varargout{1:max(1,nargout)}] = CoolProp_wrap(70, self, varargin{:});
end
function varargo... |
function plotr
a=[-2:0.04:2];
b=[-2:0.04:2];
for i=1:101
for j=1:101
x=-2+4*(i-1)/100;
y=-2+4*(j-1)/100;
a1(i,j)=mk(steepest(x,y));
a2(i,j)=mk(newt(x,y));
a3(i,j)=mk(con(x,y));
end
end
delete(gcp);
figure(1)
pcolor(a,b,a1);
figure(2)
pcolor(a,b,a2);
figure(3)
pcolor(a,b,a... |
function rcards = reveal(shval,k,p)
% This function reveals the cards whose values are passed
% in the vector shval. The hiding operation took place by taking
% the card values and raising them to the kth power mod p
cln=length(shval);
kinv=powermod(k,-1,p-1);
revvals=zeros(cln,1);
for j=1:cln,
revvals(j)=power... |
function fD = sparse_D(N,tau)
Neye1 = triu(ones(N,N-1),0);
fD = sparse(N,N+1);
for j=1:N+1
if j==1
Var = N-1;
Neye2 = triu(ones(N,N-1),0);
else
Var = N-j+1;
Neye2 = triu(ones(N,N-1),0)+tril([zeros(N,j-2),-ones(N,(N+1)~=j),zeros(N,N-j)],-1);
end
for i=1:N
... |
% plot EO power sweep
%%
% dir = './EOs/RFPowerSweep_QAOM04_T13_20190501T135818/';
powers = [0:-3:-15];
% accidentally saved all data in the data_all in the following file:
load('Z:\wtjiang\measurements\20190430_QAOM04_EO\EOs\RFPowerSweep_QAOM04_T13_20190501T135818\pow_-15_50.mat')
data_all_reshape = ... |
%% Plotting the time series of bacteria and virus populations, and immune response
lwidth=3; lbsize=25; tlbsize=20;
set(0,'DefaultLineLinewidth',lwidth)
set(0,'DefaultAxesLinewidth',lwidth)
set(0,'DefaultAxesFontSize',tlbsize)
markx=3; marky=3e11;
msize=20;
letters=strsplit(sprintf('%... |
function [] = Data_Visualization( data )
%数值型数据的可视化
global index;
%绘制直方图,用qq图检验其分布是否为正态分布。
%绘制盒图,对离群值进行识别
list = [4,5,6,16,19,20,22];
for i = 1:28
if ismember(i, list)
attribute = index(i);
col = data(:, i);
figure(find(list == i));
subplot(1,3,1), hist(col), title(index... |
function [Y] = pontomediovet(a,b,f,n,ya)
%PONTOMEDIOVET calcula uma sucessão de aproximações/iteradas y0, y1,...,yn
%produzidas a partir do método do ponto médio. Recebe uma função f, um
% intervalo ab, o número de subintervalos n e uma aproximação inicial ya
h=(b-a)/n;
Y=zeros(length(ya),n+1); %matriz que em cada co... |
% matlab as server
function [] = receiver
tcpipServer = tcpip('0.0.0.0',55010,'NetworkRole','Server');
fopen(tcpipServer);
while(1) %轮询,直到有数据了再fread
nBytes = get(tcpipServer,'BytesAvailable');
if nBytes>0
break;
end
end
rawData = fread(tcpipServer,nBytes,'char');
rawwData = char(rawData')
disp(raww... |
function [ output_args ] = whiteBalance( noFlash , Rimage )
%WHITEBALANCE Summary of this function goes here
% Detailed explanation goes here
% min value in Rimage thresh:
imgWo = imread(noFlash);
imgWoD = im2double(imgWo);
imshow(Rimage);
[rows,cols,dim] = size(imgWoD);
n = rows*cols;
L1 = imgWoD./Rimage;
L1Rav = s... |
function [T,I,Y]=naivePerfusionResponseIVP2X4free(ton,toff,Ttot)
ode=modelODEP2X4free(ton,toff);
naive=getNaiveP2X4free();
setAuxiliaryP2X4free(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:21,'MaxStep',0.01));
I=getTotalCurrentP2X4free(Y);
end |
function slope = findSlopes( x , y )
yVal = y(2:end) - y(1:(length(y)-1));
xVal = x(2:end) - x(1:(length(x)-1));
slope = yVal ./ xVal;
end
|
function code=change10t2(x)
N_row = length(x);
code = zeros(N_row,16); % 16-bit quant
code(x>=0,:) = de2bi(x(x>=0),16,'left-msb');
code(x<0,:) = de2bi(2^16-double(abs(x(x<0))),16,'left-msb');
end |
function [res] = tst_nn_reps(dbname,alg,params,b_white,nrep,suff,nns,b_tstontrain)
rand('seed',0);
res= [];
repi = 0;
if ~exist('nns','var')
nns = 1;
end
if ~exist('b_tstontrain','var')
b_tstontrain = 0;
end
if b_tstontrain
reps = nrep;
else
reps = [1:nrep];
end
for i=reps
fname = sprintf('db_%s_alg%s... |
function A=GetA(DarkChannel,I)
Ig=rgb2gray(I);
[h w]=size(DarkChannel);
x=1;
y=1;
for i=1:h
for j=1:w
if (DarkChannel(i,j)>DarkChannel(x,y))
x=i;
y=j;
end
end
end
x1=x;
y1=y;
for i=x:x+20
for j=y:y+20
if(Ig(i,j)>Ig(x1,y1))
x1=i;
y1=j;
... |
classdef (Sealed) EnergyBuilderFactory < handle
%ENERGYBUILDERFACTORY A factory of energy builders.
% This class produces ENERGYBUILDER instances.
%
% See also: GRAPH.
%======================== METHODS =================================
methods
function instance = newInstance(obj... |
subs = {'alex','biz','cloud','dave','dina','felix','genevieve','jeremie','karl','nic','pierre','russell','sukh','tegan','terry','valerie'} ;
for sb=1%:length(subs)
cd(['c:/shared/simul_fs/',subs{sb},'/mri']) ;
t1 = load_untouch_nii('T1.nii.gz') ;
figure('units','normalized','outerposition',[0 0 1 1])... |
%Ethan Green
%February 3rd, 2020
function BatchUpdate(batch)
%Updates the batch structure and displays using ODPlot.
%Takes input batch, the structure of all data from the batch.
%Initializing
disp("Updating data from the "+batch.title+" experiment.")
%Updating t vector
batch = ODTUpdate(batch);
%Updating OD ma... |
function my_RectangleFill(x_o,y_o,dx,dy,x_scaling,h_scaling,fColor)
%
% draws a rectangel of size dx,dy with lower left corner x_o,y_o
angle=-pi:.01:pi;
lP = length(angle);
x_circle = zeros(1,lP);
y_circle = zeros(1,lP);
for i = 1:length(angle)
R=[x_scaling*cos(angle(i)),-x_scaling*sin(angle(i));...
h_scaling*sin(... |
function map = colormap_visualization(map, c)
%colormap_visualization: produce visualisations for evaluating colormaps.
% Example:
% colormap_vis(jet(9))
%
% See also: colormap_investigation, colormap_optimization, bipolar
% and real2rgb, available from MATLAB Central Fileexchange ID 23342:
% http://www.mathwo... |
function ms = msLineatSFR(ms, behav, speedThresh, binSize)
%MSLINEATSFR Summary of this function goes here
% Detailed explanation goes here
%% Break position into trials
pos = behav.position(:,1);
ms.pos = interp1(behav.time, pos, ms.time);
minP = min(ms.pos);
maxP = max(ms.pos);
... |
function [pixelsX] = PIXELS_PER_100_MICRONS
% Return how many pixels are equivalent to 100 microns on the retina.
% This is done by measuring the square size that matches a known object
% on the retinal plane. Currently I'm using the Low Density MEA that
% measures from side to side ~710um (7 spaces of ... |
function size_var = GetSize(var)
name = getVarName(var);
size = whos(name);
size_var = size.bytes;
end
function out = getVarName(~)
out = inputname(1);
end |
function tmp()
path = 'E:\ArtShoe2_reconstruction\code\data\f001_dc_right\data\mask';
imglist = dir([path '/*.bmp']);
for idx = 1:length(imglist)
imgname = [path '/' imglist(idx).name];
img = imread(imgname);
layer = size(img, 3);
for i = 1:4
for j = 1:s... |
clear all;
p1 = {-1 0 1 0 1 1 -1 0 -1 1 0 1};
t1 = {-1 -1 1 1 1 2 0 -1 -1 0 1 1};
net = linearlayer([0 1],0.5);
[net,y,e,pf] = adapt(net,p1,t1); %自适应训练
while (mae(e)<1e-20)
[net,y,e,pf] = adapt(net,p1,t1);
end
mae(e) %平均绝对误差
|
function [R,P,pred_obs]=CPM_internal(all_mats,all_behav,dataset,...
kfolds,r_method,pthresh,part_var,motion_var,outname,train_mode)
% Connectome-based predictive modeling: internal (within-dataset) validation
% written by Aaron Kucyi, Northeastern University
% adapted from Shen et al. (2017 Nature Protocols)
% IN... |
%%%This function will read in the input image and filter out noise
function BW = image_Binarize(cam_snap)
BW_Sensitivity = 0.05; %%%Black White Sensitivity Value
level = graythresh(cam_snap)+BW_Sensitivity;
BW = imbinarize(cam_snap,level); %%%Binarizes cam_snap
sfigur... |
function [phikk,phi,phis_triang] = cpar(rxx,kmax,flag_print)
phikk = rxx(2);
phis_triang=zeros(kmax-1);
phi = rxx(2);
phis_triang(1,1)=rxx(2);
for i = 2:kmax-1
R = toeplitz([rxx(1:i)]);
phi = linsolve(R,rxx(2:i+1).'); %%Resuelvo el sistema de ecuaciones para obtener los phikk
... |
function H_Y = poisson_mixture( w1,lambda1, w2,lambda2 )
%POISSON_MIXTURE model entropy of two r.v's
% Uses numerical summation to calculate the mixture entropy of two
% Poisson variables.
% w1 = weight of Poisson r.v. with mean/rate lambda1
% w2 = weight of Poisson r.v. with mean/rate lambda2
H_Y = 0;
... |
function [sequences, wasLastPointStored] = updateSequences(dreamPar, sequences, acceptedChild, iOffspring, iteration)
wasLastPointStored = true;
if ~dreamPar.reducedSampleCollection
% rNumber = size(sequences,1)-dreamPar.nOffspringPerSeq + iOffspring;
rNumber = iteration;
for seq = 1:dreamPar.nSeq ... |
function y = d_gInf(V,V1,V2)
%Returns the derivative of the m_infinity(V) function, evaluated at V.
%
% y = d_mInf(V,V1,V2) returns the m_infinity(V) derivative at V, given
% parameters V1 and V2
y = (1/(2*V2)) * d_tanh((V-V1)/V2);
end |
function [K,Weights,name]=ksdenSelfcalib(TF,w,h,numparams,corrs)
Weights=[];
name='ksdensity';
%close all
%clc
width=w;
height=h;
showplots=0;
F=TF;
params(1) = struct('name', 'foc1', 'Krow', 1, 'Kcol', 1);
params(2) = struct('name', 'foc2', 'Krow', 2, 'Kcol', 2);
params(3) = struct('name', 'xc', 'Krow',... |
function r_heatmapcountour(X,G)
if nargin<2
X=randn(3000,1)+10;
Y=X.*1.5+randn(3000,1);
end
saveR('Data.R','X','Y')
system([getRscript, ' ', mfilename('fullpath'), '.r']);
imshow('output.tif')
|
function im = mnist_preprocess(im_vec, im_size)
% do normalization
im = reshape(im_vec, im_size);
im = permute(im,[2 1]);
im = im2bw(im);
|
function [ind,pattern]=gene_pattern(ref)
% ref is an increasing sequance (monotonic)
len=length(ref);
index=find(ref==0);
loc1=index(1);
loc2=index(end);
if loc1<=floor(len/20) & loc2<len-floor(len/20)
ind=1;
elseif loc2>=len-floor(len/20) & loc1>floor(len/20)
ind=2;
elseif loc1<=floor(len/20)... |
function exp_p_x = expmap_spd(P,X)
%EXPMAP_SPD is exponential map for GL(n)/O(n).
% P is a base matrix. It is a symmetric positive definite matrix.
% V is a tangent vector. It is a symmetric matrix.
if norm(X) < 1e-18
exp_p_x = P;
return
end
[U D] = eig(P);
g = U*sqrt(D);
% ... |
B = csvread('surface_flow.csv',1,0);
figure('Name', 'Trajectoire')
POINTS=[B(:,2), B(:,3), B(:,4)];
pcshow(POINTS,[0 0 0],'MarkerSize',2)
axis equal
title('Trajectoire 3D');
xlabel('X (m)')
ylabel('Y (m)')
zlabel('Z (m)')
BWB=alphaShape(B(:,2), B(:,3), B(:,4),2);
figure(1);
hold on
plot(BWB,'Facecolor', '... |
function rgb = honeydew
rgb = [0.94117, 1.0, 0.94117];
end |
function S = cylinderSurfaceArea(cyl)
%CYLINDERSURFACEAREA Surface area of a cylinder.
%
% S = cylinderSurfaceArea(CYL)
% Computes the surface area of the cylinder defined by:
% CYL = [X1 Y1 Z1 X2 Y2 Z2 R],
% where [X1 Y1 Z1] and [X2 Y2 Z2] are the coordinates of the cylinder
% extremities, and R is the c... |
function S = tt_build_test(trainingTracklistFile, testTracklistFile, fsspecFile)
% inputs:
% trainingTracklistFile is the file containing the list of conversations
% for training purpose.
% testTrackFile is the file containing the list of conversations
% for testing.
% fsspecFile is the file containing... |
%These first 10 lines of code are not important
keepdir=0;
if keepdir==1
save('bla.mat','filename','pathname','keepdir')
else
save('bla.mat','keepdir')
end
clear all
pause(0.1)
load('bla.mat','filename','pathname','keepdir');
tic %Start the timer
%-------------TYPE THERMAL SYSTEM PARAMTERS HERE--------------
a... |
function [P,AX,H] = PlotSnowpitProfile4(p,type)
% plot a snowpit profile from SnowPitLAB
% INPUT:
% snowpit profile data from SnowPitTemplate.xlsx format
% p =
% Obs: 'Kelly, Scott'
% Date: '01-Mar-2011 10:00:00'
% Loc: 'Grand Mesa'
% Pit: 13
% ... |
function [err] = xacmes_estimateModelError(model)
npt = model.nCrossValidation;
if (npt == 0)
err = 0;
return;
end;
xcross = model.CrossValidX;
fcross = model.CrossValidF;
[arfitness, arindex] = sort(fcross,2,'ascend');
xcross(:,:) = xcross(:,arindex);
... |
function CombineImages(index1, M1, C1, index2, M2, C2)
folder = '/Users/jadz/Documents/Notebook/Matlab/Stimuli/Images/';
files = dir(folder);
im0 = imread([folder, files(index1).name]);
im1 = imread([folder, files(index2).name]);
oldMean0 = mean(mean(im0));
oldMean1 = mean(mean(im1));
... |
function [ ] = sectors( n )
th1=pi/3;
th2=pi/3;
a=2;
b=4;
c=1;
d=c+b-a;
[D,x]=chebD(n);
t=(x+1)/2;
z1=(a+(b-a)*t(:))*exp(1i*th1*t(:)');
z2=(c+(d-c)*t(:))*exp(1i*th2*t(:)');
z2=z2*exp(1i*(th1-th2+pi))-(d+a)*exp(1i*(th1+pi));
figure(1);
mesh(real(z1), imag(z1), 0*real(z1)); hold on;
mesh(real(z2), imag(z2), 0*rea... |
if 1
fprintf('adding evlab ecog tools to path \n');
addpath('~/MyCodes/evlab_ecog_tools/');
addpath(genpath('~/MyCodes/evlab_ecog_tools/'));
end
f_low=3;
f_high=150;
[cfs,sds]=get_filter_param_chang_lab(f_low,f_high);
rate=2000;
X=1:10000;
time = size(X,2);
d=1./rate;
filter_bank={};
time = size(X,2);
d=1.... |
classdef ImagingSession < handle
%AnimalGroup Summary of this class goes here
% Detailed explanation goes here
% ================================================================== %
properties
% basic info for this session
date
sessionData
% ... |
i = imread('abc.jpg');
imshow(i)
%Inversion
i = imread('abc.jpg');
[r c d] = size(i);
f3 = zeros(r,c,d);
f3(1:r,:,:) = i(r:-1:1,:,:);
ginput(1)
imshow(uint8(f3));
%Transpose
f2 = zeros(c,r,d);
f2(:,:,1) = i(:,:,1)';
f2(:,:,2) = i(:,:,2)';
f2(:,:,3) = i(:,:,3)';
ginput(1)
imshow(uint8(f2)) |
clc;
clear;
close all;
% %% Create analytic world
load ../saved_shape_arrays/bitstar_test.mat
figure;
hold on;
visualize_shapes(shapes_array);
grid on;
while(1)
[x, y] = ginput(1);
scatter(x, y, 5, [0 0 1]);
[collision, d, grad] = shapes_point_check( [x y], shapes_array );
str = sprintf('Distance is %f... |
function paperPlotOrificeTheChangeL1(useModifyValue,param,massFlowERaw,isSaveFigure)
%内插管的实验对比
if useModifyValue
modifyValue(isSaveFigure);
else
calcValue(param,massFlowERaw,isSaveFigure);
end
end
function modifyValue(isSaveFigure)
dataPath = getDataPath();
orificD0_5MidPath = ... |
%% Perform svd on mouse gene data
clear variables
close all
addpath('../bh-tsne');
%% Load data (currently for a single brain)
outdir = 'results_mouse_highConf_coronal_MDS/';
datadir = '/home/mvandegiessen/data/tSNE_ABA/AllenMouseBrain_coronal/';
expressionlevels = load([datadir 'expressionMatrix']);
ngenes = size(ex... |
function [fitresult, gof] = FitFixrate(Pf, Pfix,ns)
%CREATEFITS(PF,PFIX)
% Create fits.
%
% Data for 'rat02' fit:
% X Input : Pf
% Y Output: Pfix
% Data for 'poly2' fit:
% X Input : Pf
% Y Output: Pfix
% Data for 'Fourier1' fit:
% X Input : Pf
% Y Output: Pfix
% Data for 'exp2' fit:
%... |
function y = tran_Y(k1, k2, h1, h2, miu, B, dx1, dx2, dy1, dy2 )
beta_c = 1.127e-3;
Ay1 = dx1*h1;
Ay2 = dx2*h2;
y = 2*beta_c/(miu*B)/(dy1/(Ay1*k1)+dy2/(Ay2*k2));
end |
% subject = sort({'RS','DB','MP','GR','DS','EC','VS','LA','AE','SY','GW',...
% 'SW','DK','LH','KM','FL','AN'});
subject = {'0401','0402','0403','0404','0405','0406','0407','0409','0411',...
'0413','0414','0415','0416','0417'};
% subject = {'1401','1402','1403','1404','1405','1406','1407','1408'};
%% Sta... |
classdef RunData < matlab.mixin.Copyable
properties
image
screwdriver
wrench
robot
start_time
duration
hole_location
position_error
angular_error
bagdir %directory of the bagdata, without extra '/'
bagname % delet... |
function scara=qx_scara_model()
L(1)=Link([0 0 250 0 0]);
L(2)=Link([0 0 150 0 0]);
L(3)=Link([0 0 0 0 1]);
L(4)=Link([0 0 0 0 0]);
% scara=L;
scara=SerialLink(L,'name','qx_scara');
end |
%% Corentin Rejaud - Recitation Week 7 - 3/10/2014
%% Question 1
A = [6 7 7 8
1 7 1 7
8 4 3 3
9 6 1 9
7 2 1 1];
B = [9 4 2
2 2 6
6 8 3
5 3 6
1 5 7];
C = [9;4;8;3;6];
% Part A
Aindex = find(A>7);
Bindex = find(B>7);
Cindex = find(C>7);
[Ai, Aj] = find(A>7);
[Bi, Bj] = find(B>7);
[Ci, Cj] = find(C>7);
% Part B
A(find(A>=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.