text stringlengths 8 6.12M |
|---|
%superposition.m
%Lab 01, plot and add signals
%Peter Heitkemper 4-3-21
clear
clc
% signal parameters in array
amplitude = [1,.5,.75];
frequency = [10,20,7]; %Hz
phase = zeros(1,3);
offset = [0.25,0,-.5];
color = ['r','b','g'];
%sample rate of 100*highest signal frequency(20)
sampleRate = 20000;
np... |
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
|
% alpha2.m
% Calls: pot.m (potential well)
% Calls: funct.m (Schrodinger equation for ODE)
close all
clear all
clc
global Cse Cpot U1 x1
% Input parameters -------------------------------------------------------
E = 4e6; % Energy of alpha particle (eV)
xMin = 0; % Range for X-axis (m)
xMax = 2.5... |
% num = match(image1, image2)
%
% This function reads two images, finds their SIFT features, and
% displays lines connecting the matched keypoints. A match is accepted
% only if its distance is less than distRatio times the distance to the
% second closest match.
% It returns the number of matches displayed.
%
%... |
function [meanframe,stdframe] = moviestats(file)
%[meanframe,stdframe] = moviestats(file)
[frame,Xdim,Ydim,NumFrames] = loadframe(file,1);
for i = 1:NumFrames
frame = double(loadframe(file,i));
meanframe(i) = mean(frame(:));
stdframe(i) = std(frame(:));
end
end
|
function [F, M, trpy, drpy] = controller(qd, t, qn, params)
% CONTROLLER quadrotor controller
% The current states are:
% qd{qn}.pos, qd{qn}.vel, qd{qn}.euler = [roll;pitch;yaw], qd{qn}.omega
% The desired states are:
% qd{qn}.pos_des, qd{qn}.vel_des, qd{qn}.acc_des, qd{qn}.yaw_des, qd{qn}.yawdot_des
% Using these curr... |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clc;clear;close all;format shortg
addpath([pwd,'/utility/'])
addpath([pwd,'/utility/effectsize/'])
load('twistedxor2data.mat')
whos
% Name Size ... |
function [xmin, xmax, ymin, ymax] = get_input(image)
% fonction qui recupere les coordonnees de l'operateur
% on reaorganise les coordonnees (min, max) pour obtenir le rectangle
% selectione
imshow(uint8(image));
title('image de depart');
[x, y] = ginput(2);
x = floor(x);
y = floor(y);
xmin = min(x);
xmax = max(x);
... |
% f(x)=g(x)+h(x)=norm(Ax-b)+tau*|x|
%%%%%%%%%%%%%%%%%%generate data%%%%%%%%%%%%%%%%%%
global m n s A b tau
m = 1000;
n = 500;
s = 50;
A = randn(m,n);
xs = zeros(n,1);
picks = randperm(n);
xs(picks(1:s)) = randn(s,1);
b = A*xs;
tau = 1e-6;
%%%%%%%%%%%%%%%%%%proximal line search%%%%%%%%%%%%%%%%%%
beta = 0.5;
dif... |
function points = earth_iss(N,h)
iss_mass = 419725;
iss_pos = [2.720377475731905*10^-5,-2.611108420608355*10^-5,2.522444260083528*10^-5];
iss_vel = [1.644073665336366*10^-3, 3.614215589317436*10^-3, 1.959991553260346*10^-3];
earth_mass = 5.9722*10^24;
earth_pos = [0,0,0];
earth_vel = [... |
function m = mmax(A)
% mmax - maximum entry from a matrix.
%
% m = mmax(A)
%
% Copyright (c) 2004 Gabriel Peyré
m = max(A(:)); |
function [ LHS ] = buildLHS( n, nl, nd, B, D )
end
|
function graph = bundleAdjustment(graph, adjust_type)
if nargin < 2
% adjust_type = 's+m'; % both, all, motion, structure
assert(false, 'error');
end
% convert from Rt matrix to AngleAxis
nCam=length(graph.frames);
Mot = zeros(3,2,nCam); % motion, first column is 3 dof rotation, second column is 3 dof trans... |
function out = power(in1, in2)
if ~isnumeric(in2)
error('variables as exponents is not supported')
end
size1 = [size(in1.K, 1), 1];
size2 = size(in2);
if size2(1) == 1 && size2(2) > 1
warning(['all BLOM_Expression objects are considered vectors, ' ...
'converting second input of power to colum... |
%反馈矫正环节
%这里对全量状态进行预测和校正
%2014.8.22
%还是不大对,还是直接观测增量状态吧
function [x_k] = fankui_v3(x_k_old,y_k,u_k_1,u_k_2)
global A_e B_e C_e;
global R1 R2 P0;
global K x_est Sigma;
% Kalman matrix (Created by the routine kal_filter).
% This matrix is only designed for model2.
K = [0.4624,-0.0189;0.4175,-0.3376;-0.0056,0.6674;-0.04... |
function [] = plotMapSingleValueGEO4PLOTS3(...
latitude,longitude,...
z1,z2,z3,z4,...
e1,e2,e3,e4,...
z_str,ID,nr_colours,varargin)
%PLOTMAPSINGLEVALUEGEO4PLOTS2 Plots map with colored points representing
% four attributes (Chile).
% Note: Indicating conf. intervals / errors in parameters by tran... |
eq = input('Give an equation in x \nexample: 2*x^2-3*x+4 \n :','s');
% the user types in, for instance 2*x^2-3*x+4
n = input('Type n the number of points: ');
for i = 1:n
inp = input('Input a number: ');
x_values(i) = inp;
f = inline(eq,'x');
y = feval(f,inp);
y_values(i) = y;
end
x0 = input('... |
function m_r2 = generate_m_r2(n, r)
if r <= 1
m_r2 = 0;
else
h = 1 / n;
x_r = (r - 1) / n;
x_r_1 = (r - 2) / n;
difference5 = difference(x_r, x_r_1, 5);
difference4 = difference(x_r, x_r_1, 4);
difference3 = difference(x_r, x_r_1, 3);
M_... |
clc;
clear;
K = 1600;
epochs=249;%249;
whitemat = zeros(K,K);
for i = 0:epochs
filename = strcat(strcat('../augdata/augmented',num2str(i)),'.h5');
disp(filename)
images_train = h5read(filename,'/all_images_train');
%X1 = single(images_train)';
X1 = images_train';
X1 = X1 + normrnd(0,0... |
plotEgger('1970');
plotEgger('1980');
plotEgger('1990');
plotEgger('2010');
|
function [Fx,Fy] = nBodyGForcecalc_2D(posx, posy, masses)
% An N-body, 2d Gravitational Force calculator...
%
% function [Fx,Fy] = nBodyGForcecalc_2D(posx, posy, masses)
%
% Calculates (in 2D) the Fx and Fy components for an N body problem
% The forces are computed by superpositions and are only due to
% the univers... |
classdef (Sealed) APTPiezo < Drivers.APT & Modules.Driver
% APTPIEZO A subclass to handle things specific to the motor controller
% All positions are in mm
%
% Singleton based off serial number
%
% Settings are unique to the MATLAB version. It will save all settings
% as mfilename (still u... |
function test
%Test function for loadACQ
% (c) 2003 Mihai Moldovan
% M.Moldovan@mfi.ku.dk
chan=loadacq ('EEGdata.acq');
%id -> the original channel id
%color -> matlab converted color
%name -> name of the channel
%units -> label of the units
%ms -> ms per point
%data -> vector with scaled samples
%mdata -> marker... |
function y=prep(x)
% This function normalize data between [-1,1].
z_score = (x-mean(x))./std(x);
y = sigmo (z_score );
end |
function [ij,k] = centroid(A)
%--------------------------------------------------------------------------
%
% Copyright (c) 2009-2011 Jeffrey Byrne
% $Id: centroid.m 79 2012-07-27 14:30:30Z jebyrne $
%
%--------------------------------------------------------------------------
%% Subscript
[j,i] = meshgrid(1:size(A,2)... |
function out = convmass( in, uin, uout)
%CONVMASS Convert from mass units to desired mass units.
%Allowable UI and UO strings:
% 'lbm' pounds
% 'kg' kilograms
if ~isfloat( in )
error('Input is not floating point');
end
if nargin < 3
uout = 'kg';
end
uin = lower(uin);
uout = lower(uout);... |
clc;clear;
close all
for i = 1:25
result(i,:) = jiemi(i);
end
result % 第i行为编码逆位移动i个单位的解密结果 |
%%timefilter
%Filters a sounding data structure by year and month. Given a soundings
%data structure and a structure containing a span of years and an array
%of months, timefilter destroys all data that lies outside the span of
%years, and destroys all data that corresponds to the months within the
... |
function dz =contPLRNN2_addprob(~,z,A,W,h,dt,C,Inp)
% Code from Monfared & Durstewitz (2020), Proceedings of the 37th International
% Conference on Machine Learning
% (c) the authors
%%
%------------------------------------
%dz=contPLRNN2_(tt,z,A,W,h,dt,C,Inp)
n=size(z,1);
%-----------------------------------
... |
%Author: Mateusz Grossman
%Date: 07/01/2018
% %% sensitivity analysis on different number of input days with 5 days output.
%X=ParseCSV('daily_KO.csv');
X=ParseCSV('daily_IBM.csv');
actFun='linear';
nInputs = 1:40;
nOutputs = 5;
nFeatures = size(X,2);
bias = 1;
nHidden =nInputs*nFeatures+nOutputs*... |
function lonOut = longitude_conversion(lonIn,spec)
% lonOut = longitude_conversion(lonIn,spec)
%
% represent longitude (degrees) in the range from [0 360] or in the range
% [-180 180], whichever is requested
%
% 'spec' must be the string '180' to convert to the 180 representation, or
% '360' to convert to the '360' rep... |
% close all windows, clear all variables, clear command prompt
close all; clear all; clc;
[folder, name, ext] = fileparts(which('nnTrain'));
cd(folder);
% Adding necessary files to the java path
javaaddpath([folder '\weka.jar']);
javaaddpath([folder '\SMOTE.jar']);
% Preparing the data
% Open file promoter.csv, star... |
R = uint8(ones(120,160)*255);
G = uint8(ones(120,160)*0);
B = uint8(ones(120,160)*255);
minColor = 0;
maxColor = 255;
factor = 32;
%es wea + 1 * factor - 1
red = 255;
green = 255;
blue = 255;
block = 8;
counter = 0;
select = 1;
for j = 1:1:120
for i = 1:1:160
boxX = floor(double(i)/block);
box... |
%fsqfindldr(lambda,mu,c,m)
% This function finds the average number of machines being repaired (ldr)
% for a machine repair problem (finite source queue)
function out = fsqfindldr(lambda,mu,c,m)
p0 = fsqfindp0(lambda,mu,c,m);
firstsum = 0;
for i = 0:c-1
term = (c-i)*nchoosek(m,i)*(lambda/mu)^i*p0;
... |
function [ dynamics,setup ] = hessian_runner(x,setup)
global dx_old derivatives_old cont
if any(dx_old~=x)
for q=1:setup.assist.nP
solve.phase(q).state = hderiv(x(setup.mesh.phase(q).istatepoints),numel(x),reshape(setup.mesh.phase(q).istatepoints,1,[]));
% solve.phase(q).state = hderiv(x(setup.mesh... |
clear all
close all
load ('X:\bvi\!test\EPOC+\EEGEEG_Results.mat')
F3B=EEGEEGResults(1:5:end,9:12);
F4B=EEGEEGResults(1:5:end,44:47);
T7B=EEGEEGResults(1:5:end,17:20);
T8B=EEGEEGResults(1:5:end,36:39);
OB=(EEGEEGResults(1:5:end,24:27)+EEGEEGResults(1:5:end,28:31))/2;
F3H=EEGEEGResults(3:5:end,9:12);
F4H=EEGEEGResults(3... |
N = 1000;
X=randn(N,2);
var_x = var(X);
M = mean(X);
C = [2,1;1,2];
a = chol(C);
Xn = X*a;
var_xn = var(Xn);
Mn = mean(Xn);
m1 = [0 2];
m2 = [1.5 0];
%X1 = X + kron(ones(N,1),m1);
%X2 = X + kron(ones(N,1),m2);
X1 = Xn + kron(ones(N,1),m1);
X2 = Xn + kron(ones(N,1),m2);
var_x1 = var(X1);
M1 = (mean(X1))... |
function lpall = readAllContraBulbExp(lpall)
% OMPT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% clear inhibiton from contra. cells form a band from anterior to posterior
% no clear excitation
lpall(end+1).dirPath='g:\Data\2014\June\June_23_2014';
lpall(end).fileIndx=19;
lpall(end).cluster=1;
lpall(end).mouseType ... |
function [curv_transf, transf, ssr] = collapseCurves(curv, refcurv, tquery)
% [curv1, curv2, transf] = collapseCurves(curv1, curv2)
% Optimize for translation of a curve against curv2
%
% Parameters
% ----------
% curv : Mx2 numeric
% Curve to be shifted as closely as possible to refcurv
% refcurv : Nx2 numeric
% ... |
% This function generates the reference table for both players for SIG_V1
function [REF] = reference_matrix(n, p)
n_table = 10000; % Number of reference plays
REF = zeros(101,101); % Reference Matrix
for i = 1:1:101
for j = 1:1:101
% Game
for k = 1:1:n_tabl... |
function s = RLS_fit(u, xy1, rho, niters, s)
%%
if nargin < 3
rho = robust_function('quadratic', 1);
end
if nargin < 4
niters = 3;
end;
if nargin < 5
s = (xy1'*xy1)\(xy1'*u);
end;
% irerated least square
for iter = 1:niters;
err = u - xy1*s;
w = deriv_over_x(rho, err);
s = (xy1'* bsx... |
#include "com_codename1_ui_list_GenericListCellRenderer.h"
const struct clazz *base_interfaces_for_com_codename1_ui_list_GenericListCellRenderer[] = {&class__com_codename1_ui_list_ListCellRenderer, &class__com_codename1_ui_list_CellRenderer};
struct clazz class__com_codename1_ui_list_GenericListCellRenderer = {
DEBUG... |
function [a11,a21,a22,cp]=read_alb7;
%[a11,a21,a22,cp]=read_alb(f_master,mminj);
%
% a11, a21 ,a22 are NTOT-by-6 matrices with albedos
% organized column-wise as:
%
% 1 - North (i-index -1 )
% 2 - East (j-index +1 )
% 3 - South (i-index +1 )
% 4 - West (j-index -1 )
% 5 - Up (k-index +1 )
% 6 - Down (k-index... |
% Simulate the phage-bacteria-immune model, calculate steady state
% bacteria and phage densities at different phage decay and adsorption rate,
% and plot the resulting heat maps
% Figure caption:
%Heat map showing the dependence of (a) log steady state bacteria
%density $B_S$ and (b) log steady state phage de... |
function [ seqNames, seqs] = WriteFasta( outFileName, seqNames, seqs, append, lineLength)
%Write all of the sequences and seqNames that are there
%with 80 chars per line
if append==1
fid=fopen( outFileName, 'a');
else
fid=fopen( outFileName, 'w');
end
for i... |
function varargout = untitled(varargin)
% UNTITLED MATLAB code for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject,ev... |
function keyList = ztcKeyList()
% return a list of potentialy created KEYWORD in a ZtC data
% This is usefull when copying a header from one to an other
% e.g. naomi.copyHeaderKeys(ZtCData, ZtPData, naomi.ztcKeyList)
K = naomi.KEYS;
keyList = {K.ZTCDIAM, K.ZTCMNAME, K.ZTCNAME, K.ZTCNEIG, K.ZTCNZERN, ...
... |
function flambda = calc_flambda(y,lambda)
% calculating flambda
for i=1:size(y,2)
tmp(:,i)=y(:,i)*lambda(i);
end
lfsum=y*lambda';rho=0.0;
flambda=max(tmp')';%+rho*lfsum;
|
% LDA testing
load fisheriris
gscatter(meas(:,1), meas(:,2), species,'rgb','osd');
xlabel('Sepal length');
ylabel('Sepal width');
N = size(meas,1);
lda = fitcdiscr(meas(:,1:2),species);
ldaClass = resubPredict(lda);
%% Random forest
inpaintNans = 0; % logical value to inpaint nans during feature
... |
function handle = plotmyvec(vec,vecNames)
% plot differect projection vevtor
%
% Input:
% vec: structure with each field is a projection vector
% vecNames: Cell to write in the legend
lineWidth = 1.2;fontSize = 12;
if length(fieldnames(vec)) ~= length(vecNames)
error('ERROR: Input names does not match vectors');
... |
function [] = rewrite_files_from_solved_valve(N)
% Copyright (c) 2019, Alexander D. Kaiser
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain the ... |
function [W,M,Sigma,l] = EMk(X,k,delta,M)
%EM-алгоритм
%функция вычисляет веса, вектор математических ожиданий и ковариационные
%матрицы. Выходной параметр l - количество итераций. X - выборка, k - число
%компонент в смеси, delta - параметр критерия останова.
[m,n] = size(X);
g = [ones(m, 1) zeros(m, k-1)];
l=0; %ч... |
Globals2D
N = 4;
mesh = '/Users/jchan985/Desktop/wadges/meshes/periodicSquare2.msh';
[Nv, VX, VY, K, EToV] = MeshReaderGmsh2D(mesh);
StartUp2D;
% plotting nodes
Nplot = 15;
[rp sp] = EquiNodes2D(Nplot); [rp sp] = xytors(rp,sp);
Vp = Vandermonde2D(N,rp,sp)/V;
xp = Vp*x; yp = Vp*y;
% PlotMesh2D; axis on;return
Nq = ... |
function [QRSpos] = detectQRS(signal,fvz)
w_start = 11/(fvz/2); % Zaciatok pasmovej priepusti na 6 HZ
w_stop = 23/(fvz/2); % Koniec pasmovej priepusti na 23 Hz
n = 100; % Rad filtru
h_bp = fir1(n,[w_start, w_stop]); % impulz. ch. pasmovej zadrze
delay = round(n/2);
filt_sig1 = filter(h_bp,1,signal);% filtracia signal... |
function dp = backprop(dz,w,p,z,param)
%GAMPROD.BACKPROP Backpropagate derivatives from outputs to inputs
% Copyright 2012-2015 The MathWorks, Inc.
[S,Q,N] = size(dz);
R = size(p,1);
TruncateS = max(0,min(R-1,S));
TruncateR = max(0,min(R,S+1));
if (TruncateS == 0)
dp = zeros(R,Q,N,'like',dz);
else
... |
function [dom] = box2domain(box)
%BOX2DOMAIN Convert box to domain description.
%
%usage
%-----
% dom = box2domain(box)
%
%input
%-----
% box = pairs of extrema (vectors of the 2 corner points)
% = [#dim x 2]
%
%output
%------
% dom = axis extrema (like given to axis)
% = [1 x (2* #dim) ]
%
%about
%... |
function [theta,n] = theta_and_axis(R)
theta = acos(((trace(R))-1)/2);
n = [R(2,3)-R(3,2); R(3,1)-R(1,3) ; R(1,2)-R(2,1)]/(2*sin(theta));
theta = rad2deg(theta);
end
|
function [Korrespondenzen_robust,largest_set_EF] = ransac(I1,I2,Korrespondenzen,varargin)
%% Input parser
P = inputParser;
% geschaetzte Wahrscheinlichkeit, dass ein zufaellig gewaehltes Korrespondenzpunktpaar ein Ausreisser ist
P.addOptional('epsilon', 0.5, @(x) isnumeric(x) && (x>0) && (x<1));
% gewue... |
function [x,fs] = readwav(fname,samples)
%
% [x,fs] = readwav(fname,samples)
% Version independent wav file reader.
% This function defers to audioread or wavread depending
% on which tools is available.
%
if exist('audioread')==2,
if iscell(fname),
x = [] ;
for k=1:length(fname),
... |
function [prime_dsgn,other_dsgn] = scr_dsgn_preproc(proj,n_tr,stim_times)
% scr_dsgn_preproc constructs an scr design representation based on
% the stimulation times. The formed design functions are compatible
% with either LSA or LSS variants (Mumford et al., 2012)of the beta
% series method. The prime design can be... |
function x=calcU(alfa,b)
n=length(b);
x=zeros(n,1);
x(n)=b(n)/(1+alfa);
for i=n-1:-1:1
x(i)=b(i)+x(i+1);
end
end
|
function [ sim_conditions ] = labelROInames(numROIs, idx_deletedROI)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
ROInames = {'V1_d','V2_d','V3_d','V3A_d','V4_d','MT+_4',...
'IPS_d','LO_d',...
'IPS0_prob','IPS1_prob','IPS2_prob','IPS3_prob','LO_prob',...
'V3a_prob','V3b_p... |
%GA Program tooptimize PID Parameters
clear all;
close all;
size=30;
codel=3;
minx(1)=zeros(1);
maxx(1)=100*ones(1);
minx(2)=zeros(1);
maxx(2)=100*ones(1);
minx(3)=zeros(1);
maxx(3)=0*ones(1);
kpid(:,1)=minx(1)+(maxx(1)-minx(1))*rand(size,1);
kpid(:,2)=minx(2)+(maxx(2)-minx(2))*rand(size,1);
kpid(:,3)=minx(3)+(maxx(3)-... |
function [xminmax1, xminmax2, fminmax, out] = minmaxtdectpbest1bin(fitfun1, ...
maxfunevals1, lb1, ub1, lb2, ub2, options1, options2)
% MINMAXTCDE Min-Max Tracer Coevolutionary Differential Evolution with
% current to pbest mutation strategy and binomial crossover operator
% MINMAXTCDE(fitfun, maxfunevals1, lb1, ub1, ... |
% Function for filtering the raw electrode waveforms
% The function employs a stop band filter custom made for Erik Cook's lab
%
% Haider Riaz - haider.riaz@mail.mcgill.ca
% McIntyre Medical Building Room 1225
% Department of Physiology, McGill University
%
% Created by Haider Riaz 2014.
function [FiltTrode1 , FiltTr... |
% $Id: crwea_interp.m 44 2012-07-16 10:18:15Z rdj $
%
function [crpos_intp,cprmin_intp]=crwea_interp(crpos,operpoints,cprmin,operlimit)
% Added conservatim to CR position
CRPOS_ADD=2;
l=length(operpoints);
lu=length(unique(operpoints));
if l ~= lu
%disp(['Operpoints contains non distinct values. Removed ' ...
... |
x_vec;
x;
% Find i* index by searching vector for values >= x
% and taking the last (highest) one.
% Note that since x_vec is ordered, the last value
% returned by find() will be the greatest
i_star = find(x_vec<=x, 1, 'last');
|
%==========================================================================
%
% Estimate a two factor model of the term structure
% using forward spreads relative to the one year yield.
% Allow for money shocks as an exogenous variable.
%
%=========================================================================... |
% Set up for a rectange with height 0.2, width 1, centered on 0
% Define the rectangle in pdetool:
pderect([0,1,-0.1,0.1]);
% exported arrays in Draw step:
% gd =
% 3.0000
% 4.0000
% 0
% 1.0000
% 1.0000
% 0
% -0.1000
% -0.1000
% 0.1000
% 0.1000
% sf =
% R1
% ns =... |
%% isss_multiband.m
% Script to run for pilot scans comparing ISSS, multiband, and the new
% hybrid scanning protocol. Ported from my previous ISSS_test script.
% Author - Matt Heard
% CHANGELOG
% 08/07/17 Started changelog. -- MH
% 08/07/17 Found error in "prepare timing keys" that overwrote eventStartKey
% and ... |
function [var,m]=my_and_modules(var1,m1,var2,m2)
var=union(var1,var2);
index1=find(m1==-1);
index2=find(m2==-1);
m1_num=length(index1)+1;
m2_num=length(index2)+1;
m_num=m1_num*m2_num;
m_cell=cell(1,m_num); % each cell has between two -1 (like monomials)
for j1=1:m1_num
for j2=1:m2_num
... |
%Add paths to dependencies
addpath('../functions')
addpath('../functions/models')
addpath('../tests')
addpath('../tests/comparison')
%Run full test suite
Out = dltest('--time','--perform','--coverage','--badges');
if Out.Errors>0
logname = 'dltestsuite.error';
save(logname)
end
%Load the badges JSON endpoin... |
%load trialinfo
trigger_labels= trigger_labels'
%trigger_ts = trigger_ts/10000;
for i = 1:size(trialinfo,1)
trialinfo.trigger_labels(i) = trigger_labels(i);
if strcmp(trialinfo.stimlist(i),trialinfo.trigger_labels(i))
trialinfo.isCorrect(i)=1;
end
trialinfo.trigger_ts_start(i) = trigger_ts(i)/1... |
%% This function performs parameterization of wav files from a folder and
% saves parameters and other additional data to a table.
% Input:
% path_to_wavs (string) - Path to a folder with wav files.
% corpus_name (string) - Name of the corpus (string).
% add_data (table) - Data to be saved ... |
% Matlab script for chapter 1 of Bad Honnef tutorial on "Tangent space
% methods for Tangent-space methods for uniform matrix product states",
% based on the lecture notes: https://arxiv.org/abs/1810.07006
%
% Detailed explanations of all the different steps can be found in the
% python notebooks for the different cha... |
function [h]=fun_plot_stat(stat,n_fil,n_rep,x_tick_lab,pre_fix,flg)
x_tick =[1:n_fil];
for k=1:n_fil
for j=1:n_rep
er_V05(k,j)=stat(k,j).V3.er_s5_r_d;
er_V10(k,j)=stat(k,j).V4.er_s01_r_d;
end
end
hold on
x_ind=[1:n_rep];
if flg==5
for i=1:n_fil
h=plot(i*ones(size(x_ind)),er_V05(i,:)... |
for data = [20, 50, 100]
clf;
points = strcat('points_', num2str(data));
allpts = strcat('gp_data_', num2str(data));
D = load(allpts);
dim = size(D);
n_class = max(D(:,dim(2)));
P = load(points);
[C,ia,ib] = intersect(P(:,1:2),D(:,1:2),'rows');
for c = 1:n_class
S = D(ib, :);
vals = S(find(... |
% period is 5
xt = [1,2,3,2,1,1,2,3,2,1,1,2,3,2,1,1,2,3,2,1];
result = getPeriod(xt)
% period is 1
xt = [1,1,1,1,1,1,1,1];
result = getPeriod(xt)
% period is 3
xt = [1,1,3,1,1,3,1,1,3,1,1,3];
result = getPeriod(xt)
% period is 7
xt = [1,1,3,1,1,3,2,1,1,3,1,1,3,2,1,1,3,1,1,3,2,1,1,3,1,1,3,2,1,1,3,1,... |
function [L,k] = lin_disp(T,h)
%Calculates teh linear displace of wave
g=9.81;
w=(2*pi)/T;
tol=1.0*10^-5; %%tolarance
%% Wavelegth
k_old=(2*pi)/((g*T^2)/(2*pi));
% k_old=(2*pi)/T
my_diff=1;
while (my_diff>tol) % creating the iteration and finding k
k=(w^2)/(g*tanh(k_old*h));
my_diff=abs(k-k_old);
k_old=k... |
function [ out ] = wdtw(X, Y, weight_meanCluster)
sakoe_chiba_band = 1;
X = X';
Y = Y';
%Compute the size of each time serie
%-------------------------------------------------------------------------------------------
n = size(X,1);
m = size(Y,1);
%Local Cost Matrix (Dissimilarities)
%--------------------------------... |
function z = apply(w,p,param)
%LINKDIST.APPLY Apply weight to input
% Copyright 2012-2015 The MathWorks, Inc.
S = size(w,1);
Q = size(p,2);
z = zeros(S,Q,'like',w);
end
|
function [fi1,fi0,fi] = multivariatemodle(name,result,vacab)
n=length(vacab);
m=length(name);
fi1=zeros(1,n);
fi0=zeros(1,n);
total1=sum(result);
total0=m-total1;
for i=1:n
c1=0;
c0=0;
for j=1:m
idx=strfind(name{j},vacab(i));
if size(idx,1)~=0 && result(j)==1
c1++;
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function doExtractImagesFromLabelme
%
% Input parameters:
%
% Output parameters:
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function doExtractImagesFromLabelme
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function words=parseIdxCont(input, delims, addToList, startIdx)
if isempty(input)
words=addToList;
return;
end
original = input;
quit = 0;
%Convert inputs to character arrays for processing
input=char(input);
delims=char(delims);
%Find first hit for each delim
hits = [];
for c=delims
%Find one ma... |
%------------
% sort_index contains the indices of all the intersecting map lines in sorted order (asc order)
%
% If I'm on a line and trying to move outside, stay on the line.
% If I'm at a corner, move 1 cm away from the corner; but stay within the padded map.
% If I'm on a line and trying to move inside, move 1cm aw... |
function [xxt,yyt]=angls2links2(bq)
global l1 l2
l1=1;l2=1;
for j=1:size(bq,2)
[x1(j),y1(j)]=pol2cart(bq(1,j),l1);
[x2(j),y2(j)]=pol2cart(bq(2,j)+bq(1,j),l2);
xx1(j,:)=linspace(0,x1(j));
yy1(j,:)=linspace(0,y1(j));
xx2(j,:)=linspace(0,x2(j));xx2(j,:)=xx2(j,:)+x1(j);
... |
classdef rlTrainingOptions < rl.option.BaseSimOptions
% RLTRAININGOPTIONS: Creates training options for RL.
%
% OPT = RLTRAININGOPTIONS returns the default options for RL agents.
%
% OPT = RLTRAININGOPTIONS('Option1',Value1,'Option2',Value2,...) uses name/value
% pairs to override the defa... |
function im = Color(file,blob)
image = file;
im = double(image);
r = im(:,:,1); g = im(:,:,2); b = im(:,:,3);
pix = 50;
meanR = mean(r(blob)); meanR = meanR.* ones(pix,pix);
meanG = mean(g(blob)); meanG = meanG.* ones(pix,pix);
meanB = mean(b(blob)); meanB = meanB.* ones(pix,pix);
im = cat(3, meanR, meanG, mean... |
function alsuinit(OperationalMode)
%ALSUINIT - MML setup file for ALS-U
if nargin < 1
% Default operational mode: User Mode
OperationalMode = 1;
end
% Clear previous AcceleratorObjects
setao([]);
setad([]);
% Build the device lists
for Sector = 1:12
TwoPerSectorList(2*(Sector-1)+1:2*Sector,:) = [... |
function [c,a_match,b_match] = union_sorted_rows(a,b)
%UNION_SORTED_ROWS Set union of sorted sets of row vectors.
% UNION_SORTED_ROWS(A,B) where A and B are matrices returns the combined rows
% from A and B with no repetitions. Rows of A (and B) must be sorted and
% unique, and the resulting rows will be sorted... |
a = 0.2; % value for a in eq (1)
b = 0.1; % value for b in eq (1)
tau = 17; % delay constant in eq (1)
x0 = 1.2; % initial condition: x(t=0)=x0
deltat = 1; % time step size (which coincides with the integration step)
sample_n = 6000; % total no. of samples, excluding the given i... |
# Julio Esteban de León Saravia 201807036
# German Omar Chiguichón Sibrian 201801458
# Video 34
d=[0 45 90 135 180 225 270 315 360];
a=cos(d)+sin(d);
fprintf('Resultado 1: %f \n', a )
b=cosd(d)+sind(d);
fprintf('Resultado 2: %f \n', b )
c=atan(0.2);
fprintf('Resultado 3: %f \n', c )
e=cot(7);
fprintf('Resultado 4: %f ... |
%this is how you can use the function CDMAmodem.m in your code
clc;
close all;
user1in=[1,0,0,1,1,0,0,1,1,0]; %only bindary sequences with user and user2 having same lengths
user2in=[1,1,0,0,0,1,1,1,1,0];
display(user1in);display(user2in);
[opuser1,opuser2]=CDMAmodem(user1in,user2in,10);%change snr to -5 and se... |
function Raster2(tsd,pre,post,ax)
LVcs = tsd(:,2)==50; % flags CS onsets
LVus = tsd(:,2)==70; % flags US onsets
Db = [tsd(LVcs,1)-pre 45*ones(size(tsd(LVcs,1)))]; % to be inserted onset data
De = [tsd(LVus,1)+post 85*ones(size(tsd(LVus,1)))];% to be inserted offset data
tsd = sortrows([tsd;Db;De]);
[~,b] = TSmatch(tsd,... |
function [ideal_Gibbs_RT,ideal_dGibbs_dxRT, Gibbs_total_RT,dGibbs_total_dxRT] = Gibbs_mix_total(org_mole_frac_scan, GibbsEx_RT, dGibbsEx_RTdx)
%%
% Created by Kyle Gorkowski [GORKOWFALCON] on 2019-May-05 10:16 AM
% Copyright 2019 Kyle Gorkowski
% calculates the total Gibbs energy of mixing, non-ideal from BAT plus... |
function layers=open_rdi_raw(Filename_cell,varargin)
p = inputParser;
if ~iscell(Filename_cell)
Filename_cell = {Filename_cell};
end
if ~iscell(Filename_cell)
Filename_cell = {Filename_cell};
end
if isempty(Filename_cell)
layers = [];
return;
end
[def_path_m,~,~] = fileparts(Filename_cell{1});
ad... |
fid = fopen('digits.trn','r');
S = fscanf(fid,'%f');
fclose(fid);
S=reshape(S,192+10,round(size(S,1)/(192+10)))';
S=diag((1./max(S')))*S;
S=S>0.1;
NR=12 % Zeigt exemplarisch die Ziffer Nummer 12 an
image(reshape(S(NR,1:192),12,16)'*64);
title(sprintf('Ziffer Nr %i soll eine %i sein.',NR,find(S(NR,193:202))-1));... |
addpath('../lib')
addpath('../lib/aboxplot');
addpath('/shared2/LabUserFiles/Sanjana_Gupta/Original/ptempest/core/');
addpath('/shared2/LabUserFiles/Sanjana_Gupta/Original/ptempest/core/distr/');
%%
save_pth = './pdf_updated_figures_July23_2019/';
B = [0.1,0.2,0.5,1,5,0.01,0.05];
n = 7e5;
fontsize = 24;
step = 100;
% n... |
%%%%%%%%%%%%%%%% MEASURE LINES %%%%%%%%%%%%%%%%
%
% Calculate line (ridges, grooves, etc...) specifc statistics. An ROI is assumed to be in use.
%
% Inputs:
% N - the number of images
% M - the number of boundary points plus one
% lineAngle - the angle of surface directionality w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.