text stringlengths 8 6.12M |
|---|
%
% Smooth point-set registration method using neighboring constraints
% -------------------------------------------------------------------
%
% Authors: Gerard Sanromà, René Alquézar and Francesc Serratosa
%
% Contact: gsanorma@gmail.com
% Date: 15/02/2012
%
% Demo of the non-rigid method
%
% For the execution of... |
#include "com_codename1_ui_BrowserComponent.h"
const struct clazz *base_interfaces_for_com_codename1_ui_BrowserComponent[] = {};
struct clazz class__com_codename1_ui_BrowserComponent = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_BrowserComponent ,0 , &__GC_MARK_com_coden... |
function B = mvnbeta(D)
%MVNBETA calculates multivariate beta function
% B = mvnbeta(D);
%
% gamma(x1) ... gamma(xd)
% mvnbeta(X) = -------------------------- ; "d" is # of features
% gamma(x1 + ... + xd)
%
%
% Example
% -------
% y = mvnbetaln([2.1, 1.0, 5.1
%... |
function status = XuFindOffCenterForDistanceRange(s_jsonc,distance_l,distance_h,s_inputfile_prefix)
if nargin == 2
s_inputfile_prefix = '.*.sgm_abs_te.*.raw';
else
end
mkdir('temp');
para=XuReadJsonc(s_jsonc);
para.OutputDir='temp_recon';
para.InputFiles=s_inputfile_prefix;
para.HammingFilter=0;
mkdir(para.Output... |
%Baseado em findclasses.m
function idx = urf_acharClasses(y, lista_de_classes)
|
%% Example Heat Equation 2-d in a rectangle
%Solves the heat equation in a rectangle with mixed boundary conditions and
%zero reaction term. The initial solution is taken similar as in the figure
%on Wikipedia (https://en.wikipedia.org/wiki/Heat_equation). We use an
%adaptive time selection algorithm together with the ... |
%Data input(missing & original) from excel
clc;
clear;
prompt = {'Enter Missing Data Filename','Enter Original Data Filename:'};
title = 'Input';
dims = [1 35];
definput = {'Blend1_UD.xlsx','Chess-Krkopt.xlsx'};
DataInput = inputdlg(prompt,title,dims,definput);
datasetname=char(DataInput(2,1));
O=readtable(cha... |
function xdot=vxdot(xu)
% computes state derivatives as a function of state and input
global veh;
de=xu(12+[1:8]); % fin angles
tau_b=xu(12+[9:14]); % external force and moment wrt b
tau_e=xu(12+[15:20]); % external force and moment wrt e
v_cee=xu(12+[21:23]); ... |
% Kelvin Zhang, Arvind Ganesh, February 2011.
% Questions? zhangzdfaint@gmail.com, abalasu2@illinois.edu
%
% Copyright: Perception and Decision Laboratory, University of Illinois, Urbana-Champaign
% Microsoft Research Asia, Beijing
%
% Reference: TILT: Transform Invariant Low-rank Textures
% Zh... |
% RR3 group time-frequency plots (eeglab)
% Created: 06/25/2015 By: Evan Layher
% Revised: 11/14/2015 By: Evan Layher % Prompt which group files to get
% Revised: 12/15/2015 By: Evan Layher (input single or grouped graphs)
% Adapted from Frank's code: /nfs/to-eeg/code/frank_scripts
% Creates time frequency plots using... |
clc
clear all
close all
format compact
dots = 1024;
eps = 1; % Погрешность
etl = 100; % Конец отсчета
mPi = 2.5;
f = 10;
f0 = 7;
t1=1;
%Строим сигнал.
t = 0:eps:etl;
s = 7 * sin(2 * mPi * f * t + f0);
figure('Name','Синусоидальный сигнал');
plot(t, s);
%Добавляем шу... |
function z = corrector(fname,L,kickangle, method)
%CORRECTOR Creates a corrector element in old a AT version (Obsolete)
%CORRECTOR('FAMILYNAME',LENGTH,ANGLE,'METHOD')
% creates a new family in the FAMLIST - a structure with fields
% FamName family name
% Length is set to 0 for marker type
% KickAngle ... |
wholepic1 = zeros(size(bw));
for i = 1:n
wholepic1 = wholepic1+allimage{i};
end
figure (2)
imshow(wholepic1);
s = regionprops(cc, 'Centroid');
imshow(wholepic1)
hold on
for k = 1:numel(s)
c = s(k).Centroid;
text(c(1), c(2), sprintf('%d', k), ...
'HorizontalAlignment', 'center', ...
'Vertical... |
%%
%% MSN setup
%%
function [model, species, params, container] = msn_setup_TimeWindow(flag_competitive, flag_duration, flag_optoDA)
stop_time = 20;
Toffset_VGCC = 10;
Toffset_DA = 10.8;
flag_Gi_sequestrated_AC = 1;
%%
%% DA-dip duration
%%
if flag_duration < 0
durati... |
function [concentration_4D Mask] = Intens2concentration_4D(voxels_data4D,baseline_edges,last_sample,TE,Mask,handles)
[N_rows,N_cols,N_slices,N_time_points]=size(voxels_data4D);
data_voxels_row_col_slice=handles.data_voxels_row_col_slice;
concentration_4D=zeros(size(voxels_data4D));
N_data_voxels_in... |
%%%%%%%%%%%%%%%%%%%Souvik Dan%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IKinput=[76.4583 65 143 0 0] %%input of position X-Y-Z - Orientation
OPik=fullIK(IKinput)
Theta1 = rad2deg(OPik(:,1))
Theta2 = rad2deg(OPik(:,... |
%%%%% this script is to play with the GenLouvain toolbox following Dani's
%%%%% advice:
%
% Hi Gilles and Emmanuel,
%
% Just following up on our discussion last week about dynamic community detection,
% so that we can assess quantitative markers of the modularity and its change over the looms (and fish).
% The mai... |
function varargout = T2D_DataSim(varargin)
% T2D_DATASIM MATLAB code for T2D_DataSim.fig
% T2D_DATASIM, by itself, creates a new T2D_DATASIM or raises the existing
% singleton*.
%
% H = T2D_DATASIM returns the handle to a new T2D_DATASIM or the handle to
% the existing singleton*.
%
% T2D_DATAS... |
function plotBenchmarkResults()
labels = {'Reading data' 'Normalize stack' 'CPU CNN forward' 'Transfer GPU' 'GPU CNN forward' 'Back from GPU' 'Writing data', ...
'reshape CPU' 'reshape GPU' 'permute CPU' 'permute GPU' 'Indexing CPU' 'Indexing GPU'}';
colors = {':r' '--r' ':b' '--b' ':g' '--g' ':c' '-c'}... |
function [c1, c2, c3] = crossf(a1, a2, a3, b1, b2, b3)
% compute the cross product of 2 vectors: c = a x b
c1 = a2*b3 - a3*b2;
c2 = a3*b1 - a1*b3;
c3 = a1*b2 - a2*b1;
end
|
%循环次数最少在内环,内外循环按列循环优先
function y = ForLooPCompare2(x,m)
y(m,m) = 0;
tic;
for j = 2:(m-1)
for i = 2:(m-1)
for k2 = -1:1
for k1= -1:1
y(i,j) = y(i,j) + x(i+k1,j+k2)/9;
end
end
end
end
toc |
function [bestStump, minErr, bestPred] = DecisionStump(X, Y, D)
ndata = size(X(:, 1), 1) % # of data
ndim = size(X(1, :), 2) % # of features
nstep = 10 % # of step to make the hyperplane
minErr = 999999999999 % initialize minimum error
bestStump = zeros(1, 4)
for i = 1:ndim
minx = min(X(:, i)) ... |
function get_new_state_point(i)
hfig=gcf;
cmsplot_prop=get(hfig,'userdata');
cmsplot_prop.state_point=i;
cmsplot_prop.xpo=cmsplot_prop.Xpo(i);
if ~strncmp(cmsplot_prop.crods,'no',2),
cmsplot_prop.konrod = ReadCore(cmsplot_prop.coreinfo,'CRD.POS',i);
if length(cmsplot_prop.konrod)==length(cmsplot_prop.coreinfo.c... |
function [pairwiseKernels] = getPairwiseFeatures(pairwiseFeatures, deviations)
% getPairwiseFeatures Divide the pairwise features by the given deviations
% [pairwiseKernels] = getPairwiseFeatures(pairwiseFeatures, deviations)
% OUTPUT: pairwiseKernels: pairwise kernels.
% INPUT: pairwiseFeatures: a cell array con... |
function wynik = newton_cotes(fi , h)
if(length(fi)==1)
wynik = fi(1) * h;
end
if(length(fi)==2)
wynik = (fi(1)+ fi(2))*h/2;
end
if(length(fi)==3)
wynik = h/3 * (fi(1) + 4*fi(2) + fi(3));
end
if(length(fi)==4)
wynik = 3*h/8 * (fi(1) + 3*fi(2) + 3*fi(3) + fi(4));
end
if(length(fi)==5)
wynik = (2*... |
function forHammy()
% FORHAMMY Converts fluorescence data into HaMMy format
%
% Prompts user for location of traces file (output from autotrace)
% to convert. Output extension is .dat. The original is left intact.
%
% REQUIRES: LoadTraces.m
%
% http://bio.physics.uiuc.edu/HaMMy.html
% FORMAT: <time> <donor ... |
% Copyright 2018, by the California Institute of Technology. ALL RIGHTS
% RESERVED. United States Government Sponsorship acknowledged. Any
% commercial use must be negotiated with the Office of Technology Transfer
% at the California Institute of Technology.
% -----------------------------------------------------------... |
function [ scrambled_bit ] = scramble( data, L, Ncell)
%SCRAMBLE 此处显示有关此函数的摘要
% 此处显示详细说明
A = length(data);
% 拿到后8位信息
bit8 = data(:,A-7:A);
sfn = bit8(:,1:4);
hrf = bit8(5);
Lssb = bit8(:,6:8);
if L == 4 || L == 8
M = A -3;
elseif L == 64
M = A -6;
else
error... |
function [y,n] = signult(x1,n1,x2,n2)
n = min(min(n1), min(n2)):max(max(n1),max(n2)); %durasi y(n)
y1 = zeros(1,length(n)); y2 = y1; %inisialisasi
y1(find(n>=min(n1))) & (n<=max(n1)==1) * x1; %x1 with durasi dari y
y2(find(n>=min(n2))) & (n<=max(n2)==1) * x2; %x2 with durasi dari y
y = y1.*y2; %sequence addition |
function svdParallel_SRG(parameter, id, th)
%* VMU(x1,x2) = sum_{x}(U(x1,x)* S(x) * V(x2,x))
id6 = id + 3 * (th - 1) ;
suffix = parameter.systemSuffix{id6} ;
fileNameVMU = ['VMU', suffix, '.mat'] ;
load(fileNameVMU, 'VMU')
VMU = VMU ;
ratio = parameter.svdRatio_SRG ;
svdsOptions = parameter.svdsOptions ;
%* ... |
clear
close all
clc
path_to_results_inter = [pwd '/results/intersystem_L2'];
load([path_to_results_inter '/InterSysJam_BoCsin_L2_BoC_10_5.mat']);
load([path_to_results_inter '/InterSysJam_BoCcos_L2_BoC_10_5.mat']);
load([path_to_results_inter '/InterSysJam_BPSK_L2_BoC_10_5.mat']);
load([path_to_results_inter '/InterS... |
% Generate_states_space
%% 1: Get all the grid ID by GPS data
load GridID_LineID_near_GPS_Trajectory.txt;
% get all the lines
lineID_Set = GridID_LineID_near_GPS_Trajectory(:,3:end);
lineID_Set = lineID_Set(:);
lineID_Set = unique(lineID_Set );
lineID_Set = lineID_Set (2:end)';
si... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 1000;
params.Gridjob.jobname = 'CalcOutlierComponents';
params.Gridjob.initRandStreamWithJobid = false;
params.Gridjob.continue = false;
params.Gridjob.requiredThreads = '1';
params.Gridjob.queue = 'nbp.q';
params.CalcOutlierCo... |
%% This is not included in the paper but here we are checking to make sure correct parameter covariations were maintained for the continuous treatment runs.
for i = 1:16
load(['SingleCellNFkB_reduced_model_continuous_adaptiveIKK_fixedstart_withlasso_mu_-25_b_2_trajectory_1_repeat_',num2str(i),'_progress500000.mat']... |
function Is = Recur(Is, Surf,level);
%
% Syntax :
% Is = Recur(Is, Surf,level);
%
% This function refills labeled surfaces that contains non-labeled points. It uses
% a recursive process to use neightboor labeled ponts information for non-labeled ones.
%
% Input Parameters:
% Is : Surfaces labels.
% Surf ... |
function testMatrixAssignment
%testMatrixAssignment matrix assignment benchmark test.
% Tests the speed of matrix assignment after a related slowness was
% detected in CoarseSetMinEnergy.
%
% See also: CoarseSetMinEnergy.
sz = 1e4;
n = 1e5;
x = rand(sz,10);
y = rand(1,10);
t = tic;
k = 0;
for i... |
for i = 1:1:2000000
b = 1 + i;
end |
%test for the AlazarATS9870 matlab driver
classdef AlazarTest < matlab.unittest.TestCase
properties
a
r
end
methods(TestMethodSetup)
function setUp(testCase)
testCase.a= AlazarATS9870();
testCase.r = RespondToDataReady(testCase.a);
testCase.a.c... |
function [M] = solveM(Ytrain, U, lambda, nf)
E = eye(nf);
M = zeros(nf, size(Ytrain, 2));
% solve M
for j = 1:size(Ytrain, 2)
nmj = sum(Ytrain(:, j));
Uj = U(Ytrain(:, j) > 0, :);
Aj = (Uj' * Uj) + (lambda * nmj * E);
Vj = (Ytrain(Ytrain(:, j) > 0, j))' * Uj;
mj_vector = (Aj\(Vj'));... |
%% Delete all exchange reactions from the nodule zone I
% Get exchange reactions
exchangeRxns = medicagoModel.rxns(strmatch('TEC_', medicagoModel.rxns));
exchangeRxns = vertcat(exchangeRxns, medicagoModel.rxns(strmatch('TCE_', medicagoModel.rxns)));
exchangeRxns = vertcat(exchangeRxns, medicagoModel.rxns(strmatch('TGE... |
%������������ (��������������) ����� ���������� NOE
clear all; clc;close all;
start_time=clock;
width_x=5;
length_y=5;
m=1;j1=30000;L=100; % measurement - samples - realizations
RazmX=2; % number of components of the state vector
X=zeros(RazmX,m,L); %�������������� �������� state vector
randn('s... |
% ---------------------------------------------------------------------
% Book: MVA 3
% ---------------------------------------------------------------------
% Quantlet: MVAghsurface
% ---------------------------------------------------------------------
% Description: MVAsurface gives 3D surface plo... |
function dy = backpropReverse(dx,x,y,settings)
%REMOVECONSTANTROWS.BACKPROP_REVERSE Backpropagate reverse function derivatives
% Copyright 2012-2015 The MathWorks, Inc.
dy = dx(settings.keep,:,:,:);
end
|
function results = editSimDataTest
results = functiontests(localfunctions());
end
function setupOnce(testCase)
testCase.TestData.orig_path = path();
% On my install, the perl script called in restoredefaultpath.m finds the
% stateflow folder twice. I don't know why but it throws an annoying
% warning.
state =... |
function stat=init_vector(stat)
%% initialize vector to small numbers
% ------------------------------------------------------------------------
% Authors: Pooyan Jamshidi (pooyan.jamshidi@gmail.com)
% The code is released under the FreeBSD License.
% Copyright (C) 2016 Pooyan Jamshidi, Imperial College London
% The sc... |
function b=rowadd(a,i,j,k)
%b=rowadd(a,i,j,k),i-th row is changed
a(i,:)=a(i,:)+k*a(j,:);
b=sym(a);
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Read the statistics file, compute mean and MAE
rootdir = 'D:\NOAA\IGRA_PdT_from_2000';
files_total=0;
files_normal=0;
stationdirs = dir(rootdir);
for i=1:size(stationdirs,1)
if (strcmp(stationdirs(i).name,'.') || strcmp(stationdirs(i).name,'..')) % Ski... |
function SetpointPhylogeny(QueryStrains_MeanGeneticDistance, QueryStrains_matrix, data_output)
% The function SETPOINTPHYLOGENY is designed to create a phylogenetic tree
% from pairwise genetic distances of a given strains
% Modifed by KL 20150710 (to be function within
% compute_correlation_genetic_distance_setpoint... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% Frequency Response Graphs
%
%
%
% 8(jw)^2+2jw+20
% H(jw)=----------------
% 6(jw)^2-5... |
function 5degree(a,b,c,d,f,g)
min_re = -4;
max_re = 4;
min_im = -4;
max_im = 4;
n_re = 100;
n_im = 100;
tol = 0.01;
coeff = [a b c d f g] ; polyroots = roots(coeff);
r1=polyroots(1);
r2=polyroots(2);
r3=polyroots(3);
r4=polyroots(4);
r5=polyroots(5);
max_steps=30;
delta_re = (max_re-min_re)/n_re;
delta_im = (max_im... |
% PRUEBA SEGUNDA UNIDAD
% Autor: Jonnathan Espinoza
% Fecha: 03/08/2021
clc; clear all;
% serie 1
num01=[1]; den01=[1 0];
num02=[0.05]; den02=1;
[numr1, denr1]=series(num01,den01,num02,den02);
disp('T(s) de la serie 1 es: ')
printsys(numr1,denr1)
% retroalimentación unitaria negativa en la serie 1
disp('T(s) con retr... |
## Copyright (C) 2020 irfan
## Author: irfan <irfan@mbp>
## Created: 2020-04-26
% M will be an array something like [100,10,0,0]
function y = merchant_savings(M)
y(1) = M(1)/2; % first months savings
% calculate next savings based on savings given and add the previous savings
for i = 2 : length(M)
y(i) = y... |
function h=uiedit(varargin),
% UIEDIT multi-line edit box
% UIEDIT invokes a GUI object which is similar to the edit box available
% in GUIDE. The major difference is that the edit object in GUIDE does
% not allow the user to input more than one line of text.
%
% UIEDIT supports:
% - Scrollbars
... |
function [index1, index2] = getBestStoredIndices(theta1, theta2, theta_vec)
if theta1 < -pi
theta1 = theta1 + 2*pi;
end
if theta1 > pi
theta1 = theta1 - 2*pi;
end
if theta2 < -pi
theta2 = theta2 + 2*pi;
end
if theta2 > pi
theta2 = theta2 - 2*pi;
end
% get indices on a discretized wheel going from ... |
function [cor, ac, ms, vari, cor_spear, mean_w, max_w, min_w, negative_per, ac_mean, eser] = crossval_classification(similarity_file, seeds, dim_scores, regression_type, l)
%% THE MAIN CROSS VALIDATION FUNCTION
similarity_matrix = load(similarity_file,'-ascii'); % semantic similarities between words excluded from t... |
function qs = SEDRK4t0(q0, t0, Deltat, g, balle)
% Solution equations differentielles par methode de RK4
% Equation a resoudre : dq/dt=g(q,t)
% avec
% qs : solution [q(to+Deltat)]
% q0 : conditions initiales [q(t0)]
% Deltat : intervalle de temps
% g : membre de droite de ED.
% ... |
classdef Bayesian4Compartments < mlbayesian.AbstractMcmcProblem
%% BAYESIAN4COMPARTMENTS
% $Revision$
% was created $Date$
% by $Author$,
% last modified $LastChangedDate$
% and checked into repository $URL$,
% developed on Matlab 8.4.0.150421 (R2014b)
% $Id$
properties
... |
function mxV = simmeanexponential(tau,n,M,displayhist,nbin)
% mxV = simmeanexponential(tau,n,M,displayhist,nbin)
% This function simulates the mean of the exponential distribution with
% parameter 'tau'. A number of samples 'M' of size 'n' are generated
% from this exponential distribution and the histogram of th... |
%%%%%%%% MOTION AS LINE ANGLE %%%%%%%%
% bins the shapes by orientation with respect to the lines, then finds the mean aligned motion, protrusion, and retraction
function motionAsLineAngle(numBins, motionAreaThresh, M, shape, inDirectory, frameTime, pixelsmm, frameDelta, savePath)
% initialize variables
motionFron... |
% Stern Progress in Electromagnetics Research (1995), PIER 10, 123-186
% Finite Difference Analysis of Planar Optical Waveguides
%
% Quasi-TE (Ex) modes
% BT3 structure
%
%
%
% .______ W______.
% | |
% H H
% | ... |
%% energyLandscape
% Compute the energy landscape of a dividing cell.
%%
%% Syntax
% planes = energyLandscape(N, n,delta)
%
%% Description
% The boundary of the cell is discretized with a given resolution. For each
% point on the boundary, dividing solutions are probed on each wall. If
% such a solution exists, it is ... |
% IMAGECOMPUTATION
%
% Files
% compute2D3DProximity - computeStreamlines2D3DProximity extracts proximity to the nearest solid
% computeKCcorrection - computeKCcorrection compute the correction for the Kozeny-Carman equation
% computeLocalFlux - computeLocalFlux transforms a l... |
%% Save AR Result
function [AR_Result] = AR_Result_Save(AR_Index, AR_LN, AR_LT, Time, AR_ID, AR_CenLon, AR_CenLat, Raw)
global An_Edge_Index
global SIC_Area
AR_Result = cell(1, 11);
AR_Result(1, 1) = {Time};
AR_Result(1, 2) = {AR_ID};
% Detect AR landfall in which section
AR_Land_I... |
%Implementation of frequency domain auto correlation function
%Blockwise Correlation - Q1-e
%Submitted by Deepak Gopinath- 903014581
function [ output_args ] = freqDomainACF( file, windowSize, hopSize)
%Implementation of the frequency domain block wise auto correlation
%function making use of the Wiener - Khinchin f... |
function [potential_func, grad_func] = make_hardcoded_guantlet(point_spacing, bob_attraction_factor)
% Hard coded values assembled into a potential function for the gauntlet
% challenge
% create walls
[w_pot, w_grad] = make_rectangle(4, 4.37, [0.5, -1.185], 0, point_spacing);
% create box 1
[s1_... |
function [ mesh_bndry ] = mesh_boundary( mesh, iSide, varargin )
%MESH_BOUNDARY is a method of the class mesh_2d that generates a 1d mesh of
%a part of the boundary of a 2d parametric domain.
% 2D Parametric Mesh
%
% s4
% ___ ___ ___ ___
% | | | | | 1D Bndry Mesh
% ... |
clear all
close all
%% Setup
fpath = 'figures8';
N_labeled = 200; % Number of labeled training data
N_unlabeled = 3000; % Number of unlabeld training data
D = 2; % Dimension of the input X
K = 2; % Number of components used in GMM
level_list = [0.001 .01 .1:.1:.9 .99 .999];
%% Generate synthetic da... |
%% -- FUNCTION TO CALCULATE LOCAL MIN OF THE PROFILE SUM OF BINARY MASK , INDICATES WRIST POSITION -- %%
function [Wrist] = wrist(Suma, No_valid)
% -- DUAL RECONSTRUCTION -- %
Marker = Suma+1;
S_rec = Reconstruct_Dual(Marker,Suma);
Wrist = S_rec-Suma;
% -- DECITION -- %
Wrist(No_... |
%compute the matrix of edit distance
numEle = 5;
numLanM = 5;
numPixel = 28;
for j = 0:9
str = sprintf('%d',j);
tempStr = strcat('data',str,'.txt');
fid = fopen(tempStr,'r');
subMatrix = zeros(numEle+numLanM,numPixel*numPixel+1);
for i = 1:numEle+numLanM,
temp = fread(fid,[1,numPixel*numPixe... |
dt = 0.1;
rad = 0.11;
wayposes = waypoints; %from the planner.
index = 1; %traj index
traj= wayposes(1,:);
control_list = []; %list of velocties
curr_angle = deg2rad(-90); %starting heading, in radians.
traj(1,3) = curr_angle;
%Generate velocities and then forward simulate through motion model.
for i=1:size(waypos... |
function set_gui_joint_names(gui_handles,message)
% Read the Joint Names from ROS server and set them to Matlab GUI
% only the first time the Matlab Program Runs
if (message.getName.size ~= 7)
disp('Error! Number of Joints is not equal to 7')
else
disp('Setting Joint Names for the first time');
set(gui_handles.tex... |
function g=df_conjugate(U, gramInv, d, y, N, m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
g = zeros(N, m);
for ind = 1:N
g(ind,:)= (gramInv{ind}*(y(ind, :)' + U(ind,:)'*d(ind)))';
end
|
%% 20hz flies
nfly(1).tr1 = '/Volumes/flyplacememory/TJ/VR_Maze_Experiment_Data/temperaturePreference/2013-09-12/20131209173123_stimulusTest/';
nfly(1).tr2 = '/Volumes/flyplacememory/TJ/VR_Maze_Experiment_Data/temperaturePreference/2013-09-12/20131209175118_stimulusTest/';
nfly(2).tr1 = '/Volumes/flyplacememory/TJ/VR_... |
clear variables
clc
% Variabili non calcolate da Mathematica che servono
% Sin ref
aD2=2; % Amp d2
wD2=2; % Freq d2
% Quad dist
aD1=1;
wD1=1;
% Parametri delle matrici
l=1; M=1;F=1;g=9.81;lam=-2;
run("Matrix.m")
% Definizione Sistema Esogeno
S = [0 0 0
0 0 wD2
0 -wD2 0];
bd = zeros(3,1);
cd = [0 1 0;... |
% ADSREXAMPLE
% This script creates a linear ADSR amplitude envelope
%
% See also ADSR
% Number of Samples per fade
a = 20;
d = 20;
s = 70;
r = 40;
sustainAmplitude = 0.75;
% Create each segment A,D,S,R
aFade = linspace(0,1,a)';
dFade = linspace(1,sustainAmplitude,d)';
sFade = sustainAmplitude * ones(s,1);
rFade = l... |
function MailToMe(inboxAddress)
% https://www.jianshu.com/p/409d2d527326
outboxAddress = 'gittest@163.com';
password = '163gittest';
setpref('Internet','E_mail',outboxAddress);
setpref('Internet','SMTP_Server','smtp.163.com');
setpref('Internet','SMTP_Username',outboxAddress);
setpref('Internet','SMTP_Passwo... |
%Database connection
function conn = dbchk()
%# JDBC connector path
javaaddpath('C:\Users\User\Documents\MATLAB\mysql-connector-java-5.0.8\mysql-connector-java-5.0.8-bin.jar');
%# connection parameteres
host = 'localhost'; %MySQL hostname
user = 'user'; %MySQL username
password = '';%MySQL password
dbName = 'finger... |
function [m]=specImage(sI,i, frames, nBands)
m = reshape(sI(:,i), nBands, frames);
end
|
function SetOriginalSamples( tProcess, aafSamples )
%
% for readability
iNumberOfCDFs = size( aafSamples, 2 );
%
% save the original samples
tProcess.aafOriginalSamples = aafSamples;
%
% DEBUG
fprintf( 'process %d: set the original samples ( %d x %d )\n', ...
tProcess.iLabel, ...
numel( tProc... |
function NegLnLikec = likelihoodc_reg(x)
% NegLnLikec = likelihoodc(x)
%
% Calculates the negative of the concentrated ln-likelihood of the cheap data
%
% Inputs:
% x - vector of log(theta) parameters
%
% Global variables used:
% ModelInfo.Xc - n x k matrix of sample locations
% ... |
x = 10
y = [10:2:20]
[a, b]=calfunV2(x,y) |
%% Hidden Markov Model
% Load preprocessed sonnets in sonnet.mat.
%
% Contains
% sonnet_list {cell}: A 604 row cell array where each row contains a
% input sequence, either a complete quatrain, volta, or couplet
% For example, sonnet_list{1} is a 32 token cell array containing one
% quatrain.... |
function dx = aofunc(t,x)
global m w0 e b gamma E;
dx = zeros(2,1);
dx(1) = x(2);
dx(2) = -(w0^2*x(1) + 2*gamma*x(2) + b*x(1)^3 + e/m*E(t));
end |
% Extract Common Spatial Pattern (CSP) Feature
close all; clear; clc;
savepath = 'F:\subject\';
load data1.mat
load data2.mat
load xlabel.mat
load clabel.mat
x_train = data1;
x_test = data2;
label = xlabel;
clabel = clabel;
Y=label;
feature = [];
feature2 = [];
%%
for k = 1:4
label1 = label;
label1(:,1)=2... |
function [F,V,curveIndices,faceMarker]=splitCurveSetMesh(V_cell,ns,patchType,smoothPar,splitMethod)
V1=V_cell{1};
V2=V_cell{2};
V3=V_cell{3};
n1=size(V1,1);
%Resampling curves
[V1]=evenlySampleCurve(V1,n1,'pchip',1);
% [V2]=evenlySampleCurve(V2,n1,'pchip',1);
% [V3]=evenlySampleCurve(V3,n1,'pchip',1);
... |
function [Num] = mon2num(month)
%MON2NUM - Converts month (string) to month number
% [Num] = mon2num(month)
month = lower(month);
month(1) = upper(month(1));
if strcmp(month, 'Jan')
Num = 1;
elseif strcmp(month, 'Feb')
Num = 2;
elseif strcmp(month, 'Mar')
Num = 3;
elseif strcmp(month, 'Apr')
Num = 4;
elseif ... |
function sttransanal
Pe = [-10,-1,-.1,0,.1,1,10];
x = [0:0.025:1];
figure; hold on;
for i = 1:size(Pe,2)
plot (x,(1-exp(Pe(i).*x))./(1-exp(Pe(i).*ones(1,size(x,2)))));
end
legend ('Pe=-10','Pe=-1','Pe=-.1','Pe=0','Pe=.1','Pe=1','Pe=10');
xlabel('x/L');
ylabel('c/c_0');
grid;
hold off; |
function qpts = mapPts(pc,p1,p2,quadpts)
% Assumes p1 and p2 are displacements from pc, qpts are in global coord.
qpts = [p1, p2]*quadpts + pc;
end |
function yimg = SSDBLoadBaselineMask(iImgIdx, caObjectNames,Root);
%function yimg = SSDBLoadBaselineMask(iImgIdx, caObjectNames,Root);
%
%returns an image containing masks for each selected object type.
%
if(nargin < 3)
Root = '/cbcl/scratch03/bileschi/Release';
end
fn = fullfile(Root,'Anno_OList',sprintf('SSDB%.5d_o... |
% clear
clear;
clc;
fclose all;
% run python server
python_dir = 'E:\\Project\\ChatBot\\simple_aiml_python2\\python_server';
system(sprintf('cmd.exe /k %s\\run_in_anaconda.bat %s &', python_dir, python_dir));
% if you want the window of python server to be close automatically, use /c
% to replace /k
% system(sprintf('... |
function varargout = complement(varargin)
%COMPLEMENT Returns the list of all i in [0, size[ not found in supplied list.
%
% [int] = COMPLEMENT([int] v, int size)
%
%
%The supplied vector may contain duplicates and may be non-monotonous The
%supplied vector will be checked for bounds The re... |
% -----------------------------------------------------------------
% ANSYS APDL 2D NxN TRUTH CODE, with Periodic Boundary Conditions
% This code models members as cylinders with varying radii, and 3D
% quadratic finite elements are used
% This code considers only NxN 2D trusses
% Function for calculating metamaterial... |
%% -- ALGORITHM 5 -- %%
% This function determines the number of fingers that appear on an image from a binary image %
function [ Num_fingers ] = algo5( Bin_Mask )
% - DECLARATION OF VARIABLES - %
[Z,T] = size(Bin_Mask);
% - FINDING THE G POINT- %
D_Transform = bwdist(Bin_Mask);
Marker = D_Transfo... |
function [imgrev] = bgrv(img)
for k = 1:2
hsv = rgb2hsv(img);
s = hsv(:, :, 2);
fg1 = s > 0.25;
fg2 = bwareaopen(fg1, 20000);
for i = 1:3
fg3(:, :, i) = fg2;
end
fg3 = im2uint8(fg3);
imgrev = img .* fg3;
end
end |
% This program calculate the transportation cost of each supplier in a given graph;
% ------------------------------------------
% output variables:
% cost_total(i): the cost the Supplier S_i;
% time: the computation time;
% Q0: the total link flow distribution
% ------------------------------------------
clc... |
function [t,y] = euler_implicit_linear_khan(tstop,dt,y0,A)
% euler implicit method to solve linear equations, eng 219
% function returns nuermical solution using euler implicit method
nsteps=round(tstop/dt)+1;
npar=length(y0);
y=zeros(nsteps,npar);
t=zeros(nsteps,1);
y(1,:)=y0;
t(1)=0;
for i=1:nsteps-1
M=eye(npar... |
%% This m script plots yearly mean wind vectors on a map of the MAB
%% This script was written by Hugh Roarty January 2016
%% also plots HFR coverage
conf.NDBC.years=2007:2017;
%% Configuration settings for the map
conf.Plot.lims=[-77 -68 35 42];%ALL MAB
conf.Plot.coast='/Users/roarty/Documents/GitHub/HJR_Scripts/da... |
%% Rotation model images stitcher
% A basic example on image stitching.
%
% <https://github.com/opencv/opencv/blob/3.1.0/samples/cpp/stitching.cpp>
%
%% Input images (two or more)
im1 = imread(fullfile(mexopencv.root(),'test','b1.jpg'));
im2 = imread(fullfile(mexopencv.root(),'test','b2.jpg'));
imshowpair(im1, im2, 'm... |
function [member_matrix, Kcentroids, WCSS] = ...
memMat(probes_weights, Kcentroids, clusterCount, sampleCount)
member_matrix = zeros(clusterCount,sampleCount);
Distance = zeros(clusterCount, 1);
%calculating membership matrix
turn = 1;
for i = 1:sampleCount
for j = 1:clusterCount
Distance(j,... |
function answer=tranX_bytrapz(X)
time=X(:,1);
for i=2:4
answer(:,i)=cumtrapz(time,cumtrapz(time,X(:,i)));
end
answer(:,1)=time;
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.