text stringlengths 8 6.12M |
|---|
function pass = uq_SVC_test_ExpDesigns( level )
% Make sure that Kriging works with user defined experimental designs
% regardless of scaling choice
Scaling_choices = [0,1];
fname = 'SVCValTest.mat';
N = 50;
Nval = 500;
eps = 5e-1; % Large error threshold. The idea is just to make sure that the code runs without any er... |
function out_str = num2str_norm( num, normSize )
% This function is to normalize a number to be a normed string
% with fixed length and with sign
% normSize is the length of digits in num.
% sign of num is not counted as a digit
sign = '';
abs_num = num;
if num < 0
sign = '-';
abs_num = -num;
else
sign = ... |
function D = analyze_FTM(ac, div_tol, type)
%% time evolution
options = odeset('AbsTol', 1e-11, 'RelTol', 1e-11, 'Events', @(t,y) z_event(t,y));
data = simulate_traj(ac, 2000, options);
%% calculating average values for V and gamma
t = linspace(0, ac.tf, 1000);
V_avg = 0;
for i = 1:leng... |
classdef CLASS_CollectData_INTERFACE < handle
properties
% inputs
DataConfig={};
end
properties (SetAccess = protected, GetAccess = public)
% plot handles
ShowFrame={};
DrawCirclesBLUE={};
DrawCirclesRED={};
% outputs
RGB={};
Results={... |
clc
clear
format compact;
% for n = 1000:25:2500
% tic;
% res = Main(n);
% time = toc;
% res = sort(res);
% expected = WypiszWartosci(n);
% eq = CompareArrays(res, expected);
% if(eq ~= 1)
% disp(["Pierwszy błędny wynik, n =", n]);
% break;
% end
% ["n", "correct", ... |
%% import data
clc;close all;clear;
No=[2,3,5];
GL=[7,1,5];
ipt=[7;8;13;17;20;24];
plotvariable;
gl_no=2;%高炉编号
filepath=strcat('..\..\GL_data\',num2str(No(gl_no)),'\');
% window_hours=48;
hours=12;
minutes=6*60;
opt=struct(...
...% 'window',max(window_hours,hours)*360 ...
'date_str_begin','2012-11-20', ...... |
function [winner] = whowins (plr, box)
winner=0;
% logic for winner
% upper left 3x3 box
if box(1,1)==plr && box(1,2)==plr && box(1,3)==plr
winner=box(1,1);
return;
elseif box(2,1)==plr && box(2,2)==plr && box(2,3)==plr
winner=box(2,1);
return;
elseif box(3,1)==plr ... |
function [psm_x_dsr, psm_xdot_dsr] = DsrCompute(mtm, mtm_q_pre, mtm_q)
Trans_Mat = [-1.0000 0.0000 0 -0.0001;
0.0000 -1.0000 0.0000 -0.3639;
0 0.0000 1.0000 -0.0359;
0 0 0 1.0000];
R = Trans_Mat(1... |
function newct=justletters(str)
% removes non-letters from str
newct='';
lct=1;
for ct=1:length(str)
if isletter(str(ct)), newct(lct)=str(ct); lct=lct+1; end
end
|
function [C_N] = gauss_covariance(X, N, beta, delta, hyper)
%GAUSS_COVARIANCE Compute the covariance matrix of our training data
% Use quadratic kernel
C_N = zeros(N);
for n=1:N
for m=1:N
C_N(n, m) = quadratic_kernel(X(n,1), X(m,1), hyper)+ (1/beta)*delta;
end
end
end
|
% Policy scratch
close all; clear all; clc
%% shared
amin = -100; % limits of the unsquashed control function
amax = 200;
x = linspace(-15,15,50);
maxLinOut = pi/2;
maxU = 100;
target = 50;
target_scaled = (target/maxU)*(maxLinOut);
%% linear controller
policy_lin.fcn = @(policy_lin,m,s)my_conlin(poli... |
function count = writeraw(G, filename)
%writeraw - write RAW format grey scale image file
% Usage : writeraw(G, filename)
% G: input image matrix
% filename: file name of the file to write to disk
% count: return value, the elements written to file
disp([' Write image data to' filename ' ...']);
% Get file ID
f... |
function draw_both_3d(P,Ell,Ell_AA,x0_R,diff_R,x0_out,diff_out,exp_comp,palette_label)
palette_size = length(palette_label);
tuples = gen_tuples(1:palette_size-1,3);
for i = 1:size(tuples,1)
figure('Position', [100, 100, 1049, 895]);
% PROJECTION BASIS
idx_1 = tuples(i,1);
idx_2 = tuples(i,2);
idx_3 = tuple... |
function out=sigfigs(in,varargin)
if nargin==1
maxfigs=8;
elseif nargin==2
maxfigs=varargin{1};
elseif nargin>2
error('Too many input arguments')
end
% Set default maximum number of sig figs to search for
out=ones(size(in))*maxfigs;
% NaN has NaN sig figs
out(isnan(in))=NaN;
% Find remaining sig figs
for i... |
function hSave = hIntegralVlassak(dTheta,C,normalVector,angleVec,plotFlag)
if plotFlag
figure;
end
% Initialize
hSave = zeros(length(angleVec),1);
for mLoop = 1:length(angleVec)
angleTemp = angleVec(mLoop);
yVector = [cosd(angleTemp+dTheta) sind(angleTemp+dTheta) 0];
hSave(mLoop) = hVlassak(C,yVector... |
function [ MeanFace ] = CalculateMeanFace( Images,Width,Height )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
[W,Hieght]=size(Images);
MeanFace=[];
for i=1:Hieght
MeanFace=[MeanFace; mean(Images(:,i))];
end
Mean=reshape(MeanFace,Width,Height);
figure,title('Meannnnnn'),imshow(Mea... |
function A = readData()
A = readtable('linregdata','ReadVariableNames',false);
present = @(x) ismember(table2array(A(:,1)), x);
A = [present('F') present('I') present('M') table2array(A(:,2:end))];
end |
function [current_nodes_states,current_node_activation_status,current_path_states,current_time]=data_decoder2(response,no_of_nodes,no_of_paths)
global UT_GUI
persistent prev_time
parts=str2double(strsplit(response,','));
try
current_time=parts(4);
catch
if(size(parts,2)<4)
... |
function [Bk,Knots]=mysplineVer1(t,d,m),
%% [Bk,,Knots]=myspline(t,d,m),this function calculs spline
%% functions. t contains the time sampling, d is the degree of Bspline
%%functions and m is the number of the functions
Bk=[];
Knots=[1:fix(length(t)/(m+d+2)):length(t)];
for i=1:length(Knots)-1,
Bk1=zeros(1... |
function res = run_pipeline(data_generator_func, models, n_samples)
res = cell(n_samples, 1);
parfor i = 1:n_samples
res{i} = run_pipeline_helper(data_generator_func, models, i);
end
|
function SRBM = correctMatrix(SRBM, K)
%CONVERTMATRIX Summary of this function goes here
% Detailed explanation goes here
nb_ones_column = sum(SRBM,2);
for j=1:size(SRBM,1)
nb_ones = nb_ones_column(j);
for i=1:size(SRBM,2)
if (SRBM(j,i) == 1)
SRBM(j,i) = (K/(K+1))^(nb_ones-1);
... |
% Usage:
% - circle_phi( c, r, SIZE )
% - circle_phi( c, r, X, Y )
%
% Example:
% - imagesc( circle_phi( [.2,.5], .1, [640,480] )<0 );
function F = circle_phi( varargin )
switch nargin
case 3
SIZE = varargin{3};
X = linspace(0,1,SIZE(1));
Y = linspace(0,1,SIZE(2));
[x,y] = m... |
data = csvread('/Users/martin/code/gitwork/headaches/data-preparation/resources/data1-generated-negatives-auto.txt');
X = data(:, 1:6);
y = data(:, 7);
m = length(y); % number of training examples
% Print out some data points
fprintf('Some 10 examples from the dataset: \n');
fprintf(' x = [%.0f %.0f %.0f %.0f %.0f %.... |
clear all; close all; clc;
%% Add necessary paths
addpath(genpath('./functions')) % for helper function
addpath(genpath('./classes')) % for class defintions
addpath(genpath('../chronux_2_12')) % for Chronux library
fontSize = 14; % For subsequent figures
%% Run simulation
% Define simulation parameters
simParams.num... |
function filenames = saveCodonNecessityResults(results, metric)
% filenames = saveCodonNecessityResults(results)
% -------------------------------------------------------------------------
% Saves the results of runCodonNecessity
% -------------------------------------------------------------------------
argument... |
%function to extract all relevant information from ATLAS SQLite file with or
%without covariance matrices. Returns NaN if covariance matrices are unavailable.
%code by Ingo Schiffner
function [TAG,TIME,X,Y,VARX,VARY,COVXY] = ATLAS_SQLite_GetLoc(fname)
conn = sqlite(fname,'readonly');
%get time and position... |
% Geothermal gradient - relaxing after major erosion event
%
% FTCS
%
% JSB code update
clear all
figure(2)
clf
%% Constants
Ts = 20; %initial surface T C
k = 2; % conductivity
rho = 2000; % density, kg/m^3
c = 2000; % Specific heat capacity, J/kg*K
kappa = k/(rho*c); % Thermal diffusivity, m^2/s
Qm = .04; % mant... |
function uq_LRA_print(LRAModel,outArray, varargin)
% uq_LRA_print(Coefs, Basis)
% Print information about the computed LRA model
%% Consistency checks and command line parsing
if ~exist('outArray', 'var') || isempty(outArray)
outArray = 1;
if length(LRAModel.LRA) > 1;
warning('The selected LRA has more... |
function [outname,dir_new,ymd]=auto_imget(num_image,start_n)
% This function sort all the image follow the Julian days derived for folder name
% Valid both for MTL and WO
% Input:
% num_image: is just numble you want i.e. 1,2
% Ouptut:
% outname: this is for the name structure
% dir_new: new dir
% ymd: julian date;
... |
function [] = parte1(which=1)
% Datos comunes a las 3 problemas planteados
[ind,coord,aristas,costos,delays]=carga("../datos/nodos.txt","../datos/aristas.txt");
[mAdy,vecInd] = adaptador(ind,aristas);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Por Costos
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (which==1)
... |
function [results_implicit, results_explicit] = main()
% De matrices om de resultaten in op slagen.
results_implicit = zeros(9,5);
results_explicit = zeros(9,5);
data_line = 1;
do_compare(10, 1);
do_compare(10, power(10, 4));
do_compare(10, power(10, 8));
do_compare(100, 1);
... |
function toggleZoomMode(frame)
%TOGGLEZOOMMODE Toggle zoom mode and updates menus
%
% Inputs:
% - frame: instance of PolygonsManagerMainFrame
% Outputs : none
%
% Example
% toggleGridDisplay
%
% See also
%
% ------
% Author: David Legland
% e-mail: david.legland@inra.fr
% Created: 2018-03-20, using... |
address_base1 = '/Users/Elegant_LIN/Documents/MATLAB/EEG_Emotive_data/data1'
address_base2 = '/Users/Elegant_LIN/Documents/MATLAB/EEG_Emotive_data/data2'
address_base3 = '/Users/Elegant_LIN/Documents/MATLAB/EEG_Emotive_data/data3'
address_base4 = '/Users/Elegant_LIN/Documents/MATLAB/EEG_Emotive_data/data4'
address_base... |
%%%%%%%%%%%%%
% question 1:
%%%%%%%%%%%%%
% is it possible to do better than wt_vec? by selecting another mixture?
% Assume: Parameters Knwon
conststar_c =(1/gamma_c)*(mug_c/sigma2g_c);
sutilstar_c =calU(conststar_c*wg_vec+wh_vec, mu_vec, sigma_mat, gamma_c);
m_const =50;
sutil_vec =ones(m_const,1);
for i=1:m_co... |
function out = Process_Slide_3_Method_of_Processing(DashBoard,end_Time, Decision, Reason, Class, Pending, fontsize)
start_Time = '12/31/2019 00:00';
TimeCreatedSinceDeploy = datenum(DashBoard.TS_Created) - datenum(start_Time);
Departure_UTC_SinceDeploy = datenum(DashBoard.Departure_UTC) ... |
function u0 = IC2d(x,y,option)
%% Initial Condition (IC)
% This subroutine creates an special IC for testing purposes.
% The present IC models a rectangular domain with four equally sized
% regions with diferrent initial state value, u, an adimensional value.
%
% by Manuel Diaz, manuel.ade'at'gmail.com
% Institute of ... |
function sim = gaussianKernel(x1, x2, sigma)
%RBFKERNEL returns a radial basis function kernel between x1 and x2
% sim = gaussianKernel(x1, x2) returns a gaussian kernel between x1 and x2
% and returns the value in sim
% Ensure that x1 and x2 are column vectors
x1 = x1(:); x2 = x2(:);
% You need to return the fol... |
function [d,F,G] = PrinAngles(A,B)
% function [d,F,G] = PrinAngles(A,B)
% A and B are mxn matrices with n<=m.
% d is nx1 and d(i) = cos(theta(i)), i=1:n where theta(i) is the ith
% principal angle between ran(A) and ran(B).
% The columns of F (mxn) and G (m,n) are the corresponding principal
% vectors.
[Q... |
%Script which simulates a teaming game where a number of people placed
%in a room, pick two others at random, and move to a position
%in the room where they form an equilateral triangle between themselves and
%their two chosen team members.
%
%Uses the handle class hPerson.m which simulates all the behaviours of a... |
function varargout = dotParamsMenu(varargin)
% DOTPARAMSMENU M-file for dotParamsMenu.fig
% DOTPARAMSMENU, by itself, creates a new DOTPARAMSMENU or raises the existing
% singleton*.
%
% H = DOTPARAMSMENU returns the handle to a new DOTPARAMSMENU or the handle to
% the existing singleton*.
%
% ... |
%% prt_my_pet_bib
% read results_my_pet.mat to write my_pet_bib.bib
%%
function prt_my_pet_bib(species, biblist, destinationFolder)
% created 2015/07/17 by Starrlight; modified 2016/11/03 Starrlight, 2017/05/18, 2018/08/17, 2022/02/10 Bas Kooijman
%% Syntax
% <../prt_my_pet_bib.m *prt_my_pet_bib*> (species, biblist, ... |
% generate data center demand traces
interactive_raw = load('traces/SAPnew/sapTrace.tab');
col = 4; % column of the data loaded
time_interval = 5; % in minutes
required_length = 1440; % per minute data
t_raw = linspace(0,required_length,required_length/time_interval+1);
t = linspace(0,required_length,required_length+1)... |
function [ e ] = alignmentError( x, p_W_GT, p_W_estimate )
%ALIGNMENTERROR Summary of this function goes here
% Detailed explanation goes here
% determine transformation
T = twist2HomogMatrix(x(1:6, 1));
R = T(1:3, 1:3);
t = T(1:3, 4);
s = x(7);
transformed_poses = s * R * p_W_estimate + t;
e = transformed_poses(:... |
% MAIN - Contact Simulation - Sanity check on rolling solver:
%
% Runs the simulation first with the minimal coordinates solution, and then
clc; clear;
P.m0 = 0.01;
P.m1 = 4.96;
P.I0 = 0.004;
P.I1 = 0.45;
P.g = 9.81;
P.a = 0.14;
P.b = 0.81;
P.r = 0.2;
P.slope = 0.0;
P.dt = 0.05;
DT = 1*[1e-4,1e-3, 1e-2];
% Initial... |
# converts a transformation vector into an isometry
# x: the transformation vector [tx ty theta]
# X: the 3x3 transformation matrix
function X = v2t_2d(x)
X = eye(3);
X(1:2,3) = x(1:2,1);
X(1:2,1:2) = [cos(x(3,1)) -sin(x(3,1)); sin(x(3,1)) cos(x(3,1))];
end |
clear
load test_6U_correct_units_20.mat
y_avg = y_max';
%
newf = 0:1e-6:.5;
for i = 1:80
y_avg(i) = 0 ;
end
skip = 1;
newf = newf(1:skip:20000);
y_avg = y_avg(1:skip:20000);
newf = [newf(1:1000),newf(1001:50:end)];
y_avg = [y_avg(1:1000),y_avg(1001:50:end)];
for i = 1:length(y_avg)
y_avg(i) = round(y_avg(... |
function[coverage] = infection_cascade_mod(G, init_active,p)
n = G.numnodes;
active_nodes = zeros(n,1);
active_nodes(init_active) = 1;
[num, ~] = size(init_active);
newly_active = [init_active, zeros(1, n-num)];
while num > 0
[newly_active, active_nodes, num] = ICM_time_step(G,active_nodes,newly_active,num, p,n);
e... |
function y = myFixpunktIter(g, x_0, N)
y(1) = x_0;
d(1) = 0;
for i = [2: N]
y(i) = g(y(i - 1));
d = abs(y(i) - y(i - 1))
end
end
|
ind = 25;
result = results{ind};
trials = result.trials;
trials = bsxfun(@minus, trials, mean(trials(bl_range,:,:)));
n_segs = size(trials, 3);
man_shifts = zeros(1,n_segs);
figure;
varplot(t, squeeze(trials(u,1,:)))
figure;
for ii = 1:n_segs
plot(t, squeeze(trials(u,1,ii)));
title(num2str(ii))
[x,y] = ginp... |
function Vec = ShiftedDotProducts(F)
% Vec = ShiftedDotProducts(F)
% Inputs: F = a 26 component vector (assumed to be empirical frequencies
% of letters appearing in a ciphertext believed to be acted on by a single
% shift cipher)
% Output: Vec a 26 component vector recording the dot products of F with
% each of the ... |
function output = mcal(action,value)
% Declare a persistent variable to store the current MAESTRO calibration.
% We give this variable the prefix P to indicate that this is the
% persistent variable. The current MAESTRO calibration will always be
% stored here and any function can access the calibration by calling ... |
function varargout = GUI_GRAPH_CONTROL(varargin)
% GUI_GRAPH_CONTROL M-file for GUI_GRAPH_CONTROL.fig
% Edit the above text to modify the response to help GUI_GRAPH_CONTROL
% Last Modified by GUIDE v2.5 17-Feb-2020 17:29:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', ... |
function y = rgb2hsi(x);
x = double(x);
x = x/255;
r = x(:,:,1); g = x(:,:,2); b = x(:,:,3);
% componente H
num = 0.5*((r-g) + (r-b));
den = sqrt((r-g).^2 + (r-b).*(g-b));
theta = acos(num./(den + eps));
H = theta;
H(b>g) = 2*pi - H(b>g);
H = H/(2*pi); % normalizzazione componente H
% componente S
num... |
function LMS = xyz2lms2006( XYZ )
% Transform from CIE 2006 LMS cone responses to CIE 1931 XYZ trichormatic colour values on an LED LCD display.
%
% LMS = xyz2lms2006( XYZ )
%
% XYZ can be an image (h x w x 3) or a colour vectors (n x 3).
%
% Note that because CIE XYZ 1931 and CIE 2006 LMS are based on different
% col... |
function Network2 = ConsNet_Fcn(Network,X)
%%
IW = Network.IW{1,1}; IW_Num = numel(IW);
LW1 = Network.LW{2,1}; LW1_Num = numel(LW1);
LW2 = Network.LW{3,2}; LW2_Num = numel(LW2);
LW3 = Network.LW{4,3}; LW3_Num = numel(LW3);
b1 = Network.b{1,1}; b1_Num = numel(b1);
b2 = Network.b{2,1}; b2_Num = numel(b2);
b3 = Ne... |
%Funcion que realiza el metodo tita utilizando las derivadas
function yprox = Mtita(y,h,tita,tol,maxit)
if tita == 0 %Euler Explicito
yprox = y + h*DerivadaVec(y);
endif
numit = 0;
error = tol+1;
if tita != 0
yprox = y; %Inicializa para método implícito
while ( error > tol && numit < maxi... |
function imgFiltred = wiener_filter(I_noisy,I, sigma, sigma_b)
[M,N,d]=size(I_noisy);
Nr = ifftshift((-fix(M/2):ceil(M/2)-1));
Nc = ifftshift((-fix(N/2):ceil(N/2)-1));
[Nc,Nr] = meshgrid(Nr,Nc);
% TFD de l'image bruitée
tfd_bruitee=fft2(I_noisy);
% TFD de la gaussienne
H=repmat(exp(-2*pi^2*sigma^2.*((Nc/M).^2+(Nr/... |
function [vars] = update_TY_mmx_regT_L2(vars, params) %S, Uc, Ur, X, Y, E
%UPDATE_TY_MMX_REGT_L2 Solves for T. Squared Frobenius penalty, MMX
%
% Mehdi Bahri - Imperial College London
% July, 2016
if params.TIME > 2
tic
end
mu = params.mu;
r = params.r;
alpha_t = params.alpha_t;
Uc = vars.Uc;
Ur = vars.Ur;
Xt = v... |
% q17
close all
clear all
load('I.mat');
figure;
imagesc(I);
axis image
colormap gray
title('Shaded image')
eps = 1E-10;
F = sqrt(1./I.^2 - 1 );
Fe = F + eps * (F == 0);
x0 = [121, 143];
z0 = 0;
z = runFSM(Fe,x0,z0);
z = -z;
z = (z - min(z(:)))/(max(z(:)) - min(z(:)));
figure;
surf(z);
colormap gray
shading... |
% Mirea Teodor-Adrian, 313CA
function reprezentare(image, k, R1, R2, R3, R4)
figure();
% Graficul 1
subplot(2,2,1);
plot(R1);
title_text = strcat("Valorile singulare (imaginea ", image, ")");
title(title_text, 'fontsize', 16);
xlabel('k', 'fontsize', 14);
ylabel('S_{kk}', 'fontsize', 14);
% Gra... |
% Recover all system properties possible from two subsequent trials of a
% cart in free vibration with different known masses attached to it as
% required by problem Q2 in the rectilinear section.
function rect_q4()
% PRIOR KNOWNS:
% Masses of Blocks [kg]:
mb1 = 490.5e-3;
mb2 = 485.5e-3;
mb3 = 240.... |
function [u, angles] = gamma_procedure(u_decomposed)
% param u_decomposed = [u1_x, u1_y, u2_x, u2_y, u3]
% this function maps u_decomposed to its thruster input and angles
% TODO: limit output u to [0,1]?
u1_x = u_decomposed(1);
u1_y = u_decomposed(2);
u2_x = u_decomposed(3);
u2_y = u_decomposed(4);
u(3) = u_decompos... |
% implanted tracks rotation video
fh = open('demo2.fig');
WriterObj = VideoWriter('allenCCFsliceMovie');
WriterObj.FrameRate=30;
open(WriterObj);
nFr = 720;
% design a view trajectory
viewPoint = zeros(nFr,2);
viewPoint(1:360,1) = (1:360)';
viewPoint(361:540,1) = (1:180)';
viewPoint(541:720,1) = (179:-1:0)';
... |
function [output] = hiddenlayer(input,w,b,activation)
net = w*input+repmat(b,[1 size(input,2)]);
if activation == 'tanh'
output = tanh(net);
end
end |
function al_indicateNoise(taskParam, noiseCondition)
% AL_INDICATENOISE This function indicates the noise
% condition
%
% Input:
% taskParam: Task-parameter-object instance
% noiseCondition: High vs. low noise
%
%
% Output:
% ~
if strcmp(noiseCondition, 'lowNoise')
header = 'Genauere Konfetti... |
G_tau = [2 5 10];
dt = [0.05 0.02 0.01];
mean_lumin = 10;
corr_time =zeros(1,10);
for i = 1:3
Tot = 100;
dtau = dt(i); %step width
T = dtau:dtau:Tot;
G = G_tau(i); % damping
w = G/(2*1.06);%w = G/(2w)=1.06;
D = 4; %dynamical range
at = 30;
m = mean_lumin;
L = zeros(1,length(T));
V = zeros(1,length(T));
for t = 1:lengt... |
% Executes whole cell simulation.
%
% Author: Jonathan Karr, jkarr@stanford.edu
% Author: Jared Jacobs, jmjacobs@stanford.edu
% Affilitation: Covert Lab, Department of Bioengineering, Stanford University
% Last updated: 1/9/2011
function sim = runSimulation(varargin)
%parse options
if nargin >= 1 && isstruct(va... |
function normalizeWidthImageRetrieve()
% feature extract: normalize width -> extract
% svm
% show
createDateset=false;
if(createDateset)
root='D:\Program\matlab\CVonlineDataset\101_ObjectCategories';
pathlist1=dir(root);
filenum1=length(pathlist1)-2;
filenamelist1={pathlist1.name};
filenum1=min(filenum1,10);
dataset... |
classdef hop < handle
properties
isrealin
nForward
nAdjoint
nGDObjective
nPFDObjective
nDFPObjective
end % properties
methods ( Abstract )
out = forward(self,x1,x2,scatter)
out = adjoint(self,y,x)
[f,g,V,d] = gdobjective(self,y,k,opts,v)
... |
function [ avg, mean_diff ] = aa( x_mat, b,e )
%UNTITLED Summary of this a goes here
% Detailed explanation goes here
%% data extraction
[time_vector, data_matrix] = data_out(b,e); % extracting data
appart = data_matrix(:,1);
outside = data_matrix(:,2);
room = data_matrix(:,3);
heater_state = data_matrix(:,4);
t_del... |
clc, clear all, close all
save = 1
min_exponent = 3
max_exponent = 6
variance_collection = zeros(1,max_exponent-min_exponent)
for n=min_exponent:max_exponent
%func = @(x) 2*x;
func = @(x) sin(x)/(1-cos(1));
number_samples = 10^n;
accepted_samples = zeros(1,number_samples);
k = 1;
l = 1;
... |
function [M,triTriangle, d] = cubicSpline(x, f, boundaryCond, solver)
% 三次样条插值
% 给定x对应的函数值
% 要求x升序排列
numPoint = length(x);
h = diff(x);
aveErrTable = generateAvegErrTable(x, f);
lambda = zeros(numPoint-2, 1);
mu = zeros(numPoint-2, 1);
d = zeros(numPoint-2, 1);
for j = 1:numPoint - 2
lambda(j) = h(j+1) / (h(j) ... |
%% Exported from Jupyter Notebook
% Run each section by placing your cursor in it and pressing Ctrl+Enter
%% Markdown Cell:
% +++
% title = "3D image registration with procrustes analysis"
%
% date = 2018-04-15
% draft = false
%
% tags = ["MATLAB", "image-analysis", "spines", "neuroscience", "image-registrati... |
%From a stored pointcloud and colors show the model of the teddybear
function triangulate()
load('Teddy/PC')
load('Teddy/PV')
colors = PV.colors;
k = 5;
Max = max(PC,[],2);
Min = min(PC,[],2);
Dif = (Max-Min)/k;
for ii = 1:2
if ii == 1
D1 = Min(1):Dif(1):Max(1);
D2 = Min(2):Dif(2):Max(2);
... |
function shape_rotated = rotateshape(shape,angle_limit)
%ROTATESHAPE Summary of this function goes here
% Rotate input shape randomly
% Detailed explanation goes here
% Input:
% shape: original shape
% Output:
% shape_rotated: rotated shape
anti_clockwise_angle = angle_limit*rand(1);%%original 120
... |
% This code solves the Hank model of Angeletos and Huo (2021, AER)
% Incomplete Information combined with heterogeneity in MPC and Business Cycle Exposure
% Focus on Two Types of Equilibrium:
% 1. Non-degenerate wealth dynamics, no fiscal transfer
% 2. Network model (no wealth dynamics, with fiscal transfer)
% Allow... |
function ret = l_f_copyMEEG(S)
% ret = function l_f_copyMEEG(S.D, S.dirName, S.fileName)
% D: MEEG object,
% optional:
% dirName : target dir,
% fileName: target filename
%
% copy new meeg-object to anaDir:
% CAVE: works for XYT data (3D) only!
% --------------
% ver. 0.1, leo, 7nov12
D = S.D;
if ~isfield... |
function H = FrancisQRStep(H0)
% function H = FrancisQRStep(H0)
% H0 is an unreduced upper Hessenberg matrix.
% H is the upper Hessenberg matrix that results when one step of the
% Francis double implicit shift algorithm is applied.
% GVL4: Algorithm 7.5.1
H = H0;
n = length(H);
if n<=2
return
end
m ... |
%% Run a number of COVID simulations and store results
clear
close all
num_sim = 100;
num_steps = 600;
num_pop = 79205;
dt = 0.25;
time=0:dt:dt*num_steps;
% Number of agents to vaccinate
to_vaccinate = load('input_data/random_v_numbers.txt');
% All the collected data
inf_data = zeros(num_sim, num_steps+1);
new_pos_... |
function binary=en_coef_dc(subcoef,N)
binary=SFcode(N(1)/8,1024); binary=[binary SFcode(N(2)/8,1024)];
fprintf('\nEncoding level 1: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n');
for ia=1:3
subband=subcoef{1,ia};
if max(max(abs(subband)))>0
bin=en_subband_L1(subband);
binary=[binary 1... |
function y = Disfrft(f,a,p)
%
% Computes discrete fractional Fourier transform
% of order a of vector x
% p (optional) is order of approximation, default N/2
%
%
N = length(f); even = ~rem(N,2);
shft = rem((0:N-1) + fix(N/2),N)+1;
f = f(:);
if (nargin == 2), p = N/2; end;
p = min(max(2,p),N-1);
E = dFRFT(N,p);
y(shft,... |
function [c] = YehudiChord(y)
run AircraftData
Yehudi = Vanguard.Wing.Yehudi;
Cr = Vanguard.Wing.Cr;
TaperRatio = Vanguard.Wing.TaperRatio;
b = Vanguard.Wing.b;
if y<=Yehudi
c = Cr;
else
c = Cr*(1-(1-TaperRatio)*2*((y-Yehudi)/(b-2*Yehudi)... |
%% analyze output of greedySearch
% figure out neuron addition path
currBestPop = [];
addedNeuron = [];
for i = 1:numSearchIters
addedNeuron(i) = multisetdiff(bestPopListAll(i).dat, currBestPop);
currBestPop = bestPopListAll(i).dat;
end
finBestPop = currBestPop;
for i = 1:numSearchIters
numNeuronsInBest(i)... |
function Figure2E(flyResp,stimulusInfo,general_parameters)
% This function plots the data in Figure 2E of Agrochao, Tanaka et al.
% (2020) Mechanism for analogous illusory motion perception in flies and
% humans. margarida.agrochao@yale.edu
% The input flyResp has dimensions (number of cell types x number of flies
% i... |
function y = left_mtimes(k, x)
% y = left_mtimes(k, x)
% Helper function for mtimes.m
% k is a kronMatrix object, x is a double (scalar,vector,or matrix)
%
% if x is a scalar, use the property that
% x * kron(A, B) = kron(x * A, B)
%
% if x is a vector such that x = vec(X),
% use the property that
% kron(A, B... |
clc
clear all
close all
file1=input('Enter input filename : ','s');
img=imread(file1);
[r,c,d]=size(img);
img2=zeros(r,c,d,'uint8');
const=2;
for i=1:r
for j=1:c
for k=1:d
h=double(img(i,j,k));
img2(i,j,k)=const*(1+h);
end
end
end
subplot(1,2,1);
imshow(img);
title('Origi... |
hyper_dir = '../dataset/veins_t34bands/train_data/mat/';
dat=dir(fullfile(hyper_dir,'*.mat'));
order= randperm(size(dat,1));
rgb_dir = '../dataset/veins_t34bands/train_data/rgb/';
num = 247;
for i = 1:size(dat,1)
% load mat file
mat = [hyper_dir dat(order(i)).name];
rad = load(mat,'rad');
rad ... |
function fullPath = create_subfolder_by_date(storedFolder)
folderName = ['/',storedFolder,'/',datestr(now, 'yyyy-mm-dd')];
currentFolder = pwd;
fullPath = fullfile(currentFolder, folderName);
if ~exist(fullPath, 'dir')
% Folder does not exist so create it.
mkdir(fullPath);
end
end |
%Initialization
clc;
clear;
close;
%We get the input image
%Just insert image to process
Original_image = imread('IR_0100.png');
%Segmentation part to extract only the body
%If the image is not a greyscale image we transform it
[~, ~, numberOfColorChannels] = size(Original_image);
if numberOfColorChannels > 1
Grey... |
function [MeanValues] = UpdateMeans(ImageArray,k,clusters)
% UpdateMeans calculates the mean RGB values of each cluster
% Inputs: ImageArray = a 3D array (m rows, n columns, 3 layers)
% representing a RGB coloured image
% k = the number of clusters that are there
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Copyright (C) 2016 N. Eamon Gaffney
%%
%% This program is free software; you can resdistribute and/or modify it under
%% the terms of the MIT license, a copy of which should have been included with
%% this program at https://github.com/... |
clc,clear
a = [0.1 5 5000 4.7
0.2 6 6000 5.6
0.4 7 7000 6.7
0.9 10 10000 2.3
1.2 2 400 1.8
];
[m,n] = size(a);
x2 = @(qujian,lb,ub,x)(1-(qujian(1)-x)./(qujian(1)-lb)).*(x>=lb & x<qujian(1))+(x>=qujian(1)&x<=qujian(2))+(1-(x-qujian(2))./(ub-qujian(2))).*(x>qujian(2)&x<=ub);
qujian=[5,6];lb=2;ub=12;
a(:,2... |
function PopSolutionMatrix = callHeuGA(thisInsData, Arg)
%callHeuGA 调用GA算法
% 输入
% thisInsData Ga输入算例
% Arg Ga算法参数
% 输出
% PopSolutionMatrix - 已计算Fitness的所有迭代种群Array 行:迭代数; 列:种群数;
%% function callHeuGA(thisInsData, Arg)
% Nested Functions:
% # getNewPopArray GA迭代主体
% Local Funct... |
%% Take a slice at constant elevation, sweep over azimuth and time of year.
AU = 1.496e11;
Re = 6371000;
Tnd = 365.25*24*60*60/(2*pi);
muSE = 3.036e-6;
dt = (3600/Tnd); % 1 hour steps.
yScopeInit = [1.00717285919175; 0; 0; 0; 0.0163636; 0];
tspan = 0:(3600/Tnd):3.2; % ~6 mos, time for scope to stay on-target
%tsp... |
%hvsum - issue 2.0 (24/05/06) HVLab HRV Toolbox
%----------------------------------------------
% function [outdata] = hvsum(indata1, indata2)
% Return the sum of two data structures, or of a data structure and constant values
% outdata = new workspace data structure array containing the results
% ... |
function pointStressList = calculatePointStress(stressList,supportDomainMap)
pointNum = size(supportDomainMap, 1);
pointStressList = zeros(pointNum, 3);
for i = 1 : pointNum
currentSupportingNodes = supportDomainMap{i, 1};
currentSupportingDomain = supportDomainMap{i, 2};
stress = st... |
function avetrialAlign_plotAve_noTrGroup_licks(evT, outcome2ana, stimrate2ana, strength2ana, outcomes, stimrate, cb, alldata, alldataDfofGood, alldataSpikesGood, frameLength, nPreFrames, nPostFrames, centerLicks, leftLicks, rightLicks, excludeLicksPrePost)
% Align ca imaging traces (and wheel traces) on center, left a... |
function [blockedrxnsList, blockedrxnsList_ids] = findBlockedRxns(model)
% blocked reactions are defined as those unable to carry flux when either
% maximized or minimized. Therefore total number of optimisations will be
% 2xN where N is the number of the reactions in the network
% the code is very simialr to that ... |
function out = set(name, value)
% dj.set - display, get, or set a DataJoint setting
%
% USAGE:
% dj.set - view current settings
% v = dj.set('settingName') - get the value of a setting
% oldValue = dj.set('settingName', value) - set the value of a setting
% dj.set('restore') - restore defaults
persisten... |
function gx = Density_FB4_Gy(kappa,gamm,varargin)
% DENSITY_FB4 Calculates and plots Fisher-Bingham_4 density
%
% gx = Density_FB4(kappa,gamm,Mu,resolution)
%%
% Examples of correct usage:
%
% kappa = 4.2;
% gamm = -3.5;
%
% Mu=[0 0 1];% Mu=[1 -1 1] ;% Mu=[0 -1 1];
% resolution=100;
%
% Examples of corr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.