text stringlengths 8 6.12M |
|---|
function bptc=ea_bpfilter(tc,TR,sampleLength)
lp_HighCutoff=0.08;
hp_LowCutoff=0.009;
% disp('Bandpass-filtering...');
% sampleFreq = 1/TR;
paddedLength = rest_nextpow2_one35(sampleLength); %2^nextpow2(sampleLength);
mask=ones(size(tc,1),1);
mask(:)=1;
maskLowPass = repmat(mask, [1, ... |
function [Distance,DO2,chrom1]=juli2(A,leng)
%storage=[T;l;R;D;list;amount;];
a_1=A(10,:);a_2=A(9,:);b_1=A(8,:);b_2=A(7,:);c_1=A(6,:);c_2=A(5,:);d_1=A(4,:);d_2=A(3,:);e_1=A(2,:);e_2=A(1,:);
a_1(a_1==0)=[];a_2(a_2==0)=[];b_1(b_1==0)=[];b_2(b_2==0)=[];c_1(c_1==0)=[];c_2(c_2==0)=[];d_1(d_1==0)=[];d_2(d_2==0)=[];e_1(e_1... |
function C=SODWkqwAx(AX,X,W)
% function C=SODWkqw(X,W)
%
%
% Returns the sum of all weighted outer products
%
% C=A*\sum_{i,j} (X(:,i)-X(:,j))(X(:,i)-X(:,j))'*W(i,j)
[~,n]=size(X);
Q=W+W';
C=(bsxfun(@times,AX,sum(Q)))*X'-(AX)*(Q*X');
|
function s = stdnonan(x, dim)
if ~exist('dim', 'var')
dim = 1;
end
x1=x;
x1(isnan(x1)) = 0;
m = sum(x1,dim)./sum(~isnan(x),dim);
r2 = sum((x1).^2,dim)./sum(~isnan(x),dim);
s = sqrt(abs(r2-m.^2));
|
%
if strcmp(OCTAVE_VERSION,'3.4.3')==1
addpath('/home/xyy/matlabcode/NUFFT_code/NUFFT_code/old_correct/NUFFT_code');
else
addpath('/home/xyy/matlabcode/NUFFT_code/NUFFT_code/NUFFT_code');
end
tocs = @(st) fprintf('%s: t = %6.3fs\n', st, toc());
len = 1e5;
X = gdata(len,2,2);
mlen = 512; ... |
%Implementation of the Gaussian mixture PHD filter in
%B.-N. Vo and W.-K. Ma, “The Gaussian mixture probability hypothesis density filter,” IEEE Trans. Signal Process., vol. 54, no. 11, pp. 4091–4104, Nov. 2006.
%Performance is measured with the GOSPA metric (alpha=2) and its
%decomposition into localisation errors f... |
classdef CellClass
%% cell clas
properties
X
Type %% 1 --> ag 2 ---> mono
Ext %% (array-structure)IDs of extenal Cells
Int %% (array-structure)IDs of internal Cells
Tris %% (cell-structure) of matrices [ntr... |
function [ bestBoard, score ] = findOptimalMove( board, turn, agentTurn, scoreAgent, scoreOpp )
% generate all possible immidiate children
[ children, scores ] = generateChildren( board, turn, agentTurn, scoreAgent, scoreOpp );
[ r c l ] = size( children );
maxScoreList = zeros(1, l);
%... |
function a = LineSearch( fun, grad, x, p, c1, c2, a1, aMax)
%LINESEARCH Summary of this function goes here
% Detailed explanation goes here
% c1 = 1e-3
% c2 = 0.9
% a1 = 1;
a = a1;
i = 1;
f0 = fun(x);
g0 = grad(x)'*p;
fOld = f0;
gOld = g0;
aOld = 0;
while 1
xNew = x+a*p;
fNew = fun(xNew);
if fNew > f0 +... |
%Sandra Hanekamp, 2017
%How to use AFQ_run
%with mrtrix tractography and cleaning settings
% Create a cell array where each cell is the path to a data directory
Dir = '/path/to/your/subjects/dir'; %change this to your subjects directory path
Subj = importdata('/list/of/your/subjects.txt'); %change this path to a tex... |
%Written by Frans Nordén
%Last changed 2016-12-29
function [ max_hull_force_and_freq ] = calculate_max_hull_force_and_frequency( F0, frequency_data, K, C, M, k2, c2)
%calculate_max_hull_force_and_frequency
% loops through a list of amplitude and frequencies
% and decides based of formulas what the greatest force... |
classdef SaccadeTool < handle
methods ( Access = private )
function obj = SaccadeTool()
end
end
methods ( Static )
function sac = Saccade()
sac.latency = [];
sac.duration = [];
sac.angle = []; % in degrees
sac.amplitude = [];
sac.termiPoints = single([]); % 2-by-2: 1st column f... |
function dydt = systdyn_5modes(t, y, res, g, z, s)
%SYSTDYN_5MODES Fonction de mise a jour des p et dp pour un systeme a 5 modes
% Inputs :
% t : Temps ou l'on calcule ca (a priori, inutile)
% y : Vecteur de taille 1 x 10 qui contient p et dp au temps précédent
% res : Pulsations, Q, facteurs modaux des 5 modes
%... |
function [w1,w2,w3,g]=train(num)
% clear
% clc
% num=0;
I=my_train(num);
x=I;
y=0.01*num+0.001;
N=1000;
%
[x_row,x_col]=size(x);
%
hiddnum1=30;
hiddnum2=30;
w1=rand(x_col,hiddnum1);
w2=rand(hiddnum1,hiddnum2);
w3=rand(hiddnum2,1);
learn_rate=0.01;
for i=1:N
... |
function T = time_matrix(t,n)
T = zeros(2*n);
for i = 1:2*n
den = 1-i:2*n-i;
d = factorial(0:2*n-1)./factorial(den.*(den>0));
mask = [zeros(1,i-1) ones(1,2*n-i+1)];
assignment_1 = d.*t.^((1-i:2*n-i).*((1-i:2*n-i)>0));
assignment_1(~mask) = 0;
T(i,1:2*n) = assignment_1;
end |
function [] = rmvRSB()
%RMVRSX Remove RSX libraries from Java path
% Detailed explanation goes here
javarmpath /public/amarsi_workshop/lib/rsb.m-0.5.0.jar
javarmpath /usr/share/java/rst.jar
javarmpath /usr/share/java/rstsandbox.jar
javarmpath /usr/share/java/RSBJava-0.5.0.jar
javarmpath /usr/share/java/protobuf.jar
c... |
%Matt Miccio
%MATLAB Project 1
%This project creates one million sample resistors of 10Ohm, 100Ohm, and
%1000Ohm, each with 1% tolerance. It creates four different graphs for each
%resistor group. The first two are the first 100 resistors, and the second
%two are a random group of 100 (SHOWN IN RED). The first line of ... |
clc
clear
close all
tic
figure(1) ;
hold on
% ezplot('x*sin(10*pi*x)+2',[-1,2]);
ezplot('1/(x+2)*sin(50*pi*x)+2',[-1,2]);
%参数设置
fishnum= 50;
MAXGEN = 50;
try_number = 100;
%感知距离
visual = 1 ;
%拥挤度因子
delta =0.618;
%移动步长
step =0.1;
%初始化鱼群
% lb_ub = [-3.0,12.1,1,4.1,5.8,l];
% 这里lb_ub是2行3列的矩阵,每行中前2个数是范围的上下限,
%... |
function [x_all, f_all, c_all, lambda_all, grad_L_norm_all, nb_iter, nb_eval, rho_all, nb_eval_all] = test_MHW4D(choix, max_iter, max_eval, rho, eps, max_rho)
%%% --- Test du cas test 1 : MHW4D ---%%%
% Solution donnée dans le polycopié
sol_poly = [-1.2366; 2.4616; 1.1911; -0.2144; -1.6165];
[f_poly, c_po... |
function X = zeroshift(X,k)
[m,n]=size(X);
X = circshift(X,k);
if k(1)>0
X(1:k(1),:)=0;
elseif k(1)<0
X(m+k(1)+1:m,:)=0;
end
if k(2)>0
X(:,1:k(2))=0;
elseif k(2)<0
X(:,n+k(2)+1:n)=0;
end
end
|
function loadFileAndPlot(matFilesToLoad, indTotal, outputPathLocal, masterOverall, masterSave1)
outputPath = outputPathLocal;
checkMkdir(outputPath);
rmse_fct = @(a,b,c) sqrt(sum(sum((a-b).^2))/(size(a, 1)*size(a, 2)));
nowStr = datestr(now, 'yyyy_mm_dd_HH_MM_SS');
nowStr = '';
for ind = 1:le... |
clear all;
% tmp = matlab.desktop.editor.getActive;
% cd(fileparts(tmp.Filename));
% if strcmp(getenv('USER'),'paulkrueger')
% % cd ~/Desktop/Tom_Griffiths/collapsingBoundsExp/matlab_code/
% addpath(genpath('~/Documents/MATLAB/Add-Ons/Toolboxes/Markov Decision Processes (MDP) Toolbox'))
% else
% % Falk pa... |
setParameters;
closePort();
openPort();
tic
% pozadej o mereni
fprintf(s, '%c', 'q');
for g=0:5
if ((bitand(outputForm, 2^g) > 0))
receiveMetadata;
% receive compressed image
if (image.outputForm == 1)
receiveCompressed;
disp('Compressed');
else
... |
function [fxy fcorr] = crossrefract(rgx,rgy,tR,tC);
% USAGE:
% [fxy fcorr] = CROSSREFRACT(rgx,rgy,tR,tC)
%
% INPUTS:
%
% CROSSREFRACT computes the fraction fxy of rogue spike in the merged
% spike trains. fcorr is an attempt to normalize it relatively to the
% number of spikes in each individual spike train (n... |
function metadata = dicom_prep_GeneralImage(metadata)
%DICOM_PREP_GENERALIMAGE Set necessary values for General Image module
%
% See PS 3.3 Sec C.7.6.1
% Copyright 1993-2003 The MathWorks, Inc.
% $Revision $ $Date $
image_time = now;
ImageDate_name = dicom_name_lookup('0008', '0023'); %Content Da... |
%% pull_grid_data.m
% Usage: pull_grid_data(dir, ts, te, options)
% Purpose: pulls grid data from a given set of cgns files and saves it as a
% .mat file
%
% User Inputs
% dir - the simulation directory you wish to work with
%
% TODO: add NX,NY,NZ
function pull_grid_data(dir)
addpath ~/bluebottle/tools/ma... |
%% 6.438 FALL 2015
%% MAIN FILE FOR PART I OF PROJECT
% Will Whitney
% make sure you have unzipped all the given files in the same dir...
clc; close all; clear;
%
compressed_file_name = 'mcoli_rate_high'; % compressed file name (can modify)
% - mcoli_rate_high
% - mcoli_rate_moderate
% - mcoli_rate_low
%
fpr... |
function s_list = gen_s_list(maxL, r_cut, N)
% Generate list with number of radial frequencies for volume expansion for
% each L-subspace of spherical harmonics
%
% Inputs:
% * maxL: cutoff for spherical harmonics expansion
% * r_cut: assumed bandlimit for the volume (and the projections)
% * N: radius of the su... |
function h = myfig(namestr)
% Short for myfigure.
%
% See also myfigure.
% Copyright(c) 2009-2014, by Gongmin Yan, All rights reserved.
% Northwestern Polytechnical University, Xi An, P.R.China
% 15/02/2014
if ~exist('namestr','var')
h = myfigure;
else
h = myfigure(namestr);
end
|
% Code compares Classic LB to modified LB
%for ii = 1:3
%clear;% clc; %close all;
%rng(6)
%Toy Dimensions
dToy = 200;
m = dToy;
dToySol = 1000;
n = dToySol;
%create compressible vector
%xTrue = rand_exp_decay(n,0.0001,sqrt(5));
xTrue = zeros(n, 1);
idx = randperm(n);
elem = idx(1,1);
for ii= 1:floor(n/5)
xTrue(idx... |
function ys = fast_smooth2(y);
[r,c] = size(y);
if r<3 | c<3
error('fast_smooth2 does not work on matrices less than 3-by-3 - quitting.')
end
for k = 1:c
for j = 1:r
if k==1 & j==1
ys(j,k) = mean([y(j,k) y(j+1,k) y(j,k+1)]);
elseif k==1 & j==r
ys(j,k) = mean([y(j,k) y(j-1,k) y(j,k+1)]);
elseif... |
function out = tensor_connectivity2(p,h,band)
tr=size(p{1},1);
fr=size(p,2);
if nargin<4
band=1:fr;
end
nelems=size(p{1},2);
out=zeros(nelems,nelems,fr);
for k=band
for i=1:nelems
for j=1:nelems
X=p{k}*h;
if (i~=j)
out(i,j,k)=abs(me... |
% Laboratorium nr 5
setenv GNUTERM 'x11'
% 1. Wplyw rzedu na charakterystyke
figure(1);
h = fir1(1, 0.5);
freqz(h, 1);
print(["out/fig1.png"], "-dpng", "-landscape");
figure(2);
h = fir1(10, 0.5);
freqz(h, 1);
print(["out/fig2.png"], "-dpng", "-landscape");
figure(3);
h = fir1(20, 0.5);
freqz(h, 1);
print(["out/f... |
%sort given matrix. input = matrix, mode
%if mode = 1 then sort columns, if 2 sort rows
function f = sortMatrix(A,n)
f = sort(A,n); |
%clear all
close all
clc
%% Test DS
disp('- DS test');
% specify database
bin_root = ['..' ...
filesep 'binarydb' ...
filesep];
name = 'helen';
type = 'test';
ann = 'original';
db = DB([name '-' type '-' ann],bin_root);
% number of image
n_data = 100;
% get dataset
id = 1:n_data;
reg_ex... |
classdef sig < handle
% sig 信号分析的基础类
% 信号的作用是预测之后一段时间内标的证券的价格走势
% 此类主要用于挖掘单一证券日内统计套利信号,暂时不考虑多资产的情况
% workflow: data > indicators {real value}> sig > report
% sig (after eval) > Entry and Exit > Strategy Eval
%-------------------------------
% huajun @20140916
proper... |
maxJ=20;
Jvec=0:maxJ;
Ntheta=200;
theta=map2colvec(0:pi/(Ntheta-1):pi); % array for angle theta
legendre_poly=LegendreP(cos(theta),maxJ);
Yl0=zeros([Ntheta maxJ+1]);
for indJ=1:maxJ+1
M=0;
J=Jvec(indJ);
Yl0(:,indJ)=sqrt((2*J+1)*factorial(J-M)/4/pi/factorial(J+M))*legendre_poly(:,indJ,maxJ+1+M);
en... |
%--------------------------------------------------------------------------
%
% AccelSolrad: Computes the acceleration due to solar radiation pressure
% assuming the spacecraft surface normal to the Sun direction
%
% Inputs:
% r Spacecraft position vector
% r_Sun Sun position vector
%... |
function cp=WSEML(matrix)
% %% Function : caculate the Sum-modified-Laplacian measure of image
%=============================================================
% QU Xiao-BO,
% Xiamen University in P.R.China, April 2009.
% ---------
% Author: Qu Xiao-Bo <qxb_xmu [at] yahoo.com.cn> Aug.28,2008
% Postal a... |
X1 = randn (50 ,2) + 1;
X2 = randn (51 ,2) - 1;
%%
Y1 = ones(50 ,1);
Y2 = -ones(51 ,1);
O1 = [1, 1];
O2 = [-1, -1];
M = (O1 + O2)/2;
V = O1 - O2;
VN = [-V(2), V(1)];
figure;
hold on;
% axis equal;
plot(X1(:,1), X1(:,2), 'r+');
plot(X2(:,1), X2(:,2), 'bx');
plot([O1(1), O2(1)], [O1(2), O2(2)],'c*');
% p1ot([O1(1)], [O... |
function cleanDeps()
% Function to delete all third party dependencies
import affineDetectors.*;
fprintf('\n----- Deleting datasets ----\n');
vggDataset.cleanDeps();
fprintf('\n----- Deleting feature detectors -----\n');
vggMser.cleanDeps();
vggAffine.cleanDeps();
sfop.cleanDeps();
cmpHessian.cleanDeps();
cleanKris... |
figure;hold on;axis equal;grid on;
[x,y,z] = sphere;
surf(x*sphereRadius+spherePositionOne(1), y*sphereRadius+spherePositionOne(2), z*sphereRadius+spherePositionOne(3));
surf(x*sphereRadius+spherePositionTwo(1), y*sphereRadius+spherePositionTwo(2), z*sphereRadius+spherePositionTwo(3));
cam = plotCamera('Location',[0 ;... |
function [CSA, shape] = calcCSA(I,delta)
%CSA in mm^2
CSA = I / (delta .* power(10,-6));
if CSA <= 10
shape = "circle";
else
shape = "square";
end
end
|
function draw2tree(k,N,lambda)
%% 画系数lambda的树状图
s = 1:k+1;
t = k+2:(k+1)*2;
if N>2
s=[s,kron(k+2:length(lambda)/2,ones(1,2))];
t=[t,(k+1)*2+1:length(lambda)];
end
% normlambda(1:k+1)=abs(lambda(1:k+1))/sum(abs(lambda(1:k+1)));
% normlambda(k+2:(k+1)*2)=abs(lambda(k+2:(k+1)*2))/sum(abs(lambda(k+2:(k+1)*2)));
n... |
function f=xned(start_angle,draw_graph)
XY0=[0 19*cos(start_angle) 1.5 19*sin(start_angle)]';
lastX=0;
h=0.02;
RESULT_X=[];
RESULT_Y=[];
while(XY0(3)>0)
f1=varp(XY0);
f2=varp(XY0+h*f1/2);
f3=varp(XY0+h*f2/2);
f4=varp(XY0+h*f3);
XY0=XY0+h*... |
function subfnCIGraphs(data,Parameters)
ModelNum = data.ModelNum;
switch ModelNum
case '14'
A = data.X;
B = data.M;
V = data.V;
a = Parameters.Model1{1}.AgeGroup.beta;
b = Parameters.Model2.FreeSurfer.beta;
v = Parameters.Model2.FreeSurfer_x_CogRes.beta;
... |
%L = [5,5];
%N = [1000,1000];
L = [10,10];
N = [2000,2000];
%N = [256*2,256*2];
%L = [2.5,10];
%N = [500,2000];
%L = [5,5];
%N = [2000,2000];
n = prod(N);
params.N = N;
params.L = L;
[k2,k] = formk(N,L);
k0 = 50;
%R_D5
%k0 = 100;
alpha = 5;
params.C = exp(-(sqrt(k2)-k0).^2/(2*alpha^2))*0.95;
tspan = 0:0.1:5;
tspan ... |
function [ghead, gprof] = readl2sup(fn, iQA);
% function [ghead, gprof] = readl2sup(fn, iQA);
%
% Reads an AIRS level 2 support products granule file and returns
% an RTP-like structure of retrieved profile & surface data. Only
% returns those FOVs with a passing retrieval quality flag.
% Note: returns the pseudo-lev... |
function face = detect(filename)
faceDetector=vision.CascadeObjectDetector('FrontalFaceCART');
img=imread(filename);
img_gray=rgb2gray(img);
BB=step(faceDetector,img_gray);
figure(1);
J = imcrop(img, BB);
imshow(J);
title('Detected face');
imwrite(J,'face.jpg');
face = J;
end |
%Structure from motion
%% Parse the Data
fprintf('Loading the Data\n');
K = [568.996140852 0 643.21055941;
0 568.988362396 477.982801038;
0 0 1];
matches = cell(5,6);
mdir = dir('./matching');
numims = length(mdir)-2;
for i=3:length(mdir)
%fprintf([mdir(i).name, '\n']);
data = dlmread(['./matching/... |
function [ T_IE ] = jointToEndeffectorPose( q, params )
% q: a 3x1 vector of generalized coordinates
% params: a struct of parameters
% Link lengths (meters)
l0 = params.l0;
l1 = params.l1;
l2 = params.l2;
l31 = params.l31;
l32 = params.l32;
% Joint positions
q1 = q(1);
q2 = q(2);
q3 = q(3);
... |
%% CLEAN
superclean = cell(size(unskewed, 1));
for i = 1:size(unskewed, 1)
superclean{i} = first(im_clean(im_clean(im_clean(unskewed{i}))));
end
%% chaincodes
chaincodes = zeros(size(superclean, 1), 10);
for i = 1:size(superclean, 1)
im = superclean{i};
cc = chaincode(first(bwboundaries(im)));
... |
%gui_sleep_amount
%function gui_sleep_amount(channels,label1,labelconditions,labelconditions2,rats)
plot_sleep=0;
dname=uigetdir([],'Select folder with Matlab data');
for RAT=1:length(rats)
Rat=rats(RAT);
cd(strcat(dname,'/',num2str(rats(RAT))));
%xo
gg=getfolder;
gg=gg.';
gg(ismember(gg,'OR_N'))=[];
gg(ismember(g... |
function testWS
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
ti1 = imread('../data/test/256_OC/computer-mouse_3.jpg');
% ti1 = imread('../data/test/256_OC/ak47_1.jpg');
I = rgb2gray(ti1);
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I), hy, 'replicate... |
function Mp = spiralCoilFieldCalcFilaments(A,B,a,b)
%%%%% "AB" vectors (emitter filaments)
% x_points: horizontal vector of end points (x-component) of the filaments
% generating the field
% y_points and z_points: the same
%
%%%%% "ab" vector (receiver filaments)
% Wx: 2 end points (horizontal) of the filament where ... |
% Computes dynamic paths as a function of initial state and shocks
% In particular computes impulse-response functions
% For simplicity, 'time' is same as vector index (i.e. starts at time=1)
% IN ORDER TO BE ABLE TO CONSIDER VERY SMALL SHOCKS, COMPUTE DEVIATIONS ONLY
% EXTRACTING VARIABLES DIRECTLY FROM KLEIN ... |
%% Stelling 6
%
% Met het statement 'axis equal' pas je de schaling van
% de assen van een grafiek aan.
%
Antwoord = 1;
|
function matrixAIndex = cal_A(imgs,imgfs,varargin)
%根据多对图像计算平均的模拟转换矩阵A
% img为原始图像(imgNum*1的cell,分别存储着imgNum张原图的完整名字),
% imgf为滤镜后的图像(imgNum*1的cell,分别存储着imgNum张滤镜图的完整名字)
% varargin为一些配置信息,包括model名称,取点个数,是否保留训练图像等。
% model包括取点个数,训练图对。
% ||A*beta - y||^2, 去掉alpha通道,A为3x4,beta为4x4,即4个点的[r;g;b;1]的竖向组合。
% y是3x4,是由滤镜后4个对应点的[r'... |
[UtilityGains]=demo();
[utilityGain] = futuredata();
% %nodesStart = 100;
% %nodesEnd = 201;
% %timeSlotsStart = 100;
% %timeSlotsEnd = 201;
% steps = 100;
% maxDuration = 15;
% for n = nodesStart : nodesEnd
%
%
% numNodes = n;
%
% numOfIterations = 5;
%
% ourDiffSum = 0;
% thei... |
function chromosome = crossing_over(parent1, parent2, type)
% Crossover factory
% @var integer[] parent1 - first parent
% @var integer[] parent2 - second parent
% @var string type - crossover type
if (nargin == 2)
type = 'simply_point';
end
if (strcmp(type, 'simply_point'))
chromosome = cros... |
clear;
text = textread('synthetic_data.txt', '%s', 'delimiter', ',');
N = 2; % Length of the HMM
RandVMF = [];
for i=1:size(text,1)
if mod(i,6*N)==0
RandVMF = [RandVMF; str2num(text{i})];
end
end
figure;
scatter3(RandVMF(:,1), RandVMF(:,2), RandVMF(:,3),3, 'b', 'filled'), axis([-1 1 -1 1 -1 1]);
|
% Ask user to input desired engine cycle file
InputFile = strcat('..\Cycle Design Codes\', input('Please input engine cycle file name ','s'),'.mat');
% Check that the input file exists before trying to load
% If no file found, ask user to retry file selection
while exist(InputFile,'file') ~= 2
InputFile = strcat(i... |
%%clear all;
cgmseries1 = finalcgm;
cgmdatenum1 = finaldates;
%{
yyaxis left;
plot(cgmdatenum1(1,1:end-1),cgmseries1(1,1:end-1),'r');
plot(cgmd(20),cgms(20),'r');
yyaxis left;
hold on;
stem(cgmdatenum1(1,1:end - 2),fftmatrix(1,2:end));
hold off;
cgmvel = cgmseries1(1,2:end) - cgmseries1(1,1:end-1);
plot(cgmdatenum1(1... |
function out = mirror(n_lines,in)
% function out = mirror(n_lines,in)
%
% MIRROR conjugate complex mirroring of the matrix 'in'.
% 'n_lines' is the number of columns of the matrix. If n_lines is even the
% resulting output matrix has 2 * n_lines columns, if n_lines is odd
% the resu... |
function [AllTraj, AllSigns, DerIdx] = uq_improved_morris_trajectory(M, r, R, Options)
% [ALLTRAJ, ALLSIGNS, DERIDX] = UQ_IMPROVED_MORRIS_TRAJECTORY(M, r, R, OPTIONS):
% generate R improved morris trajectories according to the options in
% OPTIONS.
%
% See also: UQ_CREATE_MORRIS_TRAJECTORY,UQ_MORRIS
% Create... |
%% ephysSettings
% Specifies hard-coded parameters for ephys acquisition including data
% directory path and axopatch parameters.
% AKM 3/7/18, last updated 7/27/18
settings=struct();
% Set paths
comptype=computer; % String describing computer type
settings.mainDataDir='D:\data_main';
settings.stimfilepath='C:\User... |
function [spec_vals]=kraichnan_new(nu,k,kb,D,chi,qq)
% [spec_vals]=batch(nu,k,kb,D,chi,q)
% B_SPEC determines the Kraichnan Spectra at a given wavenumber k
% this requires chi, kb (the batchelor wavenumber) and the diffusivity D.
% q could be set to 2.42
% q=2.42;
% but instead I have it at q=3.7
% C_star is fro... |
close all
x=imread('img3.jpe');
%Binary image
image=rgb2gray(x);
%cut image in half
n=fix(size(image,1)/2)
A=image(1:n,:,:);
bottomHalf=image(n+1:end,:,:)
title('Sobel Gradient Magnitude')
%pass noisy image
sobelGradient = imgradient(bottomHalf);
imshow(sobelGradient,[])
%The Sobel gradient operators are 3x3 filters a... |
function str_array = StringArrayWithSpacestoStringArray(str)
str_array = regexp(str,'\s','split');
end |
carTrainAll = [carTrain LcarTrain];
busTrainAll = [busTrain LbusTrain];
truckTrainAll = [truckTrain LtruckTrain];
carTestAll = [carTest LcarTest];
busTestAll = [busTest LbusTest];
truckTestAll = [truckTest LtruckTest];
% LENGTH
carTrain1 = carTrain(:,1);
busTrain1 = busTrain(:,1);
truckTrain1 = truckTrain(:,1);
carTes... |
function Tracking_withoutUpdate()
tracking_param = TrackingSetup();
options = setup();
video_path = [tracking_param.path tracking_param.video_name options.slash tracking_param.format];
pts_path = [tracking_param.path tracking_param.video_name options.slash tracking_param.pts_file];
save_singleframe_path = [trackin... |
l=0.5; %length of needle
a=1; %distance in parells
N=1000; %total number
n=0; %hit number
x=[0:2];
for i=[0,1,2]
y=a*i*ones(1,3);
plot(x,y,'black','LineWidth',2);
hold on;
end
axis([-1,3,-1,2*a+1]);
for j=1:N
x1=rand(1)*2;
y1=rand(1)*2;
angel=rand(1)*pi;
x2=x1+0.5*l*c... |
%% open image
clear all
filename='Prototype_Left';
I = imread(strcat(filename,'.jpeg'));
I=imrotate(I,90);
imshow(I,'Border','tight')
I=I(:,:,1); %using only the red channel
%%identify beads and displaying them as bounded regions
bin=imbinarize(I);
bin=imclearborder(bin);
imshow(bin); %displaying the binarized image
[... |
function [cin,cape] = fcincape2(Tvp,Te,re,dz)
g = 9.81; % m/s^2
eps = .622;
% Virtual temperature
Tve = Te.*(1+re/eps)./(1+re);
deltaTv = (Tvp - Tve);
icin = find(deltaTv<-0.1);
icape = find(deltaTv>0);
if ~isempty(icape)
ilnb = icape(end); % level of neutral buoyancy
... |
function [H_f1, H_f2, Hc_OK, ...
Hc_Next, Hc_Last, Hc_This, Hc_Enter, Hc_Quit, ...
Hc_Height, Hc_Velocity, Hc_Accel, Hc_Residual, ...
Hc_Male, Hc_Female, Hc_CaseNo] = ...
menusetup(icase, malestr, femalestr)
% figure for plotting
H_f1 = figure;
left=50; bottom=50; width=700; height=500;
Posi... |
%% Stelling 12
%
% De if-statement wordt gebruikt voor het herhalen
% van code.
%
Antwoord = 0;
|
function [split, descriptorType, encode, normalize, gmmSize, dataset] = parse_parameters(varargin)
p = inputParser;
defaultNorm = 'Power-L2';
defaultSplit = 1;
defaultEncode = 'fv';
defaultDescriptor = {'hog','hof','mbhx','mbhy'};
defaultData = 'jhmdb';
addParamValue(p,'split',defaultSp... |
% Filter out the directed graph edges by multiplier
% multipliers = vector of multipliers to filter for
% 2 for type advantages
% 0.5 for resistances
% 0 for immunities
% 1 for normal damage
% self_loops = flag for keeping self loops
function filtered = filter_graph(type_matchups, multiplie... |
% Segmentation script
% Author: D Yoan L Mekontchou Yomba
% Date: 4/7/2018
% clear work spacer
clc;
clear all;
close all;
% Add all relative paths
addpath(genpath('.'));
FILENAME = 'filenames.list';
FILEPATH = 'paths.txt';
% load in images
[images, file, n, paths] = getAllfolderimages('C:/Users/undergrad/Desktop/Pu... |
function obj = crop(obj)
%CROP Summary of this function goes here
% Detailed explanation goes here
f = figure;
f.Units = 'normalized';
f.Position = [0,0,1,1];
ax = axes(f);
%% Observation cropping
loop1 = true;
while loop1
plot(ax,obj.Time,[obj.ActivityIndex,obj.CircadianStimulus])
ax.XLimMode = 'manual';
... |
% close all;
% fid1=fopen('sent.dat','r');
% x=fread(fid1,82682*2,'short');
% fclose(fid1);
%
% xComplex2= zeros(1,82682);
% count = 1;
% for i=1:2:82682*2
% xComplex2(count) = complex(x(i),x(i+1));
% count = count+1;
% end
%
% xComplex2=conj(xComplex2)';
close all;
fid1=fopen('sent.dat','r');
x=fread(fid1,... |
function e = earthrate(lat);
%--------------------------------------------------------------
% function e = earthrate(lat);
%
% earthrate(lat) computes the earth rate vector in North, East
% Down coordinates as a function of latttitude (lat) given in
% radians.
%
% Demoz Gebre 7/2/98.
%... |
function [ best_coloring, minimum_cost ] = findColoring( G, q, max_iterations, ...
discretized, schedule, scheduleArgs, ...
competitionOutputPath)
%FINDCOLORING Find a proper coloring for graph G using q colo... |
%sprawdzenie wyznacznika
n = 100;
err = zeros(1, n);
for i = 1:n
i
A = rand(3, 1000);
our_result = determinantof(A);
mat_result = det(diagToNorm(A));
err(i) = (our_result-mat_result)/mat_result;
end
mean(err) |
function newData = scoreMapping(data)
[row, col] = size(data);
newData = zeros(row, col);
for i = 1:row
for j = 1:col
if data(i,j)>=90.00
newData(i,j) = 4.3;
elseif data(i,j)>=85.00
newData(i,j) = 4.0;
elseif data(i,j)>=80.00
... |
function [ states ] = BuildStateList_pendulum(n)
%BuildStateList builds a state list from a state matrix
% state discretization for the mountain car problem
x1 = linspace(-pi,pi,n);
x2 = linspace(-pi,pi,n);
I=size(x1,2);
J=size(x2,2);
states=[];
index=1;
for i=1:I
for j=1:J
states(index,1)... |
%%
% NOTES
% DATE: 05/14/2018
% AUTHOR: MINHYUK NAM
%% 1. Limitation, Differentiation and Integral
% syms ; do not use comma(,) to differentiate each variables
% limit(<things to limit), <smth>, <goes to somewhere>)
% diff(<function>, <with respect to>)
% int(<function>, <with respect to>, [initial val], [terminal val... |
clc;
close all;
clearvars;
selpath = uigetdir;
addpath(selpath)
addpath([selpath,'\Scenario2_transientIC'])
%% define model parameters
ksmm = 0.018; % h-1
kb = 0.00028; % h-1
Y = 0.31; % microbial carbon use efficiency
km = 25; % mgC/gSoil
rho = 1.65; % g/cm3 soil bulk density
rho_wood = 1.1; % g/cm3 max carbon den... |
function Y=GetY(X,XgID,T,N,f)
% Update vertex positions
dim=size(X,2);
nvert=size(T,1);
Y=zeros(nvert,dim);
for i=1:nvert
x=X(T(i,:),:); % 3 nodes taht interpolate vertex i
if abs(sum(ismember(T(i,:),XgID))-3)<eps
x=X(T(i,:),:);
Center=1/4*(sum(x,1));
vc=Center-X(T(i,~ismembe... |
function [guesses] = paramsel_lambdaguesses(eigvals, r, n, opt)
% paramsel_lambdaguesses(EIGVALS, R, N, OPT)
% Builds array of possible values for the regularization parameter,
% generating a geometric series from the values in EIGVALS
% Internal function, not to be called from gurls
%
% INPUTS:
% -EIGVALS: a vector... |
function [outputData] = compareSignalToMovement(inputSignals,inputMovement,varargin)
% Compares a set of input signals to a movement vector.
% Biafra Ahanonu
% started: 2013.10.30 [12:45:53]
% inputs
% inputSignals
% inputMovement - a table containing XM, YM, Angle, Slice, and velocity.
% outputs
% outputDat... |
%% Class for handling UserInterface
%
% Handles UserInterface events and data.
classdef UserInterface < handle
properties (SetAccess = private)
Initialised logical = false;
InterfaceLoaded logical = false;
MasterControlEnabled logical = false;
ReadOnlyModeEnabled logica... |
%% calc_temp.m
% Usage: calc_temp(ROOT_DIR)
% Purpose: Calculates the granular temperature of each simulation given by
% T = (<u^2> + <v^2> + <w^2>)/3
% where <> is taken over the particle ensemble
% TODO: Add rotational energy as well
%
% User Inputs:
% None
%
% Function Requireme... |
function varargout = GLW_ExtractIntervals(varargin)
% GLW_EXTRACTINTERVALS M-file for GLW_ExtractIntervals.fig
% GLW_EXTRACTINTERVALS, by itself, creates a new GLW_EXTRACTINTERVALS or raises the existing
% singleton*.
%
% H = GLW_EXTRACTINTERVALS returns the handle to a new GLW_EXTRACTINTERVALS or the ha... |
load wordtrain_new_idx.mat
load ./train_set/words_train.mat
X_label = X;
load ./train_set_unlabeled/words_train_unlabeled.mat
X_unlabel = X;
[X_label_new] = generate_new_wordtrain(topwords_idx, X_label);
[X_unlabel_new] = generate_new_wordtrain(topwords_idx, X_unlabel);
cluster = 20;
[idx,C] = kmeans(X_label,cluster,'... |
load('MLE1.mat')
rec_beta_hat1 = rec_beta_hat;
load('MLE2.mat')
rec_beta_hat2 = rec_beta_hat;
load('MLE7.mat')
rec_beta_hat3 = rec_beta_hat;
h = figure;
subplot = @(m,n,p) subtightplot (m, n, p, [0.1 0.075], [0.05 0.05], [0.03 0.02]);
var_names = {'\sigma_{1}', '\sigma_{2}', '\rho_{12}', '\nu_{1}', '\nu_{2}', '1/a', ... |
% Initialize
global piece pieces_types all_pieces running interface plane max_column max_row
max_row = 23; max_column = 15;
plane = zeros(max_row,max_column);
interface = figure; initialize_window();
load_pieces();
running = true;
% Game loop
generate_a_piece();
while running
move();
pause(0.5);
game_over();
e... |
% function to read data into structure to work with
%
% datafolder = folder where subfolders with the requested data lie
% details = name of the Temperature and Frequency file (lies in the
% same directory as the
% subfolders)
function... |
De functie size() geeft bij een matrix de hoogste
waarde terug. Bijvoorbeeld: 'size(0:3)' geeft de waarde
3 terug. |
clear all;
close all;
clc
%Read all files
Nseed=1000;
%orbit without bump nor kick
for i=1:Nseed
%orbit without bump nor kick
file_orbit=['/afs/cern.ch/user/f/fvelotti/private/awake/seed/orbit_seed' num2str(i) '.twiss1'];
[num,s,x(:,i),y(:,i),a1,a2,dx(:,i),betx(:,i),dy(:,i),bety(:,i),sx(:,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.