text
stringlengths
8
6.12M
function League=CreateInitialLeague() global ProblemSettings; global SCASettings; CostFunction=ProblemSettings.CostFunction; VarSize=ProblemSettings.VarSize; VarMin=ProblemSettings.VarMin; VarMax=ProblemSettings.VarMax; nTeam=SCASettings.nTeam; nMainPlayer=SCASettings.nMainPlayer...
function OK = WriteTFilesForReal(MCD) nClusters = length(MCD.Clusters); for x = 1:nClusters TimeStamps = MCD.FeatureTimestamps(MCD.Clusters{x}.mySpikes);%% save(fullfile(MCD.TTdn, [MCD.TTfn '_Cluster_' num2str(x)]), 'TimeStamps') OK = 1; end
% Team 20 - Signal Detection % Nov 14th, Simulation demo % Louis Rosenblum, Cayden Seiler, Khristian Jones %% Initialization close all; clear all; %% Sensor placement % Hardcoding sensor locations at (x,y) coordinates s0 = [0 0]; s1 = [100 0]; s2 = [0 100]; s3 = [100 100]; %% Spatial grid design % data structure ...
function [ indices ] = mergesort_function( cols, N ) %MERGESORT_FUNCTION addpath(genpath('../')); indices = 1:N; mergesort_helper_do_function(1, N); function [] = mergesort_helper_do_function(low, high) if low < high middle = floor((low + high) / 2); %middle = (int32(...
function vAnat2Analyze % convert a vAnatomy.dat file back to Analyze format % expecting readVolAnat.m to return volume in IPR orientation % re-orients to LAS for FSL compatibility [vAnatFile,vAnatPath] = uigetfile('*.dat','pick vAnatomy'); if isnumeric(vAnatFile) return end % img output is IPR oriented [i...
function varargout = MITOMIAnalysis_SetCoordinates(varargin) % MITOMIANALYSIS_GUI MATLAB code for MITOMIAnalysis_GUI.fig % MITOMIANALYSIS_GUI, by itself, creates a new MITOMIANALYSIS_GUI or raises the existing % singleton*. % % H = MITOMIANALYSIS_GUI returns the handle to a new MITOMIANALYSIS_GUI or the ...
% function zad3 clear clc M=19.9; t0=89+273; Ws=1.02; t1=18+273; ass=0.5:0.5:4.5; ds=[0 0.038 0.146 0.309 0.5 0.691 0.854 0.942 1]; WP=1-ds; c0=53.713; c1=33.41; % c0=54.849; % c1=31.311; W=100*M/(100+c0); S0=c0*M/(100+c0); S1=c1*M/(100+c0); M1=S1+W; m=S0-S1; mp=m/1; Wpp=1+mp; dd=fsolve(@(x...
function r = AGLQ(sub, x, a, b, c, d, p, ww, epsilon, C, k, type, varargin) % AGLQ.m % Adaptive Gauss-Legendre Quadrature % % Input: sub, 4 subscripts of the 4th order tensor T, 1 by 4 matrix; {????} % x, 3 semi-axes of an inclusion, a 3 by 1 matrix; % a,b, the integrating range of theta; % ...
%% Scripts for the vegetation rehabilitation model, according to figure order % 1) Equilibrium and response to droughts (2 sections) % 2) Impact of temporal noise (3 sections) % 3) Simulations with parameters comparable to remote-sensing data (2 sections) %% Initial setup (including perliminary simulations) lamf=3.25...
% Generated through Matlab % Author: Killian Keller % E-Mail: killian.keller@ief.ee.ethz.ch % Organization: ETHZ ITET IEF function [results] = QuantumEvaluation(model, varargin) % Function to Evaluate the evolution of the bosonic wavefunction. % Takes as arguments the model and the model ...
function state=divideNlevel(val,max,min,n) diff=(max-min)/n; a=min; for i=1:n a=[a min+i*diff]; end i=1; while(val>=a(i)&&i~=length(a)) i=i+1; end state=i-1; end
function structures = loadRT(dcm, imstruct, varargin) % loadRT loads a DICOM RT Structure Set (RTSS) file and % extracts the voxel segmentation/mask and metadata. If the centre of the voxel is inside the rtstruct polygon it is included. % % Important: The mask corresponds to image data loaded by loadRThelper, which...
wavname='C:\soundfiles\consonants\turner\ah-asha.wav'; wavname='c:\soundfiles\words\Words_diction\friends'; wavname2='c:\soundfiles\consonants\ah-aba-st.wav'; wavname2='c:\SoundFiles\sentences\timit\dr2_fram1_sx190.wav'; % Beginning Jan 25, 2012, T, C gains_dB and pw fields have elements % aligned with p.electrocd...
%% test the function spimpulse1207 % s-parameter contains all 1's % construct sp column vector sp = ones(1,11)'; fstep = 1; % here we assume fstep = fstart [ires, tstep, err, errmsg] = spimpulse1207(sp,fstep); tlist = [0:tstep:tstep*(length(ires)-1)]; irest = ires'; % transpose plot(tlist, irest); ...
%***************************************************************** % Description: calculate q and m in the network % Usage: % [m, q, mG, qG, m_std, q_std] = diffInNetwork(diff, half_ind, area, signed) % Input: % diff£ºthe difference variance maps of SZ-HC with dimension N x length(half_ind) % half_ind: t...
% HF MODEL % ----------- % ATRIBUTOS_PARA_ENTRENAMIENTO - DEFAULT INPUTS SEL_SNPSH_DISP = ''; % Selection of snapshot displacements % OPTIONS % 1) SEL_SNPSH_DISP = ''; Ignores this variables (selection follows .mfl file indications) % 2) SEL_SNPSH_DISP = 'ALL', the entire set of realizations of the displacement vecto...
r1 = 10; r2 = 6; D = 8; assistedRate = zeros(100,1); rate = zeros(100,1); SNR = zeros(10,1); pdfRate = zeros(10,1); directRate = zeros(10,1); Ps = 1; Pnoise = 1; for i = 1:10 alpha1=0.5; alpha2 = 1-alpha1; Psb = alpha1*Ps; Psm = alpha2*Ps; % beta1 = 6.6*10^(-5); % Psm1 = beta1*Psm...
function [ all ] = hnak(op,ass,all) %hnak - m/z analysis for the peaks found with H/Na/K adducts. For Luisa. %I'll put a better description in here when I've worked out how the %function is likely to work. % % INPUTs (* denotes optional input) % op - from lipid analysis toolbox % ass - also from lipid analysis too...
function plot_cameras(fig, cameras, axis_length) ax = gca(fig); F = size(cameras, 3); % Get camera centers. centers = zeros(F, 3); for t = 1:F P = cameras(:, :, t); R = P(:, 1:3); d = P(:, 4); centers(t, :) = (-R' * d)'; end lim = axis_limits(centers); init3(fig, lim); for t = 1:F...
function mtx = Normalize(mtx) %% Function that normalize input matrix by column %% each element x will be normalized by (x - mean) / stddev M = mean(mtx, 1); s = std(mtx, 1); mtx = (mtx-M)./s; end
function x = addSumLoops( n ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here tic; i=size(n,1).*size(n,2); y = 0; for j=1:i y=y + n(j); end x=toc; end
function [ action ] = deterministicPolicy(state, mdp, weights,use_fast_VOC1_approximation) if not(exist('use_fast_VOC1_approximation','var')) use_fast_VOC1_approximation=true; end %Thompson sampling for contextual bandit problems w_hat=weights; [actions,mdp]=mdp.getActions(state); for a=1:numel(actions) %parfor ...
% Load dielectric function for interphase function [] = comsol_load_epsilon_model(data) global epmodel extra_E_infi load(data); % Read in the MTD from the output of Dynamfit NumOfTerms = length(TemPR); for i = 1 : NumOfTerms - 1 MTD_Coeff(2*i-1)=TemPR(i,2); ...
clear; clc; load('peppers_bcsspl_dpcm_results.mat') load('peppers_bcsspl_MFPQ_results.mat') load('peppers_bcsspl_SDPC_ch8_results.mat') load('peppers_bcsspl_SDPC_ch16_results.mat') load('peppers_bcsspl_SDPC_results.mat') rate_SDPC = sort(rate_SDPC) rate_DPCM = sort(rate_DPCM); rate_M...
function dspcheck(Filename,Levels,PhotometerID,PortNum) % Sample script dspcheck v1.33 % % Check calculated XYZ values for monitor with photometer % % Usage:- dspcheck(DCFname,Levels,PhotometerID,PortNum) or % dspcheck(DCFname,XYZ,PhotometerID,PortNum) or % dspcheck(DCKname) % % DCFname = Display...
function char2file(C,FName,Type) % char2file [Not a public function] Write character string to text file. % % Syntax % ======= % % char2file(C,FName) % char2file(C,FName,Type) % % Input arguments % ================ % % * `C` [ char ] - Character string that will be written to the file. % % * `FNa...
function [img,H] = iradon(varargin) %IRADON Compute inverse Radon transform. % I = iradon(R,THETA) reconstructs the image I from projection % data in the 2-D array R. The columns of R are parallel beam % projection data. IRADON assumes that the center of rotation % is the center point of the projections, wh...
% Mixture Model BPS for T forecasts clear; clc; %====================% % Forecasts and Data % %====================% load('bps_eurForecastsFull.mat'); f=f1; s=s1; k=k1; % one step ahead forecasts % f=fh; s=sh; k=kh; % h step ahead forecasts clear 'f1' 'fh' 's1' 'sh' 'k1' 'kh'; % choose which models t...
%% 1. Una función que convierta de binario a base decimal. function [d] = bintodec(b) % BINTODEC % Esta funcion convierte un numero binario a decimal. % Formato de entrada: arreglo de numeros binarios ([(0|1) (0|1) ... (0|1) (0|1)]). d = 0; for i = length(b):-1:1 if(b(i) == 1) d...
function [handles] = plot_grand_averages_beamformer_masked(cfg, ... input_variables) % This function plots grand average beamfomers, first input variable should % be grand average beamformer and second should be statistics % % cfg must contain: % % cfg.event_comp...
function spectrogramData = preprocess_runs_spectrogram(runProcessedData,params_spectrogram) spectrogramData = runProcessedData; global verbose nRun = numel(runProcessedData); fs = runProcessedData{1}.rate; win = params_spectrogram.mlength*fs; noverlap = win - params_spectrogram.wshift*fs; for iRun = 1:nRun if v...
% function Fig12_OutsideOut_AsymmetricCl_v2 % % Show effect of asymmetric Cl concentration on anion current % Outside-out pipette containing 150mM K+, 10mM Cl-, and 140mM gluconate % Plot concentration and voltage-change at the end of pipette containing % 150mM KCl as a function of IK+*Raccess, and |INa+...
function traceOut = getTrace(finneeStc, address, varargin) %% DESCRIPTION % 1. INTRODUCTION % GETTRACE is used to retrieve a trace (profile, MS spectra, ...) that has % been save in the finneeStc. dataOut is the mxn array that contain all % data related to the specified trace. % % 2. INPUT PARAMETERS: % . re...
% Function creates a subject folder. Automatically checks which repetition % of the experiment it is and suggests to save session number % % Prespecified screen size and distance are necessary! % Multiple outputs as structure 'screen' containing all initalized display % properties % % v1 DJ: February 11, 2015 functio...
function top_bul(resim) I = imread(resim); bw = im2bw(I); [a,b] = bwlabel(bw); c = (a==2); s = regionprops(c, 'centroid') sz = size(c) merkez = s.Centroid if merkez(1) < sz(2)/2 yon1 = 'sol'; else yon1 = 'sağ'; end if merkez(2) < sz(1)/2 ...
function [res, txtns] = compareScriptSolStudent(callerName,nameVars,apCleaned,apStudentSol) %COMPARESCRIPTSOLSTUDENT A helperfunction for the testing the answers of %students by comparing it to a Solution file. % % ------------------------------------------------------------------------ % Copyright (C) 2017 M. Sch...
function l=prob_to_log_odds(p) % Convert proability values p to the corresponding log odds l. % p could be a scalar or a matrix. % TODO: compute l. l = log(p./(1-p)); end
clear close all clc file_name = 'lost.plt'; m=importdata(file_name,' ',6);% 6 rows for the column header. lost=m.data; [~,thet,zet,x,z,en,ptch,P,P0,mu_times_B,~,V,~,~] = valuation(lost); n=length(thet); k=0; t0=-pi/30; % FILD position midplane [-thet,thet], -thet=t0, thet=tm tm=pi/30; % or FILD position [t0, tm] phi...
% add path of feature extraction addpath(genpath('/tmp3/yuchen/BoAP_Adaboost/gbvs')); load('/tmp3/yuchen/BoAP_Adaboost/data/flickr_dataset/model.mat', 'model'); [id, url, x, y, w, h, vote] = textread('/tmp3/yuchen/flickr_dataset/crop/test_0.1.txt', '%u %s %u %u %u %u %u'); %[id, url, x0, y0, w0, h0, x1, y1, w1, h1, vo...
function [prob_y_given_x] = Apply_MIL(x,h,no_of_classifiers) h_best = zeros(no_of_classifiers,size(x,2)); prob_y_given_x = zeros(size(x,2),1); for k = 1:size(h,2) m = h(1,k); for i=1:size(x,2) prob_f_given_y1 = normpdf(x(m,i),h(2,k),h(3,k)); prob_f_given_y0 = normpdf(x(m,i),h(4,k),h(5,k)); h_b...
function A=makeLowRankMatrix(n,k) U=2*rand(n,k)-1.0; N=sqrt(sum(U.^2)).^(-1); U=U.*(ones(n,1)*N); %V=2*rand(m,k)-1.0; %N=sqrt(sum(V.^2)).^(-1); %V=V.*(ones(m,1)*N); A=U*U'; end
function poly=rotatePoly(poly,R) for i=1:length(poly) poly(i).xy=poly(i).xy*R; end
unction [ Recall ] = getRecall( Target, Output, varargin ) %Compute Recal (Sensitivity) Baseline Predicted Label and Actual Label % Recall = recall(Actual, Predicted); % % J. Cagle, University of Florida, 2016 TruePositive = sum(Output(Target == 1)); TotalPositive = sum(Target == 1); Recall = TruePositive/TotalPos...
function I_s = spatialInertiaTensor(I_com, r_com, m) r_comM = vecX3D(r_com); I_O = I_com - m*r_comM*r_comM; I_s = [I_O m*r_comM; m*r_comM' m*eye(3)]; end
function add_raw_data_to_database( outerfolder, varargin ) % ADD_RAW_DATA_TO_DATABASE -- Add un-processed behavioral data (and % references to neural data) to the sqlite database. % % add_raw_data_to_database( outerfolder ) adds all data in the % subfolders of `outerfolder` to the database. % % IN: %...
function ret = loss(model, data) % mean cross-entropy loss. % Your code here. xpn=data.inputs; %训练数据集 xln=data.targets; %数据标签 wih=model.input_to_hid; %从输入到隐藏层的权重矩阵 whc=model.hid_to_class; %从隐藏层到输出层的权重矩阵 % 先正向传播求取网络输出(softmax); sj=wih*xpn; xj=1./(1+exp(-sj)); si=whc*...
% Solucion del problema de minimos cuadrados con la factorizacion QR. % Sea A una matriz de tamaņo 5x3. A = [ 1, -1, 3; 3, 1, 4; 1, 2, 3; -1, -2, -5; 4, 3, 1]; % Obtener la factorizacion QR. [Q,R]=qr(A); % Para confirmar que Q es una matriz ortogonal, hay que multiplicar Q por % su tra...
function CreateTableMediationResults(LocalMaxima,InputImage) % Input is a text file created from FSL % InputImage is the file used to create the list of local maxima [PathName FileName] = fileparts(InputImage); if ~isempty(PathName) cd(PathName); end load(fullfile(PathName,'data','ModelInfo')); Vpath = spm_vol(I...
function [ VAR,SING ] = LSKNM( N, M, M0, M1, HM, SC, HX, W,X,Y ) %LSKNM DETERMINES LAY-FUNCTIONS AMPLITUDES FOR A NUMBER OF CONSTRAINTS % % SUBROUTINE LSKNM ( N, M, M0, M1, HM, SC, HX, W,X,Y,VAR,SING) % -------------------------------------------------------------------- % DETERMINES LAY-FUNCTIONS AMPLITUDES F...
start = clock; clf [x,y] = meshgrid(-4:0.1:4); z = x.^3 +- y.^3; %%% mesh(x,y,z); meshc(x,y,z); elapse = etime(clock,start)
function state = state_snew(rate,shape,gram,m,covtype,Sind) % does basically the same than updateW and updateOmega, but approximately, % and using the accumulated sufficient statistics state = struct(); state.W = struct(); ndim = size(m,2); npred = size(gram,1); fullcovmat = strcmp(covtype,'full') || strcmp(covtype,'u...
/* * Copyright (c) 2015 Lutz Hofmann * Licensed under the MIT license, see LICENSE.txt for details. */ freeze; declare verbose buildingQuotient, 1; import "buildingLib.m" : FiniteFldListAddOne; // quotient building of G \ Gamma0 QuotientBuildingRec := recformat < representatives : SeqEnum, // a sequence of r...
function [child1_binx, child1_biny, child2_binx, child2_biny] = point_crossover(parent1_binx, parent1_biny, parent2_binx, parent2_biny, cross_over_index) % single-point crossover child1_binx = [parent1_binx(1:cross_over_index) parent2_binx(cross_over_index+1:end)]; child2_binx = [parent2_binx(1:cross_over_i...
%% Wake rollup calculations if (Rollup == 1 && i_t > 1) if i_t > Nlump*Nstep + 1 lump = 1; else lump = []; end [u,w] = WakeRollupVelocity2D([xw(2:wakeInd+1) lump*xl(1)],[zw(2:wakeInd+1) lump*zl(1)],mu(:,1)',muTE(1),[muW(1:wakeInd) lump*muLump(1)],muLEt,muLEb,sigma',xp',zp',vt',vn',xTE'...
function lw_wave(type) % One-Dimensional Wave Eqution Using Lax-Wendroff Scheme Nx = 501; Nt = 1501; L = 1; % Setup x = linspace(0,L,Nx); dx = L/(Nx-1); a = 0.3; dt = a*dx; u = zeros(Nx,Nt); ux = zeros(Nx,Nt); ut = zeros(Nx,Nt); % Initial Condition if strcmp(type,'triangle') for i = 1:Nx xi = dx*(i-1); ...
function [xs, tris] = readmesh(filename) fid = fopen(filename, 'r'); %check if file was opened if (fid == -1) filename = ['can not open the file ' filename]; error(filename); end s=''; while ~strcmp(s,'Vertices') s = get_nextline(fid); end s = get_nextline(fid); nnodes=strread(s,'%d'); xs=zeros(nnodes,3); f...
load('ex7faces.mat'); [m, n] = size(X); [X_norm, mu, sigma] = myFeatureNormalize(X); U = pca(X_norm); displayData(X(1:100, :)); Z = projectData(X_norm, U, 100); X_rec = recoverData(Z, U, 100); figure; subplot(1, 2, 1); displayData(X_norm(1:100, :)); hold on; subplot(1, 2, 2); displayData(X_rec(1:100, :));
P = 40; % real power, MW V = 30/sqrt(3)+ j*0; % phase voltage, kV Zs = j*9; % synchronous impedance ang = acos(0.4); theta=ang:-0.01:-ang; % Angle from 0.4 leading to 0.4 lagging pf P= P*ones(1,length(theta)); ...
% Plots surface elevation for the given ITTC spectra H_significant = 2.5; T_peak = 9.0; omega_peak = 2.0 * pi / T_peak; % in Hz omega_peak = 2.0 * pi * omega_peak; % in rad/s omega_low = 0.2; omega_high = 3.0 * omega_peak; g_accel = 9.81; PLT_NUM = 150; dw = (omega_high - omega_low) / PLT_NUM;...
x=[10.0002 10.000029] e=[0.0001 9.99*10^(-8)] p=errorbar(x,e) h = findobj (p, "type", "line"); delete(h(1)) ylim([10 10.0004]) text (1, x(1), " Oscilloscopio"); text (2, x(2), " Contatore");
function [alignedBScan flatline transformline] = alignAScans(bscan, params, line) % ALIGNASCANS: Aligns A-Scan according to a given firstline. The Image is cut to % given values above or below, or a second firstline can be igiven, that is for % sure also included in the image. % [ALIGNEDIMAGE FLATLINE TRANSFORMLINE] = ...
function [attentionweights, associationweights] = UPDATE(associationweights, ... attentionweights, target, outputactivation, hiddenactivation, ... exemplars, networkinput, params) %-------------------------------------------------------------------------- % This script updates the weights of an ALCOVE network based o...
function X = dec_2_bin(num,bits) % converts decimal number "num" to binary, represented as a vector of bits, % length specified by input "bits" X = zeros(bits,1); for i = bits : -1 : 1 if num >= 2^(i-1) X(i) = 1; num = num - 2^(i-1); end end
clear; % Input image tools = few256; % smooth tools tools_smoothed = discgaussfft(tools, 4); % 1 for the simple differences operator % 2 for the central differences operator % 3 for the Roberts cross edge operator % 4 for the Sobel operator gradmagntools_1 = sqrt(Lv(tools_smoothed, 1)); gradmagntools_2 = sqrt(Lv(too...
function [ choice ] = Chicken_30485493( history ) % Defines a strategy for the chicken or dare game a % assuming the number of rounds is one thousand % The key advanatge of this strategy to my taste is that it shifts % between very different tactics based on a more long term experience %=== Strategy types === %P - pea...
%% ======================= Building Response Time ======================= % This script identifies the start and the end of the trail. It integreats % the start stop data with it with results from the Feedbacktype script and performs core % statistical inferences computationsfrom % proband=1 ; % all = all2(proban...
l=0.085; lb=0.075; mb=0.419; mw=0.204; Ib=3.34*10^-3; Iw=0.57*10^-3; Cb=1.02*10^-3; Cw=0.05*10^-3; Km=25.1*10^-3; g=9.81; T=0.02; A=[0,1,0;(mb*lb+mw*l)*g/(Ib+mw*(l^2)),-Cb/(Ib+mw*(l^2)),Cw/(Ib+mw*(l^2));-(mb*lb+mw*l)*g/(Ib+mw*(l^2)),Cb/(Ib+mw*(l^2)),-Cw*(Ib+Iw+mw*(l^2))/(Ib+mw*(l^2))/Iw]; B=[0;-Km/(Ib+mw*(l...
person = struct( 'name ', 'Per ', ' date_of_birth ', date , 'phone ', 48151623);
function scnds = sekonds(sim, act) if sim == 1 scnds = 0; elseif sim == 2 scnds = act; end
function [bins, binwidth, psth] = buildpsth(prestimdur, poststimdur, totRelSpks) % bin data into 5ms bins & determine firing rate binwidth = 0.001; bins = -prestimdur:binwidth:poststimdur; binned = nan(1,length(bins)-1); for bi = 1:length(bins)-1 thisDataIdx = totRelSpks > bins(bi) & totRelSpks < bins(bi+1); ...
function [lst]=utc2lst(mjd,longitude) [year,month,day,hour,minute,secs,ticks] = mjd2utc(mjd); lst = mod(hour+minute/60+(secs+ticks)/60/60+longitude/15.0,24.0);
% readdata.m: % This file is used to read data from file 'Ddatak8' produced by readdatak8.m, as k=4. % The raw data can be found here: % https://github.com/undersunshine/machine_learning_algorithms/blob/master/Matrix_Factorization/data.csv % Copyright (c) 2018 CHEN Tianyang % more info contact: tychen@w...
function keypoints = upscale_keypoints_to_full_image_size (keypoints) % keypoints = UPSCALE_KEYPOINTS_TO_FULL_IMAGE_SIZE (keypoints) % % Upscale keypoints, obtained on half-sized images, to full image size. % This function adjusts both keypoint location and size by factor 2. % The location is also a...
% Function for Plotting The Plots function [spikes_baseline, spikes, mean_baseline, mean1] = plot_data(baseline_start, baseline_stop, start, stop, type) global action_threshold global samplingRate [voltage_baseline, time_baseline] = get_voltage(baseline_start, baseline_stop); length(voltage_baseline); ...
je_base=g1{1}; je_plus=g1{4}; % Select direction je_base=squeeze(je_base(3,1,:)); je_plus=squeeze(je_plus(3,1,:)); diffo=je_plus-je_base; [oud]=isoutlier(diffo); ind=find(oud); Ind=zeros(size(diffo)); Ind(ind)=1; %% plot(je_base) hold on plot(je_plus) stripes(Ind,0.2) ylim([0 max(max([je_base je_plus]))]) xlim([2...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Wenan Chen % September, 2007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This function center the image with the given center. function centered_img=centerimg(img,center,method) % input: img is the image to be centered, center is the coordinate with ...
function [a_sync, b_sync, a_ind, b_ind] = sync(a, b, thres) %{ Synchronize two vectors. Used to synchronize the color and depth (or point cloud) messages. Inputs: - a: first vector. - b: second vector. Returns: - a_sync: vector a with only the synchronized elements. - b_sync: vector b ...
function soundSegment=findSegment(express) if express(1)==0 voicedIndex=find(express); % Find the position of 1 in express else voicedIndex=express; end soundSegment = []; k = 1; soundSegment(k).begin = voicedIndex(1); % Set the starting position of the first group of segments for i=1:length(voicedIndex)...
function [ accuracy ] = get_accuracy(predictions) %GET_ACCURACY Given the predictions and the testing data, calculate the %accuracy of the predictions. % accuracy = GET_ACCURACY(predictions) will return the correctness % (between 0 and 1) of a given model's predictions. num_classes = size(predictions, 2); num_sam...
% load the baseline data load outdata/measuredField_at_shot_32_with_freq_8/baseline_data.mat % load the monitor data load outdata/measuredField_at_shot_32_with_freq_8/monitor_data.mat % load the time-lapse data load outdata/measuredField_at_shot_32_with_freq_8/residuals_recorded.mat %% d1-d0 % I do not want to worr...
%% -------- % QC_01_08_CumulativeEventCount(MeasCat) % Cumulative Event Count % Input: MeasCat - Measured catalogue function NumberOfEventsCumul = QC_01_08_CumulativeEventCount(MeasCat) % close all if ~isnumeric(MeasCat) error('Load catagoue in the correct format (see readme for description)') end %% definit...
function data=nut_sampledata(par,trlval) data_loc=cell(length(par.run),1); for r=1:length(par.run) data_loc{r}=ns_fif2ft(par,par.run(r)); %% select trials based on trlval data_loc{r}.trial=data_loc{r}.trial(find(ismember(data_loc{r}.trialinfo,trlval))'); data_loc{r}.trialinfo=data_loc{r}.trialinfo(find(...
%function [pearson,spearman]=assessment(result,subject,flag_plot) %090119 ģ���������۲��� clc; %绘制传统方法曲线专用 fid1=fopen('/media/s408/GLORIA/ACMM/code/niqe/niqe_scores.txt'); fid2=fopen('/media/s408/GLORIA/ACMM/code/niqe/niqe_val.txt'); c1=textscan(fid1,'%f'); c2=textscan(fid2,'%f'); fclose(fid1); fclose(f...
function test_example_DBN load mnist_uint8; train_x = double(train_x) / 255; test_x = double(test_x) / 255; train_y = double(train_y); test_y = double(test_y); %% ex1 train a 100 hidden unit RBM and visualize its weights % rand('state',0) % dbn.sizes = [100]; % opts.numepochs = 50; % opts.batchsize = 100; % opt...
function [y1] = Battery_Classifier(x1) %MYNEURALNETWORKFUNCTION neural network simulation function. % % Generated by Neural Network Toolbox function genFunction, 22-Jun-2017 23:26:16. % % [y1] = myNeuralNetworkFunction(x1) takes these arguments: % x = 2xQ matrix, input #1 % and returns: % y = 3xQ matrix, output #1 ...
function [outputStruct] = processSpikeTrainProperties(inputStruct) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Description: % for given cell spike properties/times, advances to next processing stage of % spike train properties (AC, XC with other trains, ISI distribution, ...
clear; clc; %读入Train文件中所有文件名 fileRoot = pwd;%当前工作路径 fileFolder=fullfile([pwd '\Final Proj\SISR\Train']); fileCluster = fullfile([pwd '\Final Proj\SISR\Cluster1\cluster.txt']); dirOutput=dir(fullfile(fileFolder,'*.jpg')); fileNames={dirOutput.name}'; img_num = length(fileNames); sf = 3; HRtoVECTOR = [1:81]; %patch的大...
% limiar para pixel activo global T; T = 0.1; % area minima para ser considerada regiao global minarea; minarea = 50; % primeira frame global fframe; fframe = 0; % ultima frame global lframe; lframe = 549; % numero minimo de regioes emparelhadas para ser considerado segmento global strokeThr; strok...
%Frequency domain Low pass filter clc; clear all; close all; a=imread('dewdrop.jpg'); [m n]=size(a); mask=zeros(m,n); for i=150:180 for j=210:240 mask(i,j)=1; end end c=fftshift(mask); b=fft2(a); d=b.*c; e=abs(ifft2(d)); subplot(2,2,1),imshow(a),title('original image') subplot(2,2,2),im...
function gaborResult = l1(img, gaborArray,u,v,x,y) gaborResult = cell(u,v); for i = 1:u for j = 1:v gaborResult{i,j} = (abs(conv2((img),(gaborArray{i,j}),'same'))); % chave � cell e parenteses � a matriz naquela posi��o da c�lula % Faz a troca % for a = 1...
function price = barrier_opt_pricing_formula(sigma, K, H) % STs final stock price % K is the strike price % H the barrier % q dividend rate global rf_r; global T; global initial_capital; S0 = initial_capital; q = 0; m1 = (log(S0 / K) + (rf_r - q + sigma^2 / 2) ...
function [distance, coefficient] = It_bhattacharyya(mean1, mean2, cov1, cov2) cov1 = (cov1); cov2 = (cov2); covP = (cov1 + cov2) / 2; % coefNeperiano1 = det(covP/chol(cov1*cov2)); coefNeperiano2 = det(covP) / sqrt(det(cov1)*det(cov2)); distance = (1/8) * ((mean1-mean2)*pinv(covP))*(mean1-mean2)' + (1/2) * log(coefN...
s = niftiread('/Users/stefangrivalsky/dataset/MICCAI_BraTS17_Data_Training/LGG/Brats17_TCIA_623_1/Brats17_TCIA_623_1_flair.nii.gz'); sizeO = size(s); disp(size0) figure; slice(double(mriVolumeOriginal),sizeO(2)/2,sizeO(1)/2,sizeO(3)/2); shading interp, colormap gray; title('Original');
%%%%%%%%%%%%%%%%%%%%%%%%%% % % Sam Feig % Vladimir Zhdanov % % CSCI 4831/5722 % Homework 1 % Instructor: Ioana Fleming % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [ outImg ] = addRandomNoise_NL(inImg) inImg = double(inImg); % Generate random noise noise = randi([-255, 255], size(inImg, 1), size(inImg, ...
% Final Project - Interest Points Detection and Image Matching % Author: CÚline Bensoussan & Jill Perreault % Course: Computer Vision % Date: April 15, 2013 function SSD_table = SSD(d_im1, d_im2, M) % SSD: Generates the sum of the squared difference of all descriptors of all % points from image1 and image2 ...
function [NewPoints, removedPtNum, keepAskingBoolean] = TrackNext(img,ROIsize,TrackPoints,remPoints, maxTravel, increaseROINum, soundOption) %TrackNext Tracks points selected in SelectPoints for a different image % TrackNext(img,TrackPoints). img: image to find points in, TrackPoints: % points selected previously. ...
%%% this code implements the Greedy Gradient based Max-Cut algorithm %%% updating by pick up the most possible samples; This version is robust %%% to weight matrix; function [predict, error]=ggmc(data,gnd,labeled_ind,graph) gnd=reshape(gnd,1,length(gnd)); data_num=length(gnd); class_num=length(unique(gn...
function phi = Phi_Calculation(state, mu, sigma) x = state(1,1); v = state(2,1); %figLocal = figure(); %figure(figLocal); %hold on %scatter(mu(:,1),mu(:,2), 'filled'); phi = zeros(length(mu),1); % For each centrum for i = 1:length(mu) c_x = mu(i,1); c_v = mu(i...
%3D grid (prototype) clf; [x,y,z] = meshgrid(0:1); V=x.*y.*z; a = axes; daspect([1 1 1]); view(3); hold on; for i=0:50 for j=0:50 for k=0:10 hSlice = slice(x+i,y+j,z+k,V,i+1,j+1,[0 k+1]); hSlice = slice(x+i,y+j,z+k,V,i,j,[0 k+1]); end end end
% GardnerReverbFaderTest.m % clear;clc; [in,Fs] = audioread('AcGtr.wav'); verb = GardnerReverbFader(); size = 1; gain = 1; mix = 0.8; verb.setFs(Fs); verb.setSize(size); verb.setGain(gain); verb.setMix(mix); out = verb.process(in); plot(out);