text stringlengths 8 6.12M |
|---|
classdef MockSession < handle & mlraichle.Session
%% MOCKSESSION
% $Revision$
% was created 18-Oct-2018 18:16:12 by jjlee,
% last modified $LastChangedDate$ and placed into repository /Users/jjlee/MATLAB-Drive/mlraichle/src/+mlraichle.
%% It was developed on Matlab 9.4.0.813654 (R2018a) for MACI64. Copyr... |
% MaximoAbsoluto=maximo_struct(ESTRUCTURA)
% Explora, utilizando recursividad, los elementos de una estructura y devuelve el valor máximo entre
% todos los elementos.
% ENTRADA
% ESTRUCTURA: es una estructura con campos variables. La unica condición
% de la estructura es que en sus campos finales solo haya elemento... |
function code = ea_tmaze
code.initialization = @initializationCodeFun;
code.runtime = @runtimeCodeFun;
code.termination = @terminationCodeFun;
end
function vr = initializationCodeFun(vr)
% constants
vr.START = 1;
vr.CUE = 2;
vr.DELAY = 3;
vr.DECISION = 4;
vr.REWARD = 5;
vr.ITI =... |
function run_USPS()
fprintf '开始测试USPS数据集(数字3和8):'
Train=import_train('Datasets\USPS\optdigits.tra');
Test=import_test('Datasets\USPS\optdigits.tes');
DATA=[Train;Test];
X=DATA(:,1:end-1);
Y=DATA(:,end);
X(Y~=3 & Y~=8,:)=[];
Y(Y~=3 & Y~=8)=[];
[X,Y,Index]=K_Cross_Validation(X,Y,10);
TP=0;FP=0;FN=0;TN=0;
INDEX=1:10;
for ... |
function [w] = lab5fLE(N,p,f,Y)
%p = p1-1;
Y1 = [Y(:,1:p) ones(N,1)];
for j=1:p
Y1(:,j)=Y1(:,j)-mean(Y1(:,j));
Y1(:,j)=Y1(:,j)/std(Y1(:,j));
end
% Y1 = Y(:,1:p);
f1 = f;
f1 = f1 - mean(f1);
f1 = f1/std(f1);
w = inv(Y1'*Y1)*Y1'*f1;
|
function tf = equaltola(a, b, tol)
tf = abs(a-b)<=tol;
end |
function m = perturbacao(m,amp)
%modelo de documentacao a partir de:
%http://www.engin.umd.umich.edu/CIS/course.des/cis400/matlab/oop.html
%MODEL model class constructor.
% m = Model() creates a mesh object
%Name: perturbacao
%Location: <path>/@Model
%Purpose: method of the Model class to perturbate the base state... |
%Elina Geut
%Script for jump calculations for TFS flags
%Created 8/18/2019
%Part of case 53 and TaylorSet & SachsSet
%Part from TaylorSet (EG Modification)
if TFS == 1
if ndm == 2
trjump = reshape(trjump(1:6),2,3);
else
trjump = reshape(trjump(1:36)... |
% function x = makeSignal(T, dt, rms, bandwidth, randomSeed) creates a signal
% with characteristics as specified.
%
% T: length of the signal (s)
% dt: time step size (s)
% rms: the desired root mean square power level of x(t)
% bandwidth: a vector with the minimum and maximum frequency components
% (in radians... |
function f = ibpmultigpLowerBound(model)
% IBPMULTIGPLOWERBOUND
% IBPMULTIGP
f = 0;
% Lower bound terms related to u
Lainvm = model.Lainv'*model.m2;
f = f + .5*( (Lainvm'*Lainvm) - model.logDetA + sum(model.logDetKuu)...
- sum( sum( model.cdq.*model.etadq )) );
%% Lower Bound terms related to data
% Add
f = f -... |
clc, clear
files = {'inriaParametersGo','inriaParametersGo10','inriaParametersGoBeforeLayoutFix','inriaParametersGoChosenBig','inriaParametersGoChosenSmall','inriaParametersGoSi','inriaParametersGoTriangle','inriaParametersSi','inriaParametersSi10','inriaParametersSiBeforeLayoutFix','inriaParametersSiTriangle'};
for ... |
function [out_aligned] = alignIO(out,pulse, IRlength)
correl = xcorr(out,pulse);
[M, I] = max(correl);% Should probably replace with finddelay±±
out_aligned = out(I+IRlength-20:end);
end
%%% alignement important for finding the trainblock for equalization???
%%% disadvantage because of power normalization and mayb... |
%fmincon parameter
x0=[0.5;0.5];
A=[];
b=[];
Aeq=[];
beq=[];
ub=[0.5;0.5];
lb=[0.001;0.001];
%optimize
options = optimoptions('fmincon','Algorithm', 'sqp','Display','iter');
[x,fval] = fmincon(@objfun,x0,A,b,Aeq,beq,lb,ub,@nonlcon,options);
%get required answer
[stress,disp,force] = answer(x)
% ¥Ø¼Ð¨ç¼Æ
fun... |
% plotten der funktionen von aufgabe 3
clc;
close all;
clear all;
x = linspace(-5, 5, 10 / 10^-5);
% aufgabe a)
subplot(2,1,1);
plot(x,f1(x));
hold on
plot(x,atan(x));
plot(x,x);
title('Aufgabe a)');
legend('1/(1+x^2)', 'arctan(x)', 'x');
xlabel('x');
ylim([-2,2]);
% aufgabe b)
subplot(2,1,2);
plot(x,1./tan(x));
ho... |
image_col = [];
for i = 26:30
image_row = [];
for step = 1:8
I = imread(sprintf('./glimpse_output/img-%d-glimpse-%d.jpg', i,step));
image_row = cat(2, image_row, 255*ones(60,3,3),I);
end
image_col = cat(1, image_col, 255*ones(3,504,3), image_row);
end
imshow(image_col) |
function [ Adjacency_Matrix, Point_Set, Line_Set ] = Build_Adjacency_Matrix_BY_LineID_Set( LineID_Set )
%% Build_Adjacency_Matrix_BY_LineID_Set function description:
% Build the Adjacency Matrix BY CellID_Set
% Imput: LineID_Set
% Output:
% Adjacency_Matrix:
% Point_Set: Point ine the adjacency matrix... |
%%
clear
close all
clc
Colors
dt = 5e-2;
xo = [-0.8028 1.1398 -0.0672];
[t,x] = ode45(@f,0:dt:100,xo);
xo = x(end,:);
T = 1000;
[t,x] = ode45(@f,0:dt:T,xo);
figure
subplot(311)
plot(t,x(:,1))
subplot(312)
plot(t,x(:,2))
subplot(313)
plot(t,x(:,3))
figure
plot3(x(:,1),x(:,2),x(:,3))
dlmwrite('Final2_t.txt',... |
function p3
n = str2double(input('num', 's'));
for i = 1:n
if (isprime(i))
disp(i)
end
end
end
|
function initMP285
evalin('base', 'global state gh');
global state gh
gh.MP285 = guihandles(MP285);
openini('MP285.ini');
|
% RMSRECON
% usage: [result hdr raw_data] = rmsrecon(vers, chp, Pfile, N_sl, nph, necho, rms);
% rms=1: rms of coils
function [result,hdr,raw_data] = rmsrecon(Pfile, chp, rms)
%Pfile = ['/disk/meic/pfiles/011908/P04096.7'];
%[hdr, raw_data] = read_Pfile(Pfile);
... |
%Title: general_chromdis.m
%Author: Timothy Sheerman-Chase
%Date: 9 October 2000
%Description: This files takes the SCDM colour histogram and calculated the average and covariance. There may
%be a neater way to do this but I don't know it.
%
%Dependencies:
function [covar,rotation] = general_chromdis(in_fil... |
function [Final_Result] = Vinicity_NRC(Actual_NRC,Actual_RC,Actual_neighbourhoud,History_NRC_ID)
%% ---- Compute the vinicity of the non reporting cells ------------------------------
%% ----- Extract the first level of neighbouring cells ---------------
Actual_vinicity = 0;
Actual_NRC_ID = [];
Non_reporting_cel... |
function initCache4Patrol(n)
global cache map_handle map squirrel1
squirrel.task_id = squirrel.PATROL;
%% Fill n random caches with random food
size_x =size(map,1);
size_y = size(map,2);
indx = randperm(size(cache,1),n)
patrol = figure
for i = 1 : n
c = cache(indx(i)).capacity;
f_n = randi(c);
cache(in... |
%
% REGFUNCTIONAL Regularization functional constructor
%
% fhandle = REGFUNCTIONAL('type',S,L,K,alpha)
% Returns the objective functional of a regularization model. The function
% requires the signal (S), dipolar kernel (K), regularization matrix (L)
% and regularization parameter (alpha). The type of regulari... |
function tab=Gray(n)
% Default N:=255;
if nargin == 0
n=255;
end
% RGB färgtabellen. En rad per pixel i PIX.
tab=gray(n);
|
function [Pc_interval , Pc_drain_max , simTimes] = PcInterval()
%This function calculates the interval for increasing thr capillary
%pressure
global pore_data throat_data
max_Pc_pore = max(pore_data(:,28));
max_Pc_throat = max(throat_data(:,34));
min_Pc_pore = min(pore_data(:,28));
min_Pc_throat = min(t... |
D = diag(1./sqrt(diag(K)));
Kn = D * K * D;
|
% For each q >= 1
for q = 1:10
% Growth function with q fixed
gf = @ (N) homework_4_generalization_error_ex_8_mhq8 (N, q);
% Finds the VC dimension for the growth function gf
dvc = homework_4_generalization_error_ex_8_mhvc (gf);
% If the ith N is the breakpoint, then the (i-1)th point must be the dvc
fpr... |
function cost = PDFErrorAllParamRealSpace( params ,OmigaCell, BoardCornerGap, BoardCornerXYNum,FrameIdUsed)
K1 = params(1);
K2 = params(2);
fx = params(3);
fy = params(4);
cx = params(5);
cy = params(6);
k1 = params(7);
k2 = params(8);
A = -1/K2;
B = -K1/K2;
ext_p... |
function g = varGradient(params,model,Xs)
% VARGRADIENT
%
% COPYRIGHT : Carl Henrik Ek and Neil Lawrence, 2008
% NCCA
dim_independent = setdiff(1:1:model.q,1:1:size(Xs,2));
[void g] = gpPosteriorGradMeanVar(model,[Xs params]);
g = g(dim_independent,1)';
return |
function directionRefractedRay = getDirectionRefractedRay(directionIncidentRay, interfaceNormals, param)
crossProduct = cross(directionIncidentRay, interfaceNormals) ;
dotProduct = dot(directionIncidentRay, interfaceNormals) ;
euclideanNorm = sqrt(sum(crossProduct.^2, 1)) ;
num = euclideanNorm.*sign(dot... |
%% 准备工作空间
clc
clear all
close all
%% 第一张 cameraman
img = imread('cameraman.tif');
imgsize=size(img);
%提取bitplane
bitPlane=zeros(imgsize(1),imgsize(2),8);
for i =1:8
for ro=1:imgsize(1)
for co=1:imgsize(2)
bitPlane(ro,co,i)=bitget(img(ro,co), i);
end
end
end
... |
function [lambda,U]=stepsize(x,y,t,v,IND)
%STEPSIZE computes the optimal stepsize in a pivot of the least core algorithm
% Copyright 2005 Universiteit Maastricht, dept. of Mathematics
% $Revision: 1.00$ $Date: 2005/27/04$
% Jean Derks
global TOLR;
if isempty(TOLR), TOLR=100*eps; end
n=cardinality(v)... |
function varargout = doklik_new(varargin)
% DOKLIK_NEW MATLAB code for doklik_new.fig
% DOKLIK_NEW, by itself, creates a new DOKLIK_NEW or raises the existing
% singleton*.
%
% H = DOKLIK_NEW returns the handle to a new DOKLIK_NEW or the handle to
% the existing singleton*.
%
% DOKLIK_NEW('CALL... |
function Factors = invkrp_Rd_hosvd(X,M,usehooi)
% Factors = invkrp_Rd_hosvd(X,M,usehooi)
%
% invert an R-fold Khatri-Rao product. Tries to decompose a given matrix X
% into F1 \krp F2 \krp ... \krp FR, where size(Fr) = [M(r),N] and size(X) =
% [prod(M),N].
%
% Input
% X - tensor (double)
% M - size of dime... |
%-----------------question 1-----------------%
X_int = imread('photo1.jpg') %reading files with given "imread" function
Y_int = imread('photo2.jpg')
%
X_double = double(X_int) %values are integers - need to be cast as doubles (or floats) before being multiplied by percent values
Y_double = double(Y_int)
% %whos
... |
function y = finaal_cost(n,res,down) %% n: actual schedule --> column vector, res: number of rescheduling times
global first_schedule
global tardiness_coefficient; global inventory_coefficient; global expediting_coefficient
new_schedule = n;
comput = 500*res; %% Computational cost rate.
hc = 5 *inventory_coeff... |
%generate a sine table for Verilog ROM
x = 1:256;
% Sin : scale to 10-bits and offset 9-bits
y = fix(512 + 511*sin(2*pi*(x-1)/256));
for i=x
fprintf('\t\t\t8''h%02x: sine = 10''h%03x ;\n', x(i)-1 ,y(i))
end |
% Retrieve home dir of data
global echolex_data echolex_src echolex_dumps business_signals_data
echolex_data = getandcheckenvpath('ECHOLEX_DATA');
echolex_src = getandcheckenvpath('ECHOLEX_SRC');
echolex_dumps = fullfile(echolex_src, '../dumps');
business_signals_data = fullfile(echolex_data, 'business_signals_sample... |
function pa_bayes_modeldata(model,Nnom,Nmet,xmet)
% function pa_bayes_modeldata
%
% For every nominal factor a parameter
% For every metric factor, N dependent parameters
%
% To do: multiple metrics
% PA_BAYES_MODELDATA
%
% Write Trial-line in an exp-file with file identifier FID.
% TRL - Trial Number
%
% S... |
function twophaseflow
% Open mesh
% domain size is determined by number and size of gridcells
% ========================= Input Data ==================================
% -------------------- Grid Dimensions -------------------------
% load fine_mesh.mat
load fin_model.mat
num_nodes = msh.nbNod;
matrix_... |
function y_tgt = predict_da_toolbox(x_src, y_src, x_tgt, ftTrans, params)
% Perform a prediction with one of the ftTrans functions from the matlab domain adaptation toolbox.
% See https://github.com/viggin/domain-adaptation-toolbox
%
% Usage:
% predict_da_toolbox(x_src, y_src, x_tgt, ftTrans, params)
% W... |
function upButton = microdrive(startvalue)
% function upButton = microdrive(startvalue)
%
%
global s1 cr stepspersec micronsperstep initialdepth
if (nargin > 0)
initialdepth = startvalue;
else
initialdepth = 0;
end
% now prepare the GUI
fh = gcf;
clf
oldPos = get(fh,'Po... |
% INPUT:
% img = grey scale image
% w = window size
% c = minimum contrast between pixels in a window to apply threshold
%
% OUTPUT
% Ims = Segmented image
%
function [Ims] = BERNSEN(img, w, c)
img = im2uint8(img);
[nrows ncols] = size(img);
Ims=ones(nrows, ncols);
% determine half window h to be used in iterations
... |
function [SampEn] = SampEn(series,dim,r)
%{
Function which computes the Sample Entropy (SampEn) of a time series. The
alogorithm presented by Richman and Moorman at "Physiological time-series
analysis using approximate entropy and sample entropy" (PMID: 10843903) has
been followed.
INPUT:
serie: the time serie... |
% Calibrate gray, red, blue, and green. Make sure to warm up the monitor
% first (minimum 1 hr). Then output is saved to a .mat file as well as
% a .txt file for use with showex. For now, this script collects the
% individual color values, but then just uses gray for calibration.
clear all
calibvals = 0:255;
lv = cali... |
function [f] = TDTR_3DAni_getG_savespace(xi,eta,f,k,C,h)
%TDTR_3DAni_getG evaluates the fourier transform of the Green's function G=Ts/qpointsource
% (xi,eta): are vectors containing fourier conjugates of (x,y); they must
% be the same size.
% f: is the frequency of the oscillating unit heat source (in this
% ... |
function [I3] = Simpson38(h,data)
%Simpson38 calculate integral using 3/8 Simpson's rule integration
len = length(data);
I3 = 0;
for j=1:len
i = j-1;
if (i == 0 || j == len)
c = 1;
elseif (~rem(i,3))
c = 2;
else
c = 3;
end
I3 = I3 + c*data(j);
end
I3 = I3*3*h/8;
... |
function [f, df, Hf] = easy2dquad(x)
% EASY2DQUAD Easy to minimize quadratic function in 2D with unique minimum 0.
% clear num_calls to set to zeros
persistent num_calls;
if isempty(num_calls)
num_calls = zeros(3, 1);
end
if (nargin == 0)
f = num_calls(1);
df = num_calls(2... |
% semg = LEN x CH
function pulse_vec = semg_find_pulse(semg, threshold)
len = length(semg);
ch = size(semg, 2);
pulse_vec = zeros(size(semg));
for i = 1 : ch
for r = 2 : len
if semg(r, i) > threshold(i)
diff = (semg(r, i) - semg(r - 1, i)) * ...
(semg(r - 1, i) - semg(r, i)... |
% Wireless Communication Systems_Final Project
% Due date: 20190119
% 107064522
clear all
close all
%% Input parameters
N = 4; % The number of antennas
delta = 0.5; % The normalized antenna separation
% for comparison
% % % N = 16;
% % % delta = 1/2;
%% Output results
%% The angular-domain radiation... |
clear
W = 133;
n = 256;
m = 31;
w = @(x, N) exp(-2i*pi*x/N);
shift = @(x, M) [zeros(x,M-x),eye(x);eye(M-x),zeros(M-x,x)];
bw = chebwin(W,200);
BW = zeros(n,1);
BW(1:W) = bw;
bw_ft = abs(fft(BW));
DCW_ft = zeros(n,1);
b = [bw_ft(1:14);bw_ft(n-12:n)];
numel(b)
b = ones(1,numel(b))*b;
d = zeros(W,1);
for i = 1:n
... |
function loglik = emlikelihood(x,datatofit,ntaus)
t=x(1:ntaus);
w=x((ntaus+1):end);
pdf = emdistpdfc(datatofit, t, w);
disp(sum(pdf==0));
pdf=pdf(pdf~=0);
loglik = sum(log(pdf));
end |
%% apply NN to Exp data
clear
clc
FolderExp='C:\Users\colto\Desktop\research\TEMP_lab_home\Expanded theta experimentation';
FolderFig='C:\Users\colto\Desktop\research\TEMP_lab_home\Expanded theta experimentation\figure';
cd(FolderExp)
sampling=50;
freq_scan=freq_log(0.05,1,20);
freq_scan=freq_scan(2:end);
T_scan=305:10... |
%DEFAULT
%Default Graph Plotter
%
%default(X_coordinates,Y_coordinates_Polar,Y_coordinates_BiPolar,number_of_bits,input_streat_bits)
%
%takes the mentioned parameters and plots Polar RZ and Bipolar Pseudoternary Graphs.
%
%RETRUN VALUE:-
% 1 if successfull
% 0 if failed
function isDefaultPlotted = d... |
% Punkt 3.3 Walidacja globlna - podpunkt 3 pracy mgr
clear;clc;close all;
%%
load('markovskiM1s1s2s3.mat');
load('markovskiM2s1s2s3.mat');
load('markovskiM3s1s2s3.mat');
load('markovskiM4s1s2s3.mat');
M1 =markovskiM1s1s2s3;
M2 =markovskiM2s1s2s3;
M3 =markovskiM3s1s2s3;
M4 =markovskiM4s1s2s3;
%% masa pie... |
classdef derivative_approx
properties
size_scalar % default 3
size_Fourier % default 2
C3_to_C3 % a 3x3 complex matrix
Fourier2_to_C3 % 3x2 cell of Fourier_2D
C3_to_Fourier2 % 2x3 cell of Fourier_2D
sign_Delta % 2x2 integer matrix with values in {-1,0,1}
mat_F... |
function gamma=gamaunifac(x,T)
nu=[2 4 0 0 0;1 1 0 0 1;1 4 1 0 0;0 0 0 6 0];
Rk=[0.9011 0.6744 0.4469 0.5313 1];
Qk=[0.848 0.540 0.228 0.400 1.2];
a=[0 0 0 61.13 986.5;0 0 0 61.13 986.5;0 0 0 61.13 986.5;-11.12 -11.12 -11.12 0 636.1;156.40 156.40 156.40 89.60 0];
tow=exp(-a/T);
r=zeros(1,size(nu,1));q=zeros(1,size(nu,1... |
clear;clc;close all
orbital_parameters_1.a = 12000;
orbital_parameters_1.ecc = 0;
orbital_parameters_1.theta = 120*pi/180;
orbital_parameters_1.RAAN = 0;
orbital_parameters_1.PA = 0;
orbital_parameters_1.INCLI = 0;
orbital_parameters_2.a = 9500;
orbital_parameters_2.ecc = 0.3;
orbital_parameters_2.theta = 250*pi/180;
... |
function guess = spline_guess(x0,xf,m,N,plot_status)
dist = norm(x0(1:2)-xf(1:2));
offset = (x0(1) + xf(1)) / 2;
dt = 0.01;
t = pi:-dt:dt;
x = dist / 2 * cos(t) - offset - 0.2 * dist * sin(t);
y = 3000 * sin(t).*sin(1/2*t).^m;
z = linspace(x0(3),xf(3),length(t));
dx = x(2:end... |
function analyze_allsubjects_data()
%
% analyze_allsubjects_data() reads trial data from the current directory
% and graphs either average performance or individual performance for all
% conditions
%
% Note: comment out"Plot averages" or "Plot individual data",
% depending on what you want to graph OR use "Run Section... |
function [lp pvals P2 m1 m2] = compareLightOnVsOff(lp, permutationTest)
% compute the P value between the fr before and after the light
%
% Pvals the P value computed with either ttest or man-U paired or unpaired
% P2 is the 0,1,2 for no response, excitation and inhibition respectivly
P1=[]; m1=[]; m2=[];
pTH=lp... |
function [ flag ] = neuralNet_is2Input(refData, periodIndex, aqiIndex)
NN=refData.nnSuperSet(periodIndex).nnSet(aqiIndex);
flag=(size(NN.net,1)==48 || (size(NN.net,1)==1 && size(NN.net.inputs{1}.range,1)==16));
%flag=(size(NN.net,1)==16 || (size(NN.net,1)==1 && NN.net.inputs{1}.size==16));
end |
%%
% Evaluate the Coriolis matrix C, given q, dq
function C = eval_C(q, dq)
q1 = q(1);
q2 = q(2);
q3 = q(3);
dq1 = dq(1);
dq2 = dq(2);
dq3 = dq(3);
[m1, m2, m3, l1, l2, l3, g] = set_parameters();
t2 = q1-q2;
t3 = sin(t2);
t4 = q1-q3;
t5 = sin(t4);
C = reshape([0.0,(dq1.*l1.*l2.*m2.*t3)./2.0,dq1.*l1.*l3.*m3.*t5.*(-1... |
function predictedBoundingBoxes = PredictBB(FromBB, ToBB, colorRange ,imageBounds)
%PredictBB (FromBB, ToBB, FoundBB, colorRange) - Calculates the motion of a
%bounding box based on its center and size in 2 frames. Uses the FoundBB
%and colorRange to color BB that are only in one of the frames.
% Detailed explanation... |
function [] = LoopLogistic(Trainfile, Testfile, LoopObj, LoopArray, otherValue, method)
Acc = zeros(length(LoopArray), 1)
AccTest = zeros(length(LoopArray), 1)
if strcmp(LoopObj, 'alpha')
for i = 1:length(LoopArray)
alpha = LoopArray(i)
[Acc(i), AccTest(i)] = Logist... |
function [p] = get_pressure(INSTR)
vmon = daq_r(INSTR.DAQ_pressure{:});
a1 = 6.8;
a2 = .6;
p = 10.^((vmon-a1)/a2);
end
|
clear
clc
close all
%%
filename = 'T2T2_2b_07Sept2018';
filedir = 'C:\CommonData\TKM\Basil\T2T2_2_07Sept2018\';
fileloc = strcat(filedir,filename);
% expNum = 1;
[ap,spec,spec2,spec3,spec4] = readTecmag4d(strcat(fileloc,'.tnt'));
% spec2 = squeeze(spec3(1,:,:));
tEcho = 300; %us
nEchoes = 256;
tRep = 1000; %ms
t_mi... |
classdef BC
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties
displacements
Fpointload
iN
iD
end
methods
% Constructor
function obj = BC(nunkn)
if nargin ~= 0
[... |
% gui_resloution.m
clear all
clc
close all
%f1 = figure('Color',[0.95 0.9 0.9],'Name','Diffraction', ...
% 'NumberTitle','off','Position',[20 50 900 600]);
% set(gcf,'units','normalized','position',[0.05 0.05 0.85 0.85]);
f1 = figure('Color',[0.95 0.9 0.9],'Name','Resolution', ...
'NumberTitle','off');
% s... |
function oneD_TimeDependant_bis
% general variables
% space discrete vector
x_min = -15;
x_max = 15;
delta_x = 0.1;
x_values = (x_min:delta_x:x_max)';
n = length(x_values);
% time discrete vector
delta_t = 0.01;
nb_steps = 8;
T = 0.:delta_t:delta_t*nb_steps;
% d... |
classdef Solver < handle
%SOLVER A graph Laplacian linear solver.
% This class is an abstraction for solvers of the linear problem
% A*X=B, where A is a an NxN graph Laplacian graph and B is an NxM
% matrix (usually M=1, but could be arbitrary).
%
% Separate methods are available for the... |
% graficarTriada(V1,V2,V3,origen,frame,linewidth)
%
% grafica tres vectores en matrices (frames×3) en el "frame" indicado con
% cola en "origen".
% "origen" es una matriz (frames×3) con posiciones en el espacio.
% los vectores se grafican con cola en la posción de "origen" en el "frame"
% pasado en una escala de 1:10... |
function module_topup_job_cluster(base_image_path, reversed_image_path, outpath, minvols, filestocorrect,json_path)
global fsldir
setenv('FSL_DIR',fsldir); % this to tell where FSL folder is
setenv('FSLOUTPUTTYPE', 'NIFTI'); % this to tell what the output type
setenv('FSF_OUTPUT_FORMAT', 'nii'); % this to tell wha... |
function cc_gtb
% CC_GTB - "Compiles" all the GTB applications to run standalone
DirStart = pwd;
gotocompile('GTB');
cc_standalone('gtbcontrol');
cc_standalone('machineconfig');
cc_standalone('als_waveforms');
cc_standalone('plotfamily');
cc_standalone('viewfamily');
cd(DirStart);
|
function p = invlogit(x)
p = 1 ./ (1 + exp(-x));
nanvector = isnan(p);
n_nan = sum(reshape(nanvector,1,[]));
if n_nan > 0
y=exp(x(nanvector));
p2=y ./ (1+y);
p(nanvector) = p2;
end
end
|
function result = nearest_neighbor(train_image_matrix, train_labels, test_image_matrix)
%caculate dist
dist = vl_alldist2(train_image_matrix', test_image_matrix');
dist = dist';
result = [];
for i = 1:size(test_image_matrix,1)
%find the nearset dist and select so as the label
[value,... |
# read orientation and parse data
function [accTime,accX,accY,accZ] = accGetData(inFile)
# read acc data
inData = csvread(inFile);
# parse acc data
accTime = inData(:,1)';
accX = inData(:,2)';
accY = inData(:,3)';
accZ = inData(:,4)';
endfunction
|
function [ f, x ] = geometric_dist( p, tol)
%
clear f
n=1;
f(1)=(1-p);
while true
n=n+1;
f(n)=f(n-1)*p;
if f(n) < tol
break
end
end
f=f/sum(f);
x=1:length(f);
x=x/sum(f.*x);
end
|
function [xfit, mout, Gout] = partialFit(lpartfit, m, G)
% [xfit, mout, Gout] = PARTIALFIT(lpartfit, m, G)
%
% inputs
% - lpartfit: logical array indicating which model parameters (and
% correspondent columns of G) to keep and compute the fit.
% - m: model parameters (output of function myleastsqr... |
function [L,cpu_time,Z1,Z2,eta,sample,West]=IRMBipartite(A,W,noc,opts)
% Non-parametric IRM of Bi-partite multi-graphs based on collapsed Gibbs sampling with split
% merge moves
%
% Usage:
% [L,cpu_time,Z1,Z2,eta,sample,West]=IRMBipartite(A,W,noc,opts)
%
% Input:
% A cell array of I x J sparse adjacency mat... |
function p = classifieur1(img, n)
%detect and recognize one number
img = imbinarize(img);
img = 1 - img;
%read the class' centers
%!!!!!!!!! the centers must be determined with the same n !!!!!
centers = csvread('centers.csv',0,0);
%get the left and right values
s = size(img);
... |
function T=FUNtriDiag(a,b,c,n)
% T=tridiag(a,b,c,n) returns an (nxn) matrix that has a, b, c as the
% subdiagonal, main diagonal and superdiagonal entries in the matrix.
T=b*diag(ones(n,1))+c*diag(ones(n-1,1),1)+a*diag(ones(n-1,1),-1);
end |
function [ C1, C2 ] = get_data( )
C1={};
C2={};
res_side = 512;
path = pwd;
path = [path,'/data/labels.txt'];
labels = load(path);
PID = labels(:,1);
labels = labels(:,2);
path = pwd;
path = [path,'/data/cancer_type.txt'];
CC_type = load(path);
CC_labels = CC_type(:,2);
CC_PID = CC_type(:,1);
path = pwd;
path =... |
MatFiles=dir('*matlab*.mat');
name=strcat(MatFiles(1).name);
Calcium=load(name, 'DenoisedTraces');
Calcium=Calcium.DenoisedTraces;
MatFiles(1).number=size(Calcium,1);
Noise=load(name, 'Noise');
Noise=Noise.Noise;
Fitness=load(name, 'idx_components');
Fitness=Fitness.idx_components+1;
GoodCalcium=Calcium(Fitnes... |
faceIndex=zeros(size(faces,1),1);
%i-th face属于 faceIndex(i)-th cell;若faceIndex(i)为0,则不属于任何一个cell
for i=1:nbr_landmarks
vertIndex=find(Q(:,1)==i); %第i个cell中顶点的编号
index=zeros(size(faces));
for j=1:length(vertIndex)
index=index+(faces==vertIndex(j));
end
faceIndex=faceIndex+i*(index(:... |
function regexprepfile(filename,exp,repstr)
% Replace string in one or more files using regular expressions.
%
% Syntax
%
% regexprepfile(filename,exp,repstr)
%
% Description
%
% regexprepfile(filename,exp,repstr) performs a regular expression
% replacement using the pattern exp in the file filename with the... |
function [valuemat, xx, yy] = contourplot(nx, ny, nodraw)
global setts
if setts.nparams ~= 2
error('Number of variables to be optimized must be 2')
end
if nargin < 3
nodraw = 0;
if nargin < 2
ny = 10;
if nargin < 1
nx = 10;
... |
% =========================================================================
% Tensor Factorization: Learning Mixtures of Gaussians
% ------------------
% Paper: Tensor Decompositions and their Applications in Machine Learning
% Seminar: Efficient Inference and Large Scale Machine Learning
% Author: Stephan Rabanser (ra... |
function clearPingTable(dbconn,filename,freq)
if isempty(freq)&&~isempty(filename)
sql_cmd=sprintf('DELETE FROM ping_data WHERE filename=''%s'';',filename);
elseif ~isempty(freq)&&isempty(filename)
sql_cmd=sprintf('DELETE FROM ping_data WHERE frequency =%d;',freq);
elseif isempty(freq)&&isem... |
Q=[1;2;1];% parameters
x=[1 1 1;1.35 1.40 1.45;1.82 1.96 2.10];% height is in meters
Y=[28;32;38];%weight in kgs
X=[1;1.5;2.25]; % enter the height and in next enter row height^2
L=0.07;
m=3;
% this algorithm guess the normal weight based upon the height
for i=[1:50000],
E=((Q')*x);
O=((E'-Y)'*(x'));
... |
function model = train_mcsvm(features,costs,varargin)
% model = TRAIN_MCSVM(features,costs)
% model = TRAIN_MCSVM(features,costs,lambda)
% model = TRAIN_MCSVM(features,costs,lambda,bw)
% features is num_instances x dim_features
% costs is num_instances x num_classes
% lambda is regularization constant
% default parame... |
clc
clear
n1 = datenum(2004,04,01);
n2 = datenum(2004,04,30);
Dust_raster = zeros(298,696);
[BTDref{1:61}] = deal(zeros(298,696) - 500);
[Dust{1:61}] = deal(zeros(298,696));
[Dust_daily_sum{1:366}] = deal(zeros(298,696));
count = 0;
for n = n1:n2
count = count + 1;
[BTDref{1:61}] = deal(ze... |
function [prom_X,prom_Y]=promSizeLetter(boundingbox)
% Función que devuelve el tamaño medio de cada letra de un texto pasado
% de entrada (imagen de una palabra, una línea, etc.)
% Entrada :
% boundingbox: matriz (regionProps) de cuadros delimitadores para cada letra
%
% Salida :
% prom_x: tamaño medio de las letras qu... |
%% Run WCST simulation in multiple subjects
% The optional argument changes the specified variable to the
% requested one
% subj_sim_brx = runBRXvar_Set(5,'weights.w_STIM_PRES',0.7);
% subj_sim_brx = runBRXvar_Set(5,{'weights.w_STIM_PRES','weights.w_RULE'},{0.7,0.6});
function subj_sim_brx = runBRXvar_Set(subjects_to... |
%抛物线最远距离和最佳角度
%初始角度theta
%定义常数和初始值
conv=pi/180;g=-9.81;v0=20;
range=zeros(1,91);
for ii=1:91
theta=ii-1;
vx0=v0*cos(theta*conv);
vy0=v0*sin(theta*conv);
max_time=-2*vy0/g;
range(ii)=vx0*max_time;
end
% fprintf('Range versus angle theta:\n');
% for ii=1:91
% theta=ii-1;
% fprintf('%2d %8.4... |
% Determine whether a feasible solution exists.
%
% INPUTS: graph(adj), cardinality(K), dimension(x_1)
% OUTPUTS: CardEnoicon, feasible(1), not feasible(0)
%
% Only for undirected graph.
% GB: last updated, Jan 22, 2019
function CardEnoicon = isCardEnough(adjG_topo,K,x_1)
adj = zeros(2 * x_1+2, 2 * x_1+2);
adj((1 ... |
function dispfrac(mode)
% DISPFRAC Display terms in laplacian format.
% DISPFRAC displays the current terms in fraction format.
% Author: Craig Borghesani
% Date: 8/23/94
% Revised: 10/18/94
% Copyright (c) 1999, Prentice-Hall
% obtain handle information
f=gcf;
ui_data = get(f,'userdata');
ui... |
function str = ConvertMFSK2RS(Str1)
for i = 1:length(Str1)
if (Str1(i) == 0)
str(i) = -Inf;
else
str(i) = Str1(i)-1;
end
end |
classdef twinbeam < handle
%TWINBEAM Summary of this class goes here
% Detailed explanation goes here
properties
connection
width
height
coordinates
H_calib = []; % calibration matrix
end
methods
function obj = twinbeam(ip, port, varargin)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.