text stringlengths 8 6.12M |
|---|
function [rootPath] = get_root_path()
pathstr = mfilename('fullpath');
[pathstr, ~, ~] = fileparts([pathstr, '.m']);
[rootPath, ~, ~] = fileparts(pathstr);
end
|
function active_perm = InverseBruggeman(eff_perm, med_perm, active_volume)
media_volume = 1-active_volume;
active_perm = ((active_volume-2*media_volume)*med_perm + 2*eff_perm)...
.*eff_perm./(media_volume*(med_perm-eff_perm)+active_volume*(med_perm+2*eff_perm));
end |
%A[a b;0 a]
[x,y]=meshgrid(-3:0.3:3,-3:0.3:3);
dx=2*x+6*y;
dy=y;
quiver(x,y,dx,dy), axis tight
|
function bvAuto = segmentBVVolume(volume, params, onh, rpe)
% SEGMENTBVVOLUME Segment the blood vessels from a volume scan.
%
% This is an experimental adaption of the circular scan algorithm to volume
% scans. Preliminar results were published at the ARVO conference 2011:
% Markus A. Mayer, Joachim Hornegger, Christia... |
%This function calculates, from a 2D image, the DjI for j <= n.
%Basically problems when image derivatives get really large > 10^(5);
function [Iderivs, DjI_center] = calc_DjI_from_image_2(image, n, gridSize)
%%
%Create blur filters
sz = size(image);
%sigma = round(sz(1)/100);
sigma = 3;
window_size = round(3*sigma);... |
function [ PlMin ] = localLMI( physics, vref )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
m = physics.m;
g = physics.g;
kv = physics.kv;
k = physics.k;
muS = physics.muS;
muC = physics.muC;
vs = physics.vs;
[vref1, vref2] = A0Hurwitz(physics);
if vref >= vref1 && vref <= vref2
... |
clc;clear;close all;
load mnist_all.mat
j=0;
for i=1:1:100
index=double(randi(size(test6,1),1));
a=single(test6(index,:));
J=reshape(a,28,28);
imshow(J);
J = imnoise(J,'gaussian',100,10) ;
J=normalize(J);
[valide,value,score]=lenet(J);
disp(j);
if value==6
j=j+1;
end
end
disp(j); |
foname = 'E:\Data Analysis and records\nonquantal\ZY072315\';
finame = 'cE_ZY072315_0004.abf';
fname = strcat(foname, finame);
d=abfload(fname);%d(:,1) currents - (Im_scaledZ); voltage - (10_Vm_Z)
%nq_on = 32342; % only for the recordings in May/2015
%nq_off = 42342; % only for the recordings in May/2015
%%%%%%%%%%%%%%... |
function [ S ] = prewitt( E )
EE1 = [1,1,1;0,0,0;-1,-1,-1];
EE2 = rot90(EE1);
EE3 = rot90(EE2);
EE4 = rot90(EE3);
A=filtro3x3(E,EE1);
B=filtro3x3(E,EE2);
C=filtro3x3(E,EE3);
D=filtro3x3(E,EE4);
S=abs(A+B+C+D);
end |
% MATLAB script: advect_1.m
% Demonstration of leapfrog differencing for 1-d linear advection equation
% applied to a passive tracer with sinusoidal distribution.
% Change Nx to examine dependence of amplitude and phase errors on
% number of grid intervals per wavelength.
clear all
close all
S = 2*64; ... |
function [data] = read_xml(file_path)
% 读取'.\project2-data\project2-data\a.xml'等文件
% 读取xml文件
xmlDoc = xmlread(file_path);
% 读取所有trainingExample
trainingExampleArray = xmlDoc.getElementsByTagName('trainingExample');
for i = 0 : trainingExampleArray.getLength-1
% 对每一个trainingExample,读取所有coord
ith_data = [];
... |
function [geom]=bbtr30(Domain,BC,RefiningOptions)
%
% _________________________________________________________________________
%
% BBTR - Barbera-Berrone TRiangler - version 3.0
%
% Politecnico di Torino
% 28 / 07 /08
% _________________________________________________________________________
%
% This libra... |
close all;
fid1=fopen('multiplyer.bin','r');
x=fread(fid1,55680*2,'double');
fclose(fid1);
xComplex= zeros(1,55680);
count = 1;
for i=1:2:55680*2
xComplex(count) = complex(x(i),x(i+1));
count = count+1;
end
figure()
plot(real(xComplex));
%figure()
%semilogy(abs(fft(xComplex))); |
function sm_xsong = MaskSines(xsong,Sines)
sm_xsong = xsong;
numsines = numel(Sines.start);
if any(Sines.start)
for i = 1:numsines
positions_to_mask = Sines.start(i):Sines.stop(i);
sm_xsong(positions_to_mask) = 0;
end
end
|
function saveTensorSlices4mayavi(fileName, data, sliceList)
% save tensor volumn or slices
%
% saveTensor4mayavi(fileName, data)
% saveTensor4mayavi(fileName, data, sliceList)
%
% sliceList = [24 25 27 ],
scale = 10000;
% scale = 1000000;
% scale = 1;
data.T = data.T * scale;
s = size(data.TH);
switch nargin
... |
%%%%%%
%
% Main processing script to create AIRS RTP L1BCM files from raw data
%
% Input variables:
% JOB = [start_date end_date] (in matlab format)
% data_str='' (a string for data variation)
%
% To use execute the script using
% $ clustcmd mkday_####.m 20090801:20090808
% from the command line.
%
a... |
function [ imIdx ] = genImIdx( i1F1,i1F2,nMax )
%genImIdx Generates IM indexes
%function [ imIdx ] = genImIdx( i1F1,i1F2,nMax )
%
%Given 2 frequencies and a max intermodulation order generates the
%intermodulation products
idxTmp = [];
for n1=1:nMax,
for n2=1:nMax,
idxTmp = [idxTmp n1*i1F1+n2... |
function [ fnEval ] = ylogxr(x,y,z )
%YLOGXR Summary of this function goes here
% Used to clean up cubeGrav.m
fnEval = y*log(x + radius(x,y,z));
end
|
% =========================================================================
%> @section INTRO DefineUpliftRateDistribution 부함수
%>
%> - 융기율의 공간적 시간적 분포를 정의하는 함수
%> - 이 함수를 통해 시공간적으로 비균질적인 지반융기를 모의함. 현재 경동성
%> 요곡 지반융기도 모의 가능함
%>
%> @version 0.1
%> @callgraph
%> @callergraph
%>
%> @retval meanUpliftRateSpat... |
A = [1i -1; 1 1i];
rref(A)
B = [-1i -1; 1 -1i];
rref(B) |
% 数据初始化
volume = [7 4 8 11 20 5 3 9 16 7 8 5 4 4 3 12];
weight = [11 7 9 6 7 8 5 6 18 2 3 6 2 9 5 4];
value = [9 8 7 8 18 7 3 10 19 4 4 11 3 5 4 6];
% 种群中个体数目
num_ind = 50;
% 种群随机初始化
groups = rand(num_ind, num_features);
groups(groups >= 0.5) = 1;
groups(groups < 0.5) = 0;
% 计算初代个体适应度
f = fitness(gro... |
% function [cams, cam_centers] = reconstruct_uncalibrated_stereo_cameras(F);
%
% Method: Calculate the first and second uncalibrated camera matrix
% from the F-matrix.
%
% Input: F - Fundamental matrix with the last singular value 0
%
% Output: cams is a 3x4x2 array, where cams(:,:,1) is the first and
%... |
function plot_hrpSectorTimes(~)
%
% 101105 smw stolen from read_rawHARPdataTimes.m
%
% called from Triton Tools-> HRP file -> plot Sector Times
%
% 080904 smw stolen from read_rawHARPdataTimes.m to output each of the
% time stamps in one raw data file (i.e., 60000 per raw file - not the dirlist times)
%
% usage: >> [dv... |
function test_find_tests;
% Test function for test finder
mfp = mfilename('fullpath');
[p f e] = fileparts(mfp);
tests = find_tests(p);
assert_strings_equal(tests, f);
|
bciroot = {'/media/LoukStorage/Raw' '/Users/louk/Data/Raw/'}
expt = 'OR_real_experiment';
subjects= { 'S1' 'S2' 'S3' 'S5' 'S4'};
% sessions = {{''}};
labels ={'trn'}; %condition{
global bciroot;
%condition{
timeperiod={{[0 250 2750 3000]} {[3000 3250 5750 6000]}};
%clear out2 out2_trans
for si=[1 2 3 4 5]
... |
function [spread,contra,shape,L] = basis_STO2G (name)
if name =='C'
spread1s =[27.38503303,4.874522075];
spread2s=[1.136748198,0.2883093603];
spread2p=[1.136748198,0.2883093603];
contra1s=[0.4301284983,0.6789135305];
contra2s=[0.04947176920,0.9637824081];
contra2p=[ 0.5115407076,0.6128198961];
spread=[spread1s;spread2... |
function Consal = regionContrast( valCOL,Label,centres)
map = zeros(size(Label));
valSUM = unique( valCOL(:,3)+ 1000*valCOL(:,2)+1000000*valCOL(:,1));
valSUMall = valCOL(:,3)+ 1000*valCOL(:,2)+1000000*valCOL(:,1);
colorcentres = centres;
Consal = ones(size(centres,1),1);
for index =1:size(v... |
function dy = dLAMEE(x,y)
global salt_ NTU_ NTUm_ Cr_
test = 'dLAMEE';
dy = zeros(4,1);
h_fg = min(2.501, abs(2.501 - 0.0024 * y(3)));
cp_sol = min(4.2, abs(HeatCapacity(salt_, y(3), y(4))));
Wsol = min(200, abs(W(VP(salt_, y(3), y(4)))));
dy(1) = -NTU_ * (y(3) - y(1));
dy(2) = -NTUm_ * (Wsol - y(2));
dy(3) = Cr_ ... |
function out=opt_sol(XX,YY, size)
s = size;
cvx_begin %quiet
%cvx_precision high
%cvx_solver mosek
variable x(s)
minimize(0.5*sum_square(XX*x - YY))
cvx_end
out =0.5*sum_square(XX*x - YY);
|
function applyFloodplainSedimentation(obj)
%applyFloodplainSedimentation
% obj: the avulsion model object
% method: integer indicating the floodplain sedimentation profile
% 0 - uniform
% 1 - depth-dependent
method = obj.fpProfile;
m = obj.numRows;
n = obj.numCols;
h = obj.channelDepth... |
function ListROI = TPA_TestImageRoiEditor(imageData,ListROI)
%
% TPA_TestImageRoiEditor - Graphical interface to select rectangle or/and ellipse
% regions of interest over a picture. It's also possible
% to move, delete, change type and color or resize the
% selections.
%
% Used for ... |
function x = NNOMP(y, Phi, K)
% Non-Negative Orthogonal Matching Pursuit
% from "On the Uniqueness of Nonnegative Sparse
% Solutions to Underdetermined Systems of Equations"
% by Bruckstein et al.
% y : data
% Phi : sensing matrix
% K : sparsity
%
% Gunnar Atli Sigurdsson, 2013
[N2,N] = size(Phi);
x = ze... |
% function circlefitting
% clearvars
load('temp', 'trainingData');
x = trainingData.trainingDataDR;
label = trainingData.trainingLabel;
c = 0*ones(size(x)); % weither or not we feed in a full array for c does not change P
% c = x;
[c(:, 1), c(:, 2)] = mapUnitCircle(x(:, 1), x(:, 2));
P = 0.01*eye(size(x, 2), size(x,... |
function nMean = getMeanTraceAcrossTrials(nReshaped)
nStimLocs = length(nReshaped);
nTraces = size(nReshaped(1).preStim, 1);
for iStimLoc = 1:nStimLocs
nPreStim = nReshaped(iStimLoc).preStim;
nMean(iStimLoc).preStim = squeeze(mean(mean(nReshaped(iStimLoc).preStim(:, :, :, 2:end), 4), 2));
nMean(iStimLoc).postSti... |
function notes = get_notes(I)
%A function that takes an input image, I, and using the sift algorithm,
%returns the total note value in the picture with how many of each note
%there are
%Input:
%I - An rgb image of a scene with (possibly) notes in it.
%Output:
%notes - A struct array with fields: money - the total note ... |
function [ result ] = objective( vector_matrix_dissimilarity,vector_prototypes,vector_weights,matrix_membership_degree, K,N,q )
%armazena o resultado do argumento nos somatorios realizados
result = 0.0;
for k = 1 : K,
sum_object = 0.0;
for i = 1 : N,
first_partial = 0.0;
sum... |
% 非主函数: 获得数据的极大值、极小值包络线(三次样条插值后的数据)
function s = getspline(x,t)
N = length(x);
[value,local] = findpeaks(x);
% 原始插值点: 极值点
t1 = t(local);
x1 = x(local);
s = spline(t1,x1,t);
|
clf;clear;
Th = 294.0;
Tl = 194:1:294;
lamda = 0.8;
wel_lambda = (Th-Tl);
wsup_lambda = ((1-Tl./Th).*(Th-Tl))./ (1-lamda);
hold on
plot(Tl-273.15, wel_lambda, '--b','DisplayName', 'Radiator');
plot(Tl-273.15, wsup_lambda,'--r','DisplayName', 'Heat Pump');
hold off
legend('show', 'Location', 'BestOutside');
xlab... |
L=5;%颜色量化位数
face_vect=train_detection(L,dev_index,0,0);%我们在这个步骤里训练颜色向量
MIN_POINTS_NUM=10;%小于于这么多像素点的连通域会被忽视
se=strel('square',3);%开运算kernel
opened=imopen(dist_hist_cluster,se);%开运算,去除噪点,以及将两个原本应该分开的连通域分开
filtered=bwareaopen(opened,MIN_POINTS_NUM);%过滤小于MIN_POINTS_NUM的噪点
figure;imshow(filtered);title('connected compone... |
% Jonathan Friedman 4799380
% Jackson Horwitz [INSERT]
% AE4205 MDO for Aerospace, Final Project, 2018Q1
% This is intended to be the main file of the program. This might change as
% we go along.
% Run this file
%% Initial Values (including "guess" variables)
root_upper1 = 0.1739;
root_upper2 = 0.2814;
... |
% circuit_inhibition_new_bothJCandSO_TT.m
%
% This script tests circuit inhibition in a new way, the main result is
% expected to be the same as circuit_inhibition_TT.m.
% What are new in this script:
% 1. test the anti-corr between FR in interoffer delay and V(O)
% 2. test the circuit inhibition in JC (maybe wr... |
% script to create smdata
%Creating smdata.inst, all of the instrument properties
%Lockin 2
adr=9; %GPIB address
smdata.inst(1).device='SR830'; %device type
smdata.inst(1).name='Lockin 2'; %specific device name
smdata.inst(1).cntrlfn=@smcSR830; %handle to driver
smdata.inst(1).data.inst=gpib('ni', 0, adr); %GPIB objec... |
classdef CellStorage < handle
properties
Offset
Map
end
methods
function obj = CellStorage(offset_size)
if nargin == 0
obj.Offset = 1000;
else
obj.Offset = offset_size;
end
obj.Map = cel... |
function y = overlap_save_plot(x,h,ls)
lh = length(h);
xChunkLength = ls+lh-1;
yChunkLength = xChunkLength+lh-1;
yLength = length(x)+lh-1;
xPadLength = mod(ls-mod(length(x),ls),ls);
x = [x zeros(1,xPadLength)];
lx = length(x);
xChunkPrev = zeros(1,xChunkLength);
yChunkPrev = ze... |
%% Analysis and modelling of locomotion
% Geyer Assignment
% Exercise 1a
%% loading
clear all
clc
load('data1.mat')
load('data2.mat')
load('data3.mat')
%% Data 1
footfall = data1.footfall.data;
events = [footfall(1,:); diff(footfall)];
gait_cycle_duration = diff(find(events(:,1)==1));
strike = fin... |
function plv = multitrial_pac(lf_signals, hf_signals, srate, pf, af)
% Inputs:
% signals = Single_trial- time series
% srate = frequency range
% Pf1,Pf2 = frequency range of the low-frequency
% Af1,Af2 = frequency range of the high-frequency
%Cohen MX."Assessing transient cross-frequency coupling in EEG data"
% Journ... |
function Io = findVentricle(I, seed)
Imseg = zeros(size(I));
sz = size(I);
counter = 0;
seed = sub2ind(sz,seed(1),seed(2));
while counter ~= size(seed,1)
counter = size(seed,1) % setup to fail
for s = 1:size(seed)% look at each seed
[sx,sy] = ind2sub(sz,seed(s)); %find 8 nay
if I(sx,sy) == 0 %only conside... |
function [DV] = decode(r)
DV=0;
for i=1:5
DV=DV+(r(i)*(2^(5-i)));
end
end
|
Nodes = [turbine_position; substation_position];
n = 25;
[X,Y,Z] = peaks(n);
seaX = zeros(n*n,1);
seaY = zeros(n*n,1);
seaZ = zeros(n*n,1);
for i=1:n;
for j= 1:n;
seaX(j+ n*(i-1),1) = X(j, i)/3*24;
seaY(j+ n*(i-1),1) = Y(j, i)/3*48;
seaZ(j+ n*(i-1),1) = Z(j, i);
... |
% Top of stack: r1
% Global vars: r2
% Accumulator 1: r3
% Accumulator 2: r4
% Current Frame size: r10
% Parameter passing: r11
% helper: r13
% Return value: r14
% Return address: r15
%
% start
entry
addi r1,r0,st % Initialize top stack address
% FrSz, =, (c, 0)
addi r3,r0,0
lw r3,cs(r3)
add r10,r0,... |
function imgOut = localQuadFilterImageDomain( imgIn, imgVar, w, beta )
fprintf('Local quadratic programming filter in image domain with beta = %2.2f ... \n', beta );
imgOut = zeros( size(imgIn), class(imgIn) );
for iz = 1 : size( imgIn, 3 )
imgOut(:,:,iz) = LQPFilter( squeeze( imgIn(:,:,iz) ), sqrt( squeez... |
%
% Generate BIDS iEEG amplifier metadata files based on a MEF3 dataset
%
% createBIDS_ampFiles_fromMEF3(inputMef, outputDir)
%
% inputMef = MEF3 input, either as a path to the MEF3 session folder or a MEF3 struct (see 'matmef' function 'read_mef_session_metadata');
% If left empty... |
function [settings, params] = load_settings_params()
%% SETTINGS
settings.dataset_file = 'Neurons.txt';
settings.path2data = fullfile('..', 'Data',settings.dataset_file);
%% MODEL PARAMETERS
params.seed = 1;
params.alpha = [0.1,0.001,0.01,0.05,0.5,1,5,50];
params.lambda = [0.1... |
function [labelVec] = createLabelVector(vectors, labels)
%CREATELABELVECTOR Summary of this function goes here
% Takes 2 vectors as inputs and creates a 1D vector to output the
% relevent labels based on the size of the vectors that has been fed to
% the function.
labelVec = [];
for i=1 : numel(vectors)
for j... |
function gtVidInd = gettheirVidInd(video,videoName)
gtVidInd = -1;
for i=1:length(video)
vidid = video(i).videoName;
if strcmp(vidid,videoName)
gtVidInd = i;
break;
end
end
end |
function basisequal = eq(basis1, basis2)
% EQ assesses whether two bases are equivalent.
% Last modified 1 March 02
type1 = getbasistype(basis1);
range1 = getbasisrange(basis1);
nbasis1 = getnbasis(basis1);
pars1 = getbasispar(basis1);
type2 = getbasistype(basis2);
range2 = getbasisrange(basis2);
nbasis2 = ... |
tmpDetectionStack = detectionStack(1:10);
tmpImageStack = newImageStack(:,:,1:10);
imageCrops = cropDetections(tmpDetectionStack,tmpImageStack,windowSize);
corrValues = cellCorrelations(imageCrops(:,:,1),imageCrops);
detection = detectionStack{1}(1,:);
dists = detectionDistances(detection,tmpDetectionStack);
[~,inds] =... |
function [Rw] = rich_club_wd(CIJ,varargin)
%RICH_CLUB_WD Rich club coefficients curve (weighted directed graph)
%
% Rw = rich_club_wd(CIJ,varargin)
%
% The weighted rich club coefficient, Rw, at level k is the fraction of
% edge weights that connect nodes of degree k or higher out of the
% maximum edge weight... |
function bin=binStruct2bin(binStruct)
tic;
binNumber = 1;
for i = 1:length(binStruct)
for j = 1:length(binStruct{1,i})
binNumber = binNumber+1;
end
end
h = waitbar(0,'Preparing aligned spectra...');
% Initialise the bin that holds the alignment results
field1 = 'mz'; value1 = zeros(1,10);
field2 = 'sp... |
%% fn_fit
%% Syntax
% fx = fn_fit(x,y,model,startpoint)
%% Source
% Thomas Deneux
%
% Copyright 2008-2012
%
|
function [ au_output ] = exam_to_au( examples )
au_output = cell(size(examples,1));
for i = 1:size(examples, 1)
au_output{i} = create_AU(examples(i, :));
end
end
|
clc;
fprintf('=============================[ transientrectarray.m ]=============================\n\n');
fprintf('This example calculates the transient pressure field of an array of rectangular\n');
fprintf('transducers using a transient version of the Fast Nearfield Method. It outputs an\n');
fprintf('animation of ... |
% FabberDifferences
% Loads maps of one parameter from a pair of FABBER datasets and displays the
% difference between them, as well as some potentially interesting stats.
% MT Cherukara
% 8 February 2019
clear;
%% User to select variable and Fabber datasets
% which VS subject
set0 = 3;
% variable name
vname = 'D... |
function [ imgouter ] = preprocessing( x)
i=rgb2gray(x);
y=medfilt2(i);
fff = im2bw(y, graythresh(y));
img=fff;
imgout = (img>mean(img(:)));
colorWhite = 0;
colorBlack = 0;
[H W] = size(imgout);
imgouter = zeros(H, W);
for i=1:H
for j=1:W
if(imgout(i,j) == 1)
colorWhite = colorWhite+1;
e... |
function datalabels(b,varargin)
switch class(b)
case 'matlab.graphics.chart.primitive.Histogram'
histdatalabels(b,varargin{:})
case 'matlab.graphics.chart.primitive.Bar'
bardatalabels(b,varargin{:})
case 'matlab.graphics.scatter';
% do something
end
return
end
%%
function bardatalab... |
classdef (Abstract) Policy < handle
%POLICY This is an abstract class defining a policy.
% This class defines common functionality for a policy. The policy is
% told the number of actions it can choose from. It has to define
% functionality for choosing an action and for updating its belief
%... |
clc
clear all
close all
t= -1:0.01:1;
%(i)
y1= sin(2*pi*t);
plot(t,y1)
title("sin(2πt)")
grid on
%(ii)
y2= sin(2*pi*t) + cos(2*pi*5*t);
figure
plot(t,y2)
title("sin(2πt)+cos(10πt)")
grid on
%(iii)
y3= exp(j*pi*2*t);
figure
subplot(3,1,1)
plot(t,real(y3) , t,imag(y3))
title("exp(j2πt)")
grid on
%extra
y3a= abs(y3)... |
function currentPositions = HedgeDelta(rit, delta, currentPositions)
transactionLimit = 10000;
amountToBuy = -delta;
for i = 1:7
if abs(amountToBuy) < 1
break;
end
try
amount = min(transactionLimit, abs(amountToBuy));
amount = round(amount);
if amountToBuy < 0
am... |
function [K] = vibk(k,vi,vf)
K = zeros(1,14);
if vi == 0
for vi = 1:14
K(vi) = k(14*(vi-1) + vf);
end
else
for vf = 1:14
K(vf) = k(14*(vi-1) + vf);
end
end |
function phallp(varargin);
% phallp( [...] );
% Lamps P
h = timeplot({'AModP','BModP','CModP','DModP'}, ...
'Lamps P', ...
'P', ...
{'A','B','C','D'}, ...
varargin{:} );
|
function [ output ] = checkFeturea(img)
% checkFeturea is a function that receives an image, removes the fourth
% band and returns this image
%
% input,
% img : Image in analysis
%
% outputs,
% output : Modified image
%Removing fourth band
try
img(:,:,4)=[];
catch M
end
img = uint8(img);... |
function [ freqs, modes ] = ModalAnalysis( model )
%% calculate the frequencies and the modes of the mode
[ modes, freqs] = eig(model.mass\model.stif, 'vector');
end
|
while(true)
prinMix = gmm(num_dim,2,'diag');
options = foptions;
prinMix = gmminit(prinMix, full_score, options);
prinMix = gmmem(prinMix, full_score,options);
post = gmmpost(prinMix,full_score);
[val, ind] = max(post');
% keep re... |
function [env] = setEnv(params, emode, strtNrj)
%SETENV Sets the simulation environment
% This function initializes the simulation environment
env = {};
sinkInstance = Sink(params.xm, params.ym); % Create instance of sink
env = {sinkInstance};
nodeArray = [];
if (emode == "rand") % Random amount of ene... |
function [quantized_coef,coef,width,height]=quan_dct_coef(hall_gray,QTAB)
[height,width]=size(hall_gray);
nb_w=width/8;%横方向方块数
nb_h=height/8;%纵方向方块数
coef=zeros(64,nb_w*nb_h);
quantized_coef=zeros(64,nb_w*nb_h);
zigzag_coord=get_zigzag_coord();
for i = 1:nb_h %行方块数
for j = 1:nb_w %列方块数
curr_coef=dct2(hall_gray((i-1)*... |
function [rta] = gauss_m(X, mius, covs, alphas)
%Esta funcion realiza la suma de todas las Gaussianas indicadas por la
%escena.
[m,n] = size(mius);
rta = 0;
for i = 1:n
rta = rta+(alphas(i)*gauss(X,mius{i}, covs{i}));
end
end
|
clear all
close all
clc
format long;
set(0,'FormatSpacing', 'compact')
gpudev = gpuDevice(1); % get the GPU device
addpath('./parameterFiles')
addpath('./signalGenerationFiles')
% parameters
Physicsparams = setPhysicsParams(); % physics parameters
MPIparams = setMPIParams(Physicsparams, 'complex_raste... |
function sorted_imgs = imgs_InsertionSort(listed_imgs)
% Insurtion sort based fucntion to sort a list of images from biggest
% to smallest surface area.
listSize = size(listed_imgs);
% Iterate over every image
for i=1:listSize(2)
% Calculating the surface size of images i
... |
num=[1 -1];
den=[1 4 5];
sys_c=tf(num,den);
sys_d_zoh=c2d(sys_c,0.1,'zoh');
sys_d_foh=c2d(sys_c,0.1,'foh');
sys_c_delay=tf(num,den,'InputDelay',0.35);
sys_foh_delay=c2d(sys_c_delay,0.1,'foh');
figure
step(sys_c);hold on;
step(sys_d_zoh);
title("ZOH");
figure
step(sys_c);hold on;
step(sys_d_foh);
tit... |
function D=findTravelledDist(X_g,X_p,TotalD)
d=sqrt(sum((X_g-X_p).^2,2));
D=100*(1-(d./TotalD'));
end |
% Function to dump a matrix to CSV. This is rather straight-forward.
function dumpcsv(filename, col_labels, row_labels, data)
[rows, cols] = size(data);
assert(length(col_labels) == cols);
assert(length(row_labels) == rows);
fp = fopen(filename,'w');
for jj=1:length(col_labels)
fprintf(fp, ',%s', col_labels{jj})... |
width = 1e-4; % m thickness
frequency = 1e9; % 10 GHz
omega = 2*pi*frequency;
numpoints = 50;
numControl = 50; % is this needed?
ratioPoints = 50;
e0 = 8.854e-12;
m0 = 1.256e-6;
%controls
rptRel = logspace(0,4,numpoints);
conductivity = 1e6;%logspace(-8,4,numpoints);
iptRel = conductivity/(omega*e0*100);
rpmRel = logsp... |
classdef actLinear < IAct
properties
beta = 1;
end
methods
function obj = actLinear()
end
function y = apply(obj, x)
y = x;
end
function y = deriv1(obj, x, da)
if isa(x, 'parallel.gpu.GPUArray')
da... |
close all
clear all
clc
% Adjust recruitment threshold the ratio of somatic surface area to toal
% cell surface area, P, in Booth 1999
% Adjust the minimal discharge rate at the recruitment threshold using the
% solow postasium conductnace, K_Ca_f
% Record the peak discharge rate
% How do we adjust the slope of ... |
function phenotypeFactor = phenotypeGivenCopiesFactor(alphaList, numAlleles, geneCopyVarOne, geneCopyVarTwo, phenotypeVar)
% This function makes a factor whose values are the probabilities of
% a phenotype given an allele combination. Note that a person has one
% copy of the gene from each parent.
% In the fact... |
function data_report(yearV, setNo)
% Show basic sample stats as a diagnostic
cS = const_cpsearn(setNo);
if isempty(yearV)
% All years
yearV = cS.yearV;
end
ny = length(yearV);
%% Compute stats
nObsV = zeros(ny,1);
ageMeanV = zeros(ny, 1);
hoursMeanV = zeros(ny, 1);
weeksMeanV = zeros(ny, 1);
schoolMeanV = ze... |
function [data] = tom(slowness,n_receivers,n_sources)
% A simple tomography example
% The rays are straight lines
%% Establish grid dimensions (0 to width of length width)
[l,w] = size(slowness);
% x-direction
x_min = 0;
x_max = l;
dx = (x_max - x_min)/(l - 1);
Dx = x_max-x_min;
% y-direction
ymin = 0;
ymax = w;
... |
%{
reso.Conditions (lookup) # conditions to use for reso.Indicator ** MUST UPDATE popRel in reso.Indicator for new conditions **
condition_num : tinyint # condition number
-----
condition_name : varchar(64) # name of condition
condition_params=NULL : mediumblob # parameters for re... |
function [pathRows,pathCols,pathElevs] = BestGreedyPathHeadingEast(ElevD)
%BestGreedyPathHeadingEast will find the best greedy path starting from
%the westerly edge (i.e.using starting points in column 1). In the event
%of one or more paths tying for the lowest cost, the path that starts with
%the lowest row number... |
%Andrew Logue - 9/20/2019
clear
clc
%sets initial vectors vec1 and vec2
vec1 = [1, 2, 4];
vec2 = [5, 6, 8];
%creates matrix M
M = [vec1, vec2; vec2, vec1];
M(3, 1:6) = (1:2:11); |
classdef (Sealed = true) rect_s < qes.waveform.waveform
% rectangular pulse with sharp rising and falling
% only frequency domain funciton is used in pulse generation, time
% domain funciton is just for display
% Copyright 2016 Yulin Wu, USTC
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
... |
% Express a relation between xn+1, yn+1, zn+1 and xn, yn, zn in matrix form
A = [1.01 -0.01 0.03; -0.01 1.02 0.05; -0.1 -0.1 1.4];
% set up initial condition
vo = [7; 15;100];
v = powerIter(A,vo,20);
ratio = norm(A*v)
%change initial condition
vo1 = [10; 20; 50];
v1 = powerIter(A,vo1,20);
ratio1 = norm(A*v1)
|
function [ Rotation, Translation, MeanDistance] = findTransformKinect( name_file_kinect_reference, name_file_second_kinect)
% Find the transformation between two Kinects
% The inputs are 2 files which contains the measures for 2 kinects. The
% files are supposed to contain the same number of measures. Each pair of
% me... |
% 對數字進行錄音,共要錄兩次,用以檢測 speaker-dependent DTW 的效能
% Roger Jang, 20020328, 20050314
% ====== 檢查 MATLAB 版本
desiredVersion='6.5';
matlabVersion=version;
if ~strcmp(matlabVersion(1:3), desiredVersion)
fprintf('建議使用版本:%s\n', desiredVersion);
end
% ====== 錄音參數
duration = 2;
fs = 16000;
%nbits = 8; format = 'uint8'; % 8-bit
... |
function [dof, eig_vals, eig_perc] = screePlotMethod(array, threshold)
eig_vals = svd(array);
eig_perc = eig_vals/sum(eig_vals);
sum_eig = 0;
index = 0;
while sum_eig < threshold && index < length(eig_vals)
index = index + 1;
sum_eig = sum_eig + eig_perc(index);
end
... |
function plot_h_h_space( y, H1, H2)
%plot_interfaces Plot the interfaces.
plot( H1 + y(1:end/2), H2 + y(end/2+1:end));
xlabel('$h_1$')
ylabel('$h_2$')
%title('A plot of the interfaces against each other')
end |
function theta_x
%---------------------initial parameter------------------%
h = 0.005;
t = 0;
y1 = 10*pi/180; %theta
y2 = 0; %theta dot
x2=0;
x1=0;
%--------------------------------------------------------%
dt=0.000155;
dtx=0.000155;
%---------------------------
Tv=0; %The goal of contro... |
function multiview_multibody_affine_demo(path,sequencename)
% Lauch the included algorithms (GPCA with spectral clustering,
% LSA, RANSAC) on one sequence of the Hopkins 155 database
%
% Inputs:
% path relative path from the current directory to
% the Hopkins 155 database
% sequ... |
function synTable = getAllLinkedNeurons(neuron)
% GETALLLINKEDNEURONS
%
% Description:
% Get linked neurons for all synapse types
%
% Syntax:
% synapseTable = getAllLinkedNeurons(neuron)
%
% Input:
% neuron Neuron object
%
% See Also:
% GETLINKEDNEURONS, ... |
%
% A little macro to get the whole volume of a ginx series.
%
% Robert Welsh - Aug-17-00
% University of Michigan
% Department of Radiology
%
% Syntax
%
% [ginxVol, errmsg] = getginxvol;
%
% Modification to make : allow the person to pass a file name
% and hence remove any interaction with graphics.
% If this... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.