text stringlengths 8 6.12M |
|---|
function UECscript(trials, split)
ntry = trials; % number of iterations
lu = 3; % message length
lx = 7; % codeword length
lv = 4; % randomized information word length
nerrB = 1; % number of errors randomly introduced on A-B channel
nerrE = 3; % number of errors randomly introduced on A-E channels
% ... |
function S = simple_stats(A)
S(:,1)= mean(A,2);
S(:,2)= median(A,2);
S(:,3)= min(A');
S(:,4)= max(A');
end
|
function rutaGrafo = dijkstra1(grafo, Inicio, Fin)
% Se asigna memoria.
rutaGrafo = cell(numel(Inicio), numel(Fin));
distanciaMinima = zeros(numel(Inicio), numel(Fin));
%Matrices con ceros e in
saltos = min(size(grafo));
PorVisitar = zeros(saltos, 1);
visitados = inf(saltos, 1);
for i = 1:numel(Inicio)
% I... |
function [fr] = frame(ij, r, s)
%--------------------------------------------------------------------------
%
% Copyright (c) 2013 Jeffrey Byrne
%
%--------------------------------------------------------------------------
%% Inputs
n_interestpoint = size(ij,1);
if isscalar(r)
r = r*ones(n_interestpoint,1);
end
if i... |
function [times, states, q0, q1, qf] = get_Trajectory_SpaceCraft(xOrb_epoch_t0_system, t0, dt1, dtf, dV0, dV1, dVf)
UC = get_Univers_Constants();
times = [];
states = [];
% Initial position
q0 = get_Current_State_Cart(xOrb_epoch_t0_system, t0);
% First boost
q0(4:6) = q0(4:6)+dV0(:);
xOrb = Cart2Orb(... |
function idxs = bfindall(A, num, len, use_linear)
% BFINDALL Binomial search of sorted vector for all instances of target
%
% Searches the vector A for the value num and returns all indexes of num.
%
% IDX = BFINDALL(A, NUM) Searches A for the value num. Returns the indecies
% where num was found.
%
% IDX = BFINDALL(A,... |
function [] = plotOrderingArcRevisions(ordering_table)
ordering;
% put ordering to row names
position_arcs = ordering_table{'Position','ArcRevisions'};
smallest_init_domain_arcs = ordering_table{'Smallest_Initial_Domain','ArcRevisions'};
smallest_constraint_arcs = ordering_table{'Smallest_Constraints','ArcRevisions'}... |
fprintf("Problem 2\n\n")
disp("Part a soln:")
[ k, t, xt ] = taylor_a(0, 0.9);
fprintf("%.10f\n", xt)
fprintf("\n")
disp("Part b soln:")
[ k, t, xt ] = taylor_b(1, 1.75);
fprintf("%.10f\n", xt)
fprintf("\n")
disp("Part c soln:")
[ k, t, xt ] = taylor_c(2, 5);
fprintf("%.10f\n", xt)
fprintf("\n")
function [ k, t... |
clear
clc
close all
%%
%This code package implements a potential field based attitude controller
%The controller is described in D. E. Koditschek, "Application of a new
%lyapunov function to gloabl adaptive attitude tracking" in Proceedings of
%the 27th Conference on Decision and Control Austin, Texas December, 1988
gl... |
function k=get_chnodes
%k=get_chnodes
%
%Hämtar härdnoderna exlusive bypasskanalen
%@(#) get_chnodes.m 2.2 02/02/27 12:07:02
global geom
k=get_corenodes;
index=(geom.ncc+1):(geom.ncc+1):length(k);
k(index)=[];
|
function A = interpolarAtrozos (f, a, b, N);
h=(b-a)/N;
for j = 1:N+1
xt(2*j-1) = a + (j-1)*h;
xt(2*j) = a + (j-1)*h + h/2;
endfor
xt(end)=[];
A=[0 0 0];
for j = 1:2:length(xt)-1
x = [xt(j) xt(j+1) xt(j+2)];
V = vander(x);
b = f(x)'; % lado derecho
coefs = V\b;
A = [A;c... |
function field = points_to_field(points, resolution, sigma)
%POINTS_TO_FIELD Transforms a point cloud to a voxel occupancy grid
% points = Nx3 matrix of points to transform
% resolution = integer value - how many bins is the total space
% prepare field
field = zeros(resolution, resolution, resolution);
... |
function varargout = MnUBpcmb_gradient(n,K1,K2,K3,K6)
p.n=n;
p.n_numerical = n;
p.K1=K1;
p.K2=K2;
p.K3=K3;
p.K6=K6;
p.signal = 'monomer';
p.proportion = 'unit';
p.L = 1;
p.xsteps = 1000;
[signal, M, B] = generate_gradient(@MnUBpcmb,@oligomer_BC,p);
x = linspace(0,p.L,p.xsteps);
eta = calculate_eta(sign... |
function FFTanalysis(dig,fontsize)
%%
fig=findall(0,'Tag','DigitizerControl:FFTanalysis');
if ishandle(fig)
delete(fig);
end
fig=SMASH.MUI.DialogPlot('FontSize',fontsize);
fig.Hidden=true;
fig.Name='Frequency spectra';
set(fig.Figure,'Tag','DigitizerControl:FFTanalysis');
%%
set(fig.Axes,'FontSize',fontsize,'Col... |
function ratio = pwelch_interval(interval,outDir,filename)
% author : Bo-Yu Huang
% date : 2019/3/18
% This is a function used to perform welch spectrum analysis on interval combining five videos
% To acquire possible heart beat and LF/HF ratio
% interval : raw data series from five consecutive videos
% dat... |
function [gWB,trainPerf,trainN] = grad(net,data,hints)
TEMP = zeros(1,ceil(hints.tempSizeBG/8)*8);
numMasks = 1;
[gWB,trainPerf,trainN] = nnMex2.bg ...
(net,data.X,data.Xi,data.Pc,data.Pd,data.Ai,data.T,data.EW,data.trainMask,...
data.Q,data.TS,numMasks,hints,TEMP,hints.batch);
TEMP = [];
|
function [core probe freq] = ac(config, core)
core.mode=0;
%initial DC Analysis to determine the operating points
core=dc(config, core);
core.mode=1; %switching to AC Analysis
dcOperatingPoint = core.operatingPoint;
disp('DC-Operating Condition:')
dcOperatingPoint
step=(core.fmax-core.fm... |
%function [ dfds ] = prob_transf(s,f,lambda_DG,gm)
function [ dfds ] = prob_transf(s,f,plf_s,plf,lambda_DG )
%prob_dg = interp1(pdg_s,pdg,s,'spline');
prob_lf = interp1(plf_s,plf,f,'spline');
%prob_lf = gampdf(f,gm(1),gm(2));
prob_dg = normpdf(s,0,sqrt(lambda_DG));
dfds = prob_dg/prob_lf;
... |
function gabor = GetGaborTex(gabor)
% For usage with DisplayGaborStruct
% Screen(screen.w,'BlendFunction',GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
% has to be enabled
% Changing phase and/or mean are not working well, for an example, try
% period=100, sigma=50, phase = 3*pi/2, contrast=1,
% m... |
% DOTSHIFTPLOT Plots shift in parameter values between two conditions, for
% each subject and for the group average.
%
% Sample usage:
%
% cond1 = rand(10,3); % rows are parameters, columns are subjects
% cond2 = rand(10,3)
% PlotShift(cond1,cond2)
% PlotShift(cond1,cond2,{'p1','p2','p3'},{@mean,@mean,@circ_m... |
%clear all
File_4D_Path = 'D:\users\guyn\DCE_OUT\Guy_Test_1\SmVl_20120930\DCE4D.nii';
Brain_Mask_Path = 'D:\users\guyn\DCE_OUT\Guy_Test_1\SmVl_20120930\BrainMask.nii';
DCE_4D = loadniidata(File_4D_Path);
Brain_Mask = loadniidata(Brain_Mask_Path);
blabla = squeeze(DCE_4D(:,:, :,:));
[m n d s ]= ... |
clear;
close all;
map_height = 500;
map_width = 500;
n_obs = 10;
n_food = 0;
n_cache = 0;
addpath(getRelPath(1));
global obs_handles food_handles cache_handles map food_loc obs_loc cache_loc map_handle
%addpath(strcat(getRelPath(1),'/variables/constants'));
map_handle = generateMap(1,map_height,map_width,n_food,n_... |
function I = QReader(A)
% clean image
A = medfilt2(A, 'symmetric');
A = imsharpen(A);
A = imbinarize(A,'global');
A = A * 255;
% Remove surrounding white space starting with top left corner
A(1, :) = [];
A(:, 1) = [];
[m, n] = size(A);
count = 0;
for row = 1:m
for col = 1:floor(n/7)
if A(row, col) < 112
... |
clear all;
close all;
dataset = load('../data/traintest.mat');
% [idf_confusion, idf_acc] = evaluate_IDF(dataset,'random','euclidean');
% [idf_confusion, idf_acc] = evaluate_IDF(dataset,'random','chi2');
% [idf_confusion, idf_acc] = evaluate_IDF(dataset,'harris','euclidean');
[idf_confusion, idf_acc] = evaluate_IDF(d... |
function rank = kel2rank(kel)
%KEL2RANK Convert temperature from kelvin to rankine
%
% rank = KEL2RANK(kel) converts temperature from kelvin to rankine.
%
% See also RANK2KEL, KEL2CEL, KEL2FAR.
rank = kel * 1.8; |
%Developed by Nguyen Dao - DHBKHN
% This function initialize the first population of search agents
function Positions=initialization(n,ub,lb,Sensors)
Boundary_no= size(ub,2); % numnber of boundaries
% If the boundaries of all variables are equal and user enter a signle
% number for both ub and lb
... |
function robot = robotCRS97( robot )
%ROBOTBOSCH Robot specification: CRS97
%
% For description of common parameters see ROBOTDEF.
% (c) 2009-05, V. Smutny ???
% (c) 2010-01-27, Martin Matousek
% Last change: $Date:: 2010-02-17 17:51:32 +0100 #$
% $Revision: 2 $
% ---------------------------------------... |
classdef DefaultSpectrumTrimmer < SpectrumTrimmerInterface
%DefaultSpectrumTrimmer Trims spectrum according provided parameters
properties (Access = private)
SpectrumRange Range
end
methods
function obj = DefaultSpectrumTrimmer(spectrumRange)
assert(isa(s... |
function y=randg(n1,n2);
if nargin<1,
n1=1;
n2=1;
end;
if nargin <2,
n2=1;
end
y=randn(n1,n2);
end
|
sum = 0;
for i = 3 : 1000
sum = sum + prob(i);
end |
function [xl yl thetal]=leader(theta,v,t)
xl=v*cos(theta);
yl=v*sin(theta);
thetal=(1/v)*sin(0.1*t); |
function varargout = UseIsothermCompressCorrelation(varargin)
[varargout{1:nargout}] = CoolProp_wrap(428,varargin{:});
end
|
% custom object display
function disp(object)
name=object.Names;
N=numel(name);
fprintf('namespace containing %d names:\n',N);
tab=repmat(' ',[1 3]);
WindowSize=get(0,'CommandWindowSize');
col=floor(min(WindowSize(1)/N));
format=sprintf('%%-%ds ',N);
format=repmat(format,[1 col]);
format=[tab format];
while numel(nam... |
function [me,ma,mi,st]=fun_static_err_abs_st(er);
me=mean(er);
ma=max(er);
mi=min(er);
st=std(er);
|
addpath('./src')
%% Monks experiments
%monks_kernels = containers.Map({'linear', 'quadratic', 'cubic', 'gaussian'}, {'-t 0', '-t 1 -d 2', '-t 1 -d 3', '-t 2'});
monks_kernels_libsvm = containers.Map({'linear homog.', 'linear (c=0.5)', 'linear (c=1)', 'linear (c=5)', ...
'quadratic homog.', 'quadratic (c=0.5)', 'quadr... |
%
%************************************************************
%* *
%* vgGA: The Virtual Gene Genetic Algorithm *
%* *
%* Copyright (c) All Rights Reserved *
%* Man... |
% MINIMAX OPTIMIZATION
function[deltaX,deltaFpred] = minimaxOpt(Fmin,dFdx,lb,ub,c,options)
f = @(x)( -(Fmin+dFdx*x) ); % function to minimize
[~,minInd] = min(Fmin);
x0 = dFdx(minInd,:).'; % initial guess = dFdx of worst case
[deltaX,fNewPred] = fminimax(f,x0,[],[],[],[],lb,ub,c,options);
deltaFpred =... |
% Axial velocity @ rotor outlet (midspan) initialized to the inlet value
V_3A_m = linspace(V_2A_high(1)*1,V_2A_high(1)*0.7,1000);
% Incidence calculation
alpha_2_geo = [alpha_2_geo_low(end:-1:1) alpha_2_geo_high(2:end) ];
i_2m = alpha_2_m - alpha_2_m_geo;
for k = 1:length(V_3A_m)
%%... |
function [Path2D,flag,BlueprintArray,CSArray,CofCS ] = callingFn( )
count=1;
[r] = pvalue();
%[ IndicatorBW] = ColorOfIndicatorCheck(r);
[ColorOfIndicator,BlueprintArray,CSArray,A,CofCS,CofBot,StartCofCS]=Pixelete(r,count);
[A] = findingPathByCofIndicator(ColorOfIndicator,A,CSArray,BlueprintArray);
[NodeMap,A1... |
function [individual]=merge(individual, data, ranking, candidate)
%MERGE Merge two clusters in an individual
%
global DEBUG;
%don't do nothing if there is only two clusters
if( individual.numClusters == 2)
return
end
[numObjects numFeatures] = size(data);
%used for identification of the i,j-indexes of the pair of ... |
function A=DHEAP_INCREASE_KEY(A,i,key,d)
% 函数功能:增大max d-ary heap中,A(i)的key值。
if A(i) > key
return
end
while (i > 1 && A(PARENT(i,d)) < key)
A(i)=A(PARENT(i,d));
i=PARENT(i,d);
end
A(i)=key;
|
Rz=Rort([0,0,1]',d2r(-20))
Ry=Rort([0,1,0]',d2r(-110))
R=Rz*Ry
gbc=gab_Rp(R,[7,-2,5]')
qc=[0.5,0.2,3.2,1]'
qb=gbc*qc |
function ncfile = read_ll3m(datapath,depid)
% ncfile = read_ll3m(datapath,depid)
% Read data files from a Little Leonardo LL3M data Logger. This function
% generates a netCDF file in the current working directory containing:
% A Accelerometer data structure
% M Magnetometer data structure
% P Pressure sen... |
function [DecimalNumber] = fractionconvert(frac)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
if strcmp(frac,'½')
DecimalNumber = 0.5;
elseif strcmp(frac,'¾')
DecimalNumber = 0.75;
elseif strcmp(frac,'¼')
DecimalNumber = 0.25;
end
end
|
% Example 9.2 : finding roots for Example 9.1 using newtons
% First initial guess
x0 = [1,1]';
%find root
[x,k] = newtons(@func,x0,1e-6,20)
% Second initial guess
x0 = [-1,1]';
%find root
[x,k] = newtons(@func,x0,1e-6,20)
|
%=======================================================================================================
% This contain all the information for running main
% TEMPLATE OF THE STRUCT DATI
%=======================================================================================================
% Dati structure for the... |
function kcoeff = kwiener_train(X,Y,s)
% FUNCTION kcoeff = kwiener_train(X,Y,param)
% AUTHOR: Makoto Yamada
% (myamada@ism.ac.jp)
% DATE: 12/25/07
%
% DESCRIPTION:
%
% This function compute the kernel Wiener filter (kernel Dependency
% Estimation) using Canonical Correlation An... |
%------------------------------------------------------------------------
% WORK IN PROGRESS - FINDING AN INDEPENDENT SET OF EDGES (GRAPH MATCHING)
% CAN BE CAST AS A MAX FLOW PROBLEM...
% http://en.wikipedia.org/wiki/Matching_%28graph_theory%29
%---------------------------------------------------------------------... |
clear all
Vmin = -2.95;
Vmax = 3; %gate voltage
T = 300; %temperature
str = 'temp400.png';
%parameters
global Voff l0 l1 ep D q Vth P2 P1 mo h m Kb hbar d
f = figure()
kk = 0;
% for T=20:20:500
Voff= -3;
d = 20e-9;
l0 = 2.12e-12;
l1 = 3.73e-12; %experimental parameters
ep = 9*8.85e-12; %permittivity of ... |
function [Data_Corrected, Header, P]=y_FDR_Image(StatsImgFile,qThreshold,OutputName,MaskFile,Flag,Df1,Df2,VoxelSize,Header)
% function [Data_Corrected, Header]=y_FDR_Image(StatsImgFile,qThreshold,OutputName,MaskFile,Flag,Df1,Df2,VoxelSize,Header)
% Function to perform false discovery rate (FDR) correction.
% References... |
len = 1700;
saw = @(x) x/(len-1);
sine = @(x) 0.5*sin((x/(len-1))*2*pi + 3*pi/2)+0.5;
triang = @(x) 1+rectpulse([1,-1], (length(x)/2)).*((x-(length(x)/2))/((length(x)/2)));
pulse = @(x) rectpulse(0:1, len/2);
%% DECLAR
x = 0 : (len-1);
%% SINE
y = sine(x);
% plot(y)
toString(y);
%% TRIANG
y = triang(x);
% plot(y)
y = ... |
% Lab_3 (Phase Double differences Solution)##
close all; clear all; clc;
%% Data input
f1=1575.42e+6; f2=1227.60e+6; c=299792458;
lambda1=c/f1; lambda2=c/f2;
%% Approximate position of the two reciver stations (Observer)
x1_0=[4.159404458308991e+6,672972.065,4.77245255894603e+6];
x2_0=[4.1551687043802983e+6,6... |
classdef SampleBasedDist < ProbDist
% Sample based representation of a pdf
% samples(s,i) is sample s for dimension/ distribution i
properties
samples; % rows are samples, columns are dimensions
domain; % integer labels for the columns
end
%% Main methods
methods
function m = Sam... |
function out = grassmann_farthest_neighbor(q,dat)
N = length(dat);
parfor i = 1:N
tic
d(i) = log_map_norm(q,dat{i});
toc
end
[val,idx] = max(d);
out = dat(idx); |
% =====================================================================================================================
% =====================================================================================================================
indir =pwd; % source directory of spe files
outdir ... |
activewire(1,'OpenDevice') % open device 1
activewire(1,'SetDirection',[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]) % set all I/O lines to input
%Cycle=Period/2;
halfPeriod = 24;%'period'= a block of test-null1-test-null2
nCycles = 10; %a cycle (test-null) is equal to half a 'period' in this doubled paradigm (test-null1-test-... |
A = [-57 192 148; 20 -53 -44; -48 144 115];
C = [-4, 2, 8];
for i=1:length(C)
e = inv_power_method(A, C(i));
disp("Eigenvalue:");
disp(round(e + C(i)));
end
function [ r ] = inv_power_method(A, c)
n = length(A);
x = ones(n, 1);
x(1) = -1;
for k=1:30
B = inv(A - c * eye(n));
... |
function poly = removeMultipleVertices(poly, varargin)
%REMOVEMULTIPLEVERTICES Remove multiple vertices of a polygon or polyline.
%
% POLY2 = removeMultipleVertices(POLY, EPS)
% Remove adjacent vertices that are closer than the distance EPS to each
% other and merge them to a unique vertex.
%
% POLY2 = r... |
addpath('../general_functions')
load('../data/fig5_3.mat')
%% figure 5_3a
x=lam_range; y=EW_quot1; legend_entries={"$d=2$", "$d=3$", "$d=4$", "$d=5$"};
legend_loc='northwest';
xLab='$\lambda$'; yLab='$\frac{- E[W_\lambda]}{\log(1-\lambda)}$'; xLim=[0, 1]; yLim=[0, 1]; filename="../figures/fig5_3a.pdf"; logplot=false;... |
%% Kmeans assignment: Erika Dunn-Weiss
%
% Rather than generate a random graph, I drew a graph on paper that I
% expected to fail kmeans. Since this graph has two separated parts, I say
% that a node should be in cluster s if and only if it shares an
% edge with some other node within cluster s.
% I expected this graph... |
function [J] = barinterp(x1,x2)
N1=length(x1);
N2=length(x2);
lam=repmat(x1(:),1,N1);
lam=lam-lam'+eye(N1);
lam=1./prod(lam,1);
J=repmat(x2(:),1,N1)-repmat(x1(:)',N2,1);
[ii,jj]=find(abs(J)<10*eps);
J=repmat(lam,N2,1)./J;
J(ii,:)=0; J(ii+N2*(jj-1))=1;
J=J.*repmat(1./sum(J,2),1,N1);
end |
function [DGP DGPC]=p_Derived_game_propertyQ(clv,x,str,tol)
% P_DERIVED_GAME_PROPERTYQ checks whether an imputation x satisfies a
% modifed reduced game property (consistency).
%
% Source: Meinhardt (2018), "Analysis of Cooperative Games with Matlab and Mathematica".
%
% Usage: [DGP DGPC]=clv.p_Derived_game_propertyQ(x... |
%this code is for selection of 3*3 neighbours
%converting image to gray scale image
gray_image = rgb2gray(imread("image.jpg"));
%size of image
[R C] = size(gray_image);
%selecting neighbours
for i = 2 : 1 : R -1
for j = 2 : 1 : C - 1
neighbours = gray_image(i - 1 : i + 1 , j - 1 : j + 1) %this statem... |
function Q=quadrants(n)
Q=[ones(n,n),2*ones(n,n);3*ones(n,n),4*ones(n,n)] |
function [] = subplot_frequence_echantillonnage(position, frequence, Y)
% Cette fonction ajoute un subplot à la figure regroupant les six
% représentations de Y(t) avec différentes fréquences d'échantillonage
subplot(6,1,position);
t = linspace(0, 1, frequence);
plot(t, Y(t));
ylim([-20, 20]);
ti... |
%% Apply SAM code %%
function [final_scores] = update_seedscore(seeds, sims_mat, emotions, regression_type, lambda, model_coefs,result_dir,dim,lexicon,w_flag)
% Matrix with similarities between (set_for_affect_estimation) and lexicon used (e.g. anew)
train_matrix = load(sims_mat,'-ascii');
train_matrix(train_matrix ... |
function [ FENStr ] = FENString( FEN )
FENStr = '';
for i=1:size(FEN, 2) % Iterate over each column.
str = mat2str(cell2mat(FEN(:, i))');
[start, stop] = regexp(str, '(\.+)+');
while ~isempty(start)
str = strrep(str, str(start(1):stop(1)), ...
num2str(length(start(1):stop(1))));
... |
%script to e get AUC scores for classifier
close all
%ID = [40:59 0:39 60:79];
ID = 0:149;
N = length(ID);
%loc = '../libdai/examples/data/resultSim/';
%loc = '../libdai/examples/data/resultChandola/';
loc = '../libdai/examples/data/resultGame3/';
HSMMscores = [];
for i=1:N
file = strcat(loc, 'HSMMlikelihood_te... |
function prep_new_data
hfig = gcf;
hobj = gcbo;
cmsplot_prop = get(hfig, 'userdata');
switch (cmsplot_prop.filetype)
case {'.h5', '.hdf5'}
dname = cmsplot_prop.dist_name;
otherwise
dname=get(hobj,'label');
end
cmsplot_prop.dist_name = dname;
cmsplot_prop.matvar_plot = 0;
get_cmsplot_data;
cm... |
function b = point_in_circle(p, x, y, r)
if isnan(x) || isnan(y) || isnan(r)
% circle not defined
% can't be in an undefined circle
b = 0;
else
% get distance
d = norm((p - [x, y]), 2);
% if distance less than radius
b = d <= r;
end
|
function datast=request_usgs_data(station, parameter, start_date, end_date, options)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Loads USGS data directly from https://waterdata.usgs.gov/nwis into a structure using a
% GET request
%
%
% Parameters
% ----------
% station : str
% US... |
close all
[msfc,ws,ol,image_name] = msfcFunc()
imshow(image_name)
h = msgbox(['once you have clicked OK and zoomed in, press F5, or continue running script'])
keyboard
l1 = ginput(1)
% keyboard
l2 = ginput(1)
diff = l2-l1
d = sqrt((diff(1).^2)+(diff(2).^2))
prompt = 'How many meters is that?'
ind = inputdlg(promp... |
close all;
clear variables;
clear global;
filename = 'characters.tif';
input = imread( filename );
% input
figure;
colormap(gray(256));
image(input);
axis equal;
axis tight;
title(['"' filename '"']);
% filtered input
[M, N] = size(input);
H = IPbhpf(60, 2, M, N);
filtered_input = IPftfilter(input, H);
figure;
col... |
function prepare_pRF_Mathematica(session_dir,subject_name,outName,func)
% Converts .nii.gz pRF cortical maps that result from 'average_pRF.m' to
% .mgh format, as well as changes the naming convention to that used by
% Mathematica pRF template fitting notebook
%
% Usage:
% prepare_pRF_Mathematica(session_dir,subje... |
% Below code
function Nozzle=nozzle(M,A_exit,A_crit)
gamma=1.4;
Nozzle=A_exit/A_crit-(1/M*(2/(gamma+1)*(1+(gamma-1)/2*M*M))^((gamma+1)/2/(gamma-1)));
end
|
function [hist_prec, hist_prec_mean, mean_stop_num,stop_step,total_step,parms_inner, n1, sym1, pos1] = get_oasisc_oasisc_pos_comp(cv_flag)
if nargin == 0
cv_flag = 1;
end
disp('Please choose among ITML, OASIS, OASISC, SYMOASIS, PROJSYMO, POSSYMO and SEMISYMO \n');
disp('PROJSYMO and POSSYMO will be based on the ... |
classdef CRV < mlpet.CRV
%% CRV
% $Revision$
% was created 29-Jun-2017 21:14:36 by jjlee,
% last modified $LastChangedDate$ and placed into repository /Users/jjlee/Local/src/mlcvl/mlarbelaez/src/+mlarbelaez.
%% It was developed on Matlab 9.2.0.538062 (R2017a) for MACI64. Copyright 2017 John Joowon Lee.
... |
%%%%%
%is this label inside a video?
%this will save all label that are part of a video or 5min after and before
%mainly for blob because I forgot to implement a blob.vid label or
%bottom.small.fish.school.vid
addpath(".\gfunctions")
path_lib = 'C:\Users\jsalveta\Desktop\Matlab code\Labelling\blob.vid\';
% You nee... |
function [e0,ef]=plotIVCurrent(experiment,model)
global V
f=2;
model.setParams([]);
setGlobals(experiment.globals)
[T,I,Y]=model.naivePerfusionResponseIV(experiment.conditions{:});
V=-80e-3*2*(rem(T,1/f)*f-1/2)-60e-3;
I=model.getTotalCurrent(Y);
ton=experiment.conditions{1};
tramp=ton+1/f;
Tstim=T(T>ton);
Ystim=Y(T... |
function [Data, Mask] = t_prepro(DATA_DS, DEMEAN, VoxVarNorm)
if ndims(DATA_DS) == 4
[dx, dy, dz, dt] = size(DATA_DS);
if (DEMEAN)
%display('Calculating mean and demeaning data')
Mean = mean(DATA_DS,4);
DATA_DM = DATA_DS-repmat(Mean,[1,1,1,dt]);
else
DATA_... |
%This program decomposes an image into blocks.
%Parameters
% inImg - Input Gray Image
% blkSize - Window size for block processing
% out - Output 4 dimensional matrix with blocks.
%
%Author : Athi Narayanan S
%Student, M.E, EST,
%K.S.R College of Engineering
%Erode, Tamil Nadu... |
clearvars;
load('otsu.mat') %fuzzy / otsu .mat
arraySize=20; %otsu: 20 , fuzzy: 30
thres=90; %lower bound for sensitivity and specificity
Acc=zeros(0,0,0);
Sen=zeros(0,0,0);
Spe=zeros(0,0,0);
result=zeros(5,13);
c=1;
for i=[1,2,3,4,7,8,9,11,14,15,16,17,18]
for j=1:(i-1)
Acc(j,:,:,:)=GAccu... |
function [ specCentroidVec ] = SpectralCentroid( samples, blockSize, hopSize )
%This function calculates the Spectral Centroid for each block for an audio file and returns
%a row vector.
L = length(samples);
n = 1;
specCentroidVec = [];
kVector = 0:1:blockSize/2-1; %row
kVector = kVector'; %column
index = [];
for... |
function [ expday ] = expday(rat_id)
if strcmp(rat_id,'R066_EI')
expday.one = 'R066-2014-11-27_recording';
expday.two = 'R066-2014-11-28_recording';
expday.three = 'R066-2014-11-29_recording';
expday.four = 'R066-2014-12-01_recording';
expday.five = 'R066-2014-12-02_recording';
expday.six = 'R0... |
close all
clc
tic
%% Load Data
tic
if exist('ACWI','var') == 0
load('Data_0727.mat');
else
clearvars -except ACWI Index ptf bench
end
%% Compute all momentums
uplim = 3;
curr = {'USD','EUR','LOC','CHF'};
for c = 1:length(curr)
rr = ACWI.TimeExt.Returns.TR.(curr{c});
rr(rr>uplim|rr==Inf|rr==-1) = 0;
fo... |
function wsFlow = movFlow(src, parFlow, varargin)
% Compute optical flow for the video.
%
% Input
% src - source
% parFlow - flow parameter
% alg - algorithm, {'ms'} | 'liu'
% flip - flip flag, {0} | 1
% wMa - image maximum size, {0}
% wF - window for smoothing the magitude, ... |
function output=average_angles(word, probe, change)
if isempty(change)
angle=calc_similarities(word, probe);
angle=cell2mat(transpose(angle));
angle_cells{1,1}=mean(angle,1);
elseif length(change)==1
angle_cells=cell(2,1);
temp_word=word(:,:,1:change(1));
... |
function [Fitness_value Obj_value Rank_value] = Fitness_function_pro_libsvm( Nind, Chrom, X_norm, dim, T , K_fold, g_value, C_value, fea_rank)
% 输出变量初始化
Fitness_value = zeros(Nind,1); % 适应度函数
Obj_value = zeros(Nind,1); % 目标函数,即分类准确性
Rank_value = zeros(Nind,1); % mRMR排序
Chrom_fea = Chrom(:,1:dim);
% sampletotal=size... |
riseTime = zeros(mcSamples,1);
ssVelocity = riseTime;
disp('Running MonteCarlo Simulation ...')
tic
hwb = waitbar(0,'Starting Simulation...');
for i = 1:mcSamples
Ra = mcRa(i);
La = mcLa(i);
Kt = mcKt(i);
Kemf = mcKemf(i);
sim('MaxonDCMotor.mdl');
waitbar(i/mcSamples,hwb,['Run ',num... |
dt = 0.001; % millisecond
t = 0:dt:2;
cricket_ball_path_x = zeros(size(t));
for loop_index = 1:length(t)
if cricket_ball_path_x(loop_index) > 20
break
end
end |
% wriggle by degrees
clear all
close all
wiggle = 0.05;
n = 50000;
V = [1;0];
theta = zeros(1,n);
for i = 1:n
newV = unitvector(V + wiggle.*randn(2,1));
theta(i) = atan2(newV(2),newV(1));
end
figure(1)
hist(theta,20)
mean(theta)
std(theta)
|
classdef AdvancedResize < handle
properties (AbortSet, SetObservable)
HorizontalOrigin
HorizontalOriginSide
HorizontalOriginUnit
VerticalOrigin
VerticalOriginSide
VerticalOriginUnit
Width
WidthUnit
WidthOffset
WidthOffsetUnit... |
function [kh,out]=ftpower(x,ft)
Nx=length(x);
nk = length(ft(:,1));
NFFT = 2.^nextpow2(nk);
k=[0:NFFT/2+1 -1*(NFFT/2:-1:1)];
%k = [ nk/2:-1:1 0 1:floor((nk-1)/2)];
%k = [0:nk/2 -1.*(floor((nk-1)/2):-1:1)];
kh = fftshift(k);
power=zeros([nk 1]);
for i=1:nk
power(i) = trapz(x',conj(ft(i,:)).*ft(i,:))./(max(x)-min(... |
% Gal computaintal mdoel
%%
clear all
close all
clc
% Parameters C = [nM] time = [min]
% 1% = 55nM
kf83 = 100; x(1) = kf83;
kr83 = 150; x(2) = kr83;
kf84 = 80; x(3) = kf83;
kr84 = 1300; x(4) = kr84;
aG1 = 15; x(5) = aG1;
aG3 = 15; x(6) = aG3;
aG4 = 2; x(7) = ... |
function r = rossd2fdxdp(t,fd_cell,p)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% rossd2fdxdp
%
% The second derivative of the Rossler equations with respect to
% x and p at times t.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%r = zeros(length(t),3,3,3)... |
function [slopV distV tmpslop]=slope(LocX_Y,LocY_Y,LocX_X,LocY_X,matchnode,Xcol)
slopthr=0.02;%要改
distthr=0.2;
matcnum=size(matchnode,1);
sloparr=ones(matcnum,2);
distarr=zeros(matcnum);
slopnum=1;
tmpslop(1)=atan((LocX_Y(matchnode(1,1))-LocX_X(matchnode(1,2)))/(LocY_Y(matchnode(1,1))+Xcol-LocY_X(matchn... |
% Copyright 2018,2019, by the California Institute of Technology. ALL RIGHTS
% RESERVED. United States Government Sponsorship acknowledged. Any
% commercial use must be negotiated with the Office of Technology Transfer
% at the California Institute of Technology.
% ------------------------------------------------------... |
function [graphData, agentTrace, agentLog] = importAATOMDataFunction(path, ignore)
% importAATOMDataFunction Imports data for a specific simulation. The path
% is the path to a folder that contains log files.
% [graphData, agentTrace, agentLog] = importAATOMDataFunction(path)
% Imports all data of a simulati... |
%Vinicius -- feito com a rotina do aguirre
close all;
clear;
clc;
H = tf([0 0 1],[0 1000 1]);
b = 12;
N = 10000;
%Tb = 1
u = prbs(N, b, 1);
figure(1)
lsim(H, u, 0:1:N-1);
xlim([0 N])
axis([0 N -0.5 1.5]);
xlabel('amostras');
title('Tb = 1')
%Tb = 100
u = prbs(N, b, 100);
figure(2)
lsim(H, u, 0:1:N-1);
xlim([0 N])... |
% function SenseProm_V2
clear all; close all; clc;
tic
% This script will take input sequences of operators and promoters and
% generate sequences for chip-synthesized oligos of a defined length.
% The program functions in modules, each of which independently perform a different design:
%1. Assembles th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.