text stringlengths 8 6.12M |
|---|
function result = ifmf(Y_true,idx,Y,R,maxiter,exp_code,metric)
% Implicit Feedback Matrix Factorization (IFMF) model
% coded by Eugene Seo (seoe@oregonstate.edu)
[nPolls,nPlants] = size(Y);
lambda = 1;
alpha = 1;
W = 1 + alpha * Y; % confidence
U = rand(nPolls,R);
V = rand(R, nPlants);
for it=1:maxiter
... |
%% FIR OPTIMO
clc
%M = 60;
fpmin = 0.6e6;
fsmin = 1.8e6;
% Especificaciones de frecuencia.
fp_factor = fpmin/data.dst.fs;
if (data.dst.fs*fp_factor > fpmin )
fp=data.dst.fs*fp_factor; % Frecuencia de paso
else
fp=fpmin; % Frecuencia de paso
end
fs_factor = (fsmin-fp)/data.dst.fs;
fs=fp+data.dst.fs*fs_facto... |
lP = 90 * 90;
loa = 91 * 91;
lx = 1;
ly = 1;
nx = 90;
ny = 90;
x = linspace(0,lx,nx+1); hx = lx/nx;
y = linspace(0,ly,ny+1); hy = ly/ny;
load('../Q.dat')
load('../P.dat')
load('../Q_True.dat')
load('../P_True.dat')
%If you replace this next line you can see that this is ploting properly
%NavierStokes = NavierStokesTru... |
function [PSI] = STREAMFUNCTION(imax,jmax,dx,dy,U,V)
% Description:
%
% This function solves for the stream function using the V velocity. The
% streamfunction is defined as follows:
%
% u = d(psi)/dy
% v = -d(psi)/dx
%
% psi is defined here at the top-right corner of a grid cell (whereas
% pressure is defined ... |
function object=updateFFT(object)
% compare transform to boxcar transform
dt=object.SampleInterval;
t=0:dt:object.Measurement.Partition.Duration;
s=ones(size(t));
temp=SMASH.SignalAnalysis.Signal(t,s);
[f,P]=fft(temp,...
'RemoveDC',false,...
'FrequencyDomain','full',...
'SpectrumType','power',...
'Wi... |
function gab_print_changed_hash(job)
tasks=[job.task{:}];
funcHashes=[tasks.funcHashes];
first=true;
for f=1:length(funcHashes)
[~,outp]=unix(['md5sum ' which(funcHashes(f).funcName)]);
x=textscan(outp,'%s%s');
if ~strcmp(x{1}{1},funcHashes(f).md5) %if they don't match
if first
first=f... |
function Kx = funTVGrad(x, lambda, bPBC)
% The finite difference operator: Kx = lambda * grad(x)
[nRow, nCol] = size(x);
Kx = zeros(nRow, nCol, 2);
if bPBC
% Periodic boundary condition
Kx(:, :, 1) = diff([x; x(1, :)], 1, 1);
Kx(:, :, 2) = diff([x, x(:, 1)], 1, 2);
Kx... |
function c = PD(Kp_phi, Kd_phi, Kp_theta, Kd_theta, Kp_psi, Kd_psi, Kp_x, Kd_x, Kp_y, Kd_y, Kp_z, Kd_z)
% Use manually tuned parameters, unless arguments provide the parameters.
if nargin == 0
Kp_phi = 5;
Kd_phi = 4;
Kp_theta = 5;
Kd_theta = 4;
... |
A = csvread('../data/adj.csv');
results = [];
repeat = 1;
% run peeling
cd ../peeling
disp('Now running nbr peeling algorithm')
minq = 1;
total_n = 0;
for i = 1:repeat
[l,q,n,t] = nbr_peeling(A,50);
total_n = total_n + n;
if q < minq
minq = q;
worst_l = l;
time = t;
end
end
avg_n = total_n/repeat;
results =... |
function out = mat2clip(a, delim)
%MAT2CLIP Copies matrix to system clipboard.
%
% MAT2CLIP(A) copies the contents of 2-D matrix A to the system clipboard.
% A can be a numeric array (floats, integers, logicals), character array,
% or a cell array. The cell array can have mixture of data types.
%
% Each element of the... |
function [y]=fun(k,x)
A_1=k(1);
t2_1=k(2);
A_2=k(3);
t2_2=k(4);
A_3=k(5);
t2_3=k(6);
y= (A_1)*(exp(-x./t2_1)) + (A_2).*(exp(-x./t2_2)) + (A_3).*(exp(-x./t2_3)); |
conf.NREPETS = 1;
conf.parallelize = 1;
% conf.data.path='data/EAM/data_58_BIP.mat';
conf.data.path='data/EAM/'; % if folder, load all .mat
conf.data.colorpath='data/EAM/colormaps/ColCarto.mat';
% Parameters defining algorithms and theirs free parameters
conf.machine.algs={@LI,@TPS,@SVR};
conf.machine.params_name={'i... |
% MJLT1MSC.M
% T1 time in ms
% Called by mjljm
% First check replot ****************************
if mjlreplv == 1 ; % Re-Plot turned on; turn off
set(mjluirepl,'Visible','off') ;
set(mjlreplb,'Visible','off') ;
mjlreplv = 0 ;
end ;
% Do calcs ***************************************
mjlt1sstr = get(mjluit1ms, 'S... |
function [varhigh, varlow] = highpassBinAvg(t, x, binlen, tbin)
% [varhigh, varlow] = HIGHPASSBINAVG(t, x, binlen, tbin)
%
% inputs
% - t:
% - x:
% - binlen:
% - tbin (optional): but it is often recommended/required.
%
% outputs
% - varhigh:
% - varlow:
%
%
% Olavo Badaro Marqu... |
function H = hulk(h)
H(1,:) = h;
H(2,:) = h.*h;
H(3,:) = h.*h.*h; |
function [xf, iter1, iter2, flag] = misimplex(A, c, b)
% Resuelve por el metodo Simplex el problema estándar
% Min c'*x
% Sujeto a A*x = b
% x >= 0
[m, n] = size(A); % dimensiones de A
xf = [];
iter = 0; %Declara el número de iteraciónes en 0
% FASE 1
[xs... |
function [ ] = gen_results_for( results, method, dataset )
labels = [];
keys_all = [];
vals_all = [];
train_all = [];
c = 0;
for I = 1:size(results,1)
el = results(I,:);
if strcmp(el.Method, method) && strcmp(el.Dataset, dataset)
c = c + 1;
pars_str = el.Parameters{1};
pa... |
%%
% CellShapeAnalysis.
% Copyright (C) 2020 J. Stegmaier
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicabl... |
function [maxDiff, meanDiff] = labinator(XYZinput, ref)
loopSize = size(XYZinput, 2);
refValues = zeros(3, loopSize);
labValues = zeros(3, loopSize);
for i = 1:loopSize
[L, a, b] = xyz2lab(XYZinput(1,i), XYZinput(2,i), XYZinput(3,i));
labValues(1, i) = L;
labValues(2, i) = a;
labValues(3, i) = b;
end
... |
function [meta] = reshape_tracks(tracks, annot, varargin)
% Aligns track data to annotations
%
% Arguments:
% tracks - a cell array, cell per chr, with a matrix of Txlen(chr), where
% T is the number of tracks in data (chrM=tracks{17}).
% annot - a struct with 3 fields:
% chr - annotation chromos... |
% hmwk12.m
%
% Author: Jerome Anaeki
% Account: janaeki1
% CSc 4630 Homework #12
% Due Date: 11/13/18
%
% Description:
% This program imports a data file with different coin information,
% calculates the total value of the coins, displays the computed value, and
% saves it as a new version of the data file.
... |
function [bool]=verificacionArcillaDOLSIL(x,y)
[x1 y1 x2 y2 x3 y3]=cteArcillaDOLSIL;
bool=triangulo(x1,y1,x2,y2,x3,y3,x,y);
end
|
function [ error ] = classificationError( Y , Ypred )
%classificationError Summary of this function goes here
% Detailed explanation goes here
t = size(Y,2);
n = size(Y,1);
% Compute test set accuracy
if t>2
C = transpose(bsxfun(@eq, Y', Ypred'));
D = sum(C,2);
E = D == t;
... |
function save2database(s,fs,centroid,speaker_id,row,name)
load("database.dat","-mat");
% row = 2;
% speaker_id = 2;
% centroid =16;
% name = 'someone';
i = row;
id = speaker_id;
k = centroid*2;
s(s==0)=[];
mfcc = mymfcc(s,fs);
code = vqlbg(mfcc, k,2);
data_save{i,1} = code;
data_save{i,2} = speaker_id;
data_... |
% before code start, unzip to raw_data, drive linkinde bulabilirsin
%% Load data
clear all;
clc;
load('D:\GoogleDrive\WPT-Testler\27.10.2020\raw_data.mat');
%% envelope creation
len1=length(is1); % is1 and is4 same length and time vector
x1=1:len1/1000:len1; % it determines the how much data points are used fo... |
function wei = single_beam(Ron, Roff, Nbins, good_idx, bad_freqs)
w = zeros(length(good_idx), Nbins);
Nbin_Act = 500;
Nele_Act = 64;
wei = zeros(Nele_Act, Nbin_Act);
for b = 1:size(Ron,3)
bad_flag = sum(bad_freqs == b);
if bad_flag
w(:,b) = zeros(length(good_idx), 1);
... |
function m=forkin(h)
l1=1;l2=1;
for i=1:size(h,2)
x(i)=l1*cos(h(1,i))+l2*cos(h(1,i)+h(2,i));
y(i)=l1*sin(h(1,i))+l2*sin(h(1,i)+h(2,i));
end
m=[x;y];
|
function [b,c] = frq2bark(f,m)
%FRQ2BARK Convert Hertz to BARK frequency scale BARK=(FRQ)
% bark = frq2bark(frq) converts a vector of frequencies (in Hz)
% to the corresponding values on the BARK scale.
% Inputs: f matrix of frequencies in Hz
% m mode options
% 'h' use high fre... |
function ip=a_init_mesh
ip(1).aliases={'method' 'meth'};
ip(1).units='';
ip(1).full_name='Mesh generation method';
ip(1).type='string';
ip(1).n=[1 1;1 1];
ip(1).range=[];
ip(1).values={'uniform' 'auto' 'Adebug'};
ip(1).default={'auto'};
ip(2).aliases={'nx' 'nodes' 'maxnodes' 'nmax'};
ip(2).units=' ';
ip(2).full_name=... |
classdef plotBrowserVisibleState < plotBrowserState
%PLOTBROWSERVISIBLESTATE State class for the plotBrowser.
%For hiding objects by setting their visibility.
%
%SEE ALSO: plotBrowser
properties
end
methods
function s = plotBrowserVisibleState(p)
s@plotBro... |
% Solution analytique de l'equation d'advection-diffusion.
%
% * x point d'espace ou evaluer la solution
% * t point de temps ou evaluer la solution
% * m_end nombre d'elements de la serie de la solution qui seront pris
% en compte
% * a,b,D constantes de l'equation: D u_xx - a u_x - b u = u_t
% * l: frontiere du d... |
function [MeanTDvox, MeanFDvox, Header_Out] = y_VoxelSpecificHeadMotion(RealignmentParameterFile,ReferenceImage,OutputDir,GZFlag)
%function [MeanTDvox, MeanFDvox, Header_Out] = y_VoxelSpecificHeadMotion(RealignmentParameterFile,ReferenceImage,OutputDir,GZFlag)
% Generate the voxel specific head motion
% Input:
% Reali... |
function matrix = sparse2matrix(cellvec)
n = size(cellvec);
matrix = ones(cellvec{1,1}(1,1),cellvec{1,1}(1,2))*cellvec{1,2};
for i=3:n(2)
matrix(cellvec{1,i}(1,1),cellvec{1,i}(1,2)) = cellvec{1,i}(1,3);
end
|
load('yeastData310.mat') % 'X', 'genes', 'times');
figure;imagesc(X);colormap(redgreencmap)
xlabel('time')
set(gca,'xticklabel',times)
ylabel('genes')
title('yeast microarray data')
colorbar
if doPrintPmtk, pdfcrop; printPmtkFigures('yeastHeatMap'); end;
%figure; plot(X'); set(gca,'xticklabel',times);
fi... |
%script to e get AUC scores for classifier
close all
%clear;
ID = 2:19;
N = length(ID);
loc = '../libdai/examples/data/resultChandola/';
auc = [];
for i=1:N
file = strcat(loc, 'stideScores', num2str(ID(i)));
auc = [auc getScores(file)];
end
|
function gaze_vec = image2linGaze(img,x,y,gaze)
% Convert a image in a gaze vector as in the training protocol, where the
% center of the gaze is given by (x,y)
% image can be both greyscale or RGB
% gaze is a struct that defines the retina. For example:
% gaze.highR.ptc_dim = 8;
% gaze.highR.px = 1; % pixel f... |
function [r]=rate(w,TDM,E2,T)
hr=1.e-9;
hphi=pi/18;
R=2.4e-8:hr:4.e-8;
a=A(w,TDM);
bexp=boltzman(E2,T);
[m,n]=size(TDM);
S=zeros(m,n);
for i=1:m
for j=1:n
S(i,j)=4*pi*a(i,j)*bexp(i,j)*(R(i).^2);
end
end
k=0;
for i=1:m-1
for j... |
plot(final_alpha1(:,1),final_alpha1(:,2),final_alpha2(:,1),final_alpha2(:,2),final_alpha3(:,1),final_alpha3(:,2))
hold on;
figure;
plot(final_theta1(:,1),final_theta1(:,2),final_theta2(:,1),final_theta2(:,2),final_theta3(:,1),final_theta3(:,2),ref_case(:,1),ref_case(:,2)) |
function out = sort3(a,b,c)
if a >= b
if b >= c
out = [c,b,a];
elseif b <= c && a >=c
out = [b,c,a];
else
out = [b,a,c];
end
elseif a <= b
if b >= c && a <= c
out = [a,c,b];
elseif b <= c
out = [a,b,c];
else
out = [c,a,b];
end
end |
clc;
close all;
clear all;
%--------FILTERING--------
img = imread('C:\Third Year Semester 1\Digital Image Processing\Project\Images\pimple.jpg');
mask = imread('C:\Third Year Semester 1\Digital Image Processing\Project\Images\pimplemask.png');
originalRegion = imread('C:\Third Year Semester 1\Digital Image Pro... |
classdef Rotation
properties
Quat = quaternion([0 0 0 0]);%w,x,y,z
Vecbot= zeros(1,3);
VecTar= zeros(1,3);
AnVel = 0;
ThetainRad;
ti= 0;
posiRot = 0;
end
methods
function self = Rotation(quat,veta,anvel)
self.Quat = quat;
... |
function [cfg, Naris] = Naris_gamma_count()
%%Naris_gamma_detect : detects all the gamma events within a file and
% returns a trialified structure of all the events required for
% Naris_gamma_stats which gives all the detected gamma events.
%
%% set up defualts:
cfg.fname = mkfile;
[cfg] = Naris_cfgs(cfg);
if strcmp(... |
function image_out = image_flipud(image_in)
% flit the image from left to right
image_out = zeros(size(image_in));
for idx_dim = 1:size(image_in, 3)
image_out(:, :, idx_dim) = flipud(image_in(:, :, idx_dim));
end |
classdef event_selector < physioset.event.selector
% EVENT_SELECTOR - Selects TEMP events
properties
StimType = 'TEMP'; % Type of the temperature event
end
methods
function [evArray, idx] = select(obj, evArray)
[stimEv, stimIdx] = select(evArray, 'Typ... |
% Start with a clean slate.
close all;
clearvars;
%% Initialization
% How many time steps to generate?
T = 1000;
% How many dimensions?
dim = 10; %dimension of data
% Specify the hazard function:
lambda = 200;
min_len = 0;
hazard_func = @(r) constant_hazard(r, lambda);
% Specify prior:
mu0 = zero... |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script is to perform the defect detection on ham images
%
% Reference:
% xxxxx
%
% Matlab version was written and was tested on Matlab 2020a
% If you have any problem, please feel free to contact Sze Te... |
function [P]=tesSmooth_HC(TES,V,IND_V,cPar)
%% CONTROL PARAMETERS
if isfield(cPar,'Alpha')
alp=cPar.Alpha;
else
alp=0.1; %DEFAULT
end
if isfield(cPar,'Beta')
bet=cPar.Beta;
else
bet=0.5; %DEFAULT
end
if isfield(cPar,'n')
nMax=cPar.n;
else
nMax=1; %DEFAULT
end
if isfiel... |
function [delXO, delYO] = ObsDelta(vx, vy, ox, oy, obsRad, obsS, beta)
% This function gives delX, delY of repulsion caused by the obstacle
inf = 10;
dObs = sqrt((ox-vx)^2 + (oy-vy)^2); % distance bw goal and current position
thetaO = atan2((oy-vy),(ox-vx)); % angle between goal and current position
% delXO = 0; d... |
function scrubPath(excludes)
a=path;
b=textscan(a,'%s','delimiter',':');
b=b{1};
keepers = true(size(b));
if ischar(excludes), excludes = {excludes}; end
for i = 1:numel(excludes)
keepers = keepers & cellfun(@isempty,strfind(b, excludes{i}));
end
b = setdiff(b, b(keepers));... |
function [criterion, ms, significant, m1, m2,oracle, labels ] = knnIR(trainX,trainY,testX,testY,k,Exp)
%KNNIR Summary of this function goes here
% Detailed explanation goes here
%k=9;
[Z,mu,sigma] = zscore(trainX);
testX = (testX-mu) ./ sigma;
trainX = normalize(trainX);
[m,n]=size(testX);
[numberOfTrainSample,n]=si... |
classdef Wall < handle
%
%
% ---------------------------------------------------------------------
properties
%
% angle on the horizontal plane between the geographical north and the wall's normal
fAzimuthInDegrees;
%
% angle on the vertical plane between the normal of the ground and the wall's normal
... |
function plotverts(verts_2v,varargin)
xy = wraparound(verts_2v);
plot(xy(1,:),xy(2,:),varargin{:})
end
function y = wraparound(x)
y = [x, x(:,1)];
end
|
function [] = pause()
%--------------------------------------------------------------------------
%
% Copyright (c) 2013 Jeffrey Byrne
% $Id: preprocess.m 176 2013-08-12 15:44:02Z jebyrne $
%
%--------------------------------------------------------------------------
fprintf('[nsd.util.pause]: press any key to continu... |
t=zeros(6,1);
dt=0.15;
for i=1:6
t(i) = dt* i;
end
X=[t exp(t) t.^3 sin(t)];
z= [1.2 0.6 1.6 0.9]';
y=X*z;
dy=10^(-2)*[-1 1 1 -0.5 -2 1]';
py=y+dy;
pz=X\py;
plot(z);
hold on;
plot(pz);
hold off;
title('zeta and p_zeta');
[U,S,V]=svd(X);
%[U2,S2,V2]=svd(A2);
tS=S';
r=rank(tS);
for i=1:r
tS(i,i) = 1/S(i,i); ... |
function [pi_0,vol_disc] = niak_build_pi_0(pce_mat,part,method,q,ttest_mat)
% Estimate the proportion of null hypothesis pi_0 in a connectome
%
% PI_0 = NIAK_BUILD_PI_0( PCE , PART , [METHOD] , [Q] , [TTEST] )
%
% PCE (array NxL) each row is a vectorized matrix of per-comparison errors (aka uncorrected p-values)
% o... |
function [ test_err, train_err ] = computeModelErrors( trainModel, params, train_X, train_T, test_X, test_T )
[Out, model, train_err] = evalc('trainModel(train_X, train_T, params)');
[Out, test_Y] = evalc('model.predict(test_X)');
test_err = (1/length(test_T))*sum((test_Y - test_T).^2);
end
|
j = 1;
while(j <= 3)
a = -2;
b = 2;
fa = cos(a)+cosh(a)-j;
fb = cos(b)+cosh(b)-j;
while (b-a) > 10.^-10
c = (a+b)/2;
fc = cos(c)+cosh(c)-j;
if(fc == 0)
a=c;
b=c;
break;
elseif(fb*fc>0)
b=c;
fb=fc;
els... |
function Qcurr = epu_skew_ff_ffgettbl(Sector, gap, shift)
% function Qcurr = epu_skew_ff_ffgettbl(Sector, gap, shift)
%
% 10 Hz skew feedforward for EPUs in sector 4+11
% Christoph Steier, 2004-08-10
% Changed to a function to call from feedforward table generation routines
% T. Scarvie, 2005-02-03
% function Qcurr = ... |
function mflintps = mflint(ui1,ui2,ui3,ui4)
% Whether to interpolate
global mpgdtmu mfldtmu mfluidw mflnpts mflemtxt ...
mmgifact mmgdwelr mfluisb
% Check to see if b1 selected ****************
if get(mfluisb(1),'Value') == 1 ;
val1 = get(ui1,'Value') ;
if val1 == 1 ;
if get(ui4(1),'Value') == 0 ;
set(mflemtxt,... |
function [res, Dres] = ProfileSSE(pars, times, data, coefs, allpars, ...
lik, proc, active, ...
in_method, options_in, dcdp, oldpars)
if nargin < 12, oldpars = []; end
if nargin < 11, dcdp = []; end
if nargin ... |
function [retval] = graficar(x0,y0,y1, tipo_aproximacion)
hold on
plot(x0, y1)
scatter(x0,y0);
xlabel("x");
ylabel("p(x)");
tipo_aproximacion = strcat("Aproximacion ",tipo_aproximacion);
title (tipo_aproximacion);
hold off
endfunction |
function x = hooke_exact_solution(n, k, dist, H, step, T, x0, v0)
q0 = x0 - [0:n-1]'*dist;
q0_dx = v0;
% eigenvalues in matrix except the first
E_VAL = 2*(1-cos([1:n-1]*pi/n)).*ones(n,n-1);
% eigenvectors except the first
E_VEC = cos([1:n-1].*pi/n.*([1:n]'-0.5));
A = [E_VEC zeros(n,n-1);... |
function [ y ] = khz_func1( A, arguments, param )
%KHZ_FUNC1 Summary of this function goes here
% Detailed explanation goes here
P1 = [arguments.prevApex; 0; arguments.prevZeta];
P2 = [A; 0; arguments.zeta];
d1 = P1 - P2;
n1 = [-d1(3); 0; d1(1)]; % [x; y; z]
n1 = n1 ./ norm(n1);
... |
%Torres Aguilar Ishmael Benjamin Asignacion Especial MN 2021.
%Soluciona La ecuacion diferencial y' =(t+2t**3)y**3-ty usando el metodo de
%Heun y RK cuarto orden.
f = inline('(t+2*t^3)*y^3-t*y','t','y');
x = 0:0.1:2;
h = 0.1;
l = size(x);
l = l(2);
yH = zeros(1,l); %%yH - y para Heun
yH(1) = 1/3;
yK = zeros(1,l);
yK(1... |
classdef CocoStuffEval < handle
% Internal functions for evaluating stuff segmentations against a ground-truth.
%
% The usage for COCOStuffeval is as follows:
% cocoGt=..., cocoRes=... % load dataset and results
% E = CocoStuffEval(cocoGt, cocoRes);% initialize CocoStuffEval object
... |
% 两人赌博
clear
money = [5 10]; % 初始资金
win = [0.5 0.5]; % 赢的概率
num = 50; %计算场数
remain = zeros(sum(money),num);remain(money(1),1) = 1;
x = 1:num;
y1 = zeros(1,num);
y2 = zeros(1,num);
for i = 2:num
for j = 1:size(remain,1)-1
if j == 1
remain(j,i) = remain(j+1,i-1)*win(2);
elseif j == size(... |
function drawarrow(x1,x2,y1,y2,len)
%DRAWARROW connecting two points with a line with arrowhead
% drawarrow(x1,x2,y1,y2,len) draw an arrowed line from (x1,y1) to (x2,y2),and len is the length of the arrow side.
% (x1,y1)-->(x2,y2)
cita=pi/12; % default angle between the two sides of arrow is 30
cos_cita=cos(cita... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Script: CompruebaNorma %%%%
%%%% %%%%
%%%% Script en el que se comprueba que la matriz de canal %%%%
%%%% ... |
%This models a charged particle in a magnetic mirror/magnetic dipole. For
%it to work properly, the initial magnetid field at the starting location
%of the particle must be 1. This may be seen if the user uncomments the if
%statement in the time loop. Changes to the initial position will likely
%change the parameters ... |
%*******************************************************************************
%* Program: rsolver_mhd_fd.m
%* Description: Computes MHD Riemann states from initial left/right
%* states. Approximates the Jacobian with finite differences.
%* Author: Andrew Kercher
%* References:
%* [1] Dai, W. ... |
function fname = testResponseFilename(runParams, testLMScontrast, opticsPostFix, PolansSubjectID)
fname = sprintf('L_%2.2f_M_%2.2f_S_%2.2fResponses_%2.0f_%2.0f_%2.0f_%2.0f_microns_coneSpecificity_%2.0f_PolansSID_%d_%s.mat', ...
testLMScontrast(1), testLMScontrast(2), testLMScontrast(3), ...
... |
function dy = bolzmeq2(ct, y, k, om, omb, omt, h)
% function for the bolzman equations, Einstein equations and evolution of the inverse: the integration variable is
% the conformal time ct in Mpc.
% input: ct, conformal time, y, variables to be solved see below, k see below, om resp omb, matter resp
% baryoncont... |
function ind = GOind(dataLength, GOstruct, GOterm)
%GOIND get a logical vector for a go term
% given the length of the data structure "dataLength", that was used to
% construct the GOstruct, the GOsturct and the query go term, a logical
% vector the length of data is returned marked with True in each index of... |
function result = V1(time)
%V1
%Inputs:
%time: The vector which contains the time-points of the simulation.
%
%return:
%result: The given function * here 2sin(t) * evaluates at the
% time-points, specified at vector time
%
result = 2 * sin(time); |
function F_KI=rekursi(file,n_class,n_stor,r_tar)
%rekursi adalah fungsi untuk melakukan proses rekursi
%untuk menentukan nilai l untuk setiap f_ki pada suatu tahap t
%apabila k,l adalah kelas tampungan dengan jumlah kelas a
%apabila i,j adalah kelas inflow dengan jumlah kelas c
%b_kl adalah matriks tiga dimensi be... |
function [ B ] = calc_incidence_matrix( obj )
% CALC_INCIDENCE_MATRIX calculates the incidence matrix of the network.
% assert( ~obj.directed ); % (this impl.) only works for undirected networks
B = sparse( obj.N, obj.M ); % rows: vertices, columns: edges
% non-zero elements
[r,c]=find(obj.graph.adjacency);
% fin... |
function [ pq2, key, cost ] = priorityMinPop( pq )
%PRIORITYMINPOP Pops the minimum cost entry out of pq and returns the key
%and cost of that entry, along with the remainder of pq.
% pq must be a priority queue
if length(pq) == 0
key = [];
cost = [];
pq2 = priorityPrepare()
elseif length(pq) == 1
ke... |
%% Deleteing_superfluous_of_HMM
%% real data
% load Truth_route_EdgeID.txt;
% load Network_Topology.txt;
% unique_Truth_route_EdgeID = unique(Truth_route_EdgeID(:,1));
% mark_Edge_ID = ismember(Network_Topology(:,2),unique_Truth_route_EdgeID');
% LineID_of_GroundEdge = Network_Topology(mark_Edge_ID,1)';
% size... |
function bounds = getNeuronBounds(neuron)
bounds = zeros(3, 2);
xyz = neuron.getCellXYZ();
for i = 1:3
[bounds(i, 1), ind] = min(xyz(:, i));
bounds(i, 1) = bounds(i, 1) - neuron.nodes.Rum(ind);
[bounds(i, 2), ind] = max(xyz(:, i));
bounds(i, 2) = bounds(i, 2) + neuron.node... |
%%% Producing Figures 5.8, 5.9 and 5.10 in the thesis, Chapter 5
%%% Uses Model_tick_host_wInf
%%% Model simulations for the tick-host model with specific host density
%%% depedence and infection
%%% Produces 3 figures, one for the prevalence of ticks and hosts, one for
%%% the density of infected ticks and on... |
function isInstalled = verifyMechanize
%VERIFYMECHANIZE Check if the perl module WWW::Mechanize is installed
% If installed, return true. If not installed, return false.
perlCommand = 'perl -e "use WWW::Mechanize"';
[~, output] = system(perlCommand);
%isInstalled = status;
%disp(output);
lenOut... |
function model = check_model_repres(model,repr,mode,recomp)
%CHECK_MODEL_REPRES Check model and representation
% [{MODEL}] = EPT.CHECK_MODEL_REPRES(MODEL,REPR,MODE,{RECOMP=0})
% Checks whether model MODEL and representation REPR are
% consistent. These structs depend on the mode MODE.
%
% If there is a return argum... |
f = @(x)5*x^4-2.7*x^4-2*x+0.5;
xl = 0.1;
xr = 0.5;
fxl = f(xl);
fxr = f(xr);
if fxl * fxr > 0
printf("Root is not in range %f %f\n\n",xl,xr);
return;
endif
oldxm = 0;
cnt = 0;
es = 0.00001;
while 1
cnt = cnt + 1;
xm = (xl + xr) / 2;
fxm = f(xm);
if fxm == 0
printf("Root is at %f and after %d iteration\... |
function value = g ( u )
%*****************************************************************************80
%
%% G evaluates the outward normal values assigned at Neumann boundary conditions.
%
% Discussion:
%
% This routine must be changed by the user to reflect a particular problem.
%
% Modified:
%
% 25 Februa... |
% Función que busca el valor de 'k' correspondiente a un tiempo t dado por
% parametro.
%
% obtenerValorK(t)
%
% PRE-CONDICIONES
% t: es el tiempo en segundos.
%
% POST-CONDICIONES
% Se devuelve una matriz de dimension 1x2, donde en la primer columna se
% encuentra el valor t al cual corresponde el k(t... |
%演示四个控制点的B样条曲线生成
%四个控制点C=[C1 C2 C3 C4]
C=[0 1 2 3 %控制点X方向坐标
0 1 1 0]; %控制点Y方向坐标
%参数s为归一化位移0≤s≤1
s=0:0.01:1;
%
f1s=(1-s).^3/6;
f2s=(3*s.^3-6*s.^2+4)/6;
f3s=(-3*s.^3+3*s.^2+3*s+1)/6;
f4s=s.^3/6;
%
Ps=C(:,1)*f1s+C(:,2)*f2s+C(:,3)*f3s+C(:,4)*f4s;
%绘制控制点及B样条曲线
figure(1)
plot(C(1,:),C(2,:),'r*',Ps(1,:),Ps(2,:),'b');... |
% Please enter the options as asked. This requires the MIT-OCL and Yale
% database of images. However for testing, a custom database of 9 images
% named from c1.jpg to c9.jpg can be used to test this code. Please update
% the path in line 154 after adding the code. After that run the code and
% provide the options as d... |
function [xS,yS] = IFMScale(IFM, actuatorSeparation, orientation)
% IFMScale Copute the scale of IFM
%
% The scale in mm/pix assuming 2.5mm between
% consecutive actuators.
%
% IFM: Input matrix of Influence Function (nActuator,nSubAperture,nSubAperture)
%
% [xS,yS]: [meter/pixel] output scale ... |
%% CIC Filter
M=1; % Differential delay
Q=12; % Number of stages
RM = M*R;
gcic = (RM)^Q/R;
Dd = (RM-1)/2+1;
D = ceil(Q*Dd);
B = zeros(1, RM+1);
B(1) = 1;
B(RM+1) = -1;
A = [ 1 -1 ];
% BQ = B;
% AQ = A;
% if Q > 1
% for i=2:Q
% BQ = conv(BQ, B);
% AQ = conv(AQ, A);
% end
% end
% hcic ... |
% BROWSE TO processed_data dir created by processData.m
source_dir = uigetdir([]);
gestures = ["ABOUT","AND","CAN","COP","DEAF","DECIDE","FATHER","FIND","GOOUT","HEARING"];
feature_indices = [4,5,6,7,8,9,10,11];
for g_index = 1:length(gestures)
concatGesture = [];
gesture = gestures(g_index);
T = readtable(... |
function nh4pixels = get4nhpixels(blob,sizeR,sizeC)
% blob is a list of pixelInds
% nh4 is the list of all 4neighborhood pixels in blob
% blob can also contain multiple blobs. Then the method returns all
% 4nhpixels for all the blobs
% contains only the pixels between the original image boundaries
[r,c] = ind2sub([si... |
%% Synaptic Resources
figure
plot(1:runTime, nn(2).SynRes, 'linewidth', 2)
set(gca, 'fontsize', 20, 'box', 'off')
ylabel('iORN SynRes, [0, 1]')
axis tight
%% Rel
figure
plot(networkRelease(2,:), 'linewidth', 2)
set(gca, 'fontsize', 20, 'box', 'off')
ylabel('iORN Rel, FR(t) * SynRes(t) / inhibition(t)')
axis tight
%%
fi... |
% MJLFSLDC.M
% To read slider
% for plot expansion factor
% Called by mjljm
mjlfsldv = get(mjluifsld,'Value');
mjlfsldvs = num2str(mjlfsldv,4) ;
set(mjlfsldstr, 'String', mjlfsldvs) ; |
classdef UserRelation < dj.Relvar & dj.internal.Master
methods
function self = UserRelation(varargin)
self@dj.Relvar(varargin{:})
end
end
end
|
% 0 to 5 sec.
time_to_five = linspace(1, 5, 1800);
signal_to_five = val(1:(5*360)) / 200;
figure, subplot(2, 1, 1), plot(time_to_five, signal_to_five);
indices_to_five = findT(signal_to_five);
hold on, plot(time_to_five(indices_to_five), signal_to_five(indices_to_five), 'rx');
xlabel('time (s)');
ylabel('mV');
% 20 to... |
function mat_from_text(txtFile, resDirName, delim)
txt = fileread(txtFile);
mkdir(resDirName);
txt_sections = split(txt, delim);
for i=1:length(txt_sections)-1
files = split(txt_sections{i+1}, flip(delim));
fileName = files{1};
disp(fileName);
fileData = files{2};
id = fopen(['... |
x=sin([1:200]);
[x1,e1]=prex(x);
function [xnew,e]=prex(x)
%自相关拟合;输入x序列,输出新序列xnew及拟合误差
lag=3; %延迟
n=length(x);
xnew=zeros(1,n);
xnew(1,1:lag)=x(1,1:lag);
for i=lag+1:n
a=aryule(x(i-lag:i),lag);
xnew(i)=-a(2:end)*x(i-1:-1:i-lag)';
end
e=abs(x-xnew);
end
|
function [output,reglas_activadas] = inferencia(x1,x2)
%% valores difusos
ng = [-1.0 -1.0 -0.7 -0.55];
nm = [-0.7 -0.5 -0.4 -0.2];
np = [-0.4 -0.3 -0.2 -0.1];
ni = [-0.2 -0.1 0.0 0.0];
ce = [-0.25 0 0 0.25];
pi = [0.0 0.0 0.1 0.2];
pp = [0.1 0.2 0.3 0.4];
pm = [0.2 0.4 0.5 0.7];
pg = [0.55 0.7 1.0 1.0];
%% de_a's
ng_n... |
function [poolNo, CellSpotTot, noSpots, concentration, area, volume]=CopyNumberRodCell3(imageData, segmentation, BGav, SpotsCh1,psf, Isingle,params)
if nargin<7
params.spotAvoid=0;
params.showOutput=1;
params.inner_circle_radius=5;
params.method=1;
end
[cellCoord(:,2), cellCoord(:,1)]=find(seg... |
function d = getTriplicate(gate)
d1 = xlsread('sigResults.xlsx', [gate, 'R1']);
d2 = xlsread('sigResults.xlsx', [gate, 'R2']);
d3 = xlsread('sigResults.xlsx', [gate, 'R3']);
d = [d1;d2;d3]; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.