text stringlengths 8 6.12M |
|---|
function [e,y]=saufg(a,n,x)
y=zeros(n+1,length(x));
y(1,:)=x;
for i=1:n
y(i+1,:)=a*y(i,:).*(1-y(i,:));
end
e=y(n+1,:);
end
|
function [ inputVals, targets ] = valueEst(windField,trainGrid,stepRightSize,plotValue)
% Create training data for neural net (regression)
% Given (x,y), tells the value of going right
% Could extend to give calue of going in every direction
% Unpacking training grid parameters
xBoundsTrain = trainGrid(1,:... |
function KLD = KL01(logP)
%KL_01 returns the Kullback Leibler information distance of clustering
% to choose the optimal number of clusters, see Guo and Landis (2017)
%
% dK = - sum_n ( log(sum_k wk p(Y_i | Y^{(k)-i}, theta_k)) ) /n
%
%Optimal weights are weights over clusters
%
% wk = 1 if i in k, 0 otherwis... |
figure(1);
clf
[x1, y1] = t2xy1(x);
X2 = t2xy2(x');
x2 = X2(1,:);
y2 = X2(2,:);
[p1_x0, p1_y0] = t2xy1(td_0(1));
p2_0 = t2xy2(td_0);
p2_x0 = p2_0(1,:);
p2_y0 = p2_0(2,:);
%f1 = F1(x);
%f1_2 = F1_2(x);
%max_f1 = max(abs(f1));
%max_f1_2 = max(diag(sqrt(f1_2'*f1_2)));
max_Fc = max(diag(sqrt(Fc'*Fc)));
hold on
plot(0... |
function P_rad_H_total=P_rad_H_nse(n_e, T_e,n_H_0,n_H_1,Vp,Vv,VnD,VnBe,VnC,VnN,VnO);
%free electron power loss due to H radiation including excitation, recombination and bremsstrahlung.
[PLT_H_0]=PLT_H(n_e,T_e);
PLT_H_M=[PLT_H_0]; %H's line radiation power coefficient matrix
[PRB_H_1]=PRB_H(n_e,T_e);
PRB_H_M=[PR... |
clear all
close all
% load in audio file
audioFile = 'happyBirthday.wav';
[input Fs] = audioread(audioFile);
% sum to mono if necessary
channels = size(input, 2);
if channels > 1
input = sum(input, 2);
input./channels;
end
file_length = length(input);
window_length = 50/1000 * Fs;
jump_size = floor(0.5 * win... |
%% Velocity & Acceleration Calculation
cph = 3600; % Containers per hour
disp_time = 5; % Dispensing time (s)
row_dist = 0.1; % Distance between rows (m)
a_time = 0.025; % Acceleration time (s)
rph = cph/10; % Rows per hour
spr = 60^2/rph; % Second per row
v = row_dist / (spr-disp_time) % Velocity (m/s)
a = v/a_... |
function a = expd(th)
a = exp(1i*th*pi/180); |
function maxProj
%Point to a folder to do maximum intensity projections of the images.
tic;
datadir = uigetdir;
cd(datadir);
mkdir projections
%filelist = dir;
platerow = ['A'; 'B'; 'C'; 'D'; 'E'; 'F'; 'G'; 'H'; 'I'; 'J'; 'K'; 'L'; 'M'; 'N'; 'O'; 'P'];
platerow = cellstr(platerow);
platecol = strvcat('1', '2', '3', '4'... |
function [ totalEnergy ] = coulombCalculateDipoleEnergy( latticeHeight,...
latticeWidth,coulombPositionMatrix,dipoleChargeMatrix )
%calculateDipoleEnergy does as the name implies
% This function calculates the energy associated with a crystal of
% dipoles. It does this by repeatedly calling individualDipoleEne... |
function nn = nnapplygrads(nn,batchsize,timestep)
%NNAPPLYGRADS updates weights and biases with calculated gradients
% nn = nnapplygrads(nn) returns an neural network structure with updated
% weights and biases
for i = 1 : (nn.n - 1)
if(nn.weightPenaltyL2>0)
dW1 = nn.dW{i} + nn.weightPena... |
close all
clear all
clc
Fs = 1000;
endTime = 50*Fs;
t = [1:50*Fs]./Fs;
subjectNo = 1:12;
Cxy_mat = zeros(length(subjectNo),1001);
Cxy_2_mat = zeros(length(subjectNo),1001);
Cxy_all = zeros(4,1001);
Cxy_2_all = zeros(4,1001);
[b_f_high,a_f_high] = butter(4,[6,15]/(Fs/2),'bandpass');
[b_f_low,a_f_low] = butter(4,5/(... |
% Aligning RGB Channels (using SSD)
% The goal of this project is to learn to work with images in Matlab by taking the
% digitized glass plate images and automatically producing a color image with as few
% visual artifacts as possible. In order to do this, you will need to extract the
% three color channel images, pla... |
function [br_cyc] = signal_extraction_test(vid_path)
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 16;
orde... |
function ROT = createRotationVector3d(A,B)
%CREATEROTATIONVECTOR3D Calculates the rotation between two vectors.
%
% ROT = createRotationVector3d(A, B) returns the 4x4 rotation matrix ROT
% to transform vector A in the same direction as vector B.
%
% Example
% A=[ .1 .2 .3];
% B=-1+2.*rand(1,3);
% RO... |
% t refers to the time at the earliest point we consider
function u = adams_bashford(y_0, h, t, fcnHandle)
u = y_0(:,2) + 1.5*h*fcnHandle(y_0(:,2), t+h) - 0.5*h*fcnHandle(y_0(:,1), t);
end |
function [C] = cumsum(X)
%--------------------------------------------------------------------------
%
% Copyright (c) 2012 Jeffrey Byrne <jebyrne@cis.upenn.edu>
% $Id: cumsum.m 104 2013-02-04 16:45:20Z jebyrne $
%
%--------------------------------------------------------------------------
%% cumululative maximum over... |
function [neighbourhood]=FindNeighbours(suppixel,boundaries,max_label)
neighbourhood=zeros(max_label);
neighbourx1=suppixel; neighbourx2=suppixel; neighboury1=suppixel; neighboury2=suppixel;
neighbourx1(2:end,:)=suppixel(1:end-1,:); NX1stats=regionprops(suppixel,neighbourx1,'PixelValues');
neighbourx2(1:end-1,:)=... |
function [] = SORRunner()
%SORRUNNER Summary of this function goes here
% Detailed explanation goes here
for N = [10 50 100 200]
while 1
brk = 1;
D = diag(rand(N,1));
U = orth(rand(N,N));
A = U' * D * U;
D = triu(A) + tril(A) - A;
b = randn(N, 1);
... |
function value_list = apply_filter_note(filter_instance,session_instance,knowledge_instance)
% APPLY_FILTER_NOTE - Specific apply function for the filter
% associated with the 'note' attribute.
%
% Usage: value_list = apply_filter_note(filter_instance,session_instance,knowledge_instance)
%
target_features = get_targe... |
function y = L2( v,v0 )
[n,m]=size(v);
sigma=0.4;
r=0.05;
D=0.02;
y(1,:)=25^2*sigma^2/2*(v0-2*v(1,:)+v(2,:))+25*(r-D)/2*(v(2,:)-v0)-r*v(1,:);
for i=2:n-1
y(i,:)=(24+i)^2*sigma^2/2*(v(i-1,:)-2*v(i,:)+v(i+1,:))+(24+i)*(r-D)/2*(v(i+1,:)-v(i-1,:))-r*v(i,:);
end
y(n,:)=(24+n)*(r-D)*(v(n,:)-v(n-1,:))-r*v(n,:);
y=max(y,0)... |
function [rootPath] = get_root_path()
pathstr = mfilename('fullpath');
[cur, ~, ~] = fileparts([pathstr, '.m']);
rootPath = fileparts(fileparts(cur));
end
|
function mouseClicked = checkForMouseClick
% Joshua Calder-Travis, j.calder.travis@gmail.com
%adapted by Sarah Ashcroft-Jones, sarah.ashcroft-jones@psy.ox.ac.uk
% Flag
mouseClicked = false;
[~, ~, buttons, ~, ~, ~] = GetMouse;
relevantButtons = buttons([1 3]);
while ~any(relevantButtons) % wait for press... |
function [PAR, peak, rms] = estPAR(input_signal);
%
% [PAR, peak, avg] = estPAR(input_signal);
%
% The PAR is the peak-to-average ratio, and is defined as
% the power ratio between the peak AC amplitude and the rms
% amplitude.
%
% The input_signal is in the time domain. The PAR, peak,
% and rms values are returned... |
%******Lendo imagens de diversos contrates de Einstein
img_high = imread("Einstein_high_contrast.png");
img_med = imread("Einstein_low_contrast.png");
img_low = imread("Einstein_med_contrast.png");
img_high_1 = imadjust(img_high, [0.1 0.5],[0.4 1]);
img_med_1 = imadjust(img_med, [0.2 0.5],[]);
img_low_1 = imadjust(... |
function [ meshEdge, sdEdge, edge2sd, node2Edge, node2sd] = ...
meshConnectivity( sdConn )
%Construct mesh connectivity data
%
%Input
% sdConn: subdomain/element connectivity
% when sdConn is a matrix,
% sdConn(i,:) are the nodes of element i
% when sdConn is a cell array of a 1D ar... |
function sbs_v=p_substitutes(clv,tol)
% P_SUBSTITUTES establishes which pair of players are substitutes using
% Matlab's PCT.
%
% Usage: sbs_v=clv.p_substitutes(tol)
%
% Define variables:
% output:
% sbs -- A matrix of maximal size(binom(n,2),2). Shows
% in each row the pair that are substitutes.
%... |
% State and measurement sizes
pose = 3;
lmk_size = 2;
%
num_poses = 3;
num_lmks = 4;
torad = pi/180;
% Factors (Valors obtinguts amb una regla de 3 mesurant en el paper el
% dibuix)
factors{1+0} = struct(...
'type' , 'pose',...
'measurement', [0;0;0],...
'covariance', diag([1e-8, 1e-8, 1e-8]),...
'i... |
function [nodeLabels, nodeDists, edges] = ...
buildDendrogram(adjMat, refId, minLen)
% Written by
% Alessandro Motta <alessandro.motta@brain.mpg.de>
assert(graphisspantree(adjMat));
nodeCount = size(adjMat, 1);
nodeDists = graphshortestpath( ...
adjMat, refId, 'Directed', fals... |
function M = esvm_perform_calibration(grid, val_set, models, params)
% 1. Perform LABOO calibration procedure and 2. Learn a combination
% matrix M which multiplexes the detection results (by compiling
% co-occurrence statistics on true positives)
%
% Copyright (C) 2011-12 by Tomasz Malisiewicz
% All rights reserved.
... |
% Files for the optimal control of two hybrid configurations using
% deteriministic dynamic programming (DDP) lab
% ================================================================
%
% Generic DDP functions
% =====================
% dynProg1D - Solving a dynamic programming problem in one variable
% dynProg2D ... |
function [fitresult, gof] = createFit_KsrT(T_all, K_all)
%CREATEFIT1(T_ALL,K_ALL)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : T_all
% Y Output: K_all
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also... |
function pbmwrite(arg1,arg2,arg3,arg4)
%PBMWRITE Write a PBM (portable bitmap) file to disk.
%
% PBMWRITE(X,MAP,'FILENAME') writes a PBM file containing the indexed
% image X and color map MAP to the file 'FILENAME'.
%
% PBMWRITE(X,MAP,'FILENAME','ENCODING') where 'ENCODING' is either
% 'ascii' (or 'plain') or ... |
function c = k_tf_mult(a, b)
% Transformations are [x y z q_w q_x q_y q_z].
%compose two 6DOF configurations
Na = size(a,1);
Nb = size(b,1);
if Na==1 && Nb>Na
a = repmat(a,Nb,1);
end
if Nb==1 && Na>Nb
b = repmat(b,Na,1);
end
%c = zeros(max([size(a); size(b)]));
c = a; %zeros(size(a));
c(:, 1:3) = a(:, 1:3) + k_... |
function [var_elem, right_endpoint_index, right_endpoint_coordinate] = ElementInterpolation(coordinates, num_elem, num_nodes_per_element, space_blocks, var_blocks)
% This function interpolates a block-structued variable into the physical
% domain. By default, values at the ends of boundaries are put into the
% previou... |
function yes = close_enough(x, target)
% returns yes = 1 if x close enough to target
ptol = 0.1;
vtol = 0.1;
if (norm(x(1:2)) < ptol) && (norm(x(3:4)) < vtol)
yes = 1;
else
yes = 0;
end
end
|
function [ ImageOut ] = GeneratePhantom( )
%Generates tubular phantom with artificial break points.
ImageOut = zeros(20,20,50);
for z = 5:20
for x = 5:15
for y = 5:15
if (x-10)^2 + (y-10)^2 < 15
ImageOut(z,x,y) = 1;
end
end
end
end
for z = 25:45
fo... |
tic;fprintf('%s: Flushing out hidden FFB setpoints (due to VCMs)\n',datestr(now));
setpv('SR01____FFBON__BC00',0,0);
pause(0.001);
setpv('SR01____FFBON__BC00',2,0);
pause(0.001);
setpv('SR01____FFBON__BC00',1,0);toc
... |
data=csvread('imu_040417.txt',1,0);
var(data(:,3:end-2))
|
function p = predict(Theta1, Theta2, X)
%PREDICT Predict the label of an input given a trained neural network
% p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the
% trained weights of a neural network (Theta1, Theta2)
% Useful values
m = size(X, 1);
num_labels = size(Theta2, 1);
% You need ... |
function [vapor_y_o,liquid_x_o] = insertMixture(vapor_y,liquid_x,zero_index)
size_o = length(vapor_y)+length(zero_index); %length of output
vapor_y_o =zeros(1,size_o); % initialize output to be all 0
liquid_x_o =zeros(1,size_o); % initialize output to be all 0
index_o = setxor(1:size_o,zero_index); %real index that we... |
function [VV,FF,birth,UT,E] = half_space_intersect(V,F,p,n,varargin)
% HALF_SPACE_INTERSECT Intersect a closed mesh (V,F) with a half space
% defined by a point on a plane the plane's normal.
%
% [VV,FF] = half_space_intersect(V,F,p,n)
% [VV,FF] = half_space_intersect(V,F,p,n,'ParameterName',ParameterValue,..... |
%% 1. Simulated trade of Quorzonium
% the price of Quorzonium over the past year is approximately normally
% distributed with mean $225 per ounce and standard deviation of $8. We
% assume there is no temporal correlation in the price (i.e. the value
% between any two given days is independent).
% a) simulate the tra... |
%motion planning to aid localize underwater sensor in minmum time and energy cost
%
%
%Underwter communication have to be considered bunch of error during
%process. Here we only consider the motion planning of the boat, so we
%don't precisely compute the error in the process. Thus, assume error
%concludes random error ... |
function [pose] = compute_energy1_realsense(pose, radii, blocks, settings, pose_id, iter, display)
if settings.energy1 == false, return; end;
centers = pose.centers;
data_points = pose.points;
%% Compute projections
[model_indices, model_points, block_indices] = compute_projections(pose.points, pose.centers, blocks,... |
% Display trajectories & results of simulation and computation of trajectories with bocop & hampath for different problems
% ----------------------------------------------------------------------------------------------------
% -------------------------------------------------------------------------------------------... |
function [Ba,Bb,alpha]=util(g,y,N,Ba,Bb,mm)
ti=[y(3),y(mm*N+3)]';
vi=[y(1),y(mm*N+1)]';
Ba(1,2)=1;
Ba(1,3)=-(vi(1)*(1/ti(1))^(3/2))/sqrt(2*pi);
Ba(3,3)=(2/pi)^(1/2)*(1/ti(1))^(3/2)*(ti(1)+1);
Ba(3,4)=1;
Bb(2,1)=-(2/(pi*ti(2)))^(1/2);
Bb(2,2)=1;
Bb(4,3)=-(2/pi)^(1/2)*(1/ti(2))^(3/2)*(ti(2)+1);
Bb(2,3)=(vi(2... |
function comparisonValues = compareOrderParams(x)
%load_javaplex;
exp_num = 1;
data = loadData(exp_num);
expData = data(1);
modelData = data(2);
naiveData = data(3);
expParams = extractOrderParams(expData);
modelParams = extractOrderParams(modelData);
naiveParams = extractOrderP... |
function [initialization] = findInitialization(img, mask, numClasses)
% Initial estimate is through the k-means algorithm. We look at all
% the pixel values inside the mask and performed k-means with 3 classes
% on the pixels inside the pixel. The inside pixels had the 3 labels
% 1, 2, 3 and the outside had labels... |
function [ X_quant ] = dequantize2D( X )
load('Q_L.mat');
X_quant = X.*Q_L;
end |
function [ D, imDims, L0, S0, GTidx ] = loadMatrix( data, varargin )
%% Loads experiments from a mat file
% with ground truth data if present
%
% Author: Vahan Hovhannisyan, 2017.
D = data.D;
imDims = data.imDims;
if isfield(data, 'GTidx')
GTidx = data.GTidx;
else
GTidx = ':';
end
if isfield(data, 'L0')
... |
if isunix
videoReader = VideoReader('traffic.ogv')
elseif ispc
videoReader = VideoReader('traffic.mp4')
end
traffic = imread('traffic_image.jpg');
road = traffic(200:end,:,:);
% imshow(road);
% edges = edge(rgb2gray(road), 'canny');
edges = edge(rgb2gray(road), 'sobel');
figure(1)
imshow(edges)
[H,T,R] ... |
function tmp
close all
clear all
clc
cd('C:\DATA\Double\MW-TG-2010-07-29');
fname1 = 'C:\DATA\Double\MW-TG-2010-07-29\MW-TG-2010-07-29-0001';
fname2 = 'C:\DATA\Double\MW-TG-2010-07-29\MW-TG-2010-07-29-0002';
[Sac,Stim]=loadmat([fname1;fname2]);
% load(fname)
% whos
indx = setdiff(1:400,Sac(:,1))
... |
saveFile = 'GANpyramidOut';
fileID = fopen('GANpyramid.txt','w');
formatSpec = '%s\n';
imageList = {};
str = {'cifar-10-batches-mat/*.jpg'};
filebatchNum = 1;
cifarData = load(strcat('cifar-10-batches-mat/data_batch_',num2str(filebatchNum),'.mat'));
resolution = [8,16]; % The levels of resolution for each image. The... |
function [err,insert,delet,subst, events_to_detect]=scorescript(trans_file, hyp_file, outfile)
%scorescript calculates the acoustic events error rate (AEER).
% usage: scorescript(trans_file, hyp_file, outfile)
% input:
% trans_file - annotation file
% hyp_file - hypothesis file
% ou... |
% u节点矢量,i参数。k选择类型
function X=getx(u,i,k)
if k==1
X=u(1,i+1)-u(1,i);
elseif k==2
X=u(1,i+2)-u(1,i);
elseif k==3
X=u(1,i+3)-u(1,i);
end |
function this = parse_input_parameter(this, param)
%PARSE_INPUT_PARAMETER parses and set parameters in the struct PARAM
%
% This is a member function of the class 'ba_optical_flow'.
%
% Author: Deqing Sun, Department of Computer Science, Brown University
% Contact: dqsun@cs.brown.edu
% $Date: 2007-11-30 $
% $Revision... |
run('/Users/Morbrick/Downloads/vlfeat-0.9.20/toolbox/vl_setup');
N = length(annotations);
unclusterdataset = zeros(600000,128);
scope = zeros(N,2);
count = 0 ;
index = 0 ;
for i = 1 : N
if annotations(i).class > 5
continue;
end
%count how many pictures from class 1 to 5
count = count ... |
% This script creates a file 'IIR.HI' with 100 4th order Butterworth
% filters with logarithmically decreasing cutoff frequencies for use in HI
% simulation on Teensy.
%
close all
fs = 44100; % Sampling frequency on Teensy
filterorder = 4; %Filter order of LP Butterworth
fc_start = 14000; % First LP cutoff frequency
fc... |
function a_grav = get_gravity( model )
% get_gravity spatial/planar gravitational accn vector for given model
% get_gravity(model) returns the gravitational acceleration vector to be
% used in dynamics calculations for the given model. The return value is
% either a spatial or a planar vector, according to the type... |
%% DEMI GANDY - REACTION-DIFFUSION - GRAY SCOTT 2D
clear; clc;
%% scenario (uncomment one) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% all presets listed here (exclusing rho) work with the inital conditions
% (ICs) given by "IC_xL2_n256.mat", or you can uncomment the "randomly
% generated rectangles" inital con... |
function Options = rlRepresentationOptions(varargin)
% rlRepresentationOptions: Creates options for RL agent representations
%
% opt = rlRepresentationOptions returns the default options for RL
% representations.
%
% opt = rlRepresentationOptions('Option1',Value1,'Option2',Value2,...)
% uses name/value pairs to... |
function [strucMatrix, strucLabels] = load_sc_as_one()
%
% Usage:
% [strucMatrix_ctx, strucLabels_ctx] = load_sc_as_one()
%
% Description:
% Load structural connectivity data (cortical + subcortical in one matrix)
% parcellated using Desikan Killiany (author: @saratheriver)
%
% Outputs:
% strucMatrix (dou... |
function sep = vertex_separators(G, map, Out, couples)
ndoms = length(Out);
sep = cell(ndoms, 1);
for i = 1 : size(couples, 1)
aborder = [];
for j = Out{couples(i, 1)}
nbr = find(G(:, j));
if any( map(nbr) == couples(i, 2) )
aborder(end+1) = j;
end
end
bbor... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create an MusicXML file for Multiple notes on set %
% %
% Author: Xiang Lin 10/09/17 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear, clc, close all
% ... |
function object=picktimes(object)
NoiseLimits = object.Settings.NoiseLimits;
SignalLimits = object.Settings.SignalLimits;
FitLimits = object.Settings.FitLimits;
if isempty(SignalLimits); SignalLimits = [NaN, NaN]; end;
if isempty(NoiseLimits); NoiseLimits = [NaN, NaN]; end;
if isempty(FitLimits); FitLimits = [NaN, NaN... |
clear; ca; clc;
cd __simulation\varHelixN\3_vars\pitch_0_50\varHelixN_16
fname = 'nn_findApex_3DoF_varHelixN';
% cd C:\Users\yang\ownCloud\MATLAB\__expTrainedExpData
% fname = 'nn_expTrainedExpData';
n_pdt_arr = 1:9;
n_pdt = length(n_pdt_arr);
%% error
merr = nan(1,n_pdt);
sterr = merr; minerr = merr;
hold on;
for... |
function run_CT_use_file(filename)
load(sprintf('%s%s.mat',filename));
[E_use comps_use] = SortEval_cruns(CT_use);
save('-v7.3',sprintf('%s_comps.mat',filename),'E_use','comp_use'); |
function [allData,hA_hM_5,lA_hM_6,hA_lM_7,lA_lM_8] = Sproj_analysisPipe_3_BandpassFilter(allData,hA_hM_5,lA_hM_6,hA_lM_7,lA_lM_8)
%% Bandpass filter
cfg = [ ];
%cfg.lpfilter = 'yes';
%cfg.lpfreq = 40;
%cfg.hpfilter = 'yes';
%cfg.hpfreq = 3;
%cfg.bpfilter = 'yes';
%... |
close all
clear all
pa_datadir;
[y,fs] = aiffread('cockroach.aif');
y = double(y);
y = y./max(y);
subplot(221)
t = (0:length(y)-1)/fs;
plot(t,y,'k-');
hold on;
xlabel('Time (s)');
ylabel('Amplitude');
box off;
axis square;
thresh = 3*std(y);
pa_horline([-thresh thresh],'r-');
%%
sel = abs(y)>thr... |
x = [-360:5:360];
y1 = sind(2*x);
y2 = cosd(2*x);
y3 = sind(x)+sind(2*x);
y4 = y1 + y2 + y3;
figure;
plot(x,y1,'b',x,y2,'c',x,y3,'m',x,y4,'y')
|
% Demonstrate classification/decision tree on 2d 3class iris data
% From http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/classdemo.html
requireStatsToolbox
% "Resubstitution error" is the training set error
%{
meas =
5.1000 3.5000 1.4000 0.2000
... |
% math_fft_01.m
% Fast Fourier Transform: decomposing a time series into
% frequency components
% Ian Cooper
% email: ian.cooper@sydney.edu.au
% School of Physics, University of Sydney
% 180712 / Matlab version R2018a
% DOING PHYSICS WITH MATLAB
% https://d-arora.github.io/Doing-Physics-With-Matlab/
clear
clo... |
function pfdata = ParseStripChartData(pfname, num_chs)
% ParseStripChartData - Parse a strip chart file generated by strip chart tool.
%
% pfdata = ParseStripChartData(pfname, num_chs) reads the strip chart file
% with the name pfname and returns the information in a matrix
%
% Input:
% pfname - name of the... |
function [b,dev,stats] = train_model( X, train, Labels )
% Fitting the Logisitc Regression with Cross Validation
[b,dev,stats] = glmfit(X(train,:),Labels(train),'binomial','logit'); % Logistic regression
end
|
function [] = MickeyUI(a,b)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if strcmp(get(a,'Label'),'Move')
set(gco,'ButtonDownFcn',@MoveUicontrolWithMouse);
end
if strcmp(get(a,'Label'),'Stop')
set(gco,'ButtonDownFcn','');
set(gcf,'WindowButtonUpFcn','');
end
end
|
function next_states = move_moth_q(q_state, P, Gridinfo)
n_x = Gridinfo(1,1);
n_y = Gridinfo(2,1);
n_theta = Gridinfo(3,1);
next_index = find(P(q_state(3), :));
next_p = P(q_state(3), next_index);
number_next = length(next_index);
next_states = zeros(number_next, 4);
for i=1:number_next
index = next_index(i);
... |
function [stateEstimate,varEstimate,Q,R] = AUKF(state,obs,f,h,Q_param,stationarity,Q,R)
% state an Nx1 vector, best estimate of the initial state
% obs an MxT matrx which contains T observations in R^M
% f a function handle which computes the dynamics as a
% function ... |
function convert_movie_to_TR(saveFile,movieFile,movieBlock,TR)
% Convert RGB movie with a certain frames per second to grayscale, sampled
% at the TR
%
% Written by Andrew S Bock Jul 2015
%% Set defaults
if ~exist('saveFile','var')
error('No ''saveFile'' input provided');
end
if ~exist('movieFile','var')
... |
function [outStruc,outSolSep] = pppImuSs(obsGnss,obsImu,corrData,PARAMS,settings,varargin)
%% Parse inputs
p = inputParser;
p.addParameter('truthPos',[]);
% parse the results
parse(p, varargin{:});
res = p.Results;
truthPos = res.truthPos; % Truth position input
%% Sort all of the GNSS and IMU measurement... |
function check(original,entrenamiento,prueba,graficar)
clases = 1:11;
index_class = length(original(1,:)); %Índice para extraer la clase
[orig_count] = histc(original(:,index_class),clases);
normoc=orig_count/sum(orig_count); %Cuentas normalizadas
[trcount] = histc(entrenamiento(:,index_class),clases);
normtr... |
function [value,opts] = getoption(opts,key,value)
%GETOPTION Extract a keyword argument from an argument list
%
%VALUE=GETOPTION(ARGS,'KEY',DEFAULT)
%VALUE=GETOPTION(ARGS,KEY=DEFAULT) in Matlab >= R2021a
% Extract a keyword argument, in the form of a pair "key,value" from
% input arguments ARGS (typically from VAR... |
function y=stdpat(x);
% STDPAT - Desv. standard de un conjunto de patrones
%
% y = stdpat(x);
% Copyright (c) Pedro L. Galindo (1998)
y = std(x')';
|
function [ hr_mean, hr_bps, hr_rmssd ] = heartRate( r_peaks_location )
% HEART RATE = 60 / (RR interval in seconds).
% creat a new vector for RR-peaks interval
vector = zeros(1,round(length(r_peaks_location)/2)+1);
jj = 1;
for ii = 2:length(r_peaks_location)
vector(jj) = r_peaks_location(ii)-r_peaks_location... |
function [oStruct,varargout] = invertSnowCloudRefl(reflectance,unknowns,varargin )
% [oStruct] = invertSnowCloudRefl(reflectance,unknowns,prescription,prop/val )
% [oStruct] = invertSnowCloudRefl(reflectance,unknowns,substance,prescription,prop/val )
% [oStruct,stats] = invertSnowCloudRefl(reflectance,unknowns,prop/... |
function sorting_options = default_options()
%Create default sorting options for WaveLimit, v1.3
%Adam Rouse, 4/23/20
sorting_options.max_ISI = 1.5; %Maximum Interspike Interval time to be considered a violation in ms
sorting_options.include_multiunits = true; %Keep units even if less than 1/2 waveforms appear to co... |
function [ graphVector, pqOpen] = expandVertex3( graphVector, idxNBest, idxX, idxGoal, pqOpen )
%EXPANDVERTEX Expands the node graphVector(idxX) by adding it to
%pqOpen with appropriate cost values and modifying it's graphVector entry.
%Then returns the modified versions of graphVector and pqOpen.
% graphVector is a... |
function [ z ] = MySubPlus( x )
z=x;
[len]=size(x);
for k=1:len
z(k)=max(x(k),0);
end
end
|
clear all
clc
[clap, Fs] = audioread('clap.wav'); % Read audio Mike.wav
[snap, Fs1] = audioread('snap.wav'); % Read auido Street.Wav
clap = clap(:,1); % They must be vectors to be able to use spectrogtam
snap = snap(:,1); % They must be vectors to be able to use spectrogtam
meanFreqClap = meanfreq(clap,... |
% load('particles_omega_spread_corr_Glisa140213_fc1h2.mat')
phipos_outputG_wrap=wrap2pi(phipos_outputG);
omega_outputG=theta_outputG-phipos_outputG_wrap;
omega_outputG=wrap2pi(omega_outputG);
alphas_psi0=psipos_outputG(:,1);
alphas_psi=psipos_outputG(:,end);
% ALPHAS_POPULATION=find(abs(alphas_lambda0-alphas_lambda)... |
% Example 9.15 -- Figure 9.12 : underdetermined solutions minimizing
% l_2 and l_1 solution norms. The one using l_1 is sparse.
clear all
close all
% create data
m = 260; n = 570;
J = randn(m,n);
xh = zeros(n,1);
for i = 20:20:260
xh(i) = 1 - 10/i;
end
b = J*xh;
% minimum l_2 norm solution
[U,S,V] = svd(J);
bb ... |
% Matlab script for chapter 3 of Bad Honnef tutorial on "Tangent space
% methods for Tangent-space methods for uniform matrix product states",
% based on the lecture notes: https://arxiv.org/abs/1810.07006
%
% Detailed explanations of all the different steps can be found in the
% python notebooks for the different cha... |
clear all
close all
% Run the simulation for a specific number of iterations
delay = 11;
iterations = 2350 + delay;
ts = 0.033;
% number of robots
N = 12;
% coupling matrix
L = [0 1 0 1 0 0 0 0 0 0 0 0;
1 0 1 0 0 0 0 0 0 0 0 0;
0 1 0 1 0 0 0 0 0 0 0 0;
1 0 1 0 0 0 0 0 0 0 0 0;
1 0 0 ... |
% This code combines gait parameter based on the calculated weight.
% Then, the results are analyzed.
%
% The parameter included in the combination:
% F_Swing_Time_(s)
% F_Stride_Length_(cm)
% F_Duty_Cycle_(%)
% BOS_Hind_(cm)
% Regularity_Index
% Body_speed
% Seq_AB_(%)
% F_MaxContactAt_(%)
% H_Stride_Length_(cm)
%
% T... |
function output = mapper(input1,input2)
%MAPPER Summary of this function goes here
% Detailed explanation goes here
est_rang = max(input2(:)) - min(input2(:));
input1_cropped = input1(input2>min(input2(:)')+0.2*est_rang & input2<max(input2(:))-0.2*est_rang);
input2_cropped = input2(input2>min(input2(:))+0.2*est_ran... |
export timeServerConstructor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% Types etc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const agentType <- typeobject agentType
end agentType
const BarrierMonitorType <- typeobject BarrierMonitorType
operation registerTime[t:Time]
ope... |
%% Estimating Road Clearance Using Gradient Descent
%% Initialization
clear ; close all; clc
wheelbase = 1.78;
vehicle_width = 1.58;
track = 1.3;
%% ==================== Part 1: Load Data ====================
load('road_clear_pos_rand_01_10.mat');
frame_id = 7 %randi(100,1,1)
% get frame configs
idx = find(config... |
layers = get_lenet();
load lenet.mat
% load data
% Change the following value to true to load the entire dataset.
fullset = false;
[xtrain, ytrain, xvalidate, yvalidate, xtest, ytest] = load_mnist(fullset);
xtrain = [xtrain, xvalidate];
ytrain = [ytrain, yvalidate];
m_train = size(xtrain, 2);
batch_size = 64;
layer... |
function flag = isNNData2Gpu(d)
%isNNData2Gpu Returns true if data is likely NNDATA2GPU formatted data.
% Copyright 2015 The MathWorks, Inc.
[dRows,dCols] = size(d);
rowsMultipleOf32 = rem(dRows,32) == 0;
lastRowIsNaN = all(isnan(d(end,:)));
flag = (dRows > dCols) || (rowsMultipleOf32 && lastRowIsNaN);
end
|
%% Alamouti Encoder
%
% ECE 6604: 4G MIMO Research Project
% Klaus Okkelberg and Abhishek Obla Hema
function y = fun_AlamoutiEnc(x)
N = length(x);
y = zeros(N,2);
y(1:2:end,1) = x(1:2:end);
y(2:2:end,1) = -conj(x(2:2:end));
y(1:2:end,2) = x(2:2:end);
y(2:2:end,2) = conj(x(1:2:end)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.