text stringlengths 8 6.12M |
|---|
function u = InverseKinematicsFcn(obj, x, y)
% INVERSEKINEMATICS Inverse Dynamics (or Kinematics) function,
% finds the right control inputs to go towards a desired state,
% starting from the current state.
AngleYtoX = atan2(y(2)-x(2), y(1)-x(1));
DistanceYtoX = norm(x(1:2)-y(1:2));
current_state_angle = x(5);
curr... |
function [peakLoc,peakMag] = myPeakFinder(correctedPulses,responses,plotMe,monitor)
%the way to call this function is myPeakFinder(correctedPulses,responses,plotMe,monitor)
%the plotMe input will either show me the plots or not. It is either true
%or false
%the monitor input will change the size of the figure acording... |
function i = find_closest(a, b)
% This function returns an array of length a with the indices of
% array b that are closest to the values of array a.
delta = abs(repmat(a, length(b), 1) - repmat(b', 1, length(a)));
[~, i] = min(delta, [], 1);
end
|
%Generating IAC(t) & ITD(t) stim for EEG
clear all
fs = 48828.125;
load('Mseq_IAC_ITD.mat'); %loads Mseq
load('Seed16.mat'); %load s
rng(s);
M_dur = .050;%50 ms
M_samps = round(M_dur*fs); %number of samples for each point in Mseq
Stim_length = M_samps * length(Mseq);
Stim_dur = Stim_length/fs;
flow = 200... |
for i = 3:10:173
string = ['Glass_IPHys_a' threedig(i) '.X = (2.*Glass_IPHys_a' threedig(i-3) '_00.X + 3.*Glass_IPHys_a' threedig(mod(i+2,180)) '_00.X)./5'];
eval(string)
string = ['Glass_IPHys_a' threedig(i) '.Y = (2.*Glass_IPHys_a' threedig(i-3) '_00.Y + 3.*Glass_IPHys_a' threedig(mod(i+2,180)) '_00.Y)./5... |
function F = uq_gumbel_pdf( X, parameters )
% UQ_GUMBEL_PDF(X, parameters) calculates the Probability Density Function
% values of samples X that follow a Gumbel distribution with parameters
% specified in the vector 'parameters'
%
% NOTE: This function refers to the *maximum* Gumbel distribution. For more
% informat... |
classdef cs100a
% a class to manipulate MINOLTA CS-100A from MATLAB through a serial port connection
%
% Created : "2012-04-11 09:23:57 ban"
% Last Update: "2012-04-25 17:38:19 ban"
% properties (Hidden) %(SetAccess = protected)
properties
portname='COM1'; % id of serial port to communicate... |
function result = checkSolution(soln, config, model)
% result = checkSolution(soln, config, model)
%
% Run three simulations, and return the data for plotting
% Update controller
model.control.data.gains = soln.gains;
model.control.data.param = soln.param;
% Store the list of slopes to try:
slope = soln.scale*config... |
clear all
close all
dx=.5e-6;dy=.5e-6;
length=20e-6; breadth=20e-6;
N=round(length/dx);M=round(breadth/dy);
d_core=9e-6;
R_core= d_core/2;
N_c=round(R_core/dx);M_c=round(R_core/dy);
x=[1:N]*dx;
y=[1:M]*dy;
a=dx^-2;b=dy^-2;
lambda=1.550e-6;
k=2*pi/lambda;
A = zeros(N*M);
n0=3.14;
p0=k^2*n0^2-2*a;
n1=3.165;
p1=k^2*n1... |
function [ro]=go2d(V0,V1,IND,eldiz)
% pause
ro=zeros(1,length(IND.ind1));
switch eldiz
case 1
dv0=V0(IND.ind1)-V0(IND.ind2)-V0(IND.ind3)+V0(IND.ind4);
dv1=V1(IND.ind1)-V1(IND.ind2)-V1(IND.ind3)+V1(IND.ind4);
ro=0.6666*dv0./dv1;
case 2
dv0=V0(IND.ind1);
dv1=V1(... |
function [ ImagingData, Bruker_Info] = load_data(message)
%
% LOAD_DATA : Wrapper to ask user to get the data needed.
%
% SYNTAXIS
% ImagingData = LOAD_DATA(message)
%
% INPUT
% message = string for the user to see
% display message
uiwait(msgbox(message));
% get data after setting up pathway
experiment_directory... |
function [theta, phi, n] = regular_sampling(n_lat, n_lon)
%REGULAR_SAMPLING Samples observations on a regular grid of the
% sphere. The latitudes range from -50 degree to 50 degree.
%
% [THETA, PHI, N] = REGULAR_SAMPLING(N_LAT, N_LON);
%
% Inputs:
% N_LAT - the number of latitudes
% N_LON - the number of long... |
function [S] = CreateROI( path, file, coordinates, bwThresh )
%% CreateROI will create all sub picures.
% + S(x).Picture
% + S(x).PictureGray
% + S(x).BW
% + S(x).Label
% Finally a struct S is saved in the corresponding foler.
%
% Changelog: - no offset for the margin anymore (size of roi = picture
% ... |
function [A] = pixel_ats(I, p, f, as)
rs_cnt = 180 / as;
A = zeros(1, rs_cnt);
for i=1:rs_cnt
krnl = imrotate(f, i*as,'crop');
A(1, i) = ApplyFilter(I, krnl, p(1), p(2));
end
end
function [fout] = ApplyFilter(img, filter, x, y)
fhsz = uint16((size(fi... |
clear all;
close all;
Dataset_KITTY2;
Dataset_KITTY3;
Dataset_KITTY4;
clear all;
close all;
|
function xu_debugShownTiles_V2(RGB,bwTruth,top_left,bwFalse,top_left2,tileSize)
%figure,imshow(RGB); %% show seleced image tiles
% bwT=false(size(RGB(:,:,1)));
% %bwTruth=bwareaopen(bwTruth,tileSize(1)*tileSize(2)*6); %% remove small noisy tissue regions !!!!
% CC=bwconncomp(bwTruth);
% stats=regionprops(CC,'BoundingB... |
function Results = uq_LRA_train_test(U_train, Y_train, U_test, Y_test, Options)
% This function builds LRA using the set (U_train, Y_train) and evaluates
% the error using the set (U_test, Y_test)
%% Get information from function input
Method_corr = Options.CorrStep;
Method_updat = Options.UpdateStep;
UnivBasis = Opt... |
function [ ] = prae_prescan(subjectNumber, subjectName)
%-----------------------------------------------------------------------%
% [results] = prae_prescan( ... )
%
% SUBJNUM : unique # based on date string (e.g., '1001')
% SUBJNAME : unique subject name (e.g., 'prae')
%
% e.g.,
% >> results = pra... |
function [ result ] = im_rectangify ( df )
if (isdatafile(df))
images = data2im(df);
length = size(df, 1);
elseif (iscell(df) && ismatrix(df{1}))
images = df;
length = size(df, 2);
elseif (ismatrix(df))
images = {df};
length = 1;
else
... |
function [cost_func_value,cost1,cost2,cost3,cost4] = cost_func(lambda_1,lambda_2,rho,u,x,y,C_P,Mu_E,Cov_E,Psi,u_i)
cost1 = lambda_1/2*norm(Psi*(x.*(C_P(u_i,:)'))-Mu_E)^2;
cost2 = lambda_1/2*norm(Psi*(y.*(C_P(u_i,:)'))-Mu_E)^2;
cost3 = lambda_2/2*norm(Psi*(x*y'.*C_P)*Psi'-Cov_E,'fro')^2;
cost4 = rho/2*norm(x-y+u)^... |
% wall parameters
xWall = 0.09;
KWall = 30000;
BWall = 2;
nWall = 1;
tWall = 0.015;
% device parameters
m = 1;
b = 0.0;
g = 9.81;
Fhand = - m*g;
x0 = 0.14;
x_dot0 = 0;
% simulation parameters
tSampling = 0.015;
|
function x = row2im_patch_sample_2D(x,X,patch_inds,varargin)
% Re-averages patches back into the image domain.
% Alternatively, you can compute the derivative of the linear patchification operator,
% which is the tranpose operator.
%
% Emphasis is on speed by using MATLAB's fast indexing. Additionally, this
% code avo... |
% filename:make_label_ML_detection.m
% 라벨링 말고 스코어 개념을 도입한 버전
nS=4;
k=4;
sample_num = 1000000;
test_sample_num = 1000000;
small_label = zeros(sample_num, 5); % Specific precoders (1,2,5,6,13)
large_label = zeros(sample_num ,16); % All precoders
H_list = zeros(sample_num, 32);
H_original_list = zeros(sample_num, 1... |
function [ imgOut ] = mirrorHorz( imgIn )
%creates left-right mirror image of imput image
for i = 1:size(imgIn,2)
imgOut(:,size(imgIn,2)-i+1,:) = imgIn(:,i,:);
end
end
|
% Class function
% Function: updateData
% Add a reference line (constant y) to the data
function [x, y] = addRefLine(self, refFun, varargin)
xlimRange = self.XLim;
xrange = linspace(xlimRange(1), xlimRange(2), 100);
if nargin > 2
xrange = varargin{1};
end
if isnumeric(refFun)
yrange ... |
% Verscuh Input zu verdoppeln
% in = generate_common_weights(1,1,[-10,10]);
% [n_in, m, stdd] = gaussian_normalization(in);
for(vals = -3:0.1:3)
in = vals;
comp = in*0.5;
% n_comp = gaussian_normalization(comp,m,stdd);
net = generate_tanh_feedforward([1,1],[-2,2],'Bias','inactive');
% net.Weights = {-3.581... |
function placeHolder = readEntryLine(fields,dataType,default,row,placeHolder,C)
for i = 1:9
skip = 0;
% check if input is used
if isempty(default{row,i})
% input used
elseif default{row,i} == Inf
% skip unused field
skip = 1;
end
if skip == 0;
... |
function imgOut = attMono2Poly( imgIn, spectrum )
% Compute attenuations lookup table for two sprectrums
materialsDir = 'physicsdata/materials/';
materials = {'Air_Dry_near_sea_level', ...
'Adipose_Tissue_ICRU-44', ...
'Water_liquid', ...
'Muscle_Skeletal_ICRU-44', ...
'Tissue_Soft_ICRU-44', ...
'... |
format shortG
freqFile = fopen('freq.txt','r');
freq = fscanf(freqFile,'%f');
%freqTr = freq*0.92958;
freqTr = freq - 11;
massXFile = fopen('massX.txt','r');
massX = fscanf(massXFile,'%f');
massYFile = fopen('massY.txt','r');
massY = fscanf(massYFile,'%f');
massZFile = fopen('massZ.txt','r');
massZ = fscanf(massZFil... |
function depth = TGV(depthmap, sdepth, img, iters, alpha0, alpha1, tau, sigma, beta, gamma, theta)
[s1, s2] = size(depthmap);
depthmap = gpuArray(depthmap);
sdepth = gpuArray(sdepth);
img = gpuArray(img);
% normalize input images:
maxd = max(max(depthmap));
maxsd = max(max(sdepth));
maximg = max(max(img));
maxd = max... |
%% 多Counter 多book的操作
multi = OptStraddleTradingMulti;
% 设置
set(multi , '2016' , stra)
set(multi , '2034' , stra2)
% 获取
stra = get(multi , '2016');
stra2 = get(multi , '2034');
keys(multi)
%% 买卖操作
multi.set_opt(1, 2.3 , 'put');
multi.place_entrust_opt_equal('2', 1, '1', 0.0047)
multi.place_entrust_opt_proportio... |
%% change log -----------------------------------------
%% ------------------------------------
clear
close all
clc
head_test1% included in tdoa_proc
tdoa_proc
declare_problem_common
close all
% declare_problem_single
% single_filter
% two_filter_fast2
% declare_problem_two
declare_problem_mphd
mphdfi... |
function T = descriptiveStatsTable(X,G)
[n,m,s,se,gn] = grpstats(X,G,{'numel','mean','std','sem','gname'});
T = table;
T.groupname = gn;
T.mean = m;
T.SE = se;
T.SD = s;
T.N = n;
|
function [ h ] = RIR_generator( s,beta)
%UNTITLED7 此处显示有关此函数的摘要
% 此处显示详细说明
c = 340; % Sound velocity (m/s)
fs = 16000; % Sample frequency (samples/s)
d = 0.05;
origin = [2-d*2 1.5 2];
s = s+origin;
[x1,y1,z1]=sph2cart(0,0,2*d); % Sensor position 1
[x2,y2,z2]=sph2cart(0/180*pi,0,d... |
function [] = jess_function_alias(jess_function, matlab_function)
% Now the Matlab function could be called asynchronously from another
% thread. For Matlab to recognize the function, this folder must be
% temporarily set as the working directory.
% So Jess will tell Matlab to come here, call the callba... |
function [channel] = MTLreadCH(index,HRTF)
% adapted from MTLRCH"
% MTLRCH reads one channel from a file (type 2 or 3)
%
% [channel]=MTLreadCH(index);
%
% var_string = name of output variable
%
% See also: MTLWCH, MTLWH, MTLreadHDR
% Author: Klaus Hartung [Lehrstuhl AEA, Ruhr-Universitaet Bochum]
% Date: 19.4.1995
%... |
img = imread('images/MarioStar.png');
[h,w ] = size(img);
%stripify img
img_striped = stripify(img, 0.2);
%change img to vector
f = reshape(img_striped,[h*w,1]);
%% Algorithme de douglas Rachford
% parameter
n_iter = 1;
lambda = 0.01;
%init
u = f;
s = zeros(size(f));
% loop
y = f
for i=1:n_iter
x = prox_G2(h... |
function PlotBeadImagePair( imgpair, varargin )
%PLOTBEADIMAGEPAIR displays the generated 3D bead image pair
%Input:
% <imgpair> structure array containing the fields
% .vxsize voxel size [Ám]
% .range nodal range [x1,x2;y1,y2;z1,z2] [Ám]
% ... |
function[CI] = confidence_intervals(Results_cell)
theta = Results_cell{2,1}(:,1);
sdtheta = Results_cell{2,1}(:,2);
df = Results_cell{3,1}(3);
t_v = tinv(0.975,size(Results_cell{4,1},1)-df);
CI = num2cell([theta-t_v*sdtheta, theta, theta+t_v*sdtheta]);
names = {'LCI theta ',' theta ',' UCI ... |
function aiffwrite2(file, x, sRate)
%aiffwrite2 Write a sound file in Audio Interchange File Format.
%
% aiffwrite2(file,x,sRate)
% Create an AIFF file with sound data x sampled at sRate Hz. If x
% has multiple columns, then a multi-channel file will be created.
%
% Written by Jean-Marc Moret (moret@elpp1.epf... |
function [ CRB ] = calcCRB( modulation, SNR )
%CALCCRB calculates the Cramer-Rao Bound for the steering vector for a
% given array geometry/frequency and target SNR.
% !!! phased array only (no MIMO) !!!
c=physconst('Lightspeed');
p=reshape(modulation.P_Rx(modulation.pulse.Rx),[],1);
lambda=c./reshape(repmat(mo... |
function A_image_sequence = simulateImageSequence4(image_label,frame_size,numFrames,num_molecules,spot_distance)
%
% Started by Isabel Llorente-Garcia. August 2014.
%
% Create simulated image sequence (.mat file). Similar to
% simulateImageSequence3, but no bleaching, no padding, and it simulates two spots
% which are ... |
clc
clear
%Change the wav file name to suit your purpose
Y = wavread('miracle.wav',[1 2048]);
Y2 = int64(32767 * Y);
acf = transpose(autocorl(Y,60));
ref2 = schurrc(acf);%Calculate reflection coefficients
%Calculate optimal order
opt_order = 1;
for i = length(ref2):-1:1
if(abs(ref2(i)) > 0.1)
opt_order =... |
function write_table_latex(filename,cell_data,mode)
if nargin<3
mode='row_mode'; % The results of different algorithms are listed using row;
end
% Replace the underscore ('_') to the dash('-')
for ii=1:size(cell_data(:))
temp=cell_data{ii};
for jj=1:length(temp);
if strcmp(temp(jj),'_')
... |
data = load('ex1data2.txt');
X = data(:, 1:2);
y = data(:, 3);
m = length(y);
mu = zeros(1, size(X, 2));
sigma = zeros(1, size(X, 2));
fprintf(mu);
fprintf(sigma);
mu = mean(X);
sigma = std(X);
fprintf(mu);
fprintf(sigma);
[X mu sigma] = featureNormalize(X);
|
%% A Simple Test of the HmmDist Class
setSeed(0);
nHiddenStates = 4;
nObsStates = 6;
nsamples = 20; lens = [13*ones(10,1);30*ones(10,1)];
%% Discrete Observations
fprintf('Discrete Observations\n');
obsModel = copy(DiscreteDist,nHiddenStates,'-nstates',nObsStates); % remaining args get passed to ... |
clear all
clc
SetAdvisorPath;
%Pass the small ice vehicle
input.init.saved_veh_file='PARALLEL_defaults_in';
[error_code,resp]=adv_no_gui('initialize',input);
x = 0.5;
%
% input.modify.param={'fc_pwr_scale'}; % parameter names are stored in the first optional argument
% input.modify.value= .5 % assign correspo... |
function [] = reinitialize_variables (newT,newV,newB)
%
% [] = reinitialize_variables (newT,newV,newB)
%
% This function realloc global variables that describe the grid.
%
% Input of this function are
%
% newT: the new size of variables that depend on nT
% newV: the new size of variables that depend on nV
% ... |
function visualize(uq, r_range, phi_range)
%takes in matrix which is a list of points in polar coords.
% columns are radius, phi, and z value
% we'll convert to xyz and visualize
points = separate(uq, r_range, phi_range);
translated = zeros(size(points));
for i = 1:length(points)
... |
function data = readOctMetaVolumeMult(ActDataDescriptors, tag, number)
% READOCTMETAVOLUMEMULT Reads the meta of each A-Scan data of a complete volume
% (if available) and returns a 2D array
%
% Writen by Markus Mayer, Pattern Recognition Lab, University of
% Erlangen-Nuremberg, markus.mayer@informatik.uni-erlangen.de
... |
F=rand(5,4,7);
if exist('fortran/vec_boundary_conditions_test.exe')
disp('testing if vec_boundary_conditions gives same result in fortran')
vec_boundary_conditions_fortran(F);
else
warning('fortran/vec_boundary_conditions_test.exe not available')
end
|
function chunkDelimiter = identifyDelimiter(thisFilename)
hyphenCount = numel(strfind(thisFilename,'-'));
underscoreCount = numel(strfind(thisFilename,'_'));
if hyphenCount > 1 && hyphenCount > underscoreCount
chunkDelimiter = '-';
elseif underscoreCount > 1
chunkDelimiter = '_';
... |
% Hybrid vehicle example.
close all
rng('default')
vehicle_data
useADMM = 1;
useGUROBI = 0;
%%%%%%%%%%%%%%%%%%%%%%
% Generating problem %
%%%%%%%%%%%%%%%%%%%%%%
Problem.objective.P = P;
Problem.objective.q = q;
Problem.constraint.A = A;
Problem.constraint.b = b;
Problem.constraint.l1 = l1;
Problem.constraint.l2 = 0;... |
function[eMatrix, num] = sevenPoint(matchedPoints1, matchedPoints2, K1, K2)
% Function Introdution:
% Given a set of correspondences between two images and the intrisic matrix
% of the calibrated camera for both views, compute the essential matrix
% associated with the epipolar geometry using seven points
%
% Inputs:
... |
function [c_AC_ensemble, err_db] = vqt_without_pitch_shift_fn(varargin)
%{
db_scale: true (default) or false
mono: true (default) or false
sub_sampling_factor: int, default to 22
gamma: double, default to 14.112 Hz (equivalent to 9000 samples at sr of 44100)
wav_file: string
gpu_idx: int,... |
function [xs_new, tris_new, oldVID2newVID, newVID2oldVID, trisOld2trisNew] = ...
remove_labeled_faces( xs, tris, flabels) %#codegen
% REMOVE_LABELED_FACES Remove faces and associated vertices
% with nonzero face labels.
% Usage: % [xs_new, tris_new, oldVID2newVID] = ...
% remove_labeled_faces(xs, t... |
%*************** Advanced Communication Systems*****************%
% CE542, Fall 2018 %
% ECE, UTH, Greece %
% File: project_2b.m %
% Authors: Christos Georgakidis (1964) ... |
clc;clear all;close all;
tic;
figure
set(gcf,'Renderer','OpenGL');
x=[-5:0.1:5];
y=x;
[x_new, y_new] = meshgrid(x,y);%生成网络采样点
for k1 = 1: size(x_new, 1)
for k2 = 1 : size(x_new , 2)
X = [ x_new(k1,k2) , y_new(k1, k2) ];
z(k1,k2) = Ackley( X );%代入Ackley函数
end
end
h = contour(x_new, y_new, z , 20... |
function [pi_est] = estimate_pi(draws, reps)
%% Estimate pi using Monte Carlo integration
% Draws random x, y points from U(0, 1) and computes proportion that fall
% within a unit circle; multiply this by 4 to get an estimate for pi.
% Arguments:
% draws = number of (x, y) points to draw in sample
% rep... |
% innateDual.m
% Constants
global ts;
center = 0;
% Format: {time, visStim}
% [Mode, K0, K1, K2]
visStimN = [1, 0, -1, center];
LaserOn = '0000';
LaserOff = '0000';
front = 'ff00';
back = '00ff';
olfOff = '0000';
iv = 20;
histogramBounds = [1,2,2,3,3,4,4,2*60,;...
2*60,3*60,4*60,5*60,6*60,7*60,8*60... |
function [ activations, sumOfInputsWeights ] = ActivationFunction( inputs, weights, bias)
%ACTIVATIONFUNCTION Returns true if weights are enough to activate output
%
% bias = weights(1,:);
% weights = weights(1);
sumOfInputsWeights = zeros(size(inputs,1),size(bias,2));
activations = zeros(size(inputs,1),size(bia... |
%
% clear all; close all; dbstop if error
%
% %% load data
%
%
% dir = 'data/preprocessed_data';
% prefix = 'spec_data_all';
labels = load('data/labels.txt');
%
% train01 = load(strcat(dir,'/',prefix,'train','01'));
% train02 = load(strcat(dir,'/',prefix,'train','02'));
% train03 = load(strcat(dir,'... |
% Create a Classification DL Model with Adversarial Smoke Dataset w/forest
% background (30000) and Fuego's non_smoke Dataset
%gpuDevice
%net = squeezenet;
%deepNetworkDesigner
%analyzeNetwork(lgraph_1);
%evaluate 1 test image
% I = imread(fullfile('C:\Users\jusfo\Desktop\Smoke Images\Adversarial Dataset... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pi est un sommet du triangle
% a=[a1 a2 a3] matrice 2*3
% b=[b1 b2 b3] matrice 1*3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ a, b ] = base( P1, P2, P3 )
%¨On définit la matrice M
M = [P1' 1; P2' 1; P3' 1];
% On inverse M
M1 = inv(M);
% On définit les ak et bk
a = M1... |
syms t
initQ = [0 0 0];
finalQ = [-0.7854, 1.5708, 2.3562];
%theta = 0.5*((initQ - finalQ)*cos(pi*t) + initQ + finalQ)
figure(1)
xlabel('time')
ylabel('Joint Angle')
t = 0:0.01:1;
py1 = 0.5*((initQ(1) - finalQ(1))*cos(pi*t) + initQ(1) + finalQ(1))
plot(t,py1,'o', 'Color', 'Red')
hold on
py2 = 0.5*((initQ(2) - ... |
function v = fun(X)
x1=X(1);
x2=X(2);
v= (x1-4)^2+(x2-5)^2;
end
|
% CLAB_CMAX Maximises chroma for a set of colours
% CLAB_CMAX(L,H) where L and H are vectors of the same length finds the
% maximum chroma which is in gamut for all the L(i),H(i) pairs with L as
% Lightness and H as Hue in the CIELCH colorspace.
%
% CLAB_CMAX(L,H) where one of L and H is singleton fin... |
clear;%clc;%close all
tic
recdate='Mar_11_15';
cellnum='B';
module='fi_curves';
% trials=1:numel(whos)-3; % if you want to analyze all the trials, use this
trials=[1 2]; % ...otherwise, specify the trials here
points=[3 4 3 4]; % first and last points to include in the linear fit (2 per trial)
sample_rate=10000; % ... |
function [handle1,handle2] = makeGPPlotMultidimensional(x1Mesh, x2Mesh, mPost, sPost,xm,fm, plotConfPlane, typeOfPlot)
%makeGPPlot Will generate a plot in the given figure frame for the given GP output. It can be used to make a surface plot or a contour
% The makeGPPlot function makes a plot of the results of a GP regr... |
function [Vertices, K] = voronoisphere_2(xyz, varargin)
% [Vertices, K] = voronoisphere(xyz)
%
% Compute the voronoi's diagram of points on the spheres S^2
%
% INPUT:
% xyz is (3 x n) array, coordinates of n points in R^3
% they all must be be normalized to 1 (i.e., belong to the 2-sphere)
%
% OUTPUTS:
% - Vertic... |
%% L-by-L Markov matrix Pr(w'|w) given q
function res = tranp(q)
global delta L
Del=@(w) 1-(1-delta)^w;
res=zeros(L,L);
if q==0
res(1,:)=[1 zeros(1,L-1)];
for i=2:L
res(i,:)=[zeros(1,i-2) Del(i) 1-Del(i) zeros(1,L-i)];
end
else
for i=1:L-1
res(i,:)=[zeros(1,i-1) Del(i) 1-Del(i) zeros(... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description: This s-function provides an interface for calibration when running the simulink model
%--------------------------------------------------------------------------------------------------------------------------------
% Used in: EOG_BCI2.mdl... |
classdef CtSlice < DicomObj
%CTSLICE represents a single CtSlice DicomObj
%
%CONSTRUCTOR:
% this = CtSlice(dicomItem, useVrHeuristics) creates a CtSlice object
% using the full file path (or a DicomObj) and boolean to deterine the use of VR Heuristics
%
% See also: DICOMOBJ, CTSCAN, CONTOUR... |
function OlafClusteringAuswertung(tdb)
load(tdb);
%number of elements
[lengCount, ~] = size(allClusClass);
%number of elements in the same class
numOfElems = 0;
resultClass = cell(0);
resultHeader = allClusHeader;
resultResult = zeros(1,1);
%now iterate through
for i=1:lengCount
%abbruchbedingung, if we a... |
function RecParamCallback(action)
% RecParamCallback(action)
% Switchyard for Recording Parameters window (see function Record)
% action = 'savemode', 'CancelButton', or 'OKButton'
% (disabled: action = 'savebutton', 'dontsavebutton')
global gRecParams gAxH gTextH1 gTextH2 gIsRecording gNPix
switch(action)
% These firs... |
function [ cmam_out ] = reduce_cmam_by_rowindex( cmam_in, rowindices )
%A function to reduce the ace data according to the provided
%indicies. The indices indicate the occultations that you would like to
%keep.
% *INPUT*
% cmam_in: STRUCTURE - contains the gas specific CMAM data.
% This structure c... |
function y = observables_M2(t,x,j,p,u,m)
% hep_TG: hepatic TG
y(1) = x(m.s.hep_TG_ndnl_cyt)+x(m.s.hep_TG_ndnl_ER)+x(m.s.hep_TG_dnl_cyt)+x(m.s.hep_TG_dnl_ER);
% hep_CE: hepatic CE
y(2) = x(m.s.hep_CE_cyt)+x(m.s.hep_CE_ER);
% hep_FC: hepatic FC
y(3) = x(m.s.hep_FC);
% pl_TC: plasma total C
y(4) = x(m.s.pl_VLDL_C)+x(m... |
function initPlotState
global plotState;
global SN;
plotState.SNfignum = 1;
plotState.Moviefignum = 2;
plotState.PktHistfignum = 3;
plotState.TestParamsfignum = 10;
plotState.TestUfignum = 11;
if ~isempty(SN)
plotState.SNaxis = [0 SN.dimX 0 SN.dimY];
else
plotState.SNaxis = [0 25 0 25];
end
%plotState.nod... |
function [X_estimate,t_b_estimate,length_estimate,tag_estimate]=PoissonMBMtarget_estimate1_tracks(filter_upd,existence_estimation_threshold,X_estimate,t_b_estimate,length_estimate,tag_estimate,k,Nx)
%Author: Angel F. Garcia Fernandez
%We first estimate the current set of targets and their tags
%Option 1: one picks gl... |
function [Set]=CellLambdaS(Celln,Set)
if Set.SurfaceType~=4
return
end
aux1=Set.LambdaS1CellFactor;
aux2=Set.LambdaS2CellFactor;
aux3=Set.LambdaS3CellFactor;
Set.LambdaS1CellFactor=ones(Celln,1);
Set.LambdaS2CellFactor=ones(Celln,1);
Set.LambdaS3CellFactor=ones(Celln,1);
if ~isempty(aux1)
... |
function structOfCells=cellOfStructs2StructOfCells(cellOfStructs)
dataFields=fields(cellOfStructs{1});
nr_structs=length(cellOfStructs);
for f=1:length(dataFields)
%temp=cell(numel(cellOfStructs{1}.(dataFields{f})),1);
for r=1:nr_structs
try
eval(['temp{r}=cellOfStructs{r}.',dataFields... |
% Run this script to load all the simulation parameters into the workspace
%
% Author: Simon Kalouche
% BioRobotics Lab
clc
close all
clear all
%% 1) Hexapod Parameters
% input SM params
SMparams = SM_Params();
l = SMparams.leg.lengths;
m = SMparams.leg.mass;
m_body = SMparams.body.mass; %[kg] body... |
%%Visualizer class to make pretty pictures
classdef rlVisualizer < handle
properties (SetAccess = private)
models = rlCModel.empty;
c_window_ptr = 0;
end
methods
function obj = rlVisualizer(name,width,height)
obj.c_window_ptr = DynamicsModelMatlab(5,1,name,width,height);
... |
%% load signals
import dsp2.process.format.group_trials;
meas_type = 'normalized_power';
io = dsp2.io.get_dsp_h5();
conf = dsp2.config.load();
conf.SIGNALS.reference_type = 'non_common_averaged';
inps = { 'Measures', meas_type, 'complete', 'reward' };
allinps = [ inps, {'config', conf} ];
P = dsp2.io.get_path( alli... |
% process data using original method
[ndresp,rvcmresp] = ProcessDirs(ndresp,'Object','rvcm','Original');
InspectGUI(rvcmresp,'Diff')
plot(rvcmresp,'MeanStd');
% process data using Jonathan's method
[ndresp,rvcmresp2] = ProcessDirs(ndresp,'Object','rvcm');
plot(rvcmresp2,'MeanStd');
figure
subplot(2,1,1)
% create boxpl... |
%% This file should provide two function pointers indicating the "init" and
% "callback" functions for the agent.
function [init, callback] = agentBehavior()
init = @exampleInit;
callback = @exampleCallback;
end
|
%***********************************
% Get the Solar Radiation from each window with a particular incidence angle
%***********************************
function [Is] = getIs_surface(i_surface, tilt, Incidence,az_d,I_dn,I_df,Infor_surface_simp)
% global Infor_surface I_dn I_df
% Roof is different from walls... |
function [diffImage, binaryDiffImage] = sub_background(image1, image2, ...
diffThreshold)
%Given two images and a threshold, this function attempts to subtract
%common pixels from both images, returning the difference image in RGB
%format and in binary format.
%
%image1 is ... |
function FAVAR_Resp(FAVAR, FAVARopt, IRFMED_Chol, IRFINF_Chol, IRFSUP_Chol,FileName, FFR1d, factors)
if ~exist('FAVARopt.standardized','var');
FAVARopt.standardized = 1;
end
if FAVARopt.standardized == true
foo_str = {'Deviation from mean, std. units'};
else
foo_str = {'Deviation from mean'};
end
vnames = ... |
classdef CrazyMesh %< mimeticFEM2.Mesh
%CrazyMesh Structured test wavy mesh (crazy mesh)
% Implements the wavy mesh (crazy mesh) as defined in (S4.1.1.4, [1])
%
% CrazyMesh Properties:
% type - (type: str, size: single value)
% The type of mesh, in this case 'CrazyMesh'.
% dim... |
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loadConfig.m
% Function to load the mode according to the inheritance required.
% Only one mode configuration when multiple have been defined.
% Used only to compare single vs multimode schedules on the same
% configurations.
% Input:
% - inheritanc... |
%%INIT
clc;
close all;
% haptic_experiment_with_filter;
% N = length(filtered_angPos); % Number of samples
% filtered_angPos1 = filtered_angPos - mean(filtered_angPos); % around zero
% R = 18; %cm
% X_hat=zeros(2,N); % State Estimates
%%%%%%%%% CONTINOUS SYSTEM MODELS
%%%% Over damped : Cut-off frequency 5.03Hz (3... |
% A single phase line has two parallel conductors 2 metres apart. The diameter of each
% conductor is 1·2 cm. Calculate the loop inductance per km of the line.
clc;
clear all;
d = input("Enter the distance between the two conductors (in meters):");
d = d*100;
D = input("Enter the diameter of conductor (in centi... |
% Инициализация переменных для вычисления y по формуле:
d = -0.01;
b = 1.25;
a = 4.72;
i = 2;
x = 2.25;
k = 3;
% вычисление y по формуле
y = -(cos(i)/sin(k*x)) + (a*power(x,2)+abs(d))/power(a+b,2) - power(10,4)*power(k*x/power(a+b,2),1/6)
% Создание вектора из 6 элементов
Mas = [d b a i x k]
% поиск ин... |
kernel_dir{1} = '/mnt/40086D4C086D41D0/Reverb_neuronal_data/Kernel_fits/kfolds/LNP_model/perfreq/ridge/10ms/200ms';
type = 'lnp';
NPSP_th = 40;
for d = 1:length(kernel_dir)
plot_all_neuronal_kernels(kernel_dir{d},NPSP_th,type);
end |
function [Display] = DisplaySettings(Stereo)
%======================== DisplaySettings.m ===============================
% Sets appropriate Psychtoolbox display parameters for the current testing
% environment, which is determined based on whether the computer ID is
% recognized. Display settings are printed t... |
function re=hc(a,mu,delta,vz,alpha_R,dim)
t=25/a^2;
sx=[0,1;1,0];
sy=[0,-1i;1i,0];
sz=[1,0;0,-1];
alpha=alpha_R/(2*a);
band11sm=(spdiags([ones(dim,1) ones(dim,1)],[-1,1],dim,dim));
band1m1sm=(spdiags([ones(dim,1) -ones(dim,1)],[-1,1],dim,dim));
eyesm=speye(dim);
re=kron(sz,(kron(eye(2),-t*band11sm+(-mu+2*t)*eyesm)+kron... |
function evalarray = eval_fd(evalarg, fdobj, Lfdobj)
% EVAL_FD evaluates a functional data observation at argument
% values EVALARG.
%
% LFDOBJ is a functional data object defining the order m
% NONHOMOGENEOUS linear differential operator of the form
% Lx(t) = w_0(t) x(t) + w_1(t) Dx(t) + ...
% w_{m-1}... |
% irInterpolation.m
% Interpolation btw two impulse responses
clear;clc;
[offAxis,Fs] = audioread('MarshallSM57offAxis0_5in.wav');
[onAxis] = audioread('MarshallSM57onAxis0_5in.wav');
% Linear interpolation in time domain
mix = 0.5;
ir = (1-mix)*onAxis + mix*offAxis;
hold on; stem(offAxis);
stem(onAxis);
stem(ir); ho... |
clc
clear all
close all
Cnm4_0 = zeros(91,91);
Snm4_0 = zeros(91,91);
n = 4;
m = 0;
for theta = 0:2:180
for lambda = 0:4:360
[Cnm4_0(theta/2+1,lambda/4+1),Snm4_0(theta/2+1,lambda/4+1)]=fun(n,m,theta,lambda);
end
end
Cnm5_5 = zeros(91,91);
Snm5_5 = zeros(91,91);
n = 5;
m = 5;
for theta = 0:2:180
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.