text stringlengths 8 6.12M |
|---|
%% Filename: process_results.m
% Project: Matrix of firms via portoflio holdings
% Author: Jesse Blocher
% Date: Nov 2009
% This program processes the results of nw_stats.m
%
%%
%load matrices
env;
qtrs = 116;
% Set type of matrix being processed here
data = 'cor';
type = 'bool';
pct = 0;
blk = 0;
cor = 1;
display([... |
function handles = plotMeasurements(handles)
global FileData
% Actual position
actPt = FileData.SensorPosition(1,1)+1 ;
actOr = FileData.SensorPosition(1,2) ;
% Initialisation of axes4
XData = [] ;
YData = [] ;
axes(handles.axes4) ;
cla ;
% In Th... |
function [r_meas, v_meas] = get_measure(Target_rd)
global N r_res v_res;
[r_sig, r_indexes]=max(Target_rd(1, :));
r_ind = mode(r_indexes);
r_meas=r_ind*r_res;
[v_sig, v_ind] = max(Target_rd(:, r_ind));
v_meas = (v_ind-N/2)*v_res;
endfunction
|
function [ max_dist ] = maxDist(boidPos)
% MAXDIST: function that computes the maximum distance between boids in the
% current flock distribution. Computing the distance between one bird to
% every other bird, taking the maximum, repeating that for all birds and
% taking the maximum of the maximums is an ineffici... |
function ytraj = findMixedTrajectory(safe_regions, start, goal, lb, ub, seeds, traj_degree, num_traj_segments, n_regions)
% NOTEST
% Run the mixed-integer SOS trajectory planner on a simulated 3D environment, using IRIS to seed
% convex regions of safe space. For example usage, see runMixedIntegerForest and runMixedInt... |
% This file is a demo of UMUTracker Project.The UMUTracker is currently under active development.
% Related information can be found in the paper :
%
% Hanqing Zhang, Tim Stangner, Krister Wiklund, Alvaro Rodriguez, Magnus Andersson
% UmUTracker: A versatile MATLAB program for automated particle tracking of 2D light ... |
% Author: Zhao Fei
% Date: 2019-2-16
% Description: 低斜视角下的距离多普勒算法仿真
% This program references 《合成孔径雷达成像算法与实现》, chapter 6.
close all;clear all;
%% 1. 仿真参数 (参考 p142, table 6.1)
R_etac = 20e3; % 景中心斜距
Vr = 150; % 等效雷达速度
Tr = 2.5e-6; % 发射脉冲时宽
Kr = 20e12; % 距离调频率
f0 = 5.3e9; % 雷达工作频率
delta_fdop = 80; % 多普勒带宽
Fr =... |
function [cellDetections, maskStack] = detectCellStack( imageStack, ...
intensityThreshold, distanceThreshold )
%% distanceThreshold - usually 3, intensityThreshold - varies (.3)
%%
% intensityThreshold domain: [0,1]
[rows,cols,T] = size(imageStack);
%% Obtain initial detections
for t=1:T
t
cellDetections... |
% Filename : decadesToFactor.m
% Date : 07.03.2017
% Author : Manuel C. Kohl
function factor = octavesToFactor(decades)
factor = 10.^decades;
end
|
% h=TransparentCircleXLog(X,Y,R,C,transparency,NPoints,varargin)
% Function purpose : Plots transparant line by drawing a rectangular patch
%
% Function recives : X - x coordinate of circle center
% Y - coordinate of circle center
% R - Radius of circle (R can be entered as ... |
function makeTuples( obj, key )
import vis2p.*
[path,name,scan_prog] = fetch1( Experiments*Scans(key), 'directory','file_name','scan_prog');
if strcmp(scan_prog,'AOD')
if ~isempty(Scans(key,'exp_date > "2012-05-01"'))
dirs = dir(['M:\Mouse\' name(1:10) '*']);
names = vertcat(dirs.name);
t... |
%----STORED STREAMING CREDENTIALS----%
my_credentials = loadplotlycredentials;
my_stream_token = my_credentials.stream_key{4};
%----SETUP-----%
data{1}.x = [];
data{1}.y = [];
data{1}.type = 'scatter';
data{1}.stream.token = my_stream_token;
data{1}.stream.maxpoints = 30;
args.filename = 'stream_test';
args.fil... |
function varargout = imageBrowser(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @imageBrowser_OpeningFcn, ...
'gui_OutputFcn', @imageBrowser_OutputFcn, ...
... |
classdef DBNFactory < matlab.mixin.Copyable
% Factory for DBNs that uses string labels instead of numeral ids (so
% more flexible) and supports some (not all yet) CPD types and params
% Currently - only supporting Gaussin_CPD with continuous parents
properties %(GetAccess=private)
node_name... |
function results = dudahart( x, clustering, alpha )
%DUDAHART performs a Duda-Hart test for whether a data set should be split
%into two clusters. Adptation based on the R function (dudahart2) written
%by C Hennig.
% INPUTS:
% - x: data matrix in which cols are repetitions and rows are dimensions.
% - clustering:... |
% summary: runs the mistuned harmonic experiment
% method: 2AFC, 500ms ISI, 1s between trials, mistuned 2nd, 5th, 8th
% interleaved staircases (2 down 1 up), 12 reversals,
% adaptively mistune harmonic, fixed step size of 1.4
% stimulus: 200Hz, 500ms, 10 harmonics (includes fundamental), equal powe... |
function [F, J] = costgrad_lsqnonlin(x, x_lists, L, B, W, B_lists,...
M2_quants, m3_micro, m2_micro, m1_micro, lambda, maxL)
% Compute vector F such that the objective is given by norm(F)^2, and the
% jacobian J of F.
%
% Inputs:
% * x: current iterate. If a_lms is the vectorized coefficients of the
% volume ... |
function [model] = knn(X,y,K)
% [model] = knn(X,y,k)
%
% Implementation of k-nearest neighbour classifer
model.X = X; % coordinates of point
model.y = y; % labels for X
model.K = K; % K in KNN
model.C = max(y); % number of objects
model.predict = @predict;
end
function [yhat] = predict(model,Xt... |
% daqSessionPlotEvent_Velocity shows a real-ish time plot of velocity from
% the rotary encoder, pulling data from the session's data buffer (see
% daqSessionUPdateDataBuffer.m), and plotting it on the axes specified by
% the variable 'ax'
%
% updated by Mai-Anh Vu, 10/29/2018
function daqSessionPlotEvent_Vel... |
function o = dam_assemble(a,boards,channels,start,int,...
len,headers,names,direc,incubator, ...
use_daylight)
%DAM_ASSEMBLE Assemble DAM data parts into single data structure
%
% This function is not usually called directly, use dam_load.
%%(C)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
% Laborversuch: Simulation
% Regelungstechnik 1
% (C) 2019 W.Lindermeir, W.Zimmermann
% Hochschule Esslingen
%
% Level-2 MATLAB file S-Function (nach Beispiel msfuntmpl_basic.m)
% zur Darstellung eines Aufzugs
% (Kann nur einmal in einem Simulink-Blockschaltbild verwendet werden)
%
function AufzugAnimation_L2(block)
... |
%% FUNCIÓN PARA OBTENER LA MATRIZ HOMOGENEA DE TRANSFORMACION D-H
%Esta función devolverá en A la matriz de transformación homogenea 4x4 a
%partir de los parámetros tetha,d,a y alpha de Denavit-Hartemberg.
function A=fun_MDH(theta, d, a, alfa)
A =[cos(theta) -cos(alfa)*sin(theta) sin(alfa)*sin(theta)... |
classdef TCPServer
%UNTITLED3 Summary of this class goes here
% Detailed explanation goes here
properties
end
methods
function convertFile(o, file)
t = readtable(file)
s = size(t)
len = s(2)
s = s(1)-2
... |
function [ yhat, a ] = PCR_red( X, y)
% ANI DEVER s225055
% This function computes the Principal Component Regression
% takes 2 matrices, X & y
% computes PCA inside, obtains Z matrix
% reduces the U and D according to threshold set for eigenvalues
% returns yhat and a
% Necessary variables
N = length(X);
R = (X.'*... |
function contrastanalysis_SU_nolight
animalid = '150225';
block = 19;
lcol = 'r';
onlymod = 0;
sfc = 1;
basepath = ['C:\Users\Julia\work\data\' animalid '\'];
supath = [basepath 'singleunits\'];
basename = [animalid '_block' int2str(block) '_tet'];
files = dir([supath, basename, '*.mat']);
prestim = 300;
poststim ... |
function [predicted_label, acc, decision_values] = classifyC3DFeatures()
%training_features = load('training_features.mat');
%training_features = training_features.training_features;
%size(training_features)
%training_labels = load('training_labels.mat');
%training_labels = training_labels.training_labels;
%... |
function [p] = payoff_gddt1_MC(S)
%%光大鼎泰1号MonteCarlo定价方法
upper = 1;
S0 = 1;
a = 1.035 * S0;
b = 1.185 * S0;
T = 268;
iterN = size(S,1);
stepT = size(S,2);
ST = S(:, end);
p = ones(iterN, 1);
% knock_out_count = 0;
% total_count = iterN;
% case knock out:
fo... |
close all; clear all;
k=7;
% number of intervals to split [-pi,pi]
M = 15000*2+1;
theta0Idx = (M-1)/2+1;
epsilon=0.0001;
% solve the integral equation \phi(\theta):
phiVals = solveIntEq(k,M,epsilon)';
% compute rho again, using the final values of phi:
rhoVals = zeros(1,M)';
for idx = 1:M
rhoVals(idx) = computeRh... |
function angle_r = deg2rad(angle_x)
angle_r = angle_x*pi/180;
end |
% clear; close all; clc;
% n =36; % no of sample
[X1,X2] = meshgrid(20:(80-20)/199:80,200:(1000-200)/199:1000); %[d,H]
% constant parameters
F = 150000*ones(length(X1),1); % External force(N)
E = 210000*ones(length(X1),1); % Elastic modulus (N/mm^2)
B = 750*ones(length(X1),1); % Width of t... |
function [kappa,y] = CondEstUpperTri(T)
% function [kappa,y] = CondEstUpperTri(T)
% inf-norm condition estimator for upper triangular matrices.
% T is nxn, nonsingular, and upper triangular.
% kappa is an estimate of the inf-norm condition of T
% y is nx1 and satisfies norm(y,inf) = 1 and norm(Ty,'inf') = 1/kapp... |
function data = read_binary_array(filename, ndims, dims)
% data = read_gadgetron_array(filename)
%
% Reads simplified array format output from the Gadgetron
%
% The datatype is determined by the file extension.
% - *.short : 16-bit unsigned integer
% - *.real : 32-bit float
% - *.cplx : 32-bit compl... |
function cusip = getCusip(symbol,date,path2mst)
% GETCUSIP Retrieves CUSIPs of a symbol
%
% GETCUSIP(SYMBOL, DATE)
% Retrieves the CUSIPs corresponding to the SYMBOL - DATE(s) pairs.
%
% See also: getMaster
if ~isrowchar(symbol)
error('taq:getCusip:invalidSymbol','SYMBOL should be a string.')
end
if nargin ... |
clf;clear all;
N = 3
fc = 1/6
t = (0:0.001:N)/ fc
symbol_rate = 0.1
% s0 = sin(2*pi*fc*t)
% s1 = sin(2*pi*fc*t+pi)
% signal = [s0,s1]
% t_vec = [t t(end)+t]
signal = [-1,1,-1,1,1,1]
load('./filter/practice_1_filter')
srrc = srrc_pulse(4 , 4, 0.2);
Digital_filtered_signal = conv(DAC(signal,4),srrc)
DMA_filtered_signal =... |
function [aupicset1,aupicset2,sppicset1,sppicset2]=filedivide
%filedivide divide files into 4 category
pics={'canong3_02','canong3_05','canong3_08',...
'nikond70_02','nikond70_05','nikond70_08','nikond70_11',...
'canonxt_02','canonxt_05','canonxt_08','canonxt_11','canonxt_14','canonxt_17','canonxt_20','ca... |
function [Z_e, W] = receiver_ZF(Y_ZF,H_ZF,H0F0,N)
W = (eye(N) - (H_ZF*(inv((H_ZF')*H_ZF))*H_ZF'))*(H0F0);
Z_e = W'*Y_ZF;
end |
function[Erms_test] = test_cfs(feat_test, rel_test, phi_design_test, weights)
E_test = (((phi_design_test * weights) - rel_test)' * ((phi_design_test * weights) - rel_test)) / 2;
[row_test, col_test] = size(feat_test);
Erms_test = sqrt((2 * E_test)/ row_test);
end |
%select image acquisition tool
vid = videoinput('winvideo', 1, 'YUY2_1280x720');
%select video writer
vidWriter = VideoWriter('.avi');
%select camera
camList = webcamlist;
cam = webcam(1);
try
set(vid,'framesperTrigger',10,'TriggerRepeat',Inf);
%Start live stream acwuisition
start(vid);
%Open video ... |
function [sampleCentersX,sampleCentersY,renderedPyramid] = getSamplingCenters( xCenters, yCenters, centersPyrLevel, pyr, levelsUp )
% GETSAMPLINGCENTERS Given 3 nearest neighbors for each patch of the input image, from the patches DB,
% find the location of parent patch in the rendered pyramid image8
% Arguments:
% xCe... |
function [x, fx, i] = rprop(x, func, m, varargin)
% Minimize a differentiable multivariate function using RPROP.
%
% Usage: [X, fX, i] = minimize(x, func, m, P1, P2, P3, ... )
%
% x Initial guess.
% func The name or pointer to the function to be minimized. The function
% func must return two argument... |
%Andrew Logue - 9/20/2019
%generate vectors using ';' and the linspace function
clear
clc
%using the colon operator to generate vectors
rowvec1 = (2:2:10)
rowvec2 = (-10:-10:-30);
colvec1 = (15:15:60)';
colvec2 = (5:-2:-5)';
%using the linspace function to generate vectors
rowvec3 = linspace(2,10,5);
rowvec4 = lins... |
function [xnod,ynod,w]=quad5
% 7 node quadrature formula on the reference triangle
% degree of precision: 4
xnod=zeros(1,7);
ynod=zeros(1,7);
w=zeros(1,7);
third =1/3;%0.3333333333333333333333333333;
a=(9-2*sqrt(15))/21; %0.0597158717;
b=(6+sqrt(15))/21; %0.4701420641;
c=(9+2*sqrt(15))/21; %0.7974... |
function ExecutionString = Run(RSim)
Path = RSim.SimulationDirectory;
VersionDirectory = [RSim.PathRoot,'\',RSim.VersionDirectory];
RELAPDirectory = [VersionDirectory,'\',RSim.RELAPFolder];
RELAP = [RELAPDirectory,'\','relap5.exe '];
Input = ['-i ',Path,'\',RSim.InputFileName,' ... |
mergeh5_chunks('2018-10-01', 6500) ;
|
function [ image ] = mark_line_in_image( in_image, in_r1, in_c1, in_r2, in_c2, color )
% NAME: mark_line_in_image
%
% DESCRIPTION:
% Mark the pixels of a line in an image in
% a brute force fashion.
%
%@
% Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
%
% Permission is hereby gra... |
parseObj = dataparse(1, 1,100);
%Raw groundtruth data from dataset. Arranged [time, x pos, y pos, theta(unneccessary)]
M = containers.Map()
RB_1 = parseObj.parse_robot(3,M);
RB_2 = parseObj.parse_robot(2,M);
% Takes 100 points from robot 1 and robot 2
rb_1 = RB_1(1:100,:);
rb_2 = RB_2(1:100,:);
hold on;
% I plot... |
function varargout = MBA(varargin)
% MBA MATLAB code for MBA.fig
% MBA, by itself, creates a new MBA or raises the existing
% singleton*.
%
% H = MBA returns the handle to a new MBA or the handle to
% the existing singleton*.
%
% MBA('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
function [PxxMean, fr, totalTime, PxxStd, Pxx] = estimatePSD_welch(x, rois, w, nFFT, Fs, overlap)
% Estimate power spectral density for sub-indexed segments of data (e.g. trials)
%
% [PxxMean, fr, totalTime, PxxStd, Pxx] = estimatePSD_welch(x, rois, w, nFFT, Fs, overlap)
%
% Input
% x: 1D real-valued signal
% ... |
function fAverageRMS = CalculateRMS_Speech_7ch(InputFolder)
iSmoothWin = 10;
iNoiseTol = 10;
sInputFileCh0 = [InputFolder,'\ch0.wav'];
sInputFileCh1 = [InputFolder,'\ch1.wav'];
sInputFileCh2 = [InputFolder,'\ch2.wav'];
sInputFileCh3 = [InputFolder,'\ch3.wav'];
sInputFileCh4 = [InputFolder,'\ch4.wav'];
sInputFileCh5 =... |
function figure=plot_flow_duration_curve(Q,F,varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plots discharge vs exceedance probability as a Flow Duration Curve (FDC)
%
% Parameters
% ------------
% Q: array
% Discharge [m/s]
%
% F: array
% Exceedance probability [unitless]
%
... |
clc
clear all
[train_Y,train_prediction,test_Y,test_prediction,train_input_feature,test_input_feature] = ModelInfer_I_O_HMM_one_input('I_O_HMM_one_input/I_O_HMM_T3_B4.mat',3,4);
%[train_Y,train_prediction,test_Y,test_prediction] = ModelInfer_I_O_HMM_one_input('I_O_HMM_one_input/I_O_HMM_T3_B4_STD.mat',3,4);
MAE_train... |
function simpleChanTopo(sensors, chanlabels, data, cmap, comment, fontcolor, axiscol)
% simpleChanTopo(sensors, chanlabels, data, cmap, comment, fontcolor, axiscol)
cfg = [];
cfg.marker = 'labels'; % 'on', 'off', 'labels', 'numbers';
cfg.markersymbol = '.';
cfg.markersize = 4;
... |
% project 6 - NCTU_MAP
% -------------------------------------------------------------------------
% Goal:
% click 2 points on the map of NCTU where pedestrians can walk, and find a
% smooth path between them.
% -------------------------------------------------------------------------
% instruction:
% click 2... |
% Run BTL SDP and create a plot.
% - Fix d.
% - Vary n.
function [] = BTLSDP_test1(outdir)
if ~exist('outdir', 'var')
outdir = '.';
end
wdists = {'uniform', 'sqrtlinear', 'linear'};
d = 10;
sigma = .3;
a = 1;
b = 1;
ntrials = 5;
max_n = 10 * d * log(d);
num_n = 10;
n_vals = ceil(exp(log(d):((log(max_n)-log(d)... |
function pr = detect0(i)
[p, ~, ~] = property();
pr = p{i};
|
% calculate rate of O1D + N2 + M -> O3P + N2 + M
% Updated 7/13/06 AEP
% Based on JPL Data Evaluation #15
% rate = kO1DN2(T,M)
function j=kO1DN2(T,M)
j=2.15e-11.*exp(110../T);
|
function generate_homography_matrix()
% Choose n corresponding points (use ginput)
% 1->105; 18->20
% size of box: 10.5x7
% All dim in inches
% Generate the saved homography matrix. The user is required to pick
% the object in the displayed images and the function will build all
% the h... |
%% Humidity Variation
%% Variables
RO_SI=1.225;%density in SI
%% Functions In SI Units
ROuser=0;
X=input('PLEASE Enter The Humidity Ratio');
while X<0 || X>1
display('Humidity Ratio Must Be Between 0&1')
X=input('PLEASE Enter The Humidity Ratio');
end
RO=RO_SI*(1+X)/(1+1.609*X);
ROuser=RO;
display(RO)
%% plot
X1=(0:0.0... |
function controller(block)
setup(block);
function setup(block)
block.NumInputPorts = 3; %% x, fWall, position
block.NumOutputPorts = 4; %% u, fCon, mu_max, stiffness
block.InputPort(1).DatatypeID = 0; % double
block.InputPort(1).Complexity = 'Real';
block.InputPort(2).DatatypeID = 0; ... |
mergeh5_chunks('2018-12-01', 6500) ;
|
for a = 1:3
for b = a+1:4
for c = b+1:5
%choose mixture
%BenzeneTolueneEthylbenzeneStyreneMethylstyrene;
%letter = 'A';
%EthanolIso_1PropanolIso_1Butanol;
%letter = 'B';
HexaneHeptaneOctaneNonaneDecane;
letter = 'C';
... |
function [P,k] = CLSUP(Xs,Ys,Xl,Yl)
% Set predefined variables
[ds,ns] = size(Xs);
[dt,nt] = size(Xl);
% Set cost for defective and defect-free instances
defNumS = length(find(Ys==1));
nodefNumS = length(find(Ys==0));
defNumL = length(find(Yl==1));
nodefNumL = length(find(Yl==0));
%cost = [1 (nodefNumS+nod... |
function z=fh1(x,y1,y2,y3,y4)
z=y2;
end |
function idx = getNodeIdx(nodeID)
%
% search the list of node IDs to find the node's index in the
% global node array. If the nodeID isn't found, a new index is allocated.
%
global VIS;
% for debugging, translate ints to strings, and do the sanity check below
if isfield(VIS,'debug') & VIS.debug
if isnum(nodeID... |
function [ faceColor ] = faceColors( mesh, faceValues, vmin, vmax, colorLow, colorHigh )
%FACECOLORS Summary of this function goes here
% Detailed explanation goes here
alpha = (faceValues-vmin) / (vmax-vmin);
omalpha = ones(size(faceValues)) - alpha;
faceColor = [omalpha*colorLow(1) + alpha*colorHigh(1), omal... |
function [y,yprime]=f1(x)
% [y,yprime]=f1(x) computes y=x^2-9 and its derivative,
% yprime=2*x
% your name and the date
y=x.^2-1;
yprime=2*x; |
function L = create_line(z_strt, z_end)
%% create a line with two complex numbers as end points
EPS = 1e-3;
tmp = z_end - z_strt;
m = imag(tmp)/real(tmp); %m=y/x
if ( abs(m) <= tan(pi/2 - EPS) ) % not vertical
c = imag(z_strt) - m*real(z_strt); % c = y - mx
x_min = real(z_strt); %x1
x_max = r... |
% DTFT
% Periodic result between -pi pi or -2pi 2pi
% Real valued: magnitude response = even function
% Example: x[n] = dirac[n+3]+dirac[n+2]+dirac[n+1]
% X(e^jw) = e^3jw + e^2jw + e^jw = e^2jw(e^jw + 1 + e^-jw) = e^2jw(1+2cos(w))
% w is a vector from -pi to pi , not a variable
% A = exp(-j*Q) answer
function y = dtft... |
clear all; clc
W = [1,2,3,4,12,19,20,21,23,24,25,28,29,31,32,33,36,39,42,43,45,47,50,51,52,55,57,59,62,65,67,68,70,71,72,73,75];
q = 8; %#of networks
SS = zeros(length(W), q);
for wwidx = 1:length(W)
w=W(wwidx);
fprintf('======processing village %d ======\n',w)
loadname1 = sprintf('C:\\Users\\clean\\cl... |
function [ pred4 ] = pred4(t, y)
w = y(1);
r = y(2);
tu = y(3);
% Wolf
wolf_pop = 0.1 * w * (1 - (sum(w + 0.01 * [r tu]) / 50));
% Rabbit
rabbit_pop = 0.8 * r * (1 - ((r + 0.06 * w) / 200));
% Turkey
turkey_pop = 0.4 * tu * (1 - ((tu + 0.03 * w) / 100));
% column vector
pre... |
% try
% sshfrommatlabinstall(1)
% catch ME
% disp(['Could not find sshfrommatlab package. Make sure it is in your path.'])
% return
% end
sshdata.userName = 'fcarneva';
sshdata.hostName = 'bnbdev1.cshl.edu';
sshdata.password = 'Malasagna1';
code_folder = 'bnbTP'; %working folder
results_folder = uigetdi... |
% MAKESIG calculates signals for psychoacoustic test (pink noise, 200 ms, all directions)
% Klaus Hartung (hartung@aea.ruhr-uni-bochum.de)
% Lehrstuhl fuer allg. Elektrotechnik und Akustik
% Ruhr-Universitaet Bochum
% 44780 Bochum
% 21.October 96
close all
wnoise = mkwnoise(2.0,44100);
a = [1 -0.99];... |
function d = distancePointLine3d(point, line)
%DISTANCEPOINTLINE3D Euclidean distance between 3D point and line
%
% D = distancePointLine3d(POINT, LINE);
% Returns the distance between point POINT and the line LINE, given as:
% POINT : [x0 y0 z0]
% LINE : [x0 y0 z0 dx dy dz]
% D : (positive) scalar
% ... |
function memoryPlotter(matrixName)
% MEMORYPLOTTER plots a graph of the memory variations in the time.
% MEMORYPLOTTER(M) reads with memoryReadDelta the memory variations
% related to the decomposition and resolution of M in all the
% windows/linux-octave/matlab combinations; reports files must be in the
% fol... |
function [output, edge, thresh, result] = createPatternStimulus(sz, relCutoff, bpfilter)
% CREATE PATTERN STIMULUS
% sz - the desired image size
% relCutoff - Define a relative cutoff in terms of the available frequencies
% bpfilter - the convolutional bandpass filter to use, in space domain
if ~exist('toplo... |
function [idNumIdxArray, ok] = pipelineListBox(obj,fxnsToRun,inputTxt,currentIdx)
% Main GUI for calciumImagingAnalysis startup
% Biafra Ahanonu
% started: 2019.12.22 [09:01:38]
% inputs
%
% outputs
%
% changelog
% 2021.08.10 [09:57:36] - Updated to handle CIAtah v4.0 switch to all functions inside ciapkg ... |
%
% algorithms.m
%
% Created on May 17, 2017.
%
clc;
for k = 1:15
filename = sprintf('es413-images/%d.jpg', k);
sobelFilename = sprintf('es413-images/%d-sobel.jpg', k);
laplacianFilename = sprintf('es413-images/%d-laplacian.jpg', k);
cannyFilename = sprintf('es413-images/%d-canny.jpg', k);
... |
function [ r ] = T_P( x,y )
r = x.*y;
end
|
%Jorie Noll
%Lab 8a
a = 4;
b = 8;
accuracy = 1e-7;
f = @(x) sqrt(2*x.^4+3*x).*cos(5*x).*log((4*x.^3+7*x)./(x.^2+1))./(x.^2.*sin((3*x+1)./(2*x)).*exp(-(5*x.^3+2*x)./(6*x.^2+2)));
I = quad(f,a,b,accuracy); %#ok<DQUAD>
fprintf('I=%.5f\n', I);
|
function kernel = dcmotion(sz,r)
K = zeros(2*ceil(r)+1);
K = double(bsxfun(@(kx,ky)double(abs(realsqrt(kx.^2+ky.^2)-norm(size(K))/2)<=1).*exp(-(realsqrt(kx.^2+ky.^2)-norm(size(K))/2).^2),(1:size(K,1))',1:size(K,2))); K = K/sum(K(:));
K = [fliplr(K),K]/2;
sza = 1+ceil ((sz-size(K)-1)/2);
... |
%Spence and Turcotte Fig.1
clear
close all
figure; hold on
h0=1;%ref width
l0=1;%ref len
A=pi*h0*l0;
g=1;%9.81;
deltarho=1;%1000
t=[5 10 20 50];
eta=1;
y=linspace(-1,6,10000);
step=(y(2)-y(1));
ybar=y/l0;
for i=1:numel(t)
tbar=(h0^2*g*deltarho*t(i))/(l0*eta); %eq.4 - dmlss time
hbar=sqrt((1/tbar)+(ybar/tbar)); ... |
function parsivel = catPSVstruct(data)
% catPSVstruct(data)
% This function merge a vector of structures of PARSIVEL2 data
%
% JValdivia - 07, 2018
dims=size(data(1).time);
if dims(1) > dims(2)
time=cat(1,data.time)';
RI=cat(1,data.RI)';
dbZ=cat(1,data.dbZ)';
SYNOP4680=cat(1,data.SYNOP4... |
function z=CPB7(x)
global ProblemSettings;
nVar=ProblemSettings.nVar;
Dr=20;
Iz=55
Pmax=1;
Fmax=1000;
Tmax=15;
mu=.5;
s=1.5;
Ms=40;
Mf=3;
n=250;
vsrmax=10;
Imax=30;
rimin=60;
rimax=80;
romin=90;
romax=110;
tmin=1.5;
tmax=3;
Fmin=6... |
function SwitchSPMfdr(SWITCHTYPE)
% SWITCHTYPE = string denoting either 'voxelFDR' or 'topoFDR'
%
global defaults; spm_get_defaults;
if strcmp(SWITCHTYPE,'voxelFDR')
defaults.stats.topoFDR = 0;
elseif strcmp(SWITCHTYPE,'topoFDR')
defaults.stats.topoFDR = 1;
end % if
|
% test results from em
clear;
addpath('../evaluate/');
addpath('../grabcut/');
% imgPath = '/home/zhangyu/temp/savepath/img/';
maskPath = '../data/MSRA10K/GT/';
salPath1 = '../data/selectedSal/localSal1/';
salPath2 = '../data/selectedSal/localSal2/';
salPath3 = '../data/selectedSal/localSal3/';
savePath = '../data/se... |
function V = LDE(X, labels, k1, t1, k2, t2, d)
% G, G' ==> [W, W']
[n, m] = size(X);
[W1, W2] = LDECompute(X, labels, k1, t1, k2, t2);
D1 = spdiags(sum(W1, 2),0,speye(size(W1,1)));
D2 = spdiags(sum(W2, 2),0,speye(size(W2,1)));
tmp = X * (D1 - W1) * X';
if m < n
tmp = tmp + 10^(-9) * eye(size(tmp));
end
[V, D] =... |
function [b] = sscmd(a,ml,cl,r)
% Semi-supervised community structure detection.
% This function is used to get a new matrix from adjacency matrix based on
% some pairs constraints.
% Input :
% a(n*n) : The adjacency matrix of a network with n nodes.
% a(i,j) = 1, if i ~ j
% a(i,j) = 0, if i = j or... |
function Staircase = thisStaircaseSetup(Cons, Starts, UpDowns, Levels, InitialStepSize)
% Cons = 1;
% Starts = 5;
% Starts = LevelRange(1)
% UpDowns = [1 1];
Staircase = struct;
Staircase.UpDowns = UpDowns;
Up = UpDowns(1);
Down = UpDowns(2);
Staircase.Acc = .5^(Down/Up);
Staircase.Correct = zeros(1, Cons);
Stairc... |
clearvars
close all
clc
A = zeros(6,6);
n=36+3;
Tab = zeros(1,n);
Tab(2) = 1;
for i=3:n
Tab(i) = Tab(i - 1) + Tab(i - 2);
end
%Utworzenie tablicy zawierajacej wyrazo ciagu Fibonacciego
x=3; % rozpoczynamy od 3 elementu ciągu
for i=1:6
for j=1:6
A(i,j)=Tab(x); %przypisanie wartosci tablicy do... |
function indc = loc_find(xpos,X)
indsl = X <= xpos;
indsr = X > xpos;
[~,indc] = max(indsl.*[indsr(2:end);indsr(1)]); |
% PROGRAM TO SHOW CROSS CORRELATION FUNCTION
clc; clear all; close all;
%x=input('enter the sequence')....1
x=[1 2 3]; %....2
% either eq. 1 or 2 may be used to enter the value of sequence
y=[2 4 6];
z=xcorr(x,y);
figure;
subplot(3,1,1);
plot(x);
title('SEQUENCE 1:');
ylabel('amplitude ---->');
xlabel('(q)n ---->');... |
function [X,Pressure,Density,V,time]=read_hdf1D(filename)
% Read the HDF5 data
Density=h5read(filename,'/hydrodynamic/density');
Pressure=h5read(filename,'/hydrodynamic/pressure');
X=h5read(filename,'/geometry/edges');
V=h5read(filename,'/hydrodynamic/velocity');
time=h5read(filename,'/time');
|
UT_theta=[-90 -35 0 35 90];
UT_theta=deg2rad(UT_theta);
while(1)
pause(0.2);
for UTsensor = 1:1:5
if UTsensor ==1
plot([0 lidar(UTsensor)*cos(UT_theta(UTsensor)+pi/2)], [0 lidar(UTsensor)*sin(UT_theta(UTsensor)+pi/2)] ,'r' );
axis([-5 5 -.1 10]); axis square;hold on;
else
p... |
% freqDomainFilterAnalysis.m
% 3/1/21
% Dan Hirlinger
clear; clc;
N = 512;
k = 128;
e = exp((-1j*2*pi*k)/N);
% Amplutide
abs(e)
% Angle
angle(e)
for k = 0:(N/2)-1
H(k+1,1) = 1 + exp((-1j*2*pi*k)/N);
end
% Amplutide
ampH = abs(H);
% Angle
angleH = angle(H);
normF = [0:(N/2)-1] / ((N/2)-1);
subplot(2,1,1);
... |
function vehicle = displayTrackingResults(tracks,vehicle)
minVisibleCount = 6;
if ~isempty(tracks)
% Noisy detections tend to result in short-lived tracks.
% Only display tracks that have been visible for more than
% a minimum number of frames.
reliableTrackInds = .... |
function [AlphaReturn, AugObjEval, OriObjEval, Gap] = ADMM_ML(xtrain,xtest,ytrain,ytest,nTest,varEst,freq,var,K,options)
%ADMM_ML ADMM framework for MLK Optimization
% Input class support:
% ytrain: training y, column vector;
% U: cell of Kernels;
% options: strut(rho, MAX_iter, nv, iniAlpha).
% O... |
function [r,A,Rd,D,Rs,B,ntot_0,n_algae_end,n_dissolved_end,n_detritus_end,n_sediment_end,n_benthic_end,ntot_end] = extract_results_v6(t,Y_t,p)
%% Extracts results from simulation
% unpackages and reformats the results from the input simulation,
% and returns the extracted and calculated values.
%% Extracting results... |
function [A,B,C,phi,it1,it2,phi_vec]=bcdLrLr1_alsls(X,L_vec,lsearch,comp,Tol1,MaxIt1,Tol2,MaxIt2,Ninit,A,B,C)
%BCDLL1_ALSLS Block Component Decomposition (BCD) in rank-(Lr,Lr,1) terms.
% [A,B,C]=bcdLrLr1_alsls(X,R,L) computes the BCD-LrLr1 of a third-order tensor.
% The alternating least squares (ALS) algorithm is ... |
function ret=SIGN(v)
ret=(v>0)-(v<=0);
end
|
clear all
close all
clc
%-----------------------------INPUT SECTION-------------------------------------
%Input and output directories
idir="input";
odir="output";
%Save output data to
outfile="earlyFIT.mat";
%Choose source of data
%"COVIDITA", "COVIDJHU" or "filename.ext" to be found in idir
source="CO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.