text stringlengths 8 6.12M |
|---|
function [job] = pb_read_Job(buffer, buffer_start, buffer_end)
%pb_read_Job Reads the protobuf message Job.
% function [job] = pb_read_Job(buffer, buffer_start, buffer_end)
%
% INPUTS:
% buffer : a buffer of uint8's to parse
% buffer_start : optional starting index to consider of the buffer
% ... |
% Potassium channel
%
% modeled after Mahon and WB96
% using n and alpha, beta formulation
% returns also steady-state value
%
% $Revision:$
%
function [I_K, dn, n_inf ] = ik(V_m, n)
E_K = -90; % mV
g_K = 6; % mS/cm^2
%
al_n = mylinexp(V_m, 0.01, -34, -10);
be_n = myexp(V_m, 0.125, -44, -80);
n_inf = al_n/(al_n... |
function [xb,yb,m,mp1,Uinf,alpha] = readData(filename)
%% this function is to read data from given airfoil coordinate data and also read a user-based input for freestream velocity and angle of attack
%%
% specifying a coordinates (xb,yb) of boundary points on airfoil surface. the
% last point coincides with th... |
function [ stub ] = degree2stub( degree )
% This function turn the in/out-degree vector into a stub vector
% The stub vector will be randomly permuted.
% Example:
% if degree = [3 2 5 1]', for node i = 1, 2, 3, 4
% the stub vector is
% stub = [1 1 1 2 2 3 3 3 3 3 4]'; % before permutation
% Note th... |
function EEG = eeglab2econnectome(EEG);
eConnectome_path = '/mtfs/shared_apps/eConnectome-V2';
addpath(genpath(eConnectome_path));
% conversion
tmp.name = EEG.filename;
tmp.type = 'EEG' ;
tmp.nbchan = EEG.nbchan;
tmp.points = size(EEG.data,2);
tmp.srate = EEG.srate ;
tmp.labeltype = 'st... |
classdef GarciaGarciaJoseAngel_TrabajoUnidad3 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
GraficaM matlab.ui.control.UIAxes
GraficaMD matlab.ui.control.UIAxes
... |
function [k, b] = fit_line(h_seg, interp)
M = cell2ndmat(h_seg);
[~, n] = size(M);
[D, T] = dist_seq(M, 1:0.25*length(M(:, 1)), interp, 5, 0.90, 5, 0.25);
R = T * ones(n, 1) / n; % R: statistical results
S = []; % S: resulting dist... |
classdef Friction < dynamicprops & PusherSliderSystem
% Class that defines the limit surface (A_ls), used in controller
% design AND simulator
properties (Constant)
%Pusher constants
nu = 0.35;
nu_p = 0.3;
end
properties
c;
m_max;
f_max;
A_ls... |
function [ch_data] = plot_channel(ch_no,bin_fullname,start_time_s,end_time_s,probe)
fs = 30000; %Sampling frequncy
%Select the total number of channels based on the probe option
switch probe
case 1
no_channels = 385; %Total number of channels
case 2
no_channels = 385; %Total number of channels
... |
function [X_filtered] = normal(X,Max);
switch nargin
case 2
X_filtered = X/Max*100;
case 1
Max = max(X);
X_filtered = X/Max*100;
otherwise
X_filtered = 0;
end |
clc
clear all
close all
pict=imread("pepper.bmp");
pict=rgb2gray(pict)
[M,N]=size(pict)
x=0.1;
u=4;
for i=1:500
x=u*x*(1-x)
end
A=zeros(1,M*N);
A(1)=x;
for i=1:M*N-1
A(i+1)=u*A(i)*(1-A(i));
end
B=uint8(255*A)
mapping=reshape(B,M,N)
subplot(2,2,1)
imshow(mapping)
out=bitxor(pict,mapping)
v=out
subplot(2,2... |
u1 = 0*ones(500, 1);
u2 = 0*ones(500, 1);
y1 = zeros(500, 1);
y2 = zeros(500, 1);
u1(9:end) = 1;
for k = 9:500
y1(k) = symulacja_obiektu5y1(u1(k-7), u1(k-8), u2(k-2), u2(k-3), y1(k-1), y1(k-2));
y2(k) = symulacja_obiektu5y2(u1(k-3), u1(k-4), u2(k-4), u2(k-5), y2(k-1), y2(k-2));
end
csvwrite('z3_y1_u1.csv', y1(9:... |
function [a,b] = ss2phv(A,B)
%ss2phv Transforms a general state variable equation into phase variable form
% n-1
% for a given A and B if the matrix S =[B AB ... A B] is nonsigular
% H. Saadat, 1998
n=length(A);
for i=1:n;
S(:,n+... |
% Save_IterSummary - Saves average iteration summary data to file and
% prints to screen.
% Called by: VC_Shell
% Calls: dump2DArray, save2DArray
% V02 - 01/10/2014 VC
% ©MathEcology, LLC 2014 - Colleen R. Burgess
%--------------------------------------------------------------------------
global iternum numpops out... |
% 2-Norm Opt, KKT condition for edges
% Cond = 0(Not optimal) or 1(Optimal)
%
% Please cite the following paper when using this algorithm:
% M. Gouttefarde, J. Lamaury, C. Reichert and T. Bruckmann, "A Versatile
% Tension Distribution Algorithm for n-DOF Parallel Robots Driven by n+2
% Cables", IEEE Trans. Robot., vol.... |
function [LON,LAT] = coast2polygon(lon,lat)
% [LON,LAT] = COAST2POLYGON(lon,lat)
% Trabsforma em polígonos, a linha de costa separada por NaN
isn = find(isnan(lon)==1);
if ~isempty(isn)
siz = length(lon);
isn_f = find(isn == siz);
if isempty(isn_f)
isn = cat(1,isn,siz);
end
end
... |
function [simname] = selectSimulation(data_num)
%% choose a network to load from networks folder
clc
dirName = [pwd,'\results\*.mat'];
Allinpnames = dir(dirName);
if isempty(data_num)
disp(sprintf('\nChoose scenario file:'))
for i=1:length(Allinpnames)
disp([num2str(i),'. ', Allinpnames(i).name])
e... |
function [PercentCorrect_train,Y_predicted_train,W_randoms,W_outputs,A] = ELM_training(Flags,L,ImageSize,X,Y,k_train,labels,NumClasses,M,Scaling,RidgeParam,MinMaskSize,RF_Border)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This code implements methods ... |
function phclic(varargin);
% phclic( [...] );
% Inlet Control
h = timeplot({'IHeatBlkTSt','IHeatBlkCT'}, ...
'Inlet Control', ...
'Control', ...
{'IHeatBlkTSt','IHeatBlkCT'}, ...
varargin{:} );
|
%% Sampling strategies: Random, Stratified random (LHS) and Quasi-random (Sobol sequences)
%it is all above how you subsample from the k dimensional (continous) input space.
clear all
clc
close all
%% method 1: Randomg sampling
%n. of variables
figure(1)
k=3; N=100;
grid,hold on;
%axis([0 1 0 1]);
for i=1:N
X(i,:... |
%% calculate step and input initial value
clear;clc;close all
Delta = 0.0005; % step
t = 0:Delta:0.7; % independent variable£ºtime t
n = length(t);
Y(:,1) = [10;1;0;0]; % initial value of four variables
%% calculate the differential equation
for k = 1:n-1
z1 = f(t(k),Y(:,k));
z2 = f(t(k) + Del... |
% in function file
function F=a4q8(x)
F(1) = x(1).*x(2)-4;
F(2) = x(1).*x(3)-3;
F(3) = x(2).*x(1)+x(3)-5;
end
% in command window
returnval=@a4q8;
r=[1,2,3];
abc=fsolve(returnval, r)
|
%% Bottleneck
%%% Parameters & Variables
mut_load_0 = 0.1; %%% Initial mutation load
mutrate = 1e-7 ; %%% Mutation rate/bp
mu = mutrate *16569; %%% mtDNA genome-wide mutation rate
n_start=2^19; %%% Initial mtDNA copy number
n_iterations = 10; ... |
% cournot_game(1200, 2, 2, [100,200,200],[300,100,100],[2,1])
cournot_game(1200, 2, 2, [100,200,200],[300,100,100], [2, 1])
%% 11 firm
P = 4000;
b=2;
qbar = [300,300,300,300,300, 100,100,100,100,100,100];
mc = [100,100,100,100,100, 200,200,200,200,200,200];
N =11;
cournot_game(P, b, N, mc, qbar)
% consistent with a... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%(c) Ghassan Hamarneh 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%
function db=find_db(dx,P);
%function db=find_db(dx,P);
% find db by transforming dx into the model parameter space
% db = P\dx
db=P\dx;
|
% impa bring up with network analyzer
%% initialization
disp('Initializing...');
import qes.*
import data_taking.public.jpa.*
cd('F:\program\QOS\qos');
% addpath('F:\program\QOS\qos\dlls');
QS = qSettings.GetInstance('F:\program\QOS\qos_settings');
QS.SU('yulin');
QS.SS('impa_170220');
QS.CreateHw();
disp('Initiali... |
function [ indOprnInter,indOprnFinal] = EvalTradelist( tradelist)
%% Compute operation indicator at transaction leval.
%
%% trade list
% trade list as a SingleAsset
% code 1
% dPosition 2
% price 3
% operation 4
% Slippage 5
% Volume 6
% Participation 7
%% Compute intermediate tr... |
% transistorClippingTest.m
% Dan Hirlinger
% 2/1/21
clear; clc;
[x,Fs] = audioread('BassDI.wav');
thresh = 0.2;
out = transistorClipping(x,thresh);
actual = audioread('LA3APrint.wav');
plot(out);
figure; plot(actual);
|
function [dict,dictz] = fastMRFdictionary_Grisword(RFpulses, TR ,T1, T2, df,initial_state)
%
% This function calculates the MRF signal evolution for an IR-bSSFP-based
% readout for a single material (T1, T2, df) for the input RF pulse train
% and TR.
%
% This code is based on the single isochromat method populari... |
function u = nomTorque(cd, d_th_sq_0)
%NOMTORQUE Calculates the nominal torque required to maintain zero
% dynamics of the compass-gait walker given initial theta-dot^2
% Output is a grid of torques corresponding to grid within cd.
% This should ideally be replaced by some kind of polynomial.
d_theta_sq = cd.Gamma... |
function calc_selection_to_structure(self)
% 将期权的选择转换为Structure组合构造
% 吴云峰 20170330
% 看涨期权的行情的数据
m2tkCallQuote = self.m2tkCallQuote;
% 看跌期权的行情的数据
m2tkPutQuote = self.m2tkPutQuote;
% 合约到期时间
portfolio_T_idx = self.portfolio_T_idx;
% 合约的执行价
portfolio_K_idx = self.portfolio_K_idx;
% 合约的数量
port... |
% qJD [%NQJ%x1]
% Generalized joint velocities
|
%1a
%refer:https://stats.stackexchange.com/questions/120179/generating-data-with-a-given-sample-covariance-matrix
%class1
Sigma1 = [1 0;0 1];
%generate 1000 data samples
n = 1000;
d = 2;
rng(31);
X1 = randn(n,d)*chol(Sigma1);
%assume zero mean
mean = [0,0];
figure(1);
subplot(1,2,1);
plot(X1(:,1)+mean(1),X1(:,2)+mean... |
%% Ejercicio
% Funcion auxiliar para el calculo del productorio del polinomio
% interpolador
function [l] = ljota(s, x)
% Parametros de entrada:
% s: array de nodos
% x: punto sobre el que evaluar el polinomio
tic;
n = size(s);
l = ones(1,n(2));
for i=1:n(2)
for j=1:n(2)
... |
%{
Jacob Leonard
ITP 168 - Fall 2015
jaleonar@usc.edu
Revision History
Date Changes Programmer
-------------------------------------------------
10/23/2015 Original Jacob Leonard
%}
function[cardDealt, shuffled] = dealcard(shuffled)
%this function takes in the shuffled deck, de... |
function [moving_reg, Xx, Xy] = non_rigid_refine(moving_reg, fixed)
% -- mirt
main.similarity='ssd'; % similarity measure, e.g. SSD, CC, SAD, RC, CD2, MS, MI
main.subdivide=2; % use 3 hierarchical levels
main.okno= 16; % mesh window size
main.lambda = 0.05; % transformation regularization weight, ... |
% xAverageGrids.m
clear;
setFigureDefaults;
ng = 5; % number of grids
% pre-allocate array
Postr = zeros(500,1000,ng);
% fill array
for ii = 1:ng
load(strcat('~/Documents/DPhil/Data/GridSearches/BesselGrid_TauSet3_',num2str(ii),'.mat'));
Postr(:,:,ii) = pos;
end
% set out true values
trv... |
function [alldata_fileNames, days_all] = setBehavFileNames(subject, days, dayLast, days2exclude)
%
% alldata_fileNames includes the name of behavioral data .mat files specified
% by the inputs:
% subject: string array
% days, dayLast, days2exclude: cell array
%
% days_all includes the date of each mat file.
%
... |
function res = derivcalc(~, S, m, rho, A, c_roll)
numballs = length(S)/4;
speed_threshold = 0.03; % m/s (about 1 in/s)
a_grav = 9.8; % acceleration due to gravity (m/s^2)
x = zeros(1,numballs);
y = zeros(1,numballs);
vx = zeros(1,numballs);
vy = zeros(1,numballs);
for i = 1:numballs
x(i) = S(i*4-3);
y(i) = S(... |
%[2016]-"SCA: A sine cosine algorithm for solving optimization
%problems"
% (9/12/2020)
function SCA = jSineCosineAlgorithm(feat,label,opts)
% Parameters
lb = 0;
ub = 1;
thres = 0.5;
alpha = 2; % constant
if isfield(opts,'T'), max_Iter = opts.T; end
if isfield(opts,'N'), N = opts.N; end
if ... |
input_image = imread('Lena.bmp');
text_file = fopen('Embed.txt','rt');
text_read_ascii = fread(text_file,'uint8');
binaryString = transpose(de2bi(text_read_ascii,7));
size_binaryString = size(binaryString);
text_message = reshape(binaryString,1,size_binaryString(1)*size_binaryString(2));
text_message(length(text_... |
function out = pchange(a,b,c)
out=(mean(cell2mat(a))-mean(cell2mat(b)))/mean(cell2mat(c));
end |
function pall=addbaselinestopall(pall)
% gets each person's baseline as the mean of
% the 10 samples at the beginning of each trial
for ct=1:length(pall)
for samp=1:10
pall(ct).TrialStarts=max(1,pall(ct).TrialStarts);
s(samp)=mean(pall(ct).NoBlinks(pall(ct).TrialStarts(1:end)+samp));
end
... |
classdef MinMaxScaler < BaseEstimator & TransformerMixin
% Transforms features by scaling each feature to a given range.
%
% This estimator scales and translates each feature individually such
% that it is in the given range on the training set.
properties (GetAccess = 'public', SetAccess = 'pu... |
function [ result, header, traj_lookup ] = build_all_attributes( data )
result = [];
traj_lookup = [];
birdIds = str2double(data(:, 2));
birds = unique(birdIds);
cell_times = data(:, 5);
times = cell2mat(cell_times);
header = {};
traj_id = 0;
% Do seperately for each bird
... |
function [x1,f1,da]=GP_optimizer(func,x0,theta,sigy,step,tol,maxEval,flag_plot)
%Gaussian process optimizer (for minimization)
%[x1,f1,nf]=GP_optimizer(func,x0,theta,sigy,step,tol,maxEval,flag_plot)
%use line scan
%Idimut:
% func, function handle
% x0, initial solution
% step, step size
% tol, a small number to... |
% wei
addpath('./utils');
% set `debug = true` if you want to visualize the skeletons
% You also need to download the MPII dataset and specify the path of
% annopath = `mpii_human_pose_v1_u12_1.mat`
debug = false;
annopath = 'path_to/mpii_human_pose_v1_u12_1.mat';
load('data/detections.mat');
tompson_i = ... |
clear;clc;
exp.cond='prespeech';
if(strcmp(exp.cond,'prespeech'))
exp.freq = [12 14];
elseif(strcmp(exp.cond,'prelisten'))
exp.time = [-0.26 -0.19];
exp.freq = [22 24];
elseif(strcmp(exp.cond,'postlisten_24'))
exp.time = [0.05 0.1];
exp.freq = [24 29];
elseif(strcmp(exp.cond,'postlisten_32'))
... |
function process_assertion_outcome(name, pass, x, y, verbose, testidx, varargin)
%PROCESS_ASSERTION_OUTCOME
%
% Part of the testing framework. Save the outcome of the assertion in a
% global TEST structure if requested and handles the debugging information
% to the command line.
%
% PROCESS_ASSERTION_OUTCOME(NAME, ... |
classdef SupportVectorMachine < handle
properties
X
y
sigma
alpha
K
end
methods
function supportVectorMachineObj = SupportVectorMachine(X, y, sigma, alpha, K)
supportVectorMachineObj.X = X;
supportVectorMachineObj.y = y;
... |
function legendset(x,y,l,lbond,hObject, eventdata, handles)
global gsettings
axes(handles.axes1);
cla
colorbar('hide')
colorrange = colormap('jet');
[msize, nodatamsize] = marker_size();
% gsettings = general_settings(hObject, eventdata, handles);
[novaluecolor, novaluecolorname] = marker_color({}, -1);
[defaultcolor,... |
function movie_maker_phaseMap(g,framenum1,framenum2,speed,x_px,y_px,x_px1,y_px1,IC,switchtime,save)
% framenum1,2 are the frames you want to start and stop the movie at
% speed=2, and fps=20 let you make an avi file (filename=input.avi) that is
% in realtime
% IC=1 means that initially the condition is spontaneous wi... |
function iguess_set = AMIGO_update_parameter_guesses(inputs,iguess_set,theta,alpha)
% iguess_set = AMIGO_update_parameter_guesses(inputs,iguess_set,theta,alpha) initialize or updates the initial guess structure
%
%
% INPUTS:
% inputs AMIGO inputs strucure with PEsol field
% iguess_set(optional) structure, conta... |
function anchors = generate_anchors(basic, strides, cls_map_shape)
% generate shifts
shift_x = [0 : cls_map_shape(2)-1] * strides;
shift_y = [0 : cls_map_shape(1)-1] * strides;
shift_x = meshgrid(shift_x);
shift_y = meshgrid(shift_y);
% convert to colume
shift_x = shift_x';
% ... |
clear all
clc
filter = filterBinomial1d( 1 ); % 半径r=1的1维二项式滤波器
filter2 = filter*filter';% 半径r=1的2维二项式滤波器
bin_size = 4;
nbin=6;
sample_factor = 4;
if 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%直接读取图片,提取特征
path1 = 'E:\luobo\databases\AFLW\AFLW归一化人脸库\left_face\imface_0_20\';
tic;
... |
k1 = 10;
k2 = 6;
Td = 5;
Tp = 0.2;
x = 0;
sim('model_pid',5);
plot(t,odp_skok,'b');
grid on; |
clearvars
% load periodic solution
load('vdp1.mat')
N = 0.5*(length(X)-1);
T = X(2*N+1,1);
[~,x] = fourierdiff(N);
tt = x*T/(2*pi);
x1 = X(1:N,1); x2 = X(N+1:2*N,1);
t = linspace(0, T, 1000);
x1_interp = interp_sinc(tt, x1, t);
x2_interp = interp_sinc(tt, x2, t);
subplot(211)
plot(t, x1_interp, '-r', 'LineWidth', 1.25... |
% Berechnung der Lagekennwerte
average = sum(class.*relFreq)
median = class(2)+1*(0.5-relSumFreq(2))/relFreq(3)
% Berechnung der Streuungskennwerte
variance = 1/(length(class)-1)*sum(absFreq.*(class-average).^2)
standardDeviation = sqrt(variance)
quartil75 = class(3)+1*(0.75 - relSumFreq(3))/relFreq(4)
quartil25 = cla... |
im=imread('image_0072.jpg');
imgBin=im2bw(im,graythresh(im));
ee = strel('disk',2);
imgMarkers = imerode(imgBin,ee);
imgReconstruct=imreconstruct(imgMarkers,imgBin);
%% descriptores sencillos: circularidad/rectangularidad, compacidad
stats= regionprops(double(imgReconstruct),'Eccentricity', 'Solidity');
circularidad ... |
%======== 使用STRAIGHT調整source的pitch,duration成為target 2008/12/10 ==========================
clear all;
[source,fs1]=wavread('C:/Program Files/MATLAB/R2008a/work/STRAIGHT/2.wav'); %source
[target,fs2]=wavread('C:/Program Files/MATLAB/R2008a/work/STRAIGHT/2_4.wav'); %target
fs=fs1;
%======== duration moditication (ma... |
function [sensitivity , indiParameters] = analyseSensitivity(app, obj, refobj)
referenceImpact = refobj.generateLCIA(app);
%get only independant parameters
processParameters = string(fieldnames(obj.processParameter));
indiParameters = [];
for i = 1:length(processParameters)
if (obj.processParameter.(proce... |
FOLDER = "";
MASKS = "";
OUT = fullfile(FOLDER, "cleaned");
contents = get_contents(FOLDER);
contents = get_files_with_extension(contents, ".png");
mask_contents = get_contents(MASKS);
mask_contents = get_files_with_extension(mask_contents, ".TIF");
assert(height(contents) == height(mask_contents));
stack = [];
for... |
function result = TestPolyType(polyType)
%TestPolyType Returns true if the polyType is a valid one.
% result = TestPolyType(polyType) checks if the polyType is one of the
% valid types of polynomials. Valid types:
%
% Lobatto, Gauss, EGauss
%
% Copyright 2009 Artur Palha
% $Revision: 1.0 $ $Date: 2009/11... |
function [counts0,uniques0,counts1] = RBES_detect_features(archs,indexes,atts,types,varargin)
%% All architectures
if nargin < 5
[counts0,uniques0] = count_features(archs,atts,types);
else
counts0 = varargin{1};
uniques0 = varargin{2};
end
[counts1,~] = count_features(arch... |
%% Non-Homogenuous Stationary BVP with Variable Coefficients and Dirichlet-Neumann BC (Case 2D)
%% ============================================================================================
function [errorL2,dx,dy] = BVP_2D_DN_Exp(Nmod,varK,phiExpNmod10000,wavenumberExp0Nmod10000,wavenumberExp1Nmod10000)
... |
% 라플라스 역변환
% laplace(), ilaplace() 이용
syms s a w t f(t)
laplace(1, s)
ilaplace(1/s)
laplace(t)
ilaplace(1/s^2)
laplace(t^2)
ilaplace(2/s^3)
laplace(exp(a*t))
ilaplace(-1/(a - s))
laplace(exp(a*t)*t^2)
ilaplace(-2/(a - s)^3)
laplace(sin(w*t))
ilaplace(w/(s^2 + w^2))
laplace(cos(w*t))
ilaplace(s/(s^2 + w^2))
% 미분... |
function result = Nuton_xy(polinom, polinomi)
result = [];
result(end+1) = 3;
result(end+1) = 3;
eps = 0.001;
Jac = det([gorner_for_nm(diff_by_xy(polinom,'x'),[result(1),result(2)]),gorner_for_nm(diff_by_xy(polinom,'y'),[result(1),result(2)]);
gorner_for_nm(diff_by_xy(polinomi,'x'),[result(1),result... |
function obj = updateVariableBounds(obj, bounds)
% This function updates the boundary conditions of the optimization
% variable by updating corresponding NLP variables
%
%
% Parameters:
% bounds: a structed data stores the boundary information of the
% NLP variables @type struct
... |
# remaps a cartesian point w.r.t a transformation x
# cp: the cartesian rep of the point [px py]
# X: the 3x3 isometry of the transformation
# tcp: the cartesian rep of the point [px py]
function tcp = point2d_remapCartesian(X, cp)
tcp=cp;
tcp(1:2,1) = X(1:2,1:2)*cp(1:2,1) + X(1:2,3);
tcp=tcp';
endfunction
|
%%% this scripts combines cross-validation models
%%% Combining method: average
%%% load CS models
model1=load('k_folder_models/model1.mat');
model1=model1.model;
model2=load('k_folder_models/model2.mat');
model2=model2.model;
model3=load('k_folder_models/model3.mat');
model3=model3.model;
model4=load('k_folder_mo... |
function [order, fing, atom_fing]=fingerprint_calc(Ni, V, dist_matrix, typ_i, typ_j, numIons)
% Ni - number of atoms in the unit cell of sort that is determined by atom i
% Ncell - number of atoms in the unit cell
% dist_matrix - [Nfull, sum(numIons)],
% contains all the distances (<Rmax) from the supercell atoms to t... |
% Parameters:
% points -- num_frames x num_joints x 3 matrix of joint positions.
% lim -- Manual axis limits. [] for automatic bounding box.
% plot_opts -- Additional arguments to plot().
function save_masked_movie(fig, points, mask, colors, lim, show_masked, ...
plot_opts, masked_plot_opts, image_size, dpi, outpu... |
clear
clc
close all
t=-6:0.4:6;
t0=4;
y=delta(t-t0);
figure(5)
stem(t,y,'color',[0 200 0]/255,'Linewidth',2)
axis([-6 6 -1 2])
xlabel('n')
ylabel('f[n]') |
%% Sparse position
%%
set(0, 'DefaultFigurePosition', get(0,'screensize'));
clc; clear; close all;
addpath('provided_code');
%% First experiment:
%
% The objective is to study how the addition of a bias term along with the
% use of binary representation instead of the [-1,1] affects the storing
% capacity of the netw... |
%With your data for Ri and K_H in a file JAN1941sample,
%If you have created a file simpleavg.m containing:
load JAN1941sample
data= JAN1941sample
lon=data(:,1);
lat=data(:,2);
depth=data(:,3);
kh=data(:,5);
ri=data(:,4);
mask=(ri~=-1.e30);
riavg=sum(ri.*mask)/sum(mask);
khavg=sum(kh.*mask)/sum(mask);
%Where the mask i... |
function se0p_opt = se0p_parse_params(opt)
% Setup Free-Space Ewald grid sizes
% inner = domain containing all sources and targets
% extended = FGG grid (to cancel wrap effects)
% padded = 2x FFT grid (for aperiodic convolution)
% oversampled = FFT grid for truncated Green's function
se0p_opt = opt;
inner_M = opt.M;
... |
clear
job_list = job('Computer software ');
file_head = 'D:\MATLAB_GIT\APMCM2018';
mouth = [{'01'},{'02'},{'03'},{'04'},{'05'},{'06'},{'07'},{'08'},{'09'},{'10'},{'11'},{'12'}];
for year = 2015:2018
fold_head = num2str(year);
for k = 1:12
file_name = strcat(file_head,'\',fold_head,'\',mouth{k},'... |
function [DataFormat, ImageData]=Resample_EntireImage(DataFormat, ImageData, CDataSetInfo)
%Entire image needs to resample after preprocess-Reample_VoxelSize
[MFilePath, MFileName]=fileparts(mfilename('fullpath'));
TempIndex=strfind(MFilePath, '\');
ProgramPath=MFilePath(1:TempIndex(end));
%UpdateData DataF... |
function [W_wing] = weight()
EMWET MD11;
fid = fopen('MD11.weight', 'r');
OUT = textscan(fid, '%s');
fclose(fid);
out = OUT{1};
W_wing = str2double(out(4));
end |
function out = getTotalDistance(x,y)
% returns the total distance moved between sequential x-y points
out = 0;
for i=2:numel(x)
out = out + sqrt((x(i)-x(i-1))^2+(y(i)-y(i-1))^2);
end
|
profile on
[errors, warnings, extensions] = validateTSVTags('LSIE_01_Indoor_all_events.txt', 3, 'hasHeader', false);
profile off
profsave(profile('info'),'myprofile_results') |
function circimagesc(v,markerSize)
bg = repmat(min(min(v)),size(v,1),size(v,2));
imagesc(bg);
hold on
[I,J] = ind2sub(size(v),1:length(v(:)));
units = get(gca,'units');
set(gca,'units','pixels')
pos = get(gca,'position');
markerSize = (pos(4)*pos(3))/(2.5*(size(v,1)*size(v... |
%梯度下降函数
function theta = GD(x,y,alpha,k)
%alpha学习速率,k迭代次数
theta=zeros(size(x,2),1);
for i=1:k
theta=theta-alpha/size(x,1)*x'*(x*theta-y);
end |
% PRP: 1. implement static SAVE and LOAD function (ConstructOnLoad)
% 2. create class for ID register
classdef UMPrest < handle
methods (Static)
function envsetup()
warning('off', 'symbolic:solve:warnmsg3'); % turn off warning : no
% in... |
function [ out confidence ] = MahalanobisClassifier( testset, trainset, traingroup )
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
%calculate covariance matrices
h = waitbar(0,'Mahalanobis Classifier Training Phase');
for i = 1:10
indexes = find(traingroup == i-1);
T ... |
%AssignToClusters
%Used by KMeansRGB
%Purpose:Assigns each point to a cluster, based on which mean
%that point is closest to by calculating squared distance
%Inputs 1) 3D array containing an RGB %image 'A'
% 2)3d Array containing color information 'RGBvalues'
%Outputs 1)2D array with m rows and n columns ... |
function [var] = GetVarSta(hname,VarOp,station,slice);
%---------------------------------------------------------------------
%---------------------------------------------------------------------
%
% This function returns a specified slice (slice) of the specified
% variable (VarOp) taken from a station file.
%
% INPU... |
function [Hurst] = fas_hurst(gamma_medio)
Hurst = (gamma_medio-1)/2;
end |
function compareAODVolumes(obj,key1,key2) %#ok<*INUSD>
% uparrow/downarrow : move slices
% leftarrow/rightarrow : adjust AOD depth
% pageup/pagedown : adjust ScanImage depth
% z : zoom in/out
% w/s/a/d : adjust zoom window location
% escape : quit without saving
% ... |
%SetFreqStep
low_freq = str2num(get(H.lowfreq,'String'));
high_freq = str2num(get(H.highfreq,'String'));
numfreqs = str2num(get(H.numfreqs,'String'));
set(H.stepfreq,'String',num2str(round((high_freq-low_freq)/(numfreqs-1)))); |
function ReducedImage = Reduce(Image)
% This function blurs the image and reduces by half its size.
Image = imfilter(Image, Kernel());
ReducedImage = Image(1 : 2 : end, 1 : 2 : end, :);
end |
function outstr=makeMexcallbackmodule(maxmxinputs,maxmxinputs0,alpha)
beginstr='';middlestr='';endstr='';
modlist='';funlist='';
r=char(10);
beginstr=[beginstr,...
'module mexcallback',r];
middlestr=[middlestr,...
'contains',r];
endstr=[endstr,...
'end module mexcallback',r];
modlist=[modlist,...
' interface ... |
close all
clear all
clc
%% 1.6
Fs = 8000;
Ts = 1/Fs;
t = 0:Ts:5;
xc = chirp(t,0,5,4000,'linear');
%chirp u vremenu
figure(5)
plot(t(1:length(t)/10),xc(1:length(t)/10))
xlabel('time');
fig5 = gca; fig5.XAxis.TickLabelFormat = '%.2f s';
print('Chirp vremenski','-dsvg','-r0')
signal = audioplayer(xc... |
function Etag = getEtag(obj)
% GETETAG Gets the ETag value of the container
% The ETag value is a unique identifier that is updated when a write operation
% is performed against the container. It may be used to perform operations
% conditionally, providing concurrency control and improved efficiency. The
% Etag is retu... |
function unit = punit(parameter)
[p, ~, u] = property();
for i=1:length(p)
if (strcmp(parameter,p{i}) == 1)
unit = u{i};
break
end %if
end %i |
function TPA_ListenTestMain
% creates main gui to manage childs figures
% figures are opened according to user will
% sync user action over different childs
% WORKING
hMainGui = figure('Pos', [400 400 300 100]);
%graph=axes('parent',hMainGui, 'units', 'pixel','pos',[30 50 250 220]);
lbl1 =uicontrol(hMainGui,'style... |
sol=zeros(900,2);
for i=101:1000
ind=find(isnan(dat(i,:)));
if(ind>1)
subs=dat(i,1:ind-1);
likelystates = hmmviterbi(subs, ESTTR, ESTEMIT);
[num,ind2]=max(ESTTR(likelystates(size(likelystates,2)),:));
[num,ind3]=max(ESTEMIT(ind2,:));
%[num,ind3]=max(ESTTR(likelystates(siz... |
function err = train_test(train, num_teams, k, test, algorithm)
%TRAIN_TEST Summary of this function goes here
% Runs a given algoroithm and reports the error
if(strcmp(algorithm, 'svm'))
model = SVMTrain(train, k, num_teams);
correct = SVMTest(test, model, k, num_teams);
else... |
function h = show_pixel(pixel, B, h)
%用图像显示元胞空间
[L, W] = size(pixel); %获取车道长度,车道数
temp = pixel;
temp(temp==1) = 0;%一开始先把车道中的车清空
PLAZA(:,:,1) = pixel;
PLAZA(:,:,2) = pixel;
PLAZA(:,:,3) = pixel;
PLAZA(PLAZA==0)=1;
if pixel(end,end-1) == -2;
PLAZA(end,end-1,1) =1;
PLAZA(end,end-1,2) =0;
PLAZA(end,end-1,3) =... |
function [Hessian JJ RR2 J R] = AMIGO_FD_Hessian(p,inputs,privstruct,results)
% computes the Hessian of the Least Squares objective function.
% the computation involves npar number of gradient evaluation, thus it may timeconsuming.
% inputs:
% p: parameter vector
% inputs: AMIGO_PE input structure
% outputs:
% H... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.