text stringlengths 8 6.12M |
|---|
function dMext_heel_dx6 = dMext_heel_dx6(in1)
%DMEXT_HEEL_DX6
% DMEXT_HEEL_DX6 = DMEXT_HEEL_DX6(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.5.
% 17-May-2020 04:48:27
dMext_heel_dx6 = reshape([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],[2,6]);
|
load('Z:\SkilledReaching\R0028\R0028-processed\R0028Session20140425PawPointFiles.mat');
score = 1;
[all3dPoints] = RatDattoReal3Dpoints(RatData,score);
[sucessRate, failureRate,RatID,totalNumReaches] = getRatInfo(RatData)
[allCentroids]= TrajectoryCalculation(all3dPoints,score,RatID,3,1,2,sucessRate,totalNumReaches)
%... |
semilogx(Coef9604, Profilef-Controlf)
axis([20 2000 -0.1 0.1])
xlabel('Hz')
ylabel('g') |
addpath toolbox_image/
addpath toolbox_image/toolbox/
% Removing noises from the SENSE-produced images
disp(' smoothing the phase maps ... ');
PDmap1r = real(PDmap1);
PDmap1i = imag(PDmap1);
PDmap2r = real(PDmap2);
PDmap2i = imag(PDmap2);
PDmap3r = real(PDmap3);
PDmap3i = imag(PDmap3);
PDmap4r = real(PDmap4);
PDmap4i... |
clc; clear; close all
nb_bits = 128;
cr = 1/2;
NB_PACKETS = 1000;
SNR = -10:0.2:10;
K = [1 2 3 4 5];
H0 = makeLdpc(nb_bits, nb_bits/cr,0,1,3); % Create initial parity check matrix of size 128 x 256
infobits = (randi(2,nb_bits,NB_PACKETS)-1);
[checkbits, H] = makeParityChk(infobits, H0, 0); % Encode information bits ... |
function [l,u] = LUDec(a)
[m,n]=size(a);
u=a;
l=eye(m,m);
pii=1;
pij=1;
r=0;
while 1
if u(pii,pij)==0 % to check if pivot is zero
flag=0;
for k=pii+1:m
if u(k,pij)~=0
flag=1;
break;
end
end
if flag==0
pij=pij+1;
if pij>n
break;
else
continue;
end
else
t... |
function Ih = STconstructor_SpatialInertia(I,m,c)
%Ih = [I zeros(3,3); zeros(3,3) eye(3)*m];
Ih = [I-m*VECfun_S(c)*VECfun_S(c) m*VECfun_S(c); -m*VECfun_S(c) eye(3)*m];
end |
%ANALISIS NUMERICO_UCC_ING.ESP. ANDRES FELIPE ESCALLON PORTILLA_MAYO 2010
%Metodo de Newton Rapshon: Sist. Ecuac. No Lineales
function [iter,x,ea] = newton_raphson_2x2
%Función para solucionar un sistema de dos ecuaciones no lineales
%ecuaciones es una subfunción que contiene las ecuaciones
%x0 es un vector con l... |
% #### Average Over ALL Analysis ###
% this module should be run after SMARTeCDFs.m to have all the data related
% to any individual preloaded to Matlab, it also uses CDFcomparitor.m
% function to calculate emperical CDF of any three combination of commands
% with the same basis. It will generate plot to make comparisi... |
time = joint_variables_ddq_d.Time;
ddq_d = joint_variables_ddq_d.Data;
dq_d = joint_variables_dq_d.Data;
q_d = joint_variables_q_d.Data;
ddq = joint_variables_ddq_modelled.Data;
dq = joint_variables_dq_measured.Data;
q = joint_variables_q_measured.Data;
a_q = zeros(length(time),6);
for i = 1:length(time)
a_q(... |
% This function initialize the first population of search agents
function Positions=initialization(SearchAgents_no,dim,ub,lb)
Boundary_no= size(ub,2); % numnber of boundaries
% If the boundaries of all variables are equal and user enter a signle
% number for both ub and lb
if Boundary_no==1
Positions=rand... |
function CoPlot(I)
% This function draws variable vectors onto MDS plot. It is assumed that an
% MDS graph is plotted before calling this function. After all, CoPlot is
% just a vector addition to the MDS plot. Hence, without MDS graph, drawing
% variable vectors is not meaningful.
%
% Explanation of input struct... |
function [original lungWindow mediastinal] = preprocessing(original)
minVal = double(min(min(original)));
maxVal = double(max(max(original)));
% lung window view parameters
windowWidth = 1500; %D&D: 1500
windowLevel = -400; %D&D: -400
desiredMinVal = windowLevel - (windowWidth/2);
desiredMaxVal = ... |
function dxf2stl(filein,fileout,h,simpTol)
[~,c_Poly]=f_LectDxf(filein);
for i=1:size(c_Poly,1)
loops(i).xy=simplifyPoly(flipud(c_Poly{i,1}),simpTol);
end
polys=separate(loops,h,0);
P.vertices=[];
P.faces=[];
for i=1:length(polys)
skel=Sskel(polys(i).poly,179);
p=skel2patch(skel,h,0);
P.faces=[P.faces... |
%Author: Benjamin Hagenau
%Created: 2/4/17
function [fixedCredit_table] = fixedCredit(compounded,continous)
%FIXEDCREDIT calculates the credit model for a fixed credit compounded
%interest
%define initial condition and fixed rate.
r = 0.14;
A0 = 10000; %[$]
t = linspace(1,5,100); %[years]
%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function P=GAinitialize(params,npop,pinc,ppow,ndigit)
% P = GAinitialize(params,npop,p)
%
% Initialize a population for use in the genetic algorithm
%
% params is a vector of initial parameter values to be perturbed.
% NaN values will be filled with random params (not functional yet)
%
% npop is the population size
... |
%Create the mask for each image file in the directory
tic; %starts a timer
files = dir('*file.tif'); %add in the shared identifier after the *
for ii = 1:size(files,1) %looping through the files in the directory,
I = files(ii).name; %pick up the name of the iith file:
I = logical(I);
%mask_for_DCC(I... |
function Model = subfnSetModelParameters(statsStruct)
if isfield(statsStruct,'modelLL')
% This was logistic regression model
Model = {};
str = ['Model = setfield(Model,''modelLL'', ' num2str(statsStruct.modelLL) ');'];
eval(str)
str = ['Model = setfield(Model,''modelLLdf'', ' num2str(statsStru... |
function [err] = comp_err(y, y_est)
err = sum(y == y_est)/length(y);
err = min(err, 1-err);
end
|
function image_creation(image_in,x1,y1,size)
img=image(image_in);
axis([-1 32*size-1 -1 32*size-1], 'square');
axis off;
x1=x1-1;
y1=y1-1;
set(img,'Xdata',[32*x1 32*x1])
set(img,'Ydata',[32*y1 32*y1])
hold on |
function [icp_T,x,fval] = perform_fmincon(input_part_ptcloud_icp,scan_traj,tx,ty,tz,q0,q1,q2,q3)
global x0;
x = [tx ty tz q0 q1 q2 q3];
lb = [-20 -20 -20 -1 -1 -1 -1];
ub = [20 20 20 1 1 1 1];
% lb = [-50 -50 -50 -1 -1 -1 -1];
% ub = [50 50 50 1 1 1 1];
KDtree = KDTreeSearcher(input_part_ptcloud_icp);
%%%%%%%%%%%%... |
% PKRoots.m by Daniel Borrero 08/08/2012
% -----------------------------------------------------------
% Finds the roots for the Porter & Knobloch system in the
% (u,v,w,q) invariant polynomial basis for a given
% set of parameters and displays them one by one, checking if they
% satisfy the syzygy w^2+q^2-4*u^2*v... |
function obj = getObj(X, Y, obj)
if nargin < 3
obj = struct();
end
obj = tools.structDefaults(obj, {'centerX'}, {false});
if ~isfield(obj, 'llstr')
if numel(unique(Y)) == 2
obj.llstr = 'bern';
else
obj.llstr = 'gauss';
end
end
if strcmp(obj... |
function [success] = downloadCnmfGithubRepositories(varargin)
% Biafra Ahanonu
% Downloads CNMF and CNMF-E repositories.
% started: 2019.01.14 [10:23:05]
% changelog
% 2020.04.03 [14:02:33] - Save downloaded compressed files (e.g. zips) to a sub-folder.
% 2020.06.28 [13:08:16] - Final implementation of force up... |
%% 1 Electron Modelling
global C
C.q_0 = 1.60217653e-19; % electron charge
C.m_0 = 9.10938215e-31; % electron mass
C.mn = 0.26*C.m_0; % Effective Electron Mass
C.kb = 1.3806504e-23; % Boltzmann constant
C.T = 300; % Kelvin
vth = sqrt(2*C... |
function E = Energy(s1,phi1,theta,s2,phi2,ds1,dphi1,dtheta,ds2,dphi2,x1,y1,g,k1,k2,L_sp0,L_mB,mB,IB,m2)
%ENERGY
% E = ENERGY(S1,PHI1,THETA,S2,PHI2,DS1,DPHI1,DTHETA,DS2,DPHI2,X1,Y1,G,K1,K2,L_SP0,L_MB,MB,IB,M2)
% This function was generated by the Symbolic Math Toolbox version 7.1.
% 14-Jan-2017 01:29:06
t2 = ... |
function showResults( X, reflBasis, cameraMat, measVals, wave, reference )
h = size(X,1);
w = size(X,2);
nBasis = size(X,3);
nWaves = size(reflBasis,1);
nChannels = size(cameraMat,1);
reflEst = reflBasis*reshape(X,h*w,nBasis)';
reflEstImg = reshape(reflEst',[h w nWaves]);
predVals = cameraMat*reflEst;
predValsImg = r... |
function [NI_slbp,RD_slbp] = xu_SLBP(img,lbpRadius,lbpPoints,mapping,mode)
blocks1 = cirInterpSingleRadiusNew(img,lbpPoints,lbpRadius);
blocks1 = blocks1';
imgTemp = img(lbpRadius+1:end-lbpRadius,lbpRadius+1:end-lbpRadius);
blocks2 = repmat(imgTemp(:),1,lbpPoints);
radialDiff = blocks1 - blocks2;
radialDiff(radialDif... |
function svpApprox()
numFactors = 60;
maxIter = 5;
fracEdgesToRemove = .5;
uncertaintyFactor = 5;
dataset = 'artificial';
getNewSplits = 1;
useBigMergedNet = 1;
setGGUnknown = 1;
getKnownEntriesFromKatz = 0;
% smoothenUserUser = 1;
[socialNet, A, targetEdgeSet, Tr... |
close all
clear all
clc
rh_data = load(['/home/local/carltonx/Documents/Smear_course//New_data/20160501-20173113_rh.txt']);
temp_data = load(['/home/local/carltonx/Documents/Smear_course/New_data/20160501-20173113_temp.txt']);
dmps_data = load(['/home/local/carltonx/Documents/Smear_course/New_data/2016/dm1... |
%*******************
%% UNIT CELL
%****************
L1=0.3;
L2 =0.4;
a=5;
Nx=512;
Ny=512;
Mx=20; %% map X [m]
My=20; %% map Y [m]
%*******************
%% DASHBOARD
%****************
% Nx = 200;
% Ny = 200;
dx = 1/Nx;
dy = 1/Ny;
xa = [0:Nx-1]*dx; xa = xa-mean(xa);
ya = [0:Ny-1]*dy; ya... |
clear
clc
syms L1 L2 L3 L4 L5 L6 L7 L8 alpha beta gamma zeta alphaDot betaDot gammaDot alphaDotDot gammaDotDot betaDotDot
% %Forward Kinematics
%
% x = (L2+L3*cos(-beta)+L4*cos(zeta)+L5*cos(zeta+gamma)-L7)*cos(alpha);
%
% xDot = - alphaDot*sin(alpha)*(L2 - L7 + L5*cos(gamma + zeta) + L3*cos(beta) + L4*c... |
function [w] = lr_solve_gd(x_train, y_train, iters, eta)
N = size(x_train,1);
w = zeros(size(x_train,2),1);
for i=1:iters
y_pred = lr_predict(x_train, w);
w = w + x_train'*(y_train - y_pred)*eta;
end
|
function ret = l_function_create_spindleInfos_26oct12(S)
% function ret = l_function_create_spindleInfos_22oct12(currDir,workDir)
% create struct 'spindleInfo' from subject's (workDir) spindle info files
% (vpXX_400Hz_{Cz,C3,C4,F3,F4,Fz}.txt) and sleep stage files (vpXX.txt)
% and saves it to 'spindleInfos.mat'
% ---... |
function SXDM_Mat(beamline_sample_path)
loadmda_function_path='/home/will/Research/UIC/SXDM/Analysis'
addpath (loadmda_function_path)
path1add = strsplit(loadmda_function_path,'/')
leng = size(path1add)
length = leng(2)-1
path2add = strjoin(path1add(1:length),'/')
addpath (path2add)
%Default wip_sample_path
splits=s... |
function [Xgrid, Ygrid]=obs_ijpos(GRDname, obs_lon, obs_lat, ...
Correction, obc_edge, ...
Ioffset, Joffset);
%
% OBS_IJPOS: Computes observation locations in ROMS fractional coordinates
%
% [Xgrid,Ygrid]=obs_ijpos(GRDname,obs_lon,obs_lat,Correction,... |
% Script to exercise the DIRECT optimization Algorithm with ADVISOR.
%
% 1) initialize workspace
% 2) define the problem
% 3) run optimizer
% 4) save results
%
% initiate timer
tic
% initialize the workspace
if 1% 1=initialize, 0=don't initial - for continuation runs
%Pass the small electric vehicle
input.init.save... |
clear;
[ret, no, tab] = bisection(-1,1);
x=linspace(-1,1,1000);
y=zeros(1,1000);
for i=1:1000
y(i)=fun(x(i));
end
plot(x, y, ret, fun(ret), 'o');
grid on;
grid minor;
title('Rozwiązanie równania nieliniowego metodą bisekcji');
xlabel('x');
ylabel('f(x)');
hold on;
%%
function f=fun(x)
f = 3.55*x^3 - 1.1*x^2 - ... |
function [EmphasizedModel] = EmphasizeModel(Model, EmphasisValue)
Labels = unique(Model(Model>0));
NL = length(Labels);
%% 強調モデル作成
EmphasizedModel = cell(NL,1);
for iL = 1:NL
L = Labels(iL);% ラベルを1つ選択
EmphasizedComponent = (Model == L);% ラベルと同じ値を持つ部品を抜き出す。
OthersComponent = (Model>0) - EmphasizedComponent... |
%%%
smoothing=zeros(length(X));
smoothing_factor=smooth_coefficient*spacing^2/100^2;
%%% "smooth_coefficient" is defined in QTomo_SetParams
%%% It and the exponent 0.8, below, were chosen by Tikhonov
%%% regularization of each frequency's inversion. These
all_dist=zeros(length(X));
... |
% generate synthetic data and detect bad channels from it
%
% Note:
% * assumes PROJECT_ROOT to be in workspace
% * run batch_psweep_datagen.m prior to running this script!
% PROJECT_ROOT = '/home/jkor/work_local/projects/ctap/ctapres_hydra';
%% General setup
FILE_ROOT = mfilename('fullpath');
PROJECT_ROOT = FILE_... |
clc; clear all; close all;
syms a b t
x1t=t*exp(-a*t);
x2t=sin(a*t)+cos(b*t);
X1s=laplace(x1t);
X2s=laplace(x2t);
X2s=simplify(X2s);
disp(X1s);
disp(X2s); |
clear
R = 6371.2;
%plt = 1 plot the earth,emitter,sensors and the generated sequence
plt = 1;
if plt == 1
figure('color','k')
ha=axes('units','normalized','position',[0 0 1 1]);
uistack(ha,'down')
img=imread('background.jpg');
image(img)
colormap gray
set(ha,'handlevisibility','off','visible... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FRE 6251 Numerical and Simulation Techniques in Finance
% Assignment #2
% Name: Surya L Gurung ID: 0449604
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (Monte Carlo Simulat... |
hold on
rlc(10,10,0.1)% heavy damping
rlc(1,10,0.1) %weak damping
hold off |
load('JpegCoeff.mat');
load('hall.mat');
[accode,dccode,quantized_coef,width,height]=jpeg_encode(hall_gray,QTAB,ACTAB,DCTAB);
save('jpegcodes.mat','accode','dccode','width','height'); |
function [totalFig] = burst_hist(sid,bursts,typeCell,OUTPUT_DIR,saveIt)
% this function is designed to take a burst table (in the case of ecb43e,
% where there are a given number of conditions, and plot a histogram of the number of
% bursts in each size, binned.
% modified by DJC 2-10-2016 to consider stats on the bur... |
depthfileNamesFile = fopen('sunrgbd_train_depth_fileNames.txt','w');
res_file = fopen('sunrgbd_train_res_fileNames.txt','w');
K_file = fopen('sunrgbd_train_K_fileNames.txt','w');
T_file = fopen('sunrgbd_train_T_fileNames.txt','w');
for i = 1:5285
i
k = i+5050;
fName = mat2str(cell2mat(alltrain(i... |
% DES debug test script
% Prints every intermediate step of the DES algorithm
clear;clc
Key = ...
'0000000100100011010001010110011110001001101010111100110111101111'-'0';
M = Key;
C = DES(M, Key, 1, true); |
%% test Intersection Adjusting %%
clear;
clc;
tic;
load('weight_EC_cube.mat','weight_EC_cube');
load('map_img_rgb_cube.mat','map_img_rgb_cube');
load('traject_free.mat','traject_free');
load('traject_regul.mat','traject_regul');
load('grid_network.mat','grid_network');
load('air_level.mat','air_level');
load... |
function set_component_listitem(component);
global vinf
%the tag for the popupmenu containing the component list
tag=component;
listitem=eval(['vinf.' component, '.name']);
listname=[component , '_', eval(['vinf.' component '.type']) '_' eval(['vinf.', component, '.ver'])];
set(findobj('tag',tag),'string',optionlis... |
function showParameter( obj )
w = 2 * pi / obj.T;
c = sqrt( obj.gra * obj.H );
k = w/c;
waveLen = obj.T * sqrt(obj.gra * obj.H);
fprintf('\nWave parameter:\n');
fprintf('\tWave amplitude (m): %f\n', obj.delta * obj.H);
fprintf('\tWave period (s): %f\n', obj.T);
fprintf('\tWave speed (m/s): %f\n', sqrt(obj.gra * obj.H ... |
clc;
close all;
% Time period enteries
t1 = input("Enter from time: ");
t2 = input("Enter to time: ");
% Number of coefficients is set to 32(-16:1:16) you can change it if more are
% required
% Time period
T = t2 - t1;
% Range of the function variable
k = (t1):0.001:(t2);
% Function
f = (3.*cos(k));
% ==========... |
%
%plots various steps of the spike extraction process.
%
%from top to bottom:
%raw signal
%filtered signal
%local energy with threshold
%spikes extracted
%empty
%
%urut/april04
function plotSpikeExtraction(label,rawSignal, rawMean, filteredSignal, rawTraceSpikes, runStd2, upperlim)
%ID='P3S1B6_block17';
... |
function [wFF]=filter_definitions_V1_simple(sigma,wFF)
%Define weights, based on Gabor functions, for V1 simple cells
angles=[0:22.5:179];
wavel=1.5*sigma;
aspect=1./sqrt(2);
if nargin<2
k=0;
else
k=size(wFF,1); %append new filters onto those already defined
end
for phase=0:90:270
for angle=angles
k=k+1;
%defi... |
function Bijk = box_spline(i,j,k,smer,D_Bijk)
% Opis:
% box_spline izracuna pripadajoc skatlasti zlepek tipa 1
%
% Definicija:
% Bijk = box_spline(i,j,k,smer,D_Bijk)
%
% Vhodni podatki:
% i, j, k parametri, ki določajo zlepek
% D_Bijk matrika odvoda zlepka v dani smeri
% smer smer po k... |
clear; clc; clf; close all;
IN = load('C:\Users\Heath\Google Drive\gflash tests\Mixed_debug\cpp_interface\out.txt');
%IN = load('C:\Users\Heath\Google Drive\gprs_fromMartin\BitumenTest\out30_293.txt');
%IN = load('C:\Users\Heath\Google Drive\gprs_fromDenis\BitumenTest\3_out30_373.15.txt');
%IN = load('C:\Users\Heath... |
function [NewBodyPath] = DiscreteBodyPath(BodyPath, BodyCostMap)
%UNTITLED2 Summary of this function goes here
% Discretize the body path according to the body cost map
% For example, if the body cost of current position is high, then reduce
% the step length. Otherwise, increase step length
VariantStepLen =... |
function combinds = getCombInds(labelNames, combLabels)
combinds = [];
for n = 1:length(combLabels)
if ~isempty(find(strcmp(combLabels{n}, labelNames)))
combinds(end+1) = find(strcmp(combLabels{n}, labelNames));
end
end
end |
function [epochedTactor,epochedAudio,epochedStim,epochedButton,t,tSamps] = extract_epochs_TOJ(stim,tact,trainTimes,fsStim)
% QUANTIFY RXN TIME TO CORTICAL STIM
sampsEnd = round(3*fsStim);
preStim = round(fsStim*1);
epochedTactor = squeeze(getEpochSignal(tact(:,1),trainTimes,trainTimes+sampsEnd));
epochedAudio ... |
function [] = fullAnatomyXls(neuronIDs,outputFile,varargin)
%fullAnatomyXls. Generates xls with axonal information per anatomical
%region. Used to select regions for later anatomy tables.
%% Parse input.
p = inputParser;
p.addRequired('neuronIDs',@(x) ischar(x) | iscell(x));
p.addRequired('outputFile',@(x) ischar... |
function domain = mplsqfourier_height (input)
% Usage (all produce the same output):
% mplsqfourier_height(2:0.1:3)
% mplsqfourier_height({[2 3], 0.1})
% mplsqfourier_height({[], 0.1, 2.5, 0.5})
if (nargin < 1) || isempty(input)
domain = mplsqfourier_height_aux ();
elseif iscell(input)
domain = ... |
function [R, t] = find_rotation_translation(E)
% svd
[U, ~, V] = svd(E, 0);
% t
t{1} = U(:,end);
t{2} = -U(:,end);
% R
rot_mat{1} = [0, -1, 0; 1, 0, 0; 0, 0, 1];
rot_mat{2} = [0, 1, 0; -1, 0, 0; 0, 0, 1];
count = 0;
for i = 1:2
for j = 1:2
... |
function h = err2d(x, y, xe, ye, varargin)
% Draw a scatter plot with 2d error bars
%
% Usage:
% -------------------------------------------------------------------------
% function h = err2d(x, y, xe, ye, varargin)
%
% Inputs:
% -------------------------------------------------------------------------
% x mean x
... |
function top_five_ind = get_five(x)
top_five_ind = zeros(1,10);
for i = 1:10
tmp_ind = find(abs(x)==max(abs(x)));
top_five_ind(1,i) = tmp_ind(1);
x(tmp_ind(1)) = 0;
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Author: Josh Smith
%% Discription : a simple pid controller
%%
%% INPUTS
%% targetVal: desired control value
%% actualVal: actual control value
%% time: current time
%% upperLimit: upper limit of controlled device
%% lowerLimit: lower limit of control... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Wenan Chen
%% September, 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This function drow a box on the rgb image rota_img by setting the r
%% component to 255.
function rota_img=drawbox(rota_img, boxRect, boxcolor)
%% input: boxRect is a four ... |
function benchminmax()
% function benchminmax()
%
% Benchmark runtime minmax filter among four methods: Matlab vectorized,
% for-loop, Lemire's MEX files, and vanherk by Frederico D'Almeida
%
try
lemire_engine(1,1);
catch
minmaxfilter_install();
end
% Data
fprintf('Random, win=100\n');
B = randperm(100000)... |
%% Viewpoint invariance of face-selective units in untrained networks (Fig.S8-10)
%% Analysis for viewpoint invariance (Fig.S8a,f-h)
net_rand = Cell_Net{1,1,1}; % untrained AlexNet
load('IMG_var_view_210106.mat'); % viewp... |
function XsInterval = maxInterval(maxDist, probabilityInterval, xMin, xMax , Xs)
k = 0;
%limitDistscaled = 100*maxDist/trapz(maxDist);
probabilitySurface = 0;
nsPerDimension = size(maxDist,1);
dx = prod((xMax - xMin)/(nsPerDimension - 1));
while probabilitySurface < probabilityInterval
k = k + 1e-3;
limitDis... |
function A = DD(n,h)
% DD(n,h)
%
% One-dimensional finite-difference derivative matrix
% of size n times n for second derivative:
%
% This function belongs to SG2212.m
A = zeros(n);
A(1,1)=-1;
A(1,2)=1;
A(n,n-1)=1;
A(n,n)=-1;
for i=2:n-1
A(i,i-1)=1;
A(i,i)=-2;
A(i,i+1)=1;
end
A=A/h^2; |
clear all; close all; clc;
%%
library_directory = '../mex';
addpath(library_directory);
matlab_directory = '../matlab/';
addpath(matlab_directory);
meshes_directory = '../meshes/';
addpath(meshes_directory);
%%
[vertex,faces] = read_mesh('genus3.off');
nvert = size(vertex,2);nverts = size(vertex,2);
nstart = 1;
%%
... |
close all
clear all
hinfo = hdf5info('asgard_realspace.h5');
[dset info] = hdf5read(hinfo.GroupHierarchy.Datasets(1));
% dset(:,2) = [];
degree = 3;
level = 3;
domain_p = [0 10];
domain_xi = [-1 1];
domain_s = [0 1.2];
p = create_grid(degree, level, domain_p);
xi = create_grid(degree, level, domain_xi);
xi = create... |
% 例1,傅里叶级数合成,符号计算
% 北京邮电大学,尹霄丽
% 2018年12月
close all;
clear all;
set(0,'defaultAxesFontName','Microsoft YaHei UI')
syms t n;
T=2*pi;
tao=pi;
w1=2*pi/T;
Fn=int(1*exp(-i*n*w1*t),'t',0,tao)/T
N=21;
f=tao/T;
nn=[-N:-1 1:N];
for k=1:length(nn)
n=nn(k);
f=f+subs(Fn)*exp(i*n*w1*t);
end
ezplot(f); |
function Robot_Dimension(scale)
% ROBOT_DIMENSION(scale) loads robot physical parameters.
% scale = scale to be used to plot the robot. Default values are in
% meters.
if nargin < 1
scale = 1;
end
et = 1.4; % error factor for parameter estimates
Robot.theta = [0.26038*et 0.25095*et -0.00049969*et ... |
clear;
constants;
ang = deg2rad([-10 40 -50 50 5 200]');
[~, pos, orient] = FKfull(ang,"R",robot);
fullMatOld = [pos;orient];
fullMatOld
newAngles = IKfull(fullMatOld,"R",robot);
rad2deg(newAngles)
for curAngles=newAngles
[~, pos, orient] = FKfull(curAngles,"R",robot);
fullMatNew = roundn([pos;orient] - ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% reference paper: [kong14lr] Lattice reduction aided transceiver design for MU MIMO downlink transmissions
%
%
% calculate total precoding matrix F = [F1, F2, ..., FK];
% F: M_T * r
% Fi: M_T * ri
%
% initialize receive matrices
% loop:-------
% calcualte langrang... |
function g = sigmoid(z)
%SIGMOID Compute sigmoid function
% g = SIGMOID(z) computes the sigmoid of z.
% You need to return the following variables correctly
g = zeros(size(z));
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the sigmoid of each value of z (z can be a matrix,
... |
%% Copyright (C) 2014 Hui Chen
%%
%% This program is free software; you can redistribute it and/or modify it
%% under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 3 of the License, or
%% (at your option) any later version.
%%
%% This program is distribute... |
function y=psi(axis,a,h)
v=[1 1; 1 1]/4;
d1=[0 0 0; 0 1 -1; 0 0 0]/2;
d2=[0 0 0; 0 1 0; 0 -1 0]/2;
d3=[0 0 0; 0 1 0; 0 0 -1]/2;
d4=[0 0 0; 0 1 0; -1 0 0]/2;
d=eval(['d' '0'+axis]);
if h>0
y=d;
for i=1:h-1
y=conv2(y,d);
end
else
y=v;
a=a-1;
end
for i=1:a
y=conv2(y,v);
end
end |
function f1=spacetime_plot(spacetime)
lx=20
f1=matrix_maker1D(spacetime,lx);
t=linspace(5500+0.05,6000,length(f1(:,1)));
x=linspace(1,lx,length(f1(1,:)));
surf(x,t,f1)
shading interp
view(0,90)
axis ij
xlim([min(x), max(x)]);
ylim([min(t), max(t)]);
colorbar
xlabel('cell #')
ylabel('time [ms]')
title(['Spacetime plot... |
% videoClickFcn.m
%
% Called when the video preview image is clicked. This moves the region of
% interest to be centered on the point that was clicked. Shift-Clicking
% centers the ROI in the middle of the video frame.
%
% nb. Doesn't protect against wandering out of the video frame.
%
% JSB 11/2010
function videoCli... |
%% plot strong NS
% threshold is one std+ median of intra- and inter-brain NS
clear all; close all; clc;
addpath('f_PlotEEG_BrainNetwork');
addpath('D:\software\eeglab14_1_2b');
%% plot strong NS individually
load('data/useful/conn/conn_phase_spectcoher','conn_phase_spectcoher');
load('data/useful/conn/conn_phase_spect... |
function [home_dir_, lab_dir_, current_dir_, tmat_dir_] = dirnames
% [home_dir_, lab_dir_, current_dir_, tmat_dir_] = dirnames
% home/lab directories
home_dir_ = fullfile(filesep, 'Users', 'jigold', 'Desktop');
lab_dir_ = fullfile(filesep, 'Users', 'jigold', 'Desktop');
% current proj... |
function BpodImager_delayRegressModel(cPath,Animal,Rec)
if ~strcmpi(cPath(end),filesep)
cPath = [cPath filesep];
end
%general variables
Paradigm = 'SpatialDisc';
cPath = [cPath Animal filesep Paradigm filesep Rec filesep]; %Widefield data path
sPath = ['U:\space_managed_data\BpodImager\Animals\' Animal filesep Pa... |
function nll = nll_LogReg(X_C, Y, X_E, theta)
n = size(X_C,2);
X = [ones(1,n); X_C; X_E];
nll = mean( log( 1+exp(-theta*X) ) + (1-Y) .* (theta*X) );
end
|
function A_reduced = Hw_2_downsize(u, m_r, n_r)
% ----------------------- Description ---------------------- %
% %
% Dimensionallity reduction algorithm %
% %
% ----------- Init... |
% Static variables for depth
tic
t1 = datetime('now','Format','HH:mm:ss');
time = string(t1);
h = 900;
min_y = 120;
max_y = 480;
min_x = 50;
max_x = 340;
% Threshold values
min_thresh = 30;
max_thresh = 500;
% Static variables for color
THRESHOLD_VALUE = 2;
MIN_ROW_LINES_BETWEEN_GROUPS = 10; %25... |
% this file computes steady state figures
% firstly, load parameter values
load paramValues
% construct the interval for phi in steady state
intervalLength = 50;
phistInt = linspace(0.25,0.75,intervalLength);
storeUnemployment = zeros(1,intervalLength);
storeWage = zeros(1,intervalLength);
% Here we sol... |
function[]=plotscalingresults5(casrimax,distances,synweight,trunksri)
% replaces zeros (no calcium measured) in the original data with NaN
casrimax=removezeros(casrimax);
[nrruns,nrsegments]=size(synweight); % note nrruns is nrrun+1 because the synaptic weights are defined at the end of the run
... |
%Yes-No Up-Down. Press any key to say that there is a stimulus.
%Step Size = c/n, c = initial step size, n = trial number. Step size
%shrinks as experiment progresses
%Termination after set number of runs (# reversals)
%Threshold calculated via Wetherill method. Average of all peaks and
%valleys (coherence value at... |
function score = score_alignment(s1, s2, s2_offset)
% count how many "same" terms there are
score = sum(s1(1 + s2_offset : end) == s2(1: end - s2_offset));
% turn that into a percentage of the overlap
score = 100 * score / size(s2(1:end-s2_offset), 1);
end |
clc; clear;
% 导入自带的一个一维电压信号, 取前4096个点
load leleccum;
s = leleccum(1:4096);
% 多尺度/级分解:
% 命令: wavedec
[C,L]=wavedec(s,3,'db1');
% 系数提取: 提取经过变换之后的信号: 小波域下的低频系数(近似信息)和高频系数(细节信号), 即"时域→小波域"!
% 说明: 系数提取是多级分解才用!1级分解有就分成2个部分,不需要提取。
% 命令: appcoef低频系数提取; detcoef高频系数提取
cA3=appcoef(C,L,'db1',3); % 低: 3表示第三层
cD3=d... |
function [] = pricing_tf_design_7()
clear all; rehash
sigma = 0.3;
r = 0.05;
T = 90;
S0 = 1;
%% 生成二叉树根
pricer = BinomialPricer;
% pricer.set_params_from_optPricer(oi);
%% 手动设置参数
pricer.T_ = T;
pricer.S_ = S0;
pricer.u_ = exp(sigma * sqrt(1/365));
pricer.d_ = exp(-s... |
%Sorts planes into bins. Takes 150 samples to compute covariance matrix and
%average plane equation. Returns planes and the covariance matrix.
function all_planes = getcov(fileName)
buffer = load(fileName);
[L,M] = size(buffer);
index = 1;
%Divide Data into four sets. The first 275 PLANES are used to comp... |
%estimates the filter coefficients of the minimum phase filter
%design and returns the required filter
function h00=new_fil(L,N)
h0=mov_av(L);
%Filter Design for Length L1(MOMENTUM FILTER/L1)
H00=fft(h0,N);
A0=abs(H00);
%Amplitude
A01=0.01*ones(1,N/2+1);
theta1=1.4*pi/L/6;
theta2=5*pi/L;
N1=rou... |
function J = menjavaBaze(c,A,b,J,izstopna,opcija)
%funkcija menjavaBaze izvede en korak menjave baze v simpleksni metodi.
%Funkcija je namenjena menjavi nezazeljenih spremenljivk v 1.fazi dvofazne
%simpleksne metode (zamnejamo eno dopolnilno spremenljivko za prvo ustrezno)
%
%Vhod:
% c nx1 matrika kriterijske funkcije
... |
function a = task1
a = zeros(10,10);
a(1,:)= 1;
endfunction
|
function plot_Ts(T_arr, Ts_arr, color, line_width, marker, marker_size)
%T_arr = T_arr - T_arr(1);
stairs(T_arr, Ts_arr, color, "LineWidth", line_width);
hold on;
scatter(T_arr, Ts_arr, marker_size^2, color, marker, 'filled');
% Per: https://www.mathworks.com/matlabcentral/answers/454164-marker-size-difference-between... |
%clear;clc;
%% root folder names
dot = "/Users/brandomiranda/home_simulation_research/overparametrized_experiments/";
path_all_expts = fullfile(dot,'pytorch_experiments/test_runs_flatness2');
%% names
%name = "flatness_May_label_corrupt_prob_0.0_exptlabel_Movie_NL0.0_RLNL0.5_WRLNL_Mdist_NL_1.0_Wrlnl_lr_0.01_momentum_0.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.