text stringlengths 8 6.12M |
|---|
function pmarkPrm = getpmarkPrm(y, fs, plotopt, SFS_pitchcurve)
% GETPMARKPRM Get parameters for pitch marking function.
% Usage : pmarkPrm = getpmarkPrm(y, fs, plotopt, SFS_pitchcurve)
if nargin == 0,
[y, fs] = wavread('la.wav');
plotopt = 1;
SFS_pitchcurve = [176 163 150 147 146 145 146 ... |
% compile mex files
mex mex/fm2dGradient.cpp |
function ConvertedRules = ConvertEcoliRules(rules,gene_names)
ruleNum = size(rules,1);
for i = 1:ruleNum
if ~isempty(rules{i})
t = char(rules{i});
x_pos = strfind(t,'x');
while ~isempty(x_pos)
k = x_pos(1);
while t(k) ~= ')'
k = k + 1;
... |
function [Z] = zca2(x)
epsilon = 1e-4;
% You should be able to use the code from your PCA/ZCA exercise
% Retain all of the components from the ZCA transform (i.e. do not do
% dimensionality reduction)
% x is the input patch data of size
% z is the ZCA transformed data. The dimenison of z = x.
%%% YOUR CODE HERE %%%
s... |
function [out] = palingrove(ca)
% A palindrome is a word, phrase, or sequence that reads the same backward as forward
% (e.g., "racecar").
% To add symmetry to your orchard, you decide that every row in the grove should be a palindrome.
% Write a function that takes in a cell array outlining the plan for your... |
% leak current
%
% $Revision:$
%
function I_L= leak(V_m)
I_L = 0.04 * (V_m - -75);
|
% 1 2 3 4 5 6 7 8 9
% tAIX = [powerN, LR, presN, laneN, roomTemp, trialTime, repN, flyN, genoN
function normSpeeds = normSpeedOdorIn(tA, tAIX)
samplePeriod = .05;
nTraces = size(tAIX, 1);
preWindow = [30 60]./samplePeriod;
odorWindow = [60 90]./samp... |
function [R1,R2,U] = inv_abs_r(Q,R,X)
U = ones(size(R,1),size(R,2));
for j=1:size(Q,2)
% if(Q(:,j)'*X(:,j)<0)
if(R(j,j)<0)
R(j,:) = -R(j,:);
U(j,:) = -1;
end
end
% U = R < 0;
% %reLU
% R(U) = -R(U);
R1 = inv(R);
R2 = R1*R1; |
% Copyright 2014
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writin... |
function [ H ] = get_homography( pts1,pts2 )
%Computes 2D-2D homography between two images given a set of points for
%matching points in 2 images
%
mean_pt = mean(pts1);
tx = [1 0 -mean_pt(1);0 1 -mean_pt(2);0 0 1];
mean_pt_re = repmat(mean_pt,size(pts1,1),1);
diff = pts1 - mean_pt_re;
dist = sqrt(sum(diff.^2,2));
mea... |
clear all
close all
addpath('People - Code');
% load train data
[train_images, train_labels] = loadPedestrianDatabase('pedestrian_train.cdataset');
features = [];
image_num = size(train_images,1);
for i=1:image_num
im = reshape(train_images(i,:),160,96);
feature = hog_feature_vector(im);
features = [featu... |
function head_y_grad = head_y_grad(in1)
%HEAD_Y_GRAD
% HEAD_Y_GRAD = HEAD_Y_GRAD(IN1)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 22-Jun-2020 12:47:53
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
t2 = q1+q2;
t3 = cos(t2);
t4 = q3+t2;
t5 = cos(t4);
t7 = t3.*4.38012e-1;
t6 = t5.*7... |
function [DNshape] = C3D8_El_DShape(NE,xi,eta,mu)
DNshape(1,1)=-((eta - 1)*(mu - 1))/8;
DNshape(2,1)= ((eta - 1)*(mu - 1))/8;
DNshape(3,1)=-((eta + 1)*(mu - 1))/8;
DNshape(4,1)= ((eta + 1)*(mu - 1))/8;
DNshape(5,1)= ((eta - 1)*(mu + 1))/8;
DNshape(6,1)=-((eta - 1)*(mu + 1))/8;
DNshape(7,1)= ((eta + 1)*(mu + ... |
function data=calcRenyiEntropy(data)
totalwindow=length(data);
histparameter=128;
for windowindex=1:totalwindow
tempwindow=data(windowindex).winSound;
tempwindow = tempwindow - mean(tempwindow);
temphist=hist(tempwindow,histparameter);
for alpha = 1:3
data(windowindex).renyi(alpha) = entropy_ren... |
function [x] = popgrowth(x,r)
%Small function calculating return values
x = x.*r.*(1-x);
end
|
% FUZZYENH Fuzzy enhancement.
% J = FUZZYENH(I) performs the contrast enhancenment based on fuzzy logic
% to enhance the contrast of a breast ultrasound image I.
%
% Example:
% -------
% I = imread('BUSreal.tif');
% J = fuzzyenh(I);
% figure;
% subplot 121; imshow(I); title('Original Image');
% subp... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Symbolic Model for a 5 Link biped in 2D
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
clc
% This is for the biped model, with right foot on the ground, walking left to right. The model is
% for five degrees of freedom of the robot, with Foot1 touching the ground
... |
function priorvalue=VTD_Landscape_Model_Fitting_v1_EvalPriors(compparamvalue,paramnumber)
if paramnumber==1
%WNT
elseif paramnumber == 2
%FGF
elseif paramnumber == 3
%a0
priorvalue = pdf('Gamma',-compparamvalue,21,0.6);
elseif paramnumber == 4
%b0
priorvalue = pdf('Gamma'... |
opengl('save', 'software')
load('DATA0000_raw.mat');
%Extract walking and toe walking data from 3 subjects
SharonW = MyData(6400:12399,:); %SharonW
SharonT = MyData(18900:24899,:); %SharonT
DavidW = MyData(38000:43999,:); %DavidW
DavidT = MyData(50500:56699,:); %DavidT
JoeyW = MyData(68450:75049,:); %JoeyW
Jo... |
function [coefs,fits,deResp,stimID,visOri,visCon] = ...
makeStimGLMs(stimExpt, distThresh)
if nargin<2
distThresh = 25;
end
distConv = stimExpt.xConvFactor;
respFrameRange = 0:10;
nFolds = 50;
%% TEMPORARY FIX FOR BASELINE ERROR!!
for n = find(sum(stimExpt.dF_deconv<0,2)>0)
stimExpt.dF_deconv(n,:) = sti... |
function [ret,loaded] = atsif_isloaded()
%AT_U32 ATSIF_IsLoaded(AT_32 * _i_loaded)
%
%Description : This function is used to determine if a SIF file is currently loaded.
%
%
%Arguments : NONE
%
%Return : ret - Check the help for return code meanings
% loaded - 1 if loaded, 0 if ... |
function cmd_help(args)
%CMD_HELP displays some general MAESTRO help.
% CMD_HELP(ARGS) displays some relavant commands to getting help with MAESTRO.
%
% See also CMD_COMMAND CMD_COMMANDS
%
% Copyright (C) 2009-2010 James Dalessio
% Display the copyright information.
mtalk(mcopyright);
% Display some help.
mtalk... |
S0 = 100; r = 0.04; sigma = 0.3; K = [90 100 110]; T = 1; n = [4 12 50]; M = 1E5; alpha = 0.95;
%% Nothing should be printed on the command window. If the results are needed to be shown, one would need to print the variable
%% Question 3
expected_asian_lower_bound = [];
expected_asian_lower_bound_delta = [];
geome... |
function [output] = validlines(tangentlines,rnm1,rn)
% Function that computes if the set of tangent lines are not all parallel
% and do not intersect at the same point
line1 = tangentlines(1:2);
line2 = tangentlines(3:4);
line3 = tangentlines(5:6);
line4 = tangentlines(7:8);
lines = [line1;line2;line3;line4];
alldiffe... |
function M = subsasgn(A,index,InputVAL)
%SUBSASGN Subscripted assignment for Laurent matrix.
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 26-Apr-2001.
% Last Revision: 20-Dec-2010.
% Copyright 1995-2010 The MathWorks, Inc.
% $Revision: 1.1.6.6 $ $Date: 2011/04/12 20:45:58 $
switch index.type
case '()'... |
clear all;close all; clc;
load Rho
for k = 51:53
n = int2str(k);
f1 = 'Fotos/';
f2 = '.jpg';
Foto = strcat(f1,n,f2);
img = double(imread(Foto))./255;
d = size(img);
fprintf(strcat('Foto número',int2str(k),'\n'));
fprintf('Seleccione el anillo interior al lunar \n')
anLunar... |
function execute(script_name,varargin)
try
syslog(strcat("Running ",script_name))
for jj=1:2:length(varargin)
define_var_string = strcat(varargin{jj}, " = ");
myclass = class(varargin{jj+1});
switch myclass
case 'double'
if length(varargin{jj+1}) ==1
... |
function [ mjd_out ] = datenum2mjd( datenum_data )
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
dates = datevec(datenum_data);
mjd_out = date2mjd(dates(:,1),dates(:,2),dates(:,3),dates(:,4), dates(:,5), dates(:,6));
end
|
function z = msigmareject(x,s)
%MSIGMAREJECT Summary of this function goes here
% Detailed explanation goes here
while(1)
z = x;
% Remove the bad sky.
x(abs(x-mean(x)) > s*std(x)) = [];
% Break if we have not removed any pixels.
if length(x) == length(z) || isempty(x), break... |
clear;
close;
clc;
function plot_line(a,b,str)
m = (b(2)-a(2))/(b(1)-a(1));
c = a(2)-m*a(1);
x = linspace(a(1),b(1),100);
y = m*x +c;
plot(x,y,str,'LineWidth',4);
endfunction
function plot_point(Q,str,offset)
plot(Q(1),Q(2),'ro','LineWidth',4)
text(Q(1)-offset(1),Q(2)-offset(2), str)
endfunction
%Matrix representati... |
function [xm,count] = bisection(f,a,b,tol)
%[xm,count] = bisection(f,a,b,tol)
%Approximates a root, xm, of function f bounded by a and b to within
%tolerance
%To help you understand the code, here is a explanation of some of the
%variables:
%a is the lower guess
%b is the uppper guess
%tol is the pre-specified toleranc... |
function fib_sequence = fibonacci(n,t1,t2)
fib_sequence = zeros(1,n);
fib_sequence(1) = t1;
fib_sequence(2) = t2;
for i = 3:n
fib_sequence(i) = fib_sequence(i-1) + fib_sequence(i-2);
end |
function pausa(time);
%
% pausa.m
% purpose: wrapper for pause with messages
% author: Filipe P. A. Fernandes
% e-mail: ocefpaf@gmail.com
% web: http://ocefpaf.tiddlyspot.com/
% date: 11-Sep-2009
% modified: 11-Sep-2009
%
% obs:
%
% force plotting of any figure
drawnow
if nargin == 1
disp('Pau... |
%%let score be the score matrix
score = [];
index_matrix = [];%stores index numbers for all combinations of 2 and 3 digit models
index = 1;
for i=1:3
for j=1:3
str = sprintf('%d%d', i , j );
index_matrix = [index_matrix str2num(str)];
end
end
for i=1:3
for j=1:3
for... |
function [A, B] = reflexKronApprox( K, m, n, Rtol )
%
% [A, B] = reflexKronApprox( K, m, n, Rtol );
%
% computes a kronecker sum approximation to the blurring matrix K
% that arises from the input PSF under reflexive boundary conditions.
% This approximation is done a-la Nagy-Ng-Perrone (see paper for details).
%... |
###############################################################################
# Creates a BloomFilter with the stop words
###############################################################################
# Author:
# --> Catarina Silva
#
###############################################################################
fu... |
%% 1f)
% Load Data
load('TouchToneMatrixNoise1.mat')
load('TouchToneMatrixNoise2.mat')
% Count the number of rows for each matrix. P.S. Since both matrices have
% the same dimentions, we only need to consider one of them.
R = size(TouchToneMatrixNoise1,1);
% Number of samples. Just like before, the number of... |
function [LM] = Lum_Mask(Image)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
[m, n, ~] = size(Image);
block = m*n/64;
LM = zeros(2,block);
i = 1;
for k = 1:8:m
for j = 1:8:n
img = Image(k:k+7,j:j+7,1);
img = img(:);
l = round(mean(img));
if (l <... |
load rock; nrock=numel(rock);
%%
%Choose_rock
for ir=1:nrock
disp(sprintf('%4d: %s',ir,rock(ir).name));
end
irs=input('Desired strong mineral phase: ');
irw=input('Desired weak mineral phase: ');
C=input('Weak phase abundance');
disp('Rheologies for strong phase');
nrheol=size(rock(irs).rheol,2);
for i... |
function [ ] = genreHistogram( distMatrix,genre )
if (strcmp(genre,'classical')) %%extract genre
distMatrix = distMatrix(1:25,1:25);
elseif (strcmp(genre,'electronic'))
distMatrix = distMatrix(26:50,26:50);
elseif (strcmp(genre,'jazz'))
distMatrix = distMatrix(51:75,51:75)... |
%% Start
clear all; close all; clc; fclose all;
LMfile = '\\mb-petinsert1\ListMode\Normalizations\20180814_NormAfterSetup_18h.lst';
savedir = '\\mb-petinsert1\ListMode\Normalizations\3E9Counts';
frames = [26642];
%% allocate and initialization
tic; clc
fid = fopen(LMfile,'r','l');
found = 0;
while ~found
number... |
function [DATASET] = CellSelect_Temperature(DATASET,temperature)
for dataset_num = 1:length(DATASET)
if str2num(DATASET(dataset_num).Temperature{1}) ~= temperature
DATASET(dataset_num).SensorID = [];
DATASET(dataset_num).IsVacuum = [];
DATASET(dataset_num).IsPreBaked = [];
DATASET(da... |
function varargout = components(varargin)
% COMPONENTS MATLAB code for components.fig
% COMPONENTS, by itself, creates a new COMPONENTS or raises the existing
% singleton*.
%
% H = COMPONENTS returns the handle to a new COMPONENTS or the handle to
% the existing singleton*.
%
% COMPONENTS('CALL... |
clear; clc; close all;
%% Input Signal (Step)
%% Input Signal (Sinusoid)
a = 1/5; % amplitude
T = 10; % experiment time
dT = 0.002; % sampling time
min_freq = 2*pi/T; % frequency
range = 1:200; ... |
function EEG_uni = unipolar(EEG_bipolar)
% This funcion converts the data from bipolar to unipolar.
% Input
% EEG_bipolar = EEG bipolar data set
% Output
% EEG_uni = EEG unipolar data set
% The data set, EEG_bipolar, is on the form
% Xb = MX
% Where
% Xb: the bipolar data set, ... |
%this script generates final prediction maps after averaging the scoremaps
%across different scales.
% This code assumes that the prediction scoremaps have already been
% generated for the mentioned destination folder with following naming
% convention: <folder_name>_<scale> e.g. egohands_0.6, egohands_0.8 and
% egoh... |
%A = zeros(19,2);
%for c = 1:24
% A(c,1) = c/20;
% A(c,2) = rosenbrock_linesearch_armijo(c/20)
%end
%plot(A(:,1), A(:,2))
%title('Convergence wrt \rho in Linesearch w/ Armijo')
%xlabel('\rho')
%ylabel('Iterations before ||-\Deltaf(x)|| <= 10^{-5}')
gradient_descent([1.2,1.2]', @eval_func, @grad_func)
gradient_desce... |
function ocr_regPath(dataPath, resultPath, time_budget, ...
true_gap, A, AplusB, stepType, eps_reg_path, gap_check, sample, useCache, ...
num_passes, maxCacheSize, cacheNu, cacheFactor, rand_seed, datasetName)
dataPath
resultPath
time_budget
true_gap
A
AplusB
stepType
eps_reg_path
gap_check
sample
useCache
num... |
clc,clear all,close all;
% im2double 0-1 arasına çeker. %
image = im2double(imread('tire.tif'));
c = 1;
gamma = 0.5;
image_new_1 = c * power(image, gamma);
c = 1;
gamma = 1.2;
image_new_2 = c * power(image, gamma);
c = 1;
gamma = 3;
image_new_3 = c * power(image, gamma);
c = 1;
gamma = 5.5;
image_new_4 = c * po... |
clear all;
% clc;
%direc='/Volumes/TOSHIBA/Seņales suizos tercero, cuarto, quinto y sexto escenario/Datos/Datos_raw/datos4.mat';
direc='/Volumes/TOSHIBA/Seņales suizos tercero, cuarto, quinto y sexto escenario/Datos/Datos_n/Scenarios_n/datos4_n.mat';
load(direc);
fs = 10;
%
% a=C4{1};
% b=C4{49};
% c=C4{97};
% d=C... |
function [] = plot_3D(S,G,t0,tf,r)
% Plot and check results for simple 2D, min velocity^2 C-CAPT.
% ASSUMPTIONS:
% Velocity constant (for velocity verification)
% Initialization ==========================================================
N = size(S,1);
% Time parameterization
%coeff = quintic_generate([0,1],[t0,tf])... |
function [qdd] = ModeloDinamico_RobotReal_cR(in)
% Variables de entrada en la funcion: [q(3) qd(3) Tau(3)]
q1 = in(1);
q2 = in(2);
q3 = in(3);
qd1 = in(4);
qd2 = in(5);
qd3 = in(6);
Im1 = in(7);
Im2 = in(8);
Im3 = in(9);
g=9.8;L0=0.6;L1=0.6;L2=1;L3=0.... |
clc;
%Initialisation
AF = zeros(1,360);
AE = zeros(1,360);
theta=1:360;
%ACCEPTING INPUTS..
N= input('\nEnter the number of Elements::->');
d= input('\nEnter the distance between the elements::->');
k= 360;
c= (k.*d)./2;
%%CALCULATING ARRAY FACTOR AND ARRAY ELEMENT...
num= ((1./N).*sind(N.*c.*(cosd(theta)+1... |
clc
format long G
% Contiguity Matrix
ConMatrix =[0 1 1 1 1 1 1
1 0 1 0 0 0 1
1 1 0 1 0 0 0
1 0 1 0 1 0 0
1 0 0 1 0 1 0
1 0 0 0 1 0 1
1 1 0 0 0 1 0 ] ;
% Sum of Contiguity Matrix Rows
s = sum(ConMatrix,2) ;
% Row Standardized Spatial Weights Matrix = Contiguity Matrix / Sum o... |
function [map1_resized] = resize_map(map1, map2)
if isequal(size(map1(:,:,1)),size(map2(:,:,1))) == 0
map1_resized = imresize(map1,[size(map2,1) size(map2,2)]);
%disp(['resized map from:' int2str(size(map1,1)) 'x' int2str(size(map1,2)) ' to ' int2str(size(map1_resized,1)) '... |
function [ XE4_1,dXE4_1 ] = XE4_1( context, H )
%XE4_1 ELECTRON DENSITY FOR THE INTERMEDIATE REGION
% REAL FUNCTION XE4_1(H)
% ELECTRON DENSITY FOR THE INTERMEDIATE REGION (HEF...HZ)
% USING THE NEW DEFINED FUNCTION
% COMMON /BLOCK3/ HZ,T,HST
% & /BLOCK4/ HME,XNME,HEF
%
if context.HST < 0.0
XE4_... |
t_s = 0.000625;
n = 32;
t_start = 0.000625;
t_end = n*t_s;
t = t_start:t_s:t_end;
y = 1.25*sin(2*pi*50*t)+0.5*sin(2*pi*100*t+pi)+0.25*sin(2*pi*150*t+1.5*pi)+0.125*sin(2*pi*200*t);
y_f = fft(y)*2/32;
dur = t_end - t_start;
sample_point = dur/t_s + 1;
fs = 1/t_s;
f_x = 0:1600/32:1600-t_s;
subplot(2,1,1);
plot(t,y);
title... |
% Multiply two quaternions together.
function quat = quatMult(qA, qB)
% Assumes the scalar component is q(4)
% Note that multiplication is not communitive.
quat = qA;
qAv = qA(1:3); qBv = qB(1:3);
quat(4) = qA(4)*qB(4) - dot(qAv, qBv);
quat(1:3) = qA(4)*qBv + qB(4)*qAv + cross(qAv, qBv);
end
|
function result = loadParameters(configFile, result)
if(nargin<2)
result = [];
end
fp = fopen(configFile,'r');
while(1)
tstr=fgetl(fp);
if(isnumeric(tstr))
break;
else
tstr = strtrim(tstr);
if(tstr(1)~='#' && ~isempty(tstr))
... |
function [ out ] = delete_bits( pic,delete )
%DELETE_BITS Summary of this function goes here
% Detailed explanation goes here
x = 1;
for i=1:delete-1
x = x*2;
display(x)
end
bit_muster = uint8((255-x)*(ones(size(pic))));
out = bitand(pic,bit_muster);
end
|
function [g,dg] = acrobot_running_cost(~,x,u)
R = 1;
g = sum((R*u).*u,1);
dg = [zeros(1,1+size(x,1)),2*u'*R];
return;
xd = repmat([pi;0;0;0],1,size(x,2));
xerr = x-xd;
xerr(1,:) = mod(xerr(1,:)+pi,2*pi)-pi;
Q = diag([10,10,1,1]);
R = 100;
g = sum((Q*xerr).*xerr + (R*u).*u,1);
... |
fileToOpen = strcat('plotLeapfrog','.dat');
fidPosi = fopen(fileToOpen);
nbRows = 4;
Plot_File = fscanf(fidPosi,'%g',[18 nbRows]).';
fclose(fidPosi);
bWantToSaveJPEG = true;
filename = strcat('fitscaling_n0.jpeg');
filename2 = strcat('fitscaling_r0.jpeg');
% Init of our time vector
t = [1 (nbRows)];
for i = 1: (nbRows... |
function ShowToeplitz()
% function ShowToeplitz()
% Examines the Toeplitz algorithms Durbin, Levinson, and Trench
% on a small random example.
% Generate T...
n = 5
T = gallery('toeppd',n)
T = T/T(1,1);
r = T(2:n,1);
clc
disp('T = ')
fprintfM('%7.3f',T);
r(n) = rand(1);
y = Durbin(r);
fprintf('||Durbin(... |
function displayVarTrack(cyc, fname, E)
% uses the varTracker.m function to save the information usually printed
% during a display down to a file. The user must provide a file name
% (fname) as a character array).
if length(cyc)>1
for i=1:length(cyc)
display(cyc(i));
end
return
end
[P, K, A, R, ac... |
% Embed the Message into the Provided Image
% The function takes a 3x3 array which represents the image to be encoded and
% a string message that will be encoded into the image. It returns a 3x3 array
% which represents the new encoded image.
function newImg = embedMessage(originalImg, msg)
startDateTime = datet... |
function [M,f] = autoGen_dynamics(phi0,phi1,th0,th1,dth0,dth1,u0,u1,uHip,F0x,F0y,F1x,F1y,qc0,qc1,rc0,rc1,g,l,c,m,I,Ifoot)
%AUTOGEN_DYNAMICS
% [M,F] = AUTOGEN_DYNAMICS(PHI0,PHI1,TH0,TH1,DTH0,DTH1,U0,U1,UHIP,F0X,F0Y,F1X,F1Y,QC0,QC1,RC0,RC1,G,L,C,M,I,IFOOT)
% This function was generated by the Symbolic Math Toolbox... |
function varargout = STFT_app(varargin)
% STFT_APP MATLAB code for STFT_app.fig
% STFT_APP, by itself, creates a new STFT_APP or raises the existing
% singleton*.
%
% H = STFT_APP returns the handle to a new STFT_APP or the handle to
% the existing singleton*.
%
% STFT_APP('CALLBACK',hObject,ev... |
function proxEVsys = getProxEVSys( Cpm,var,basisDecRule,Pxd,CpmProd )
import mbn.*
import func.*
Ncomp = length( var.X );
Ndec = cellfun( @(x) length( x.C ), Cpm(var.D) );
EVsys_basis = CpmProd.p;
for nn = 1:Ncomp
EVsys_basis = exp( log(EVsys_basis) + log(Pxd{nn}(:,basisDecRule(nn))) );
end
proxEVsys = {};
for ... |
function [G] = zopchol(A)
%cholesky decomposition based on rank-1 matrix update
%this problem can be formalized as A = [a b; b' B];
%then A = [ c d; d' D ]; and c = sqrt(a); d = b / c; and D = B - d*d' / a ;
[m, n] = size(A);
if m ~= n
error('support square matrix only')
end
G = zeros(n);
for k=1:n
G(k,... |
loadFile = 1;
%%
if loadFile
load('3ada8b_priming_neural_block_1_cond7_processed.mat')
end
processedSig7 = processedSig;
%%
if loadFile
load('3ada8b_priming_neural_block_1_cond4_processed.mat')
end
processedSig4 = processedSig;
%%
%chanIntList = 3;
trainDuration = [];
rerefMode = 'selectedChannels';
xli... |
function newGraph = addDummyNode(graph,centers)
%% Add a dummy node to the graph
% The dummy node is adjacent to all nodes EXCEPT the center(s).
%
% Usage:
% newGraph = addDummyNode(graph,centers)
%
% graph - in sparse matrix form (n-by-n)
% centers - a k-by-1 array of k integer indices for nodes NOT to connect
% ... |
function bool_first_feas = check_first_feasible_new(cur)
global t t_future R target_num;
%% ----------------------------------------------------------------------%%
% This is for just removing branches as much as I can, so the feasiblity is not
% necessarily exact. i.e.) Target may be outside of the host range for so... |
function desiRaman(src,event,fig)
%desiRaman - upload a Raman sample from Mads/Andrea into the toolbox and
%use the image masks as well.
%
% It requires the Raman images to be loaded into the matlab workspace.
% Reset the toolbox to make it ready to recieve new files
% Close annotation / manipulation windows
f0 = fin... |
function [c, ceq] = feasibility(X, swaps)
A = [0, 2; 1, 1];
B = [1, 2];
C = [0.5];
c = X*A*X' + B*X' + C;
ceq = [];
end |
function CalculateAverageFiringRate(Force)
mysqlconnect('edith');
% TheseCells = mysql('SELECT id FROM STC')';
if Force
TheseSessions = mysql('SELECT Session.id FROM Session')';
else % only calculate Sessions with missing data
TheseSessions = mysql('SELECT Session.id FROM Session,STC where Session.id=Sess... |
clear all %clear all variables
close all %close all figure
clc %clear screen
p =[0 0; 0 1; 1 0; 1 1]; %input vectors (input patterns)
t =[0 1 1 1]'; %target output
w = [-1.2 -0.5]; %initial weight
b = 1; %initial bias
%plot input, target, and initial weight(line wp+b =0)
%see help for plotpv and plotpc
pt = p'
tt = t... |
function QL = logq(Q)
% Calculate the logarithm map of quaternion.
%
% Input
% Q - quaternion matrix, (k x 4) x n
%
% Output
% QL - logarithm map, (k x 3) x n
%
% History
% create - Feng Zhou (zhfe99@gmail.com), 02-13-2009
% modify - Feng Zhou (zhfe99@gmail.com), 10-09-2011
% dimension
[k, n] ... |
% Aysar Khalid
% Problem 1: Detecting Lines
% The following function sets up the args to the main function (p1b)
% D is the threshold or # of pixels that must be within the line
% N is the number of iterations, more iterations = better results
% F is the number of lines to find, the more lines the better the ability to... |
% Main function, calling all steps of the tracking process. (Mod. R.Hopf, Januar 2014)
function [epsX epsY force]=main_uniaxial
addpath('preprocessing')
addpath('postprocessing')
addpath('functions')
%% sample specifications
% geometry
width = 14.85;
thickness = 1.65;
% cycle label
cycle = 'tens... |
%% PCE METAMODELLING: SIMPLY SUPPORTED BEAM - ESTIMATION OF STATISTICAL MOMENTS
% This example showcases an application of sparse PCE to the estimation of
% the statistical moments of the mid-span deflection of a simply supported
% beam subject to a uniform random load. The convergence behaviour of
% PCE-based and ... |
%This M-File Will Describe The Feature Selection Approach Has Done by The
%Wadworth Center for mu-based Brain computer Interfaces
%% clear
clc
clear
close all
%Let SessionXY = NTrials x NBands x NElectrodes
%% Data Loading and Settings
%eegSession = Csv2BciStruct('db\calibration\bci_users\popoli_a\right_hand\... |
%maze
clc;
% generate the maze as a 12x11 array
%maze.m
% starts at 9, ends at 8
% walls are 1 and passage is 0
maz = [1 1 1 1 1 1 1 1 1 1 1;1 1 1 1 1 9 1 1 1 1 1 ;1 0 0 0 1 0 1 1 1 1 1;...
1 0 1 0 1 0 0 0 1 1 1; 1 0 1 0 1 1 1 0 1 1 1; 1 0 1 0 0 0 0 0 1 1 1;...
1 0 1 1 1 1 1 1 1 1 1; 1 0 ... |
function pomdp_threebuttons_canon_messages(W,E,bb)
% set text properties
Screen('TextSize', W.n, E.textSize);
Screen('TextStyle', W.n, E.textStyle);
Screen('TextFont', W.n, E.textFont);
Screen('TextColor', W.n, E.textColor);
if bb>0
if (bb==1)
... |
%% Compute the matrix generated by the function generated by the Exponential distribution (non-vectorized form)
function sol = K(x,y,Nmod,KMean,varK,C1,C2,phi,Nx,Ny)
sol = zeros(Nx,Ny) ;
coeff = sqrt(varK*2/Nmod) ;
for i = 1 : Nx
for j = 1 : Ny
sum = 0 ;
... |
function wage_create(yearV, setNo)
% Create weekly wage, real
%{
Including business income share
Including zeros, but not negatives
2 versions:
- all: including zeros
- workers: only those with valid wages that are not outliers
Checked: 2015-july1
%}
cS = const_cpsearn(setNo);
fltS = output_cpsearn.var_load(cS.vFilt... |
function bhat = adjustAmdBhats(bhat)
% adjsutBhats(bhat)
% Adjust the values of the bhats
varStrings = {' ',...
'Ambient_Temp0',...
'Ambient_Temp1',...
'CPU_0_Temp', ...
'CPU_1_Temp', ...
'HT1Scaled', ...
'HT2Scaled', ...
... |
% Author: Chi Wang (chiwang1@illinois.edu)
% do ranking based on lda results pttopic file and mined patterns
function KERT(datapath, output, options)
%% input selection
% the name of term dictionary file
dictfile = [datapath 'word_index.txt'];
% the name of the topic model result file
pttfile = [datapath 'ptt.tx... |
%% Define Parameters and Initial Conditions
param.g = 9.81;
param.kappa =0.006;
u0 = 35 *cos(pi/4);
v0 = 35*sin(pi/4);
%% Settings up and Solving problem
x0 =[0;0; u0;v0 ];
tSpan = [0 20];
[tOut,XOut]= ode45(@ballTrajectoryFun, tSpan,x0,[],param);
%% Displaying the results
figure(1);
plot(XOut(:,1),Xout(:,2),'bo');
x... |
%clear;
disp('--------------')
%%
filename='overfit_param_pinv_7';
%filename='overfit_param_pinv_keep';
load( ['./results/' filename])
%%
x_axis = monomials
train_errors
test_errors
[N_train,~] = size(X_train);
title_fig = ['Training data size: ' sprintf('%d',N_train)]
%%
fig = figure;
fig.PaperPositionMode = 'auto';
t... |
function [labelVec] = convertLabels(labelsVar)
labelVec = zeros(size(labelsVar,1),1);
for i=1 : size(labelsVar,1)
[~,numericValue] = max(labelsVar(i,:));
%labelVec = [labelVec ; numericValue-1];
labelVec(i) = numericValue-1;
end
end |
[sig,Fs] = audioread('sample1.wav');
change_point(sig,Fs)
sig1 = [];
sig = sig.';
sig1 = sig ;
N = length(sig); % signal length
n = 0:N-1;
ts = n*(1/Fs); % time for signal
% define the window
wintype = 'rectwin';
winlen = 201;
winamp = [0.5,1]*(1/winlen);
% find the zero-crossing rate
zc = zerocross(sig,wintype,w... |
function [] = make_video_curves(frms, cst, curves, video, sq, folder, gm)
add_original = true;
add_single = false;
add_increasing = true;
add_curves = true;
add_original_slow = true;
add_tsr_dummy = false;
add_removal = true;
add_tsr = true;
add_gt = false;
rsz = 1;
name = sq.short;
low_contrast = sq.low_contrast;
... |
function shaperoa=rotateabout(shape,a,b,c,x,y,z)
% rotateabout.m
% Rotates a given shape about the point X,Y,Z (ACW)
% Rotation is A rad about x axis, B rad about y axis, and C rad about Z
% axis
s1=translate(shape,-x,-y,-z); % Translate the shape by (-X,-Y,Z)
s2=rotate(s1,a,b,c); % Rotate
shaperoa=translate(s2,... |
% quick_benchmark_mat_noise.m
% A quick benchmark on denoising for all matrix methods.
%
% Georgios Papamakarios
% Imperial College London
% Aug 2014
clc;
clear;
close all;
%% load data
datapath = '../data/';
%datafile = 'yaleb10.mat';
%datafile = 'highway.mat';
datafile = 'multipie10.mat';
load([data... |
function gps_point = Calculate_Next_GPS_Mat(gps_base,X)
% Correct after compare with http://andrew.hedges.name/experiments/haversine/
x = X(1,:);
y = X(2,:);
lat_offset = y/110540;
lon_offset = x/(111320*cosd(gps_base.lat)); % lat in degree, need to use cosd
% gps_point.lon = gps_base.lon + lon_offset;
% gps_point.lat ... |
function [x,y,z,I] = octahedron(a,Obj)
%% octahedron
% Finds the coordinates and moment of inertia of an octahedron of circumradius a
x = [1;0;0;-1;0;0]*a;
y = [0;1;0;0;-1;0]*a;
z = [0;0;1;0;0;-1]*a;
shape = [x,y,z];
s = norm(shape(1,:)-shape(2,:));
I = Obj.m*s^2/10; |
%======== subplots ========%
t = 0:0.2:5
s = 2*sin(t)
c = 2*cos(t)
subplot(1,2,1) ,plot(s)
title('sine wave')
xlabel('time')
ylabel('output')
subplot(1,2,2) ,plot(c)
title('cos wave')
xlabel('time')
ylabel('output')
|
function [T] = Detection_Twave(DERFI,leads,Sum_QRS,S,T_Deteciton_rule)
%Funkce Detection_Twave má za úkol detekovat začátek a konce vlny P
%Vstupy funkcí jsou: DERFI - přefiltrovaný derivovaný signál
% signal - přefiltrovný původní signál
% leads – počet svodů
% ... |
function [traces,out] = antrace(traces,fps,traceOpts) %#ok<*INUSD>
traces = traces(:,:,3);
if nargout>1
out = [];
end |
function analyse(filename)
data = csvread(filename);
figure('position',[7 716 846 233]);
subplot(1,3,1)
plot(mean(data))
ylabel('AVERAGE')
subplot(1,3,2)
plot(min(data,[],1))
subplot(1,3,3)
plot(max(data,[],1))
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.