text stringlengths 8 6.12M |
|---|
function Complete_run(dname, feature_extraction)
addpath('cluster');
addpath('convolutional');
addpath('PSLF');
addpath('style_analysis');
%%
dataname=dname; %data set name you are going to run
%select from
%demo
%hu_building, hu_car, hu_drinkware, hu_furniture, hu_leg
%our_building, our_car, our_furniture
%%
%% start... |
function res=SODW(x,a,b,w);
% function res=SODW(x,a,b,w);
%
% Computes and sums over all outer products of the columns in x and
% weights them according to w.
%
% equivalent to:
%
% res=zeros(size(x,1));
% for i=1:n
% res=res+w(i).*x(:,a(i))*x(:,b(i))';
%% should be:
%% res = res + w(i).*x(:,a(... |
function result = GenerateTrajectory(simParam)
%rename inputs
initialCondition = simParam.initialCondition;
finalCondition = simParam.finalCondition;
purturbH = simParam.purturbH;
maxConvergenceCount = simParam.maxConvergenceCount;
convergenceThreshold = simParam.convergenceThreshold;
purturbH = simParam.purturbH;
od... |
function [Uab,Ubc,Uca,Un,t]=Umf
% function [Uab,Ubc,Uca,Un,t]=Umf
% zawiera pomiary napiec miedzyfazowych w V, rejestrowane co 1 min.
% na szynach 20 kV stacji GPZ zasilajacej zaklady przemyslowe
Un = 20; % napiecie znamionowe w kV
Uxls='xlsU.xlsx'; % nazwa arkusza xlsx z pomiarami napiec
%w kolumnach i wierszach arkus... |
% John Chen <chenyi@hitsz.edu.cn>
% Shenzhen Graduate School, Harbin Institute of Technology
% Created: November 2013
% Modified: November 2013
function prob = calculateNMI( param )
% function that calculate nmi
file = strcat(param.path, param.file);
file = strcat(file, '.txt');
M = dlmread(file);
prob ... |
classdef IS2 < handle
%IS2 Class to perform marginal likelihood estimation using IS2
properties
ModelToFit
NumParticle % Number of particles in particle filter
NumISParticle % Number of IS particle
LogLikelihood % Handle of the function implementing log-likelihod
... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 5000;
params.Gridjob.wc_host = [];
params.Gridjob.jobname = 'simZtrafo';
params.Gridjob.initRandStreamWithSeed = 12345;
params.RBM.inActFolder = '../labelMeZtransformed';
params.RBM.inActFilenames = 'act.*.mat';
params.RBM.outW... |
function psf = pupilPSF(opd, amplitude, bands, intensities, focalLength, npix, pupilSamplingDistance, pixelSize)
% this method was developed by Andy Kee. The built-in FFT function
% uniformly samples frequencies with interval 1/n. But we don't want that!
% We only want the intervals that correspond to pixels. Using FFT... |
function imf = emd(x)
% Empiricial Mode Decomposition (Hilbert-Huang Transform)
% EMD分解或HHT变换
% 返回值为cell类型,依次为一次IMF、二次IMF、...、最后残差
x= transpose(x(:));
imf = [];
while ~ismonotonic(x)
x1 = x;
sd = Inf;
while (sd > 0.1) || ~isimf(x1)
s1 = getspline(x1);%?????????% 极大值点样条曲线
s2 = -getspline(-x1);%???????% 极小值点样条曲线
x2 = x1... |
function [] = rgb2grey(path)
I=imread(path);%读取文件
[y,x,~]=size(I);%获取文件大小
maxRow = y; %最大行数和最大列数
maxColumn = x;
total = 0;
intArray = int32(total);
%对整个图片进行扫描
for i = 1:maxRow
for j = 1:maxColumn
r = I(i,j,1); %获取这个像素点对应的rgb值
g = I(i,j,2);
... |
function [train_data,train_labels,train_subject_indices,train_subject_num] = read_replay_attack_train_data(path)
fid_train_real = fopen(strcat(path,'real-train.txt'));
path_train_real = textscan(fid_train_real,'%s');
train_real = path_train_real{1,1};
fid_train_attack = fopen(strcat(... |
clear;set(0,'defaultaxesfontsize',20);format long
%%% p10.m 3DVAR Filter, sin map (Ex. 1.3)
%% setup
J=1e3;% number of steps
alpha=2.5;% dynamics determined by alpha
gamma=1;% observational noise variance is gamma^2
sigma=3e-1;% dynamics noise variance is sigma^2
C0=9e-2;% prior initial condition variance
m0=0;% prior... |
clear all;
clc;
mkdir('./date/EEG'); %创建脑电数据目录
mkdir('./date/label'); %创建标签数据目录
A1 = zeros(32,256);
A2 = zeros(32,255);
for i = 1:1:32 %循环32次提取32个人的数据
d_data = strcat('s',num2str(i),'.mat'); %组合变量
load(d_data); %提取第i个人的数据
d_EEG = data; %读取EEG信号数据到变量d_EEG
d_label = labels; %读取标签数据到d... |
function batteryvoltagenow = getRealBatteryVoltageNow()
% getRealBatteryVoltageNow - Gets the instaneous battery voltage.
% ========================================================================
%
% [batteryvoltagenow] = getRealBatteryVoltageNow()
%
% Description:
% This value is averaged over a number of r... |
% Test Code
% Developed By Adnan Munawar
% For PSM1
close all
clear all
clc
node = rosmatlab.node('psm_matlab_node');
msg = rosmatlab.message('sensor_msgs/JointState',node);
pub = rosmatlab.publisher('/ros_matlab_psm1','sensor_msgs/JointState',node);
name = msg.getName();
name.add('one_outer_yaw_joint');
name.add('... |
function [r,firmado] = firmo_elgamal (g, a, q, texto)
%FIRMO_ELGAMAL
%Funcion que firma un texto con el cifrado ElGamal
%Parametros:
%g=Número generador en base q
%a=Clave privada del cifrado
%q=Número primo que representa el modulo
%texto=Texto a cifrar
%Salida:
%r= Número necesario para comprobar la firma
%firmado=M... |
% ABMSchellingSegregation.m
% Tested on the following builds: MATLAB R2020b
%
% (C) 2021 Joseph Blochberger (jblochb2@jhu.edu). All rights reserved.
% Feel free to share and use this script with associated files based on the
% following creative commons license: Attribution-NonCommercial-ShareAlike
% 4.0 Internationa... |
function milestones_pet_individuals_figure
% KNO_PET_FIGURE2
%
% Produce figure 2
% L.V. Straatman1, M.M. van Wanrooij1,2, L.F. de Geus-Oei3, E.P. Visser3, A.F.M. Snik1, J.J.S. Mulder1
%
%% Cleansing
close all
clear all
p = 'E:\Backup\Nifti\';
cd(p)
sub = '4549835';
fnamec = ['gswro_s' sub '-d201... |
%% Generate white noise
Ts=0.001;Fs=1/Ts;
t=0:Ts:100;
t=t';
u2=23*randn(size(t));
%% Plot
figure
plot(t,u2)
hold all
shg
%% Create a first order filter with time constant T=1:
T=.2; %Variera T
G=tf(1,[T 1]);
%% Filter the white noise with the filter
y2=lsim(G,u2,t);
plot(t,y2,'r')
shg
%% Calculate a spectrum for U, Y... |
%% set up time base
t=0:(1/80):100;
t=t(:);
%% generate simple noise
amplitude=1;
noiseA=amplitude*randn(size(t));
%% Nyquist fraction noise
figure;
noiseB=SMASH.SignalAnalysis.NoiseSignal(t);
noiseB.Amplitude=amplitude;
noiseB=defineTransfer(noiseB,'fraction',0.25);
noiseB=generate(noiseB);
subplot(2,1,1);
plot(t,... |
function [h] = egg(x, y, varargin)
%EGG plot an egg ellipse on current axes
%
% Arguments:
% x,y - data vectors with same length.
%
% name/value pairs:
% clr - face color of egg (NaN, i.e. unfilled)
% eclr - edge color of egg (k)
% res - egg resolution or number of points (100)
% q - egg quantile to use (.25)
% r... |
function [A0 A D O] = genHSMMparam_true(Nobs, Nhid, Dmin, Dmax, ID)
%initial state distribution
A0 = full(sprand(Nhid, 1, 1)); %0.6
if sum(A0) == 0
A0(randi(Nhid,1))=1;
end
A0 = A0./sum(A0); %normalize
%========= transition distribution ==========
%element i,j,k is transition from j to i when d_{t-1} = k: p(i|j,... |
% pc_001.m
clear all
close all
clc
% Inputs
L = 32;
p = 0.50;
% Setup
RN = rand(L,L);
u = zeros(L,L);
u(RN < p) = 1;
% clusters: cls = cluster labels 1, 2, ... numC = number of clusters
[cls, numC] = bwlabel(u,4);
% number of sites
nSites = L*L;
% number of occupied sites
... |
function [models] = my_gmm_models(X_train, y_train, K, cov_type, plot_iter)
%MY_GMM_MODELS Computes maximum likelihood estimate of the parameters for the
% given GMM using the EM algorithm and initial parameters for each class of
% the dataset X_train
% input------------------------------------------------------... |
% The basis pursuit algorithm in a cosine packet dictionnary is
% not yet implemented in Wavelab. It is implemented in the LastWave
% software, which is available on the Internet at
% http://www.cmap.polytechnique.fr/users/www.bacry
%
% Part of WaveLab Version 802
% Built Sunday, October 3, 1999 8:52:27 AM... |
function avg_logprob = hybrid_emb_training(last_dir, new_dir, vars)
% Hybrid Embedded training with HERest
hmm_defs_path = fullfile(last_dir, vars.hmm_defs);
floor_path = fullfile(last_dir, vars.hmm_vfloors);
if ~exist(new_dir, 'dir')
mkdir(new_dir);
end
% log_path = fullfile(new_dir, 'emb.log');
cm... |
function h5writeCompound(outputFilename, dsetLocation, newProbDomain)
% Need to extract group and dataset from dsetLocation
C = strsplit(dsetLocation, '/');
dataset = C{end};
group = '';
for i=1:(length(C)-1)
group = strcat(group, '/', C{i});
end
memtype = h5CompoundMemtype(newProbDomain);
fid = H5F.open(outputF... |
function show_hmm_trans(hmm_dir, vars)
% show hmms transition probs
% input:
% hmm_dir - dir that holds hmmdefs
hmm_defs_path = fullfile(hmm_dir, vars.hmm_defs);
hmms = read_htk_hmm(hmm_defs_path);
n_hmms = length(hmms);
for i = 1:n_hmms
disp(['[' hmms(i).name ']-------... |
function errFunc=normDataError(experiment,model)
%should be called as dataError(experiment1,model1,...experimentN,modelN)
%returns a function which will give you the SSE of all the experiments and their models
% SSE=errFunc([parameterValues])
%each sse is normalized by the number of datapoints in the experiment
er... |
function Jacobian = get_Jacobian(clientID,object,functionCall,vrep)
[~, ~, JacobianFloat, ~, ~] = vrep.simxCallScriptFunction(clientID,object,...
vrep.sim_scripttype_childscript,char(functionCall),[],[],[],[],...
vrep.simx_opmode_blocking... |
initialize_folder_names;
close all;
filename=strcat(DATA_FOLDER,'physics_constants.mat');
load(filename);
filename=strcat(DATA_FOLDER,'pressure_profile.mat');
load(filename);
filename=strcat(DATA_FOLDER,'flux_geometry.mat');
load(filename);
filename=strcat('../METIS_profiles.mat');
load(filename);
filename=strcat(DATA... |
function loc_extrema=localminmax(data)
% function loc_extrema=localminmax(data) finds local extrema from the
% matrix data (a Nx2 matrix, first column contains positions, second
% contains the function values. The function returns a cell with two
% elements, the first contains local maxima, the second contains local
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function [outData,outDataNum]= readExcelData(inPath )
%this function only use for read excel data
%fprintf(' go readExcelData!\n');
%[data,text ]= xlsread('\sourceData\第一步功率因数.xlsx');% ID in data(:,1),other usefull data text(:,4)
[~,text ]= xlsread(inPath);% ID in data(:,1),other usefull data text(:,4)
a=text(:,4)... |
clc;
close all;
clear all;
x=[1 0 1 1 0 1];
nx=size(x,2);
sign=1;
i=1;
while i<nx+1
t = i:0.001:i+1-0.001;
if x(i)==1
unipolar_code=square(t*2*pi,100);
polar_code=square(t*2*pi,100);
bipolar_code=sign*square(t*2*pi,100);
sign=sign*-1;
manchester_code=-square... |
function compteurBBA(varargin)
% analyse results of BBA from a file of type : ResBBA_numero_Date.mat
% INPUT
% 'Yes' if you want to write the specific file for offset application on
% file tableBBAH.mat and tableBBAV.mat
% 'No' if you just want to evaluate results on file result.txt
% OUTPUTS
% if 'yes' tableBBAH.... |
classdef BetadcvDeconv
%% BETADCVDECONV determines dcv from provided crv and catheter impulse response.
% It uses Fourier transformation and resampling to match the algorithm of the original betadcv.
% $Revision$
% was created $Date$
% by $Author$,
% last modified $LastChangedDate$
% and check... |
function cct_I = calcCCTimg( I ) % in mired = 1e6 / color temp.
% suppose I is already invGamma mapped, sRGB, 3 channel, in [0, 1] (HDR)
XYZ_I = rgb2xyz(I, 'srgb', 'D65/2', 'Gamma', 1.0);
xy_I = xyz2xy(XYZ_I);
cct_I = xy2cct(xy_I);
cct_I = max(cct_I, 1500); % clip: warmest, 1500K
cct_I ... |
%Zihang Zhou
%861090400
%April 18, 2016
%CS 171
%PS 2
function [ err ] = lambdaerror(v, X, Y, nfold, lambdas, I)
%vth segment is validation set outputs total error of labdas in col array
testing = [];
target = [];
err = [];
for i = 1:nfold %make testing and target that doesnt incude valid
if i ~= v
testing... |
function [H, HH, S, SS, H_f, SS_f] = design_regularization_filter ...
(h, matrix_1,matrix_2, extension_case,type_of_symmetry,option)
[M,N] = size(h);
%% design z at first, now z is Hermitian symmetric, s.t. the inverse DFT is also real-valued,
%% for sake of performing filtering.
limit = 1;
x = linspace(... |
function I_YCbCr_US_LI = jpeg_decode(Q_Y, Q_Cb, Q_Cr)
%------- JPEG Luminance quantizer matrix --------%
l_q = [16 11 10 16 24 40 51 61;
12 12 14 19 26 58 60 55;
14 13 16 24 40 57 69 56;
14 17 22 29 51 87 89 62;
18 22 37 56 68 109 103 77;
24 35 55 64 81 104 113 92;
49 64 78 87 108 121 120 101;
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gaussian Mixture Model Data Generation
% Author - Sahib Dhanjal <dhanjalsahib@gmail.com>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function output = generator(mu, sigma, scale, pi, matfile, write)
j=1;
X = zeros(scale^3,3);
for x_point=1:1:scale
fo... |
%@(#) arnewfil.m 1.4 06/01/04 08:22:27
%
function arnewfil
p=get(gcf,'position');
z=get(gcf,'userdata');
harwin=gcf;
hpar=z(3);
hand=get(hpar,'userdata');
ud=get(hand(2),'userdata');
hdis=z(1);
hfil=z(2);
distfile=get(hfil,'string');
[dist,mminj,konrod,bb,hy,mz,ks,buntyp,bunref,...
distlist,staton,masfil,rubrik,... |
% Select unit in the side panel:
function UnitSelection(app,event)
selected = strrep(event.Value, 'Unit ','');
app.Data.selected = str2double(selected);
if ~isempty(app.Data.selected)
makePlots(app);
metricPlots(app);
end
end |
clc
clear
close all
randn('seed',2020);rand('seed',2020)
D = 9;
K = 3;
parms = rand_parms_spec();
parms.D = D;
parms.K = K;
parms.alpha = 0.8;
parms.r = 0.3;
info = info_compute(parms);
maxiter = 2e2;
beta_list = [0.3 0.6 0.9];
mu_o = 1e-2;
Xtilde = info.Xtilde;
c = 1;
d = D-1;
% initialization
[U,~,~] = svd(Xti... |
function [r, LSF, rc2] = VADLPAnalysis(x, VADPar)
M = VADPar.M; % LP order
NP = VADPar.NP; % autocorrelation order
% Apply window to input frame
xw = VADPar.Window .* x;
% Compute autocorrelation
r = acorr(xw, NP+1) .* VADPar.LagWindow;
% Compute normalized LSF
% A = ac2poly(r(1:M+1));
N = length(r(1:M+1))... |
function [F F_chordae_left F_chordae_right] = difference_equations(leaflet)
%
% Evaluation of the global difference equations at j,k
% Requires reference configuration R
%
% Input
% leaflet Current parameters
%
% Output
% F Values of all difference equation, 3 by triangular array
%
% Copyright ... |
function [] = showDeflection(F, method)
warning('off','all')
x = -500:50:500;
y = -500:50:500;
z = 1.0;
d = zeros(length(x),length(y));
if strcmp(method,'MSA')
for i = 1:length(x)
for j = 1:length(y)
if abs(x(i)) >= 50 || abs(y(j)) >= 50
% Calc robot stiffnes matrix
... |
function h = compare_bottom(timedate, p, bton, btoff, bton2, btoff2);
%
% COMPARE_BOTTOM (timedate, p, bton, btoff, bton2, btoff2)
% plots depth and time, and overlays bottom time shown by different methods
% colours red for bottom time 1
% colours blue for bottom time 2
clf
% plot the full dive profile
plot(timedate... |
%HW8
% Problem 1: Modeling population growth
% The simplest model for a growing population assumes that each current
% individual has equal likelihood to divide, which yields a differential
% equation dx/dt = a*x where a is the division rate. It is easy to see that
% this will grow exponentially without bound. A simpl... |
function [query_points_X, query_points_Y] = get_q_points(x, y, win_rad)
% Get coordinates of query points within the window
left_bound = x - win_rad;
right_bound = x + win_rad;
top_bound = y - win_rad;
bottom_bound = y + win_rad;
win_size = 2 * win_rad + 1;
X = zeros(win_size);
Y = z... |
function [M] = define_M_BCP(rho, d, A)
%
M=zeros(A+1,A+1);
M(1,1)=rho^d+nchoosek(d,1)*rho^(d-1)*(1-rho);
for ell=2:d
M(1,ell)=nchoosek(d,ell)*rho^(d-ell)*(1-rho)^ell;
end
for k=2:A+1
for ell=(k-1):min((d+k-1),A+1)
M(k,ell)=nchoosek(d,ell+1-k)*rho^(d-(ell+1-k))*(1-rho)^(ell+1-k);
end
end
for k=(A-d+... |
function varargout = DlgEdgLin(varargin)
% DLGEDGLIN MATLAB code for DlgEdgLin.fig
% DLGEDGLIN, by itself, creates a new DLGEDGLIN or raises the existing
% singleton*.
%
% H = DLGEDGLIN returns the handle to a new DLGEDGLIN or the handle to
% the existing singleton*.
%
% DLGEDGLIN('CALLBACK',hO... |
classdef parameter_2020_08_06
%PARAMETER_2020_08_06 Summary of this class goes here
% Additional parameters for the data of the night 2020 August 5th
% Path: location (folder) of the data
% Heater: data of the heating during that night [start; end]
% Heater_int: intervall, in ... |
function [timeRecord, names] = expandFG(f,g)
% close all;
% t = 0: 0.01:2;
% y = sin(2*pi*t);
% plot(t,y)
timeRecord = [];
names = [];
count = 1;
% for i = 0.1:0.1:0.5
% for j = 0.1 : 0.1: 0.5
% timeStep = i + j;
% names = [names, "F" + num2str(i*10) + "G" + num2str(j*10)];
% timeRecord(count... |
function det_pq = pq_relaxed_small_step(euler_angle)
dummy7=1;
for p =-1.5:0.001:1.5
dummy6 =1;
for q=-1.5:0.001:1.5
strain_external = [1 0 p;0 0 q;p q -1];
g_mat = Euler_to_gmat(euler_angle);
s_in= g_mat*strain_external*g_mat';
for counter1=1:1:56 % Calculating m using bishop-hill table and ... |
% confidence set for e
data_load=load('confidence_set_e');
% discrete confidence set
discrete_e_set=data_load.eligible_e;
% continuous confidence set parameters
beta_svm=data_load.beta_svm;
bias_svm=data_load.bias_svm;
e_range=data_load.range_e;
% indicator of whether the example is in the confidence se... |
function y = sigmoid(x)
% Calcola la funzione sigmoide sull'input x
y = 1./(1+exp(-x));
end
|
function [ prob ] = background_marginal( is, m )
% ancestral group method k = 1/m
% m is the probability that given two alleles they are ibd
temp(1:length(is(:,1))) = 0;
prob(1:length(is(:,1))) = 1;
for i = 1:length(is(:,1))
for j = 1:length(is(i,:))
if( is(i,j) ~= j )
temp(i) = temp(i) + 1... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Algorithme de test
clear variables
close all
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% VARIABLES
%
pSize = 8;
overflow = 3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Dict = getDataset('Cropp... |
%CONTENTS MESHES3D 3D Surface Meshes.
% Version 1.22 06-Jun-2018.
%
% Creation, visualization, and manipulation of 3D surface meshes or
% polyhedra.
%
% Meshes and Polyhedra are represented by a couple of variables {V, F}:
% V: Nv-by-3 array of vertices: [x1 y1 z1; ... ; xn yn zn];
% F: is either a NF... |
function phaseDiff = LRCphaseDifference(xcn,xn,xcAcrophase,xAcrophase)
%LRCPHASEDIFFERENCE Summary of this function goes here
% Detailed explanation goes here
pacemakerPhase = atan2(xcn,xn)*43200/pi; %xn should actually be -xn but ok as is
pacemakerPhase = mod(pacemakerPhase,86400);
activityPhase = atan2(xcAcrophas... |
clear;
clc;
%inverse elbow manipulator
%更快的方法当然是利用elbow的工具和空间坐标系的变换来直接使用elbow逆解的结论
%这里试试直接使用逆解
%%%%%%%%%机械臂建模
gst0=gab_Rp(eye(3,3),[0;3;0]);
w1=[0;0;1];w2=[0;1;0];w3=[-1;0;0];w4=[-1;0;0];w5=[-1;0;0];w6=[0;1;0];
wq123=[0;0;0];wq4=[0;1;0];wq56=[0;2;0];
%%%%%%%%%正运动学
for_theta=[pi/4;pi/4;pi/4;pi/4;pi/4;pi/4]'
fg1=twist2ga... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% classMitglo includes all proprieties and methods specific for the apical
% dendrite of mitral cells. Mitral cells are divided in two compartments
%
% Licurgo de Almeida
% 04/19/2013
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function CIDETDtable = scoreMixedMode(varargin)
%SCOREMIXEDMODE: Calculate new score for alternative fragmentation mode
%
% Syntax:
% newscoretable = scoreMixedMode(scorecsvfilename,option);
% newscoretable = scoreMixedMode(scorecsvfilename);
%
% Input:
% scorecsvfilename: score csv file name containing decoy glyc... |
for rep = 1:5
[data,networkcell] = createData();
trueA = cell(10,1);
for t = 1:5
trueA{t} = triu(double(abs(networkcell{1})>0),1);
end
for t = 6:10
trueA{t} = triu(double(abs(networkcell{2})>0),1);
end
T = length(data);
A = cell(T,1);
errors = zeros(20,T);
for t = 1:T
trueA_t{1} = trueA{1};
data_t{1}... |
function [ output ] = main_branch(branches,objective_function,not)
[m,n]=size(branches);
if objective_function==1
for i=1:not
for j=1:m
if branches(j,n-2)==i
s=j;
break;
end
end
k=s;
for j=s+1:m
if (branc... |
% Luke Schwenke - Problem Set #1 - 9/7/18
clear all
%% Problem 1
w = 5;
x = sqrt(2);
y = 4^3;
z = randi([1 20],1,1) %random int
a = x * y * z;
b = (w+y) / (x+z);
%% Problem 2
g = 1+rand(1,1)*(100-1) %random number
if g > 50
g = g / 2;
end
if g >= 50
g = g * 2;
end
%% Problem 3
x = 10;
while x > 0
x =... |
% Midpoint method
function [ys] = midpoint(f, a, b, hs, y0)
% TODO: Remove the following line and fill in the correct code.
for j=1:length(hs)
h = hs(j);
x = a:h:b;
n = length(x);
y = zeros(1,n);
y(1) = y0;
for i=1:(n-1)
ym=y(i)+f(x(i),y(i))*h/2;
xm=x(i)+h/2;
slope = f(xm,ym);
... |
function K = computeKernel_cov(X1,varargin)
%COMPUTKERNEL: projected kernel between covariance terms
% K{i,j} = inner_product(X1{i},X2{j})
MIN_THRESH = 1e-6;
same_flag = false;
if (nargin < 2)
% X2 = X1;
same_flag = true;
numpoints1 = size(X1,2);
numpoints2 = numpoints1;
else
X2 =... |
function [X, NormalizedSamples]= Pej_Normalize_Columns_Robust(X,Offset )
F = sum(X>1,2)>(size(X,2)/2);
XL = log(X(F,:));
NormalizedSamples = sum(isfinite(XL))>(.75*size(XL,1)); % Only include samples that have over 75% of the expressed genes expressed in them!
XL = XL(:,NormalizedSamples);
ref = median(XL,2);
Xd = XL ... |
function [Pb Deltak] = single_trial_backwards(Pf, Pd, bo, W)
% the backwards, posterior probability distribution
Pb = zeros(size(Pf));
n = nbins(bo);
N = size(Pf,2); % number of time steps
Deltak.gamma = zeros(1,N);
Deltak.phi = zeros(1,N);
Deltak.sigma2 = zeros(1,N);
Deltak.B = zeros(1,N);
Pb(:,end) = Pd;... |
function observe= observe(a,b,c,d)
surf(a,b,c);
%contourf(c);
end |
% relperm and capillary pressure curves
% to be used with FVTool package
% Written by Ali A. Eftekhari
% This is what this function does:
% res=zeros(size(sw));
% for i=1:numel(sw)
% if swc(i)<=sw(i) && sw(i)<=1-sor(i)
% res(i)=kro0(i)*((1-sw(i)-sor(i))/(1-sor(i)-swc(i)))^no(i);
% elseif 0.0<sw(i) && sw(i)<sw... |
function waw_drw()
%WAW_DRW - Draw a series of type curves of the WAW model
%
% Syntax: waw_drw()
%
% Description:
% Draw a series of type curves of Warren and Root (1963)
% with well bore storage effect
%
% See also: waw_dim, waw_dls
%%% Type curves for different sigma
lambda=0.1;
cd=0.1;
t=logspace(-4,7,200);
... |
clear all;
close all;
% this is the pillar position (position of sensors that are located exactly at the pillars)
% starting from pillar 0
% the hypothesis from professor Guéguen is that captors are spaced
% unifromly between pillars.
% there is generally two captors between two pillars apart from the captors
... |
%Redesign of MFBF
semilogx(F,CH2+40)
grid on
xlabel('Frequency [Hz]')
ylabel('Gain [dB]')
ax = gca
ax.XTick = [100 1000 10000 100000 1000000];
ax.XTickLabel = {'100' '1k' '10k' '100k' '1M'}; |
function writeHeader(packetDims, blockDims, numBins, rCounts, mvCounts, outfile)
fid = fopen(outfile, 'wb');
% Frame Packet Dimensions
fwrite(fid, packetDims(1), 'uint16');
fwrite(fid, packetDims(2), 'uint16');
fwrite(fid, packetDims(3), 'uint8');
% Search Block Dimensions
fwrite(fid, blockDims(1), 'uint8');
fwrite(... |
function n = normal_dir_timing3(jt,b_x,b_y,b_z,x,y,z)
px = zeros(3,1);
py = zeros(3,1);
pz = zeros(3,1);
t = zeros(3,1);
figure; hold on;
for i = 1:3;
x_comp = x(:,i);
y_comp = y(:,i);
z_comp = z(:,i);
bx... |
function Y = nn_SpatialDivisiveNormalization(X, kernel_arg, threshold)
if ~isa(X, 'float')
X = single(X);
end
if nargin < 2
kernel_arg = 7;
end
if nargin < 3
threshold = 0.4;
end
if isscalar(kernel_arg)
kernel_size = kernel_arg;
k_x = i... |
# Calculate MTBF Related info
# Variables maintain info in hours
# v20161018_2008, HanishKVC
#
disp("INFO: Enter all time in hours")
function print_times(msg, timeInHours)
printf(msg)
timeInDays = timeInHours/24;
timeInYears = timeInHours/(24*365);
printf("\n\t In Hours = %d\n\t In Days = %d \n\t In Years = %... |
function file_name = get_file_name(trial_counter, expnum)
% returns new and unique file name
file_name = strcat(sprintf('./exp%s/mnist_cnn_exp%s_trial_%d_', expnum, expnum, trial_counter),...
datestr(now, 'yyyy_mm_dd_HH_MM_SS_FFF'), '.csv');
|
function img = hough_detect(img)
step_r = 1; step_angle = 0.1; minr = 30; maxr = 45; thresh = 0.51;
[HoughSpace, HoughCircle, TempPara] = hough_circle(img, step_r, step_angle, minr, maxr, thresh);
subplot(1, 3, 1), imshow(img), title('边缘');
subplot(1, 3, 2), imshow(HoughCircle), title('检测... |
clc, clear all
setNum = 16;
imNum = 1;
liNum = 0;
peakThresholdDog = 6.5;
peakThresholdHarris = 10^4;
matchCache = 1;
desSave = 1;
% 'vl',{'method','MultiscaleHarris','peakthreshold',peakThresholdHarris}, ...
% 'vl',{'method','dog','peakthreshold',peakThresholdDog,'cache',1}, ...
% method = methodStruct( ...... |
clear; clc; close all; % 清除变量/命令行窗口/所有图像
% 测试isMonge函数
wiki_monge = [10,17,13,28,23;17,22,16,29,23;24,28,22,34,24;11,13,6,17,7;45,44,32,37,23;36,33,19,21,6;75,66,51,53,34];
wiki_flag = isMonge(wiki_monge);
fprintf('维基百科的Monge矩阵算例测试结果为:%d\n',wiki_flag);
% 测试genMonge函数
% 测试不同大小的算例
m = 50:50:500;
n = round(repmat(m,3,1).... |
function fSweep()
global port plotBuffer readSamples channels drawCounter sampleSize recording
try
fclose(port)
catch
end
close all;
pause(10);
sampleSize = 1;
plotSamples = 2500;
readSamples = 42;
channels = 3;
sampleRate = 1.25; % kHz
scale = 1.15;
recording... |
%限定感知度求最快完成时间
global D C W T
load('data.mat')
D = d; C = c; W = w;
n = size(D,1) + size(C,1) - 1;
YY = [];
for T = 46500:300:49500
options = optimoptions('ga','PopulationSize',100,'MaxGenerations',100);%,'MaxStallGenerations',100);
[x,y] = ga(@f21,n,[],[],[],[],zeros(1,n),ones(1,n),[],options);
YY = [Y... |
%
% created by Christian A. Schroth, 29. June 2020
%
% "Real Elliptically Skewed Distributions and Their Application to Robust Cluster Analysis"
% Christian A. Schroth and Michael Muma, Signal Processing Group, Technische Universität Darmstadt
% submitted to IEEE Transactions on Signal Processing
close all
clear all
... |
function zeroaxes(ax)
% % function zeroaxes()
% %
% % Put axes lower limit to zero
% % ax is string arg 'x', 'y', or 'xy' (or 'yx')
if ~nargin
ax = 'xy';
end;
if findstr('x', ax)
xlim = get(gca,'XLim');
xlim(1) = 0;
set(gca,'XLim',xlim);
end;
if findstr('y',ax)
ylim = get(gca,'YLim');
ylim(1) = 0;
set(gca,'... |
function template=GetNeighborhoodWindow(pixel,image,ws)
pixel=pixel-floor(ws/2);
template=zeros(ws,ws);
index=floor(ws/2);
padded_image = padarray(image,[floor(ws/2) floor(ws/2)] );
template=double(padded_image( pixel(1,1)+index : (pixel(1,1)+index+ws-1) , pixel(1,2)+index : (pixel(1,2)+index+ws-1)) );
return;
|
function att4marker( fid, address, size )
% fid : file id
% address : marker image address ('http://i1.daumcdn.net/localimg/localimages/07/mapapidoc/markerStar.png')
% size : marker size [x y] ([20 20])
fprintf(fid, 'var imageSrc = "%s"; \n', address);
fprintf(fid, 'for (var i = 0; i < positions.length; i ++) { \n');... |
function [fn, FnVar, FnGrad, FnGradCov, constraint, ConstraintCov, ConstraintGrad, ConstraintGradCov] = SAN(x, runlength, problemRng, seed)
% INPUTS
% x: a column vector equaling the decision variables theta
% runlength: the number of longest paths to simulate
% problemRng: a cell array of RNG streams for the simulati... |
function s = readsen2(sens_filename)
% function sens = readsen2(sensor_filename)
%
% for use with C version of tagread2, to read the sensor data from
% DTAG V1.1
%
% sens = [time pagenum ax ay az aa magx magy magz temp pres batt
% 1 2 3 4 5 6 7 8 9 10 11 12
% extin mbridge p... |
function run_filtru3(text1,text2,nrmin,nrmax,pas,ext_fis,fr,deltafr, frmaxfil,opt, fgr)
%
% run_ps_dls5(text1,text2,nrmin,nrmax, pas,frecvachiz,nr1,nr2,tip,opt)
%
% functia citeste fisierele scrise slicer
% calculeaza fisierul cu frecventa si amplitudinea puterii si screi
% fisierul cu extensia fps
% fisier care... |
%% define catheter 3D rotation (about x-axis)
bend_arr = [0.000001,deg_inc:deg_inc:90];% array of values for the varying parameter
roll_arr = 0:deg_inc:75; % array of the "roll" rotation (deg)
pitch_arr = pitch_range(1):deg_inc:pitch_range(end);% array of the "pitch" rotation (deg)
%% define catheter
L = 105; ... |
function [X] = slow_dst(x)
% Computes the discrete sine transform of vector x directly from the definition
if x(1) ~= 0
error('Vector must begin with 0');
end
N = length(x);
theta = pi/N;
W = zeros(N,N);
for i = 2:N
for j = 2:i
W(i,j) = sin(theta*((i-1)*(j... |
function flag=criterion_2(rif,temp)
%this function computes the second criterion described in Consigli (2013)
if(var(rif)>=var(temp))
flag=1;
else
flag=0;
end
end
|
function batch_set_complete = batchsetDPE128x64(serDPE, batch_set_parameter1, batch_set_parameter2, batch_set_parameter3)
% Batch reset operations for the DPEfor 128x64 array.
% The only difference in this function is one extra bit as bottom flag to
% indicate the function is handling top 64x64 or bottom 64x64 part of ... |
classdef PlotP2 < matlab.mixin.Copyable
%PlotP2 Plots a P2 Triangulated surface
% Detailed explanation goes here
properties
light
patch
edge
end
properties (Hidden)
X
tri
CData
xnod
ynod
znod
end
properties (... |
x = linspace(0,6);
y1 = x.^3 -8*x.^2 + 6*x + 6;
y2 = 0;
plot(x,y1,'-r')
hold on
plot(x,y2,'xb')
axis([0,2,-8,8]);
grid on
box on
legend('y1 = x.^3 -8*x.^2 + 6*x + 6','y2 = 0')
xlabel ('x-axis')
ylabel ('y-axis')
title('Graphical representation of f(x)')
idx = find(y1-y2 < eps,1);
px = x(idx);
py = y1(idx);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.