text stringlengths 8 6.12M |
|---|
classdef rammus < champion
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
properties
possible_actions = {'uparrow' 'leftarrow' 'downarrow' 'rightarrow' 'q' 'w' 'e' 'r' 'f'};
taunt_delay = 0;
powerball_delay = 0;
reflect_delay = 0;
tre... |
function [L,R]=FLOYD1(w,s,t)
n=size(w,1);
D=w;
path=zeros(n,n);
%以下是标准floyd算法
for i=1:n
for j=1:n
if D(i,j)~=inf
path(i,j)=j;
end
end
end
for k=1:n
for i=1:n
for j=1:n
if D(i,k)+D(k,j)<D(i,j)
D(i,j)=D(i,k)+D(k,j);
... |
%% get information for report
[exptCSV,exptPath,FilterIndex] = uigetfile('*.csv','Select CSV experiment file');
cd(exptPath);
currDir = pwd;
rptDir = [currDir,'\report'];
if ~exist(rptDir)
mkdir('report')
end
exptParams = readtable(exptCSV,'Format',...
'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%... |
function [VV,FF,RIM] = glue_reverse(V,F,varargin)
% GLUE_REVERSE Glue a mesh to itself at its boundary reversing the
% z-coordinates of one of the copies. Useful for creating closed meshes from
% inflated disks.
%
% [VV,FF,RIM] = glue_reverse(V,F)
%
% Inputs:
% V #V by 3 list of vertex positions
%... |
% Calculate Catalase heme B heating after disproportionation of H2O2
% assuming that all of the heat is transfered into the product molecule:
T1 = 298; %(K) - Assume room temp to start.
delta_H = 100; %(kJ/mol) - Estimated total heat released during catalytic
%turnover from Bustamante, et. al.
Cp_Z... |
in_dir='F:\Bharti\Thesis\data\VOC2012\Class_Masks\15_person\offset\train\';
out_dir='F:\Bharti\Thesis\data\VOC2012\Class_Masks\15_person\offset\train\c';
mkdir(out_dir);
files_info = dir([in_dir filesep '*.mat']);
for file_no=2:2
filename=files_info(file_no).name;
f=load(fullfile(in_dir,filename));
off=f... |
function [] = GetPCARep()
warning('off','all');
cellinfo
numCells = length(celldata);
neuralResponse = cell(numCells,1);
for ii=1:numCells
load(celldata(ii).datafile,'resp');
neuralResponse{ii} = resp;
end
for ii=1:numCells
resp = neuralResponse{ii};
inds = find(~isnan(resp));
newResp = re... |
function [ p2c ] = primitive_to_conserved_1D( qp )
%Function "primitive_to_conserved_1D:
% MATLAB version of Joe Derlaga's "primitive_to_conservative_1D.f90:,
% created 070313.
% Takes primitive variables [rho,u,p] and returns conserved variables.
global xgm1
p2c = zeros(3,1);
% --------------
p2c(1) ... |
function plotMRCPs(Data,Subject_name, MRCP_channels,optimized_MRCP_channels)
%UNTITLED Summary of this function goes here
% Function to plot Grand Averaged MRCPs and highlight classification
% channels
Channel_nos = [ 4, 38, 5, 39, 6,...
43, 9, 32, 10, 44,...
... |
function [m,Y] = Bspline2(X,t)
XX = [X 0 0 0];
l = length(X)-1;
m = linspace(0,l,(t+1)*l + 1);
i = floor(m);
Bk = @(x)(1-abs(x));
Y = Bk(m-i).*XX(i+1) + Bk(m-i-1).*XX(i+2);
end
|
function ucm2 = im2ucm(image,mode)
if nargin<2
mode = 'fast';
end
% Load pre-trained Structured Forest model
load(fullfile(root_dir, 'data', 'model', 'sf_modelFinal.mat'));
if strcmp(mode,'fast')
% Which scales to work on (MCG is [2, 1, 0.5], SCG is just [1])
scales = 1;
% Get the hierarchies at each... |
rng(1);
global N;
global M;
global En;
global Sn;
global Cn;
global Et;
global St;
global Ct;
global P;
global MAX1;
global MAX2;
global MAX3;
%number of resource node
M = 40;
En = floor(200+300*rand(1,M));
Sn = floor(100+400*rand(1,M));
Cn = floor(100+150*rand(1,M));
Et = 10+40*rand(1,N);
St = 50+50*rand(1,N);
C... |
%% Generate points that are rougly co-planar
v1 = rand(1,3) - 0.5;
v2 = [v1(1), -v1(2), v1(3)];
%v2 = rand(1,3) - 0.5;
v1 = v1./norm(v1);
v2 = v2./norm(v2);
V1 = repmat(v1, [50, 1]);
V2 = repmat(v2, [50, 1]);
P = V1 .* rand(50,1) + V2 .* rand(50,1);
P = P + (rand(50, 3) .* 0.1);
%plot3(P(:, 1), P(:, 2), P(:, 3), '... |
% Comsol server required
%% preprocessing, copied from main_solo.m
ratio=0.2; %ratio of solid
nx=10;
ny=10;
l=0.1;
d=l/nx/2;
nx_q=300;
ny_q=300;
qtotal=632080;
[coords,~] = fun_gen_coord(nx,ny,l);
N=nx*ny;
coord_list=reshape(coords(:,:,1:2),nx*ny,2);
delta_xy=pdist2(coord_list,coord_list,'squaredeuclidean');
A=zeros... |
function [ returnStruct ] = Get_Ht_Deconvolving(Sim_Struct, AIF, Ct , Output_directory, Subject_name, Force_RealData_Calc, Verbosity)
%Get_Ht_Deconvolving Extracting possible h_t filter
% The function gets AIF(nT), Ct(num_voxels,nT) - the arterial input function and the tissue conventration (in minutes metric).
% ... |
function tmp
close all
clear all
clc
% elderly_fig4_modelselection_earsize;
hold on
[g8,d8] = elderly;
[g7,d7] = avdr;
[g6,d6] = geta;
% [g5,d5] = avprior; % elevation
[g1,d1] = plug;
[g2,d2] = plug2;
[g3,d3] = mold;
% [g4,d4] = owl; % molds??
d = [d1; d2; d3; d6; d7; d8];
g = [g1; g2; g3; g6... |
function opt = rlSACAgentOptions(varargin)
%rlSACAgentOptions: Creates options for SAC Agent
%
% OPT = rlSACAgentoptions returns the default options for rlSACAgent.
%
% OPT = rlSACAgentOptions('Option1',Value1,'Option2',Value2,...) uses name/value
% pairs to override the default values for 'Option1','Option2',..... |
function SOL=tug_Bankruptcy(E,d)
% TUG verifies game solution/property with the Mathematica Package TuGames.
%
% Usage: SOL=tug_Bankruptcy(E,d)
% Define variables:
% output:
% SOL -- Returns a modest bankruptcy game.
% Field variable gives result in Matlab and Mathematica format.
% input:
% E ... |
function h = bpfilter(objsize)
% h = bpfilter(objsize)
% creates a bandpass filter for objects of diameter objsize
%
% R. Parthasarathy
% based on Andrew Demond's program, based on MATLAB examples
% 28 May 2007 -- remove 'hole' in intensity at low f
% last modified 28 May 2007
[f1,f2] = freqspace(objsize*2+1,'meshgri... |
%@(#) cpos2knum.m 1.3 06/01/13 07:59:23
%
%function kannum=cpos2knum(y,x,mminj)
%or function kannum=cpos2knum(yx,mminj)
function kannum=cpos2knum(y,x,mminj)
if nargin==2, mminj=x;x=y(:,2);y=y(:,1);end
lx=min(length(x),length(y));
ll=length(mminj)+2;
kannum=zeros(lx,1);
for i=1:lx,
%added the second condition, ... |
function [output] = KONSTANTEN(TC, pCO2);
%(08.12.2010/m)
%function KONSTANTEN(TC, pCO2) calculates activity coefficients, mass action constants,
%reaction rate constants and concentrations of all species [mol/l] comprised in the
%CO2-H2O-CaCO3 system.
%
%output variables
%
%activity coefficients
%ac = [gammaC... |
classdef SeasonAnalyzer
properties
%our season day converter
seasonDayConverter;
%our intervals
cardLevelInterval;
dayInterval;
%our grids
cardLevelGrid;
dayGrid;
normalizedFrequencyGrid;
%Resolution for our grids
... |
function [ LPred ] = kNN(X, k, XTrain, LTrain)
% KNN Your implementation of the kNN algorithm
% Inputs:
% X - Samples to be classified (matrix)
% k - Number of neighbors (scalar)
% XTrain - Training samples (matrix)
% LTrain - Correct labels of each... |
function findExit(serPort)
initVariables();
align2exit(serPort);
go2exit(serPort);
end
function initVariables()
global gap; gap = 1;
global Front; Front = 100;
global F; F = 100;
global R; R = 100;
global L; L = 100;
end
function align2exit(serPort)
global F_Sonar... |
clear
clc
source_dir = 'C:\Temp\Oscop data\Oscop data out';
source_files = dir(fullfile(source_dir, '*.xls'));
for i = 1:length(source_files)
i
data = xlsread(fullfile(source_dir, source_files(i).name));
sig{i,1}=source_files(i).name;
sig{i,2}=data( : , 2);
end
save('C:\Temp\Oscop data\sig.mat', 'sig') |
function img_threshold = XuSoftThresholding(img, th_l,th_h, lower_or_upper)
% lower_or_upper<0 means lower portion
% lower_or_upper>0 means higher portion
lower = img<th_l;
upper = img>=th_h;
transitional = (img>=th_l).*(img<th_h);
if lower_or_upper>0
transitional = transitional.*[(img-th_l)/(th_h-th_l)];
im... |
function [network_data, geology_data, soil_data, shreve_data, ...
alternative_data, atanb_data, drift_data, ...
permeability_data, permeability_data2, ...
elevation_data] = ...
loadGISResults(ID)
%LOADGISRESULTS Load table from GIS anaylsis.
%
% INPUT
% ID: gauge ID
%
% OUTPUT
% network_da... |
classdef clObstacle
properties
type
P1
P2
radius
color = [1 0 0 0.1];
end%properties
methods
function obj = clObstacle(varargin)
obj.type = varargin{1,1};
if strcmp(obj.type,'box')
if nargin == 3
... |
%signal
%sampling freq
%freq-spectrum size
fs = 16000;
dftsize = 512;
spectrogram(out,hamming(dftsize),floor(dftsize/2),floor(dftsize/4),fs)
%spectrogram(simin(:,1),'yaxis')
sig = out;
%[simin, nbsecs, fs] = initparams(sig, fs);
%sim('recplay')
%out = simout.signals.values;
|
classdef TuKrn < TuSol
% TUPRK creates the subclass object TuKrn to perform several computations for retrieving
% and modifying game data. It stores relevant game information and
% kernel elements obtained by overloading functions from various solvers.
%
% Usage: clv = TuKrn(v,'gtype','gformat')
%
% Define variables:
... |
function plot_variability(all_stats_all_features)
%Get indexes of features of interest
[morph_indexes,~]=narrow_by_feature_type(all_stats_all_features.feature_name,'morph_3D');
[stat_indexes,~]=narrow_by_feature_type(all_stats_all_features.feature_name,'stats_3D');
[texture_indexes,~]=narrow_by_feature_type(all_stats_a... |
function [mTrans] = Translation(dx,dy)
%TRANSLATION creates a translational matrix given the x and y translation
%values
%Define given variables and translation matrix
mTrans=eye(3); %idendtity matrix
mTrans(1,3)=dx; %translate x values
mTrans(2,3)=dy; %translate y values
end
|
%% Subacz, RBE502, Homework 4, Problem 5
function []= Problem4()
clc, clear all, close all;
%parameters for the arm
%Importing the parameters from table 5.1, page 115 of kelly's book
I_1 = 0.1213; I_2 = 0.0116; m_1 = 6.5225; l_c1 = .0983; m_2 = 2.0458;
l_c2 = .0229; l_1 = 0.26; l_2 = 0.26; g = 9.81; w_1 = 4; w_2 = 3;... |
close all;
clear all;
FFT_LEN = 4096;
CENTER_FREQ = 172250000;
data = raw2complex('/tmp/sdr_data/RAW_DATA_000001_000001');
data_len = length(data);
num_ffts = data_len / FFT_LEN;
fft_in_data = reshape(data, [FFT_LEN, num_ffts]);
fft_out_data = fft(fft_in_data);
P2 = abs(fft_out_data / FFT_LEN);
P2 = [P2(FFT_LEN/2+1:F... |
function testUnwrapVec()
%TESTUNWRAPVEC testUnwrapVec()
% Test for unwrapping vector to params.
% 10/10/13
X = rand(4,2);
hyp = rand(3,1);
u = wrapToVec(X, hyp);
[Xres, hypRes] = unwrapVec(u, 4);
assert(all(all(Xres == X)));
assert(all(hypRes == hyp));
disp('test unwrapVec() passed');
|
% Projecting original system to reduced system
% Input : os = original system
% U = left projection matrix
% V = right projection matrix
% Output:
function [rs] = reduce_stable(os,U,V);
rs.E=U'*os.E*V;
rs.A=U'*os.A*V;
rs.B=U'*os.B;
rs.C=os.C*V;
%
|
function[]=triangulo(a,b,c)
if a==b && b==c
disp('Triángulo Equilátero')
else if ~(a==b && b==c) && (a==b || a==c || b==c)
disp('Triangulo Isósceles')
else disp('Triángulo Escaleno')
end
end |
n=input('n=');
if rem(n,2)==0;
A='even'
else
A='odd'
end |
function pop = setDisplay(pop,displayList)
% population/setDisplay
%
% pop = setDisplay(pop,displayList)
%
% Sets display parameters:
% best: display best individual found so far
% chroms: display chromosomes
% phenos: display phenotypes
% params: display population parameters
%
% For example pop=setDisplay(... |
function power_W = calculate_recup_power_f(area_m2)
ROOM_HEIGHT_M = 2.5;
V_m3 = area_m2 * ROOM_HEIGHT_M;
power_W = V_m3 / 2;
end |
% if k is even the window for nth WILL NOT include the x(n), if k is odd
% window will be symmetric around the nth value. sides are discarded.
function M = Pej_Movmean(x,k)
L = length(x);
M = nan(size(x));
if mod(k,2)==1
% k is odd
w = (k-1)/2;
M(1+w)= sum(x(1:k));
for wc = 2+w:L-w
M(wc) = x(wc... |
%% SYS800 - Reconnaissance de formes et inspection
% M'Hand Kedjar - December 2016
C = log10([1 5 10 30 70 100 200 500 1000 3000 6000 10000]);
g = log10([0.1 0.05 0.01 0.0075 0.005 0.003 0.001 0.00075 0.0005 0.00035 0.0002 0.0001]);
err_mtx = ...
[834 657 111 83 47 35 30 29 37 43 ... |
close all hidden
clear all hidden
cd('E:\DATA\Test\Auditory Center\MA-MW-2012-09-04');
datfile = 'MA-MW-2012-09-04-0000.dat';
dat = pa_loaddat(datfile,8,5000);
whos dat
btn = squeeze(dat(:,:,4));
[expinfo,chaninfo,mLog] = pa_readcsv(datfile);
ntrials = size(btn,2);
R = NaN(ntrials,1);
L1 = R;
... |
%% What's it?
% im_pix_line draws a "pixel by pixel" imline and im_circle draws a "circle
% version" of imrect.
%% INSTALL
% im_pix_line and im_circle is adopted from imline and im_circle,respectively.
% So either of the following methods to intall is OK:
%
% * simple mode
%
% Unzip the zip file, copy the whole... |
%% Project2
% This script will compute all the functions needed for Project2
% April 17, 2018
% Dylan Stewart
Ytrain = []; EstParameters = []; EstConfMatrices = []; ConfMatrix = []; EstLabels = [];
% load training data
load('Proj2FeatVecsSet1.mat'); load('Proj2TargetOutputsSet1.mat');
Alg = {'SVM' 'RVM' 'GPR'... |
function [] = plot_results(t, x, y, u, s, t_end, ctl_period, ctl_delay, annotate, recActRes, recSenRes, t_controller)
% annotate determine if you want to have vertical lines
% for periods and computational delays
% create a figure and maximise it on the screen
% in the figure we'll have three subplots... |
%===============================================================================
% Description : Acquire acoustic data from default system soundcard and plot
% in both time and frequency domain.
%
% Parameters : Fs - Acquisition sample frequency [44000] Hz
% n_bits - Sample ... |
function [w] = rel_error(x, x_approx)
%rel_error Zwraca błąd względny wektora
w = norm(x-x_approx)/norm(x);
end |
function [image] = flattenColor(imagePath)
image = imread(imagePath);
%freqColors = getColorsByFrequence(image, 8);
freqColors = colorPalette();
% for i = 1 : size(colors, 1)
% image = layerColorFlatten(image, colors(i, :));
% end
vSize = size(image, 1);
hSize = size(image, 2);... |
% Captura sonido desde la linea de entrada de la tarjeta de sonido y lo
% graba con los parametros pasados como argumentos en el fichero indicado
function [y] = grabaSonido(fichero, frecMuestreo, resolucion, canales, duracion)
% Creamos un objeto para grabar audio y establecemos la frecuencia de
% muestreo, la re... |
function varargout = graph2Contours(nodes, edges) %#ok<INUSL>
%GRAPH2CONTOURS Convert a graph to a set of contour curves.
%
% CONTOURS = GRAPH2CONTOURS(NODES, EDGES)
% NODES, EDGES is a graph representation (type "help graphs" for details)
% The algorithm assume every node has degree 2, and the set of edges... |
function mergespm(filelist,outfilename)
loadpaths
fprintf('\nMerging the following files:\n');
for f = 1:length(filelist)
file2merge = [filepath filelist{f} '.mat'];
fprintf('%s\n',file2merge);
S.D{f} = spm_eeg_load(file2merge);
end
outfilename = [filepath outfilename '.mat'];
fprintf('\ninto this file:\... |
classdef mixHMM < handle
properties
NC % number of clusters (each cluster is defined by a HMM)
dim % dimension of the state space
D % dimension of the observation space
obsTypes % obsTypes is input to the constructor of the dists.GPEF distribution
%
... |
function y = ncisb(H,L,BL,Zi1,Zi0)
% NCISB(H,L) takes in high/low channel data in vectors H,L, filters them
% with non-causal IIR half-band allpass filters derived from 5th-order
% Butterworth filter (ref. Mitra P10.40) and returns output data vector
% y using double-buffer scheme. Works with NCIAB, use same BL.... |
function mask = get_random_mask(sampling_factor)
%GET_MASK Summary of this function goes here
% Detailed explanation goes here
% Read my data
basic_path = '/media/ohadsh/Data/ohadsh/work/matlab/thesis/';
W = 256;
H = 256;
size_dat = W*H;
path_mask = fullfile(basic_path, ['mask', num2st... |
function SetConstraints( tController )
% Setting the constraints for the optimization problem
%
try %
%
% Getting necessary data
fCurrentJulianDate = Time.GetCurrentJulianDate();
fSamplingTimeInJulianDates = Time.GetJulianSecond() * tController.fSamplingTimeInSeconds;
iNumberOfInputs = size( tControl... |
function [sweep_vals, scaleaxis, sweep_kpts] = tblg_kp_calc_ext(varargin)
% Computes eigenvalues for selected k-points according to the Name/Value
% pair list supplied in varargin.
% Here we let number of bands = nb, and the number of k points = kp.
%
% sweep_vals: Cell containing the nb x nk eig... |
function [z]=f_sys(w,t,q)
%
z=zeros(1,2);
u=w(1); % y(t)
v=w(2); % y'(t)
z(1)=v;
z(2)= -q*(u^2-1)*v - u;
%
|
function P = POI(img)
% Finding the point of intersection of the horizontal blue line and vertical pink line
if size(img,1) ~= 352 && size(img,2) ~= 352
img = imresize(img, [352 352]);
end
[y, x] = size(rgb2gray(img));
y = y/2; x = x/2;
imc1 = uint8(zeros(size(img)));
% Taking a patch of size 120x1... |
classdef Collector < MosaikAPI.Simulator
% COLLECTOR A simple data collector that prints all data when the simulation finishes.
% Shows required data as table, graphical plot and saves it. To capture it, connect
% the required data to the collector.
properties (Constant)
model = 'Collector' % Mod... |
function [data_fname,rho_fname] = file_selec(days,tstep,rho_year)
str_days=num2str(days); str_tstep=num2str(tstep);
path='data_';
data_fname=strcat(path,str_days,'days_',str_tstep,'s.mat');
if rho_year == 2022
rho_folder = '2022 Solar Activity Density/';
elseif rho_year == 2020
rho_folder = '2020 Sol... |
function f = fct_filter(f,sigma,dt)
% Filter f along second dimension of f
%
N_ini = size(f,2);
sigma = 1/8 * sigma;
%% Mirror (since the data are non-periodic)
f = [f(:,end:-1:1) f];
N = size(f,2);
% Ensure that the number of time step is even
N_d_n_dt = mod(N,2);
if N_d_n_dt > 0
warning([ num2str(N_d_n_dt) ' ... |
function results=gab_task_erplab_gaverager(args)
%% DESCRIPTION
%
% GAB wrapper for ERPLAB's pop_gaverager for computing grand averaged
% ERPs.
%
% INPUT:
%
% args.
% erp_index: index of ERPs to average (default is all ERPs loaded)
% iswavg: is weight averaged (1=weighted 0=classic average)
%
... |
function [score]=SCPMFDR(Y,M,D,r)
[~,m]=size(M);
[~,n]=size(D);
B=spones(Y);
rand('state',0);
W=rand(m,r);
rand('state',0);
H=rand(n,r);
W=W';
H=H';
parm1=1;
parm2=1;
parm3=0.1;
parm4=0.1;
k=1;
while k<1000
W=W.*((H*(Y'.*B')+2*parm3*W*M)./(H*((H'*W).*B')+parm1*W+2*parm3*W*(W')*W));
H=H.*((W*(Y.*B)+2*parm4*H*D... |
% Exercise 5.5 - bootstrap confidence intervals for regression parameters
datdir = 'c:\MyFiles\Teach\DataAnalysis\Data\';
dattxt = 'lightair';
alpha = 0.05;
M = 1000;
xyM = load([datdir,dattxt,'.dat']);
xysM = sortrows(xyM);
xV = xysM(:,1);
yV = xysM(:,2);
n = length(xV);
xM = [ones(n,1) xV];
[bV, bint,r... |
%% load in
signals = dsp__get_signals( db );
%% GET CURRENT SIGNALS
current_signals = dsp__ref_subtract_within_day( signals.rwdOn );
current_signals = remove( current_signals, 'errors' );
current_signals = filter( current_signals );
%% GET CURRENT SIGNALS - STRUCT
signals = signals.remove( 'errors' );
signals = si... |
% Quick Peak Analysis
clearvars;
close all;
% Get scan information and set path
addpath ../kernel/
scan_table; % Found in kernel directory
source_table; % Found in kernel directory
% Specify session information
session = AGBT16B_400_14;
on_scan = 4;
source = source3C295;
Nint = 1;
% Parameters
pol = 'X';
ele = 1;
%... |
function compileNu(base_dir, chi, Da, Ra, res_uniform, res_vm, NuLeBars)
if nargin == 0
base_dir = '/home/parkinsonjl/mnt/sharedStorage/TestDiffusiveTimescale/ConvectionDB-cfl0.15/';
chi = '0.4';
Da = '1e-06'; % '1.0e-02'
res_uniform = 128;
res_vm = 128;
if strcmp(Da, '1e-06')
... |
% Copyright (C) 1995, 1996, 1997, 2005, 2006, 2007 Kurt Hornik
%
% This file is part of Octave, coverted to Matlab style
%
% Octave is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the Licen... |
function mosim = mosaicImage(im)
% MOSAICIMAGE computes the mosaic of an image.
% MOSIM = MOSAICIMAGE(IM) computes the response of the image under a
% Bayer filter. Given an image IM = NxMx3, the output is a NxM image
% where the R,G,B channels are sampled according to RGRG on the top left.
%
% This code is part ... |
//////////////////////////////////
// Library for polytopes
//////////////////////////////////
// NPolytope
// INPUT: a polynomial f
// OUTPUT: the Newton polytope of f
NPolytope := function(f)
return Polytope([Exponents(m) : m in Monomials(f)]);
end function;
// Slices
// INPUT: a polytope pol, a vec... |
function Vnew = embeddingR6_vecs(p,V)
%EMBEDDINGR6_VECS embeds V in TpM onto R6.
%
% p is a base point. V is tangent vectors.
% V is 3-by-3-n. n is the number of matrices.
if length(size(V)) == 2
Vnew = embeddingR6(p, V);
return;
elseif length(size(V)) == 3
% Common part
nmx = size(V,3);... |
function callnnpiter
% routine to call nnpiter
% load some data
load GBPdata1sShort
%x=diff(eurusd(1:300000,4));
N=round(length(bid)/1);
x = diff(0.5*(bid(1:N)+ask(1:N)));
tic
% parameters for the model
%window=25; d = 10; n=5;
%window=10; d = 3; n=5;
window=15; d = 3; n=10;
% evaluate the model and compute... |
%{
The study of the STT-effect using the Landau–Lifshitz–Gilbert-Slonczewski-Berger equation.
%}
function tst
% matherial parameters
a = 0.02;
b = 2.856;
ha = 0.42;
na = [0 1 0];
Nx = 0.32; Nz = 0.36; Ny=Nx;
Y0 = [11*pi/24; pi/24];
J0 = 3.165995e-03;
w1 = 0.1;
Nr = [Nx Ny Nz];
kf = 400;
w... |
vvv=zeros(1,1);
for cot=1:30
A='C:\Users\Administrator\Desktop\Validation\V_2\';
B=num2str(cot);
C='.bmp';
D=[A,B,C];
gg=imread(D);
%gg=rgb2gray(gg);
gv=imresize(gg,[20 20]);
fv=Hist_Equalization(CorrectLight(gv));
fv(1,1:4)=0;fv(1,17:20)=0;
fv(2,1:3)=0;fv(2,18:2... |
%
% motor_globals
%
% comand error -command
AerNoError = 0;
AerInit = 1; % -1
AerMoveHome = 2; % -2
AerMoveAbs = 3;
AerMoveEnable = 4;
AerMoveDisable = 5;
AerMoveWaitDone = 6;
AerMoveTestDone = 7;
AerGetPosition = 8;
AerShowInfo ... |
function [endeff] = computeMiniForwardKinematics(rads1,rads2)
alpha = pi + (rads1 + rads2) / 2;
beta = rads1 - rads2;
L_longer = 2.0;
L_shorter = 1.0;
syms x;
S = solve(cos(pi-beta/2) == (x^2 + L_shorter^2 - L_longer^2) / (2 * L_shorter * x));
L = double(S);
X = L * cos(alpha);
Y = L * sin(alph... |
function main_test_HDF5(varargin)
% clc;clear;close all;
% addpath(genpath(cd));
% cd ~/tmp_data
loop_num = 2;
% seed the matlab rand function! The seed is global.
[FID ] = new_ygin_files_and_randseedHDF5(loop_num);
k = 1*2.4e-3; % miuSiemens
% Basic parameters
dt = 0.1;
step_tot = 10000;
N = [10; 12; ];
wri... |
function [INFO] = DrawScreen_with_fixation_square(myWindow,INFO)
% Display square fixation
Screen('FillRect', myWindow, INFO.P.stim.fixation_square_color,...
INFO.P.stim.fixation_rects); %Add square fixation
Screen('Flip', myWindow); |
function Zad5b_niejawna(h)
c1=-1/2;
c2=-1/4; %przykładowe stałe dla 1 trajektorii
t=[0:0.01:5];
x=c1*exp(t);
y=c2*exp(-t); %rozwiązanie analityczne x i y
plot(x,y,'g')
xlabel('x(t)')
ylabel('y(t)')
hold on
c1=1/2; %przykładowe stałe dla 2 trajektorii
c2=-1/4;
x=c1*exp(t);
y=c2*exp(-t); %rozwiązanie an... |
%%It takes two matrices and find their common rated movies for finding
%%their similarity, return a pcc value
function [ pcc ] = PPC(A,B)
%first rated movie indices and second rated movie indices
firstSampleIndices = find(A ~= -1);
secondSampleIndices = find(B ~= -1);
[commonMoviesIndices,~,~] = intersect(firstSample... |
function [ model ] = train( X, Y )
% Constants that can be tweaked
NUM_CLUSTERS = 150;
num_images = size(X, 1);
filter_bank = createFilterBank();
responses = zeros(1024 * num_images, 72);
disp('Calculating filter responses');
tic
for i = 1:num_images
if mod(i, 100) == 0
... |
function [dist] = getHsvDist(hsv1,hsv2)
% dist(1) = whole image dist(2) ave 2x2 distance
wholeimage1 = hsv1(1,:);
wholeimage2 = hsv2(1,:);
dist(1) = pdist2(wholeimage1, wholeimage2);
aveimage1 = mean(hsv1(2:5,:));
aveimage2 = mean(hsv2(2:5,:));
dist(2) = pdist2(aveimage1, aveimage2);
end
|
%%% Analytical calculation of the mean time to pathogen extinction of the
%%% SIS model discussed in Chapter 4 of the Thesis.
%%% Also plots the mean time to pathogen extinction for a varying disease
%%% induced mortality rate
%%% Used in conjuction with Chapter4_Figure_2_run for SIS, to
%%% produce Figure Fig C.1
%... |
classdef ParforTrainer < rl.train.Trainer
% PARFORTRAINER
%
% Base class for parfor type trainers
% Revised: 8-14-2019
% Copyright 2019 The MathWorks, Inc.
properties (Access = private)
Listeners = event.listener.empty
end
methods
function this = ParforTrainer(env,agent,trainOpts)
... |
function n = l_get_n(l)
n = l(1:2)/norm(l(1:2));
|
function [gd_out,w_out] = smithDly(b,n,Fs)
% [gd_out,w_out] = smithDly(b,n,Fs) returns length N vectors gd_out and w_out
% containing the group delay and the frequencies (in radians) at which it
% is evaluated. Group delay is -d{angle(w)}/dw. The frequency
% response is evaluated at N points equally spaced aroun... |
function [matched_starts, matched_durations] = match_gt_proposal(labels, starts, durations)
% Input:
% labels: temporal ground truth label of actions
% labels.gt_start_frames: Nx1 start_frames vector, N
% is the number of labels of i-th video
% labels.gt_end_frames : Nx1 end_frames vect... |
function alp_returnvalue = seqcontrol(obj, deviceid, sequenceid, controltype, ...
controlvalue)
% Changes display properties of a sequence
%
% See also:
% seqinquire
%
% File information:
% version 1.0 (feb 2014)
% (c) Martin Vogel
% email: matlab@martin-vo... |
function [root, err, nIter] = metodoNewton(f, df, x0, tol1, tol2, maxIter)
if nargin < 3
error('Número de parámetros insuficientes.')
end
if nargin < 4
tol1 = eps;
end
if nargin < 5
tol2 = eps;
end
if nargin < 6
maxIter = 1000;
end
nIter = 0;... |
% phase_servo - Phase servo based on waveform data
% phase_servo(dev, bunch_list)
% sys - device ID
% bunch_list - A list of bunch numbers (1 based) to include
function phase_servo(sys, bunch_list)
prm.root = 'IGPF';
if isempty(sys)
sys='TEST';
end
prm.sys = sys;
pvnm = [prm.root, ':', prm.sys, ':'];
prm.... |
N = length(annotations);
label = zeros(1,N);
for i = 1 : N
%read the picture and trancate it and transfer to gray pic
pathname = 'cars_test/';
pathname = strcat(pathname,annotations(i).fname);
pic = imread(pathname);
subimg = pic(annotations(i).bbox_y1:annotations(i).bbox_y2,...
annotations... |
function [pred_lab,score] = testOneBag_dp( X,w,Y,Nbmax,option)
%TESTONEBAG test one bag accuracy
% bag level prediction vs. instance level prediction
prior=PriorOneBag(w,X,option);
[score,~]=max(prior,[],2);
score=score(1:end-1);
%%%%using dynamic programming to compute bag label probability%%%%
yindex=ones(1,... |
function varargout = nlsegui(varargin)
% NLSEGUI M-file for nlsegui.fig
% NLSEGUI, by itself, creates a new NLSEGUI or raises the existing
% singleton*.
%
% H = NLSEGUI returns the handle to a new NLSEGUI or the handle to
% the existing singleton*.
%
% NLSEGUI('CALLBACK',hObject,eventDa... |
% Senjor Project: Software Defined Implementation of Digital Communication
% Student: Leul Wuletaw
% Professor: Dr. Ing.- Dereje Hailemariam
% Date: June, 2017
% ***************** FUNCTION: decoder() ***************** %
% This function is used to decode received signal.
function [decoded_signal] = decoder( i... |
function [cc, crossc] = getV1CA1firingRateCorr(animal, iseries, iexp, ...
CA1groups, V1group, FRbin, addInfo)
if nargin<7
addInfo = [];
end
%% Load the spikes from the experiment
start = 1;
for itrode = 1:length(CA1groups)
temp = getKwikSpikes(animal, iseries, iexp, CA1groups(itrode), '1');
CA1spikes(st... |
function data = funnel(amplitude, len, fixedAmplitude)
% data = funnel(amplitude, len)
if fixedAmplitude
randAmp = amplitude;
else
randAmp = amplitude + randn(1);
end
inc = randAmp / len;
data = ((randAmp-inc):-inc:0)';
data = data + randn(len,1);
end |
function [ pphi_kin ] = get_pphi_kin(input,x,v_plus_1,psi)
%get_pphi_kin Determines pphi_kin/eV for 2D and 3D maps. Note the full maps
%need to be loaded in `maps'.
% Detailed explanation goes here
global par const
%% Pphi calculation
if par.APPLY_3D
[field_3D] = find_3D_Afield(x,{'Aphi'});
pphi_kin=..... |
function scan_data = EKFSLAM(robot, sensor, sensor_rf, obstacle, lmks, this_scan_good, pose_this_scan)
global World t;
%%%%%%%%%%%%%%%%%%%%%%%% SLAM loop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
World.t = t;
R_old = robot.R; % true pose
for lid = 1:size(World.W,2)
v = sensor_rf.noise .* randn(2,1);
World... |
G = zeros(256,31);
for i = 1:31
G(i:132+i,i) = chebwin(133,10^10);
end
W = zeros(256,1);
O = ones(31,1);
%for i = 1:256
% for j = 1:31
% W(i) = W(i)+G(i,j);
% end
%end
W = G*O;
wvtool(W) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.