text stringlengths 8 6.12M |
|---|
function [critical_shear_velocity,taocr,S] = shieldsmodbonlay(rhom,diam,rho,viscocine)
% _______________________________________________________________
% This routine gets the critical shear velocity and critical bottom shear stress for initiation of motion.
%
% 0. Syntax:
% [critical_shear_velocity,taocr] = shie... |
function y=gety(x)
global xmean xsd
covx=xsd./xmean;
for i=1:length(x)
kexi=sqrt(log(1+covx(i)^2)) ;
lamda=log(xmean(i))-0.5*kexi^2;
y(i)=(log(x(i))-lamda)/kexi;
end
|
%bacic fct.m
N=20; mtime=[0:N-1];
impuls = eye(1,N); %unit pulse
untstep=ones(1,N); %unit step
f0=.1; fsin=sin(2*pi*f0*mtime) %senosoidal
P=3; tps2=[-N:N]; %2P+1 sample rect
porteP = [zeros(1, N-P) ones(1,2*P+1) zeros(1,N-P)] ;
subplot(221); plot(mtime,impuls, 'x')
subplot(222); plot(mtime,untstep, '... |
function [ t_s, ux_mps, uy_mps, r_radps, s_m, e_m, delta_psi_rad, Fx_total, delta_steer ] = proj_nonlinear_sim(C_alphaf, C_alphar, u_f,...
u_fs, u_r, u_rs, m,Iz, L, s, k, percent_front, percent_rear,...
Kla, xla, k_vel, e0, ux0, vx_prof, ax_prof, k_accel, f_rr, C_DA)
%UNTITLED Summary of this function goes here... |
function [ analysis ] = inspect_experience(varargin)
startstep = 150;
data = load('../kesh/experiments/all.mat','xids');
kwargs = utils.dict(varargin{:});
xids = kwargs.get('xids',2);
for x=xids
for g=1:2
varrs1a1 = [];
varrs1a2 = [];
avgvrs1a1 = [];
avgvrs1a2 = [];
errvrs1a1 = [];
... |
function e=caughtSpeeding(speed, birthday)
% Returns 0 for no ticket, 1 for small ticket and 2 for big ticket
% Taha Bakhtiyar 5/2011.
if (birthday == true)
speed = speed - 5;
end
if (speed<=60)
e=0;
elseif (speed>60 && speed<=80)
e=1;
else
e=2;
end
end |
function [d,CF] = solve_linear_system(H,mu,A,b,c,tau,kappa,r1,r2,r3,r4,r5,pars)
%Calls the C code that solves the linear system
%Debug flag
print_t = false;
print_c = true;
%Get the size of the problem
[m,n] = size(A);
%Set up the pointers to call the solver
%int solve_kkt_system_no_structs... |
%% Drawdown in the well.
% This demonstrates the interpretation of a Drawdown in the well
% with well-bore storage effect with Papadopulos and Cooper (1967) solution
%
% MIT License
% Copyright (c) 2017 Philippe Renard - University of Neuchâtel (CHYN)
%%
% The data set for this example comes from the following refer... |
function str= char(epb)
% CHAR Convert an embededprogressbar object in a char for display
str = [
epb.String, ...
' ',num2str(fix(epb.Value*100)),'% done.',...
];
end % main function |
clear all
close all
% initialize
rosshutdown % to 'close' any previous sessions
rosinit('172.16.144.132'); % initialize Matlab ROS node
tbot = turtlebot % the data structure that allows access to the turtlebot and its sensors
% these are the variables that are used to define the robot velocity
lin_vel... |
function filepath = searchFor(query, searchPath, k, maxLevels)
%SEARCHFOR Searches for a specified file within a directory recursively.
% Usage:
% filepath = searchFor(query)
% filepath = searchFor(query, searchPath)
% filepath = searchFor(query, searchPath, k)
% filepath = searchFor(query, searchPath, k,... |
%%
% This is an example of how to create an line plot from a function in MATLAB®.
%
% Read about the <http://www.mathworks.com/help/matlab/ref/ezplot.html |ezplot|> function in the MATLAB documentation.
%
% For more examples, go to <http://www.mathworks.com/discovery/gallery.html MATLAB Plot Gallery>
%
% Copyrigh... |
function [xl,xu,fxl,fxu,xr,fxr,ea,noOfIterations] = falsePosition (f,Xl,Xu,es,maxIterations)
F= inline(f,'x');
xl(1)=Xl;
xu(1)=Xu;
if F(xl(1))*F(xu(1))>0
xr(1)=0;ea(1)=100;noOfIterations=0;
warning('Please check your range reason: F(Xl)*F(Xu)>0');
return
end
for i=1:1:maxIterations
xr(i) = (xl... |
seg_p = [];
for i = 1 : size(seg,1)
seg_p(i) = seg(i).p;
end
indx = roulette(seg_p);
sprintf('moving to the segment %d to search',indx);
squirrel1.move2Seg(indx(1),1000);
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% 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:/... |
function [dat,gabortex] = stimulus_setup(dat,w)
%
% define features of experimental stimulus
% SCREEN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dat.scr.cm2pix = dat.scr.widthPix/dat.scr.widthCm; % conversion for cm to pixels
dat.scr.pix2deg = 2*ata... |
function n = apply(z,S,Q,param,arrayType)
%NETPROD.APPLY Combined weighted inputs into net input
% Copyright 2012-2015 The MathWorks, Inc.
if isempty(z)
% No inputs
if (nargin < 5)
arrayType = 0;
end
n = ones(S,Q,'like',arrayType);
else
% Combine inputs
n = z{1};
for i=2:lengt... |
%% Load file
root_path = 'C:\Users\Virginia Casasnovas\Documents\Virginia\Data\MINISCOPES\HeadFreeTreadmillMiniscope\';
addpath(genpath(root_path));
raw_folder = 'TM RAW FILES';
tracking_folder = 'TM TRACKING FILES';
processed_folder = 'TM PROCESSED FILES';
registered_folder = 'TM PROCESSED IMAGING FILES';
segme... |
t = [1 2 2 2 2 3 7 10 20 30 30];
median(t)
n=hist(t,1:50);
n_elements = histc(t,1:50);
c_elements = cumsum(n_elements);
bar(1:50,c_elements);
ta = sum(c_elements);
cum = c_elements(1);
for a=2:50
if cum>ta/2
zn = a;
break;
end
cum = cum+c_elements(a);
end
c_elements(zn) |
%% Generate the data.mat with open price @0945
% replace open price by 09:45 price
NUVpath='C:\Users\Langyu\Desktop\Dropbox\GU\1.Investment\Data\NewUniverse\';
Intradaypath='C:\Users\Langyu\Desktop\Dropbox\GU\1.Investment\Data\EODData\MatlabFormat\15mins\';
load(strcat(NUVpath, 'NUV.mat'));
load(strcat(Intradaypath, ... |
function [Q,Uf_0] = NLForceNewtonRaphson(Pf,Bi,Bx,M,C,Uflast3,dt,Qx)
% calcualte the element forces to minimize the difference between Bx'*V
%
% written by T.Y. Yang 2009/08/23
% extract the displacement history
U_1 = Uflast3(:,end);
U_2 = Uflast3(:,end-1);
U_3 = Uflast3(:,end-2);
tol = 1e-10;
residual = 1... |
function [err] = lin_conv_2D(SBP,dx,eqntyp,spd_a,form,tf)
close all
% Input arguments
if nargin<1
SBP.p = 3; SBP.type = 'omega'; % SBP operator info
end
if nargin<2
dx = 1/12; % Mesh spacing
end
if nargin<3
eqntyp = 'const_lin_conv'; % Problem to solve
end
if nargin<4... |
%% A trial
% Must under the initiliaztion of {run.m}
%% Set the priority
Priority(top_priority_level);
%% Initilize getters
% position_id (1 for green at left and 2 for orange at left);
pos_id = condition_seq(1, i_trial);
% Bonus
bonus_green = condition_seq(2, i_trial);
bonus_orange = condition_seq(3, i_trial);
%... |
% Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
% z=phi(x)
%
% Calculates the normal distribution and returns the value of the
% integral
%
% z=int((1/sqrt(2*pi))*exp(-t^2/2),t=-infinity..x)
%
% Input Parameters:
% x - endpoint of integration (scalar)
%
% Ou... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
Theta1 = reshape(nn_params(1:hidden_layer_size * (input_layer_size + 1)), ...
hidden_layer_size, (input_layer_size + 1));
Theta2 = reshape(nn_params((1 + (hidden_layer_size *... |
close all, clc, clear all;
Num_in = 128;
p_vec = [1:Num_in];
U = 64;
n = [10;50;100];
p_discrete = [8,16,32,64,128];
C_fp = 6 .* n * p_vec;
C_fp_discrete = 6 .* n * p_discrete;
C_fp_SISO = 2.*n *(p_vec.^2 + 2);
for i = 1:3
L_fp(i,:) = C_fp_discrete(i,:) .* 1./[185 139.63 110 76 46];
end
L_fp_SISO = C_fp_SISO ./ 4000;
... |
function fnval = fhn_fun(times,y,p,more)
r = y;
r(:,1) = p(3).*(y(:,1) - (y(:,1).^3)./3 + y(:,2));
r(:,2) = -(y(:,1) - p(1) + p(2).*y(:,2))./p(3);
fnval = r;
end
|
function [new_alleles recombination error] = reassign_segments(assignment, family, parameters)
error = 0;
new_alleles = [];
recombination = [];
[alleles_all, intervals, error] = check_allsegments(assignment, family);
if( error ~= 0 )
disp('error in processing global IBD');
return;
end
disp(['family ', num2st... |
%%%Random Weight Matrix (asymmetric & symmetric)
%%%In this version, patterns are established in accordance to pictures.
clear, clc
pict
xd = [p11; p22];
[ndistorts, units] = size(xd);
%%%Learn
w = normrnd(0 ,1 ,units, units);
%w = 0.5 * ( w + w' ); %[Change]Make the weight matrix symmetric
ed_ini = ... |
clear
clc
addpath(genpath('./tensor_toolbox'));
addpath(genpath('./FOptM'));
rng(5489, 'twister');
m = 6;
n = 5;
k = 4; % rank for tensor
%%
m = 10;
n = 10;
k = 10; % rank for tensor
[X, Z, Y] = tBNE_data(m, n, k); % generate the tensor, guidance and label
[T, W] = tBNE_fun(X, Z, Y, k);
[~, y1] = max(Y, [], 2);
[~... |
classdef CocoEval < handle
% Interface for evaluating detection on the Microsoft COCO dataset.
%
% The usage for CocoEval is as follows:
% cocoGt=..., cocoDt=... % load dataset and results
% E = CocoEval(cocoGt,cocoDt); % initialize CocoEval object
% E.params.recThresholds =... |
fname = [];
fname = fcheckexist(fname,'*.dat');
csvfile = fcheckext(fname,'csv');
[expinfo,chaninfo,mLog] = readcsv(csvfile);
Nsamples = chaninfo(1,6);
Fsample = chaninfo(1,5);
Ntrial = ... |
function v=getgame(hd,n);
% GETGAME computes a game from the unanimity coordinates hd
%
% Usage: v=getgame(hd,n)
% Define variables:
% output:
% v -- A TU game of size 2^n-1.
% input:
% hd -- The harsanyi dividends.
% n -- The number of player involved (optional)
%
%
% Author: Holge... |
function g = gravity_acceleration (phi, p)
%
% function g = gravity_acceleration (phi, p)
% ACHTUNG phi is in radians
%
if (nargin == 1)
p = 0;
end
sin_phi = sin (phi);
sin2_phi = sin_phi .* sin_phi;
pg = [2.3462e-5, 5.278895e-3, 1];
g = 9.7803185 * polyval (pg, sin2_phi) + 1.092e-6 * p;
|
%生成【integration of shape from shading and stereo】的傅里叶频率域
function [freq] = frequency(S,fl)
freq = zeros(1, S);
for i = 1: S/2
freq(i) = -0.5 + i/(S * fl);
freq(i + S/2) = i/(S * fl);
end
|
clear
clc
LUnit = 6378; % 单位 km
deg = pi/180;
mu = 398600;
theta0 = 160*deg; %约束可观测的真近角范围
thetaf = 205*deg;
% 初始轨道参数(经典轨道根数坐标系下)
hp0 = 300;
ha0 = 42000;
a00 = (ha0+hp0)/2+LUnit;
e00 = (ha0+LUnit)/a00-1;
inc00 = 51*deg;
omega00 = 11*deg;
w00 = 225*deg;
theta00 = theta0;
coe0... |
%helper function for constructing a decision tree recursively
function [ new_tree, new_slot ] = DT_recursive2(X, Y, feat_idx, tree, slot, c)
%DT_RECURSIVE A recursive decision tree algorithm
% This function calculates the sub tree of the whole decision tree rooted
% at the current splitting node
% X Txd the trai... |
%% tinyWorld Demo
% Demonstration for tinyWorld Neuroevolution system.
% Features:
clear; clc
x = NeuroEvolution;
% ------- Saving/Visualization Variables -------
x.saveFile = 'tinyWorld';
x.visualize = 'no';
subPop = 'yes';
subPopProp = 0.95; % changing this value to 0.80 generated a non-string error on one o... |
%# data
% t = linspace(0,8*pi,200);
% x = 20*t; y = cos(t); z = sin(t);
%
% %# plot 3D line
% plot3(x,y,z)
% axis tight, grid on, view(35,40)
% c = 1:numel(t); %# colors
% h = surface([x(:), x(:)], [y(:), y(:)], [z(:), z(:)], ...
% [c(:), c(:)], 'EdgeColor','flat', 'FaceColor','none');
% colormap( j... |
function [gam,Final_E] = DynamicProgrammingQ_1(h1_SO,h1_R,h2_SO,h2_R,Rot1,Trans1,Rot2,Trans2)
N = size(h1_R,2);
M = size(h2_R,2);
Nbrs = [1 1; 1 2; 2 1; 2 3; 3 2; 1 3; 3 1; 1 4; 3 4; 4 3; 4 1; 1 5; 2 5; 3 5; 4 5; 5 4; 5 3; 5 2; 5 1; 1 6; 5 6; 6 5; 6 1];
% 1 7;2 7;3 7;4 7;5 7;6 7;7 6;7 5;7 4;7 3;7 2;7 1;1 ... |
%@(#) cprmod.m 1.4 05/12/08 13:18:31
%
%
%function [CPRMOD,straff]=cprmod(indatafil);
%
% Input: Indata file which contains specification of buntyp-
% characteristics wrt mean and stand.dev. of box bowing and
% an EOFP-distr.file with appropriate burnup levels.
%
% Output1: Vectors with CPRMOD and ... |
function plot_settings(fig)
%% Set default sizes for plotting, so that all plots are consistent.
% :param fig: The current figure
% :return: none
%
% Created by: Lee A. Harrison
% On: 6/19/2018
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MAT... |
%M: Measurement vectors. It must be a column vector.
%P: Stations coordinates. It must be a matrix of [numstations x 3].
%xg: Guess point. It must be a row vector.
%lambda2: Tikhonov regularization parameter
function [xg xgg xggr errorr jt sig1 sig2 sig3]=taylorTDOA_2D_23022011(M,P,xg,NC,ref_station)
jt=0;
erro... |
% measuring time for stochastic method
clear all;
close all;
clc;
load('~/Dropbox/Bachelor_Project_Hanieh_Soleimani/covariance/') ;
matrices = {
'covMatrix_51_2_4.mat' ; 'covMatrix_51_3_5.mat' ; 'covMatrix_51_3_3.mat' ; 'covMatrix_51_4_5.mat' ; 'covMatrix_51_3_4.mat' ;
'covMatrix_81_2_... |
function y = init_cost_no(n,d) %% n: new sequence --> column vector, d: is delays due to breakdown
global start_schedule
new_schedule = constructingschedule(n,start_schedule); %% constructing schedule for the new sequence.
comput = 50; %% Computational cost rate.
tard = 12; %% Tardiness cost --> assumed c... |
fx = @(x) sin(x)-cos(x);
tol = 10^-6;
a = 0;
b = 1;
if (fx(a) * fx(b) > 0)
disp("No zero can be determined according to IVT");
return
end
while (abs(a-b) > tol)
c = mean([a, b]);
if (fx(c)*fx(a) < 0)
b = c;
else
a = c;
end
end
fprintf('%10.6f\n',c);
|
function [result] = executeVinay1(data)
for i = 1:length(data.Distances())
result(i,1:2) = solver_murphy_1(data.Distances(i,1:3),data.AnchorPositions(1:3,1:2))';
end |
#!/usr/bin/octave -qf
if (nargin!=3)
printf("Usage: multinomial_suavizado_competicion.m <data_filename> <init> <fin>");
exit(1);
end
arglist=argv();
datafile=arglist{1};
init = str2num(arglist{2});
fin = str2num(arglist{3});
disp("Loading data...");
load(datafile);
disp("Data load complete.");
#te=testDATA; #test AQUI ... |
function h = normIVMRecoveryError(model)
global prol3IVMp;
%normalize wrt the final point in the control
experiment=struct();
experiment.conditions={0,25,25};
experiment.globals=struct('A',100e-6,'J',3e-6,'IVMon',4.6,'IVMoff',10.6);
function err=sse(x)
setGlobals(experiment.globals);
... |
function dzdt = HL_odefile(t,z,parstr)
y=parstr.y;
k=parstr.k;
u=parstr.u;
n_Transcripts=4;
n_Promoters=8;
Y=reshape(y,n_Promoters,n_Transcripts);
Y=Y';
IPTG=u(1);
aTc=u(2);
tetR=z(1);
lacI=z(2);
cI=z(3);
araC=z(4);
lacIIPTG=z(5);
tetRaTc=z(6);
K_Plac1=k(1);
K_Plac2=k(2);
K_Plac3=k(3);
K_Plac4=k(4);
K_Plambda=k(5... |
function [npcp] = npcp(wav, fs, fftSize, window)
%
% USAGE
% [npcp] = npcp(wav, fs, fftSize, window)
%
% INPUT
% vector of wav samples
% fs : sampling frequency
% fftSize: size of fft
% window: a window of size fftSize
%
% OUTPUT
% normalized pitch class profile
N = fftSize;
w = window;
K = fft... |
function [isBackground] = cellIsBackground(spectrum, normalizedBG)
% Assumes that both spectrum and normalizedBG are ALREADY NORMALIZED
spectrum = squeeze(spectrum);
[bgs, ~] = size(normalizedBG);
smallestError = Inf;
for index = 1:bgs
% Attempt simple point-by-point subtraction-summation
error = abs(spec... |
function [seriesNino, ninoFilt] = calcnino34(Yr,Mth,X,Y,varN)
%Calculate Nino 3.4 index using recipe from
% https://climatedataguide.ucar.edu/climate-data/nino-sst-indices-nino-12-3-34-4-oni-and-tni
% Nino X Index computation: (a) Compute area averaged total SST from Niņo X region;
% (b) Compute monthly climatology ... |
function varargout = InterfaceI(varargin)
% INTERFACEI MATLAB code for InterfaceI.fig
% INTERFACEI, by itself, creates a new INTERFACEI or raises the existing
% singleton*.
%
% H = INTERFACEI returns the handle to a new INTERFACEI or the handle to
% the existing singleton*.
%
% INTERFACEI('CALL... |
function varargout = circleMesh(circle, varargin)
%CIRCLEMESH Create a mesh defined by a 3D circle.
%
% [V, F] = cylinderMesh(CYL)
% Computes vertex coordinates V and face vertex indices F of a mesh
% representing a 3D circle given as [xc yc zc R theta phi psi].
%
% [V, F] = cylinderMesh(..., NAME, VALUE);
% ... |
function stats = getStats(ptf, bench, p, ACWI, Index)
% getStats computes all statistics on the portfolios.
% Inputs: * ptf = [strcut] contains all portfolios
% * bench = [strcut] contains all benchmarks
% * p = [struct] contains all parameters
% * ACWI = [strcut] contains all the data
... |
function saveSettings(filename, nB, tau, nA, K, n, tol, algorytm_uczacy, tryb_uczenia)
%%funkcja zapisujaca ustawienia pliku sieci.exe do pliku ustawienia.txt
fileID = fopen(filename, 'w');
fprintf(fileID, "%d %d %d %d %d %d %d %d", nB, tau, nA, K, n, tol, algorytm_uczacy, tryb_uczenia);
fclose(fileID);
end... |
function kl=klocking(rates)
%
% Copyright 2007-2015 Cornell University All Rights Reserved.
% Initialize rate values
kCH1 = rates(1);
kH1C = rates(2);
kH1H2 = rates(3);
kH2H1 = rates(4);
kCH2 = rates(5);
kH2C = rates(6);
kCB=0.05;
kCPB=0.05;
kH1B=0.05;
kH1PB=0.05;
kH2B=0.05;
kH2PB=0.05;
kBC=10;
kBH1=10;
kBH... |
function [ names , onsets , durations ] = SPMnod( DataStruct )
%SPMNOD Build 'names', 'onsets', 'durations' for SPM
try
%% Preparation
% 'names' for SPM
switch DataStruct.Task
case 'EyelinkCalibration'
names = {'EyelinkCalibration'};
case 'Calibration'... |
function tagPos = trilat2d_geometrical_method(P1, P2, P3, DistA, DistB, DistC)
% P1 = [xA; yA; zA];
% P2 = [xB; yB; zB];
% P3 = [xC; yC; zC];
%% Transformation
% from wikipedia https://en.wikipedia.org/wiki/Trilateration
% transform to get anchor 1 at origin
% transform to get anchor 2... |
function plotPoint(x)
plot(x(2), x(1), 'r+');
|
function pred = svmPredict(model, X)
% Description: Returns a vector of predictions using a trained SVM model
%
% Parameters: X - mxn matrix where there each example is a row
%
% Y - column matrix containing 1 for positive examples
% and 0 for negative examples.
% m... |
%{
Funcao para realizar merge de clusters num individuo.
Recebe: individuo (matriz), dados;
Retorna: individuo e tempo gasto.
Para saber quais clusters serao fundidos, precisa calcular aptidao de cada
cluster com seu cluster mais proximo. A melhor fusao sera escolhida.
Lista de saida:
elemento 1: individuo
elemento ... |
function [] = sim_two_drugs_effects()
%SIM_TWO_DRUGS_EFFECTS simulates the co-dosing of two drugs that act
%independently on the cell cycle and apopotosis and calculates the level of
%synergy
%% DEFINE UNTREATED CELLS
%defien cell cycle rates
tG1=13; tS=20; tG2=5; tM=4;
%calculate transition rates for cell cycle tran... |
function x = conjgrad(A, b, tol, maxit, M, dummy, x0)
flag = 0;
normb = norm(b);
tolb = tol*normb;
if nargin < 7
x = zeros(length(b), 1);
else
x = x0;
end
r = b - A(x);
z = M(r);
p = z;
gamma = r'*z;
for i = 1 : maxit
Ap = A(p);
alpha = gamma /... |
%% Hearing aid problem
clear, clc, close all
T = 1/22.05e3; % sampling time in seconds
f = 1e3*[0.1 0.5 1 2 3 4 5 6 7 8 9 10]; % in Hz
A = [0 0 0 -10 -12 -17 -22 -29 -34 -39 -47 -50]; % in dB
figure, plot(f, A)
%% |
function flag = check_stable( y1, y2 )
abs_tol = 10^-4;
rel_tol = 10^-4;
% mode = 'crude';
%
% switch mode
% case 'precise'
% abs_tol = 10^-5;
% rel_tol = 10^-5;
% case 'crude'
% abs_tol = 10^-4;
% rel_tol = 10^-4;
% case 'more crude'
% abs_tol = 10^-3;
% re... |
function node_number = dwt2_to_graph( tree, D, save_file )
% Save wavelet transform for INLA
% Write the coefficients in a wavelet transform along with the
% corresponding node in the wavelet tree.
%
% Syntax:
% node = dwt2_to_graph( tree, D, file )
%
% Input:
% tree : Output from DWT2_TO_TREE
%
% D : Directi... |
% reproduce Adult communities for spiking test, when six phenotypes could
% mutate. Modified to use multinomial distribution to draw number of cells
% comm_select: Adults to be reproduced
% const_struct: a structure to pass constants
% parentnum: the rank of the Adult community
% spike_frac_M: matrix specify the spi... |
function r = getGlobalx
global x
r = x; |
function generate_heatmap_of( target_root, output_root, heatmap_root, method,visulize_heat)
%generate_heatmap_of creat a heat map for target set and output set
% target_root : directory of all the target images (GT)
% output_root : directory of all the output images (generated)
% method : the method for compute d... |
clear
ybar = cell(1,2); dt = [0.001 0.0001];
error = cell(1,2);
for i = 1:length(dt)
time = 0:dt(i):50;
input = u(time);
y = out(time,input);
ybar{i} = least_squares_parametric(y,3,2,0.4,dt(i),2);
end
for i = 1:length(dt)
time = 0:dt(i):50;
input = u_test(time);
y = out(time,input);
erro... |
function [a,b,c] = getABC(p1,p2)
% 通过两点确定直线的标准方程a*x+b*y+c=0
% p1,p2 1*2 double 表示点
% 若返回值是矩阵,那么矩阵为1*3 double,表示a,b,c三个值
% 若返回值是三个数,其分别表示a,b,c三个值
% Author A.Star
% e-mail : chenxiaolong12315@163.com
% 2017-5-30
a = p2(2) - p1(2);
b = p1(1) - p2(1);
c = -a * p1(1) - b * p1(2);
if nargout == 1
a =... |
function An = Normalize_Similarity_2(A)
% An = D^{-1/2} A D^{-1/2}
% where D = diag(sum(A))
d = sum(A);
An = bsxfun(@rdivide, bsxfun(@rdivide, A, sqrt(d)+eps), sqrt(d)'+eps); |
function [intel] = analysis_HASPI(x, y, varargin)
%% DESCRIPTION:
%
% Wrapper for Jim Kates' intelligibility and quality
% index. When written, CWB intended to call this from analysis_Hagerman,
% which takes care of a lot of the logistical crap (like file matching,
% temporal alignment, etc.). So this isn't a t... |
%function [ dfds ] = prob_transf(s,f,lambda_DG,gm)
function [ dfds ] = prob_transf_back(s,f,plf_s,plf,lambda_DG )
% This function attempts to solve the change of variable ODE
% for a pdf i.e. http://en.wikipedia.org/wiki/
% Probability_density_function#Dependent_
% variables_and_change_of_variables
%
% i.e given df/ds ... |
function img = hack_pca(filename)
% Input: filename -- input image file name/path
% Output: img -- image without rotation
img_r = double(imread(filename));
% YOUR CODE HERE
% show original img
figure;
imshow(uint8(img_r));
% find pixel which is not backgound
[img_row, img_col] = find(img_r < 255);
% pca
[eigve... |
function [dt, dim] = getArgDataType(arg)
dt = '';
dim = 1;
if isfield(arg, 'type') && strcmp(arg.type, 'array access')
[dt, dim] = Lus2SLXUtils.getArgDataType(arg.array);
elseif isfield(arg, 'datatype')
if isstruct(arg.datatype)
if isfield(arg.datatype, 'kind')
... |
%% ctrldesign
% 2021/9/29 Shirato, Miyoshi
% 2021/10/11 Sakai: PIDとdistを統合(model2hdrを使う関係で)
%
% このファイルについて:
% identification_chirp.mで同定した結果を使う
% 1. 極配置でPID, PD制御器を設計
% 2. 外乱オブザーバに使うローパスフィルタを設計
clear;
close all;
s = tf('s');
Ts = 1/1000;
% Gnominal = トルク指令値[Nm]から位置[rad]までのノミナルモデル
% identification_chirp.m の同定結果(注: 速度ま... |
function y = decimaltobinary(n)
y_1 = [];
aux = n;
if (n==0)
y_1 = [y_1, 0];
else
while n >= 1
y_1 = [y_1, mod(n,2)];
n = floor(n / 2);
endwhile
endif
if(aux <= 1)
y_1 = [y_1, 0];
y_1 = [y_1, 0];
elseif(aux <= 3)
y_1 = [y_1, 0];
endif
y = fliplr(y_1);
endfunction
|
% Computer Integrated Surgery, EN.600.445
% Alperen Degirmenci, Saumya Gurbani
%
%
% Driver for Programming Assignment 3
% Required files (listed alphabetically):
%
% closestPointOnMeshLinear.m - calculates closest point using a simple search
% closestPointOnMeshLinearBounding.m - like above, but with a bound... |
function [ FEN, centroidList ] = pieceClassification( board, grayBoard ) %#ok<*NODEF>
centroidList = [];
FEN = cell(8);
FEN(:, :) = {'.'};
board = double(board); % Convert to double if not done already.
%% Load/setup pawn data.
load('data/bPawn.mat')
load('data/wPawn.mat')
bRedStd = std(bPawn(:, 1));
bGreenStd = std... |
classdef control_set_default_nans_test < matlab.unittest.TestCase
%INSPECTLAYOUTSTEST Summary of this class goes here
% Detailed explanation goes here
properties
layout
end
methods(TestMethodSetup)
function setFolders(testCase)
% Add the relevant folders to the current ... |
function [magnitude, orientation] = gradmad(img, sigma)
% Create the Gaussian derivatives kernels
G_x = gaussianDer(gaussian(sigma), sigma);
G_y = G_x';
% We convolve the image
id = [zeros(1, 3*floor(sigma)) 1 zeros(1, 3*floor(sigma))];
% Convolve the input image with these kernels; compute the magnitude and
% th... |
function [y]=delta6j(a,b,c)
%this function calculates delta(abc) for the 6j wigner symbol
%use gamma function instead of factorial in case of half integers
A=gamma(a+b-c+1);
B=gamma(a-b+c+1);
C=gamma(b+c-a+1);
D=gamma(a+b+c+1+1);
y=sqrt(A*B*C/D);
end
|
clear all
clc
%% outline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
load Mat_en_XP_anntest_cluster3_20.mat
ite=10000;
re=dat_En_pr;
si=out_si_pr_en_new;
ind=find(abs(si-re)>0.01);
mat_en_stat(:,1)=fun_static_err_v4(dat_En_tr,out_si_pr_en);
mat_en_stat(:,2)=fun_static_err_v4(re,si);
clf
h=... |
TorqueAndVelocity=[0.22495656 -2.39808239
0.22495656 -1.774580968
0.22495656 -1.055156251
0.22495656 -0.263789063
0.22495656 0
0.22495656 0.599520597
0.22495656 1.29496449];
PWM=[-300
-200
-100
0
100
200
300];
UpperTorqueConstant = TorqueAndVelocity(1:4,1:2)\PWM(1:4,1)
BottomTorqueConstant = TorqueAndVelocity(5:7,1:2... |
function [param fval history] = run_SMM_ehail(p0,C_IN,true_mom,S,Q,PI,U,eta,Perm,flag,print_flag,iter)
history.param = [];
history.fval = [];
options = optimset('OutputFcn', @outfun, 'Display', 'iter', 'PlotFcns', @optimplotx, 'MaxIter', iter);
N = size(C_IN,1);
T = 144;
full_S = ... |
function x = LU_imp(A,b)
% input:
% A = macierz
% wektor prawej strony
v = length(b);
[m,n] = size(A);
if m ~= n, error('Matrix musi by? kwadratowa'); end
U=zeros(m);
L=zeros(m);
%init
for i=1:m
L(i,i)=1;
end
for i=1:m
U(1,i)=A(1,i);
end
for i=2:m
for i=1:m
for k=1:i-1
s1=0;
... |
classdef Probable_Operation < Scheduled_Operation
%PROBABLE_OPERATION Klasse aller Geräte mit statistisch verteilten Einsatz
% PROBABLE_OPERATION repräsentiert all jene Geräte, deren Einsatz durch
% eine statistische Verteilung charakterisiert ist, aber eine konstante
% Eingangsleistung während des Betr... |
function net = network(varargin)
%NETWORK Create a custom neural network.
%
% <a href="matlab:doc network">network</a> without arguments returns a new neural network with no
% inputs, layers or outputs.
%
% <a href="matlab:doc network">network</a>(numInputs,numLayers,biasConnect,inputConnect,layerConnect,
% outputC... |
classdef BigramFinder < NGramFinder
%BIGRAMFINDER Wrapper for nltk.colloection.BigramCollocationsFinder
properties(Access = private)
pyBigramFinder
end
properties(Access = public)
D
end
methods(Access = private)
function obj = BigramFinder()
... |
[testName,testPath]=uigetfile( ... %вызов диалогового окна для выбора файлов
{ '*.txt','TXT-files (*.txt)'; ... %изначально показывает файлы в папке с расширением txt
'*.*', 'All Files (*.*)'}, ... %можно выбрать показывать все файлы
'Выберите данные, содержащие точки', ... %Заг... |
function [f0] = myGetF0FromAcf(acfVector, fs)
%% Computes the pitch for a block of audio from the ACF vector
% Input:
% acfVector: (blockSize x 1) float vector, ACF of a block
% fs: float, sampling rate in Hz
% Output:
% f0: float, fundamental frequency of the block in Hz
% check input dimens... |
format('long')
options=odeset('RelTol',1e-14);
istate=[2.0 log(0.0001)];
lensim=[0 10000];
[t,xy]=ode15s(@CA_Forced_QuasiPer,lensim,istate,options);
|
clear;
clc;
save_path = '/home/star/datasets/hangzhoujiahe/new_nodeid/';
filesets = {'927', '948', '1074', '00-00-00-00-00-00-00-02-00-00-30-64-00-01-C3'};
sensorsets = {'A相温度', 'A相电流', 'B相温度', 'B相电流', 'C相温度', 'C相电流', '剩余电流', '环境温度' };
for ifile = 1 : length(filesets)
data_nodeid = filesets{ifile};
for isensor ... |
%% Limpia la memoria de variables
clear all
close all
clc
%% Cierra y elimina cualquier objeto de tipo serial
if ~isempty(instrfind)
fclose(instrfind);
delete(instrfind);
end
%% Creación de un objeto tipo serial
arduino = serial('COM5','BaudRate',9600);
fopen(arduino);
if arduino.status == 'open'
disp('... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%CLASS: COMPOUND POISSON EM ALGORITHM
%NOTE: cannot be run in parallel as all threads depend on the same rng
%Fit the compound Poisson onto simulated data using the EM algorithm
%Plots, at each step of EM, the:
%log likelihood (marginal, not joint)
%lambda estimate
%al... |
function KeepScaledResidual = setFireSampleToMissing(KeepScaledResidual,KeepFireDetect)
KeepScaledResidual(KeepFireDetect==1) = nan;
|
%% Initialization
close all
clear all
clc
%% Records / Protocol
cd('E:\DATA\KNO\vsb-baha');
fname = 'Overzicht.xlsx';
[NUM,TXT,RAW] = xlsread(fname);
nfiles = size(TXT)-1; % number of files / subjects
dnames = TXT(2:nfiles+1,1); % directory names / subjects
cond = TXT(1,2:end); % experimental condi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.