text stringlengths 8 6.12M |
|---|
function [varBag, MessageBag] = UpdateHelperGaussianWeightedSumFactor_HA(w, m1, idxMessageHAUp, m2, m3, MessageBag, v1, playerHA, v2, v3, varBag)
% m1: index for d= p_hai + p_oi - p_dj, i.e., the message corresponds to performance difference
% m2: index for p_oi
% m3: index for p_dj
% idxMessageHAUP: the message ... |
function igotop=igotop()
D=randi([1,20],10,20);%10*20
for i=1:size(D,1)
C=df(i,D(i,:));
D(i,:)=C;
opt(i)=opt(C)
bolt=firebalt(D(i,:),opt(i).positive,opt(i).negative);
price(i)=(bolt.y(i))/(bolt.x(i)+bolt.y(i));
end
%price=round(price.*10,2)
... |
clear all;
clc;
N = 1000;
maxV = 20.8;
maxI = 3.65;
Id = @(Vd,Voc,Vt,Isc)Isc * (1 - exp((Vd-Voc)/Vt));
X = linspace(0, maxV, N);
Vt = linspace(0.5, 3, N);
maxP = zeros(N);
for n = linspace(1,N,N);
Y = Id(X, maxV, Vt(n), maxI);
maxP(n) = max(X.*Y);
end
%plot(Vt, maxP);
plot(X, Id(X,maxV,1.178,maxI));
hold ... |
function new_seq = randseq_remNNN(length)
new_seq = randseq(length);
while ~isempty(strfind(new_seq,'AAA'))||~isempty(strfind(new_seq,'CCC'))||~isempty(strfind(new_seq,'TTT'))||~isempty(strfind(new_seq,'GGG')) % check if there is 1 in repeat, if there is, return 0
new_seq = randseq(length);
end
new_seq ... |
% for num tree = 1000, data = caltech101-500
% Seq time = 58 sec
% ideal speedup = number of workers = num_proc-1
num_trees = 100;
num_proc = [2
3
4
5
10
15
20
25
30
40
50
60
70
90
101
128]';
speed_up = [0.97949147504661
1.94474248927039
2.86901464186783
3.8563829787234
8.0154781647319
11.7934119560797
15.441959531... |
function[yWarp,ux,uy] = OpticalFlow(x,y,alpha,ux,uy)
if not(exist('ux','var'))
ux = zeros(size(y,1),size(y,2));
uy = zeros(size(y,1),size(y,2));
end
%optical flow parameters initialization:
nOuterFPIterations = 3;
nInnerFPIterations = 1;
nSORIterations = 30;
ratio = 0.75;
minWidth = min(20, size(... |
function [ w ] = RotationRates_to_AngularVelocity(q,dR)
% Compute angular velocity in frame B. dR is the time derivative of rotation
% matrix d/dt(RxRyRz) rotating vectors in frame B to frame A.
%
% Author: Ross Hartley
% Date: 06/23/2017
% Compute Rotation matrix
switch numel(q)
case 9
... |
function [conn, nnConn] = connections(varargin)
if nargin == 2
X = varargin{1};
Y = varargin{2};
conn = delaunay(X, Y);
nnConn = [conn(:, [1 2]); conn(:, [1 3]); conn(:, [2 3])];
elseif nargin == 3
X = varargin{1};
Y = varargin{2};
Z = varargin{3};
conn = delaunay(X, Y, Z)... |
% Exercise 1
% Test: manually transform image in order to have well-aligned digits
I = imread('LicensePlate.png');
figure; imshow(I);
% Rotate clockwise 15 degrees to align base
J1 = imrotate(I, -15, 'bilinear');
figure; imshow(J1);
% Now apply a skew
tform = affine2d([1 .3 0; 0 1 0; 0 0 1]');
J2 = imwarp(J1, tform);
f... |
function q = ContrastDiscriminationTask(varargin)
% Quest test.
% You'll be presented to patches and have to identify the highest
% contrast one. Press left/right arrow to identify the highest contrast
% one or "Esc" to quit
global screen
try
[objSize lambda sigma phase pedestal deltaX trialsPerDel... |
function ds = load_ds(dir, leave_probes)
if nargin == 1
leave_probes = false;
end
start_dir = pwd;
cd(dir);
sources = data_sources;
if exist('cm01-fix', 'dir')
ds = DaySummary(sources, 'cm01-fix');
elseif exist('cm01', 'dir')
ds = DaySummary(sources, 'cm01');
class_file_name = ls('cm01/class*.txt');
... |
function saveSort(src,fname)
global WaveformInfo
global FileInfo
if src==-1 %to be used to save an unfinished sort to a default location (eventually)
d = dir(fullfile(WaveformInfo.sortFileLocation,'spikesortunits'));
d([d.isdir]) = []; %strip off '.' and '..'
sort = cell(size(d));
for dx = 1:nu... |
function [f,g] = OF_Oscil(vy,opstr)
oscil_xcorr_threshold = 0.01;
idx = opstr.idx;
par = opstr.par;
n_Transcripts = opstr.n_Transcripts;
n_Promoters = opstr.n_Promoters;
n_real = opstr.n_real;
n_int = opstr.n_int;
x = vy(1:n_real);
y_int = vy(n_real+1:n_real+n_int);
y_bin = vy(n_real+n_int+1:end);
... |
%2nd order butter(2,0.01) -3 dB cutoff at 0.01 of sample nyquist frequency (0.5 hz of 50 hz (nyquist of 100 hz sample rate)
%2nd order butter(2,0.10) -3 dB cutoff at 0.10 of sample nyquist frequency (5.0 hz of 50 hz (nyquist of 100 hz sample rate)
%2nd order butter(2,0.20) -3 dB cutoff at 0.20 of sample nyquist frequen... |
%%%% compute prox-mapping given by
%%%% s = \argmin_{x \in X} \langle p, x \rangle + \|x\|^2/2
%%%% where X is the standard spectahedron
function s = ProjSpectahedron(data, domain, p)
n = domain.n;
R = domain.R;
%%% do eigenvalue decomposition for p.
sp = reshape(p, n,n);
sp = (sp + sp')/2;
[V, xi] = eig(fu... |
function [func_dec, outputs, funcs] = PNU_SL(x, y, prior, eta_list, options)
% PNU_SL Estimates classifiers based on PNU learning
% From samples
% {x^P_i}^{n_P}_{i=1} ~ p(x|y=+1),
% {x^N_i}^{n_N}_{i=1} ~ p(x|y=-1),
% {x^U_i}^{n_U}_{i=1} ~ p(x) = \theta_P p(x|y=+1) + \theta_N p(x|y=-1),
% \theta... |
function Bstar = randorient(k, p, xi)
% Generates a random orientation for a screening matrix
%
% Inputs:
% k - number of design variables
% p - number of discreet levels along each dimension
% xi- elementery effect step length factor
%
% Output:
% Bstar - random orientation matrix
%
... |
function dDp_dq = tyre_damper_derivative(rp, r_0, r_1, p, s, d, h, l, rho, beta)
% From "8/5/20 - 1"
dDp_dr = rp*r_1;
dr_dzc = 1/(cos(beta)*cos(rho));
dr_dl = -1;
dr_dbeta = (-(h - l - r_0)*sin(beta)*cos(rho) - p*cos(beta)*cos(rho)) / (cos(beta)*cos(rho));
dr_drho = (-(h - l - r_0)*cos(beta)*sin(rho) + (s + d)*cos(... |
function [w] = GradientDescent(X,y,w,alpha,NIter)
% this function computes the parameters given the input , output
% varaibles , intital parameters and iterations using gradient descent.
J = [];
for i = 1:NIter
w = w - alpha * diffCost(X,y,w); % the gradient descent iteration logic
J = [J costFun(X,y,w)];
end... |
function ah = binaryTensorVoxel(t,varargin)
% binaryTensorVoxel. Create a voxel image out of the binary tensor 't'.
%
% A binary tensor is also referred to as a 3D matrix of zeros and nonzeros.
% Each voxel is a cube of side length varargin{1}.
%
%
% NECESSARY INPUT.
% t : binary tensor, in other words, a 3D m... |
% Example 8.6 -- Figures 8.5 and 8.6 : image compression with SVD
close all
colormap('gray')
load clown.mat;
figure(1)
image(X);
[U,S,V] = svd(X);
figure(2)
r = 20;
colormap('gray')
image(U(:,1:r)*S(1:r,1:r)*V(:,1:r)'); |
function [GFP_smallmet_data_updated, RFP_smallmet_data_updated] = ...
remove_overlaps( ...
GFP_smallmet_data, RFP_smallmet_data, ...
GFP, RFP, ...
... |
% capillary pressure curve for drainage
% Written by Ali A. Eftekhari
% TBD, probably not required in the new IMPES formulation
function res=dpc_drain(sw, pce, swc, labda, pc_max)
sw0=swc+(1-labda*log(pc_max/pce)+sqrt((-1+labda*log(pc_max/pce))^2+...
4*swc/(1-swc)))/2*(1-swc);
res = (sw>sw0).*(-1.0/((1-swc)*labda... |
for i = 1:5
sqrt(i)
end |
close all; clear; clc
%% Settings
doSave = 1;
doShow = 0;
%% Load ROS bag file
name = 'stata_floor1_g'; % '32_144', '34_floor3', '36_floor3', '38_floor3', '39_floor3', 'lids_floor7', 'stata_floor1'
bag = rosbag([name, '.bag']);
bagselectDepth = select(bag, 'Topic', '/kinect2/sd/image_depth_rect');
bagsel... |
clear;
p = 0.15
GradientThres = givemethreshold('GradientData_Grad.dat',p,'g')
LaplacianThres = givemethreshold('GradientData_Lapl.dat',p,'l')
DOGThres = givemethreshold('GradientData_Dog.dat',p,'d') |
function Phi=Gaussian_kernel(Phi_tmp,sigma)
Phi = exp(Phi_tmp/sigma^2);
|
Qkdat = dlmread('../../unittest/Qk16/Qk_r1.txt',',');
% Qkdat = dlmread('../../unittest/Qk16/Qk.txt',',');
Qkdat(:,end) = [];
assert(any(Qkdat(:) ~= 0));
nullbasis = null(Qkdat);
for cmp = 1:3
Qk11dat = Qkdat(:, cmp:3:end);
nullbasis = null(Qk11dat);
% Qk11dat = Qkdat;
% nullbasis = null(Qk11dat);
% nullbasis = nul... |
function result = sirius_meas_orbit_acquisition_timing
% sirius_meas_orbit_acquisition_timing: calcula o intervalo de espera para que o servidor possa atualizar a leitura dos bpms.
fprintf('sirius_meas_orbit_acquisition_timing: measuring orbit acquistion time interval between two valid consecutive readings...\n');
si... |
% Function for the calculation of the parameter C of a Weibull
% distribution by method of moments
function y=weibC(x,m1,m2)
y=gamma(2./x+1)./(gamma(1./x+1).^2)-m2./(m1.^2); |
function [TfarO] = FiltThres(img,parameters)
%img=RFPtoThreshold3(:,:,250);
%imagesc(img)
%max(max(img))
[LoGradius level areaopen]=parameters{:};
%img=ones(400,800);
%LoGradius=1;
h=-fspecial('log',round(10*1),LoGradius);
%max(max(h))
filteredImg = fourierFilterWithSymmetricBoundaryConditions(i... |
function [T1T2LayerTable,layerLabels] = ImportT1T2ByLayer(whatFilter)
%IMPORTFILE Import numeric data from a text file as a matrix.
% T1T2ABACORTEXLAYERS = IMPORTFILE(FILENAME) Reads data from text file
% FILENAME for the default selection.
%
% T1T2ABACORTEXLAYERS = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads da... |
function [feat, distictive_score, idx, featuremap, patch] = modify_extractFeature(im, pos, target_sz, window_sz, cos_window, indLayers, foreground_extend_range)
% Get the search window from previous detection
target_sz = round((1+ foreground_extend_range).*target_sz);
[patch, target_mask] = modify_get_subwindow(im, pos... |
function [path_smooth]=smooth(map,path,vertices,delta)
end_idx = path(length(path));
q_end = vertices(end_idx,:); % At First q_end is the goal point
path_smooth = [end_idx];
while end_idx ~= path(1)
% Update start_vertex
for i = 1 : length(path) - 1
start_idx = path(i);
q_start = vertices(start... |
function [ c ] = tensor_prod( u )
%tensor_prod return tensor product between u and u
c = [u(1)^2 u(1)*u(2) u(1)*u(3);
u(1)*u(2) u(2)^2 u(2)*u(3);
u(1)*u(3) u(2)*u(3) u(3)^2];
end
|
% Example 9.2.
% Computes the weighted jacobian of rawfunc.m
% from Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%
% J=jac(p)
%
%
function J=jac(p)
global x;
global sigma;
m=length(p);
n=length(x);
J=zeros(m,n);
for j=1:n
J(:,j)=(...
[exp(p(2)*x(j));
... |
function CutterOption_00_CheckAllClusters(self)
% CheckClusters(self)
%
%
% INPUTS
%
% OUTPUTS
%
% NONE
% NCST 2002
%
% Status: PROMOTED (Release version)
% See documentation for copyright (owned by original authors) and warranties (none!).
% This code released as part of MClust 3.0.
% Version control M3.0.
% Extensi... |
function xString = f_copy(x,tab)
% - copies a numerical-array to the clipboard
%
% USAGE: xString = f_copy(x,tab);
%
% x = numerical array to copy to the clipboard as a space (default) or tab
% separated string. Space-delimited is suitable for pasting into a text
% editor, while tab-delimited is good ... |
function indeksit = nelionsisalla(nelio,points)
%%% palauttaa niiden pisteiden indeksit, jotka ovat nelion sisalla
indeksit = [];
[kork,lev] =size(points);
for i = 1:kork
if onkosisalla(nelio,points(i,:))
indeksit = [indeksit,i];
end
end
|
function takeSnapshotForMarkingDir(dirPath)
%Dla wszystkich danych w katalogu generuje zrzut ekranu
% w widoku przystosowanym do oznaczania regionów (maskData).
f = dir([dirPath '*.txt']);
noOfFiles = length(f);
for fileNo = 1:noOfFiles
pts = ioLoad3dData([dirPath f(fileNo).name]);
takeSnapshotForMarki... |
%% (yeast example)
load yeastdata.mat
fprintf('Amount:%.0f,Test:%s',numel(genes),genes{15})
%% (gene expression set)
% uiimport('TCGACRC_expression.tsv') %manual select
fid = 'TCGACRC_expression.xlsx'; % File Name of Excel here
par = detectImportOptions(fid);
par.VariableNames = {'feature'}; % Modify , Narrow... |
function quickPlot(p, sol)
% Solution key
Ah = sol(:, :, 1);
qh = sol(:, :, 2);
fontSize = 16;
% Get fields
q = real(ifft2(qh));
[u, v] = getVelocities(p, Ah);
sp = sqrt(u.^2 + v.^2);
figure(1), clf
set(gcf, 'DefaultTextInterpreter', 'latex')
ax(1) = subplot(1, 2, 1);
... |
function field_t = userdata_calcTemporalField(coeffs,CFvecs,x,x0)
% K = randperm(size(CFvecs,2))
% [~,x_ind] = max(abs(CFvecs(:,K(1))));
% x_ind
[~,x_ind] = min(abs(x - x0*x(end)));
field_t = squeeze(sum(coeffs.*repmat(CFvecs(x_ind,:),[size(coeffs,1),1,size(coeffs,3)]),2));
end |
function [RegionPropsTable,timeInFrames] = FindParticlesFromVideo(LastFrame,StartTime,EndTime,video,corner,postx,posty)
%[FileName,PathName, FilterIndex] = uigetfile('E:\aksel\Toshibahdcontent/ .avi');
%path = strcat(PathName,FileName);
%video = VideoReader(path,'CurrentTime',StartTime);
if EndTime ==0
EndTime ... |
function [stat] = Sproj_freqstats_onICA(ica5,ica6,ica7,ica8)
Subj = [102 105 106];
load(['C:\Users\Admin\Desktop\EmotivPro_recordings\Processing' filesep num2str(Subj(3)) '_preprocessed']);
cfg = [];
cfg.output = 'pow';
cfg.method = 'mtmconvol'; %mtmconvol
cfg.taper = 'hann... |
function logit = pa_logit(p,varargin)
% LOGIT = PA_LOGIT(P)
%
% The logit function is the inverse logistic function:
% log(P/1-P) defined for 0<P<1
%
% Optional:
% LOGIT = PA_LOGIT(P,'minP',VALUE)
% Provide a mininum value for P to deviate from 0 and 1 (default: 1e-6)
%
% See also PA_LOGISTIC, PA_PROBIT
% ... |
function tokens = tokenize(str,delimiter)
% tokenize a string
if(nargin < 2)
delimiter = ' ' ;
end
tokens = textscan(str,'%s','delimiter',delimiter, 'bufsize', 100000);
tokens = tokens{:};
end |
classdef L1GriddingProximity < GriddingProximity
properties
verbose;
end
methods
function obj = L1GriddingProximity(kernelObj, verbosity)
% Call super constructor to build obj
obj = obj@GriddingProximity(kernelObj);
% Save properties of object
obj.verbose = verbosity;
obj.unique_string = ['L... |
%% Import data from text file.
% Script for importing data from the following text file:
%
% C:\Users\fabien\EBdyna_go\JET_sim\build_initial_distributions\ascot_ion_distrib.dat
%
% To extend the code to different selected data or a different text file,
% generate a function instead of a script.
% Auto-generated by ... |
function [ B, turn, aiTime ] = importBoard( filePath )
%IMPORTBOARD Loads a saved board state from an external file
% Detailed explanation goes here
n = 8;
fileID = fopen(filePath);
formatSpec = repmat('%d',[1 n]);
B = textscan(fileID, formatSpec,'CollectOutput',true);
fclose(fileID);
B = cell2mat... |
clc
clear
benign_size = 160;
malignant_size = 40;
c = cell(benign_size+malignant_size,1);
for i=1:(benign_size+malignant_size)
if i<=malignant_size
c(i) = cellstr('1');
else
c(i) = cellstr('2');
end
end
CVO = cvpartition(c,'k',10);
CVO.TrainSize
CVO.TestSize
% CVO.NumTestSets
result1 = one... |
clc
clear all
close all
I=imread('ruf5.jpg');
imtool(I)
% % I=rgb2hsv(I);
% I=250*I;
%I=uint8(I);
a=size(I);
R_hist=zeros(256,1);
G_hist=zeros(256,1);
B_hist=zeros(256,1);
t=0:255;
for i=1:a(1)
for j=1:a(2)
R_hist(I(i,j,1)+1)=R_hist(I(i,j,1)+1)+1;
G_hist(I(i,j,2)+1)=G_hist(I(i,j,2)+1... |
function beam = dynamic_euler_beam_solver(beam, sim_time)
global Q;
if strcmp(beam.lb, 'fixed') && strcmp(beam.rb, 'fixed')
A = zeros(beam.N-2, beam.N-2); % the first node and last node are excluded
A(1,1:3) = [7 -4 1];
A(2,1:4) = [-4 6 -4 1];
A(3,1:5) = [1 -4 6 -4 1];
for k = 1 : beam.... |
% Nikola Janjusevic
% Viterbi Decoding, Hard and Soft
close all, clear all;
PLOT = 0;
M = 2; % constellation order
num_run = 25; % number of runs
num_sym = 1e3; % number of symbols
snr_vec = -5:1:5; % SNR points
for rate = [2/3]
% number of bits for quantization, 1bit is hard decoding
for num_bits = [1 2 3]
ber_vec ... |
function msgAndWait(m,args,timeout)
% function msg(msg,args)
% ex helper function, sends a message to the slave and then waits for a
% response from the slave
%
% msg: a string message
% args: if present, the msg variable can use % replacement like fprintf and
% these are the arguments
%
% examples:
% > msg('obj_on 3... |
% Specify number of objects for training set (200-1000)
number_of_objects = 10;
% Retrieve NIST data file
data_file = prnist(0:9, 1:number_of_objects);
% Pre-process and convert data file to data set
data_set = my_rep(data_file);
% Compute the classifier
start = clock;
selected_features = featself(data_se... |
%function trig_1 computes the 2D-DWT of an image and transmit it to the
%sink node
%the input to the function is the image
function [aL,hL,Lh,hh,E_dwt]=trig_1(frame_i)
[LL1,HL1,LH1,HH1]=dwt2(frame_i,'db2');
aL=LL1;
hL=HL1;
Lh=LH1;
hh=HH1;
[r,c]=size(frame_i);
%--------------------------------------------------------... |
%% Filter Design Using Different Techniques
clc
close all
clearvars
%% Specifications
sampFreq = 20000; % Sampling Frequency
pbFreq = 4000; % Pass Band Frequency
sbFreq = 4500; % Stop Band Frequency
pbRipl = 0.1; % Pass Band Ripple
sbRipl = 0.05; % Stop Band Ripple
delta = min(pbRipl,sbRipl); % Finds Mini... |
function y=Count_Range_ab2(A,a,b)
% 函数功能 :统计A数组中[a,b]区间内的元素个数。
% 算法导论 8.2-4
% T(n)=θ(n+k)
n=length(A);
k=max(A);
% 检测最小值是否小于等于零
l=min(A);
if (l <= 0)
temp=abs(l)+1;
k=k+temp;
else
temp=0;
end
for i=1:k
C(i)=0;
end
for i=1:n
C(A(i)+temp)=C(A(i)+temp)+1;
end
for i=2:k
C(i)=C(i-1)+C(i);
end
% 如果... |
function [ warp_im ] = warpA( im, A, out_size )
% warp_im=warpAbilinear(im, A, out_size)
% Warps (w,h,1) image im using affine (3,3) matrix A
% producing (out_size(1),out_size(2)) output image warp_im
% with warped = A*input, warped spanning 1..out_size
% Uses nearest neighbor mapping.
% INPUTS:
% im : input image
... |
function [outline3D] = find_model_outline(centers, radii, blocks, palm_blocks, fingers_blocks, fingers_base_centers, camera_ray, verbose)
%% Compute palm outline
[palm_outline] = find_planar_outline(centers, palm_blocks, radii, false);
palm_outline_indicator = ones(length(palm_outline), 1);
new_palm_outline = palm_ou... |
function D = caley_menger(p,q)
% caley_menger(p,q) Calculates the Caley Menger determinant.
% CALEY_MENGER(P,Q) Calculates the Caley Menger determinant between two
% sets of points P and Q, where the columns indicate the number of
% points.
%
% D=CALEY_MENGER(P,Q) return the value of the Cal... |
R = 100;
count = 1000;
x = zeros(1, count);
y = zeros(1, count);
tic;
for i = 1 : count
theta = rand * 2 * pi;
x(i) = R * cos(theta);
y(i) = R * sin(theta);
end
plot(x, y, 'ro', 'MarkerSize',2, 'MarkerFaceColor','r');
axis equal;
toc; |
function enzdb =enzdbmatLoad(enzdbmatfilename)
%enzdbmatLoad load a local Enzyme database from a MATLAB mat file
%
% enzdb = enzdbmatLoad(enzdbmatfilename) returns an enzyme database
% storing the enzymes predefined. This database is stored as a MATLAB
% containers.Map structure. To find all enzymes stored in the da... |
function BERtheoretical(v_EbN0_dB,n_mod_type,SUI);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %
%% Archivo: BERtheoretical.m %
%% ... |
function l=getWatchedLabelsanmarP2X4tri()
l=['C0';'C1';'C2';'C3';'C4';'Q1';'Q2';'Q3';'Q4';'D1';'D2';'D3';'D4';'Z '];
end |
% quat_to_eangles
%
% Input a 4 element quaternion array in the form [qw qx qy qz], output is a
% 3 element array with Euler angles about the x, y, and z axes.
% By: Scott Barnes & Chris Poole
%
function [ eangles ] = quat_to_eangles(quat)
quat_rp = [quat(2), quat(3), quat(4), quat(1)];
quat_y = [quat(6), quat(7), qu... |
% pick 500 random people and 5 images of each of them
% each batch has one of the 500 people
faces = load('../data/faceData/FacesInTheWild');
% faces.lexicon: list of people, 1 x 14808 cell, i.e. 'Scott Ritter'
% faces.metaData: list of images, 1 x 30281 cell, i.e. ...
% faces.metaData{1}.fileName = % '2002/09/... |
function y = fourth(f, h)
n = length(f);
y = zeros(1, n);
for k = 2 : n-1
y(k)= (f(k+1) - f(k-1))/(2*h);
end
end |
function session_instance = set_sound_file(session_instance,sound_file)
% SET_SOUND_FILE - Set a new sound target in current session.
%
% Usage: session_instance = set_sound_file(session_instance,sound_file)
%
% Set new sound target
session_instance.target = set_sound_file(session_instance.target,sound_file);
% Attr... |
function [ MOV ] = RelDistFramesB( Model_Ref, Model_Test, Pro_Test )
%[ MOV ] = RelDistFramesB( Model_Ref, Model_Test, Pro_Test )
% Calculation of Relative Disturbed Frames
% As described by ITU-R BS.1387-1 Section 4.6
global debug_var
if debug_var
disp(' RelDistFramesB')
end
N = size(Pro_Test.P_noise,1);
t... |
function CV=mcst_game(cm,method)
% MCST_GAME computes from a cost matrix the corresponding mcst game.
% Using Prim's or Kruskal’s algorithm.
%
% Usage: CV=mcst_game(cm)
%
% Define field variables:
% output:
% c_v -- A cost game v of length 2^n-1.
% tslm -- Matrix of minimum cost tree solutions.
% trm ... |
function [fx2, fy2, fz2, fa2] = GdfidL_read_ascii_output( log_file )
%Reads in the log file and extracts parameter data from it.
%
% Example: log = GdfidL_read_wake_log( log_file )
%% read in the file put the data into a cell array.
data = read_in_text_file(log_file);
%% Analyse the data
% Find the user defines var... |
function [e] = PINAW(y,yu,yl)
%Prediction Interval Normalized Average Width (%)
N=length(y);
R=max(y)-min(y);
e=1/(N*R)*sum(yu-yl)*100;
end
|
function raw = loadRawData(param, bbox)
% Written by
% Alessandro Motta <alessandro.motta@brain.mpg.de>
if ~isfield(param, 'backend') || isempty(param.backend)
% backward compatibility
param.backend = 'wkcube';
end
switch param.backend
case 'wkcube'
ra... |
function image2file(inFile, sz, outFile)
% function png2pdf(inFile, sz, outFile)
if nargin < 3
I = find(inFile == '.');
outFile = [inFile(1:I(end)), '.eps'];
end
im = imread(inFile);
if nargin < 2
sz = size(im(:, :, 1));
end
hFig = figure;
subplot_tight(1, 1, 1, 0, 0);
imshow(im);
toFi... |
function dz = ode_dubins(t,z,param)
% use z for [x,y,theta]
dz =zeros(3,1);
%% TODO: Here is the code for control input.
%%% the controller needs to provide control input: linear velocity and
%%% steering angle: v, delta
% step 1: calculate the value of deviation variables given the
% desired state and input and the ... |
clc;
clear all;
x1=input('enter the first sequence :');
x2=input('enter the second sequence :');
N1=length(x1);
N2=length(x2);
N=max(N1,N2);
N3=N1-N2
if(N3>0)
x2=[x2,zeros(1,N3)];
else
x1=[x1,zeros(1,-N3)];
end
for m=1:N
y(m)=0;
for n=1:N
i=m-n+1;
if(i<=0)
i... |
% shrinkageDemoBaseballData
% 1970 batting averages for 18 major league players. Data from p313 of
% "Data Analysis Using Stein's Estimator and its Generalizations"
% Bradley Efron; Carl Morris JASA Vol. 70, No. 350. (Jun., 1975), pp. 311-319.
% first column = batting average for first 45 at bats
% 2nd column = batti... |
function px_acq2mat(fdp,para)
% FORMAT px_acq2mat(fdp,para)
% fdp.acq
% para
% para.op
% para.on
%==========================================================================
for nf = 1:length(fdp.acq)
% load
acq = load_acq(fdp.acq{nf},0);
data = acq.data;
isi = acq.hdr.graph.sam... |
classdef handler < handle
properties
data
end
methods
function obj = handler(data)
obj.data = data;
end
end
end |
l = 1800; %Packet rate
C = [10, 20, 30, 40]; %Link Capacity
f = 1000000; %Queue
%Calculation of the probability associated to each packet size
% (other than the sizes 64, 110 and 1518 bytes)
numelems = (109 - 65 + 1) + (1517 - 111 + 1);
probrestante = 100 - (19 + 23 + 17);
probcada... |
function Surf = fs_read_surf(fname)
% Surf = fs_read_surf(fname)
%
% Reads coordinates and triangles of a Freesurfer's surf (Depends on
% Freesurfer's read_surf function).
%
% Input
% fname: A Freesurfer's surface file.
%
% Output
% Surf: Surface which represent a coordinate system where the analysis is
% to be done... |
%% SDP #1: Minimum trace
clear;
rng('default');
rng(1);
n=800;
P = randn(n,n);
cvx_begin sdp
cvx_solver scs
cvx_solver_settings('eps', 1e-4,...
'scale', 1,...
'do_super_scs',1,...
'direction', 100,...
'k0', 0,...
'memory', 50,...
'rho_x', 0.001,...
'verbose', 2)... |
function [unique_modes, no_unique] = unique_modes_within_clusters(modes_clusters, k, alpha, explain)
% This function finds how many unique modes within local clusters there are.
% The modes are compared based on a dot product. Two modes are considered
% the same if their dot product is larger than or equal to alpha.
%
... |
function Ws = vdoFiltWeiGauss(siz, pFs, sig)
% Computing Gaussian filtering weight.
%
% Input
% siz - image size, [h x w]
% pFs - frame index, 1 x (wF + 1)
% sig - sigma
%
% Output
% Ws - weight, h x w x (wF + 1)
%
% History
% create - Feng Zhou (zhfe99@gmail.com), 06-03-2013
% modify... |
function [ X ] = computeFeatures( las, res, showPlot, inpaintNans, features)
% calculate features for input las struct
%
% Inputs:
%
% las - struct containing las data
%
% res - struct containing x,y fields with raster dimensions and
% resolution
%
% showPlot - logical value to show feature plots (1) or not (0)... |
%Calculate the probability of an expolore individual to enter a certain
%shelter;
%Inputs: theta-Real. Normalized fitness value of the candidate shelter
% leader;
% shelterCap-Integer. Capacity of its current shelter;
% indNumberInCorner-Integer. Number of individuals present in th... |
function caseis = EdgeBoundaryWrapQPOTTS(i,j,x)
ijinside=1;
if i==1 & j==1;caseis=1;ijinside=0;end;
if i==size(x,1) & j==size(x,1);caseis=2;ijinside=0;end;
if i==size(x,1) & j==1;caseis=3;ijinside=0;end;
if i==1 & j==size(x,1);caseis=4;ijinside=0;end;
if i==size(x,1) & j~=1;if j~=size(x,1);caseis=5;ijinside=0;end... |
% Generate random patterns
NCELL = 100; % number of cells (neurons)
NPATT =10 ; % number of patterns
SPATT = 20; % numbeer of active cells per pattern
%PC = 0.5; % percent connectivity (not normally used)
var=num2str(NPATT);
FPATT = strcat('pattsN100S20P',var,'.dat'); % patterns file
%rand('state',0);
ran... |
function dx = odefun_flight_dyn_com(t, X, leg, params )
%% ODEFUN_FLIGHT_DYN_COM
%% Read constant parameters
l1max = leg.l1max;
Ksp = leg.spring.Ksp;
Kd = leg.damper.Kd;
g = leg.g;
%% ------------- Forces --------------------
t
l1 = X(4);
xf = X(5);
yf = X(6);
dl1 = X(10);
dxf = X(11);
dyf = X(12);
%% Determine if... |
function [t,y] = trapezoidal(f,tspan,y0,h)
% Explicit Euler
% Takes a function f, time span, initial condition and number of time step
% as input
m = length(y0);
t = tspan(1):h:tspan(2); % Uniform grid
N = length(t); % Number of grid points
y = zeros(m,N); % Initialise variable representing numerical solution
y(... |
classdef EstimationTwo
%UNTITLED7 Summary of this class goes here
% Detailed explanation goes here
methods (Static)
function f = gaussianWindow2d(n, step, var)
[x y] = meshgrid(round(-n/2):step:round(N/2));
f = exp(-x.^2/(2*var)-y.^2/(2*var));
f = f... |
close all
clear all
clc
fs=44100;
fc=fs/5;
Ts=1/fs;
upConversion=25;
bitrate=fs*6/upConversion;
% Generate random data
nrDataBits = bitrate; % Choose number of data bits
data1 = (rand(1, nrDataBits) > .5);
data = sixtyFourQAM(data1);
% Load the training sequence and guard bits
guard=dlmread('guard');
train=dlmread('... |
function Poly = map_assign_polygons( S, X, Y )
% assign polygons
Poly = zeros(size(X)); % to which polygon does X,Y belong
%%% Variant looping over Polygons
N = numel(S); % number of polygons
for i = 1:N % loop over polygons
bb = S(i).BoundingBox;
Xr = X(~Poly); Yr = Y(~Poly);
inbb = Xr >= bb(1,1) & Xr <= b... |
function [cir_index]=waterindex(cir, waterIndex, ~)
% [cir_index]=waterindex(cir, waterIndex, ~)
% Function to return various banmd ratios and indexes from an input image.
% For this paper, the Normalized Diffewrence Water Ind3ex (NDWI) and
% infrared (IR, band 1) was used.
% cir is 3-band int image
% cir_index i... |
function[c]=fem_solve(f, psi, omega)
N=length(psi)-1;
%% Set up matricies A and b (A=cb)
b = zeros(N, 1); % matrix of RHS (i.e. b)
A = zeros(N, N); % local K matrix
%% Calculate variables for matrix A
for i=0:N
for j=0:N
A(i+1, j+1)=int(psi(i+1)*psi(j+1), omega(1), omega(2));
end
end
%% Calculate ... |
function runBMAlgorOnDingWebKBDAta(cData,...
numRun, sOutBaseDir, sOutPrefix, varargin)
%
% Scans the input directories then runs the testing
%
% cData -
% numRum - the number of runs to experiment over ([0,numRum]). The appropriate
% input run files must exist.
% sOutBaseDir - Base directory... |
function error=Filter_Bank_Design_In_General_Case(x)
global Beta Sigma_dictionary M N K R gamma_cof cost_function_weight
optional_delay=0;
A=A_gerenator(x,Beta,Sigma_dictionary,M);
[m1,n1]=size(A);
b=zeros(m1,1);
b(N+optional_delay)=1;
Q=lscov(A,b);
error_pr=norm(A*Q-b);
for i=1:K
temp_R=R... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.jobname = 'labelMeInput';
params.LoadLabelMe.catName = '05june05_static_street_boston';
params.LoadLabelMe.fileid = 1:50;
params.LoadLabelMe.outActFolder = 'labelMeInput';
paramsAll{1} = params;
clear params;
params.Gridjob.runLocal = fals... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.