text stringlengths 8 6.12M |
|---|
function [nParticlesCaught, xyExp, dotCol, dotSize] = al_confetti(taskParam, taskData, currTrial, background, timestamp, fadeOutEffect)
%AL_CONFETTI This function animates the confetti shot
%
% Input
% taskParam: Task-parameter-object instance
% taskData: Task-data-object instance
% currTrial: Curre... |
% Copyright 2014
%
% 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 required by applicable law or agreed to in writin... |
clc;clear;close all;
load fromfig;
%pic_pv=con2seq(pic_pv);pic_ide=con2seq(pic_ide);
lag=5;%自回归阶数
fn=60;%预测个数
iinput=pic_ide;
n=length(iinput);
%准备输入输出数据;
inputs=zeros(lag,n-lag);
for i=1:n-lag
inputs(:,i)=iinput(i:i+lag-1);
end
targets=pic_ide(lag+1:end);
%创建网络
hiddenLayerSize=10;
net=fitnet(hid... |
% compare winters & d'asaro estimate with others
load ../proc/Turb.mat
t0 = find_approx(Turb.mm1.time, chi.wda.time(1));
t1 = find_approx(Turb.mm1.time, chi.wda.time(end));
sgn = sign(interp1(chi.time, chi.dTdz, chi.wda.time));
sgn(sgn == 0) = 1;
load ../input/dTdz_i.mat
tz0 = find_approx(Tz_i.time, chi.wda.time(1));... |
load('USPS Data/Dictionary2.mat');
datapath='USPS Data/';
train_data=load([datapath 'USPS_Train_Data.mat']);
train_data=train_data.Train_Data;
Wd=Dict;
coeff_trainset=zeros(size(Dict,2),size(train_data,2));
[Wd,w]=col_norm(Wd,2);
L=max(eig(Wd'*Wd))+0.1;
S=eye(size(Wd'*Wd))-(Wd'*Wd);
for j=1:size(train_data,2)
disp(j)... |
function [ data ] = getInt( images, data, wb )
%intRejection returns frames that fall within a range of intensity distributions
waitbar(0,wb,'Calculating mean pixel intensity...');
%% Get intensity distribution
nrf = numel(data.frames);
mInt = zeros(nrf,1);
for i=1:nrf
mInt(i) = mean(images{data.frames(... |
function obs=useL5obs(obs,useL5,poob)
%
% Function useL5obs
% ==============
%
% This function puts L5 in place of L2, for chosen satellites
% So L5 is used rather than L2 for chosen satellites
%
% Syntax
% ======
%
% obs=useL5(obs,useL5)
%
% Input
% =====
%
% obs -> nsx(no+2) matrix containi... |
function varargout = test_gui_p(varargin)
% TEST_GUI_P MATLAB code for test_gui_p.fig
% TEST_GUI_P, by itself, creates a new TEST_GUI_P or raises the existing
% singleton*.
%
% H = TEST_GUI_P returns the handle to a new TEST_GUI_P or the handle to
% the existing singleton*.
%
% TEST_GUI_P('CALL... |
function [ N ] = normalize( x )
%NORMALIZE will return the normalization matrix N, based on
% the points x.
%
% Alexander Karlsson, 2015
s = (std(x(1:2,:),0,2));
m = (mean(x(1:2,:),2));
N = [ s(1) 0 m(1)
0 s(2) m(2)
0 0 1 ];
end
|
function X=FFT2(x)
X(1)=x(1)+x(2);
X(2)=x(1)-x(2);
end |
%{
# subject.Sequence
sequence: varchar(63) # informal name
-----
-> subject.SequenceType
base_pairs='': varchar(1023) # base pairs
sequence_description='': varchar(255) # description
%}
classdef Sequence < dj.Lookup
properties
contents = {
'GCaMP6f', 'calcium ... |
% Psychophysics performance
% Show file you are running
p1 = mfilename;
fprintf('\n=========\n')
fprintf('\n Current file: %s\n', p1)
fprintf('\n=========\n')
% Loading the files needed
if ~exist('settings', 'var')
settings = struct;
end
settings = get_settings_ini_v10(settings);
%% Extra settings
settings.fi... |
function error=ensure_par(v,N_line,d_m,object_num,d,d2)
%2012 12 20 by lichao
%用于确认参数信息是否准确
%用法:error=ensure_par[v,N_line,d_m,object_num,d,d2]
%v 微透镜位置
%N_line 主透镜采样率
%d_m 场景放大倍数
%object_num 场景数
%d 场景1的距离
%d2 场景2的距离
error=0;
if nargin<=5
error=1;
disp('请输入足... |
function rate = daq_getOutputSamplingRate()
%Return the current output sampling rate;
global GAO
rate = get(GAO,'SampleRate'); |
clear all;clc
%% Testing cov_long
% Forming column vectors x and t. All t0's < tstart and t1's > tfinal.
t0_1=0 ; t1_1=10 ; npts1=10000 ;
parameters1.A=1 ; parameters1.omega=1 ;parameters1.theta=2 ; nanpts1=20 ;
[x1, t1] = synthesize(t0_1, t1_1, npts1, parameters1, nanpts1);
t0_2=1 ; t1_2=12 ; npts2=12000 ... |
classdef MLOptProblem < OptProblem
properties
end
methods
function obj = MLOptProblem()
end
function obj = estimateOptObjectNumber(self, groundStructure, loadCases)
obj = size(groundStructure.members, 1) + size(groundStructure.nodes, 1);
... |
clc; clear all;clf;
format long;
out = load('C:\Users\Heath\Google Drive\gprs_fromMartin\OnePhase\outSRK.txt');
pres = out(:,3); temp = out(:,4);
feed = round(out(:,1).*100); status = out(:,2);
%ZC = 5:5:50;
ZC = 5:5:20;
for k = 0:1;
h=figure(k+1);
for i = 1:4
if k*4+i <= length(ZC)
... |
function [ cost ] = costForMLE_5_2( variances )
%COSTFORMLE Summary of this function goes here
% Detailed explanation goes here
%Seyit Yiğit SIZLAYAN / 1876861
global z
global N
global dt
modelVar = variances(1);
r_enc = variances(2);
r_gyro = variances(3);
%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%%
%%
%%
%Encryption method: The origial message reads 'CLASSIFIED' which is
%encoded as 'LUCUIYILRQ' by using Hill Cipher encrytption as shown below
%The steps for the same are 1) Key definition 2) message in letters
%3)converted to ASCII 4)Hill Cipher modulo conversion
%Encryption%
P= [2 3; 1 4]
m= 'universitas... |
function outperm = clusterLymphSim(link, k, cut, filename, dataFile, outFile)
% This fucntion performs hierarchical clustering over the lymph node
% similarity matrix and computes the chi^2 of the clusters given the
% different toxicity
% Input: link = linkage for clustering {'single', 'average', 'compelte', 'weighte... |
%% genetic_alg_inner.m
% This is the 'inner' function for the Genetic Algorithm, which uses the
% functions passed through from outer to initialise and run the iterative
% loop of the algorithm. Each iteration is performed in another inside
% functon, 'genetic_alg_worker.m'.
%% Inputs:
% input_array: an array of l... |
function [mRearrangedOrig, vPermR, vPermC, vPermU, unionRC] = coVat(mOrig, bVisualise,figureName)
%coVat Implementation of co-Vat algorithm
%
% @author: Bingzan Liang
% Last update: 13/05/2014
%
%[mOrig,~,~] = svds(mOrig,1000);
%matlabpool local 4
row = size(mOrig,1);
column = size(mOri... |
function varargout = GUI(varargin)
%GUI M-file for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('Property','Value',...) creates a new GUI using the
% given pr... |
function [A, B] = covADD(cov, hyp, x, z)
% Additive covariance function using a 1d base covariance function
% cov(x^p,x^q;hyp) with individual hyperparameters hyp.
%
% k(x^p,x^q) = \sum_{r \in R} sf_r \sum_{|I|=r}
% \prod_{i \in I} cov(x^p_i,x^q_i;hyp_i)
%
% hyp = [ hyp_1
% hyp_2
% ..... |
% calculate rate of O1D + H2 -> OH +H
% Updated 7/13/06 AEP
% Based on JPL Data Evaluation #15
% rate = kO1DH2(T,M)
function j=kO1DH2(T,M)
j=1.0e-10.*exp(0./T);
|
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
function m = SymmPlane(id)
% SYMMPLANE - Return a Domain1D instance representing a symmetry plane.
%
m = Domain1D(4);
if nargin == 0
setID(m,'symmetry_plane');
else
setID(m,id);
end
|
clear all; close all;
x = [1 2 3.5 4 7 7.3 8.6 12.4 13.8 18.1];
x_sort = sort(x);
x_trimmed=x_sort(3:8);
mean_trim = mean(x_sort(3:8));
for t=1:50
B = 2000;
bx = zeros(1,6,B);
for i=1:B
ind = randsample(6,6,'true');
bx(1,:,i) = x_trimmed(1,ind);
end;
%... |
save_masterdir = GetCurrentDataDir();
%%
C = [];
range_fish = [8,9,11];
M_ClusGroup = [1,2,2];
M_Cluster = [7,5,5];
for i = 1:length(range_fish),
i_fish = range_fish(i)
i_ClusGroup = M_ClusGroup(i);
i_Cluster = M_Cluster(i);
cIX_abs = VAR(i_fish).ClusGroup{i_ClusGroup}(i_Cluster).cIX_abs;
%%... |
WM = imread('w.jpg');
[images] = im_array();
[W,imw4] = embedding(images,WM);
%[Wmext,psnrwmf,msewmf,images1] = extracting(images,WM);
% [I,I1,I2,rW1,psnrnoiseim,psnrnoisewm, corcoeffwm,rW2,psnrnoiseim1,psnrnoisewm1, corcoeffwm1,rW3,psnrnoiseim2,psnrnoisewm2, corcoeffwm2] = noise(images,WM);
% [rWb,psnrblurim,psnrblurw... |
samplingFrequency = 8000;
centerFrequency = 3600;
transitionWidth = 100;
passbandRipple = -20*log10(1*E-3);
stopbandAttenuation =-20*log10(5*E-5);
designSpec = fdesign.lowpass('Fp,Fst,Ap,Ast',...
centerFrequency-transitionWidth/2, ...
centerFrequency+transitionWidth/2, ...
passbandRipple,stopbandAttenuatio... |
function createSptlcorr_MSC(atlas_path,groupavg_name,CortexOnly,template_path,dconn_data,variant_fname)
%% Creates a variant map from the spatial correlation between an individual's temporal correlations at each vertex and group average temporal correlations at the same vertex
%
% This function correlates the temporal... |
% Implements the main result (sec. 2.1) of :
%
function [theta] = gAngleLp(x, y, p)
div = norm(x,p).*norm(y,p);
theta = gLp(y, x, p)./div;
end |
global u0;
global A_depth;
global B_depth;
global ts_depth;
rou=1000;
L=5.3;
m=5454.54;
xG=0;
Y_v=-0.1;
Y_r=3.0e-02;
Y_deltar=2.7e-02;
N_v=-7.4e-03;
N_r=-1.6e-02;
N_deltar=-1.3e-02;
Y_vdot=-5.5e-02;
Y_rdot=1.2e-03;
N_vdot=1.2e-3;
N_rdot=-3.4e-3;
Yv=0.5*rou*L^2*Y_v;
Yr=0.5*rou*L^3*Y_r;
Ydeltar=0.5*rou*L^2*u0^2*Y_deltar;... |
function [cost]=fitness(pop)
[n, m]=size(pop);
cost=zeros(n,1);
for k=1:n
temp=pop(k,:);
for i=1:m-1
for j=i+1:m
if(abs(temp(i)-temp(j)) == abs(i-j))
cost(k)=cost(k)+1;
end
end
end
end
end |
% Student Name: Sarah Bland
% Program Name: SWAS_Q_WY.m // PROGRAM #1
% Description: Opens and analyzes discharge (Q) data for 4 SWAS sites in the
% Shenandoah National Park by WATER YEAR.
%
% NOTE: Water year is defined for all SWAS sites as being from the final
% 1/4 of calendar year A through 3/4 of calendar... |
% clear all;
% clc;
rng(7610);
% load('Z:\User\wuxiang\Result\DeepFace\DeepFace_set003\DeepFace0.3.13.x\trainset.mat');
% normalization
features = features ./ repmat(sqrt(sum(features.^2, 2)), 1, size(features, 2));
nclass = 200;
neg_seed = 200;
alpha = 0.5;
fid_pair_list = fopen('triplet_pairs.txt', 'wt');
fid_scor... |
clc, clear, close all;
myfigure('fig1'); plot( rand(10,1) );
myfigure('fig2'); plot( rand(10,1) );
myfigure('fig3'); plot( rand(10,1) );
myfigure('fig4'); plot( rand(10,1) ); |
% cleaning the workspace and the screen
clc
clear all
close all
pkg load parallel
%% constants
q = [3:1:20]';
mass = 16./17;
conv_factor = 0.071^2 * 3550 * mass;
freq = [540, 850, 3550];
u = sqrt(conv_factor/mass./freq);
u_sq = u.^2;
% use_overtone = true;
% tic; [F, O] = integrals_par (q, u_sq(1), u_sq(2) ,u_sq(3),... |
figure;
N = 2000;
czas = 4;
t1 = 250;
t2 = 125;
dt = czas/N;
t = 0:dt:czas-dt;
f = 1;
x1 = 3.5*sin(2*pi*f*t);
x1 = (x1+abs(x1))/2;
z = [zeros(1,t1),ones(1,t2),-ones(1,t2)];
x2 = [z,z,z,z];
x3 = x1+x2;
wsr = sum(x3)/length(x3);
x4 = x3 - wsr;
subplot(4,1,1);
plot(t,x1);
grid on;
subplot(4,1,2);
plot(t,x2);
grid on... |
close all;
figure;
linewidth = 2;
zeros = load('zeros.txt');
ones = load('ones.txt');
random = load('random.txt');
x_zeros = zeros(:,1);
x_ones = ones(:,1);
x_random = random(:,1);
y_zeros = zeros(:,2);
y_ones = ones(:,2);
y_random = random(:,2);
plot(x_zeros, y_zeros, 'Linewidth', linewidth); hold on;
plot(x_ones, y... |
function VANDERPOL
%
% Выбор метода решения:
method_type='SDIRC'; % Допустимые значения:
% 1) 'MidPoint' --- неявный метод средней точки
% (одношаговый, одностадийный, 2-ого порядка)
% 2) 'HH' --- метод Хаммера-Холлингсворта
... |
function f_ss = autogen_drift_vector_field(I_pend,b1,b2,dtheta_pend,dx_cart,g,m_cart,m_pend,r_com_pend,theta_pend)
%AUTOGEN_DRIFT_VECTOR_FIELD
% F_SS = AUTOGEN_DRIFT_VECTOR_FIELD(I_PEND,B1,B2,DTHETA_PEND,DX_CART,G,M_CART,M_PEND,R_COM_PEND,THETA_PEND)
% This function was generated by the Symbolic Math Toolbox ver... |
# -*- octave -*-
function [f,H,b]=raised_cosine(N,beta,T,fs)
f=[0:N/2-1 -N/2:-1]*fs/N;
f1=(1-beta)/2/T;
f2=(1+beta)/2/T;
H=f*0;
H(abs(f) <= f1) = T;
b=abs(f) >= f1 & abs(f) <= f2;
H(b) = T/2*(1+cos(pi*T/beta*(abs(f(b))-f1)));
b=ifft(H);
b=real(b);
b/=sum(b);
endfunction |
function structAxialROI=ROIImportMethod_MaskNifti(FileName, ImageDataInfo)
%Import
try
[DataOut, Pixdim, Rotate, DataType] = ReadNifti(FileName);
%Sanity Check 1
if ~isempty(DataOut) && isequal(DataType, 'uint8')
MaskMat=DataOut(:, :, :, 1);
MaskMat=fl... |
%% par_generate_and_test.m
% Generates and tests the neighbourhood of the current instance
% (generalised for k > 2)
%% Input:
% k: The size of the k-exchange
% curr_makespan: the makespan of the current instance
% L: The machine numbers of all the loaded machines
% M: The number of (movable) programs i... |
function [C_1,C_1_var] = C1MatrixFunction(beta,PlsPoints,PllPoints)
%% Initialise blank matrix
C_1 = zeros(PlsPoints+1,PlsPoints+1);
%% Populate interior of C_1 matrix
% Inner values
for i = 2:PlsPoints
C_1(i,i-1) = beta; % sets above diagonals
C_1(i,i) = 1 - 2*beta; % sets diagonals
C_1(i,i+1) = ... |
function [p] = p(m,p0,x,x0,t0)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% x represent the unknown parameter
% x0 represent the estimated parameter
t = t0/m;
p = UA(x,t)*p0*UA(x,t)';
for i = 1:m-1
p = UA(x,t)*UA(x0,t)'*p*UA(x0,t)*UA(x,t)';
en... |
function [JacObjReg, JacResReg] = AMIGO_PEJacreg(inputs,privstruct)
% computes the Jacobian of the regularization part of the objective function.
% JacObjReg: the Jacobian of the regularized part
% JacResReg: if the regularization can be stated as sum of squared functions, g
% contains the Jacobian of the functions t... |
%==============================================================
% FileName: elem_nbenergy.m
% Description: Get non-bonded energy in a element
% Author: Changhao Li
% Date created: 20 Jul 2017
% Version: 1.00
% Date last revised: 20 Jul 2017
% Revised by: Changhao Li
%============================================... |
function q = Q(ang)
% Q.m
%
% Transformation matrix Q from three spherical angles
%
% Input: ang, three spherical angles defined in Jiang(2007a), in radian,
% 3*1 matrix;
% Output: q, 3*3 matrix
%--------------------------------------------------------------------------
a = [sin(ang(2)... |
disp('Question 6 is running ...');
%% global variables or settings
%% A
|
function [memory, instances] = memory_remove(memory, index)
if isempty(index)
instances = {};
return;
end;
mask = true(numel(memory.instances), 1);
instances = memory.instances(index);
mask(index) = false;
memory.instances = memory.instances(mask);
memory.frequency =... |
% Author : Seungwhan (Shane) Moon
% Description : Return the indices of the sorted vector
% Last Update : November 10, 2013
% Input
% - M : Vertical vector of size [m X 1] to be sorted
% - mode : 'ascend' or 'descend'
% Usage
% - indices = argsort(M)
% - indices = argsort(M, mode)
% - [indices, sort... |
function []= SingleTrainData(train_data,seq_ID_mat,common_index,...
boundry,TIME_SLOT,SEN_NUM)
%UNTITLED18 此处显示有关此函数的摘要
% 此处显示详细说明
sub_test_num = length(common_index);
%expect_index = seq_ID_mat(2,common_index);
for i = 1:1:sub_test_num
temp_index = common_index(1,i);
fin_index = ... |
function [dc_power, bj_after] = min_peak_using_batch_jobs( dc_cap, grid_load_data , a, BS, A_bj, PP, IP, T_sw, isPlot)
% Scale the power consumption of data center corresponding to the
% PV generation.
T = length(a);
total_BN = size(BS,1); % total number of batch jobs.
if isPlot
f... |
function [ eeState_ref, eeVel_ref ] = getEERef_fromMyPath( dt, eeState_prev )
%GETEEREF_FROMMYPATH この関数の概要をここに記述
% 詳細説明をここに記述
% [mm]
A = 500;
B = 0;
velocity = [
A;%A*sin(0.5);
0;%A*cos(0.5);
0;
0;
0;
0
];
eeVel_ref = velocity';
eeState_ref = eeState_prev + eeVel_ref*dt;
end
|
%% Data Preparation
%% Extract brain imags from each patient
%Patients_Protected = [43, 76, 80, 81, 88, 90, 94, 113, 122, 125, 183, 241, 244, 247, 250, 265, 269, 278, ...
% 280, 284, 297, 308, 320, 332, 380];
%Patients_TrauImg = [147, 149, 176, 177, 180, 190, 209, 212, 222,256, 264, 270, 271, 273, 282, 283, 289, 3... |
%% Main Algorithm Function
%clc;
clcl;
go2myRootDir
% Set current directory
%----------------------------------------------------------------------
compName=getComputerName;
setCD(compName);
rootDir=cd;
% Configuration
%----------------------------------------------------------------------
nEchoes4Cost = 15; ... |
%=========================================
path1 = '../../data/temp/Figure2/';
a = readtable(strcat(char(path1),'tss_homer_output2.txt'));
tss = zeros(285,501);
for i = 1:285
b = table2array(a(:,3+(i-1)*3));
tss(i,:) = b';
end;
mtss = mean(tss)';
mm = max(mtss)/min(mtss);
index_tss = zeros(285,2);
for i = 1:2... |
function error = get_error(a, time)
[x, y] = gen_traj(a);
dxd = derivate_pp(x);
dyd = derivate_pp(y);
[psil, psir] = mov_interpolation(a * 4, dxd, dyd);
[T, Y] = solve_diff2(x, y, psil, psir, a);
% calcul de l'erreur finale
% Trajectoire souhaitée :
xdf = ppval(x, time);
ydf =... |
N = 16;
N_axis = [16,32,64,128,256,512,1024];
condition = zeros(7,1);
counter = 1;
while N <= 1024
% G is an N+2 by N+2 full matrix with border entries set to zero
G = numgrid('S',N+2); % íSí means square with columnwise ordering
% A is the n by n five-point Laplacian sparse matrix, where n=N^2
A = dels... |
Parameters;
angleStep = 5;
set_ant_angle = -180:angleStep:175; %-180:5:175;
set_BBgain = [1]; % Not used actually
set_iterations =10;
thresh=0.005;
set_modIndex = [2];
set_fsamp = [5e6];
%Compile all matricies
% addpath('./matlab2tikz/src/');
%Get RMS statistics
myRMS = cel... |
classdef SensorCore < handle
%This is the Core Sensor which actually creates the body which gets
%attached to the Model.
properties(SetAccess=protected)
c_sensor_ptr = [];
end
properties (SetAccess=protected)
velocity = [0 0 0 0 0 0];
acceleration = [0 0 0 0 0 0];
%Observ... |
classdef PlotTools
properties
samples = 54;
end
methods
function self = PlotTools(data_ref)
%init method
if data_ref == 'y'
self.samples = 32;
end
end
function [] = plot_wvs(self, wv_data, x0, xN, pos, step)
%P... |
% The Langevin equation for a particle trapped within a potential V (an unidimensional potential of some form) at a finite temperature T is given by:
% dx/dt = (-1/gamma)*dV/dx + sqrt(2*D)*w(t)......(1)
% Note that: Here, D is the diffusion constant given by: D=k*T/gamma
% (gamma being the friction constant (depends... |
%Joseph Lannan
%9/12/17
%Basic Field Transforms of the EM field
%499 Ji Research
% lets define the electromagnetic tensor
% to make this as general as possible, ill define it using the scalar and
% vector potentials so that it can more easily be generalized
function matrix = emtensor( Ex, Ey, Ez, Bx, By, B... |
function set_graphic_sizes(h,fs,lw)
% set_graphic_sizes - enlarge the size of the fonts
%
% set_graphic_sizes(h,fs,lw);
%
% Copyright (c) 2008 Gabriel Peyre
if nargin==0
h = [];
end
if nargin<2
fs = 20;
end
if nargin<3
lw = 2;
end
if not(isempty(h))
set(h, 'LineWidth', lw);
end
set(gca, 'FontSize... |
%% Path planning algorithm test script
% Copyright 2018 The MathWorks, Inc.
%% Load and show the map
load myMapsV3
close all
show(map)
hold on
%% Interactively select points
title('STEP 1: Click on map to select start point');
startPoint = impoint;
startPos = getPosition(startPoint);
title('STEP 2: Cli... |
function plotForce(nbforce, nodedof, nodenum, xmax, ymax, nodex, nodey, edgex, edgey)
% for i = 1:elenum
% for ng = 1:12
% gauss_x((i-1)*12+ng) = gauss_pos(i,ng,1);
% gauss_y((i-1)*12+ng) = gauss_pos(i,ng,2);
% x_nbforce((i-1)*12+ng) = gauss_nbforce(i,ng,1);
% y_nbforce((i-1)... |
function kjm_printfig2(fname,ppsize)
% This function exports the current figure in a reasonable way, in both eps
% and png formats kjm 05/10
%
% "fname" - desired filename. include path if desired
% "size" - size of figure in cm
set(gcf, 'PaperUnits', 'centimeters');
set(gcf, 'PaperSize', [ppsize]);
print(gcf,fn... |
%plot defaults
set(0,'DefaultLineLinewidth',3);
set(0,'DefaultAxesFontSize',16);
set(0,'DefaultFigurePosition',[150 150 1600 1200]);
set(0,'DefaultLineMarkerSize',10);
set(0,'DefaultLegendFontSize',22);
set(groot,{'DefaultAxesXColor','DefaultAxesYColor','DefaultAxesZColor'},{'k','k','k'}) |
%Tests in An evaluation metric for image segmentation of multiple objects
gt =[0 0 0 0; 0 1 1 0; 0 1 1 0; 0 0 0 0];
im1=[0 0 0 0; 0 1 1 0; 0 1 1 0; 0 0 0 0];
im2=[0 0 0 0; 0 1 1 0; 0 2 2 0; 0 0 0 0];
im3=[0 0 0 0; 0 1 1 0; 0 2 3 0; 0 0 0 0];
im4=zeros(4);
%% Test 1: Perfect match
assert(oce(gt,im1)==0,'should be 0');... |
% Wireless Transmission over 60Ghz
%
% RX SCRIPT TO TRANSMIT DATA PROCESSED IN MATLAB
%
clear
close all
test_n=31;
Nsamples=98039*2;
%Set USRP values
gain=15;
%Receive sequence
rx_data=rx_60GHz(Nsamples, gain);
rx_data=rx_data/4400;
figure(1)
subplot(1,2,1);
plot(rx_data,'o');
%axis([-0.1 0.1 -0.1 0.1... |
mat_test = [1,11;11,3;6,8;6,7;6,6;12,14];
v_test_knn = [2, 4, 2, 2, 4, 6];
v_test_cm = [2, 4, 2, 2, 4, 6];
v_test_lr = [2, 4, 2, 2, 4, 6];
v_test_svm = [2, 4, 2, 2, 4, 6];
v_r = 0:0.5:20;
i_l = length(v_r);
mat_rows = repmat(v_r, [i_l,1]);
mat_cols = mat_rows';
% mat_te... |
delta=[1,zeros(1,127)];
n=0:127;
y1=filter(1,[1 0.9],delta);
figure,stem(n',y1);
y2=filter([0.2 -0.5 0.8],[1 -0.6 0.3],delta);
figure,stem(n',y2);
y3=filter([1 0.5 0.25],[1 -0.5 -0.6],delta);
figure,stem(n',y3);
%The function in (c) is not stable for the response is not bounded for all
%the n in its scope
|
function Ul = lag_forcing(U,Tl,Ta,Na)
[T,D] = size(U);
assert(D==1);
assert(T>2*Tl);
Ul = zeros(T,Tl+Ta);
for t = Tl+(Ta*Na):T
for l = 1:Tl
Ul(t,l) = U(t-l+1);
end
for a = 1:Ta
sdex = t-Tl - (a-0)*Na + 1;
edex = t-Tl - (a-1)*Na ;
Ul(t,Tl+a) = mean(U(sdex:edex));
end
end
Ul(1:Tl+(Ta*Na),:) = [];
... |
% This file is to coregister colored MSDWI to T1 for DARTEL deformation
clear;
clc;
addpath('/home2/HWGroup/wangfw/SPMTools');
load('/home3/HWGroup/wangfw/BSTry2/atlas.mat');
load('/home3/HWGroup/wangfw/BSTry2/bai_jiacheng.mat');
referenceT1NII = '/home2/HWGroup/wangfw/MAGICNET/NetworkData/bai_jiacheng/bai_ji... |
% demo of signal mining on Bars
% huajun 2014/9/12
clear all;
clc;
rehash;
%% set path
addpath(genpath('V:\root\qtool\data\'));
addpath(genpath('V:\root\qtool\framework'));
addpath(genpath('v:\root\qtool\indicator'));
workpath= 'd:\huajun\focus\sigMining\';
if ~exist(workpath, 'dir'), mkdir(workpath);end
cd(workpa... |
function fv=unit_cube_mesh
% Construct quadrilateral mesh of a unit cube with edges along
% positive x-, y-, and z-axes, and one corner at the origin.
%
% AUTHOR: Anton Semechko (a.semechko@gmail.com)
%
X=[0 0 0; ...
1 0 0; ...
1 1 0; ...
0 1 0; ...
0 0 1; ...
1 0 1; ...
1 1 1; ...
0 1 1];
F=[1 ... |
%function OldNewRecogExp(subNo,hand)
% OldNewRecogExp(subNo,hand);
%
% Example of an old/new recognition experiment.
%
% This is an example of a simple old/new recognition experiment. It is split
% into two phases, a study phase and a test phase:
%
% Study phase:
%
% In the study phase, the subject is presented with 3 ... |
% This script is used to generate three kinds of neural network, each using
% a different representation for the board.
data_cutoff = 94500;
net_size = 10;
% comment or uncomment depending on whether data is already loaded in
data = load_in_training_data(data_cutoff);
if (size(data,1) == 0)
fprintf('No data wa... |
function STAR = STAR_ID(Data,Pair,ac_er_ang, ac_er_dis,i,j,k)
%Calculate 3 sets of distance and angle by 3 peaks of triangle
[dis1,dis2,agl1] = StarPair(Data,i,j,k);
[dis3,dis4,agl2] = StarPair(Data,j,i,k);
[dis5,dis6,agl3] = StarPair(Data,k,i,j);
%% Set 1
Pair1 = Pair;
% Eliminati... |
function [m] = MQ_nq1(c,x)
%atenção à ordem dos inputs: primeiro c e depois x
m=c(1)./x+c(2)*sin(x)+c(3)*x.^2;
end
|
clear all;
SerialPort='COM3'; %serial port
MaxDeviation = 3;%Maximum Allowable Change from one value to next
TimeInterval=0.5;%time interval between each input.
loop=1;%count values
%%Set up the serial port object
s = serial(SerialPort)
fopen(s);
time =now;
temperature = 0;
%% Set up the figure
f... |
function joint_tables = re_arrange_data(data_as_struct)
%% Go through the data
subj_codes = fieldnames(data_as_struct);
for subj = 1 : length(subj_codes)
subj_code = subj_codes{subj};
exercises = fieldnames(data_as_struct.(subj_code));
for ex = 1 : length(exercises)
... |
channel_avg = {{'F5';'F7';'FT7';'FC5'};{'AF8';'F6';'F8';'FT8';'FC6'};{'C4';'C6';'CP6';'CP4'};{'POz';'P2';'P4';'PO4'}};
channel_no = 4;
%% ======================= real pair coherence==========================
load([project.paths.processedData '/coherence/matlab.mat'], 'prespeech','prelisten');
load([project.paths.svn... |
function R = irpCut(H, cx, cy, r)
% R = irpCut(H, cx, cy, r)
% Schneidet eine kreisrunde Fläche aus dem Hough-Raum heraus bzw. setzt
% innerhalb einer kreisrunden Fläche alle Werte auf null.
%
% Parameter:
% 'H' 2d Hough-Raum
% 'cx' x-Koordinate des Kreismittelpunktes
% 'cy' ... |
function [] = saveSession(eeg_frame,sim_out,phase_id,description,filename)
%SAVESESSION Summary of this function goes here
% Detailed explanation goes here
eegSessionBundle = getSessionFromFrame(eeg_frame);
if phase_id==1
save(filename,'eegSessionBundle','phase_id');
else
[modelParametersBundle,statsBundle,dxyBundle... |
function [C,R] = acf(varargin)
% acf Sample autocovariance and autocorrelation functions.
%
%
% Syntax
% =======
%
% [C,R] = acf(X)
% [C,R] = acf(X,Dates,...)
%
%
% Input arguments
% ================
%
% * `X` [ tseries ] - Tseries object.
%
% * `Dates` [ numeric | Inf ] - Dates or date range f... |
function [ x,y ,xk, yk] = forw_kinematics(th_k, th_a, params, X_a, Y_a)
L_a = params.La;
L_k = params.Lk;
x = L_a*cos(th_a) + L_k*cos(th_k + th_a) + X_a;
y = L_a*sin(th_a) + L_k*sin(th_k + th_a) + Y_a;
xk = L_a*cos(th_a) + X_a;
yk = L_a*sin(th_a) + Y_a;
end
|
clear all ;
close all ;
% 采用分治策略设计网络
% number of patterns to be remembered
m = 4 ;
% read and reshape the image to vector
Im = {
rgb2gray(imread('01.jpg')), ...
rgb2gray(imread('02.jpg')), ...
rgb2gray(imread('03.jpg')), ...
rgb2gray(imread('04.jpg')), ...
};
[image_height, image_width] = size(Im{1})... |
classdef Hmm < ChainModel & LatentVarModel
%HMM
properties
dof;
ndimensions; % dimensionality of the observation model
ndimsLatent = 1;
params; % stores starting dist & starting distribution over hidden states
prior = NoPrior();
nst... |
clear all; close all;
[data1,data2,data3,data4,data5,data6] = loadData();
right = 0;%counter
total = 0;%counter
[traindata,testdata] = randomSplit(data2,0.8);
traindata = traindata;
testdata = testdata;
shape = size(testdata);
numofcol = shape(2);
numofrow = shape(1);
svmmodel = svmtr... |
function [p_optim] = OptimLagByAutoc()
%Fonction permettant d'optimiser le nombre de retard p* optimal pour les
%variables explicatives du modèle AR sur Yt, par la méthode de
%l'autocorrélation partielle
global Yt;
warning('off');
partial_autocorr = parcorr(Yt);
%on initialise le p* à 0
p_optim = 0;
%on... |
function h = viewTrace(x,t,winSize)
h = figure;
fPos = get(gcf,'Position');
nTrace = size(x,2);
for l=1:nTrace
subplot(nTrace,1,l)
plot(t,x(:,l))
xlim([t(1) t(1)+winSize])
end
setappdata(h,'winNum',1)
backButton = uicontrol(h,'Style','pushbutton','String','<<','Position',[0.01 0.01 50 25],'Callback',['for l... |
function [] = PCA_check( task, fast, fast_check, knn, selected_channels,...
number_sub_channel, threshold, KernelSVM, size_of_subject)
%PCA_CHECK check models
%==========================================
%Author: Uladzislau Barayeu
%Github: @UladzislauBarayeu
%Email: uladzislau.barayeu@ist.ac.at
%===================... |
function [span] = TrajSdToSpan(mean,sd,n)
temp_min = min(mean-3*sd);
temp_max = max(mean+3*sd);
span=linspace(temp_min,temp_max,n);
end |
function [] = script_trigger_psth_amplitude_distribution()
%SCRIPT_TRIGGER_PSTH_AMPLITUDE_DISTRIBUTION 脚本:处理刺激Trigger后的Spike统计信息
% 1:程序运行时要求输入一个MCD文件(SPIKE)
% 2:若有多个Trigger数据流存在,程序要求用户选择
% 其他参数请酌情手动调整 -_-!...
%
% 蒲江波 - 2009年5月22日
% 蒲江波 - 2009年5月31日
% 引入统一的util_load_spike_trigger_mcdstream_whold_... |
function [ss]=hist_lbp(img,m,n,s,t)%原图
img_lbp=[];
if ndims(img)==3
img_gray=rgb2gray(img);
else
img_gray=img;
end
img_gray=double(img_gray);
img_gray=imresize(img_gray,[m,n],'bicubic');%大图切成100*100
img_lbp=lbp_img(img_gray);%可显示的int图片
img_lbp=double(img_lbp);
%patchsize=[s,t];%小块
fea=[];
for i=1:s:m
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.