text stringlengths 8 6.12M |
|---|
function trees = CREATE_TREES(examples,attributes,binary_targets)
% trees = CREATE_TREES(examples,attributes,binary_targets)
% Function that creates and trains the six trees.
% INPUT : examples - matrix containing the train data.
% attrubutes - vector containing the attributes of the data
% ... |
function [las] = refine_power_lines(las, res, numPeaks, fillGap, minLength)
% this method uses removes small regions classified as power lines
% which do not fall on large linear features across the tile.
% the power line points are isolated and used to generate a raster.
% The hough, houghpeaks, and houghlines meth... |
% time_stamp_end = 1231
% find(Ekin_outputG(:,1)<60*1e3)
Bavg=3.6;
% %
P1=1+32;
P2=2+32;
P5=3+32;
P6=4+32;
% vperp_sq_outputG=vDsq_outputG;
% Bfield_part_outputG=interp2(scale_X,scale_Z,Btot_XZ_map',Xpos_outputG,Zpos_outputG,'*linear');
mm_outputG=Eperp_outputG./Bfield_outputG;
lambda_outputG=Bavg*mm_outputG./Ekin_... |
function y = blk_reactor_BaCl2_NH3_no_walls_fun1(x)
% Get pair and binder properties:
pair = get_material_properties(x.pairName);
binder = get_material_properties(x.binderName);
% Salt mass (kg)
y.m_salt_kg = x.N_salt * pair.M_salt;
% Binder mass (kg):
y.m_binder_kg = x.N_binder * binder.M;
% Composite ... |
clear;
parameter_initialization;
volume_ratio=.5;
o_p_energy=c_os*((1-volume_ratio)*c_d0-volume_ratio*c_f0+(2*volume_ratio-1)*sqrt(c_d0*c_f0));
o_p_power=.5*c_os*(c_d0-c_f0);
%delta_h_p=o_p_power;
delta_h_p=2;
delta_v_max1=1-c_f0./(c_d0-delta_h_p./(c_os));%the condition that c_f=c_d0-delta_h_p at the entrance of the ... |
function printsrcline(fid,card,line)
LINELENGTH=80; % Max längd på rad i sourcefilen
c=1;
for m=1:size(line,2)
if c>LINELENGTH & strcmp(line(1,m-1),',')
space1=char(ones(1,(6-size(card,2)))*32);
cont=[card,space1,'*',' '];
fprintf(fid,'\n%s',cont);
c=1;
end
if c>1 & m>1 & strcmp(line(1,m-1),',')
fpri... |
%Face Detection
FDetect=vision.CascadeObjectDetector;
I= imread(filename);
BB=step(FDetect,I);
figure,
imshow(I); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
end
title('Face Detection');
hold off;
|
function val = posRect(val)
val(val<0)=0;
%output=zeros(size(val));
% for i=1:length(val)
%
% if val(i) > 0
% output(i) = val(i);
% else
% output(i) = 0;
% end
%
% end
end |
%%
% clear;
%% parameters
aoa = 15/180.*pi;
k=pi/2;
Amp = 0.5;
forcefilename='force.dat';
%% dependent parameters
Fref = 0.5;
Stime = 0;
Tper = pi/k;
mode = 1;
StA = k*Amp/pi
%% load data
% clc;
close all;
setPlotParameters;
nskip = 5;
nvars = 7;
file = loadequispacedtimeseries(forcefilename, nskip, nvars);
Npts = roun... |
function [xopt] = newton( x,epsiloni,D,WI1,WI2,N,t )
%define parameters
theta = 1;
alpha = 0.1748;
beta = 0.98;
delta = 0.2;
%initial values of gradient and hessian at x
[y1,y2] = dfx( x,D,WI1,WI2,N,t,delta );
deltx = -inv(y2) * y1;
omegasq = -y1.' * deltx;
% newton's method to find optimal x with specific t
whi... |
%% Loop example
% Created by: Lee A. Harrison
% On: 8/5/2018
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of Artech House.
clear, clc
% The operating frequency... |
load testdata datax xy
fig=figure;
plot(datax(:,1),datax(:,2),'o')
hold on
error_ellipse(cov(datax),mean(datax),'conf',0.95);
plot(xy(1),xy(2),'*r');
plot(0.8182,0.066,'*');
dcm_obj = datacursormode(fig);
set(dcm_obj,'UpdateFcn',{@myupdatefcn,datax})
%%
% this should return FALSE
i_95pct_error_ellipse(datax,xy,0.9... |
classdef GlycanLinkage <handle
%GlycanLinkage class representing a linkage between two monosaccharide residues.
%
% A GlycanLinkage object is a generic representation of glycan linkage
% information. It consists of two glycan monosaccharide residues
% (parent and child), and the glycosidic bonds.
%
% GlycanLinkage ... |
function [ FoS_incTorsion, FoSUlt_incTorsion, FoSSkin, FoSSkin_curv, FoSir, FoScr, FoScripPure, FoScripAdjusted, FoSStringer ] = analysisTotal( LOAD_FACTOR, SAVE_DATA )
% function to solve an idealised 3 cell wing in combination of shear and moment
% Author: Declan Walsh
% For AERO3410 wing analysis assignment
% all a... |
function euclid_dist = find_euclid_dist(all_features, all_average, k)
%% DOCUMENTATION
% FUNCTION CALCULATES THE EUCLIDEAN DISTANCE BETWEEN A
% GIVEN SET OF FEATURE VECTORS AND THE AVERAGE CLASS VECTORS
% FOR USE WITH KMEANS FUNCTIONS
% MADE BY: DANIEL SHERMAN
% MARCH 30, 2020
%% START OF CODE
[block_n... |
%% This is the unit test for visual quality measure function
sourceVideo = VideoReader('./testVideoSegs/testSeg1.avi');
% Convert the video file into a cell array
index = 1;
while hasFrame(sourceVideo)
tempFrame = readFrame(sourceVideo);
Seg{index} = tempFrame;
index = index + 1;
end
visualQualityMeasure =... |
function result = perfectNumberNearest(N)
smallestPerfectRoot = 11826;
largestPerfectRoot = 30384;
currentBest = -1;
if (abs(smallestPerfectRoot ^ 2 - N) < abs(largestPerfectRoot^2 - N))
currentBest = smallestPerfectRoot;
else
currentBest = largestPerfectRoot;
endif
currentDiff = ab... |
clc; % nao limpar os dados!
% Tratamento de dados
array = table2array(table);
h = figure('Name', 'Dados Recebidos');
plot(array(:,1), array(:,2));
title('Sinal de saída');
xlabel('$t$','Interpreter','LaTex','FontSize',16);
ylabel('$V_{OUT}$ (V)','Interpreter','LaTex','FontSize',16);
% saveas(h, 'Sinal_IN.png');
es... |
function model = sgdUpdateUser(gradX, gradMean, userid, model, opt)
%SGDUPDATEUSER model = sgdUpdateUser(gradX, gradMean, userid, model, opt)
% Update the latent parameters of the user with given userid. This is
% called for a single SGD update.
%
% INPUT
% - gradX : structure containing gradients corresponding t... |
%Comunicações Digitais - Simulação 1 - 1/2017
%
%
%
%Alunos:
%
%
%
%Gera a sequência de 100000 + 2 bits aleatórios:
bits = randi([0, 1], 1,1E5 + 2);
it = 20; %qtde de iterações
receivedSymbols = [];
Eb = 1;
Eb_N0_db = zeros(1, it); %Eb/N0 em dB
ber = zeros(1, it);
for i=1:lengt... |
function server_send_waypoints(waypoints)
[message] = server_pack_waypoints(waypoints);
for i = 1:40:length(message)
msgToSend = strcat(message{i:min(i+40,length(message))});
judp('SEND',4000,'192.168.1.255',int8(msgToSend));
end
end |
function [non_res_metric, res_metric, pt_metric] = test_EZ(adj_matrices,resected_elecs,metric_type)
% calculate number of patients
num_patients = length(adj_matrices);
% loop through patients
for pt = 1:num_patients
% extract resected electrode indices
pt_res_elecs = r... |
function y_next = eulero_avanti(f, ti, yi, h)
% INPUT
% f:= funzione
% ti:= punto di rete precedente utilizzato
% yi:= punto della funzione approssimato precedentemente
% h:= passo
y_next = yi + h*f(ti,yi);
return;
end
|
function deg = ang_btw_vec(a,b)
deg = rad2deg(atan2(norm(cross(a,b)), dot(a,b)));
end
|
function x = per(x, n)
%PER Periodic indexing.
% Y = PER(X,N) returns the 1-based index of a subscript vector
% X=(X(1)..X(D)) in a periodic grid of size N=(N(1)..N(D)). That is, 1 <=
% Y(i) <= N(i) for all i = 1..LENGTH(X). If X is an MxD matrix, then Y is
% an MxD matrix whose rows are the periodic indic... |
clc; clear; close all;
pkg load image;
A=imread('peppers.jpg');
subplot(2,2,1);
imshow(A);
title('Imagen original');
%Forma 1 de calcular el histograma
h1 = zeros(256,1); %Entradas ==> h1(0),...,h(256)
[m,n] = size(A);
for x=1:m
for y=1:n
h1(A(x,y)+1) += 1;
end
end
subplot(2,2,2);
bar(0:2... |
function g = NoteOfVPS2DepritLie(Wn1,n)
% function g = NoteOfVPS2DepritLie(Wn1,n)
% g = u(1:2*OSIP.CanonicalDimensions)*(-S)*Wn1/(n+1).
% It is used for the calculation of VPS2DepritLie.
% Ref. "The Use of Lie Algebra Methods to Analyze and Design Accelerator Beamlines"
% Author: Yiton T. Yan, SLAC
% Section. 3.6.2
%--... |
currentFolder = pwd;
rootfolder_path = strcat(currentFolder,'\processed_images\');
rootfolder = dir(rootfolder_path);
output_folder = "";
for p = 3:length(rootfolder)
sequence_folders = rootfolder(p);
folder_path = strcat(sequence_folders.folder,'\');
folder_path = strcat(folder_path,sequence_folders.name)... |
function [ distribution ] = softmaxDistribution( vector )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
distribution = exp(vector) / sum(exp(vector));
end
|
function [octree,next_free_offset]=generateOctree2(scene,objects,octree,level,offset,child_offset,aabb)
% Generate a sparse loose octree, with specified maximum number of
% levels.
% Scene contains: .aabb, .max_levels, .max_occupants
% aabb is scene bounds.
% Level is current level in octree.
% Offset is offset of cur... |
% clear variables
clear;
x = [0 0 1 1; 0 1 0 1];
t = [0 1 1 1];
net = perceptron;
net = train(net,x,t);
view(net)
y = net(x); |
function shollHist = sholl(state, step)
% INPUT: savedata.state{time}, step <-- radius increment
% OUTPUT: shollHist(m) = total branch length found in the spherical shell
% with inner radius step*(m-1) and outer radius = step*(m)
branch = state.tree; %just to simplify naming
scale = [state.info.xres;state.info.yres;... |
grdth = importdata('KeyFrameTrajectory.txt');
thredis = 1.6;
thresmch = 30;
input_a = importdata('surf64_lab_real.txt');
r1_a = 0;
for la = input_a'
r1_a = r1_a + 1;
if(la(5,1) > 80)
break;
end
end
r3_a = 0;
for la = input_a'
r3_a = r3_a + 1;
if(la(5,1) > 395)
break;
... |
function [ Area ] = AQ(func,left_x, right_x, error)
%% Recursive Adaptive Quadrature Function
% Applies the adaptive quadrature recursive strategy until
% the error threshold is reached
%%
% Use a conservative error reduction of a factor of 10
threshold = 10;
%%
% Calculate mi... |
function atomov2
masc=[0 1 2 3 4];
art=1;
c=get(gcf,'UserData');
rob=c{2};
datos=c{3};
pos=get(gca,'UserData');
tt=get(gcf,'UserData');
activo=tt{1};
if isempty(pos.objetivo)
data
pos=get(gca,'UserData');
if isempty(pos.objetivo)
return
end
end
if isa(pos.red.base,'network')&isa(... |
function convert_F_to_p(session_dir,subject_name,runNums,func,thresh,SUBJECTS_DIR)
% Converts the fstat1.nii.gz volume to pval.nii.gz in feat/stats directory.
% Also saves a pval.mask.nii.gz volume, where pval.nii.z < thresh = 1.
%
% Outputs are also projected to anatomical space, specified by
% 'subject_name'
%
%... |
%% Autoregressive Conditional Mean, Variance and Kurtosis
% Allows the estimation of the Autoregressive Conditional Kurtosis Model
% presented in Brooks, C., Burke, S., P., and Persand, G., (2005),
% "Autoregressive Conditional Kurtosis Model", Journal of Financial
% Econometrics, 3(3),339-421.
%
%% *_Mean Mode... |
function alpha = psi2alpha(psi)
alpha = (pi - psi)/2;
end |
function d = dprime(h,f)
% d = dprime(h,f)
%
% h - proportion of true positives
% f - proportion of false positives
%
% Reference:
% Coombs, Dawes & Tversky (1970) Mathematical Psychology
% Macmillan & Creelman (1991) Detection Theory: A User's Guide
%
% ___________________________________________________
% Copyri... |
clear all ; close all
subs = {'alex','dina','genevieve','jeremie','russell','valerie','tegan'} ;
comps = {[30,26],[32,23],[21,28],[47,46],[19,37],[47,38],[44,46]} ; % all subjects, right and left
fcomps = {[64,80,12],[41,31,40],[61,48,15],[6,84,79],[79,80,50],[75,77,41],[48,50]} ;
for sub=1:length(subs)
... |
function values = atgetfieldvalues(ring,varargin)
%ATGETFIELDVALUES retrieves the field values AT cell array of elements
%
% VALUES = ATGETFIELDVALUES(RING,'field') extracts the values of
% the field 'field' in all the elements of RING
%
% VALUES = ATGETFIELDVALUES(RING,INDEX,'field') extracts the values of
% the field... |
function Orbit = GetOrbit(Constant)
% 第三天体
% GEO想定
%% 初期設定
Orbit.name = 'Orbit';
Orbit.Geo.H = 35786000; % 基準軌道高度h_ref (GEO) [m]
Orbit.Geo.Omega = CalcOmega(Orbit.Geo.H, Constant); % 基準高度角速度 (GEO) [rad/s]
Orbit.Geo.T = 2*pi / Orbit.Geo.Omega; % 基準軌道周期 (GEO) [s]
Orbit.Geo.R =... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Wenjun Liu
% Date: 03/12/2020
%
% Matrix Inequalities Based Robust Model Predictive Control for Vehicle Considering
% Model Uncertainties, External Disturbances
%
% Installation package to be installed---yalmip,penlab
%%%%%%... |
% FPMat Interface
% Example of Elevation plot data
% Read Elevation plot data.
% The data has been generated in FlexPDE
% by running Example01.PDE
fpreade('TempE.flx');
fpreade('TempE2.flx');
|
function f_plot_PS(X,A,lod,log)
% - plot 'otolith profile' data collected as a series of spots
%
% USAGE: f_plot_PS(X,A,LOD,log)
%
% X = structure of 'otolith spot profile' data created by f_cps2ppm_PS
% A = cell array specifying which analytes in X to plot; if empty all are potted
% e.g., A = {'Li7' 'Sr88' '... |
function maxFrequencies = PlotAllImages(patientnr, nightnr, freq, description)
% plots all jpg figures given a connectivity struct, chanlocs and frequency
% in the patient's folder
% freq = array of hz vals like [8 8.1 8.2 8.3 ... 9.8]
[matrices, maxFrequencies] = AggregateMaxFreqMatrix(patientnr, ... |
function z_stance = impact_map(z_flight,p)
x = A_c(z_flight,p)\[A(z_flight,p)*z_flight(6:end);zeros(2,1)];
z_stance = z_flight;
z_stance(6:end) = x(1:5);
% F_c = x(length(z_flight)+1:end); % the impulse
end |
function coeff = getLWDFcoefficients(P);
% This function computes the adaptor coefficients for a LWDF given the poles.
N = length(P);
coeff = zeros(1, N);
% Find the phase angles
arg = abs(angle(P));
% Start with the real pole
id = find(~arg);
if length(id) ~= 1
error('There should be ONE real pole');
end
coeff(... |
% Given: Node,Edge,Face
% asembling of the time-dependent body force, per timestep
function [rhs_d,rhs_p] = Assembly_ElAd_quadrTH_Q2Q1_rhs(time,Node,...
Face_eorder9,Face_eorder4,...
Face_flag,Face_thick,Discoef,...
Gauss_p... |
% Dasslc test problem
% requires files: dydt.m
% global debug level
% 0 : no output
% 1 : write output values only
% 10 : write all results from m-files
% 100 : confirm exit from each m-file with <RETURN>
global DEBUG;
DEBUG = 1;
t0 = 0.0; % initial value for independent variable
tf = 1.0... |
function ds = addcolorchannel(ds, dat, dname)
% Adds a channel to the ds.colorch array
% dat should be an array: ntrain x 11 x 11 x 11 x 3
if(~isfield(ds, 'colorch'))
ds.colorch = zeros([0 ds.ntrain ds.sgdim 3]);
ds.colorchname = {};
end
ds.colorch(end+1,:,:,:,:,:) = shiftdim(dat, -1);
ds.colorchname{end+1} =... |
function planning_plot(p0,p5,i,lmin1,lmin2)
p1 = p0 + [lmin1*cos(p0(3)),lmin1*sin(p0(3)),0];
p2 = p1;
p4 = p5 - [lmin2*cos(p5(3)),lmin2*sin(p5(3)),0];
p3 = p4;
[p51_x, p51_y] = B5_C(p0,p1,p2,p3,p4,p5);
show(p0,p1,p2,p3,p4,p5,p51_x,p51_y,i);
end |
function docNode=addGeometryLevel_FEB2(docNode,FEB_struct)
%%
febio_spec = docNode.getDocumentElement;
disp('Adding Geometry level')
ElementAddNode = docNode.createElement('Geometry');
febio_spec.appendChild(ElementAddNode);
%% Adding node field
disp('----> Adding node field')
GEONode = docNode.getE... |
% drawRenyiDistsFromMakeTable
A = renyiTab(2:end-1,:);
nVars = size(A, 1);
%plot(A-repmat(min(A), size(A,1),1));
renNames = {'sqrt', 'rice', 'sturge', 'doane', 'scott','kernel'};
legend(renNames);
nRenNames = length(renNames);
sortedVars = A;
indeces = A;
for k = 1:nRenNames
[sortedVars(:,k) indeces(:,k)] = sor... |
function [Aout,Bout,Cout,Kout,fai1,Q0,W0]= interpotlation(A,B,C,K,fai,Q,W,C1,C2,Cave)
%ÄÚ²å
Aout = (Cave - C2)./(C1 - C2).*(A(1)-A(2))+A(2);
Bout = (Cave - C2)./(C1 - C2).*(B(1)-B(2))+B(2);
Cout = (Cave - C2)./(C1 - C2).*(C(1)-C(2))+C(2);
Kout = (Cave - C2)./(C1 - C2).*(K(1)-K(2))+K(2);
fai1 = (Cave - C2)./(C1 - ... |
function [atxOut] = ReadATX(filename)
%% ReadATX
% Parse IGS antenna phase center offset/variation file (.atx)
%
% Required Inputs:
% filename - location and filename of the .atx file
%
% Outputs
% atxOut - structure containing antenna phase center offset
% information
... |
function L = isinf(x)
%PREAL/ISINF Overloaded ISINF function for class preal.
L=isinf(double(x)); |
clear all;
clc;
collect_pq = [];
%% Asking the euler angle input from User
prompt = 'Enter your file name having orientation of grain in apostrophe(''myfile.txt''):-';
name_of_file = input(prompt);
all_euler = dlmread(name_of_file);
for counter16 = 1:1:size(all_euler,1)
euler_angle = all_euler(counter16,:);
... |
%% Script for fitting a gaussian to a signal
% Edit this script to produce a decent fit
clear;
clc;
clf;
%% Load the data in - you can save variables using the 'save' command,
% then read them in using the 'load' command. Very similar to dlmread
% and dlmwrite, but for any matlab variable
dataLoaded = load('signa... |
%%soundplots
%Function to chart soundings for a specific date, given a
%sounding data structure such as that created by IGRAimpf.
%
%General form: [foundit] = soundplots(y,m,d,t,sounding)
%
%Output:
%foundit: index of the sounding with the datenumber requested
%generates a skew-T, a zT ... |
%%% 基于多阶数据项与全局稀疏性先验去条带算法
%%% 注: 算法均对水平条带进行处理
%%% 求解 u 时利用 FFT
function u = TVdestripe(f,I,belta,lamda,omega1,MaxIter)
[N1,N2] = size(f);
%%% 初始化 %%%
u = f; % 给解赋初值
g = f; % 观测值
k = 0;
Tol = 1e-5; %%% 迭代容许误差
StopFlag = 0;
Psiy = 0;
Psix2 = 0;
by = 0;
bx2 = 0;
[M,N] = size(f);
ep = 1e-6;
%%% compute fixed quantities
[... |
function [input_points] = obtaininputslarge(checkerboard_points)
p1 = [checkerboard_points(1,14) checkerboard_points(2,14)];
p2 = [checkerboard_points(1,17) checkerboard_points(2,17)];
p3 = [checkerboard_points(1,32) checkerboard_points(2,32)];
p4 = [checkerboard_points(1,35) checkerboard_points(2,35)];
input_points = ... |
function [G] = getGraphData(param, G_old)
% generate adjacency matrix
n = param.n;
if isempty(G_old)
A = sprand(n,n,0.1);
A = A+A';
A = A-diag(sparse(diag(A)));
G = graph(A);
else
Go = G_old.laplacian;
%G = G_old;
Go(Go<0.01*rand) = 0;
A = Go+sprand(n,n,0.01);
A = A+... |
function [out, q] = quantize(cmd, fs, N)
%%% input
% N: 量化bit
% infile: 输入声音信号
%%% output
% out: 量化后的信号,0:2^N-1
q = (1-(-1))/2^N;
out = floor((cmd+1)/q);
% 量化和原始信号对比
len = length(cmd);
ts = (0:len-1)/fs;
figure;
plot(ts, cmd, 'b');
hold on;
restore = q*out-1;
plot(ts, restore, 'r');
title('原始语音信号'... |
function [ min_orbit, start_idx, file_num, orbit_energy ] = minimum_orbit( ...
power_mat_file_1, power_mat_file_2, orbital_period, dt )
%minimum_orbit Calculates the orbit which collects the least energy from the
%power vector in the power_mat_file
orbit_steps = floor(orbital_period / dt);
power_1 = load_power_dat... |
function [ke]=keefe(Pk,kr,vh,w)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Last changed : 28-5-2015
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% version : 5
%%%%%%%%%... |
function [ obs ] = generate_obs_cont( T, pi, a, miu, sigma, c )
% miu1 = mean for first component (2-dim)
% miu2 = mean for second compunent (2-dim)
% sigma1 = covariance for first component (2-dim)
% sigma2 = covariance for second component (2-dim)
% c = probability for components of mixture
% ex:
% sigma = [... |
function [T]=fixz(M,C)
%out=fixz(Matrix,confine)
%
%confine is nonzero positive Integer number
%these function set amount all element of a matrix to zero if respective
%array is -confine=<M(i,j)<=confine
%
%for example: confine=5 produce precision 0.00001
%and all array input Matrix check ==> -0.00001=<M(i,j)... |
function [alp_returnvalue, uservar] = projinquire(obj, deviceid, inquiretype)
% Inquires system parameters of an ALP system
%
% See also:
% projcontrol
%
% File information:
% version 1.0 (feb 2014)
% (c) Martin Vogel
% email: matlab@martin-vogel.info
%
% ... |
function [dxi,stop_condition,energy] = weighted_bearing_consensus_using_RSS_and_DOA(L,xi)
% This function implements the Weighted Bearings Consensus Controller using Received Signal Strenght (RSS)
% and the Direction of Arrival (DOA) of the RSS measurements from wireless network devices (e.g. Wi-F)
% as the (noisy) c... |
%% Theis solution for Multiple rate tests.
% This demonstrates the interpretation of the drawdown at time t
% for multiple rate tests without accounting for quadratic head losses
% with the Theis (1935) solution
%
% MIT License
% Copyright (c) 2017 Philippe Renard - University of Neuchâtel (CHYN)
%%
% The data set fo... |
function [J, grad] = costFunctionReg(theta, X, y, lambda)
%COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
% J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
% theta as the parameter for regularized logistic regression and the
% gradient of the cost w.r.t. ... |
function synthesizedRFParams = synthesizeRetinalRFparamsConsistentWithVisualRFparams(obj, ...
rfCenterInputConesNum, rfCenterPositionMicrons, deconvolutionOpticsParams)
% Returns a struct with corresponding retinal <-> visual parameter of
% center/surround characteristic radii & peak sensitivities. These
% are comp... |
function [ alps ] = ME246_HW2_Kankaria_Yash( Tr, Tp )
Tavg=(Tr+Tp)/2;
%cp of each reactant and product;
%to find cp of nitrogen
anit=28.9;
bnit=-0.1571*10^-2;
cnit=0.8081*10^-5;
dnit=-2.873*10^-9;
%to find cp of oxygen
aoxy=25.48;
boxy=1.520*10^-2;
coxy=0.7155*10^-5;
doxy=1.312*10^-9;
%to find cp of hydrogen
ahyd=29.... |
%1.-----------二值化-----------------%
I=imread('lv0 - relax.bmp'); %读取初始图片
binaryzationGraph = ostu(I);
figure; imshow(binaryzationGraph); title('Ostu二值化后结果');
binaryzationGraph = (binaryzationGraph > 0) * 255;
%------------------------------------%
%%-----------------进行图像的旋转---------------------%
% ang = 180;
[x,y]=hou... |
clear all;
close all;
%% File loading and data processing
HEIGHT = 1.75;
Dsize = 200;
DTW_threshold = 100;
filename = 'test3.csv';
filename1 = 'kalman_test3.csv';
filenameRT = 'sony_trousers.csv';
filenameRH = 'sony_hand.csv';
dataRT = csvread(filenameRT,1,0);
axRT = dataRT(1:Dsize,2);
ayRT = data... |
function res = R(jj, k, m)
% Calculates weight function
% for Nystrom method
global s;
ii = 1:m - 1;
r = cos(ii .* (s(k) - s(jj))) ./ ii;
res = - (1 + 2 * sum(r) + cos(m * (s(k) - s(jj))) / m) / (2 * m);
end
|
function generate_structure_images(dataset_path, output_path)
addpath('code');
image_list = dirPlus(dataset_path, 'FileFilter', '\.(jpg|png|tif)$');
num_image = numel(image_list);
for i=1:num_image
image_name = image_list{i};
image = im2double(imread(image_name));
S = tsmooth(image,... |
function createfigure(CData1, ZData1, YData1, XData1)
%CREATEFIGURE(CDATA1, ZDATA1, YDATA1, XDATA1)
% CDATA1: surface cdata
% ZDATA1: surface zdata
% YDATA1: surface ydata
% XDATA1: surface xdata
% Generated by JOHNMATLAB on 04-Oct-2016 21:23:00
% Create figure
figure1 = figure;
% Create axes
a... |
%Function implements a Canny edge detector
%Usage: [gradImage, thetaImage] = gaussGrad(im, kernelSize, kernelSigma)
function [gradImage, thetaImage] = gaussGrad(im, kernelSize, kernelSigma)
im = double(im);
%Create the Gaussian kernel to use for edge detection
gaussKernel = fspecial('gaussian', kernelSiz... |
function [edge,good_paths] = FindEulerPathsHelper(G,u,target_size,good_paths)
%Recursively finds Euler path
%Recur for all the vertices adjacent to this vertex
edge = [];
neighborss = neighbors(G,u);
%Iterate through all neighboring nodes
for (i = 1:length(neighborss))
v = neighborss(i);
... |
function bioRadio_Start_fcn(~,event)
%% Globals Initialization
global bioRadioHandle isCollecting numDevices;
%%
txt1 = ' event occurred at ';
%% Bio Radio Connection
dllPath = 'BioRadio';
configPath = 'C:\Users\spk4422\Desktop\Testing\Stimulus\ConfigFiles\EMG.ini';
bioRadioHandle = BioRadio150_Load(dllPath,false,numDe... |
function [ outImage ] = salt_pepper_noise_cvip( inImage, noiseArgs, noiseImgSize)
% SALT_PEPPER_NOISE_CVIP - add speckle(Salt & Pepper) noise to an image.
% The function adds Salt & Pepper noise to an image or creates Salt &
% Pepper noise image.If user wants to add Salt & Pepper noise to the
% image, the user ne... |
function J_nk = obtain_jerk(Jx,Jy,N,K)
%obtain_jerk takes as inputs Jx and Jy for every Nth vehicle and Kth state
%and obtains the 2-norm so that it can be constrained as a euclidean ball in
%cvx. Jx and Jy are the jerk in a 2-D coordinate system.
J_nk = cvx(zeros(N,K)); %must use "cvx" since this passes an intermediat... |
function [query, class] = ir_perquery2(gt_quer, distance_mtx, gt_retr)
% distance_mtx : Distance of query from the rest of the datapoints
% Each row refers to one query
% ground_truth : A ground truth vector of categories (starting from 1)
%
% per_query is a stucture with following elements:
% m... |
classdef Status < int32
%%
% 生成したプログラムの実行結果を表す
enumeration
Succeeded(0) % t_lastまで計算できた
Failed(1) % 計算をはじめられなかった
% ・コマンドライン引数がおかしい
% ・出力用のファイルを開けなかった
Incomplete(2) % 途中までしか計算できなかった
end
end
|
function [] = createTraining_sim(T, numSeq, Nobs, Nhid, Dmax, A0, D0, A, D, O, ID)
loc = strcat('../libdai/examples/data/HSMMtraining_',num2str(ID),'.txt');
fidhsmm = fopen(loc, 'w');
loc = strcat('../libdai/examples/data/HMMtraining_',num2str(ID),'.txt');
fidhmm = fopen(loc, 'w');
fprintf(fidhsmm, '%d\n',numSeq);
... |
function boundariesPxInd = convertBoundariesToPxInd(boundaries, imgSize)
% check if each boundary is close to an edge or not
boundariesCat = cat(1, boundaries{:});
% look at all surrounding pixels: if at least one of them is an edge, we're good!
boundariesPxInd = unique(cat(1, ...
sub2ind(imgSize([1 2]), min(max(... |
function close(object)
if strcmpi(object.VISA.Status,'open')
fclose(object.VISA);
end
end |
% John Heath
% ACM 116 Problem Set 6
% Problem 5
clc; clear; close all;
N = 1000;
reps = 1000;
m = zeros(reps, 1);
% synthesize a lower triangular matrix of 0.1s, like I drew in the last
% page of the problem set.
T = tril(ones(N)) .* 0.1;
figure();
hold on;
for i = 1:reps
% draw the standard normal RVs in a vector... |
function [signalCalibrationOpen,signalVideo,signalPrzed,signalPo,signalICA] = readDataWithCalibration(path, it)
data = load(path);
[signal, time] = selectSignal(data);
signalPrzed = signal;
% figure()
% for el = 1:19
% subplot(5,4,el)
% plot(signal(el,:))
% end
%si... |
function [C,Cu,Cx] = OCP_C_Cu_Cx(u,x,p) %#codegen
[C,Cu,Cx] = OCP_GEN_C_Cu_Cx(u,x,p);
end |
function predicted = badacostApply(X, classfr)
% Apply learned badacost weak learners ensemble
%
% USAGE
% hs = badacostApply( X, model, [maxDepth], [minWeight], [nThreads] )
%
% INPUTS
% X - [FXN] N num vectors to classfy, F num feature vectors
% model - learned boosted tree classifier
%
% OUTPUTS
% ... |
% boolval = IsConsoleHidden(myobj)
%
% Determine if the console window is currently hidden or
% visible. Returns true if the console window is hidden,
% or false otherwise. The console window may be
% hidden/shown using the ConsoleHide() and ConsoleUnhid... |
% flatten - mode-k unfolding of a tensor
%
% Syntax
% Z=flatten(X,ind)
%
% See also
% flatten_adj
%
% Reference
% "Estimation of low-rank tensors via convex optimization"
% Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima
% arXiv:1010.0789
% http://arxiv.org/abs/1010.0789
%
% "Statistical Performance of Convex Tens... |
function [input_data_diff, layer_train] = FCBackward(input, output, layer, layer_train)
W = layer.W;
b = layer.b;
weight_decay = layer.weight_decay;
input_data = input.data;
output_data_diff = output.data_diff;
W_diff = output_data_diff * input_data' + W * weight_decay;
b_diff = sum(output_data_diff, 2);
layer_train.W_... |
function [ state, conv, flag, iter, message ] = fem_implicit_step_amalie(dt, mesh, state, params, bcon, profile, iter_max, abs_tol, rel_tol, dir_tol, stag_tol)
% Copyright 2011, Kenny Erleben
%--- Check if arguments are valid or assing defaults ----------------------
if (nargin < 6)
error('Not enough input arguments... |
function [spinImgs selIxs] = getDescriptorFile(fileDesc, ...
filePts, noOfSeedPoints, distance, ...
alfaBins, betaBins, alfaAxes, betaAxes)
%Wczytuje deskryptor z pliku.
%Jeśli plik nie istnieje to deskryptor jest tworzony zgodnie z parametrami
%po wczytaniu z pliku z danymi.
%Parametry:
% fileDesc - p... |
function SaveDataExcel( Data,Nsweeps,figname,Npoints,VectDataSheet,VectInfoSheet)
% Save the data as an Excel file.
% Each set of Data corresponding from one file will be put into one sheet
% The first sheet will contain the name of the files, as well as other
% relevant information, such as the Gain_AOP, the value... |
% The fixed point function for problem D
function y = problemD(x)
y = (21/x)^(1/2);
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.