text stringlengths 8 6.12M |
|---|
function phaseretrieve(obj)
% phaseretrieve - generate pupil function based on a phase retrieval
% algorithm described in paper.
%z=[obj.Zstart:obj.Zstep:obj.Zend];
z = obj.Zpos;
zind=[obj.Zindstart:obj.Zindstep:obj.Zindend];
N=length(zind);
n=obj.PRstruct.RefractiveIndex;
Freq_max=obj.PRstruct.NA/obj.PRstruct.Lambda;
... |
%Written by Patrick Strassmann
function [] = pairComparePlot(inputCell,colorList)
if nargin<2
numElements = max(cellfun(@numel,inputCell(:,1)));
colorList = hsv(numElements);
end
[numRows, numCols] = size(inputCell);
if numCols~=2
error('Number of cols in inputCell must equal 2');
end
for i = 1:numRows
... |
function answer = t_func( a, b )
a = wavread(a);
b = wavread(b);
A = fft(a, length(a)*2);
B = fft(b, length(b)*2);
answer = A ./ B;
endfunction
|
function LG = lgmode(p,l,r,phi)
% lgmode -- LG mode at z = 0
%
% Usage:
% A = lgmode(p,l,r,phi);
% where
% r is in units of the beam width
% r and phi can be matrices of equal size
%
% PACKAGE INFO
LG = sqrt(2*factorial(p)/(pi*factorial(p+abs(l)))) * (sqrt(2)*r).^abs(l) .* laguerre(p,abs(l),2*r.^2) ...
.* exp(i*l*... |
clear all;
close all;
Low = imread('combined.png');
MagFactor = 3;
High = SuperresCode(Low, MagFactor); %%% magnify the input image 'Low' by the factor of 'MagFactor' along each dimension.
High = uint8(High);
imwrite(High,'HighResol.png');
NNLow = imresize(Low, MagFactor, 'nearest');
subplot(1,2,1);
image(NNLow(:,2... |
classdef SimplexPoolLayer < handle
properties
nodeX
nodeY
simplexFeatures
simplexList
nodesMap
collapsedSimplexes
simplexesCollapseMap
processedSimplexes
end
methods
out = splitSimplexes(obj);
function obj = SimplexPool... |
function aligned_spikes = align_spikes( spike_vec, align_mat, align_key )
import shared_utils.assertions.*;
assert__isa( spike_vec, 'double' );
assert__is_vector( spike_vec );
assert__isa( align_mat, 'double' );
assert__is_cellstr( align_key );
assert( numel(align_key) == size(align_mat, 2), 'The align key does not m... |
function byear_school_age_stats_test(setNo)
fprintf('Testing byear_school_age_stats \n');
cS = const_cpsearn(setNo);
% Load stats by [age, school, year]
loadS = output_cpsearn.var_load(cS.vAgeSchoolYearStats, [], setNo);
iu = 1;
iSchool = 2;
% Make stats by birth year from this
byLbV = 1940 : 1960;
byUbV = byLbV;
a... |
% This function is used to calculate cos(beta).
function f = cosbeta(R,r,theta)
f = (R.^2-r.^2)./sqrt((r.^2+R.^2).^2-4.*R.^2.*r.^2.*sin(theta).^2);
end |
function [best,E_F]= HNMEDV6(NE,NS)
% Se seleccionan los parámetros de expansión,
% contracción y reflexión.
gamma=1.7;
beta=0.3;
alpha=2;
% Asignando la n para el problema actual.
n= get_problem_n();
% Asignando los límites de las variables.
bounds=get_problem_bound();
% Calculando el tamaño de la población.
NP=(n+1)... |
function Y = exist(X,varargin)
% delete [Not a public function] Use Java methods to
% test if a file exists, if possible.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
if usejava('jvm')
if nargin>1
if strncmpi(var... |
function M=showmod14files(search)
% display one or more MOD14 Matlab files
% input:
% search file name, or search string
if ~exist('search','var'),
search='';
end
d=sort_rsac_files(search);
d=d.file;
lonlat=[-130 -70 20 60];
for i=1:length(d),
file=d{i};
hold off
v=readmod14('',file);
v.axis=lo... |
close all
clear all
%% Set up save details
str1 = '25-11-15PopulationExperiments';
Scans = 10;
DataSites = 15;
NumImages = 10;
ScanPeriod = 100; % Time taken to return to site in seconds
%%
ExperimentDetails = {'Scans','DataSites','NumImages','ScanPeriod'};
ExperimentDetails{2,1} = Scans; ExperimentDetails{2,2} = DataS... |
function [ Stage ] = CompStage( StageIn, DesignInputs, DesignCriteria, Input, StageNo, Comp, PreviousStage )
if nargin < 7
PreviousStage = -1;
end
% Set output equal to input
Stage = StageIn;
% Extract relevant data from inputs and criteria
RotorDeHaller = DesignInputs.(Input).RotorDeHaller;
StatorDeHaller = Des... |
prompt = 'Enter name of image with extension: ';
imgName = input(prompt, 's');
[filepath, name, ext] = fileparts(imgName);
Img = imread(imgName);
[row, col, ch] = size(Img);
prompt = 'Enter the border size (pixels): ';
border = input(prompt);
if ch == 1
new = uint8(zeros(row+2*border, col+2*border));
for i = 1:... |
function P = EvaluateClassifier( X, W, b )
% K = 10, d = 3072
% X corresponds to an image w size d x n
% W weights, b biases
% P probability for each label, size K x n
n = size(X,2);
s = W*X + repmat(b,1,n);
P = softmax(s); %Softmax(s) = exp(s) / 1'exp(s)
end
|
function PtextRep = EllipticCurvePlaintextRepModp(m, a, b, p, K)
a=-1;
b=188;
p=6563;
K=20;
% a=1;
% b=1;
% p=6563;
% K=20;
% m=55;
if (m + 1)*K >= p
fprintf('Error: With inputted values of K and m, will need to use a larger prime p.\r')
return
end
for i = 0:K-1
x = m*K + i;
r = mod(x^3 + a*x + ... |
function children=getChildren(board,turn)
[row col]=size(board);
head=turn*10+turn;
[hRow hCol]=find(board==head);
moveCount = 0;
if hRow+1<=8 && (board(hRow+1,hCol)==0 || board(hRow+1,hCol)==turn)
moveCount=moveCount+1;
end
if hRow-1>0 && (board(hRow-1,hCol)==0 || board(hRow-1,hCol)==turn)
moveC... |
function [dataCluster codebook] = kmeans_light(data, K)
[N dim] = size(data);
stopIter = .05;
% Initial codebook
codebook = data(randsample(N, K), :);
improvedRatio = Inf;
distortion = Inf;
iter = 0;
while true
% Calculate euclidean distances between each sample and each codeword
d = eucdist2(data, ... |
% In this function, the global graph value in the set named global_nodes
% W: fused graph, initialized by the adjacency graph;
% W_given: the given graph needed to be fused
% gloabl_set: store the index of W_given could be fused;
function W=assignGraphValue(W,W_give,global_set)
[nonzero_row nonzero_col]=find(W... |
load ToneReservationVsEVM
% Figures for radar spreading PAR reduction paper
xind_i = interp1(xind,1:.01:length(xind),'linear');
yind_i = interp1(yind,1:.01:length(yind),'linear');
[gridXi, gridYi] = meshgrid(xind_i,yind_i);
[gridX, gridY] = meshgrid(xind,yind);
mkedB_i = interp2(gridX,gridY,avgpar,gridXi,gridYi,'spli... |
clc, clear all, close all
%Define Robô:
MeuRobo=KUKA_KR3_R540
%Plota Robô na posição master:
plotar(MeuRobo)
%Eqn cinemática direta simbólicas:
[A1 A2 A3 A4 A5 A6]=CineD_simb(MeuRobo);
%Eqn cinemática direta numérica:
%Q = [0 -pi/2 pi/2 80*pi/180 0 0] %Vetor Q 1x6 qualquer
Q=pi/180*[170 -50 10 1 1 1]... |
function [varargout] = InitializeInstr(obj)
% Initialize instrument
%
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
TYP = lower(obj.drivertype);
ErrMsg = '';
if strcmp(obj.interfaceobj.Status,'open')
fclose(obj.interf... |
% Thesis pictures: z coordinate, reference value plotted,
% stop pre-acquiring and transitions.
clear,clc,close all
format shortg
sys = fSysSetup([0,1,4], 'session', 'portable');
% Buffer vectors are used to store data data acquired through the probe.
xbuffer = [];
ybuffer = [];
zbuffer = [];
ang1buffer = [];
an... |
function [B] = GaussJordan(A)
%% GaussJordan.m
% Function performs Gauss-Jordan elimination to invert matrix A
%
% Kyle Bishop, 1/21/2013
%
% INPUT:
% A - square NxN matrix
%
% OUTPUT:
% B - inverse of matrix A
%% Check the dimensions of the input
N = size(A,1); % number of rows in matrix A
M = size(A,2); % number ... |
x = [0.125, 0.125, 0.5, 0.125, 0.125];
%v = 3*x(3)^2+4*x(4)^2
SM = [0 0 1 0 0;
0 1 1 1 0;
1 1 1 1 1;
0 1 1 1 0;
0 0 1 0 0];
vfiber = 0;
vall = 0;
for b = 1:size(x,2)
for g = 1:size(x,2)
if SM(g,b) == 1;
vfiber = vfiber + x(b)*x(g);
end
vall = vall + x... |
% [RTs answer regionlength comptime] = movingwindowQ(mainwindow, fgcolor, bgcolor, stimulus,question,centerMultipleLines,showlegend)
%
% Performs a self-paced moving window reading task on window MAINWINDOW
% with text color FGCOLOR on background color BGCOLOR, then asks
% comprehension question QUESTION afterwards.
%
... |
function [sequence, region] = scan_directory(dir, offset)
% SCAN_DIRECTORY scans a directory for images matching the following
% pattern:
% 00000001.jpg, 00000002.jpg, 00000003.jpg ...
% and returns an ordered cell array of the full file paths to the
% available images that form a video sequence.
sequence = cell(0, ... |
function B=rmatrix(A,S,Z);
B=A+S.*Z;
end |
%% Stelling 3
%
% Wanneer je een zelfgemaakte Matlab functie aanroept die
% niet in de Current Folder of path staat, krijg je een
% foutmelding.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
clc,clear all
addpath('./..');
% Quantity epoch
N= 100;
gen_size =32;
chromosome_size_a = gen_size * 2;
chromosome_size_b = gen_size * 4;
M = [5,4,3,2;
1,4,4,7];
p_reference = [0.6, 0.4];
q_reference = [0.2, 0, 0.8, 0];
u_reference = 3.4;
u = 0;
population_size = 50;
population = [];
disp('Win matrix:');
disp(M);
... |
function output = meanthresh(image, varargin)
% Initialization
numvarargs = length(varargin); % Only want 3 optional inputs at most
if numvarargs > 3
error('myfuns:somefun2Alt:TooManyInputs', ...
'Possible parameters are: (image, [m n], threshold, padding)');
end
optargs = {[15 15] 0.1 'replicate'}; % ... |
function wsMoc = cmuMoc(src, varargin)
% Obtain motion capture data for CMU source.
%
% Input
% src - cmu src
% varargin
% save option
%
% Output
% wsMoc
% prex - prex
% Dof - Dof Matrix, dim x nF
% join - joints related to DOFs
% skel - skel struct for animation
% QC - j... |
bases = [100 230]; %[Sbase, Vbase]
%parametros de redes todos em p.u.
params = [1 2 0.01008 0.05040 10.25/100 0.05125;
1 3 0.00744 0.03720 7.75/100 0.03875;
2 4 0.00744 0.03720 7.75/100 0.03875;
3 4 0.01272 0.06360 12.75/100 0.06375];
%% montagem do triangulo superior da matriz de admitância nodal Y
Y = z... |
function result = Orient(A)
[m,n] = size(A)
if m==4 && n==4
result = A(1:3,1:3)
else
disp("Input invalida")
end
end |
%% function to find the frequence estiamtes of the two signals
% Author: Radha Krishna Ganti
% Motivated by the following papers.
% On-Data-Aided Feedforward Carrier Frequency Offset Estimators for QAM Constellations:
% A Nonlinear Least-Squares Approach
%
% Basic idea is that only 4th power E[X^4] is not equal to zero... |
function [normal_range ] = Give_ref_range
normal_range=[{'BAND',0,0.3,20;'BASO',0,0.15,0.15*50;'EOS',0,0.9,0.9*50;'HCT',36,48,75;'HGB',11.5,16.40,11.5*5;'LYM',0.800,4.800,600;'MCH',27,33,33*2;'MCHC',32,36,36*2;'MCV',80,95,95*2;'MONO',0.100,0.9000,0.9*100;'NEUT',1.80,7.6,7.6*50;'PLT',150,450,150*20;'RBC',3.90,6,6*1.5;'R... |
% plt50.m ------------------------------------------------------------
%
% This script is similar to plt5.m except the number of functions plotted has
% been increased to 50 to demonstrate the use of the TIDcolumn parameter.
% Normally the legend is rendered in a single column; but with this many
% traces, the trace ID... |
clearvars
% close all;
load('session_zandvoort_laps36-52_20130627_0931_v1.mat')
%% select desired laps
ind = Lap<0;
% for i=[39 40 41 44]
for i=[36:44 49:51]
% for i=41
ind = or(Lap==i, ind);
end
Lap(~ind)=[];
Distancem(~ind)=[];
Xpositionm(~ind)=[];
Ypositionm(~ind)=[];
Speedms(~ind)=[];
... |
% Problem Set 4_3
% Falkner-Skan Eqn Solver using shooting method
% By Chiyu 'Max' Jiang
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Part 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Find the critical value of beta
s1 = 10;
beta_crit = bisection(-0.1,-0.2,@(beta) evalFS2(beta,s1));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Part 1 %%%%%%%%%%%%%... |
num=xlsread('xztime.xlsx', 'A1:C90'); %读取出该区域的数据作为表格
A=num(:,1); %从B矩阵取出第一列的所有行
B=num(:,2);
C=num(:,3);
xx=linspace(min(A),max(A),100); %产生min(A)到max(A)均摊的50个点,目的上拟合离散点数量上的不足
yy=linspace(min(B),max(B),100);
[xt,yt]=meshgrid(xx,yy); %做成二维网格
zt = griddata(A,B,C,xt,yt,'nearest'); %用v4点的方式进行填充
figure
surf(xt,yt,zt) %输出结... |
clc; clear all;
%%% Ackermann steering model of robot simulation
%%% Inputs
% dur - Duration of simulation (secs)
% dt - time step (secs)
% phi - angle of turn (radians)
%L = length of robot (cm)
dur = 300;
dt = 0.2;
phi = 0.1;
L = 5;
%Noise parameters
measnois_dis = 4; %SD of distance Measurement noise
measnoi... |
% Adımda resimde her bir madeni paradan kaç adet olduğunu saydırma
%% 1-Önce resmin olduğu dosya okunur.
%% 2- Resmin arka planı yok edilir.
%%Dikkat ilgilenilen eleman beyaz,arka plan siyah olacak
I=paralar(:,:,1)/3+paralar(:,:,2)/3+paralar(:,:,3)/3;
%I=rgb2gray(I);
I=255-I;
imshow(I);figure
background=imopen(I... |
function y=hier_clus(Dir_data,num_seq,burn_in,iter)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
if(Dir_data(end)~='/')
Dir_data=[Dir_data,'/'];
end
eval(['cd ' Dir_data])
set(0,'RecursionLimit',1000000)
for ind_seq=1:num_seq
truth=textread(['tru_str_',num2str(ind_seq)],'%s');
truth=truth{1};
N=length(trut... |
function [steeringVec] = gridSampleBackscatter3D(delay,aoa,aod,AS_vec,DS_vec,calib_const)
% % % Input
%
% % % Output
%
cc = calib_const;
aoaSteering = exp(-1j*2*pi*AS_vec'*cc.fc/cc.C*cos(aoa));
aodSteering = exp(-1j*2*pi*DS_vec'*cc.fc/cc.C*cos(aod));
delaySteering = exp(-1j*2*pi*cc.f(1:cc.F)'*delay);
steeringVecDelayA... |
function [ M ] = reverse_diag( n )
%REVERSE_DIAG Summary of this function goes here
% Detailed explanation goes here
M = zeros(n);
M(1:n-1:n^2) = 1;
M(1 ,1) = 0;
M(n ,n) = 0;
M(1 ,n) = 1;
end
|
% Create the template
clc
clear all
close all
inImg = imread('sidewalk_iphone.jpg');
dim = ndims(inImg);
mag = 100;
% rgbImg = inImg;
if(dim == 3)
%Input is a color image
% inImg = imnoise(inImg,'gaussian',0,0.02);
colImg = inImg;
inImg = rgb2gray(inImg);
end
inImg = im2double(inImg);
inImg = imresize(i... |
% example of how to call gbvs with default params
img = imread('/media/dberga/DATA1/repos/metrics_saliency/input/images/tsotsos/4.jpg');
out_gbvs = gbvs(img);
out_itti = ittikochmap(img);
subplot(2,3,1);
imshow(img);
title('Original Image');
subplot(2,3,2);
show_imgnmap(img,out_gbvs);
title('GBVS map overlayed');
... |
classdef junction
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties
junctionID = [];
vertex1 = [];
vertex2 = [];
junctionCoordinates = [];
junctionLength = [];
midpoint = [];
angle = [];
neighboursID =... |
function [fval] = newMatchWageEmplDispBS(z_TLTS,emp_targets,rw_targets,disp_target,mean_l,mean_m,mean_s,corr_lm,corr_ms,corr_ls,AL,AM,AS,param)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% New strategy: under the current guess z_TLTS, find the unit wage that
%%%% closes the economy. ... |
mtype='clust';
n=10;
Xo=mvnrnd(zeros(1,n),eye(n),50 )';
Wo=WfromX(Xo);
mo=ls_network_metric(Wo,mtype);
mo=ls_corrnetwork_metric(Xo,mtype);
idx=1;
tidx=1;
X=Xo;
X(idx,tidx)=X(idx,tidx)+10;
W=WfromX(X);
[Y my ity]=optimise_corrnetwork(X,idx,tidx,{mtype},{mo});
Wy=WfromX(Y);
[Ww mw itw]=optimise_network_multi(W,{mtyp... |
clear;clc;
%//////////////////////////////////////////////////////////////////////
organ_cult_dir = "R:\funded_projects\Grytz-R01EY026588-Scleral_remodeling_in_myopia\organ_culture\analysis";
% directory and file naming schema set up
prompt_exp_number = 'Enter the exp number for this experiment: ';
exp_number = input(p... |
function wordMatchDistribution(bins,property,varargin)
% wordMatchDistribution(bins,property,varargin)
%
% Purpose
% Given a reference word list, create a non-word list whose distribution in
% regards to a statistic of your choosing is matched. This is done through
% a process of binning and counting, and thus ... |
%调查问卷随机数据
Q1 = [179 348 98];
Q2 = [333 292];
Q3 = [9 188 278 100 35 15];
Q4 = [348 277];
Q5 = [113 129 187 100 75 21];
Q1_ans = RandomBox(3,Q1);
Q2_ans = RandomBox(2,Q2);
Q3_ans = RandomBox(6,Q3);
Q4_ans = RandomBox(2,Q4);
Q5_ans = RandomBox(6,Q5);
number = 1:625;
data = [Q1_ans,Q2_ans,Q3_ans,Q4_ans,Q5_ans];
group_... |
fun = @root2d;
x0 = [x_values(1,1),x_values(2,1)];
exact = fsolve(fun,x0); |
%--------------------------------------------------------------------------
% Single POINT Positioning (SPP) using pseudorange AND phase observations
% ------------------------------------------------------------------------
% Coder : Mohammed Abou-Galala
% Date : 13-10-2021
%----------------------------... |
function Q=setfsize(m,n)
%
figrect=get(gcf,'Position');
set(gcf,'Position',[figrect(1:2),m n]); |
function o=fcnPSVG(y,opt)
% y is the time series o is the negative of the log-log slope
% opt=1 plots the log-log slope and point values
if nargin<2
opt=0;
end
[P, x] = countGraphEdges(y);
p=polyfit(log(2:x-1),log(P(2:x-1)),1); %find the power law slope
if opt==1
ln=length(y);
kk=1:ln;
... |
function finalfig2()
% Final Project Figure 2
% By Chiyu 'Max' Jiang, May 6, 2016
c = 1; % Case #, choose 1 or 2
if c == 1
% kh = 3.144001302391963;
% wN = 0.447124652770773;
kh = 3.144772;
wN = 0.4472136;
xmax = 750;
else
% kh = 5.130304194261720;
% wN = 0.477926973672925;
kh = 5.1324... |
clear all
close all
addpath('./main');
% load Function Path
addpath('./LoadData');
addpath('./Preprocessing');
addpath('./FeatureExtraction');
addpath('./DimensionalityReduction');
addpath('./Classification');
addpath('./evaluation');
addpath('./detection');
% load the path of images
addpath('./images/neg');
addpath... |
function getModel(modelType,samplesNum)
%计算cal_A产生的model对于Test文件夹的图片的效果,并进行记录到model中。
%model存储为'\feature\models\xx.mat'形式。
% modelType:需要模拟的滤镜类型,比如dy,fg等等。
% sampleNum:设置的采样点个数。
A = zeros(3,4);
sumA = zeros(3,4);
%--------------------------------暂时有12种modelType可供选择--------------------------
file_path = []; %原图路径
file... |
function [SS_e,s_e,SS_total,r_sq,r_sq_adj] = validation_3var(x1v,x2v,x3v,noise,b)
global x_1
global x_2
global x_3
y_real = zeros(length(x1v)*length(x2v)*length(x3v),1);
yv = zeros(length(x1v)*length(x2v)*length(x3v),1);
for i = 1:length(x1v)
for j = 1:length(x2v)
for k = 1:length(x3v)
x_1 =... |
M1 = dlmread('anglesIn.txt1');
sp1 = M1(:,1);
sr1 = M1(:,2);
ep1 = M1(:,3);
ey1 = M1(:,4);
s = size(sp1, 1);
s1 = size(sp1, 1) / 10;
sp_est1 = zeros(s1, 1);%M_est(:,1);
sr_est1 = zeros(s1,1 );%M_est(:,2);
ep_est1 = zeros(s1,1);%M_est(:,3);
ey_est1 =zeros(s1,1);%&M_est(:,4);
time = zeros(s1,1);
time2 = zeros(s,1);
sum1... |
function [D,P,D_chirp,D_chirp_rb]=create_dictionary()
load ('spike_location.mat')
load ('B_G.mat')
n=6;
for i=1:size(spike_location,2)
D(i,:)=double(B_G(19,spike_location(i)*200-35:spike_location(i)*200+35));
P(i,:)=reshape(find_chirplets(D(i,:),n),[1 5*n]);
% 'D'
% siz... |
%this script tests the subSolver, that is, the function for solving the subproblem of
%reachability. Different instances are testes until an error is found.
clear all;
rng('shuffle');
err = 1e-6;%tolerance
penaltyFactor = 5;%higher this value, faster the penalty function growing
nLevels = 2;%nLevels^n=number of initi... |
function id=imgre(ind)
% step0 生成参数
param=par_init();
% step1 图片稠密取样的sift特征
if ~exist('sift.mat','file') && ~exist('sift','var') % 不存在 计算并保存
if param.parallel
if matlabpool('size')<=0
matlabpool open local;
end
parfor i=1:param.nimgs
imgpath=[param.imgdir num2st... |
function xCorrRefs(resPockelsBorder,hSI)
pix2um = [-1.9 1.85 0];
%Load movies and calculate reference images (can change to mean for speed)
iRefFile = uigetfile([hSI.loggingFilePath '\*.tif'],'Choose Reference Image');
nRefFile = uigetfile([hSI.loggingFilePath '\*.tif'],'Choose Recent Image');
[iMov,iMovProps] = tiff... |
%% write_addStat
% writes a structure with all pars and stats for selected entries
%%
function [allStat, info] = write_addStat(taxa, T, f)
% created 2016/11/18 by Bas Kooijman, modified 2017/08/16
%% Syntax
% [allStat, info] = <write_addStat *write_addStat*> (taxa, T, f)
%% Description
% Appends/overwrites result of... |
function isOk = validateAirfoils(e1, e2, bl_thickness, check_angle)
isOk = true;
if ~issimplified(e1) || ~issimplified(e2)
isOk = false;
return
end
% if overlaps(polybuffer(e1, 2*bl_thickness), e2)
% isOk = false;
% return
% end
if check_angle && e2... |
function [x_0, y_0, x_1, y_1] = ClosestPoints(X, Y, x)
% X
% x
for i = 2:length(X)
if x <= X(i)
x_0 = X(i-1);
y_0 = Y(i-1);
x_1 = X(i);
y_1 = Y(i);
return;
end
end
x_0 = X(length(X));
y_0 = Y(length(X));
x_1 = X(length(X));
... |
%Jorie Noll
%Lab 7
m1 = .4;
m2 = .7;
m3 = .7;
m4 = .2;
m5 = .6;
m6 = .4;
k1 = 3.9;
k2 = 3.2;
k3 = 2.2;
k4 = 2.7;
k5 = 1.3;
k6 = 4.9;
k7 = 4.4;
c1 = .016;
c2 = .036;
c3 = .028;
c4 = .014;
c5 = .032;
c6 = .024;
c7 = .012;
A11 = [ 0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 ... |
function y=Lagrange(x0,y0,x)
%Input -x0 n*1矩阵,已知点的横坐标
% -y0 n*1矩阵,已知点的纵坐标
% -x m*1矩阵,插值点的横坐标
%Output -y m*1使用Lagrange插值多项式求得的插值点的函数值
n=length(x0);%已知点的个数
m=length(x);%插值点的个数
for i=1:m
z=x(i);%z:第i个插值点
s=0;%累加器清零
%以下计算Ln(x(i))
for k=1:n
p=1;%累乘器赋初值1
... |
%% link3_learnImp.m
% *Summary:* Main file for learning planar Peg-in-Hole insertion task.
% Probabilistic model-based RL,
%
%
%
%% High-Level Steps
% # Load parameters
% # Create J initial trajectories by applying random controls
% # Initialise policy with hand-picked targets
% # Controlled learning (train dynamics m... |
function directive_companion_find(args)
timeSeriesData = []
timeSeriesFiles = FILE(args.timeSeriesFiles)
for i=1:length(args.timeSeriesFiles)
timeSeriesData = [timeSeriesData;str2double(mloadtimeseries(timeSeriesFiles(i).FullName))];
end
[~,so] = sort(timeSeriesData(:,1));
timeSeriesData = timeSeriesDa... |
% function to fix the size of the gradient in the figure
% this is needed because if the figure is scaled really small
% the gradient will sometimes not be contained to the
% axis of the figure not sure why
function resizeGradient(currentFigure)
h = findall(currentFigure, 'type', 'axes');
set(h(2), 'Position', get(h(... |
clc
% x0 = 30;
fun = @(x0) fft_laptime_vis(x0);
% v = fminsearch(fun, x0);
t = fft_laptime_vis(x);
% disp(['Laptime in simulated lap = ' datestr(t / (24*60*60), 'hh:MM:SS.FFF')])
|
function [Results,ResultsOnlyNum]=Behavior_acc_RTs_SeparateTaskNumChanges()
warning('off','all')
rmpath('/Volumes/Oded/Bein/fMRI_course/AnalysisScripts');
engram=0;
if engram
proj_dir='/data/Bein/TickyReanalysis';
else
proj_dir='/Volumes/data/Bein/TickyReanalysis';
end
%subjects={'JA';'JG';'JW';'YE'; 'AR'}; ... |
function cancel = EyelinkFixationControl(time, el, Then, ResetAbort)
% variant = is this during the context phase (1) or test stimulus (2)?
Now = GetSecs(); cancel = 0;
while (Now - Then) < time && cancel ~= 1
Now = GetSecs();
[~,~, keyCode] = KbCheck;
if keyCode(KbName('F3')); cancel = 1;
elseif keyCo... |
function [k,rho,kSuggested]=chooseBestk(X,option)
% Model selection. Search the best k for NMF based clustering from 1 to sqrt(#column).
% X: matrix, as input of a NMF
% option: struct,
% option.rerun: scalar, the time of reruning NMF for a k, the default is 3;
% option.numClasses: scalar, number of the real class... |
function [] = sendSpeeds( s, zumoID, v_L, v_R )
%UNTITLED Summary of this function goes here
leftSpeed=v_L+128;
rightSpeed=v_R+128;
if leftSpeed == 0
leftSpeed=1
end
if rightSpeed == 0
rightSpeed=1
end
switch zumoID
case 1
destinationAddress_hex = ['00';'13';'A2';'00';'40';'D6';'A6';'80'];
c... |
% sgems_set_resim_data : Select and set a region to resimulate.
%
% Call
% S=sgems_set_resim_data(S,D,lim,pos)
%
% S : SGEMS structure
% D : completete conditional data set (e.g. S.D(:,:,1)');
% lim : lim(1) : horizontal radius (in cells)
% lim(2) : vertical radius (in cells)
%
% pos : center po... |
function [num] = read_DMM(COMdmm,exposure)
%READ_DMM Summary of this function goes here
% Detailed explanation goes here
writeline(COMdmm, 'FETC?') %send internal memory to BUS
pause(exposure*2)
num = readline(COMdmm);
format long
num=str2num(num);
end
|
function plotSweepRespStd(responses, kernelTimes, response_name,y_limit)
justMean=0;
% define parameters
[nRoi, nStim, ~ , ~] = size(responses);
kernelTimesPatch = [kernelTimes, fliplr(kernelTimes)]';
%%
% Number of cells per figure and of figures
if nRoi >= 10
cellsPerFigure = 10;
else
cellsPerFigure = ... |
% Copyright 2013 Marco Aurelio Barbosa Fagnani Gomes Lotz
%
% Licensed under the Apache License, Version 2.0 (the "License"); you
% may not use this file except in compliance with the License. You may
% obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless requ... |
function [ stdCell ] = getStdCell( N, type )
%getStdCell std cell warp function to get the specific cell object
% Detailed explanation goes here
switch type
case enumStdCell.Point
stdCell = StdPoint(N);
case enumStdCell.Line
stdCell = StdLine(N);
case enumStdCell.Tri
stdCell = Std... |
function time = getNextVisibleTime(obj)
% GETNEXTVISIBILITYTIME Gets the time that the message will next be visible
% The time is returned as a datetime.
% Copyright 2019 The MathWorks, Inc.
timeJ = obj.Handle.getNextVisibleTime();
time = datetime(timeJ.getTime()/1000,'convertfrom','posixtime','TimeZone','UTC');
end... |
% Spectral Ewald 0P (free-space) Laplace, force computation
clear
rng(1);
N = 10; % number of source particles
L = 1; % box side length
box = [L L L]; % periodic box
[x, f] = NEW_vector_system(N, box); % random sources
Neval = N; % number of evaluation points
% Ewald parameters
M0 = 28; % Set M0 to an even number, t... |
function [neuron_pairs, channel_nums] = pair_nearby_neurons(metadata)
monkey = metadata.monkey;
channel = metadata.channel_num;
iso_qual = metadata.iso_qual;
depth = metadata.depth;
monkeys = {"quincy", "wahwah"};
iso_qual_mask = iso_qual >= 3;
neuron_pairs = []; % [2 (inds) x pairs]
channel_nums = [];... |
% Calculates the angle of attack of a vehicle at a given speed
% Returns -1's if vehicle cannot sustain lift
% Returns -1's if iterator does not converge
% numMotors & motorRPM are number of motors and RPM of motors respectively
% propDiameter and propPitch are diameter and pitch of propeller
% respectively, in in... |
function [yint,ypint] = ntrp23t(tint,t,y,~,ynew,h,z,znew,idxNonNegative)
%NTRP23T Interpolation helper function for ODE23T.
% YINT = NTRP23T(TINT,T,Y,TNEW,YNEW,H,Z,ZNEW,IDX) uses data computed in ODE23T
% to approximate the solution at time TINT. TINT may be a scalar or a row vector.
% The argument TNEW doe... |
clc;
clear all;
close all;
maxepoch = 2^10;
beta = [0:1/1000:0.5 0.5:1/10000:0.9 0.9:1/10000:1.0];
numruns = 100;
converter;
makebatches;
numhid = 500;
[numcases numdims numbatches]=size(batchdata);
testbatchdata2 = rand(10000, numdims) > 0.5;
vishid0 = 0.01*randn(numdims, numhid);
hidbiases0 = zeros(1, numhid);
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Main
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Metadata
% Written by : NathanaŽl Esnault
% Verified by : N/A
% Creation date : 2016-03-05
% Version : 1.0 (finished on ... |
function Rs = ReliabSensor(NS,S1,S2,S3,REL_SENS)
% ReliabSensor.m
%
% Rs = ReliabSensor(NS,S1,S2,S3,REL_SENS)
% %NS - integer, number of sensors
% %Si - Integer {1,2,3} type of sensor
% This function returns the sensors' reliability vector Rs necessary to call
% the CalcReliability function
% Parameter: a... |
function [ wordsLength ] = getWordsLengthFromLine( SL_Image )
wordsLength = [];
begEndIsIndexes = getLettersBegEndIsIndexes(SL_Image);
%add 4 column with sign width
begEndIsIndexes = [begEndIsIndexes (begEndIsIndexes(:, 2) - begEndIsIndexes(:, 1))];
%remove first sign is white sign
... |
function [y_output]=knn(k,X_train,Y_train,x_input)
Y2=Y_train';
m=size(X_train,1);
n=size(x_input,1);
d=size(X_train,2);
% a=repmat(x_input',m,1);
% b=(reshape(a,[d,m*n]))';
b=kron(x_input,ones(m,1));
X1=repmat(X_train,n,1);
dis=sum((b-X1).^2,2);
[distance,index]=sort(reshape(dis,[m,n]));
y_output=(sign(sum(Y2(index(1:... |
clc;
close all;
clearvars -except testsData ;
selectedtests = 1:length(testsData);
selectedGraphs = 1: size(testsData{1},2);
selectedPeople = 1: size(testsData{1},1);
featureBank = fieldnames(testsData{1}{1,1});
selectedFeature = featureBank([5 6 13 14]);
%%
cols = length(selectedPeople);
rows = length(selectedFea... |
function DrawFixationCroos(WindowPtr,crosslines,crosswidth,crosscolor,xCenter,yCenter)
% ====================== YOUR CODE HERE ======================
% hint: Draw fixation cross using DrawLines
Screen('drawlines',WindowPtr,crosslines,crosswidth,crosscolor,[xCenter,yCenter]);
Screen('Flip',WindowPtr);
%============... |
close all;
clear all;
% load and split data, 60% trn - 20% chk - 20% tst
data = load('haberman.data');
preproc = 1;
[trnData, chkData, tstData] = split_scale(data, preproc);
% clusters' size and rules' number defined by radius' values [0,1]
% need 2 outliers for each of the 2 cases examined:
% class depen... |
function [ X ID ] = MGS_with_norm_sort( A )
%MGS_with_norm_sort Orthogonalize the columns of A, with sorting
%by column 2-norm during each iteration.
% The purpose of the function is to generate a matrix with orthogonal
% columns. This is done via the Modified Gram-Schmidt process with an
% additional modi... |
function [t,xk] = sig_reconstruct(Kcoeff,fs,N)
% Given the DFT coefficients, we chop it in half from N/2+1 to N/2.
lengthKcoeff = zeros(N/2+1,1);
lengthKcoeff(1:length(Kcoeff)) = Kcoeff;
% Compute the iDFT
[t,xk] = myidft(lengthKcoeff,fs);
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.