text stringlengths 8 6.12M |
|---|
function C = categorize( I , cc , siml , t )
[y x] = size(I);
C = {};
for i = 1:cc.NumObjects
placed = false;
for j = 1:numel(C)
similarities = zeros(1,numel(C{j}));
c = C{j};
for k = 1:numel(c)
[s d] = siml( I , c{k} , cc.PixelIdxList{i... |
function ri = dc_motor_encoder_hardware_simulatedri
ri = [];
|
function zoomed_image = zoom_out(imgOriginal, zf)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Zoom_out: effectue un zoom arrière de l'image
% imgOriginal :image à zoomer
% zf: facteur de zoom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[M,N,d]=size(imgOriginal);
% Une image est crée de zf fois plus petite que... |
rand('seed', 1994);
w = [-1 + (2).*rand(3, 1)];
% initial_weight = [0;1;1];
% initial_weight = [-.1678;.2567;.5505];
% hypothesis_w_list = single_perceptron(200, initial_weight, 1000);
% w = [-.1678;13.982;-13.5078];
% num_dots = 10:10:3000;
% repeat = 1000;
% percent_correct = percent_correct_perceptron(num_dots,... |
function results = event_cal_stats(chunks, args)
%EVENT_CAL_STATS Report various stypes of statistics of event data
%chunks according to user args.
%
% For examples and usage, go to:
% demo_timevp_compute_statistics.m
if isempty(chunks)
warning('The args CHUNKS is empty, there is no data inside, the function wi... |
% The horner_rule function applies the horner rule to find a
% polynomial solution p for a given coefficient vector c
% and a value for x.
function p = horner_rule(c,x)
n = length(c);
p = c(n);
for k = n-1:-1:1
p = p*x + c(k);
end
end
|
function [ output ] = convert2numbers( alphabet, sequence )
output = zeros(1, length(sequence));
for i = 1:length(sequence)
for j = 1:length(alphabet)
if sequence{i} == alphabet(j,:)
break
end
end
output(i) = j;
end
end |
function out = mywienerfilt(input, system, noise)
NOISE=fft(noise);
NOISE= mean((NOISE.^2));
INPUT = fft(input);
SYSTEM = fft(system);
G = conj(SYSTEM) ./ ((abs(system)).^2 + NOISE );
OUT = G .* INPUT ;
out = abs(ifft(OUT)+100)-100;
return
% some test code
count = 1;
count2 = 1;
s2 = 0.52; % CNR=8; 0.05; % nois... |
function percent = get_percentile(x, xs)
percent = sum(x > xs) / length(xs);
end
|
function [I1 I2 I3 I4 I5 I6 I7 I8] = pyrGauss(I0)
%% pyrGauss
% I0: Imagen de entrada
% pyr: Piramide de Gauss
I1 = impyramid (I0, 'reduce'); I2 = impyramid (I1, 'reduce');
I3 = impyramid (I2, 'reduce'); I4 = impyramid (I3, 'reduce');
I5 = impyramid (I4, 'reduce'); I6 = impyramid (I5, 'reduce');
I7 = impyramid... |
function [ ] = plot_ace_climatology_file( climfile_in )
%A function to plot the climatology data for ACE. The function uses
%'pcolor'.
%
% *INPUT*
% climstruct_in: STRING - the name of the file containing the ACE
% climatology data.
%
% *OUTPUT*
% makes a plot
%
%%%%%%%%%%%%%%%%%%%%%%%%... |
function evaluate_model(model, dataset)
gt = dataset.Labels;
predictions = model.predictFcn(dataset);
cm = confmat(string(gt), string(predictions));
labels = strrep(cm.labels, '*', '_');
plabels = strcat('P', cellstr(labels));
tlabels = strcat('T', cellstr(labels));
fprintf('<... |
function [plane, pavg] = plane_thru_3_points(p1, p2, p3)
p12 = p1 - p2;
p13 = p1 - p3;
n = cross(p12, p13);
n = n./ norm(n);
pavg = (p1+p2+p3)./3;
d = -dot(n, pavg);
plane = [n; d];
end |
%% Calcul de la fiabilité de l'exploitation par approche probabiliste %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Variables d'entrée :
% MX : Vecteur 1D contenant les points de puissances réactives
% MW : Vecteur 1D contenant les points de puissan... |
function tests = MHyProLocationTest
tests = functiontests(localfunctions);
end
function testLocation(testCase)
loc1 = MHyProLocation();
loc2 = MHyProLocation([1 0 1; 2 1 3; 1 1 1]);
loc3 = MHyProLocation([1 0; 2 1]);
loc4 = MHyProLocation([1 0; 0 1]);
tran1_2 = MHyProTransition(loc1, loc2);
tran1_3 = MHyProTransi... |
function I = motorControl_oldVersion(qEnd,dqEnd,q,dq,fRef,P)
% I = motorControl_oldVersion(qEnd,dqEnd,q,dq,fRef,P)
%
% This function runs a force controller that tracks some desired force to
% be applied to the hard stop at the far end of the tendon.
%
%%%% NOTES:
%
% This sort of works, but it does not track
% Unpa... |
classdef (Abstract) VehicleModel
% VehicleModel vehicle abstract class.
%
% Abstract class representing a vehicle.
%
% Extend this class in order to create a new vehicle model to be used with the simulator.
methods(Abstract)
Model(self, t, estados)
end
properties
M % S... |
function [s]=GridDist(A,B)
% calculate sum of horizontal and vertical distance between A and B
s=abs(A(1,1)-B(1,1))+abs(A(1,2)-B(1,2)); |
function [ str ] = plotspread( input_args )
%PLOTSPREAD Summary of this function goes here
% Detailed explanation goes here
sthresh = csvread('/home/kevin/Desktop/sthresh');
spectrum = csvread('/home/kevin/Desktop/spectrum_data');
for i=1:100
%plot([1:257],str((i-1)*2 + 1,1:257),[1:257],str((i-1)*... |
%% Linear Segments with Parabolic Blends (PSPB)
% From: http://www.ee.nmt.edu/~wedeward/EE570/SP09/gentraj.html
clear all;
% intial time, joint value and joint velocity
t0 = 0;
tf = 7;
% final time, joint value and joint velocity
q0 = -0.7;
qf = 0.5;
% constant velocity and blend time
V = 0.2;
tb = (q0 - qf + V*t... |
function y = stderr(x,d)
% STDERR Standard Error
% For vectors, STDERR(X) is the STD(X)/SQRT(LENGTH(X)). For
% matrices, STDERR(X) is a row vector containing the standard
% error value of each column. For N-D arrays, STDERR(X) is the
% standard error of the elements along the first non-singleton
% dimensio... |
function [FF,R2] = SimulateInVivoValues(FFvals, R2vals, SNR, echotimes)
% function = SimulateInVivoValues(FFvals, R2vals, SNR, echotimes)
% Description:
% Enables simulation of signal from in vivo parameter distribution
% Input:
% SNR is the true SNR; sigma is calculated from this assuming ground truth
% S0 value
... |
function m = sphere(mat,center,r,value)
m = zeros(size(mat));
for x = 1:size(mat,1)
for y = 1:size(mat,2)
for z = 1:size(mat,3)
d = distance([x,y,z],center);
if d <= r
m(y,x,z) = value;
end
end
end
end
end |
function [ret] = pcz_latex_coeffs(A, varargin)
%%
%
% file: pcz_latex_coeffs.m
% author: Polcz Péter <ppolcz@gmail.com>
%
% Created on 2016.05.25. Wednesday, 11:27:13
%
vars = pargin(varargin, 2, []);
[c1,t1,c2,t2] = pcoeffs(A,vars);
[n,m] = size(c1);
sed = [
sed_platex_from_latex
sed_platex_from_... |
%% Add the approprate folders to the path
%Path of the SOSpikingModel repository
%repopath = '/Users/dlevenstein/Project Repos/SOSpikingModel';
repopath = '/Users/jonathangornet/Documents/GitHub/SOSpikingModel';
addpath(genpath(repopath))
figfolder = [repopath,'/Figures/EIBalance'];
%% Define the Population Para... |
num_sequences = numel(scenes);
num_ranks = numel(ranks);
num_cameras_sans = numel(solvers.find_cameras);
num_cameras_with = numel(solvers.find_cameras_with_K);
num_structure_sans = numel(solvers.find_structure);
num_structure_with = numel(solvers.find_structure_with_K);
num_cameras = num_cameras_sans + num_cameras_wit... |
clc;
clear all;
a1=imread('E:\Study\DIP\Lab_exp\cameraman.jpg');
a = rgb2gray(a1);
subplot(3,3,1);
imshow(a);
title('original image');
%simple thresholding takes a default level of 0.3
level=0.3
subplot(3,3,2);
segimage1=im2bw(a,level);
imshow(segimage1);
title('simple thresholding at 0.3');
subplot(3,... |
T = table(['M';'F';'M'],[45 45;41 32;40 34],{'NY';'CA';'MA'},[true;false;false]);
writetable(T,'myData.xls','Sheet',2,'Range','B2:F6'); |
function [] = tomographyplot(parameters,observed_data,method,file_name)
clf
tom_image = reshape(parameters,[6,20]);
subplot(6,3,1:6)
colormap(brewermap([],'YlOrRd'));
imagesc(tom_image)
colorbar()
set(gca,'ytick',[],'xtick',[])
colors = brewermap(2,'set1');
if strcmp(method,'ana')
c_to_use = colors(1,:);
end
if s... |
function [ L ] = wshed( bw )
%WSHED perform watershed on distance transform of bw
D = bwdist(~bw);
D = -D;
D(~bw) = -Inf;
L = watershed(D);
% find the background label and remove the bg class
[r, c] = find(bw == 0, 1);
bglabel = L(r, c);
L(L == bglabel) = 0;
end |
function [Z,x,f,Hz] = fourierbasis (T,Q,N)
% Make Schauder basis
% INPUT
% T: length that Z will have
% Q: defines the range of frequencies covered by Z
% N: period (Z will have 0.5*T/N periods)
% OUTPUT
% Z: output sinusoudal signals
% x: time indexes
% f: frequencies at each column of Z
% Hz: sampling frequency
if ... |
function [MFCCs] = getMFCCs(magSpec, params)
magSpec = magSpec(1:length(magSpec)/2+1);
%-Filter parameters
numFilts = params.feat.numFilts;
numCoeff = params.feat.numCoeff;
% fftUnique = length(magSpec);
% lowFreq = params.feat.lowFreq;
% highFreq = params.feat.highFreq;
% freqRange = [lowFreq highFreq];
%
% m... |
function errorFix(scr,const,my_key)
% ----------------------------------------------------------------------
% errorFix(scr,const,my_key)
% ----------------------------------------------------------------------
% Goal of the function :
% Blank stimuli and display three red circle around the fixation
% target to invite ... |
function [x_out, y_out] = center_of_mass(I,x,y,range_ratio,w,m,n)
x_out = 0; y_out = 0;
y_left = max(1, fix(y-range_ratio*w)); y_right = min(n, fix(y+range_ratio*w));
x_top = max(1, fix(x-range_ratio*w)); x_bottom = min(m, fix(x+range_ratio*w));
% plot([y_left,y_right,y_right,y_left,y_left],[x_top,x_top,x_bottom,x_b... |
function imgRez = maresteLatime(img,numarPixeliLatime,metodaSelectareDrum,ploteazaDrum,culoareDrum)
E = calculeazaEnergie(img);
drumuri = selecteazaDrumuriVerticale(img,E,metodaSelectareDrum,numarPixeliLatime,ploteazaDrum,culoareDrum);
imgRez = uint8(zeros(size(img,1),size(img,2)+numarPixeliLatime,size(img,3)));
for i... |
%load Cactus_96frames
%load ParkScene_96frames
%load Kimono_96frames
%load CrowdRun_96frames
%load OldTownCross_96frames
%a=a/256;
%a=a/1024;
b=zeros(512,512,3);
%c=zeros(1024,1024,3);
for fm=1:32
%b(:,:,1)=a(1:512,1:512,fm+32); b(:,:,2)=b(:,:,1); b(:,:,3)=b(:,:,1);
b(:,:,1)=a(1:512,513:1024,fm+32); b(:,:,2)=b(... |
function H = hamming_weight(X)
% HAMMING_WEIGHT Computes the Hamming weight
% [H] = hamming_weight(X)
% returns the Hamming weight of the elements in X.
%% Initialize and check parameters
[m, n] = size(X);
H = zeros(m,n);
%% Compute the Hamming weight of each element in X
for i = 1:m
for j=1:n
valbin ... |
% stressstate.m
% Calculates the state of stress at an arbitrary point on a beam, given the
% properties of the I-beam's cross-section and three shear and moment
% equations.
% NOTE: Please pay close attention to the input and output units
% First created February 16, 2013 by Itai Axelrad
%
% Input Variables:
% x = Hor... |
function [ETE, ETy, E] = LS_Prep(y,X,Z)
[N,D] = size(X);
[N,K] = size(Z);
DK = D*K;
E = zeros(N,DK);
for i = 1:N
rank_one_mat = X(i,:)'*Z(i,:);
E(i,:) = rank_one_mat(:)';
end
ETE = E'*E;
ETy = E'*y;
|
close all; clear all;
im1='demo.jpg'
[OutputMap] = analyze(im1);
imagesc(OutputMap);
title('JPG');
figure;
im2='demo.png'
[OutputMap] = analyze(im2);
imagesc(OutputMap);
title('PNG'); |
function Y = readTenBarTrussOutput(outputfilename)
% Keyword that identify the requested output
keyword = ' NODE FOOT- U1 U2 COOR1 COOR2';
found = [] ;
% OPen the output file
f = fopen(outputfilename) ;
if f < 0
error('Something went wrong, the output file could not be opened') ;
en... |
function [ files ] = scanfile( root_dir )
files={};
if root_dir(end)~='/'
root_dir=[root_dir,'/'];
end
fileList=dir(root_dir); %扩展名
n=length(fileList);
cntpic=0;
for i=1:n
if strcmp(fileList(i).name,'.')==1||strcmp(fileList(i).name,'..')==1
continue;
else
fileList(i).name;
if ~fileLis... |
function [edgeStrong, edgeWeak] = double_threshold(Sthin, lowThresh, highThresh)
% Input: the thinned image, and the percent of the two threshold
% Output: the strong and weak edge
% do some assertion for the input
assert(lowThresh >= 0 && lowThresh<=100 ,'low threshold must be between 0 and 100 %')
assert(highThresh ... |
%% Initialization section
clear all;
close all;
%loadlibrary('BEMatlabLib.dll', 'MatlabLibBE.h');
% File with photon arrival times
ResultsFile='Flow_test.txt'; % The file with the output flow
DescriptionFile=['Description_',ResultsFile]; % The file with description of the parameters
format_strin... |
function val = Hn(kp,iz)
global Nk k
global Hint
if(kp<k(1))
val = 0;
return
end
if(kp>=k(end))
val = Hint(Nk,iz);
return
end
for i = 1 : Nk-1
ik = i;
if( kp>=k(i) && kp<k(i+1) )
ik = i;
break
end
end
k0 = k(ik);
k1 = k(ik+1);
val = (Hint(ik+1,iz)-Hin... |
function ROIH=roi_height(img,BW2)
%%%%%%该函数就是根据手指关节位置裁剪兴趣区域的高度
img=double(img);
cropimage=img;
%[L, N]=bwlabel(BW2,8);%%%%找出BW2中8邻域的连通域个数,输出L矩阵,个数为N。
[m,n]=size(BW2); %%%%求矩阵的行数m和列数n。
if mod(n,2)==0 % 边缘图像中点 n与2相除取余数
mid=n/2;
else
mid=(n+1)/2;
end
% 末梢关节
linesum=sum(cropimage,2); % 行累积,若是求每行之和,则为1
LN=length(... |
function [ gradY ] = VanDerPol( t, Y, args )
%VANDELPOL Summary of this function goes here
% Detailed explanation goes here
mu = 100;
% Syntax: xdot = PreyPredator(t,x,a,b)
gradY = zeros(2,1);
gradY(1) = Y(2);
gradY(2) = mu*(1-power(Y(1),2))*Y(2) - Y(1);
end
|
%TrainingData_File='csv_data/train_d.csv';TestingData_File='csv_data/test_d.csv'; FileName='input_data/elm_input_d';
%TrainingData_File='csv_data/train_w.csv';TestingData_File='csv_data/test_w.csv'; FileName='input_data/elm_input_w';
%TrainingData_File='csv_data/train_dw.csv';TestingData_File='csv_data/test_dw.csv'; Fi... |
%drawTotalProbes
% directory of reference atlas files
annotation_volume_location = 'E:\prJ\neuropixels\histology location analysis\allenCCF\annotation_volume_10um_by_index.npy';
structure_tree_location = 'E:\prJ\neuropixels\histology location analysis\allenCCF\structure_tree_safe_2017.csv';
pointListFolder = 'H:\NP... |
warning('off', 'Octave:broadcast');
addpath('../util');
printf('Reading images and labels...\n');
[training_images, training_labels, images, labels] = get_images_and_labels();
% 784 TOO MUCH!!! USE SUM!! BAD FEATURE! BUT USE OTHERS TOO
% sum, sum of top half, sum of bottom half
ti_top = training_images(1:end/2,:);
ti... |
function [] = RunplanA(max,t)
global deltaM1;
%RUNPLANA Summary of this function goes here
% Detailed explanation goes here
if max>=1
hwait=waitbar(0,'start>>>>>>>>');
for m=1:max
count = planA(t);
PerStr=fix(100*m/max); %fix是向0靠拢取整函数
str=['全体扫描轮次',num2str(PerStr),'%'];
waitbar(m/max,... |
%function [tip_diameter, sigma] = calculate_tip_diameter(params, R_pip)
%
% Calculate tip diameter for a given pipette_resistance
%
% Input - params.rho_pip -> ion concentrations in pipette (mM)
% e.g. [135 15 150] -> 150mM, 15mM, 150mM
% param... |
function [s_asw, expDates, name] = Asset_spread(bond, value_date, t0, EONIA, payments)
% This function filters the bonds according to the 'filter_bond' function,
% then, fixing a value_date, computes Asset Swap Spread over EONIA for
% every selected bond, where the set of floating leg is equal to the
% correspon... |
function [train, test] = DT_transform_features( ini_table )
% DT_transform_features - use thresholds or ranges to get...
% Boolean/discrete alternatives
% On input:
% ini_table: the data table;
% On output:
% table: the new data talbe after features transformation
% Call:
... |
clear;
close all;
clc;
load('Variables.mat');
% Tune crossover frequency to see good repsonse on control usage
wc = 5;
% Performance weight
W_p=makeweight(100,wc,1/3);
Wp=eye(2)*W_p;
% Controller Weight
Wu=inv([25,0;0,25]);
%% LQG
fprintf('LQG Controller\n');
fprintf('=============================================... |
function infsup(c)
%INFSUP Display of interval gradients in infsup notation
%
% infsup(c)
%
% written 10/16/98 S.M. Rump
% modified 04/04/04 S.M. Rump set round to nearest for safety
% take care of Matlab sparse Inf/NaN bug
% modified 04/06/05 S.M. Rump roundin... |
n = 10;n2 = 20;n3 = 40;
xlist = 0:0.01:1;
xs = 0.5*(1-cos(((0:n)+0.5)*pi./(n+1))); %chebyshev
fs = [0,0,0,0,0,1,0,0,0,0,0];
xs2 = 0.5*(1-cos(((0:n2)+0.5)*pi./(n2+1))); %n=20
fs2 = [0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0];
xs3 = 0.5*(1-cos(((0:n2)+0.5)*pi./(n2+1))); %n=40
fs3 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,... |
function data = convert_to_trials( data, dim1 )
%
% INPUTS:
% data = [time x n-electrodes]
% dim1 = window size in samples of desired trial (for ex: 2s * 2035 Hz)
%
% OUTPUT:
% data = [dim1 x (n-electrodes*time/dim1)]
%
% EXAMPLE:
% M = [(1:7)',(8:14)',(15:21)'];
% Mt= convert_to_trials( M, 3 )
% Convert vectors... |
%time steps of model
noTimeStepsFig1 = 5000; %assume each step is one year
%number of grid nodes of model
noNodes = 201; %assmume each step is a grid cell length
%subsample results
spaceJump = 1; %jump every-other grid cell
timeJumpfig1 = 100; % jump 1000 years
tPreAuto = round(tAutobreak/timeJumpfig1+1);
t... |
% determineThresholds
% ===================
% Determines the best thresholds in the fourier domain for each patch.
% The function takes a framed training image, a validation mask and a validation image (ground truth),
% together with a set of paramateters. It then calculates the optimal thresholds in the fourier domain... |
function r = solo_get_notes(x)
%
% Returns notes (documentation entered at time of experiment into
% the Solo GUI) for session in x.
%
% x is a loaded-from-disk Solo file.
%
% DHO, 9/07.
s = x.saved.NotesSection_notes;
r = strcat(s{:});
% Can use char(s) too but newlines are still present. |
opt = config();
[opt, rgb_buffer] = process_data(opt);
[denominator_ind, image_buffer] = calculate_denominator(opt, rgb_buffer);
norm_matrix = estimate_norm(denominator_ind, image_buffer, opt);
opt_matrix = graphcut_refine(norm_matrix);
depth_map = reconstruct_surf(opt_matrix);
figure, surf(depth_map);
|
% Hybrid Symbiotic Differential Evolution Moth-Flame Optimization algorithm(HSDE-MFO)
% Source codes demo version 1.0
% ... |
%%%%%%%function: getfdt()%%%%
function G=getfdt(G_unc, unc)
us=usubs(G_unc, 'fm', unc);
A=us.NominalValue.A;
B=us.NominalValue.B;
C=us.NominalValue.C;
s=tf('s');
G=simplify(C*inv(s*eye(4)-A)*B);
end
|
function [tr_i,tr_t,te_i,te_t] = nc_getdata
%NC_GETDATA Neural classifier get forensic glass data
% [tr_i,tr_t,te_i,te_t] = nc_getdata
% Use an example data set: the forensic glass data from the Proben
% collection as data
%
% Neural classifier, DSP IMM DTU, MWP97
% cvs $Revision: 1.1 $
load glass1.dat
... |
function raiz = falsaposicao (xl, xu, es, ni)
% xl = limite inferior -> a
% xu = limite superior -> b
% [xl, xu] = [a, b]
% es = precisão da raiz (se a raiz encontrada for menor ou igual a precisão, satisfaz a equação)
% ni = numero de iterações, se não encontrar uma raiz até esse numero sai do algoritimo
... |
%% Initialization
clc;clear;
AccuracyTotal = {};
addpath(genpath('../Functions'));
%% Load data
load('/dataslow/sheng/Project of Sheng/Results/sheng/Mat_TFA/Accuracy_gratings_esingles/Accuracy_14gratings316_RhmMdesingle2-80_SnsrMdall_p100_groupall.mat');
%startmatlabpool(12);
%% Calculate step
Baseline = 300;
Frequ... |
AF = AcquisitionFrequency;
[ca_measurements,ca_measurements_txt,ca_measurements_raw] = xlsread('Calcium_measurements.xlsx');
[ca_traces,ca_traces_txt,ca_traces_raw] = xlsread('Calcium_Traces.xlsx');
BBdistance_extra_beat = ca_measurements(:,end-3);
Nperiod_extra_beat = ca_measurements(:,end-2);
SNR = ca_measurements... |
for n = 1 : 100
disp(n);
end |
function image = p3m1(N,n)
% N=1024;
%
% n = 64;
s = round(n*sqrt(4/sqrt(3)));
a = floor(s/2)-1;
tile = rand(s);
% tile(1,:) = 1;
% tile(s,:) = 1;
% tile(:,1) = 1;
% tile(:,s) = 1;
% tile(:,(a-1):(a+1)) =1;
% tile(10:20, 10:20) = 1;
magfactor = 8;
tile = imresize(tile, magfactor, 'nearest');
n=ma... |
N=15;
n=15;
omega = 2*pi*(0:N-1)./N;
pp=(omega-2*pi/5);
j=1;
for i=-n:n
for l=1:N
x(j)=pp(2) +2*pi*i;
xx(j)=KronD(x(j),0);
%j=j+1;
end
x(j)=pp(2) +2*pi*i;
xx2(j)=KronD(x(j),0);
j=j+1;
end
x2(1:n)=pp(1:n) +2*pi*1;
stem(omega,x2)
%xx(j)=KronD(,0);
a=15*pi/5-omega;
b=(2*pi/5-omega)/2;
c... |
function [accImu, angImu, timeImu] = readInertial(dataset)
%
% Read inertial measurements and timestamps from the input files.
% See the README.txt for more information about the input format.
%
% INPUT: dataset : Name of the dataset (string)
%
% OUTPUT: accImu : Inertial accelerations [m/s^2] (Mx3 matrix... |
function test_suite = test_unequal_time_gf_long_tau_parallel_2D_6_sites
initTestSuite;
global in_NUM_EIGEN_VALUES_UP;
global in_NUM_EIGEN_VALUES_DN;
in_NUM_EIGEN_VALUES_UP = 17; % These are the smallest values that we can get away with such that the result still agrees with the brute-force results to within 0.1%
in_NUM... |
function test_main
A = spaugment(ones(5)); A(1,10) = 1; A(10,1) = 1; A(5,6) = 1; A(6,5) = 1;
map = metismex('PartGraphRecursive',sparse(A),2);
diff = 0;
for i=1:20
map2 = metismex('PartGraphRecursive',sparse(A),2,struct('seed',i));
diff = any(map ~= map2);
if diff, break; end
end
assert(diff)
for i=2:5
... |
function hD = My_helperMIMOChannelEstimate(rxData,ltfSC, prm)
% Estimate channel from the preamble signal data tones
[~, nltf, numRx] = size(rxData);
% nltf should be == numSTS
% Transmitted pilot mapping sequences
P = helperGetP(prm.numSTS);
Puse = P'; % Extract and conjugate the P matrix
denom = nltf.*ltfSC;
... |
function [] = plotline ( point, dirVector )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
end
|
function [z] = DB(zk)
%Decision block;
z = [1;1;1;1]*zk;
z_standard = [4;2;-2;-4]*ones(1,length(zk));
z_distance = abs(z -z_standard);
[~,N] = min(z_distance);
z = z_standard(N);
end |
%y=[ vecMu vecNu vecDelta varLamda varT ]
% Nk Ntr Ntr 1 1
acc = 5e-5;
generate;
Nk = 1;
varC = 1;
Ntr = length(groups);
vSigma = [0.8];
[x y info vecC vecY] = solvesdpsvm(Nk,varC,data,groups,'mkisvm',vSigma);
vecMu = y(1:Nk);
vecNu = y(Nk+1:Nk+Ntr);
vecDelta = y(Nk+Ntr+1 : Nk+Ntr*2);
... |
function summarizeFromIntermediate(sessions, nodeTypes, summary_pid, ops_pid, TPIntervals, interval, allEventTypes, allTypeNames, fid)
% wrapper function to summarize the data from multiple intermediates
% include throughput per interval, summary by pid,
fprintf(1, 'summarize all procs\n');
% aggregate by events the... |
function dXdXiEvaluated = dXdXi(obj,elements,xi,eta)
% dXdXi computes the dXdXi term of the metric for
% at the local positions (xi,eta) for the element. For the IrregularSquare grid.
%
% USAGE
% -----
% dXdXiEvaluated = obj.dXdXi(elements,xi,eta)
%
% INPUTS
% ------
% elements :: the elements numbe... |
function wt_long = wtLongAdjust(meanwt, sim)
rng(sim.seed);
% Presynaptic Spike Times
if length(sim.pPreSpike)==1 % homogeneous Poisson
mean_isi = sim.dt/sim.pPreSpike;
data.pre_spk_times = cumsum(exprnd(mean_isi,sim.T/mean_isi*5,1));
data.pre_spk_times = data.pre_spk_times(data.pre_spk_times<sim.T);
els... |
function c1Layers = c1Vector2LayerStructure(c1Vector, c1SpaceSS, c1OL, imgy, imgx)
%function c1Layers = c1Vector2LayerStructure(c1Vector, c1SpaceSS, c1OL, imgy, imgx)
% OR function c1Layers = c1Vector2LayerStructure(c1Vector, options)
%
%
%Serre c1 output is a vector, convert to a cell array organized by band
%within e... |
clear all
close all
load('summary.mat');
for i = 1:12
if i <= 7
betweenTimes(i,:) = sort(betweenTimes(i,:),'descend');
averageBetween(i) = mean(betweenTimes(i,1:find(betweenTimes(i,:)==0)));
uniqueTimes(i,:) = sort(uniqueTimes(i,:),'descend');
lengths(i,:) = sort(lengths(i,:),'desc... |
function [phantom, density,T1_phantom,T2_phantom,df_phantom] = brain_phantom(RFpulses, TR)
% This function builds an MRF phantom using the Brainweb anatomical phantom
% along with selected T1, T2 and pd values based on existing tables
% The anatomical model was described in:
% Design and Construction of a Realisti... |
function [n,ekN]=cexp(k,N)
% cexp Generate a discrete-time complex exponential
% [n,x]=cexp(k,N) generates a vector x of length N and unit energy that
% represents the N discrete values of a complex exponential of frequency
% k. That is, x(n)=1/sqrt(N)*exp(j 2 pi k n / N). The output vector n
% contains the correspondi... |
classdef MLP < handle
%MLP Class This class is the core of the implementation: it implements
%the MLP algorithm as described in the theory. It inherits the handle
%class to be able to make lasting edits of the variables
%% Properties of the class
properties
h1 % number of neurons in t... |
function x = morse_decode(sir)
m = morse();
for k = 1:length(sir)
if sir(k) == "."
m = m{2};
elseif sir(k) == "-"
m = m{3};
end
if isempty(m)
ch = "*";
return
end
end
x = m{1};
end |
function X_matrix = directsolve_weightedLS(PhWiPh_star,Y,W_l_inv,W_r_inv,Omega,variant,varargin)
%it_min_l2_w_fast_MC solves the least squares problem of the IRLS, adapted
%to the matrix completion setting.
%%% PhWiPh_star : (m x m) matrix
%%% Y : (m x 1) vector
%%% W_l_inv : (d1 x d1) matrix
%%% W_r_inv... |
function [Mesh, Sys] = GetBndMap(Sys, Mesh)
idsDD = find(Mesh.slab == Mesh.BC.DDschur);
RegEle = cell(length(unique(Mesh.elab)),1);
RegDoF = cell(length(unique(Mesh.elab)),1);
RegDoFmap = cell(length(unique(Mesh.elab)),1);
BndDoF = [];
for ie=1:Mesh.NELE
gIs = CalcGlobIndex(2, Sys.pOrd, Mesh, ie);
tmp =... |
% Matlab exercise main9b.m
% Demonstration of K-nearest neighbor classification
% for the Pima diabetes diagnosis
%
load pima
Kmax=120;
figure(1)
X_tr=X_tr(:,[1,2,3,4,5,6,7]);
X_te=X_te(:,[1,2,3,4,5,6,7]);
%
Ntrain=size(X_tr,1);
Ntest=size(X_te,1);
X_te=X_te-repmat(mean(X_tr,1),Ntest,1);
X_tr=X_tr-repmat(mean(X_tr,1),... |
function [ o1,o2 ] = neuralerr( teams,input,label,iteration,tp)
[m,n]=size(teams);
tp=tp/100;
iteration=iteration*30;
selection=zeros(1,n-3);
i=1;
for j=1:n-3
flag=1;
for k=1:j-1
if teams(i,k)==teams(i,j)
flag=0;
break;
end
... |
function [points2d,points3d,timeList,isPawVisible] = trackPaw_direct_local( video, ...
BGimg_ud, ...
greenBGmask, ...
initPawMask, ...
mirror_points2d, ...
... |
%--------------------------------------------------------------------------
% BangBang_Solution_States.m
% Calculates the optimal states for the Bang-Bang problem
%--------------------------------------------------------------------------
% See page 141 of Benson's PhD thesis
%------------------------------------------... |
function ambig_od(subjectnumber)
% function run_execinfo06_behavioral(subjectnumber,run,permute)
%
% subjectnumber -> ID number of the subject you are running
% which session of the ATD is this? 1 = prelim, 2 = main1, 3 = main2
% run -> number of current run
%-----------------------------------------------------... |
function co2()
%saves desired data from the large data set to new file
%websave takes data set to local file
websave('CO2.dat','http://scrippso2.ucsd.edu/assets/data/co2_data/co2_monthly/altc.txt');
fid = fopen('CO2.dat'); %local large data set file
fid2 = fopen('whyphy.dat','w'); %new file
%skip first 13 line... |
clear;
data = load('cluster_data.mat');
X = data.cluster_data;
eucD = pdist(X,'euclidean');
Z = linkage(eucD,'complete');
[h,nodes] = dendrogram(Z,0);
figure;
c = cluster(Z,'maxclust',4);
scatter(X(:,1),X(:,2),50,c)
centroid = zeros(4,2)
for cls=1:4
count =0;
for i=1:length(c)
if cls == c(i)
centroid(cls... |
function t= threshold(img, T)
Z = 255.*img;
X = size(img,1);
Y = size(img,2);
t = zeros(X,Y);
for i = 1:X
for j = 1:Y
t(i,j) = (Z(i,j)>=T);
end
end |
function [Tn,Wn] = mRK4(f,y0,I,h)
%mEuler Método de Runge-Kutta de orden 4
% resuelve el PVI y'=f(t,y), y(t0)=y0
% donde el vector I=[t0,t0+T] y h es el tamaño del paso
Tn=I(1):h:I(2); %la malla del tiempo
Wn=zeros(1,size(Tn,2)); %preset Wn
Wn(1)=y0; %Condicion inicial
for i=1:size(Tn,2)-1
Wn(i+1)=paso_RK4(f,Wn(... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXXX htet_tabulate_lateral_result XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Function : used to tabulate results for lateral systems
% Syntax : htet_tabulate_lateral_result(SYSTEMS)
% SYSTEMS - already processed Lateral Systems
% Stars : ... |
function [classify_output, classify_output2] = bo_misclass_wrapper_shuffle(neuron_index,...
psth_AB_trials, psth_CD_trials, steps,...
numperms, enssizes, max_A_trial, max_B_trial,window)
nindex = find(neuron_index);
ee=length(enssizes);
for enssize=enssizes(length(enssizes):-1:1)
for ii = numper... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.