text stringlengths 8 6.12M |
|---|
function locs=getcelllocation(g)
%Get file with most spikes
cnum=0;
locs=[];
for ch=2:size(g.channels,2)
for cell=1:size(g.chanclust{ch},1)
cnum=cnum+1;
sptimes=g.chanclust{ch}(cell,:);
for f=1:size(sptimes,2)
nspikes(f)=size(sptimes{f},2);
end
lf=find(nspikes==max(nspikes));lf=lf(1);
snips=loadaibdata(... |
students_calc_cv;
clc;
data = csvread('students.txt');
X = data(:, 1:end-1);
y = data(:, end);
X_norm = X;
mu = zeros(1, size(X, 2));
sigma = zeros(1, size(X, 2));
for i = 1:length(mu)
cur_column = X_norm(:, i);
mu(i) = mean(cur_column);
sigma(i) = std(cur_column);
X_norm(:, i) -= mu(i);
X_norm(:, ... |
function ib = loadib(subjects,missings)
% subjects = scalar number of subjects scanned
% missings = vector of subjects whose scans to exclude
% set defaults for choking and officer
if nargin<2 || ~numel(missings)
ib = [];
if subjects == 22 % choking default
ib = [1;3;4;6;7;8;9;10;11;12... |
function modified_springs = modify_spring_length( X, springs )
% this function modifies the length of springs based on the displacement
% X should be a vector containing all the compression value
% springs should be a cell array containing all the shaped data of the
% uncompressed spring
% the function will return an c... |
function[rgb]=get_color(q)
im = imcrop(q);
redmax = max(max(im(:,:,1)));
redmin = min(min(im(:,:,1)));
greenmax = max(max(im(:,:,2)));
greenmin = min(min(im(:,:,2)));
bluemax = max(max(im(:,:,3)));
bluemin = min(min(im(:,:,3)));
rgb = [redmax, redmin, greenmax, greenmin, bluemax, bluemin];
end |
function testFactorFunctionRegistry()
% Unit test for FactorFunctionRegistry class
ffr = FactorFunctionRegistry();
env = DimpleEnvironment.active();
ffr2 = env.FactorFunctions;
pffr = ffr.getProxyObject();
assertEqual(pffr, unwrapProxyObject(ffr));
% Both should refer to the same underlying Java FactorFunctionRegist... |
function CloseExcelConnection( Excel )
Excel.ActiveWorkbook.Save;
Excel.Quit;
Excel.delete;
end |
function fighandle = uq_display_cobweb(X, Y, varargin)
% disphand = UQ_DISPLAY_COBWEB(X, Y, varargin) Accepts a set of raw data
% and a set of conditions and produces a 'cobweb' plot. In order to bring
% different sets of lines to the front, use the scroll whell on the plot.
%
%
% varargin can consist of the following ... |
vector=[1:3:9]
matrix=[1 2 3;4 5 6 ;7 8 9]
z=zeros(5,1)
random=rand(1,5)
transpose= matrix.'
m1=[1 5 9;2 3 6;7 4 1]
m2=[7 4 1;4 5 6;3 5 7]
inner_product= dot(m1,m2)
cross_product=cross(m1, m2)
inverse=inv(m1)
scalermultiplicationf=8.*(m1)
h=ones(1,4)
i=zeros(1,4)
concate=[h i]
complexvector= complex(m1,... |
function TS=updateTS(TS,Mb,A,Wi,Wb,T,M,P,N,S,MAXTS,MINTS)
% Update the Time-Shifts via a cross-correlation analysis
%------------------------------------------------------------------------
% N.B.: this function may drastically slow down the program
% Consider compiling this function to speed up (e.g. using codege... |
%take shot of all frames
obj = VideoReader('exit.mp4');
vid = read(obj);
frames = obj.NumberOfFrames;
i = 1 ;
for x = 3 : 30 : frames
imwrite(vid(:,:,:,x),strcat(num2str(i),'.png'));
i=i+1;
end
sequence(i-1); |
%% MyMainScript
tic;
close all;
%Initial code for changing the default colormap
myNumOfColors = 200;
colorScale = 0:1/(myNumOfColors-1):1;
myColorScale = [ colorScale' colorScale' colorScale' ];
%% Image Shrinking
circles = imread('../data/circles_concentric.png');
circles_shrunk2 = myShrinkImageByFactorD(circles,2... |
%% difference equation iteration
n = 10;
a = zeros(1,n+1); % initialize / pre-allocate
% parameter(s) & initial condition(s)
%r = 3.3; a(1) = 0.1; % logistic example
a(1) = 18;
% iterate
for j = 2:(n+1)
%a(j) = r*a(j-1)*(1-a(j-1)); % logistic map
%a(j) = a(j-1) + 1;
%a(j) = a(j-1) + (j-2);
%a(j)... |
% TRY OLD DEBLURRING USING MULTI-CORE PROCESSING %
% initPop = initPop / 255; % convert rgb value to floating point
% Set Total Poplation
popSize = 20;
% read image
im = imread('cameraman3.tiff'); % original image
[x,y] = size(im);
imb = meanBlur(im); % blurred image
% imb = im2double(imb);
% image restoration hold... |
%{
Am ales w0 si N astfel incat suportul sa contina cel putin 5
perioade ale sinusoidei.
%}
N = 100;
n = 0:N-1;
w1 = pi/8;
w2 = pi/3;
x1 = cos(w1*n);
x2 = cos(w2*n);
x = x1 + x2 ;
figure(1);
subplot(311);
stem(n, x);
title('Semnalul x');
subplot(312);
stem(n, x1);
title('Semnalul cos(w1*n)');
subpl... |
function bin_table = util_print_bins_with_files( varargin )
%UTIL_PRINT_BINS_WITH_FILES Print out how many bins in each data file.
% This function is helpful when you are counting bins from multiple
% files. It is also very helpful to count DIVs (days in vitro) from
% multiple recordings.
%
% Input:
% ... |
%% Construct PDF
%
% First version: Richard Tol, 29 March 2021
% This version: Richard Tol, 29 March 2021
%% Sensitivity analysis on kernel functions
NFilterSave = NFilter;
NFilter = 1;
nosplit = true;
distpos = 'normal'
distneg = 'normal'
JohnsonSU = true;
Silverman = true;
ConstructPDF;
JointPDFJSUS ... |
function newSketch(pb,src,event)
%% set up figure
pb.sketchObj=[];
pb.sketchConnection=cell(8);
if ~isempty(findobj(0,'tag','sketchFig'))
pb.sketchFig = findobj(0,'tag','sketchFig');
else
pb.sketchFig = figure;
set(pb.sketchFig,'keypressfcn',@pb.updateSketch,'tag','sketchFig');
set(pb.sketchFig,'positi... |
function [ G, IBand ] = transfCompuesta( I, AnIn, AnRo , Kpe)
G = 0;
IBand = 0;
cosIn = cosd(AnRo);
senIn = sind(AnRo);
nCoord=zeros(size(I,1),size(I,2),2); %% X' , Y'
for i=1:size(I,1) %% renglones
for j=1:size(I,2) %% columnas
tempx = (cosIn*AnIn)- senIn;
... |
currentposn = [ 0,0];
targetpos = [-10,-10];
errorpos = targetpos - currentposn;
errorpos(1) = currentposn(1)-targetpos(1);
targetangle = rad2deg(atan2(errorpos(2),errorpos(1)) )-90
if targetangle < 0
targetangle = targetangle+360
end
|
function Plot_Tuning_extra(imgobj, comp)
stim_list = 1:size(imgobj.dFF_s_ave, 2);
if ismember(imgobj.selectROI, comp.roi_ds2)
f_vM = @(b, x) b(1) * exp(b(2) * cos(x - b(5))) .*...
exp(b(3) * cos(2*x - 2*(b(5)+b(6)))) + b(4);
%
elseif ismember(imgobj.selectROI, comp.roi_os2)
f_vM = @(b, x) b(1) * e... |
function A=readMRI(slice)
%infile='MRI\t1_icbm_normal_1mm_pn3_rf20.mnc'; fid=fopen(infile);
infile='MRI\t1_ai_msles2_1mm_pn3_rf20.mnc'; fid=fopen(infile);
A=zeros(512,512);
%env=(cos([0:8]/8*pi)+1)/2; envv=fliplr(env);
oft=20/256; env=(cos([0:8]/8*pi)+1)*0.5*(236/256) +oft; envv=fliplr(env);
tem=[zeros(32,1)+oft;... |
% draw_lines.m
function draw_lines(str)
global x0 y0 flag;
switch str
case 'down'
current_pt=get(gca,'CurrentPoint');
x0=current_pt(1,1);
y0=current_pt(1,2);
flag=1;
case 'motion'
if flag==1
current_pt=get(gca,'CurrentPoint');
x1=current_pt(1,1);
... |
function [sNOxCalc, cNOxCalc, TuCalc, TbCalc, vuCalc, vbCalc, FuCalc, FbCalc, pCylCyc, TCylCyc, FCylCyc, phiCombCylCyc] = NOxPostProcessNew(timeSim,phiCyl,pCyl,TCyl,FCyl,vCyl,mfCyl,QCyl,WCyl,nStroke,varargin)
if isempty(varargin)
FComb = 1; %Fuel air equivalent ratio of combustion
fs = 0.0683;... |
function [frame_struct] = classification(boundingBox, mdl_target_background, mdl_car_truck, params, visualize)
% TODO: Add explicit explanations here
frame_struct = struct();
frame_struct.maskCumulative = zeros(params.h, params.w, 'uint8');
target_k=1;
for k=1:length(boundingBox)
bb = [];
bb = [bb; int16(bound... |
%%主程序
%[u1,u2,u3]=dsolve('Du1=u2','Du2=u3','Du3=2*u3','u1(0)=1','u2(0)=1','u3(0)=1')
clc;
clf;
tspan=[0,2];
u0=[1,1,1];
h=0.1;
[t1,u1]=Kutta4s(@dufun2,tspan,u0,h);
u1exact=1/4*exp(2*t1)+t1/2+3/4;
u2exact=1/2*exp(2*t1)+1/2;
u3exact=exp(2*t1);
plot(t1,u1(1,:),'-*',t1,u1(2,:),'-*',t1,u1(3,:),'-*',t1,u1exact,'o',t1,u2exa... |
%function [cpgIslands, cpgCount, codingCount, cpgLengthMtr] = CpGviterbi(seq)
%implementation of Hidden Markov Model for CpG Islands
%which uses the viterbi algorithm to find the best path
%toy samples
%[head, toy1] = fastaread('Toy_seq\seq1.fa');
%[head, toy2] = fastaread('Toy_seq\seq2.fa');
%input sequence
FASTAfile... |
function [rho] = tfem(a, b, ksi, w, wn, k)
% Displays stability chart
% 3 nodes for each element, and two weighted functions
% a = 0.01;
% b = 0.01;
m = 40; % element number
n = 2; % state space order
sz = m*4+2;
H = zeros(sz,sz);
G = zeros(sz,sz);
H(1:2,1:2) = eye(n);
G(1:2,sz-1:sz) = eye(n);
% [N, P] = matfun(m,... |
function [Pa_b, Pb_a, jh, Pa, Pb, Pab ] = cprob(a,aRange, b, bRange)
% function [Pa_b, Pb_a, jhist, Pa, Pb, Pab ] = cprob(a,aRange, b, bRange)
%
% (c) 2005 Luis Hernandez-Garcia
% University of Michigan
% report bugs to: hernan@umich.edu
%
% Find the conditional probability of A being in the aRange interval
% given t... |
function [output_es, pow_es] = powAnalysis(animal, iseries, expt_list, cond_tag, chns, savedata)
if nargin< 5
savedata = false;
end
if nargin< 4
cond_tag = 'none';
end
if nargin< 5
chns = [20 40];
end
SetDirs;
es = VRLoadMultipleExpts(animal,iseries,expt_list, 'BEHAV_LFP', chns);
allCont = unique(es.co... |
function [magnitude_kp2,orientat2,u,v]=magtheta33(I1,B1,sigma_not)
%I1=imread('cameraman.tif');
I1=double(I1);
[r1 c1]=size(I1); %size of input image
I=zeros(r1+16,c1+16); %creating zero matrix for new padded image
%=======Padding image on both sides by 8======%
for i=1:r1
for j=1:... |
%%
imgs = PatientsData(6).brain_pos;
annots = PatientsData(6).annots;
index = 5;
brain = imgs(:,:,index);
annot = annots(:,:,:,index);
figure;imshow(brain)
figure;imshow(annot)
%%
img_pad = pad_brain(brain, 0.1);
%%
sel_index = [97];
%%
index = 220;
brain = result(index).brain;
annot = result(index).annotated_img;... |
function varargout = wmuldentoolmonab(varargin)
% WMULDENTOOLMONAB MATLAB file for wmuldentoolmonab.fig
% Called by WMULDENTOOL (More On Adapted Basis).
% Last Modified by GUIDE v2.5 10-Jan-2006 10:49:47
%
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 06-Jan-2006.
% Last Revision: 25-Jan-2012.
% Copyright 199... |
function [t] = sample2time(sampleindex,fs,secondperunit,zerotimesampleindex)
%SAMPLE2TIME Get the times of samples, relative to zerotimesampleindex, and
% convert to time unit specified in secondperunit
if nargin==2
secondperunit=1;
zerotimesampleindex=1;
elseif nargin==3
zerotimesampleindex=1;
end
t=doub... |
function Yprime = fox2(t,Y)
k = 0.75;
r1=sqrt(1+t)*cos(t);
r2=sqrt(1+t)*sin(t);
r = [r1,r2]';
r1prime=1/2*cos(t)/sqrt(1+t)-sqrt(1+t)*sin(t);
r2prime=1/2*sin(t)/sqrt(1+t)+sqrt(1+t)*cos(t);
rprime=[r1prime,r2prime]';
s = k*norm(rprime)/norm(rprime-Y);
Yprime=s*(r-Y);
end
|
function CMOS = shiftCMOS(cmosData)
% transfers each pixel from 3D CMOS data set and shifts into struct
% variables in 2-dimensional space
% Arthur Morrissette v1 may 2015
% *assuming 100x100 pixel space
% lcmos = length(cmosData(1,1,:));
% Create Structure for data copy
CMOS = struct('timeSeries',[],'std',[]);
... |
function [opars] = IWANPARCONVERT(ipars, dir)
%IWANPARCONVERT Convert 4-Parameter Iwan Parameters between equivalent
%representations
% USAGE:
% opars = IWANPARCONVERT(ipars, dir);
% INPUTS:
% ipars : Nx4 vector of Iwan Parameters
% dir : If 1, ipars=[Fs Kt Chi Beta]
% If 2, ipars=[R S Chi Phima... |
% This function determines if a given image is that of a face
% or not, based on information extracted from a dataset of face
% images.
function [min_dist output_img_index] = face_recognition(image_path, m, A, eigenfaces, pr_img)
% Read image:
matrix = double(rgb2gray(imread(image_path)));
T = matrix'(:);... |
function [] = dist_travelled(clipno, group)
% This function calculates the total distance travelled by the eye in an
% eye tracking session, using GZD files
homepath = '/Users/liam/Projects/Final-Year-Project';
% get the Expert model for the clip
load(strcat('expert',int2str(clipno),'.net'), 'mix', '-mat'... |
clear all
clc
index = 0;
ind1 = 0;
angle = 0;
b = 0;
vidIn = VideoReader('C:\Users\Parasite\Desktop\awan.mp4');
endOfFrame = vidIn.NumberOfFrame();
index=index+1;
mov1 = read(vidIn, 10);
mov2 = read(vidIn, 25);
im1 = rgb2gray(mov1);
im2 = rgb2gray(mov2);
[rows, columns] = size(im1);
height = 300;
ratio_b21 =... |
function [X, G, XTest, GTest] = trainTestSplit(X,G,SplitDataPrs)
% [X, G, XTest, GTest] = trainTestSplit(X,G,SplitDataPrs)
%
% Randomly splits data into train (X,G) and test (XTest,GTest) datasets,
% using SplitDataPrs.trainFraction to determine fraction of data that will
% be used for training
nDataPts = size(X,2);
i... |
%% fn_displayarrows
%% Syntax
% fn_displayarrows([[x,y,]img,]arrows,sub,flag)
%% Description
% Input
% - x,y vectors
% - img array
% - arrows array (...) or 2-element cell array
% - sub scalar or 2-element vector
% - flag ''
%
% USES MATLAB CONVENTIONS FOR IMAGES (i.e. row... |
function doImputation(data_fname, data, miss_rate, rand_arr, cont_ind, method, varargin)
% To excute imputation using required method
save_fname = sprintf('%s_%s_%s.mat',data_fname,num2str(miss_rate),method);
if (exist(save_fname,'file'))
return;
end
col_num = size(data,2);
row_rand... |
function C=getRangeC(k)
C=false(2^k,k);
row=1;
for i=0:k
n=(1:k);
idxs=nchoosek(n,i);
for j=1:size(idxs,1)
C(row,idxs(j,:))=true;
row=row+1;
end
end
end |
classdef u_v_dn_model < models.model
methods
function obj = u_v_dn_model(varargin)
obj@models.model(varargin{:});
end
function initialize(obj)
initialize@models.model(obj);
obj.labels = {'v', 'u', 's'};
obj.n_vars = 3;
obj.... |
% Alexandros Dimas
% University of Patras
% Department of Mechanical Engineering and Aeronautics
% Robotics Group
% Spring 2020
% Euler to Rotation Matrix
%{
Convention 1: MBA refers to pose of frame {B} as seen by {A}. Similar
notation is used to describe relative position and orientation of two
frames.
%}
functi... |
function spc_switchChannel
global spc gui
if ~spc.switches.noSPC
if (gui.spc.proChannel > spc.nChannels)
gui.spc.proChannel = spc.nChannels;
end
end
set(gui.spc.figure.lifetimeUpperlimit, 'String', num2str(spc.fit(gui.spc.proChannel).lifetime_limit(1)));
set(gui.spc.figure.lifetimeLowerlimit, 'String'... |
classdef TVH < PerformanceCalculator
properties (Constant)
name='TVH';
end
methods (Access = public)
function [obj] = TVH(algoBox)
if (nargin~=1)
error('You must enter an AlgorithmBox as argument of a performance calculator constructor.');... |
diary 'sourcedata/eeg/sub-s01.log';
%% CHECK FOR OUTPUT PATH AND CRETAE IF NECESSARY
eeg_init({'sourcedata/eeg/IC_trn_P01_F_1.bdf', ...
'sourcedata/eeg/IC_trn_P01_F_2.bdf', ...
'sourcedata/eeg/IC_trn_P01_f_3.bdf', ...
'sourcedata/eeg/IC_trn_P01_f_4.bdf', ...
'sourcedata/eeg/IC_tr... |
function bytes = byte2(n)
% Splits an integer into 2 byte with first byte being the least significant
byte1 = floor(n/256);
byte0 = floor(n - byte1*256);
bytes = [byte0 byte1];
|
function [P_total_10Be, P_total_26Al] = BMC_production_model(MassDepth)
% muon production for bear meadows core
Latitude = 40.7481; % bear meadows core latitude
Longitude = -77.7457; % bear meadows core longitude
Elevation = 562; % bear meadows core elevation from lidar
Pressure = ERA40atm(Latitud... |
function [ Q, t ] = central_differences( gridpoints, initial_values, discrete_flux, timestepsize, finaltime, a)
%calculates the central difference scheme for a partial differential
%equation
%INPUT:
%gridpoints: vector containing the grid points of the discretisation
%initial_values: vector containing the i... |
classdef GainPlugin < audioPlugin
properties (Access = public)
gain = 1;
end
properties (Access = private)
dBGain = 0;
smoothGain = [0 0];
alpha = 0.99;
end
properties (Constant)
% PluginInterface = audioPluginInterface(audioPluginParameter('g... |
function [pc, dprime, ntrial] = getPerf(correct, response, targettype)
dprime = nan;
Idx = ismember(response, [0 1]);
pc = mean(correct(Idx));
ntrial = sum(Idx);
if nargin ==3
hit = sum(response(Idx) == 1 & targettype(Idx) == 1) / sum(targettype(Idx)==1);
fa = sum(response(Idx) == 1 & targettype(Idx) == 0... |
function CheckSolBase(fn,path)
%% Check if needed files are present
% Erase a possible POSTFIX
filename = erase(fn,'_CHECK');
if contains(filename,'_SOL2')
filename = erase(filename,'_SOL2');
else
filename = erase(filename,'_SOL');
end
% Create a string of the SOL and CHECK file
solutionFile = rep... |
function G = debundle(G, varargin)
%DEBUNDLE Divided edge bundling
%
% G = debundle(G)
%
% This function replicates the divided edge bundling algorithm, as
% described in:
%
% Selassie D, Heller B, Heer J (2011) Divided edge bundling for directional
% network data. IEEE Trans Vis Comput Graph 17:2354-2363
%
% This v... |
function [success]=InhalePush(dInhale,dPush,dOrigin)
Fs = 44100;
dMul = dInhale.*dPush;
windowSize = 1000;
s = 1;
i = 1;
len = length(dInhale);
e = zeros(len/windowSize + 1,1);
while s + windowSize - 1 <= len
subD = dMul(s:s+windowSize-1,1);
e(i)= dot(subD,subD);
i = i + 1;
s = s + windowSize;
end
... |
% exm3_laplace_ilaplace.m
% 例3:拉普拉斯变换与逆变换符号表示法
% 北京邮电大学,尹霄丽
% 2018年12月
syms t s
x=exp(-3*t)*heaviside(t)
H=(3*s+1)/(s*s+2*s+5)
X=laplace(x)
Y=X*H
y=ilaplace(Y)
ezplot(y,[0 10]);
axis([0 10 -1 1]); |
function OnTemperatureMeasured_console(src,evtdata)
global temperature;
fprintf('Event OnTemperatureMeasured(temperatureDegreesC = %1.3f)\n', evtdata.temperatureDegreesC);
temperature = evtdata.temperatureDegreesC;
end |
%
% irpGetStripeImages generates "stripe patterns" from Gray-Code
% These patterns are displayed in fullscreen and for each pattern an image is
% captured with the attached camera.
%
% The captured images are saved in the variable "striped".
% A particular image (index i) can be accessed via striped{i}.
%
% max_stripe... |
function pvalue=VTD_Landscape_Model_v1_Priors(paramnumber,CaseLandscape)
if paramnumber==1
%a
if CaseLandscape == 1
%pvalue = -random('Gamma',10,0.9);
pvalue = -random('Gamma',21,0.6);%% 80% -> 40% with height saddles
elseif CaseLandscape == 2
pvalue = -random('Gamma',10,0.9);
e... |
%
% D_INITIAL: Driver script to create a ROMS initial conditions file.
%
% This a user modifiable script that can be used to prepare ROMS initial
% conditions NetCDF file. It sets-up all the necessary parameters and
% variables. USERS can use this as a prototype for their application.
%
% svn $Id: d_initial.m 62... |
function out = Forward(in,kernel,act_func,stride,padding)
arguments
in (:,:,:,:) double
kernel (:,:,:,:) double
act_func = @Relu
stride (1,1) double = 1
padding (1,1) double = 0 %zero padding
end
[col,row,~,in_n] = size(in);
if padding ~= 0
pad = zeros(col+padding*2,row+padding*2,1,in_n);
p... |
rmpath('C:\Users\gcao\Desktop\GPs');
rmpath('C:\Users\gcao\Desktop\GPs\util');
rmpath('C:\Users\gcao\Desktop\GPs\mean');
rmpath('C:\Users\gcao\Desktop\GPs\cov');
rmpath('C:\Users\gcao\Desktop\GPs\inf');
rmpath('C:\Users\gcao\Desktop\GPs\lik');
rmpath('C:\Users\gcao\Desktop\GPs\doc');
rmpath('C:\Users\gcao\Deskto... |
clear;
close all;
clc
%% Set up Network Size
input_layer_size = 11;
hidden_layer_size = 25;
num_labels = 4;
%% Load Data
fprintf('Loading data ...\n');
X = load('nn_train_features_x.txt');
y = load('nn_train_labels_y.txt');
Xpred = load('nn_input_features_x.txt');
[m numfeat] = size(X);
[mpred numpr... |
function [activity, mask] = activityFromSpatialComp(mousename, imagingFolder, mdfFileNumber, ch2read, spatialComp, contour_threshold)
% compute mean fluorescence signal of a Tif movie for each ROI.
% mask is driven from spatialComp.
% mousename = 'fni17';
% imagingFolder = '151102';
% mdfFileNumber = 1; % or t... |
function [C0f,errest,varargout] = pdcfsFFT(Pad,funct,varargin)
%-------------------------------------------------------------------------------
% USAGE of "pdcfsFFT".
%
% [C0f,errest] = pdcfsFFT(Pad,funct,[],opt1,opt2,...)
% [C0f,errest,cubature] = pdcfsFFT(Pad,funct,xyrange,opt1,opt2,...)
%
% Compute the coefficient ... |
function obj = resetMijiClass(obj)
% This clears Miji from Java's dynamic path and then re-initializes. Use if Miji is not loading normally.
% Biafra Ahanonu
% started: 2014.07.31 - branch from calciumImagingAnalysis 2020.05.07 [15:47:29]
% inputs
%
% outputs
%
% changelog
%
% TODO
%
ciapkg.api.resetM... |
%calling function performTrade
%performing trade on seller if buyer already exists in the buyers_list
function [node] = trade_already_exists(node,seller,buyers_id,index,request)
service = node(seller).service;
cnt_upto_now =0;
buyers_list = node(seller).buyers_list;
for i=1:index
cnt_upto_now = cnt_upto_n... |
%% Stelling 9
%
% Met de functie sqrt(2) wordt het getal 2 gekwadrateerd.
%
Antwoord = 0;
|
function meso_stack = mesoscope_stack_to_tiff(in_filename_base)
%% convert mesoscopic z-stacks to stitched multiplane TIFF, assuming one channel in file
infn = in_filename_base;
chan_ix = 1;
%%
[raw, myinfo] = sbxread_all(infn);
%%
overlap = 15;
frame_rows = myinfo.sz(1);
frame_cols = myinfo.sz(2);
tiles_... |
function plotAccUnionITI(tmid, accSVMlinConseq, accSVMlin, accSVMlinPrev, chanceLevels, toneTime, labelsFontSz)
accSVMlinUnion.raw.mean = [transpose(accSVMlinConseq.raw.mean(:)) nan(1,5) transpose(accSVMlin.raw.mean(:)) nan(1,5) transpose(accSVMlinPrev.raw.mean(:))];
accSVMlinUnion.raw.std = [transpose(accSVMlinConseq... |
function sample = Rawdata2Sample(raw, windows, FeatureName)
L = length(raw);
LI = windows.LI;
LW = windows.LW;
Nwindows = floor((L-LW)/LI);
Nfeatures = length(FeatureName);
sample = [];
for wd=0:Nwindows-1
data = raw(wd*LI+1:wd*LI+LW);
sample_row = [];
for nf = 1... |
function [ lats, lons, intIds, names ] = loadWhinWeatherStationInfo()
%LOADWHINWEATHERSTATIONINFO A helper function to extract the WHIN weather
%station information from the raw log file.
%
% Outputs:
% - lats, lons
% GPS (lats, lons) for the weather stations.
% - intIds
% Integer IDs of the weather station... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Extended Babylonian Method: finding the nth root
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n = 17; % We will calculate the nth root.
a = 2; % The number we want the nth root of: a^(1/n).
x = 1; % An initial guess.
last_x = -1; % If the las... |
function img = PrewittGradDetector(image)
% Calculates the 3x3 Sobel Gradient Detector given an input image
%
% img = output image (gradient-detected)
% image = input image name as string
B=imread(image);
if size(B,3)==3
B = double(rgb2gray(B));
end
if size(B,3)<3
B = double((B));
end
Dx = [-1 0 1; -1 0 1; -1 0... |
function def = grouping( )
% grouping Default options for grouping class.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%--------------------------------------------------------------------------
def.eval = {
'append', true... |
%set dmap and disparity map ranges to .01 and .99 quantiles to get rid of outliers
% then inpaint NaN values
function cleaned = cleanDepth(image)
%normalize dmap and disparity map, to .01 and .99 quantiles to get rid of
%outliers
cleaned = image;
cleaned.imZ(cleaned.imZ > quantile(cleaned.imZ(:), 0.99)... |
function din = read_digitalBoard(filename)
% Intan software saves the digital input lines in seprate files
% This function reads the digital file that has info. related to when the
% sample was turned on
% use:
% din = read_digitalBoard(filename)
% $KK
fileinfo = dir(filename);
num_samples = fileinfo.bytes/2;
fid = fop... |
function [ca, ch, cv, cd]=b44int(x)
% For bior4.4, there are 9/7 coificients. Add 4 points at the start,
% and at the end, since the filter is symmetric.
% To do symmetrical reflection, for decomposition: odd interpolation
% should be used at both the start and the end because both filters (low
% and high) have od... |
clear all
clc
A = 379.62;
B = 632.7;
C = 506.16;
l = 1.327;
alp = 7.789e12;
bet = 1.7e12;
gam = 6.427e11;
k = 4.87;
cost = @(x) (A*(alp/(15 - bet/(x)^k))^(l/k) + B*(x)^l + C*(gam/(5+(bet/(x)^k)))^(l/k))/(1e6);
str = 'Cost function is not U shaped';
y_L = 205;
y_U = 210;
%%
r = (3 - sqrt(5))/2;
y_1 = y_L + r*(y_U - y... |
%% This program plots the graph as soon as the wavefunction is calculated.
% Using Natural Units
hbar = 1;
m = 1;
%====================================================================
% Parameters for solving the problem in the interval 0 < x < L
i = sqrt(-1);
L = 200; % Interval Length
N = 1600; % No of points
x = lin... |
function scaled = Scale_removeNAN(data);
scaled = (data - nanmean(data)) / nanstd(data);
scaled(isnan(data)) = 0; |
%% MATLABによる"ディープラーニングで打音検査"
%
% 打音データの取得の取得から、前処理、ネットワークの構築と学習、
% 結果の可視化までのワークフローをご紹介いたします。
%
%
% 参考例題
% https://jp.mathworks.com/help/deeplearning/examples/deep-learning-speech-recognition.html?lang=en
%
%【デモで使用しているToolbox】
% Signal Processing Toolbox:信号の前処理(ピーク検出)
% DSP System Toolbox :Audio Toolboxに必要
% Au... |
function [A] = demodQAM_4thPower(A,M,p)
% Last Update: 02/05/2019
%% Check for Class A (QPSK-like) Symbols
if isfield(A,'A')
A.A1 = abs(A.A).^p.*exp(1j*angle(A.A)*4);
end
%% 4th Power Demodulation for Other (non-QPSK) Symbols
if M == 64
% Rotation angles definition:
phiRotB = atan(3) - pi/4;
phiRotC... |
classdef linear_exchange_model
%CLASS LINEAR_EXCHANGE_MODEL describes multi-site model of exchange, relaxation, perfusion, etc.
% Allows model description to easily be passed to functions
% For use with Flip Angle Design scripts
%
% Flip Angle Design Toolbox
% John Maidens (maidens... |
% from e:/data/cloud_from_cloudGAN6_001
% save_to e:/data/cloud_from_cloudGAN6_001_improve
cloud_dir = 'e:/data/cloud_from_cloudGAN6_001';
cloud_improve_dir='e:/data/cloud_from_cloudGAN6_001_improve';
clouds=dir( [cloud_dir, '/*.png' ] );
i=1;
while(i<=length(clouds))
t=imread( [ cloud_dir, '/', clouds(i).... |
function A = generate_line_pluecker_mod(l1, l2, third_proj, pt_shift, u, is_direct, is_stereoshift, prime_num)
t2 = [1;0;0];
inds = [1 2 3; 4 5 6; 7 8 9];
if (~is_direct)
inds = inds';
end
[X1, X2] = resolve_line_mod(eye(3), zeros(3, 1), eye(3), t2, l1, l2, prime_num);
Xcp = mod(cross(X1... |
function F = evi(F, E)
for i = 1:size(E, 1),
v = E(i, 1); % variable
x = E(i, 2); % value
for j = 1:length(F),
indx = find(F(j).var == v);
if (~isempty(indx)),
C=F(j);
for k = 1:length(C.val),
B = Ind... |
function [foutput] = FilenameDetectEDA1(path,CandidateCount,E4type)
if(CandidateCount<10)
foutput = path+"VetTrain_P00"+CandidateCount+"_Actiheart/"+"VetTrain_P00"+CandidateCount+"_Actiheart_"+E4type+".csv";
else(CandidateCount>10)
foutput = path+"VetTrain_P0"+CandidateCount+"_Actiheart/"+"V... |
function rim = ReconstructFace(im, mu, W, w, h, N)
% RECONSTRUCTFACE reconstruct im using N eigenfaces defined by mu and W. w
% and h define the size of the images used to construct the eigenfaces.
res = imresize(im, [h w]);
res = res(:);
% normalise the face
rmean = mean(res);
rstd = std(res)... |
KNN = 8;
save('KNN.mat', 'KNN'); |
function M = CRRlsDemod(f0,f1,p0,p1,d0,d1,I,t,Mr,Mt)
% Equation 10.
% Numerical least-squares demodulation
Mat = kron(inv(Mt),transpose(inv(Mr)));
B = zeros(length(t),16);
arg0 = 2*(2*pi*f0.*t + p0);
arg1 = 2*(2*pi*f1.*t + p1);
Cp0 = cos(arg0);
Sp0 = sin(arg0);
Cp1 = cos(arg1);
Sp1 = sin(arg1);
Cd0 = cos(d0);
Sd0 = si... |
%% preprocess.m
%{
Created: 2/3/2014
Author: Tim Campbell
Decription: this script is intended to contain the primary structure and
data handling for data output from the Ring GINA for the Fabsense
project.
Pipeline:
import data and create a data structure
perform basic signal processing (R... |
function output = PDE_system_run(~,input,x,h,kappa,s,mu,eta)
S=input(end);
n=[input(1:end-2);0]; %n=0 at the boundary
np = [n(2:end);NaN]; %n_{i+1}
nm = [NaN;n(1:end-1)]; %n_{i-1}
dsdt = -(1/(2*S*h))*(-4*n(end-1)+n(end-2)); %moving boundary
advec = [0;x(2:end-1).*dsdt.*(np(2:end-1)-n(2:end-1))/(S*h);NaN... |
function stop = optimplotfval(~,optimValues,state,varargin)
% OPTIMPLOTFVAL Plot value of the objective function at each iteration.
%
% STOP = OPTIMPLOTFVAL(X,OPTIMVALUES,STATE) plots OPTIMVALUES.fval. If
% the function value is not scalar, a bar plot of the elements at the
% current iteration is displayed. If ... |
function res_img = rec_region_img(img_paras,rec_paras)
%The function rec_region_img() is used to generate a simulated image with a
%rectangle region in that image
% input:
% img_paras: The pixel size of the generated image
% rec_paras: The parameters of the rectangle region
% output:
% Th... |
function [numz, denz] = bilinear_xform(nums, dens, fs)
% [numz, denz] = bilinear_xform(nums, dens, fs)
% Info:
% By: Dr. Gabrielson
% Last Edit: ???
% This routine performs a bilinear transformation from the s-domain
% expression given by the numerator, nums, and denominator, dens, polynom... |
clear
close 'all'
%the files produced by the main code, names are set to match default
%outputs of that code
load('means.mat')%the file for the means
load('vars.mat')%variances
load('skews.mat')%3rd moments
load('kurts.mat')%4th moments
%adjustment to the usual normalised form of skewness and kurtosis
skews=skews./var... |
function[] = batch_process()
for i = 1:14
generate_cwt_img_per_channel(i);
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.