text stringlengths 8 6.12M |
|---|
%Resampling_kyle.m
%This is a basic script to show you the ins and outs of bootstrapping and jackknifing.
%Here is the actual Data
left_amygdala = [1848;1571;2199;1849;1802;1982;2473;1366;1253;1125;1815;1292;1470;2158;1795;1538;1941;2235;2361;1841;1549;2091;2093;1531;2004;2145;2021;2149;];
right_amygdala = [1886;... |
function [t, V, APD, AT, nodemap] = load_results(path, filename)
% This funtion handles the actual reading of the h5 files generated by
% CHASTE and the re-ordering of nodes. Because the re-ordering depends on
% information that is contained in the base results file, it is also used
% here for interpretation of t... |
% load carsmall % matlab自带数据,可以直接运行。数据包含变量:Horsepower, Weight, MPG
% X = [Horsepower Weight];
% rtree = fitrtree(X,MPG); % 生成决策树:回归树
% view(rtree,'Mode','graph') % 查看决策树
% load fisheriris %matlab自带数据,可以直接运行。% load样本数据
% ctree = fitctree(meas,species); % 生成决策树:分类树
% view(ctree,'Mode','graph') % % 查看决策树
% load ionosp... |
function D=fdesvioPvT(a,b,m,R,P,v,T)
D=0;
for k=1:m
D=D+(funcaoP(a,b,R,v(k),T(k))-P(k))^2;
end%for
D=D/m;
end
|
function dydt=full_infor(t,y)
x = y(1:2);
w = y(3:4);
A = [0 1;0 0];
B = [0;1];
C = [1 0];
S = [0 1;-1 0];
P = [1 0;0 0];
Q = [-1 0];
% solve the regulator equation
% from the steady state variable perspective
PI = [1 0;-1 1];
TAU = [-1 -1];
% the regulat output
e = C*x + Q*w;
% place the p... |
%%% This code test whether the results of Theorem 1 hold when the
%%% the effects of mutations are not infinitesimally small
%%% Update: 3 January 2021 (SK)
%%% (1) Added a probability for a reaction to have zero rate constant in genKineticParamsLin.m
%%% (2) Fixed error in fixed point calculation for linear function ... |
clear;%clc;%close all
tic
recdate='Mar_24_15';
cellnum='A';
module='fi_curves';
% trials=1:numel(whos)-3;
trial=4;
sample_rate=10000; % Sample rate in Hz
delay=2;
pulse_length=20;
pause_length=10;
increments=11;
windowsize=3; %Size of window in seconds
slidesize=.3; %Size of window sliding in seconds
saveit=0;
[ra... |
function url = getServiceRoot(source)
% GETSERVICEROOT
%
% Description:
% Get OData root
%
% Syntax:
% url = getServiceRoot(source)
%
% Input:
% source Volume name or abbreviation
%
% Output:
% url URL ending in /OData/
%
% See also:
% VALIDATESOURCE, SBFSEM.BUILTIN.VOLUMES
%
% History:
% 17Dec... |
function savefigs(figids,prefix,fmt)
%savefigs(figids,prefix,fmt)
% Save a set of figures to a file in a loop. Specify the set of figure
% handles to loop over in 'figids'. Specify the prefix for the files to
% save the figures into in 'prefix' and the file extension of the files
% formagt in 'fmt'.
%
% Example usage:... |
function [ myDatabase, minmax ] = SingleClassGenData2
% SingleClassGenData Generates database of face images from folder
% excluding 1 face
%
img_dir = dir(fullfile('./data/s1','*.jpg'));
num_imgs = length(img_dir);
pers_dir = dir(fullfile('./data'));
numOfPers = sum([pers_dir.isdir])-2;
eps=.000001;... |
% This file shows how to run the algorithm introduced in:
% M.Bosch, C. Gifford, A.Dress, C. Lau, J.Skibbo, G.Christie
% "Improved image segmentation via cost minimization of multiple
% hypotheses", BMVC 17.
% If this code is used please cite above.
% This version only supports FH kernel as described in the paper.... |
% 例7,由抽样信号重建连续信号
% 北京邮电大学,尹霄丽
% 2018年12月
clear
Ts=1;
Fs=1/Ts;
n = 0:10;
x = sin(n);
t = 0:0.25:10;
nTs=0:10;
tt=ones(length(n),1)*t-nTs'*ones(1,length(t));
x_sinc=x*sinc(Fs*tt);
hold on;
plot(t,x_sinc,'b','linewidth',2);
hold on;
stem(n*Ts,x,'r','linewidth',2);
xlabel('t (s)');
legend('x\_sinc','x(n)'); |
function MAIN_2_projectileMotionWithDrag()
%
% This function uses ode45 to simulate a ball flying through the air,
% subject to linear and quadratic drag forces.
%
param.mass = 1.0; % (kg) mass of ball
param.gravity = 9.81; % (m/s^2) gravity accel.
param.linearDragCoefficient = 0.8; % (Ns/m)
param.quadraticDrawC... |
f = @(x) 1 ./ (1 + x.^2);
for n = 10:10:30
x = linspace(-5,5,n + 1);
y = f(x);
coeffs = polyfit(x, y, n);
steps = -5:0.0001:5;
values = polyval(coeffs, steps);
figure(n);
plot(steps, values, x, y, 'r*',steps, f(steps), 'g');
end
|
% Copyright (C) Daphne Koller, Stanford University, 2012
%I = I4;
function [MEU OptimalDecisionRule] = OptimizeLinearExpectations( I )
% Inputs: An influence diagram I with a single decision node and one or more utility nodes.
% I.RandomFactors = list of factors for each random variable. These are CPDs, w... |
function Y = uq_CornerPeak(X,options)
% function Y = uq_CornerPeak(X)
% Computes the corner peak function defined as
% Y_i = (1 + sum_{k=1}^{d} (c_{i,k} xi_k))^(-(d+1))
%
% Model has d input parameters defined as:
% X = [xi_1, ...., xi_d]
%
% The coefficients of the corner peak function can be calculated u... |
%72-hour data
%setting up
copy72hourdata=repmat(copy72hourdata,1)
%before importing, rows of averages were included in the Excel spreadsheet
A=copy72hourdata(19,:)
B=copy72hourdata(84,:)
C=copy72hourdata(138,:)
D=copy72hourdata(323,:)
%A and B
Combined=[A;B]
L=length(A)
degrow=zeros(1,L)
Differences1=zeros(1,L)
%Si... |
function [] = Engage_Composite(FNlist, Test_array)
global H
global XStimParams
global TDT
global FN
global C_
global M_
global GUI
global F
%Engage_Composite
% Initialize Application and get AP2 and XBUS locks
if(S232('S2init', 0, 'INIT_PRIMARY', 20000) == 0)
disp('Cannot initialize a primary process... |
#Modulación y demodulación PCM con cuantización uniforme
IN= input('Ingrese la función: ', "s");
F=inline(IN,'x');
n= 2 #Numero de pulsos binarios
T_m=4*pi; #Periodo
f_m=1/T_m; #Frecuencia
f_s=2*f_m; #Frecuencia de muestreo
# Arreglo para el muestreo
t=[0:f_s:2*T_m];
# Arreglo función original
#t_s=[0:0.02:2*T_m];
t_... |
%{
Use this script to add a column for food zone entries and exits to the
Box_Complete table. This will be necessary for creating the behavioural
raster plot. Need DarkBoxC, DarkBoxD, and DarkBoxE. This raw data was
collected using the Noldus software.
Uses the function exclusionrem_2Feed_Godfrey.m
%}
%% For analysis ... |
m = 50;
x = 1;
W = eye(m);
for i = 1:m
W(i,m) = 1;
for j = 1:i-1
W(i,j) = -1;
end
end
W(m, m) = W(m, m) + x;
rcond(W);
I = eye(m);
y = W\I(:,1);
% W
A = [1 0;
1 -3];
%
% W = randn(m);
[L U P] =gepp(W);
norm(P*W - L*U)
% [L U P Q] =gecp(A)
% norm(P*A*Q - L*U)
[L U P Q] =gecp(W);
norm(P*W*Q - L*U)
% [L... |
% A small example that illustrates how cSPoC works and how it can be
% applied.
%
% In this example we assume that we have some datasets X{n} for n in {1,..,N},
% each with a certain number M{n} of channels that measure a mixture of source
% activity. The envelope of K sources in the datasets are coupled and
% these... |
%----Luciferase Assay Analyzer: Graphical User Interface for analyzing luciferase assay data----
%software: MikroWin version 5.19
%machine:Berthold Centro XS3 LB960
%data collection: settings -> measurement -> repeated: enter total time (total duration assay),
%counting time (how long each measure... |
function elem=atmarker(fname,varargin)
%ATMARKER(FAMNAME,PASSMETHOD)
% creates a marker space element
%
%FAMNAME family name
%PASSMETHOD tracking function, defaults to 'IdentityPass'
%
%ATMARKER(FAMNAME,PASSMETHOD,'FIELDNAME1',VALUE1,...)
% Each pair {'FIELDNAME',VALUE} is added to the element
%
%See also: ATDRI... |
function [signalPeaks, signalPeaksArray, signalSigmas] = computeSignalPeaks(signalMatrix, varargin)
% Binarize [0,1] input analog signals based on peaks in the signal.
% Biafra Ahanonu
% started: 2013.10.28
% inputs
% signalMatrix: [nSignals frame] matrix
% outputs
% signalPeaks: [nSignals frame] matrix. Bina... |
function [ array ] = circle_array( n )
%CIRCLE_ARRAY Summary of this function goes here
% Création d'une matrice contenant un cercle de hauteur unitaire en son
% centre.
vect = linspace(-1,1,n);
[array_x,array_y] = ndgrid(vect);
array = (sqrt(array_x.^2+array_y.^2) <= 1);
array = cast(array,'double');
end
|
% Charge density for K_plus = 1.0 obtained by first solving
% equation 7 for v(R). SI Units were used by incorporating
% the elctric constant K_E = 1 / (4*pi*eps_0) into the definition
% of K_plus, to give K_plus = K_E*4*pi*r^2*rho*v^1/2 / |V_o|
% solving for the charge density gives:
% rho = eps_0*|V_o|/(r^2*v^1/2)... |
function [ output_args ] = c0estimate( input_args )
%C0ESTIMATE Summary of this function goes here
% Detailed explanation goes here
end
|
function nearestNeighborList = getNearestNeighborList(timeSeries, seedPosition, windowSize, isUseMASS, maxChainLen)
maxOverlapRelaxed = round((1 / 2) * windowSize);
nearestNeighborList = [];
isSinkFound = 0;
currentNeighbor = seedPosition;
nearestNeighborList = [nearestNeighborList currentNeig... |
function [ Phi_XY ] = regressormatrix_displacement ( data )
% Calculate displacement in absolute RF get in input revolution from
% encoder of two wheels and postion angle, return (2,2) matrix of
% displacement
% Vehicle movements respect the absolute coordinates x and y in the (2,2)
% regressor matrix. To compute an u... |
#! /usr/bin/octave -q
%################################################################################
% #
% Author: Dr. M.A. Danielides #
% Last modified: 02-01-2012 #
% Function: ENTER TEXT here #
% ========= #
% #
%##########################################################... |
load_param_resonance_load;
important_parameters;
%STATE SPACE
s = tf('s');
%real derivative transfer function for finding and filtering w
w_c = 2*pi*50;
delta_f = 1/sqrt(2);
H_w = (w_c^2*s)/(s^2+2*delta_f*w_c*s+w_c^2); %real derivative
[numH_w,denH_w] = tfdata(H_w, 'v'); %to be used it in a simulink block
%for findi... |
%This script calculates the Q1' heating from the first two PCs of vertical motion over DJF for the 40
%year climatology from ERA5.
%Add the paths for the netcdf scripts
addpath('~/matlab_scripts/mexcdf/mexnc');
addpath('~/matlab_scripts/mexcdf/snctools');
%load objects needed for plotting
load('angleco... |
clear; close all;
t1 = datenum(2021,6,3);
t2 = datenum(2021,6,4);
% Define filenames.
mdl_fname = 'https://geoport.usgs.esipfed.org/thredds/dodsC/vortexfs1/usgs/Projects/COAWST_forecast_refined2/obx_his.ncml';
grd_fname = 'C:\Users\chegermiller\Desktop\Research\Duck_forecast\models\grids\roms_duck_102019bathy... |
function F = addps(A,B,C,D,E,option,tol)
%ADDPS Solution to Continuous-time Disturbance Decoupling Problem
%
% F = addps(A,B,C,D,E[,option])
%
% generates a state feedback gain law u = F x, which solves
% the almost disturbance decoupling problem for the system:
% .
% ... |
scom=serial('com5');
scom.BaudRate = 115200;
scom.Terminator='CR';%设置终止符为CR(回车符)
fopen(scom);
fwrite(scom,255);%写串口,发送握手信号0xFF(等价于十进制下的数值255)
%fclose(scom);%关闭串口设备对象
%delete(scom);%删除内存中的串口设备对象
%clear scom; %清除工作空间中的串口设备对象 |
function [rms_val] = rmsd_bilateral(A,B)
[m, n] = size(A);
A1 = A - min(A(:));
A1 = A1/ max(A1(:));
B1 = B - min(B(:));
B1 = B1/max(B1(:));
diff = A1 - B1;
diff = diff.^2;
diff_sum = sum(diff(:));
diff_avg = diff_sum/(m*n);
rms_val = sqrt(diff_avg);
end
|
function result = computeAll(debug)
if ~exist('debug', 'var')
debug = 0;
end
dataset = loadDataset (16);
images = textread('images.txt', '%s', 'delimiter', '\n');
groundtruth = textread('groundtruth_raw.txt', '%s', 'delimiter', '\n');
correct = 0;
confmat = zeros (1... |
function[v] = getnodeinfo(X,F,V)
%GDELETEVERTEX - delete 1 vertex from the end of a fiber
%get the datatip object
dcm_obj = datacursormode(gcf);
%get info on the datatip(s)
info_struct = getCursorInfo(dcm_obj);
p = info_struct(1).Position;
if length(p)==3
v = find( X(:,1)==p(1) & X(:,2)==... |
function [out]=sigmoid(z);
out=1./(1+exp(-z));
end
|
function mat = sigmoid(mat, L, k)
% NONLINEARITY: Every pixel value x gets scaled by
% L * [1 / (1 + e^(-kx)) + 0.5]
% Inputs:
% mat - a matrix of any shape
% L, k - gain and steepness
%
% Outputs:
% mat - transformed matrix
mat = L * (1 ./ (1+exp(-k*mat)) - 0.5);
end
|
%% Taser Simple 2D Forearm
% by Leonard Spiering 07.12.2019
% 20microsec puls -> frequency of 50kHz
% PeakVoltage of 500kV
% Material Parameter: dry Skin (thickness?!)
% Nerves completely ignored.
%https://itis.swiss/virtual-population/tissue-properties/database/dielectric-properties/
close all... |
function boid = boundary(dim,boid)
% BOUNDARY: function that bounces the boids inside the grid if they get to
% the walls with the same velocity it hit the wall
%
% INPUTS:
% dim = size of the domain
% boid = boids position and velocity
%
% OUTPUTS:
% boid = boids position and velocity
%
% Xing Jin and Javier Lobato, ... |
fID = fopen('f.txt','w');
fclose(fID);
clear
close all
vid1=VideoReader('1.mp4');
% numFrames = vid1.NumberOfFrames;
n=10;
for i = 1:1:n
frames = read(vid1,i);
imwrite(frames,['vid' int2str(i), '.jpg']);
im(i)=image(frames);
end
fID = fopen('f.txt','a+');
fprintf(fID,'%d',n);
fclose(fID);
%%%%%%%%... |
load('EPL_2012_2013.csv.mat');
[n, m]= size(train);
num_of_teams = 20;
k = 6;
model= LogTrainTeam(train, 1, n, num_of_teams, k);
[accuracy,prediction,conf]=LogTestTeams(model,train, num_of_teams, k);
|
v1 = mesh.co(:,1,mesh.el(:,2))-mesh.co(:,1,mesh.el(:,1));
v2 = mesh.co(:,1,mesh.el(:,3))-mesh.co(:,1,mesh.el(:,1));
v3 = mesh.co(:,1,mesh.el(:,4))-mesh.co(:,1,mesh.el(:,1));
v4 = mesh.co(:,1,mesh.el(:,3))-mesh.co(:,1,mesh.el(:,2));
v5 = mesh.co(:,1,mesh.el(:,4))-mesh.co(:,1,mesh.el(:,2));
v6 = mesh.co(:,1,mesh.el(:,4))... |
function CDST = Correct_t_DaylightSavings(DST,FTC)
% Function corrects TIME for daylight savings so that it is a constant
% offset from UTC year-round. To do this it needs to cut out time steps and
% add a time step.
%
% SYNTAX:
%
%
% INPUTS:
%
%
% OUTPUTS:
%
%
% NOTES:
% This code has been untested for ... |
function [ r ] = moment( x, k )
r = sum( (x - mean(x)).^k );
%r = (1/length(x))*sum( x.^k );
end |
function out = splitSimplexes(obj)
% - разделить все симплексы по две пары
% - как именно?
simplexesCount = size(obj.simplexList, 1);
obj.processedSimplexes = [];
currentPair = [];
pairs = [];
% firstPair = [];
% secondPair = [];
% pairTuples = [];
for i = 1:simplexesCo... |
%% Initialization
clear all;
close all;
clc;
%% HW2
V = 20; % km/hr
C = 3*10^8; % m/s
Fc = 2*10^9; % 1/s
Fm = ((V*(1000/3600))/C)*Fc;
sample = 10^4;
point = 10^3;
r = unifrnd(-pi, pi, [1, sample]);
Fd = cos(r).*Fm;
benchmark = min(Fd):(max(Fd)-min(Fd))/point:max(Fd);
cdf_s = zeros(1, l... |
clear
clc
pop_size =100 ;
n = 10;
m = 3;
k = 4;
Pc = 0.8;
Pm = 0.2;
G = 1000;
Initial_Group = pop(pop_size,n,k,m);
[Initial_Group,fitness_time] = decode( Initial_Group,pop_size,n,k,m );
father = father_pair(pop_size);
[children] = cross(pop_size,father, Initial_Group, Pc, n, k);
% [children1] = mutat... |
function H = discreteft(I,U)
f
V=H*I*transpose(H);
% N=size(f,1);
% [m,n]=size(f);
% xc=m/2;
% yc=n/2;
%
% K=[l;k];
% R=[cos(t) -sin(t);sin(t) cos(t)];
% v=0;
% for x=1:(size(f,1))
%
% for y=1:(size(f,2))
% m=x-xc-1;
% n=y-yc-1;
% M=[n;m];
%
% pr=-(1i*2*pi/N)*... |
function [Tz_min_cross] = generate_min_dTdz_crossing_mask(dTdz, min_dTdz, debug_plot)
% [Tz_min_cross] = generate_min_dTdz_crossing_mask(dTdz, min_dTdz, debug_plot)
%
% Generates a mask for points that are on either side of a crossing of
% min_dTdz. I.e., if Tz(t0) < 1e-3 and Tz(t0-1), Tz(t0+1) > 1e-3, we might
% not w... |
function writeJHLearnHDF5(FID, pop_ind_pre, pop_ind_post, infsteps,learn_rate,learn_rate_all,tau, inf_scale,noise, ntype_pre,ntype_post, dropout)
% add inhibitory STDP to connection
% FID: file id for writing data
% pop_ind:
pop_ind_pre = pop_ind_pre - 1; % from matlab to c++ index
pop_ind_post = pop_ind_post - 1... |
function y = unitmean(x,varargin)
% Divide a variable by its mean, to set mu=1 (for positive data)
m=nanmean(x,varargin{:});
if length(m)==1;
y=x./m;
else
y=x./repmat(m,size(x)./size(m));
end |
function root = secant(f, low_x, up_x)
% Approxime un zéro d'une fonction via la méthode de la sécante.
% Elle cherche ce zéro à l'aide d'une succession de zéros de droites.
%
% Bien que la fonction demande au départ deux approximations initiales, le
% zéro trouvé peut très bien se trouver hors de ces "bornes".
%
% Pa... |
function a = setState_Tsat(a,tx)
% SETSTATE_TSAT Set the fluid to a saturated state at
% temperature t
%
thermo_set(a.tp_id,25,tx);
|
classdef OptStructureConfig < handle
% 期权Structure配置
% wuyunfeng 20170330 VERSION 0
properties( SetAccess = 'public' , GetAccess = 'public' , Hidden = false )
% Import
m2tkCallQuote@M2TK; % 看涨期权的行情的数据
m2tkPutQuote@M2TK; % 看跌期权的行情的数据
curr_biaod... |
%% Overview of project
% Purpose of code
% First time looking at MSNA / signal processing on MATLAB
% Need to learn how to extract data
% Sample NVX_CKD file has channel 1 = MSNA, channel 2 = ECG
% Sampling frequency is 1000 Hz, there is 10 minutes of data
% Data already been amplified, band pass fi... |
function P = getPlanet(planets_struct,planetName)
if nargin < 2
sprintf('\nUsage: \n\tplanets_struct = struct array from parsePlanetInfo.m');
sprintf('\n\tplanetName = name of planet to return\n');
return
end
planets = planets_struct;
n = {planets.Name};
i = find(strcmp(n,planetName));
if i
P = ... |
function u = ctrlCriticalTracking(~,z,xi,kp,kd,P)
% Adds an artificial damping term to achieve a critical damping between the
% motor and the end effector, and then uses a standard pd controller
qf = z(1,:);
qm = z(2,:);
dqf = z(3,:);
dqm = z(4,:);
% Reference for tracking
qr = 0.2;
dqr = 0.0;
Jm = P.Jm; % Motor... |
function [figps] = xplot(it,vval,vfnrm,vflops,vpos,vdeg,vpcg)
%XPLOT 4 performance graphs
%
% figps = xplot(it,vval,vfnrm,vflops,vpos,vdeg,vpcg)
%
% PLOT 4 OUTPUT GRAPHS ON 2-BY-2 DISPLAY
% Copyright (c) 1990-98 by The MathWorks, Inc.
% $Revision: 1.3 $ $Date: 1998/07/09 16:30:10 $
% This is to avoi... |
%% Stelling 24
%
% De volgende code voegt 'voornaam' en 'achternaam'
% samen:
%
% ------------code--------------
% voornaam = 'Bio'
% achternaam = 'Statica' ... |
classdef SWEBoundaryConditionUnitTest2d < SWEConventional2d
properties( Constant )
gra = 9.81
hmin = 1e-4
end
methods
function obj = SWEBoundaryConditionUnitTest2d( N, bctype )
mesh = makeUniformQuadMesh(N, [0, 10], [0, 10], 2, 2, bctype);
obj.initPh... |
function [] = copyItem(obj,obj2,seqNo,seqNo2)
% 将obj2选定的记录copy到obj1相应位置,覆盖式的
%
if length(seqNo)~=length(seqNo2)
error('Target and source item number not equal');
end
maxSeqNo = max(seqNo);
if obj.capacity<maxSeqNo
obj.extend(maxSeqNo-obj.capacity);
end
if obj.latest<maxSeqNo
obj.latest = maxSeqNo;
end
o... |
% This script shows the Runge phenomenon Runge's phenomenon which is a
% problem of oscillation at the edges of an interval that occurs when using
% polynomial interpolation with polynomials of high degree over a set of
% equispaced interpolation points.
% Copyright 2017 Junshen Xu
ns = [11, 13, 15]; % orders of p... |
%% distribution with all type of tails
clear ; close all; clc;
mu = 2;
sigma = 2;
% normal
X = [-10:0.01:40];
Y = normpdf(X,mu,sigma);
plot(X,Y);
hold on;
X = [0:0.01:40];
% exponential
Y = exppdf(X,mu);
plot(X,Y);
hold on;
m = 2;
v = 2;
% Exact solution
mu = log((m^2)/sqrt(v+m^2));v =... |
function [ pt, coverge] = implicitMethod( F, F_, p0, dt, tend, maxIterations)
%Calculation of the solution of an ordinary differential equation with
%implicit method. This function can be used for the implicit methods as
%mentioned in the assignement. F and F_ will control the type of method
%coverge boolean
c... |
% MIRT2D_F Initializes a matrix of cubic B-spline coefficients
% for a single square 2D patch. F times the vector of 16 (4x4) given control points
% will give a new spatial locations of image pixels within this patch.
%
% Copyright (C) 2007-2010 Andriy Myronenko (myron@csee.ogi.edu)
% also see http://www.bme.ogi.edu/~... |
function parMeasureMI(grandMetrics, grandIX, nBins, metricN1)
ix = find(isnan(grandMetrics));
grandMetrics(ix) = 0;
classIX = uniqueTypes(grandIX);
MI = NaN*ones(size(grandMetrics,2),size(grandMetrics,2));
MIshuff = NaN*ones(size(grandMetrics,2),size(grandMetrics,2));
metricN1
for ... |
function dh=zad1_p_correction_pg(p,t,pc1,tc1,pc2,tc2,x1,x2,om1,om2)
%stałe
r=8.3144;u=2;w=-1;
check_kay_rule=[tc1/tc2,pc1/pc2];
if check_kay_rule(1)<=2 && check_kay_rule(1)>=0.5 && check_kay_rule(2)<=2 && check_kay_rule(2)>=0.5
%Kay rule
s=0.37464+1.54226*(x1.*om1+x2.*om2)-0.26992*(x1.*om1+x2.*om2).^2;
t... |
function [payoff] = single_trial(choice1,choice2)
% Given 2 choices of 1 (dare) or 0 (chicken) returns the payoff for the
% first and second player
if choice1 == 0
if choice2 == 0
payoff = [6,6];
elseif choice2 == 1
payoff = [2,7];
end
elseif choice1 == 1
if choice2 =... |
function plotROIsummary(Cin,ROI,template_red)
%might need to get the frameratefrom this computer and merge that data?
%why is it mad
[imwidth,imheight,roinum]=size(ROI);
figure;
hold on;
imframerate=5.3;%get value from notebook or xml file
tvec=linspace(1,numel(Cin(1,:)),251)/5.3;
for k=1:roinum%iterate... |
%% Euler Intergration
% file: euler.m
%
% by Nathaniel Chang
% Created: 07/03/2021
% last edited: 30/03/2021
% programing (MATLAB and C) Semester 1
% -------------------- initialize values -------------------
% position vector (r)
x = [];
y = [];
z = [];
ur = [];
% interval bettween each point
interval = 0.001;
... |
function [tris, sibhes, v2he] = swap_tris_surf( fid1, fid2, tris, sibhes, v2he) %#codegen
%SWAP_TRIS_SURF Swap two faces in a triangle mesh.
% [tris, sibhes, v2he] = SWAP_TRIS_SURF( FID1, FID2, TRIS, SIBHES, V2HE)
% swaps two triangles in connecitivity table.
%
if fid1==fid2; return; end
% modify opposite... |
classdef image_track < handle
properties
target_image;
gry_target_image;
target_extracted_features;
target_points;
debug;
fig
end
methods
function self = image_track(debug)
self.debug = debug;
self.target_image = imread("Marker_5... |
function [Rules_semantic Rule_importance] = interpret(net, IND, OUTD)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DISPLAY RULE BASE %%%%%%%%%%%%%%%%%%%%%%%%%%
disp('RULE BASE');
disp(net.Rules);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DISPLAY RULE SEMANTIC %%%%%%%%%%%%%%%%%%%%%%%%%%
semantic_list = {'M ';'H ';'VH... |
%% Pre-process
%% Optimization
function [costMat,inputSolCellMat]=prepMat4Opt(p,trajMat)
numPaths = rows(p);
fprintf('num of trajectories/paths to optimize: %d\n',numPaths);
inputSolCellMat = {};
costMat = [];
optCtr = 1;
for i = 1:numPaths
[d,path] = getPathInfo(p(i,:));
input4OptMat = trajMat(path,:);
o... |
x = 1:200;
y = 100./(1+100*exp(-x./10));
performance = [y(46:100) y(30:130)];
plot(performance)
box off; |
function [decodevar] = hsmmresidual_decodelog(self,X,opt_varargin)
n=0;
if isempty(opt_varargin)
program_option;
n=size(opt_varargin,2);
elseif isstruct(opt_varargin{1})
opt=opt_varargin{1};
... |
function [ tanstruct_out ] = subset_ace_by_3month( tanstruct_in, months_in )
%A function to subset ace data corresponding to a particular 3-month period
%of the year. Empty arrays are produced if there is no data for that month.
% *INPUT*
% tanstruct_in: STRUCTURE - contains the gas specific ACE data.
% ... |
function [Xout,A,Z]=dg_fprop(X,We1,S1,theta1,T1,We2,S2,theta2,T2,G,D)
% Syntax:
% [Xout,A,Z]=dg_fprop(X,We1,S1,theta1,T1,We2,S2,T2,theta2,G,D)
[a1,Z1,C1,~]=lista_fprop(X,We1,S1,theta1,T1);
y=G*a1;
[a2,Z2,C2,~]=lista_fprop(y,We2,S2,theta2,T2);
Xout=D*a2;
A=cat(1,tocell(Z1),y,tocell(Z2),Xout);
Z=cat(1,tocell(... |
function Sxy= st_xsd(x,y,Nframe,beta)
% short-time cross spectral density
N= length(x);
L= (N-Nframe)/(Nframe*beta)+1; %no. of frames
Sxy= zeros(Nframe,L);
for l=1:L
q= (l-1)*Nframe*beta;
Sxy(:,l)= fft(x((q+1):(q+Nframe))).*conj(fft(y((q+1):(q+Nframe))));
end;
|
%{
# action.Weighing
-> subject.Subject
weighing_time: datetime
-----
-> reference.User
weight: float # in grams
%}
classdef Weighing < dj.Manual
end |
% clc;
% clear all;
haptic_experiment;
N = length(angPos); % Number of samples
% z = [angPos';gyro_angVel']; % Measured signal
angPos = angPos - mean(angPos); % around zero
r = 0.3; %m
xPedal = r*sind(angPos);
xPedalDot = r.*cosd(angPos).*gyro_angVel;
k_spring = 1;
M_mass = 10;
b_damper = 10;
A = [0 1 0; -k_spring/... |
function dJ2_q5 = dJ2_q5(in1)
%DJ2_Q5
% DJ2_Q5 = DJ2_Q5(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 22-Jun-2020 13:00:49
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
q4 = in1(:,4);
q5 = in1(:,5);
q6 = in1(:,6);
t2 = q1+q2+q3+q4+q5;
t3 = q6+t2;
t4 = sin(t2);
t5 = cos(t2);
t6... |
function Error=error_aproximado(Vact,Vante)
Error = abs((Vact-Vante)/Vact)*100; |
%función que calcula PSD
function [f,APSD_raw, APSD_N] = APSD_M(Signal,dt,blksize) %,APSDdB,APSD_N,APSD_N_dB
data=Signal-mean(Signal);
N=blksize; %number of points in a block
nblk = floor( length(data) / N ); %number of blocks
FS=1/dt; %frequency rate
% we know the relat... |
function [inplanes, ground_plane_regions, overlap] = loadPlanes(visibility_regions_directory, homographies, cameras, num_cams, dataset)
inplanes = cell(num_cams,1);
for i=1:num_cams
inplanes{i} = load(strcat(visibility_regions_directory, num2str(cameras{i}),'.mat'));
inplanes{i} = inplanes{i}.t... |
clear all
%% Sets up inputs and filepaths for thresholding variant maps
%
% This script sets up the inputs for the function that thresholds variant
% maps. Here, the settings are used to exclude vertices from consideration
% with low SNR and set the threshold(s) to use for defining variants.
%
%OUTPUTS:
%
% -workben... |
function idx=find_thd_idx(n,p,th)
%save temp n p th
sm=sum(n); psm=p*sm;
idx=1; ssm=n(1);
%while ssm < psm %<=============================== modified Apr. 28, 2021
while ssm < psm && idx<24%<=============================== modified Apr. 28, 2021
ssm = ssm + sum(n(th(idx)+1:th(idx+1)));
idx = idx+1;
end
%... |
load ps5_data.mat
% Same code used for question 3 - 5 . Generated the results by changing
% just the initial data set
% For Problem 3
% mean_vectors = InitTwoClusters_1;
% For Problem 4
% mean_vectors = InitTwoClusters_2;
% For Problem 5a
% mean_vectors = InitThreeClusters_1;
% For Problem 5b
mean_vectors = InitT... |
%USES MICE 3 TO 11 TO FIRST INTERPOLATE OVER MIN TO MAX TIME FRAME FOR A
%PARTICULAR MOUSE AND THEN SUM ACROSS ALL TO CREATE A SINGLE DATASET
%NOTE THAT MICE 1 AND 2 ARE OUTLIERS AND THUS NOT INCLUDED
counts = zeros(1, 39); %vector to hold number of readings for each time point
vq_sum = zeros(1,39); %vector to hold su... |
function curr_spline_fit = applyKnotOffsetAndSpline(curr_q_knot, feature_opt, ii_vec, ii_h, param)
curr_q_knot(ii_vec) = curr_q_knot(ii_vec) + param.h_array(ii_h);
y_opt_mat = vec2mat_multi(curr_q_knot, param.matVec_struct);
curr_spline_fit = calc_direct_spline(y_opt_mat, param);
% % % % dq/d... |
% Image Preprocessing, in order to acquire visualization appealing to the normal human vision. Simply to
% obtain the images suitable for direct observation.
imginFileInfo1 = dir('ImgIn/');
imginFileInfo2 = dir('ImgOut/');
% Processing the input Image
nentry = max(size(imginFileInfo1));
for i=1:nentry
if... |
function [varNames, firstVar] = findbasevars(searchString,varargin)
%FINDBASEVARS return a cell array containing the names of all variables in
% the base workspace which contain it. If an exact match to SearchString
% is found, it will be returned as the first cell in the array.
% The function also returns variable ... |
%%%
addpath('Libraries/Utils')
PROJECT_BASENAME = ['/Volumes/Scratch/Chris/Paper2_Rippling/Paper2/'];
run('ENVS.m')
load([PROJECT_BASENAME, '/data/processed/Development/AllData.mat']);
% If to save the data and figures, and the folder to save them in
SAVE = true;
SAVE_FOLDER = [PROJECT_BASENAME '/reports/figures/deve... |
% DO NOT CHANGE THIS LINE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [A, B, C, D, E, F, G, H, I, J, K] = ABCs_moreFunctions(DNE)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ABCs of Functions
%
% Directions:
% Write the code to satisify the following directions.... |
function range = get_resp_range(P)
sum = 0.;
avg = 0.;
cnt = 0;
r_start = 0;
r_end = 0;
for ii = 1:length(P)
% P(ii)
if P(ii) == 0
continue;
else
if ii < 50
cnt = cnt + 1;
sum = sum + P(ii);
avg... |
function fig = sinead_preprocess()
% ___________________________________________________________________________
% SINEAD (Software Integrating NEuroimaging And other Data)
%
% Copyright 2016 ISRC-Ulster
% Reference
% Youssofzadeh et al, Multi-kernel learning with Dartel enhances
% combined MRI-PET classification and ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.