text stringlengths 8 6.12M |
|---|
function CG = liftingSurfaceCG(chord_fraction, semiSpan_fraction, span, taperRatio, rootChord, dihedral, sweepLE, vert)
% this function calculates the CG position of a lifting surface w.r.t. the
% leading edge of the root chord.
%
chord_CG = rootChord*((taperRatio - 1)*semiSpan_fraction + 1);
yCG = 0.5*span*sem... |
function waterwave ( )
% WATER WAVE
% 2D Shallow Water Model
%
% Lax-Wendroff finite difference method.
% Reflective boundary conditions.
% Random water drops initiate gravity waves.
% Surface plot displays height colored by momentum.
% Plot title shows t = simulated time and tv = a measure of total variation.
% An ex... |
function y = removeNaN (x1)
% This function removes NaN values (all of them) from the matrix. If
% columns contain different number of NaN values, matrix will be reshaped
% into one row.
% MUST: only one sheet matrix is accepted (2 DIMENSIONS).
[m,n,o]=size(x1);
if o>1
disp ('EMPTY MATRIX PRODUCED!');
y=[];
... |
%% Sensor Variation4 (Size of the coil)
% Peak EMF voltage to Distance between coil and RBC (Position)
%% Magnetic Field Setting
clear all
clc
N_p = 30; % number of particle
d_int = 1e-4; % interparticle spacing
N = 1; % Number of positive point charge consisting a group / (2.464e-12 / 1.6e-19)
v = 1; % meter per s... |
k = 5
T = 2
T1 = 3
T2 = 1.3
ksi = 0.2
w1 = tf([k], [1 0])
w2 = tf([k], [1 T 0])
w3 = tf([k*T 1], [1 0])
w4 = tf([k 0], [T 1])
w5 = tf([k], [T 1])
w6 = tf([k], [T2.^2 T 1])
w7 = tf([k], [T.^2 2*ksi*T 1])
w8 = tf([k], [T.^2 0 1])
show_zveno_graphs(... |
function iso_mesh(isofrequency,level_grid,level_color,level_contour,...
azi_interp,elev_interp)
% function iso_mesh(isofrequency,level_grid,level_color,level_contour,...
% azi_interp,elev_interp)
%
% ISO_MESH plots lines of the same level in a 3D-meshplot. The different
% ... |
function adddata(handles)
global rawdata
nf = int32(str2double(get(handles.text1,'string')));
j = 0;
% l = 0;
data1 = {};
% data2 = {};
for n=1:nf
% for i=1:size(rawdata(n).parameter,1)
for i=1:size(rawdata(n).title,1)
j = j + 1;
% temp = [rawdata(n).xylabel{i,2} ' vs. ' rawdata(n).xylabel{i,1} ... |
function stimulus = generate_stimulus(scaling,range)
omega = 5.7; % spatial frequency (cycles / degree)
diameter = 0.7; % annulus diameter (degree)
side_length = 7; % side length (degree) of square stimulus region
res = 50; % ... |
%%Genetic Algorithm
%%
%domain 参数范围 size = n x 2
function genetic_optimize(domain)
maxiter = 50; popsize = 30; len_v = 10;topelite = 12; % parameter
pop = zeros(popsize, len_v);
for i = 1:popsize %initial
for j = 1:len_v
pop(i,j) = rand(1,1) * (domain(j,2) - domain(j,1)) + domain(j,1);
end
end
s... |
% analysis_TempTreatmentANOVAs.m
% Looks at % cover of various organisms, # of mobiles and total diversity
% by whether the community was on the plate of the bedrock. Based on
% biological data gathered by DLG in fall and winter of 2013, and spring
% and summer of2014. These data are contained in summarydataFINAL.tx... |
#!/bin/octave
## Evan Widloski - 2016-07-14
## DFT Testing - practicing and understanding DFT
duration = 1;
sample_freq = 50;
N = duration*sample_freq;
n = 0:N-1;
x = sin(2*pi*1*n/N) + cos(2*pi*5*n/N);
for k = n
c = cos((2*pi*k*n)/N);
s = -sin((2*pi*k*n)/N);
## show original signal and sin/cos to calculate ... |
function H = computeH(targetPoints, sourcePoints)
A(1,:) = [-targetPoints(1,1), -targetPoints(1,2), -1, 0, 0, 0, sourcePoints(1,1)*targetPoints(1,1), sourcePoints(1,1)*targetPoints(1,2), sourcePoints(1,1)];
A(2,:) = [0, 0, 0, -targetPoints(1,1), -targetPoints(1,2), -1, sourcePoints(1,2)*targetPoints(1,1), sourcePoi... |
clear all
n = 100000;
d(1) = 0;
c{1} = 0;
tic
for i = 1:n
d(1) = i;
end
toc
tic
for i = 1:n
c{1} = i;
end
toc
|
%% NIG -SA- N/M
clear param;
param(1,1) = 24.24; %nu (NIG)
param(2,1) = -8.18; %theta (NIG)
param(3,1) = 1.14; %sigma (NIG)
param(1,2) = 4.23; %kappa
param(2,2) = 0.6925; %eta
param(3,2) = 3.41; %lambda
param(4,2) = 1.00; %y0
S0 = 100;
K = 100;
TTM = 1;
r = 0;
div = 0;
modellnamn = 'CC_NIG-SA-M';
par... |
function [logMLE, theta, sterr, u_hat, non_par_u_hat, V_u_hat, u_hat_conditional_w1w2, V_u_hat_conditional_w1w2, V_non_par_u_hat] = nested_AppLoglikelihood_APS16(y, x1, x2, x3, p1, p2, p3, theta0)
Options = optimset('TolX', 1e-8, 'TolFun', 1e-8, 'MaxIter', 20000, 'MaxFunEvals', 6 * 20000, 'Display', 'Off');
[th... |
function save_stack_as_OMEtiff(folder, file_names, extension, dimension, FLIM_mode, ometiffilename)
if isempty(file_names) || 0 == numel(file_names), return, end;
num_files = numel(file_names);
%
sizeC = 1;
sizeZ = 1;
sizeT = 1; ... |
load specular-pear.mat
theta=asin(c(2,1));
fi=atan(c(3,1)/c(1,1));
Ky=[cos(fi), 0, sin(fi); 0, 1, 0; -sin(fi), 0, cos(fi)];
Kz=[cos(-theta), -sin(-theta), 0; sin(-theta), cos(-theta), 0; 0, 0 ,1];
IM1=mat2gray(im1);
IM2=mat2gray(im2);
IM3=mat2gray(im3);
IM4=mat2gray(im4);
for i=1:328
for j=1:262
I1suv(i,... |
function F = solve2D2DRegistration(pts2D1, pts2D2)
% param:
% pts3D1 [2,N] matrix
% pts3D2 [2,N] matrix
% output: relative transformation from pts3D1 to pts3D2
% F: homogenous transfromation
%fist find the reference point
pts2D1_0 = findRefPoint(pts2D1);
pts2D2_0 = findRefPoint(pt... |
close all;
clear all;
load("Results_1D_Simulation_Temp_plot2.mat");
n = 10; % Number of points on chain
% Finding max value
max_val = max(P_1d_dynamics_temp(1,:,:),[],'all');
% Finding min value
min_val = min(P_1d_dynamics_temp(1,:,:),[],'all');
% Setup of conditions and polymer chain
max_temp = 10^4;
T_vals = [... |
function f = transcribeOneNote(YY, I)
if(all(YY==0))
f = 0;
else
%autocorrelation
% AUTO=real(ifft(abs(fft(YY)).^2)); %COMPUTE AUTOCORRELATION OF EACH COLUMN.
% [Q,I]=max(AUTO(55:120,:)); %FIND MAXIMUM (Q) AND ITS LOCATION (I) OF EACH.
% f= 44100./(I+53)
if(I==3) %for trumpet
%harmonic product spectrum
FYY=abs(fft(Y... |
%Algoritmo Curvas de Bezier para trecho UNICO
clear
clc
m=4 %numero de intervalos de um trecho UNICO das 6 figuras:
%y=[0 0 4 4];x=[0 4 4 0]; %parabola horizontal
%y=[0 9 9 0];x=[4 4 0 0]; %parabola vertical
%y=[3 6 0 -3];x=[0 5 6 1]; %parabola inclinada
%y=[3 1 5 -3];x=[0 2 2 3]; %parabola distorcida
... |
function val = eval_bf(basisfun, xyz_a0)
% val = eval_bf(basisfun,xyz_a0)
%
% Input:
% basisfun structure with basis function information, from list of basis functions
% xyz_a0 mx3 list of Cartesian coordinates, one point per row, over which to
% evaluate the basis function
% Output:
% val ... |
function [U,K,F] = FEA_3DP6(struc,elements,map,KE,Po,noF,fixeddofs,oldstruc,oldK,oldF)
%for irregular shapes
%Computes Finite element analysis for the structure where 1 means there is
%material and 0 corresponds to void
%Inputs: -struc:material distribution representation (1=material & 0=void)
% -el... |
function [samples, energies, diagn] = hmc_wrapper(f, x, options, gradf, varargin)
ioptions = foptions;
ioptions(14) = 10000;
num_samples = options(14);
num_skip = options(15);
num_test = 25;
x = scg(f, x, ioptions, gradf, varargin{:});
ix = x;
while (1)
options(14) = 1;
options(15) = 0;
x = ix;
... |
%% Correlation experiment
%% Xiluva maswanganye
%% May 2021
signal = audioread('white.wav');
sig_corr = signal
% Test one - general correlation
tic;
r1 = mycorr(signal, sig_corr, 10000);
runtime_r1 = toc();
tic;
r2 = corr(signal, sig_corr);
runtime_r2 = toc();
disp(r2 - r1);
disp(strcat('It took: ', nu... |
clc
clear
clc
clear all
close all
im = double(rgb2gray(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week6/original_cameraman.jpg')));
Mu=3.999; % Parameter of map
xlog1= 20;
ylog1= 22;
zlog1= 19;
k_5 = 34;
k_6 = 40;
k_7 = 36;
for k=2:numel(im) +2
xlog1(1,k)=mod(Mu*k_5*ylog1(1,k-1)*(1-xlog1(1,k-1)+... |
function [estimates, model] = fitLog(xdata, ydata,start_point)
% Call fminsearch with a random starting point.
model = @expfun;
% options = optimset('MaxFunEvals',1000000);
estimates = fminsearch(model, start_point);%,options);
% expfun accepts curve parameters as inputs, and outputs sse,
% the sum of squares error fo... |
% Project 2
% Konstantin Zelmanovich
% Jayden Chen
clear all
clc
clf
% Initial values
L = 10;
e = 0.25/1000;
p = 1000;
u = 0.001;
D1 = 0.2;
g = 9.81;
A1 = ((D1/2)^2)*pi();
RR1 = e/(D1);
data1 = [];
data2 = [];
d_steps = linspace(0.03, 0.5, 60);
m_steps = linspace(0,5,500);
% Mass flow rate, Fri... |
%Test 2a (Select threshold):
%input:
[epsilon F1] = selectThreshold([1 0 0 1 1]', [0.1 0.2 0.3 0.4 0.5]');
%output:%epsilon = 0.40040
%F1 = 0.57143
fprintf('Best epsilon found using cross-validation: %e\n', epsilon);
fprintf('Best F1 on Cross Validation Set: %f\n', F1);
|
%a
array=[-1, 1];%nivelul la care ajunge graficul
nr=50; %nr de pulsuri
Pcell=cell(1,nr);
dt=.002;
for i=1:nr
T=2 ;%Perioada semnalului de T 2s
Width=0.25;%latime puls
t=0:dt:T;
Pcell{i}=randsample(array,1)*(t<=Width); %functia intoarce o matrice goala
end
... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
function [result,WCL,Irrigation_3] = Threshold_5(ET,Precipitation,t,d)
corn_price = 0.2;
water_price =1;
WCL_3 = zeros(28,1);
WCL_3(1) = 540;
WCL = zeros(84,1);
WCL(1) = 540;
Irrigation_3 = zeros(28,1);
for i = 1:28
if WCL_3(i) < t
Irrigation_3(i) = d;
end
... |
function [dU,dV] = MeanFields2(a,vid)
display('test2')
U=double(zeros(480,640));
V=double(zeros(480,640));
image1=read(vid,a);
image2=read(vid,a+2);
im1=double(rgb2gray(image1))/255;
im2=double(rgb2gray(image2))/255;
[h w]=size(im1);
height=h;
width=w;
ORIGINAL_IMAGE_1=im1;
ORIGINAL_IMAGE_2=im2; ... |
%------------------------------------------------------------------------------------
%
% M-file: CpWl.m (Specific heat liquid water, CpWl. [J/(mol*C)])
%
% Data from Felder, Rousseau "Elementary Principles of Chemical Processes",
% 2nd ed., 1986, John Wiley & Sons, Inc.
% Valid in the temperature range [0-100]degr... |
%DRAWMARKERARUCO Draw a canonical marker image
%
% img = cv.drawMarkerAruco(dictionary, id, sidePixels)
% img = cv.drawMarkerAruco(..., 'OptionName',optionValue, ...)
%
% ## Input
% * __dictionary__ dictionary of markers indicating the type of markers.
% * __id__ identifier of the marker that will be returned. I... |
function marginals = uq_getAvailableMarginals( varargin )
% UQ_GETAVAILABLEMARGINALS retrieves the list of the names of the built-in
% distributions
%% get the parent folder where all the built-in marginals are stored
root_folder = uq_rootPath ;
marginals_folder = fullfile(root_folder,'modules','uq_input','builtin',.... |
function Integration2D(obj,flag, qmin, qmax, varargin)
% This function integrates 2D X-ray data various ways:
% obj.Integral = Integration2D('i', InputFileName,qmin,qmax, minAngle, maxAngle, OutputFileName);
% Integrates the data over a circular path along q_||. Integral
% is a vector consist... |
n = 50;
r = rand(n,1)
plot(r)
|
clear all
clc
addpath('fcm')
load('fcm/iris.mat')
c = 3;
metric = @euclidean;
X = iris(1:150, 1:4);
m = 1.5;
Max = 1000;
tol = 1e-3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Data Normalization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[nr nc] = size(X);
for i = 1:nc
for j = 1:nr
data(j, i) = (X(j, i)-st... |
function E = estimateRelativePose_PC5P_Sw(rays1, rays2)
for i = 1:5
AE(i, :) = reshape(rays2(i, :)' * rays1(i, :), 1, []);
end
nulle = null(AE);
[x, y, z] = solver_sw5pt(nulle(:, 1), nulle(:, 2), nulle(:, 3), nulle(:, 4));
E = [];
for i = 1:numel(x)
Evec = nulle * [x(i); y(i); z(i); 1];
E = [E; reshape(E... |
function [R Q]=rq_m_greater_n(A, varargin)
%For now, use this when m>n
% function [R Q]=rq(A)
%
% Perform RQ factorization
% A [m x n]
% returns R [m x n] triangular superior and
% Q [n x n] unitary (i.e., Q'*Q=I)
% such that A = R*Q
%
% Note: Standard RQ requires m<=n.
%
% For n ~=m, default output R has non-zero ele... |
function plot_reg_solutions(x,x_err,b,bn,Q_LS,delta,nopt,name)
figure()
subplot(211)
plot(delta,x_err/norm(x),'.-'), hold on
plot(delta(nopt),x_err(nopt)/norm(x),'r*')
set(gca,'yscale','log','xscale','log')
xlabel('reg. parameter')
ylabel('error in the estimate')
title(name)
axis tight
subplot(212)
plot(... |
clear all
close all
mshfile = '/home/tmattner/Research/Nose_shaping/RunFDIP/semtex094.msh'
wssfile = '/home/tmattner/Research/Nose_shaping/RunFDIP/semtex094.wss'
data = semtex(mshfile)
data.open(wssfile)
data.read
data.close
% Assuming elements are in order!
s0 = 0;
for ielem = 1:size(data.t, 4)
ds = sqrt(diff(... |
function [calcium, DATA_D, song_r, song, align, Motif_ind, BGD, stretch] = FS_PreMotor(roi_ave,TEMPLATE,directed,undirected)
% run on data extracted from base directory, to aligne to the first
% detected song
% 05.26.17
% 09.28.17 % add linear time warping
% WAL3
disp(' Make sure you set the threshold correctly!');... |
function [ K ] = getK( T )
TmeltStart=330;
TmeltEnd=335;
if T>TmeltEnd
K=0.13;
elseif T>TmeltStart
K=-0.018*T+6.16;
else
K=0.22;
end
end
|
classdef myMarble
%MYMARBLE Class representing an individual marble
%--------------------------------------------------------------------------
properties
%Identification number of marble
ID;
%Center of mass of the marble
com;
%2D histogram of ... |
function sim2 = polynomialKernel(x1, x2, sigma, coef, e)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
x1 = x1(:); x2 = x2(:);
sim2 = (sigma*(x1'*x2)+coef).^e;
end
|
%% Question 2b script
%Author - Roshan Pradhan
clear
close all
clc
global plant_dt gamma alpha g l m
%% First generate Poincare map from x
X_0 = [-0.3127; 4.5];
m = 1; l = 1; g = 9.8; alpha = pi/8; gamma = 0.08;
ct =1; plant_dt = 1e-4;
x = X_0; x_prev = [0;0];
% start Newton's method from this x_p
while( norm(x - ... |
% Converts an adjacency graph representation to an adjacency list
% Valid for a general (directed, not simple) network model, but edge
% weights get lost in the conversion.
% INPUT: an adjacency matrix, NxN, N - # of nodes
% OUTPUT: cell structure for adjacency list: x{i_1}=[j_1,j_2 ...]
% GB, October 1, 2009
function... |
Je gebruik de functie dlmwrite() om csv bestanden weg
te schrijven. |
function varargout = fhpkg_cns_type_pf(method, varargin)
% Defines the "pyramid forming" cell type.
% Simplified "si" cell. Do not conduct bicubic interpolation.
% Yunjun Nam.
%***********************************************************************************************************************
[varargout{1 : nargou... |
% function [] = Close(VCS)
% does something coole...
% Johannes Rebling, (johannesrebling@gmail.com), 2019
function [] = Close(VCS)
tic;
VCS.VPrintF('[VCS] Closing connection to stage...');
if ~isempty(VCS.Serial) && strcmp(VCS.Serial.Status,'open')
fclose(VCS.Serial);
delete(VCS.Serial);
VCS.Serial... |
% data file, if empty a dialog box will ask to select a file
sensorDataFile='data 2015 Aug30.mat';
% default folder for open/save data
DataFolder='/home/camilo/5_UBC/Data visualization GUI/Borehole data/';
% default folder were all processing routines are
routinesFolder='/home/camilo/5_UBC/Data visualization GUI/Ruti... |
function [] = kMeansHistogram(data1, k)
%A MATLAB function for step 2(1). The function input is: data1.mat and k.
%The function will generate the histogram plot of the cluster sizes.
% USAGE: kMeansHistogram('Data1.mat', 20) %
load(data1)
a = SeqData(1:1000, :);
idx = kmeans(a, k);
histogram(idx)
end
func... |
%% RBES_Init_params_common.m
function RBES_Init_params_common(varargin)
global params
if isempty(params) || nargin > 0
fprintf('Im in Dropbox\n');
%% Paths for Java classes
params.javaaddpath = cell(1,3);
params.javaaddpath{1} = '.\java\jess.jar';
params.javaaddpath{2} = '.\java\EOLanguage.jar';
... |
function[W_vec, well] = well_construct(P_n, well, grid, fluid)
pressure = P_n(1:2:size(P_n));
R_o = zeros(2*grid.blocknums, 1);
R_g = zeros(2*grid.blocknums, 1);
i = 1;
% loop through all the wells
while i <= size(well,2)
well_blocknum = well(i).blocknum;
T_wo = well(i).WI*(fluid.k_ro(well_blocknum)... |
% Evan Pezent | evanpezent.com | epezent@rice.edu
% 02/11/2016
function [T0N,Ti,T0i] = dh2tf(DH_table)
% =========================================================================
% Accepts an Nx4 matrix with rows of the form [a alpha d theta] which
% correspond to the DH parameters of subsequent frames i=1:N, where:
%... |
function u = a02e04WaveEq( t,x,a,b )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
prompt = 'What is the value of t?';
t = input(prompt);
prompt = 'What is the value of x?';
x = input(prompt);
prompt = 'What is the value of a?';
a = input(prompt);
prompt = 'What is the valu... |
function [Zr,M]=tzircZr(CaO, Na2O, K2O, Al2O3, SiO2, TiO2, FeOT, MgO, MnO, P2O5, T)
% [Zr,M]=tzircZr(CaO, Na2O, K2O, Al2O3, SiO2, TiO2, FeOT, MgO, MnO, P2O5, T)
% Calculate zircon saturation concentration for a given temperature (in C)
%Cation ratio
Na=Na2O/30.9895;
K=K2O/47.0827;
Ca=CaO/56.0774;
Al=Al2O3/50.9806;
Si=... |
%Levent Batakci
%3/19/2021
sigma = eye(3);
sigma(3,3)=0;
p=1000;
theta = RandRange(pi , 0, p);
phi = RandRange(pi, 0, p);
r = 1;
data = r * [cos(theta).*sin(phi) sin(theta).*sin(phi) cos(phi)]'; %Sphere :D
k=100;
N = k^(1/2);
params = defaultParams(k,2);
map = SOM(data, k, params);
hold on
scatter3(data(1,:),data(2,... |
% function which finding number of arc by number of OD nodes
%input:
% 1. Net_data - information about time on each arc. (num_arc, origin, destination, time, flow)
% 2. node_o - number of origin node
% 3. node_d - number of destination node
% Output: number of arc, or -1 in case when there is no such arc
funct... |
function [ri,rc,r]=relative_quantitative_evaluation(ti,Y1,Y2)
mm(1)=min(ti(:));
mm(2)=max(ti(:));
if mm<100
ti=255/diff(mm)*(double(ti)-mm(1));
Y1=255/diff(mm)*(double(Y1)-mm(1));
Y2=255/diff(mm)*(double(Y2)-mm(1));
end
disp('quantifying innovation factor(s) ....')
ci1 = innovation_measure_2d(ti,Y1... |
%% PC_KRIGING: ISHIGAMI FUNCTION
% A basic example illustrating different aspects of PC-Kriging on the
% well-known Ishigami function
%% 1 - INITIALIZE THE UQLAB FRAMEWORK AND CLEAR THE WORKSPACE
clearvars
uqlab
%%
% Keep a constant seed in the random number generator for reproducability
% of the results
rng(1)
%% ... |
%% This is the primary preprocessing step. All the input images are assumed
%% to have prefixes which are listed out in the model_names variable. This
%% script computes how many of each category images exist and what their
%% starting indexes are when the directory contents are listed out.
model_names = {'coasts',... |
load Threshold
T=T*delta; T2=T2*delta; T3=T3*delta;
n0=sum(z)
[gc,lastBit]=Golomb0(z);
lg=length(gc);
pos=0; gc0=gc;
for ia=1:lg-1
pos=pos+gc0(ia);
if gc(ia)>1
lenp=min([gc(ia) gc(ia+1)]);
if lenp>1
if sb(pos)<T(lenp)
%cf0trim=cf0(pos)
%[lenp, sb(pos), T(lenp)]
... |
function [gs_params, varargout] = s4_gs_study(shield_params, varargin)
% function [gs_params, varargout] = s4_gs_study(shield_params, varargin)
% This function calculates the groundhield dimensions a small aperture
% telescope (SAT) for a wide range of input parameters based on the
% Double Diffraction Criteria listed ... |
function [] = show_all(t, seq, frms)
if ~isempty(t)
image(uint8(imresize(mean(t.Vk,4), seq.resize)));
end
num = 0;
for ki = 1:numel(frms)
fr = frms(ki);
for f0 = fr{1}
% if ~isempty(f0.Speed) && f0.Speed < 0.5 && ki > 1 && ~isempty(frms{ki-1})
% ALG.update_frame(frame{i}{ki}, frame{i}{ki-1}, 0.9);
% end
f0.... |
function re=specbottom(mu,delta,alpha)
t=25;
vzm=1;
% vzm=((-alpha^2+2*t*mu)*sqrt(delta^2+mu^2)+sqrt(4*t*mu*alpha^2*(mu^2-delta^2)+(alpha^4+4*t^2*mu^2)*(delta^2+mu^2)))/(4*t*mu);
vzgrid=51;
vzset=linspace(0,vzm,vzgrid);
% vzstep=vzset(2)-vzset(1);
% vzset2=0:vzstep/100:vzm;
en=zeros(1,length(vzset));
for i=1:length(vzs... |
syms x delta s
u1= -x+1/4;
u2= x-3/4;
%% if [0,1/2]
I12=(-x+1/4)*delta;
% if [0,delta]
u22=subs(u2,x,x+1);%move to left
I11a=int(subs(u1,x,x-s),s,0,x)+int(subs(u22,x,x-s),s,x,delta);
G1=2/(delta^2)*(I11a-I12);
% if [delta,1/2]
I11b=int(subs(u1,x,x-s),s,0,delta);
G2=2/(delta^2)*(I11b-I12);
%% if [1/2,1]
I22=(x-3/4... |
function [] = bci_gem_pipeline()
% Demonstrate how to use toggle buttons to mimic tabbed panels.
% Creates a GUI with three toggle buttons which act as tabs. One of the
% tabs is not selectable until the user plots a random quartic by
% pressing the pushbutton at the bottom of the screen. The middle tab
% shows the r... |
function varargout = fgetregexptok(fid, expr, ln)
if (nargin == 2)
ln = '';
end;
if (isempty(ln))
ln = fgetl(fid);
end;
tok = regexp(ln, expr, 'tokens','once');
if (nargout == length(tok)+1)
varargout = [tok ''];
elseif (nargout == length(tok))
varargout = tok;
else
varargout = [cell(1,nargout-1)... |
function [actualPayouts] = dawGenerate(numArms,numTrials)
% Parameters From the Daw paper
decayParameter = 0.9836;
decayCenter = 50;
diffusionNoiseSD = 2.8;
payoutSD = 4;
% Compute mean payouts
meanPayouts = {};
for banditCounter = 1:length(numArms)
%Create NaN array for number of bandits and trials
mean... |
function [freqCh1,vPkPkCh1,highCh1,lowCh1,freqCh2,vPkPkCh2,highCh2,lowCh2,waveFormCh1,waveFormCh2] = initOscopeDatStorStruct(nStor)
freqCh1 = zeros(nStor,1);
highCh1 = zeros(nStor,1);
lowCh1 = zeros(nStor,1);
vPkPkCh1 = zeros(nStor,1);
freqCh2 = zeros(nStor,1);
highCh2 = zeros(nStor,1);
lowCh2 = zeros(nStor,1);
vPkPkCh... |
function [success] = runCvxSetup(varargin)
% DESCRIPTION.
% Biafra Ahanonu
% started: INSERT_DATE
% inputs
%
% outputs
%
% changelog
% 2021.02.01 [15:19:40] - Update `_external_programs` to call ciapkg.getDirExternalPrograms() to standardize call across all functions.
% 2021.08.08 [19:30:20] - Updated ... |
function payoff_cell = caos_cell(ch)
global par;
if (par.pl~=2)
return;
end
payoff_cell = cell(par.types);
payoffs = par.payoffs(1,:);
for a=1:par.types
for b=1:par.types
% types of the players have been assigned (a,b)
% output payoff matrix:
payo... |
function [ border,currI,currJ,direction ] = isThereBorder( i,j,direction,sizeIm,border )
%The function considers the 8 pixels surrounding the current position and
%evaluates whether, for the coordinates of those pixels, there is a border
%of the image. If so, the current position is moved one pixel away from the
%borde... |
function task6()
mkdir('.\task6\out\');
database_path = '.\task6\dataset';
in_path = strcat(pwd, '\task6\in');
max_dif = 10*200^3;
[m,A,eigenfaces,pr_img] = eigenface_core(database_path);
fid = fopen('.\task6\out\task6.txt', 'w');
a = dir([in_path '\*.jpg']);
a = size(a,1);
for i = ... |
function [dataTable, countCut] = FindCutScene(thresh, edges)
% This function intends to detect either in some video there is some cut
% scene or not. if it does, we take only the part before the cut if it
% happened after the middle frame, and the second part if it happened
% before that frame.
% At the end of this fun... |
function [X,sco,conf] = graphmatching(M,group1,group2,E12)
[L12(:,1),L12(:,2)] = find(E12);
Xraw = RRWM(M,group1,group2);
X = zeros(size(E12)); X(find(E12)) = Xraw;
X = discretisationMatching_hungarian(X,E12); X = X(find(E12));
sco = X(:)'*M*X(:);
conf = Xraw;
end |
function [indices,s] = despiker(pfilename , spike_threshold, fastrecflag, showData ,year)
% Usage ... indices = despiker(pfile, spike_threshold, fastrecflag, showData [,year])
%
% search for spikes in the kspace data and replace them by the mean of
% that point in kspace over the time series.
%
% a spike is defined as ... |
function v = bsdvalid(list, dir)
for i = 1 : length(list)
f = [dir list{i} '.bsd'];
v(i) = exist(f);
end;
v = v > 0; |
classdef EMat < handle
%EMAT Embedded Matlab templating
%
% EMat class provides a templating system in Matlab like Ruby's ERB
% system. Matlab code can be embedded inside any text document to
% easily control the document generation flow.
%
% A simple example is illustrated here:
... |
%This bins AUC data found the old way (i.e. with predetermined windows)
%where data.EEG.AUC is 64x#wndwsx150 array (New function combines
%electrodes across conditions and makes this array 7x#wndwsx150, this new
%array should be fed into function lk_binFromRegionsAUC)
function reliability = lk_binFromElectrodesAUC(data... |
clear; close all; clc
%% Load data
load handel
v = y' / 2;
L = length(v);
t = (1:L)';
figure, plot(t / Fs, v);
xlabel('Time [sec]')
ylabel('Amplitude')
title('Signal of Interest, v(n)')
freq_unshift = Fs * (0: (L - 1)) / L;
freq_unshift(((L + 1) / 2 + 1):end) =...
freq_unshift(((L + 1) / 2 + 1... |
function [ImAux] = criaMatrizesAux_comPosicao_dosPixels(coord, Nx, Ny)
%==========================================================================
% Cria as matrizes auxiliares com as posi��es espaciais correspondentes
% aos pixels na nova malha uniforme
%
% IN: coord: structure containing the coordinates of the finite... |
function plotBox(x,Y,varargin)
% Provides customized box plotting, one box at a time.
%
% x is a scalar
% Y is a vector or matrix of data
%
% @ Matt Golub, 2018.
Y = Y(:);
BOX_UPPER_PCTL = 75;
BOX_LOWER_PCTL = 25;
WHISKER_UPPER_PCTL = 95;
WHISKER_LOWER_PCTL = 5;
BOX_WIDTH = 0.8;
FILL_COLOR = 'none';
EDGE_COLOR = '... |
clear all;
global ops
global opt_settings
ops = sdpsettings('solver', 'mosek', 'cachesolvers', 1, 'verbose', 0);
opt_settings.mode = 'sdsos';
opt_settings.max_deg = 4;
system_setting = TransSyst.sparse_set;
encoding_setting = BDDSystem.split_enc;
% max # of synthesis-refinement steps
maxiter = 2500;
% split final ... |
%function CC_compile_transcort2
subjs_dir = '/home/bqrosen/projects/CC/RECON';
filroot = '/space/mdeh7/1/halgdev/projects/bqrosen/CC/out';
subjs = dir(sprintf('%s/CC*',subjs_dir));
subjs = {subjs.name};
fprintf('\n')
alldata = {};
gidx = {};
covthresh = [-.3 0];%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [Result,Model] = Train_grid_search(Filename,Method,TF,Opt,Set,RatiofRS,gamma)
%%
% ========================================================================%
% ! Input the sequence of parameter to search the best combination !
%
% Read Me ================================================================%
% In... |
function [EXalpha EXalphaprime]=GIGmoment(alpha,lambda,chi,psi)
%function computes alpha moment of the GIG(lambda,chi,psi) r.v. and the
%derivative of alpha moment w.r.t. alpha
%USES: derivest.m to get EXalphaprime
if lambda>0
if chi>=0 && psi>0
paramsOK=1;
else
paramsOK=0;
end
elsei... |
function setRanging(nodes, maxNeighbors)
global TESTBED
if nargin<1 | isempty(nodes) | strcmp(nodes, 'all')
nodes=TESTBED.nodeIDs;
end
if nargin<2 | isempty(maxNeighbors)
maxNeighbors = 6;
end
for node=nodes
i= find(TESTBED.nodeIDs==node);
nodeInds = vectorFind(nodes,TESTBED.nodeIDs);
[neighborDists, neigh... |
function results = linearTraining(type, features, labels)
if type
results = struct('NoOfSupportVectors', NaN, 'Metrics', NaN, 'labels', NaN);
else
results = struct('Epsilon', NaN, 'RMSE', NaN,'NoOfSupportVectors', NaN, 'labels', NaN);
end
trainIdx = 1:ceil(height(features)*0.8);
... |
function [M_2,M_3,td,xd] = test_traj
global rpm radi
options = odeset('RelTol',1e-6,'abstol',1e-6);
TSPAN = [0 60];
[p0,v0,a0] = circle(0);
x0 = [p0;v0;a0];
[td,xd] = ode45(@f,TSPAN,x0,options);
plot(td,xd);
M_2 = (rpm*2*pi/60)^2*radi;
M_3 = (rpm*2*pi/60)^3*radi;
end
func... |
function [hf,hl] = plotmROI_phono(T,expName,effects,whichROIs,displayStats,displayIndividuals)
%% Inputs
% Examples:
% T is a data table from T=readtable('resultsfile.csv')
% UID Subject ROI Effect EffectSize
% ___ ___________________________... |
%Load calibration parameters
load('stereparam.mat')
% Image 1 coordinates
% I1 = [[109, 328.62840536059656]; [108, 328.10704067640853]];
I1 = [[111.5963, 393.5897]; [330.5997, 149.0714]];
% Image 2 coordinates
% I2 = [[46, 33.3387896703047]; [46, 33.3387896703047]];
I2 = [[65.8821, 36.3804]; [611.2641, 271.33... |
function [sibhes, v2he, manifold, oriented] = construct_halfedges(nv, elems)
%CONSTRUCT_HALFEDGES constructs an extended half-edge data structure
% for a non-oriented or non-manifold surface mesh.
%
% [sibhes, v2he, manifold, oriented] = construct_halfedges(nv, elems)
%
% At output, it returns sibhes and v2he, along... |
x = [-5:0.1:5];
sigma = 0.5;
mu = 0;
A=0.8;
y = A/sigma*exp(-(x-mu).^2/(2*(sigma^2)));
plot(x,y) |
function [dF] = get_PSTH(deltaF, dFWindow, nStim, stimInds)
pre = dFWindow(1);
post = dFWindow(2);
windowLen = post - pre + 1;
nCells = size(deltaF,2);
dF = zeros(nStim, windowLen, nCells);
% Get the event triggered average for fluorescence
for cellID = 1:nCells
for stimid = 2:nStim
windowBeg = stimInd... |
clear all
close all
clc
expList{1} = '01_01|02_01|03_01|04_01|04_02';
expList{2} = '01_02|03_02';
expList{3} = '02_02';
expList{4} = '02_03';
expList{5} = '03_03';
expList{6} = '04_03'; |
function aligned_psi_source = construct_alignment_psi(temp, psi_source, l_shotgun, m)
% temp: (10, 3): (num_samples, [score, other, offset])
% psi_source: transition prob in markov chain
aligned_psi_source = zeros(m,m,4,4);
% Chain
for i=1:m-1
aligned_psi_source(i,i+1,:,:)=psi_sour... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.