text stringlengths 8 6.12M |
|---|
function javaview(surface_handle, filename, destination, source, open_html )
% Syntax:
% javaview(surface_handle, filename, destination, source, open_html)
%
% Description:
% This function generates output files for Javaview (www.javaview.de).
% It allows to display and interact with 3d-Graph not only... |
function [x]=normalize_tmm(x)
% case 3 % edgeR TMM (trimmed mean of M values)
% For TMM normalization, the calcNormFactors function in the edgeR package v3.12.0 [11] was used with default settings.
|
function loc = match(x,tab)
%MATCH Location of matches in a set.
% MATCH(x,tab) returns loc such that tab(loc(i)) = x(i).
% If x(i) is not in tab, loc(i) = 0.
%
% This function is a special case of ISMEMBER.
[dummy,loc] = ismember(x,tab);
|
function [ Distance ] = Get_Distance( n, coordinate )
% From atom coordinates to get the distance between atoms
Distance=zeros(n,n);
for i=1:n-1
for j=i+1:n
tmp=coordinate(i,:)-coordinate(j,:);
Distance(i,j)=norm(tmp);
Distance(j,i)=Distance(i,j);
end
end
end
|
% just testing, a short cut for running the model
clear; clear global;
epoch = 2^2;
record = trainAgent(epoch);
save('record','record');
checkDevelop() |
%Load AVL I-File combustion data
% LOAD_IFILE loads the specified AVL I-File into a MATLAB structure.
%
% input = LOAD_IFILE(filename,offset_correction)
%
% Set offset_correction = 1 to perform cylinder pressure offset
% correction as specified in the AVL I-File itself.
function result = load_ifile(... |
%% Text Printer
% reverse of List Reader
% takes in a list of KanjiVars, a filename, and a title string and creates
% a text file with those attributes
function textPrinter(tLine, kList, fName)
fid = fopen(fName,'w','n','Shift_JIS');
fprintf(fid,'%s\r\n',tLine);
for i = kList
fprintf(fid,'Kanji: %s\r\n',i.kanji);... |
clear all
close all
clc
%% Input data
k = 200;
iterations = 250;
relaxationFactor = 0.05;
rootChord = 0.2;
taperRatio = 1;
wingspan = 0.8;
airspeed = [30 0 0];
density = 1.225; % kg/m^3
alphaFly = 4;
twist = 0;
alpha0lift = 0;
alphaRad = alphaFly * pi/180;
alpha0liftRad = alpha0l... |
clear
syms x a b
y1=sin(x)/x;
y2=(1-sqrt(1-x^2))/(exp(x)-cos(x));
y3=((a^x+b^x)/2)^(3/x);
yl1=limit(y1,x,0)
yl2=limit(y2,x,0)
yl3=limit(y3,x,0) |
function varargout = testpreds(thr, test, pt, ploterrors)
% function varargout = testpreds(thr, test, pt, ploterrors);
% --------------------------
% Tests the predictions made by MERMPRED and returns statistics about their
% accuracy. Filters the mermaid data and picks one observation for each
% day, therefore observ... |
% Select probe indices that belong to a gene
% Based on probes2genes
%%% 25 Feb 2014
%%% collapse probes to genes
function probe2gene_indices = probeindices2genes(dataDir, donor)
% load the donor probe info and the expression matrix
load([dataDir '/normalized_microarray_donor' donor '/probe.mat']);
% load([dataDir... |
function [K,Fd] = elmt13(sys_vars,ul,xl)
% MAIN PURPOSE: GET STIFFNESS AND RESIDUAL VALUE (s,r)
% s=zeros(total_node_no,total_node_no); r=zeros(total_node_no,1);
% mat_para=[8,392,0]; % [g12,lambda,gc]
% mat_para=[8,392,0]; % [g12,lambda,gc]
% _________________ ELMT13.m ____________________
debug = sys_vars.debug... |
% Script to plot the fODF in a brain slice
clear; clc
path_to_mask = 'process_real_data/opt_dim_multi_mask.nii';
folder = {'process_real_data/ODF_folder/'};
%_________________________________________________________________________%
for i=1:length(folder)
folder_i = char(folder(i));
display (['Creating figur... |
%% solution of optimal control problem
clear all;
close all;
clc;
%% system matrices
load lmi_test_dt_sys.mat;
%% define closed loop systems
S1 = A_aug{1} + B_aug{1}*K1;
S2 = A_aug{2} + B_aug{2}*K2;
S3 = A_aug{3} + B_aug{3}*K3;
S1F = A_aug{1};
S2F = A_aug{2};
S3F = A_aug{3};
%% define unknown variables
n = size(A_... |
function [adjucent_blocks_indices] = get_adjucent_blocks(index, current_block, blocks)
adjucent_blocks_indices = [];
for i = 1:length(index)
for b = 1:length(blocks)
if b == current_block, continue; end
if ismember(index(i), blocks{b})
adjucent_blocks_indices = [adjucent_blocks_indices... |
function r = genlind3fdxdp2(t,fd_cell,p,more)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% genlind3fdxdp2
%
% The third derivative of linear differential equations with respect to
% x (once) and p (twice) at times t.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function x=FactorizacionCholesky(A,b)
n=length(A);
x=zeros(n,1);
y=zeros(n,1);
U=zeros(n);
L=zeros(n);
%obtenemos L
for i=1:n
%para todas las filas
for j=1:n
%para todas las columnas
suma=0;
if (i==j)
%si el elemento esta en la diagonal
for k=1:i-1... |
%% Scene engine for static grating
spatialFreq = 2;
rmsContrast = 0.1;
chromaDir = [1.0, -1.0, 0.0]';
chromaDir = chromaDir / norm(chromaDir) * rmsContrast;
fovDegs = 0.50;
gratingScene = createGratingScene(chromaDir, spatialFreq, 'fovDegs', fovDegs);
%% Setup a cone mosaic & generate its corresponding render matrix... |
% time= simout.ACapCurr.Time(1:end);
% capA_cur= simout.ACapCurr.Data(1:end);
% capB_cur=simout.BCapCurr.Data(1:end);
% capC_cur=simout.CCapCurr.Data(1:end);
%
% capA_volt= simout1.ACapVolt.Data(1:end);
% capB_volt=simout1.BCapVolt.Data(1:end);
% capC_volt=simout1.CCapVolt.Data(1:end);
%
% InputCurr= simout2... |
function [pass,maxerr] = test(opt)
% Check error control of apt() towards wrong inputs
Dimension = 200;
t = linspace(-0.6,2,Dimension);
r = time2dist(t);
P = dd_gauss(r,[3,0.5]);
K = dipolarkernel(t,r);
S = K*P;
% Pass 1: More than one DDS value passed
aptK = aptkernel(t);
try
apt(S,aptK,[0.05 12... |
function feat_higher_level_2feat_5copes(session_dir,subject_name,runNums,func,run_feat,design_file)
% Creates a 'feat_higher_level_2feat_5copes.fsf' file in each bold directory for a given
% session directory.
%
% Usage:
% feat_higher_level_2feat_5copes(session_dir,subject_name,runNums,func,run_feat,design_file)
%... |
% A linear method for computing spherical conformal map of genus-0 closed triangle meshes
%
% Main program:
% map = spherical_conformal_map(v,f)
%
% Input:
% v: nv x 3 vertex coordinates of a genus-0 closed triangle mesh
% f: nf x 3 triangulations of a genus-0 closed triangle mesh
%
% Output:
% map: nv x 3 v... |
function[F_cluster12, F_cluster21] = F(member_matrix)
%this function measures the F1 score of the kmeans clustering
%it is being used for external validity of clustering for different no of
%PCs
image_count = size(member_matrix,2);
%cluster_num = size(member_matrix, 1);
Gender = importSoft();
keySet = unique... |
close all;
n = 1:0.001:100;
x1 = 7 * cos( 0.3 * pi * n + 0.3);
x2 = sin( 0.7 * pi * n - pi / 6);
sumx1x2 = x1 + x2;
figure();
plot( n, x1);
xlabel('n');
ylabel('x1(n)');
figure();
plot( n, x2);
xlabel('n');
ylabel('x2(n)');
figure();
plot( n, sumx1x2);
xlabel('n');
ylabel('x1(n) + x2(n)');
|
function cmap = f_colormap(n)
% - create a custom colormap
%
% USAGE: cmap = f_colormap(n);
%
% n = # color levels
% cmap = matrix of colors to use with colormap command
% -----Notes:-----
% This preliminary version only does shades of gray, but varies the values
% for rgb to colors;
% -----Author:-----
% by D... |
%% Demo of approximate inference on 2d distributions
%{
% Johnson and Albert p35
logtarget = @(X) smokingCancerLogpost(X);
target = @(X) exp(logtarget(X));
range1 = -1:0.1:6; range2 = 2:0.1:10;
%}
mu = [5 1]';
Sigma = [2 1; 1 1.5];
range1 = 0:0.1:10; range2 = -5:0.05:5;
truedist = MvnDist(mu,Sigma);
%{
prior = N... |
function [fwhm] = fn_compute_wavelet_fwhm(time_vec,freqs,n_cycles,varargin)
%% Compute the full-width at half-maximum in sec for frequencies of a wavelet signal
% Code based on Supplement from MX Cohen 2019 NeuroImage
% INPUTS:
% time_vec [array] - time vector for filtered data
% e.g. [-pad_len:1/sample_rate:... |
close all
clc
str = 'Сидоров Николай 101 521 899';
sum(str ~= ' ')
strnew = [str(9:15) str(8) str(1:7) str(16:27)]
strnew = strrep(strnew,'1','один ');
strnew = strrep(strnew,'2','два ');
strnew = strrep(strnew,'3','три ');
strnew = strrep(strnew,'4','четыре ');
strnew = strrep(strnew,'5','пять ');
... |
figure
for i=1:2 %real vs imag
for k=1:K % all sparse vals
subplot(2,K,(i-1)*K+k)
x2tilde = 0*xtilde;
x2tilde(I(k),J(k)) = (sqrt(-1))^(i-1); % = 1 for i=1 and =i for i=2
x2 = ifft2(x2tilde);
surf(X,Y,Z,real(x2),'EdgeColor','none');
MODESFFT(i,k,:) = x2(:);
vi... |
function [rxy, l, SD] = ccrs(x, y, nx, ny)
%% shift input signals to index nx and ny
A = x(nx : length(x));
B = y(ny : length(y));
%% determine length of correlation sequence
len = length(A) + length(B) - 1;
%% time reverse shifted input signal A
Ar = flip(A);
%... |
function [ Z ] = kssc_exact_par( X, lambda, num_neighbors )
[D, N] = size(X);
if (num_neighbors >= N)
num_neighbors = N - 1;
end
full_rows_mat = double(vl_kdtreequery(vl_kdtreebuild(X),X,X,'NUMNEIGHBORS',num_neighbors+1,'MAXNUMCOMPARISONS',10*(num_neighbors+1/10)));
[rows, cols] = process_neighbours(full_rows_m... |
function [adj, idx] = get_adj_from_kmeans_phase1(data, rep, num_clusters)
idx = zeros(size(data,1),rep);
fprintf('Step 1: running multiple kmeans ... '); fprintf('%3d%%',0);
for i=1:size(idx,2)
idx(:,i) = kmeans_phase1(data,num_clusters);
fprintf('\b\b\b\b%3d%%',round(i/size(idx,2)*100)); drawnow;
end
... |
global Pe Da N
Di=0.005;
k=0.01;
L=1;
u=0.01;
Pe=L*u/Di;
Da=k*L/u;
Pe
Da
N=fsolve('shoot1',[0.1 -0.1],optimset('TolFun',1e-3,'Display','iter'));
[t y]=ode45('goveqn1',[0 1],N);
1-y(end,1)
plot(t,y(:,1),'g') |
function [score] = AUC_Borji(map1, map2)
% map1: Saliency map
% map2: Fixation pts
stepSize = .1; % for sweeping through saliency map
Nsplits = 100; % number of random splits
score=nan;
% normalize saliency map
map1 = (map1-min(map1(:)))/(max(map1(:))-min(map1(:)));
if sum(isnan(map1(:)))==length(map1(:))
... |
clear all
close all
set(0,'DefaultFigureWindowStyle','docked')
rosshutdown
rosinit
warning('off')
% while 1
% getMsg
% pause(0.01);
% end
% %% Get RGB and Depth Messages from ROS
%
% function getMsg
clear('pub','sub','node')
node = ros.Node('/driving');
qrCode = rgb2gray(imread('FollowMeQr.png'));
rgb = rossubscriber(... |
classdef (Abstract) Domain < handle
%DOMAIN represents a variable domain, i.e. where a variable is defined.
% This class defines the interface for the subclasses of Domain.
properties
end
methods
function data = gridded( obj, variable, grid )
obj.assert_variable( variable );
assert( isa... |
function playTone(freq,length)
% function s = playTone(freq,length)
% freq: frequency in Hz
% length: sound length in seconds
global pahandle;
rate = 48000;
len = round(rate*length);
s = sin((1:len)*2*pi*freq/rate);
s(1:50) = s(1:50).*(1:50)/50;
s(end-49:end) = s(end-49:end).*(50:-1:1)/50;
% Fill the ... |
function VI = interp3rdDim(x, V, xi, varargin)
% uses built-in interp1 to do interpolation of the 3rd dimension of volume
% data.
%
% For help other than input V and output VI, please refer to interp1.
%
% V and VI are both R x C x K matrices, where V(r, c, :) and VI(r, c, :)
% are 1d signals that can be view... |
function Data=FilterJumps(Dates,Data,Name)
Chgs=diff(Data);
DatesChgs=Dates(2:end);
ChgsNoJumps=Chgs;
DatesChgsNoJumps=DatesChgs;
Reject=find(abs(Chgs)>7*median(abs(Chgs))); % reject outliers
ChgsNoJumps(Reject)=[];
DatesChgsNoJumps(Reject)=[];
ChgsJumps=0*DatesChgs;
ChgsJumps(Reject)=Chgs(Reject);
Plo... |
function y=fivenurbes(a0,a1,da0,da1,dda0,dda1,t,k)
J=[1,0,0,0,0,0;0,0,1,0,0,0;0,0,0,0,1/2,0;-10/k^3,10/k^3, -6/k^2, -4/k^2,-3/(2*k),1/(2*k);15/k^4, -15/k^4,8/k^3,7/k^3,3/(2*k^2),-1/k^2;-6/k^5,6/k^5,-3/k^4,-3/k^4,-1/(2*k^3),1/(2*k^3)];
a=[a0;a1;da0;da1;dda0;dda1];
y1=J*a;
theta1=y1(1,1)+y1(2,1)*t+y1(3,1)*t^2+y1(4,1)... |
function [data,cfg] = pa_spk_readsrc(cfg)
% [DATA,CFG] = PA_SPK_READSRC(FNAME)
%
% Convert a stimulus-based SRC-structure in file FNAME to a trial-based
% DAT-structure. The CFG-structure contains all non-data, accessory
% information, such as filename, and analysis methods performed on the
% data.
%
% Fields ... |
function Y = Vect2Ket(V)
%--------------------------------------------------------------------------
% Vect2Ket(V) inputs a general complex vector A and returns a quantum state
% vector (i.e., a ket vector).
%
% INPUT:
% V: complex array of finite length n
%
% OUTPUT:
% Y: ket vector from n-dimentio... |
%
clear all
clc
%
%Declarations
x0= [0.7,0.7];
y0= [-1.5,3.0];
h = 0.05;
[t x]=calc_sRK4(x0,h);
[t y]=calc_sRK4(y0,h);
plot(x(:,1),x(:,2),'b-o')
hold all
plot(y(:,1),y(:,2),'m-x')
%Titles,labels, legend
xlabel('y(t)');
ylabel('dy/dt');
legend('Set 1', 'Set 2');
title('Problem 5');
|
clear
%----------------------------------------
%following:
%
%Morvan D. and Dupuy J.L
%Modeling the propagation of a wildfire
%through a Mediterranean shrub
%using a multiphase formulation
%Combustion and Flame 138:199-210 (2004)
%
%use the linear model for pyrolysis
%to get degradation, keep alpha, sigma, rho
%con... |
function criteria = compare_features(target_features,soundset_features)
% COMPARE_FEATURES - Ouput a structure of perceptual dissimilaries
% between target and sound combinations for each feature in the
% input soundset feature structure. In each dissimilarity vector
% each element i is the dissimilarity between the t... |
% chaos23.m
clear
%close all
clc
% INPUTS ==========================================================
col = [1 0 0];
%col = [1 0 0];
x0 = 0.1 ;
y0 = 0.1 ;
z0 = 0.1;
t1 = 0;
t2 = 50;
sigma = 10;
beta = 8/3;
%rho = 14; %28
N = 99;
rho = linspace(0,50,N);
% SETUP ======================... |
clc; clear;
[data, txt, raw] = xlsread('DataHW1.xlsx');
grades = {'F', 'D', 'C', 'B', 'A'};
data(:, 5) = zscore(data(:, 2)); % Physics
data(:, 6) = zscore(data(:, 3)); % Math
data(:, 7) = zscore(data(:, 4)); % English
data(:, 8) = sum(data(:, 5:7), 2); % Sum of all subjects' z-scores
data = sortrows(data, 8);
... |
function [ outVal, outGr, outHes ] = AlmostPertQuad( x0, VGH )
% Almost Perturbed Quadratic function
n = length(x0);
outVal = 0;
outGr = 0;
%constants
c = 100;
if VGH(1) > 0
innerPart = (1/c)*(x0(1)+x0(n))^2;
for i=1:n
outVal = outVal + i*x0(i)^2 + innerPart;
end
end
if VGH(2) > 0
outG... |
function [separate_event1, separate_event2] = cutevent(E)
% Description:
% The two types of events is slited in vectors homogeneous in respective
%types.
%
%% Input:
%Column vector (N,2). First column are the times of events and Second
%column the event 0 or 1.
%
% Output:
%Two column vectos (N,2) wi... |
function y=minpat(x);
% MINPAT - Minimo de un conjunto de patrones
% Copyright (c) Pedro L. Galindo (1998)
if size(x,2)==1,
y=x;
else,
y = min(x')';
end;
|
clc;
close all;
savedir=strcat(Input_File_Directory_Location,'\CTEAS_Output\','xtal_data.mat');
load(savedir);
if exist(outputsavelocation)==7
disp('CSV Save location already present, adding to directory.');
else
mkdir(outputsavelocation);
end
%Make a movie
if Want_A_Movie==1
%Concatenate a path to save the... |
function lessLog(jobDir, id)
% function lessLog(jobDir, id)
% lessLog(jobDir, 1);
% AUTORIGHTS
% ---------------------------------------------------------
% Copyright (c) 2014, Saurabh Gupta
%
% This file is part of the Utils code and is available
% under the terms of the Simplified BSD License provided in
% LICENS... |
clc
clear all
format long
warning off
alpha = 0;
% mpc = case9;
% mpc = case14;
% mpc = case30;
% mpc = case39;
% mpc = case57;
% mpc = case118;
% mpc = case300;
mpc = case1354pegase;
% mpc = case2383wp;
% mpc = case2736sp;
% mpc = case2737sop;
% mpc = case2746wop;
% mpc = case2746wp;
% mpc = ca... |
function main()
state = 'init';
while ~strcmp(state,'finito')
if strcmp(state,'init') % Initialization
rng(101)
delete(timerfind)
figure(1001);
clf
hold on
axis([-100 900 -400 400])
mapobject = Map();
h_start = Sprite('CData',imread('start.png')... |
function stock = cumulativeStock(transactions)
%cumulativeStock
% this function returns the number of items in stock after
% each transaction given a vector containing the list of transactions
%
% USAGE:
% stock = cumulativeStock(transactions)
%
% INPUT
% - transactions: Transactions (vector of whol... |
% Representation of a Stimulus
% Contains:
% Stimulus Length,
% Stimulus Type,
% Description of the Stimulus,
% Interval of interest
%
% Author: Tim Kreitzberg
%
classdef StimuIntDefinition
properties
Stimulength % Length of the Stimulus Inte... |
function [spk,spkTs] = makeSpikeTrainBinned(x,z,varargin)
%MAKESPIKETRAINBINNED Generates a spike train from a 2D distribution
%
% REQUIRED INPUTS
% x - The position of the animal
% z - The log probability map
%
% OPTIONAL PARAMETERS
% trackLength (300 cm) - The length of the track
% Fs (1e3 Hz) - The sample fr... |
% load('../B_maps/B0001.mat')
% deltaB_B0=max(max(max(sqrt(BsX_map_phi.^2+BsZ_map_phi.^2+Bsphi_map_phi.^2))))/Bavg
time_stamp_go_recalc=length(WTAE_evol)*(time_stamp-1)/length(time_scale)
time_scale_go=(1:length(WTAE_evol))*time_scale(end)/length(WTAE_evol);
tmax=time_stamp
tinit=15
t_tau_max=time_scale_go(tmax)*omeg... |
% Visualization and plotting
function [] = visualize_coulomb(t, q_pos, gamma_packet_width, ...
Z, A, e, ...
visualization_toggles)
[X, Y] = meshgrid(-2:.1:2, .1:.1:2);
V = ((-Z*e) ./ X) .* erf((sqrt(3/2)) * (X ./ Y));
if visualization_toggles(1) == 1
% plot q over time
figu... |
function d = dz_dw(w,p,z,param)
%VGAMPROD.DZ_DW Derivative of weighted input with respect to weight
% Copyright 2012-2015 The MathWorks, Inc.
[S,Q] = size(z);
R = size(p,1);
TruncateS = max(0,min(R-1,S));
d1 = p(1:TruncateS,:)-p(2:TruncateS+1,:) + 1;
d1 = reshape(d1,1,TruncateS,Q);
d = zeros(S,S,Q,'like'... |
#!/usr/bin/octave3.2
close all;
lena_img = imread('lena.tif');
lena_img = rgb2gray(lena_img);
% normalize lena_img to be in the range [0, 1]
lena_img = double(lena_img)/255;
% impulse functions from the lab1 handout
h1 = (1/6)*ones(1,6);
h2 = h1';
h3 = [-1 1];
lena_conv_h1 = conv2(lena_img, h1, 'valid');
lena_conv_... |
function [user]=loadUser(chavePrivada)
%Devolve uma struct do utilizador com esta chave privada
%No caso de erro, devolve uma struct com campos vazios
% Struct:
% id (chavePrivada)
% nome (contém o nome da pessoa em formato string de aspas)
% dataNascimento (contém a data de nascimento da pessoa em formato ... |
function OutputName = Recognition(m, A, Eigenfaces)
% descripcion de pasos....
%
% descripcion: Esta función compara dos caras al proyectar las imágenes en el espacio frontal y
% midiendo la distancia euclidiana entre ellos.
%
% argumento: m - (M * Nx1) Media del entrenamiento
% de... |
function [g, dg] = reps_dual(eta, r, q, epsilon)
Z = exp(r/eta).*q ;
a = r/eta - log(length(r));
A = max(a);
logSumExp = A + log(sum(exp(a - A)));
g = eta * logSumExp + eta*epsilon;
% dg = epsilon + logSumExp - sum(Z.*r)/(eta * sum(Z));
% dg = epsilon + logSumExp - sum(Z.*r) * exp( - log(eta) - A - log(sum(exp(a... |
function TestSignificanceOfResults()
%% Input Data
% baselineSuccesses = 151 + 150;
% baselineAttempts = 180 + 180;
% treatmentSuccesses = 164 + 165;
% treatmentAttempts = 180 + 180;
baselineSuccesses = 173 + 174;
baselineAttempts = 196 + 201;
treatmentSuccesses = 196 + 19... |
function y = df_sys(x)
dt = 0.02;
y = 1 + dt*( -0.2 );
end |
function [sys,x0]=segbotanim(t,x,u,flag,ts);
%pendubotanim S-function for animating the motion of the Pendubot.
% Ned Gulley, 6-21-93
% Copyright (c) 1990-1998 by The MathWorks, Inc. All Rights Reserved.
% $Revision: 5.6 $
% Editted by Dan Block
global PendAnim2
if flag==2,
u(1) = u(1) - pi;
shh = get(... |
function g = sigmoidGradient(z)
%SIGMOIDGRADIENT returns the gradient of the sigmoid function
%evaluated at z
% g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid function
% evaluated at z. This should work regardless if z is a matrix or a
% vector. In particular, if z is a vector or matrix, you should r... |
function [ w,y,err ] = CreeazaPerceptron( x,t,nrepoci )
[m,n]=size(x);
w=rand(n+1,1)*2-1;
y=zeros(m,1);
for e=1:nrepoci
p=randperm(m);
x=x(p,:);
t=t(p);
for i=1:m
xi=[x(i,:) 1];
out=xi*w;
if out>0 y(i)=0;
else y(i)=1;
end
end
end
err=nnz(gsub... |
function [ class,class_rate ] = Classification_function_lilun( test_data,tmp_A,tmp_D1,tmp_D2,maxL,LABELS,per_D_size,sparsitythres,tast_labels,X,test_A )
%对测试数据进行分类,并计算分辨率
%% 修改字典大小
% for j=1:maxL
% for i=1:per_D_size
% if tmp_D1(:,i,j)==zeros(size(tmp_D1,1),1)
% tmp_D1(1,i,j)=1;
% end
% end
% e... |
% THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION IS RELEASED "AS IS." THE U.S. GOVERNMENT MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, CONCERNING THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT ... |
ALGORITHM = 'FloodFill3D'; % Stops at locked ROI
%ALGORITHM = 'regionGrowing';% Does not stop at locked ROI -- (but, does not over write locked ROI)
if (~areTheseToolboxesInstalled({'Image Processing Toolbox'}) )
warndlg('Missing the required toolbox: Image Processing Toolbox');
return
end
% INITIALIZE
... |
function [sp_to_user]=get_sp_to_user(aligned_img,D,nPoints)
load mat/platform_calib.mat
close all;
figure;
imagesc(D);
figure;
imshow(aligned_img);
[x,y]=ginput(nPoints);
scale=100.3841/norm(median_transL-median_transR);
close all;
sp_to_user=zeros(nPoints,3);
for i=1:nPoints
z_3d=D(round(y(i)),round(x(i)))... |
function NXTBocht(radius, alpha, phi1, richting)
% bereken de afstand voor het buitenste wiel
s1 = (2*pi*(radius+5.85))/360 * alpha;
% bereken de afstand voor het binnenste wiel
s2 = (2*pi*(radius-5.85))/360 * alpha;
% bereken de bijbehorende tijd
t = s1 / phi1;
% bereken de snelheid voor het binnenste wiel
phi2 = s2/t... |
function max_delta = readData(k, N)
baseSize = 2*N+1;
% x_star = 3;
x_star = 5;
y_star = log(1+exp(x_star));
% задаем лин-триг сетку
j = 1:baseSize;
alpha = 2/(2+pi);
y0 = 0.5*y_star*(2*alpha*j/(baseSize)+(1-alpha)*(1 - cos(pi*j/(baseSize))));
prefix = strcat('linTrig/k12/n', num2str(N));
filename = strcat(prefix, '... |
%%
f_test = 1.8504e9;
% f_test = 1.849e9;
fs_range = 2e6;
side = 'B';
% side = 'R';
%%
clc;
Ps_start = getEta(instrs.el_in, instrs.el_out);
if side == 'R'
V_bg = 2.7;
else
V_bg = -2.7;
end
piezo_smoothset(V_bg);
pause(0.5)
hsattenSet_fast;
pause(0.5);
daq_r(INSTR.DAQ_highspeedvoltage{:})... |
function [ROC, PR, Tunique] = confusionMeasure(groundTruth,prob)
[T,idx] = sort(prob);
groundTruth = groundTruth(idx);
True = groundTruth == 1;
False = groundTruth == -1;
[Tunique,idxT] = unique(T);
Tunique = [Tunique; Inf];
idxT = [idxT; numel(T)+1];
FN = [0; cumsum(True)];
FN = FN(idxT);
TP = sum(True) - FN;
TN = ... |
function rank_refine_all()
p = get_paths();
data_dir = sprintf('%s/%d_%f',p.data_dir,p.feature_len,p.miss_rate);
p.data_path = data_dir
set_file=fullfile(p.dataset_dir,p.test_set,'ImageSets',p.test_sub_set,p.test_gt);
im_ids=load(set_file);
image_num=length(im_ids);
rank_dir=sprintf('%s/rank',data_dir);
if ~e... |
% Function to perform convolution without
% the use of conv() function.
function [y,n] = convo(x1,st1,x2,st2)
num1 = st1 + length(x1) - 1;
n1 = linspace(st1,num1,length(x1));
num2 = st2 + length(x2) - 1;
n2 = linspace(st2,num2,length(x2));
len = length(x1) + length(x2) - 1;
conv_num = st1 + st2 + len - ... |
function Nuclei = ExtractNuclei(imagename,T0,ShowImages)
% T0: intensity threshold for nucleus identification
% (default: 32)
AreaMin = 1000; % Nuclear area lower threshold
fsz = 40; % font-size in nucleus annotation image
% Read images
fprintf(['Processing sam... |
function[st_sw_frames] = get_st_sw_frames(tracking_data)
st_sw_frames = {};
for ipaw = 1:4
if isfield(tracking_data,'ptsraw')
if size(tracking_data.ptsraw.stance{ipaw},1) >= size(tracking_data.ptsraw.swing{ipaw},1)
npts = size(tracking_data.ptsraw.swing{ipaw},1);
else
... |
function meanOfAandB=multiDnanmean(A,B)
apnd1d = @(x) reshape(x,[1,size(x)]) ;
meanOfAandB=nanmean([apnd1d(A); apnd1d(B)]);
end |
function [wall,book,box1,box2,table] = cluster_segmentation(I,varargin)
%% Input parser
P = inputParser;
P.addOptional('start_point', [10,10], @isnumeric);
P.addOptional('reg_maxdist', 0.2, @isnumeric);
P.addOptional('down_ratio', 0.2, @isnumeric);
P.addOptional('hsize', 15, @isnumeric);
P.addOptional('sigma', 2.5, @is... |
function color_rgb = blue
color_rgb = {'color', [0.0, 0.0, 1.0]};
end |
function varargout = vkf(y,fs,f,p,bw,multiorder)
%VKF 2nd Generation Vold-Kalman Order Filtering.
% x = VKF(y,fs,f) extracts the order with frequency vector f from signal
% y with samplerate fs, using a 2-pole filter with a -3dB bandwidth of
% 1 percent of the sample rate. The output is a single waveform x.... |
function [x,y,e,bestR, iris_mask]= find_iris_ours(E)
Ycbcr = rgb2ycbcr(E);
e = edge(Ycbcr(:,:,1),'canny');
%e = edge(Ycbcr(:,:,1),'sobel');
e = edge(Ycbcr(:,:,1),'zerocross') ; %not bad
e = edge(Ycbcr(:,:,1),'log') ; %not bad
%e = edge(Ycbcr(:,:,1),'roberts'); %good for pupil
R = round((size(E,1)/2).*1.3);
sizeIm =... |
ZS=zscore(DenoisedTraces(idx_components+1,:),1,2);
ZS_std=std(ZS,1,2);
ZS=ZS(ZS_std>0,:);
%ZS=ZS([1:297 299:431 434:size(ZS,1)],:);
ZS=detrend(ZS')';
framerate=2;
x = linspace(0.2,size(ZS,2)/framerate,size(ZS,2));
y = linspace(1,size(ZS,1)/100,size(ZS,1));
CorrMatrix_dist=pdist(ZS,'correlation');
CorrMatrix=squareform... |
function [ras,R]=exampleraster(ev, ts,varargin)
% [ax_handle,data]=rasterC(ev, ts, varargin)
% pairs={'pre' 3;...
% 'post' 3;...
% 'binsz' 0.050;...
% 'cnd' 1;...
% 'meanflg' 0;...
% 'krn' 0.25;...
% 'ax_handle' [];...
% 'legend_str' '... |
function [pass,maxerr] = test(opt)
% Check that fitbackground() can fit fractal backgrunds
t = linspace(0,5,100).';
k = 0.5;
d = 3;
lam = 0.3;
bckg = (1-lam)*exp(-lam*k*(t).^(d/3));
k = 1;
d = 2;
bckg2 = (1-lam)*exp(-lam*k*(t).^(d/3));
k = 1.5;
d = 4;
bckg3 = (1-lam)*exp(-lam*k*(t).^(d/3));
data2fit = bckg(1:end);
da... |
function [FamRes,DevRes,PosRes]=proche2(FamR,FamC,DevC,valdes,FamRloc);
% function [FamRes,DevRes,PosRes]=proche2(FamR,FamC,DevC,valdes,FamRloc);
%
% INPUTS -> VALUES
%
% 1. FamR: Family of the element looked for -> 'HCOR'
% 2. FamC: F... |
clear all
path_data = '/home/pbellec/database/blindtvr/xp_2015_03/';
%label_contrast = 'rest_CBvsSC';
label_contrast = 'tvr_CBvsSC';
%label_contrast = 'task_CBvsSC';
%seeds = [74 75 140];
seeds = 67;
%% Load partitions
%[hdr,sc159] = niak_read_vol([path_data 'networks_sci180_scg162_scf159.nii.gz']);
[hdr,sc159] = ni... |
%{
Runs the tests defined in test_multicolor19F
%}
fprintf('Running automated tests for multicolor 19F app\n')
% find tests path and set this to current directory
cd(fileparts(which('runtests_19F')))
% run all tests defined in test_multicolor19F
runtests('test_multicolor19F')
% run only one test like this:
% runt... |
%% 求解函数y = 21.5+x(1)*sin(4*pi*x(1))+x(2)*sin(20*pi*x(2))在x1属于[-3,12.1],x2属于[4.1,5.8]内的最大值
% 目标函数参考的最优值:38.8503
x0 = [11.6 5.7]; % 这里的初始值如果取得偏离一点,结果就可能千差万别
% 不要问我为啥会选择这一个初始值,我是站在上帝视角选择的~~~
A=[]; b=[];
Aeq=[];beq=[];
x_lb = [-3 4.1]; % x的下界
x_ub = [12.1 5.8]; % x的上界
[x,fval] = fmincon(@Obj_fun_1,x0,A,b,Aeq,... |
[FileName,PathName] = uigetfile('*.set','Select the TrainSet');
TrainDataPath=[PathName FileName]
[FileName,PathName] = uigetfile('*.set','Select the TestSet');
TestDataPath=[PathName FileName]
%bcilab;
trainset = io_loadset(TrainDataPath)
testset = io_loadset(TestDataPath)
myapproach1 = {'Windowmeans' 'SignalProcess... |
function [x0, y0, A] = get_bullseye_center_LH( im, LB, UB, T1, T2)
% im is a grayscale image
% [T1, T2] are (hystersis thresholds) %
% [LB, UB] are mimumum/maximum blob-sizes to process
%%
% if ~exist('T1','var')
% T1=mean(All(im))+0.05*std(double(All(im))); %started at 0.5 (no) 0.4 (no) 0.3(no)... |
% Generate experimental setup and compute local covariances
% *************************************************
% The setup is stored in 'Data.mat'
%
% By Ronen Talmon (20.3.2012)
% *************************************************
%% Configuration
M = 2000; % No of samples
N = 200; % No of pertubations
L = 8; ... |
function varargout = PSK_BER_Curves(SNRs)
%PSK_BER_Curves Bit Error Rate plots for PSK signals over AWGN Channel.
% h = PSK_BER_Curves plots the bit error rate (BER) curves verus
% SNR per bit (Eb/No) for BPSK, QPSK, 8-, 16-, 32-PSK and 64-PSK signal
% constellations over AWGN channels.
%
% Gray mapping i... |
%% Numeric Integration using trapz
% we revisit example 1 and use the trapz function to estimate the integral.
% we compare our results to the analytic results and also look at the
% effect of sampling frequency
% trapz requires data vectors and integral requires a function and bounds
clear all; close all; clc;
% def... |
function Znext = ActivationFunction(W,Z,b,fun_choice)
%Computes activation function for multi-layer perceptron algorithm
% Input:
% W: n1 x n2 weight matrix - n1 = # of nodes in previous layer, n2 = # of nodes in next layer
% Z: n1 x 1 node value matrix - previous layer
% b: n2 x 1 bias vector
% fun_cho... |
function [] = ReduceFrames(FileNames, Num)
display('Starting ReduceFrames...');
if CountEnv({'InDir' 'Ins'}) < 2;
disp('Missing environment variables');
return
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.