text
stringlengths
8
6.12M
clc,clear %该函数用于产生网络 N = 40;%节点个数 K = 4;p=0.1;m0=2;m=2; p2 = 0.05;%第二个网络重新连接的概率 pp = 0.1;%产生ER %CI 产生两个完全重合的网络--------------------------------------------------- G = WS_generate(N, K, p); sum(sum(G))/(size(G,1)*size(G,2)) G1 = G; save(['CI/1_WS_N_',num2str(N),'.mat'],'G'); G2 = G; save(['CI/2_WS_N_',num2str...
function [ genORG, allEPOCH, epochList ] = gp_eeglab2gasp( incfg, input_fld_ABS, input_file ) %UNTITLED Summary of this function goes here % Detailed explanation goes here if ~isfield(incfg,'outputABS'); incfg.outputABS = []; end if ~isfield(incfg,'modfields'); incfg.modfields = {}; end %{{'fieldname','valu...
clear all, close all rew = @(x) .5*exp(- (x - 2) * 1 * (x -2)) + exp(- x * 4 * x) ; addpath('../gp') addpath('..') addpath('~/svnprojects/ClassSystem/Helpers/') addpath('../DERIVESTsuite/') addpath('../teach-grad-hess/') addpath('../reps_demo/') xsampled = -6:.1:9; for i = 1:length(xsampled) r(i) = rew(xsampled(i...
function output = rfid_crc5(input) %% crc5 for GEN2 crc = [1,0,0,1,0]; for i = 1:1:17 temp = [0,0,0,0,0]; temp(5) = crc(4); if crc(5) == 1 if input(i) == 1 temp(1) = 0; temp(2) = crc(1); temp(3) = crc(2); temp(4) = crc(3); else temp...
%% Profile Estimation Experiments %% Path Functions odefn = @fhnfun1p; % Function for ODE solver (perturbed) odefn = @fhnfun1; % Function for ODE solver (exact) fn = @fhnfun; % RHS function fndfdy = @fhndfdy; % Derivative wrt inputs (Jacobian) fndfdp = @fhndfdp; % Derviative w...
%% FOLDER & LINKS & FILELIST <<<<<<< HEAD D_asthDATA = 'E:\ASTHMA DATA'; D_PHRVText = 'E:\PPG HRV Text'; D_EHRVText = 'E:\ECG HRV Text'; D_HRVData = 'E:\HRV DATA'; addpath(genpath('E:\Google Drive\Documents\Academic\Pre-thesis\MIMIC II DATABASE')); % add code & subfolders ======= D_PHRVText = 'D:\MIMC II WAVEFORM...
function index = find_closest_player(pos_arr,ball) % FIND_CLOSET_PLAYER searches an array of postion vectors for the index that points to the closest position to the ball. % POS_ARR is an 2*N array registering all testing positions. The format should be % POS_ARR = [position_1_x position_2_x position_3_x ...; % ...
function q = super_fibonacci(n,phi,psi) % SUPER_FIBONACCI Generate n quaternions according to "Super-Fibonacci % Spirals: Fast, Low-Discrepancy Sampling of SO(3)" [Alexa 2021] % % q = super_fibonacci(n,phi,psi) % % Inputs: % n number of rotations to generate % phi, psi parameters controling the d...
%CREATETREFOILKNOT Create a 3D mesh around a trefoild curve % % [X, Y, Z] = createTrefoilKnot; % [X, Y, Z] = createTrefoilKnot(NPTS); % % Example % createTrefoilKnot % % See also % % ------ % Author: David Legland % e-mail: david.legland@grignon.inra.fr % Created: 2015-01-07, using Matlab 8.4.0.150421 (R...
cicada=imread('cicada.jpg');%read in image gray_cicada = rgb2gray(cicada); %convert to grayscale image gray_cicada = double(gray_cicada);% convert image to a type suitable row = cicada(70,:); %extracts 70th row ave_filt=ones(1,7)/7; % calculate filter coefficients filt_row = conv(row,ave_filt); %filter 70th row ...
% º¯Êý£º´¹Ö±°ÙÒ¶´° function g=ShuttersVerticalFunc(image) if isempty(image) image=selectPicFunc(); end I=image; [M,N,R]=size(I);g=zeros(M,N,R); for t=1:R for i=1:M for j=1:N % if mod(i,4)==0 || mod(i,4)==1; g(i,j,t)=I(i,j,t); else g(i,j,t)=0; end end ...
function sum = test_connectivity(grid, i) [x,y] = ind2sub(size(grid),i); x_i = grid(i); [nx, ny] = meshgrid(x-1:x+1, y-1:y+1); n = [nx(:) ny(:)]; clockwise = [n(1:3,:);n(6,:);n(9,:);n(8,:);n(7,:);n(4,:)]; values = zeros(8,1); temp = clockwise; values(clockwise(:,1) == 0 | cloc...
function timeProcessArgs() % compare running time of processArgs and process_options. tic for i=1:5000 testPO('-a',1,'-k',11,'-c',3,'-e',5,'-f',6,'-d',4,'-g',7,'-h',8,'-i',9,'-b',2); end t = toc; fprintf('process_options took %f seconds\n',t); tic for i=1:5000 ...
%Name: David George %Student Number: 251004930 %Excerse a) disp("Excervise a) Converting 43 degrees"); temp = TempConvert(43); disp(temp); %Exercisse b) disp("Excervise B) ..."); M = [6 1 5 5; 2 7 1 5; 6 3 6 7; 1 2 4 1]; v= [1 1 1 1]; %Product of Mv disp("The product of Mat...
%% TD1 % Problem 15 %% Antoine MERLET, Condorcet clc; % Clear command window. clear; % Delete all variables. close all; % Close all figure windows except those created byimtool. imtool close all; % Close all figure windows created by imtool. workspace; % Make sure the workspace panel is showing. %% Proble...
%============================================================================ % DeerLab Example: % Multi-Gauss fit of a 4-pulse DEER signal %============================================================================ % This example showcases how to fit a simple 4-pulse DEER signal with % background using a mult...
function [ s,t,w ] = generateGraph( rows, cols ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here nodes_count = rows*cols; s = [[1:nodes_count] [1:nodes_count] [1:nodes_count]]; t = [[1:nodes_count]+cols-1 [1:nodes_count]+cols [1:nodes_count]+cols+1]; w = [sqrt(2)*ones(1,nodes_count) o...
function fig_prop(width,height) figure('units','normalized','outerposition',[0 0 1 1]); fig = gcf; set(fig, 'Units', 'inches') fig.PaperUnits = 'inches'; set(fig,'PaperPositionMode','manual'); fig.PaperPosition = [0 0 width height]; fig.PaperSize = [width height]; set(gcf,'renderer','painters'); end
classdef Geometry %UNTITLED4 Summary of this class goes here % Detailed explanation goes here properties cartDeriv area ndime nnode % preguntar ngaus % preguntar end methods function obj = Geometry(mesh) triangleLinear = Triangl...
function [alpha_data]=a_ralpha(alpha_file) % global APATH CONST VERBOSE % see if alpha file is in current working directory [Fid,message]=fopen(alpha_file,'rt'); if Fid < 0 alfpath=fullfile(APATH,'BIN','ALPHA'); [Fid,message]=fopen(fullfile(alfpath,alpha_file),'rt'); if Fid < 0 error('a_ralpha.m: %...
function [ M ] = mistakeMatrix( dds,dte,pages ) %MISTAKEMATRIX Summary of this function goes here % Detailed explanation goes here dmax = max(dte); M = zeros(dmax,dmax,pages); for i = 1:pages mistakes = zeros(dmax,dmax); for j = 1:length(dte) mistakes(dds(j,i),dte(j)) = mistakes(dds(j,i),dte(j))...
% How long does it take to remove a paddle? % How long to change the bias? % Do I need to change the bias ahead of the sequencer doing it??? % Same with InjFieldGroupDelay??? %Prefix = getfamilydata('BPM','BaseName'); % lcaNewMonitorValue(pvs) % lcaNewMonitorWait(pvs) % lcaSetMonitor(pvs, nmax, type) % lcaCl...
% % 19 September 2021 % here is for euclidean distance calculation % euclidean = shortest distance between two vectors % % 20 September 2021 % AHA just need to send data % from framespectra.m to here % AND COMPARE THEM FOR THE training.m % TO CALCULATE OH MY GOWAEUHNLFJHA % a = known speaker % b = unknown speaker of...
L=10; a=1; D=0.1; dt=0.1; N=5; m=1; X =rand(1,N)*L; Y=rand(1,N)*L; Vx=rand(1,N); Vy=rand(1,N); %% тело figure for st =1:1000%step po timu for i=1:N for j=1:N if(i~=j) rx=X(j)-X(i); ry=Y(j)-Y(i); r=sqrt(rx.^2+ry.^2); ...
%% MAIN SETUP: SETS CONFIGURATIONS FOR BOTH PSO AND FT EXPERIMENTS %% CLEAR: all workspace and global variables, and close all figues clearvars -global; clearvars; close all; clc; %% ADD CODES addpath('timing'); %% SETUP % COMMON SETUP: SETTINGS USED IN BOTH PSO AND FT FRAMEWORKS controller_experiment = 1;...
clc; fclose('all'); clearvars; close all hidden; addpath(genpath('INPUT/')) % Add INPUT folder and subfolders to path addpath(genpath('OUTPUT/')) % Add OUTPUT folder and subfolders to path %% =====DESCRIPTION===== % Vessel channel background intensity characterization. % Calculates mean and spread, creates mask of...
classdef PositionTrajectoryAlignerBase %POSITIONTRAJECTORYALIGNER Summary of this class goes here % Detailed explanation goes here properties end methods % Constructor function obj = PositionTrajectoryAlignerBase() end end ...
function out = vars2struct(vars) %This function is designed to store copies of variables as fields of a %structure. The idea behind this is that it enables you to quickly put %a bunch of variables in the workspace belonging to one analysis under %one 'heading' so they aren't overwritten. 'vars' shou...
function [ fundamental_matrix_RANSAC, inliers_RANSAC, inliers_idx_RANSAC ] = RANSAC( all_matches_image1, all_matches_image2, n_iterations, epsilon ) % apply RANSAC to the normalized 8-point algorithm n_random_samples = 8; %% Ensure shape 3xN if size(all_matches_image1,2) == 2 all_matches_image1 = transpose(all_mat...
function[kArray]=makekspace(gridDimensionVector, Options) %MAKEKSPACE produces 3D array of k-space coordinates % % MAKEKSPACE returns K(kx,ky,kz) % % Syntax % % MAKEKSPACE(gridDimensionVector) % MAKEKSPACE(gridDimensionVector,Options) % % Description % % K = MAKEKSPACE(gridDimensionVector,Options) return...
%if OCTAVE is used %pkg load statistics x = [1 2 3 4 5]; y = [1 3 3 3 5]; xx=[ones(5,1) x']; b = regress(y', xx)
% params = GetParams(myobj, 'PluginName') % % Retrieve the configuration parameters (if any) for a % particular plugin. Configuration parameters are a struct % of name/value pairs that plugins use to affect their % runtime operation. The returned structure...
movnm = '30pow_002_crop.tif'; outname = '30pow_002_crop_eucl.tif'; if exist(['.' filesep outname],'file'), delete(outname); end ml = length(imfinfo(movnm)); ss = size(imread(movnm)); join = 3; skip = 97; fr = 1; k = 1; while fr <=ml; img = zeros(ss); for i = 1:join img = img + double(imread(movn...
bootstrap_experiment consolidate_results best_parameter_combinations datasetsFilename = fullfile(echolex_data, 'public_datasets_training_val_test.mat'); load(datasetsFilename); l datasetNames = cellfun(@(x) x.DatasetName, public_datasets_training_validation, 'UniformOutput', false); u = unique(best_results.DatasetNam...
function [ ] = saveToFile(filename,data, message ) %saveToFile Sauve les données data dans le fichier filename, sous forme de %text. % message : message à affiché à la fin save(filename, 'data', '-ascii'); display(message); end
% read and show maps cd maps; % Flow: load('Flow_sSVD.mat'); F_sSVD=F; N_slices=size(F_sSVD,3); figure; n_sp_rows=floor(sqrt(N_slices)); n_sp_cols=ceil(N_slices/n_sp_rows); for slice=1:N_slices subplot(n_sp_rows,n_sp_cols,slice); imshow(mat2gray(F_sSVD(:,:,slice))); end
classdef (Sealed) UTestBatchReader < graph.GraphFixture %UTestBatchReader A unit test of class BatchReader. % This class includes unit tests of Class BatchReader's batch build and % read operations. %=========================== PROPERTIES ============================== properties (Constant,...
function [zero_lengths ref]=PreProcess_ZeroValues(voxels_data_4D,Filter_data,Mask_prev) % We don't want voxels whose intensity curves contain a few % consecutive zeros: voxels_data_4D_permute=permute(voxels_data_4D,[4,3,2,1]); [row_data col_data slice_data time_data]=ind2sub(size(voxels_data_4D_permute),find(voxels_da...
function h = plot_waterphase_all(var,parm) % plot basinwise spatially averaged organized cloud water over lead time % plot TS,LFLX in rh0 to show that the difference of strength is due % to SST % plot EOF1 vert profile for each basin at the side % % parm.lagind*30min % %load fname % run ~/scripts/matlab/startup % qthr...
function Chebfun_analysis(qh0,qk0,e0,id) jn=@(N)(1:N); Xn =@(N)(0.5-0.5*cos((jn(N)-0.5)*pi/N)); dp = fileparts(which('disp_dft_parameterized.m')); persistent in_dat if nargin > 3 in_dat = id; end e_max = 680; q0 = 1; qi = (0:q0/100:q0)'; ei = (0:e_max/500:e_max)'; if isempty(in_dat) disp('***** loading refe...
function [val] = wavefront_initialize(xx,yy,xGoal,world) %Initializes the workspace val. The value of each cell is set to: % inf if the midpoint of that cell is within an obstacle % 0 if it contains the goal location % NaN for all other values % % xx,yy are vectors of size NGrid+1, where val will be of size % ...
function outputPara= New_sar_TRTVp(inputPara) p=inputPara.p; % p value lamda=inputPara.lamda; %parameter that balances likelihood and prior term weighting f=inputPara.destroyedimage; % noisy input grayscale image MAXITR = inputPara.MAXITR; %max dca number tol_out= inputPara.tol_out; % outer tollerence TR_value= i...
%@(#) randvec.m 1.2 94/08/12 12:10:46 % %function vec=randvec(mminj) %vec(x)=1 randpos, vec(x)=2 semirandpos function vec=crrandvec(mminj) lm=length(mminj); mat=zeros(lm); for a=1:lm mat(a,mminj(a))=1; mat(a,lm+1-mminj(a))=1; mat(mminj(a),a)=1; mat(lm+1-mminj(a),a)=1; end for i=2:round(lm/2) for j=2:ro...
%% movie example % This example calls "AD_MED64_LFP_movie_Miranda.m", % ...which then calls "sweep2movie_LFPInterp3D.m" internally data.raw(:,51,:)=0; % this hides the stim channel when it is = Ch 51 AD_MED64_LFP_movie_Miranda(data)
function AI_agent = determine_AI_agent(win_matrix, round_counter, focus_length) sum_of_wins = zeros(28,1); win_percent = zeros(28,1); size_win_mat = size(win_matrix); length_win_mat = size_win_mat(2); if length_win_mat - focus_length <= 0 for row = 1:28 sum_of_wins(row,1) = sum(win_matrix(row,:...
eyePos = XY_fixMid; screenDist = 36; pixPerCm = 27.03; eyePosPix = tools.deg2pix(eyePos, screenDist, pixPerCm); % eyePosPix = eyePos; figure; colormap gray; for ii = 1:size(eyePosPix,1) img = ica.loadImage(datadir, imNames{ii}); clf; hold on; iml = size(img); imagesc(img'); set(gca, 'YDir...
clear all clc %% outline % use the MD 320-2160 trained Ann to predict the MD protein ser. % ch %% main % load MD data load Mat_MD_dis_input_output.mat % load the ch trained net % path parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% path_ch_loop_save='../res_data/ch/ch_atom_dis_cluster_...
function [solution,error] = Poisson_solver_1D(left,right,h,basis_type_trial,basis_type_test,der_trial,der_test,Gauss_type) % 一维possion方程求解器 % 主要来求解如下形式的方程 % $-\nabla \cdot c(x) \nabla u(x) = f(x),a\le x\le b$ %$u(a)=g_a$, %$u'(b)+q_bu(b)=p_b$ % left = 0; %区间左端点 % right = 1; ...
%% Parameters Jm = 0.0000542; %Rotor Inertia (J) kg.m^2 Motor Jg = 0.0000542; %Rotor Inertia (J) kg.m^2 Gears Kt = 93.4e-3; %Torque Constant (Kt) N.m/A Ke = (1/102)*(60/(2*pi)); %Back EMF Constant (Ke) V/rad/s (1/(102) V/rpm) La = 0.423e-3; %Motor Inductance (La) H Ra = 0.608; %Motor Resistance (Ra) ohms bm...
clear all threshold = 0.5; clear rpfiles R cwd = '/data/local_share/huiai/Documents/NESDA/L1_scan/'; rpfiles = spm_select('FPListRec',pwd, '^rp_.*.txt') for r = 1:length(rpfiles) h = figure; clear R R = load(rpfiles{r}); %rpfiles = spm_select('FPListRec',pwd, '^rp_.*.txt') translation = R(:...
function value = estimator_K(probes) size = length(probes); N=size; p = floor(sqrt(N)); minimum = min(probes); maximum = max(probes); x = linspace(minimum,maximum,p); value = zeros(1,p); alpha = 0.1; h=N.^(-alpha); for m=1:p tmp_value = 0; for k=1:size tmp_value = tmp_value + core_rectangle((-x(m)+probes(...
function [ppl_1,x_1,y_1]=g_aMain1(index,n,p_c,p_m,num_var,num_dgt,x_lo,m,precision,f,ppl,count_max) %===============Initial Population============================ x=bn2de(ppl,x_lo,precision,m,num_var); y=f(x); [f_min, ind1]=min(y); [f_max,ind2]=max(y); x_min=x(ind1,:); x...
fopen ('housing.data', 'rt'); housing_data = importdata('housing.data'); [N, p1] = size(housing_data); [Y,w,y] = lab5fstd(N,p1,housing_data); yh = Y*w; El = ((norm(Y*w-y))^2)/N; [yhl,Enl] = lab5fnl(N,Y,y,50); disp([ ' El',' Enl']); disp([El Enl]); uu = -3:0.1:3; jj = -3:0.1:3; figure(1),clf, ...
function output = residualImage(corruptedData, biasRemoved, biasField) output = corruptedData - (biasRemoved .* biasField);
function obj = SignalObject__subraction(a,b) if ~isa(b,'SignalObject') error('The subtractor must be a signal object.'); end if count(a,1) ~= count(b,1) error('Dimensions don''t match between signal objects'); end if ~strcmp(a.dtype,b.dtype) error('Cannot mix and match windowed and non-windowed signals')...
dark_ratio = 1; synth_img = create_synth_dataset(); synth_img = synth_img(1:4:end,1:4:end,:);%imresize(synth_img,1/4); synth_img = synth_img/dark_ratio; data_dir = 'datasets/dataset_cannon/synth_bg_sub/img%d.png'; a = 255/dark_ratio; scale = 1/50; width = 10; height = 20; [M,N,C] = size(synth_img); frame_count = 20...
function r=getTRANS(chainlist) r = zeros(11*13,11*13); total = zeros(1,11*13); num_of_list = size(chainlist,2); for i = 1 : num_of_list chain = chainlist{i}; num_of_state = size(chain,2); %disp(num_of_state); for j = 1: num_of_state-1 s = chain(j); %disp(s) e = chain(j+1)...
function out = model % % fluid_optimized.m % % Model exported on Jan 5 2021, 14:27 by COMSOL 5.4.0.225. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('C:\Users\dcy60\Google Drive\Research\MLOPT\code_data\fluid_coarse'); model.label('pressure.mph'); mode...
% This function produces a vector of jittered ISIs distributed according to % the exponential function (a la Wager & Nichols). % % Input: mean jitter time (in s), length of output (i.e. number of % ISIs needed), and whether to sample from a gamma distribution with a long % tail (0 if not [default], 1 if so) % % ...
function results = similarity_experiment(dataset_params_str, method_params_str, kfolds, hyper_params_sweep, experiment_stage, max_parallel_workers) % function results = similarity_experiment(dataset_params_str, method_params_str, kfolds, hyper_params_sweep) % run a 2 layer, k folds (5 folds by default) experiment % inp...
function rate = errorRate(X,y,W) [row,~] = size(X); result = sign(X * W) ; result(result==0) = -1;%take sign(0) as -1 index = find(result ~= y); rate = length(index)/row; end
function y = third(f, h) n = length(f); y = zeros(1, n); for k = 1 : n-2 y(k) = (4*f(k+1) - 3*f(k) - f(k+2))/ (2 * h); end
% Calculates Tissue Partition Coefficients for acidic, basic, neutral and % zwitterion Drugs. Equations taken from: % Rodgers, T., Leahy, D., & Rowland, M. (2005). % Physiologically based pharmacokinetic modeling 1: predicting the tissue distribution of moderate-to-strong bases. % Journal of pharmaceutical ...
function lines = Emergence_PlotGridOnTri( nGrid, dims, col, tricc ) % EMERGENCE_PLOTGRIDONTRI displays a grid on the triangle. % - "nGrid": a scalar number specifying the number of grid lines to % display. % - "dims": a scalar or array specifying along which of the 3 dimensions % to plot the grid lines....
function y = rhsODE(t,y) % y = rhs=DE(t,y) % Calculate the function f(t,y) = y-0.5e^(t/2)*sin(5t) + 5e^(t/2)*cos(5t) y = y - 0.5*exp(t/2)*sin(5*t) + 5*exp(t/2)*cos(5*t); end
function sig_hat_kk = KN_noiseEst(ell,n,kk) % function sig_hat_kk = KN_noiseEst(ell,n,kk) % % Code by Shira Kritchman and Boaz Nadler % 2008, Weizmann Institute of Science % -------------------------------------------- % DESCRIPTION: % This function gets as input the eigenvalues of an SCM % (sample covariance matri...
% this program is designed for optimal substation placement %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function SP_main() clear;clc; pack; tic; display('______________________________________ RESULTS STARTED ____________________________________...
function [model,pred_y,rmse] = random_forest_regression(nTree,train_X,train_Y,test_X,test_Y) model=TreeBagger(nTree,train_X,train_Y,'Method','regression'); pred_y=predict(model,test_X); rmse=sqrt(mean((pred_y-test_Y).^2)); end
function [composite] = stitchImages(im1, im2, H) [h1, w1, numChannels1] = size(im1); [h2, w2, ~] = size(im2); corners = [ 1 1 1; w1 1 1; w1 h1 1; 1 h1 1]; warpCorners = homo_2_cart( corners * H ); minX = min( min(warpCorners(:,1)), 1); ...
% Chapter 9 - Interacting Species. % Program_9b - The Holling-Tanner Model (Time Series). % Copyright Birkhauser 2011. Stephen Lynch. % Time series of a predator/prey model. clear hold on % sys=inline('[x(1)*(1-x(1)/7)-6*x(1)*x(2)/(7+7*x(1));0.2*x(2)*(1-.5*x(2)/x(1))]','t','x'); sys = @(t,x) [x(1)*(1-x(1)/7)-6...
function q = MergeQuests(varargin) % Merge the different trials and recompute the psychometric funciton by % calling QuestRecompute inputN = length(varargin); questN = size(varargin{1}, 2); q = varargin{1}; for i=2:inputN length1 = length(q(1).intensity); length2 = length(vararg...
function x=beeps(ary,sc,sd) sc = 1 - sc; c = -0.5 / (sd * sd); rho = 1.0 + sc; height, width = size(ary) # BEEPSHorizontalVertical Ihp = ary Ihr = ary Ihp(:, 1) = Ihp(:, 1) / rho; for k =2:width: mu = Ihp(:, k) - rho * Ihp(:, k - 1); mu = sc * np.exp(c * mu * mu); ...
Fs=44100; % sampling frequency dt=1/Fs; T0=2; % period, sec close all; r = audiorecorder(Fs, 16, 1); clc;disp('recording started...'); recordblocking(r,T0); % record next data disp('recorded'); s00 = getaudiodata(r); % get data L0=length(s00); s=s00-mean(s00); %load('bp.mat'); % bandpass 50-4000...
function disSimilarity = stringcompare(string1, string2) %voldif % this function takes as input two strings and returns % their dis-similarity. % % USAGE: % disSimilarity = stringcompare(string1, string2) % % INPUT % - string1: Strings to be compared (string) % - string2: Strings to b...
function display_bbox_detections( img, bbox_detections, score_thresh, category_names ) all_dets = []; num_categories = length(bbox_detections); for i = 1:num_categories bbox_detections_this_category = bbox_detections{i}; detection_scores_this_category = bbox_detections_this_category(:,5); is_above_the_thr...
% Nishimura, Shotaro, and Mvuma Aloys. % "Rejection of narrow-band interference in BPSK % demodulation using adaptive IIR notch filter." s = tf('s'); alpha = 0.5; beta = 0.5; numStep = 100; W1 = tf([0 -1 0 1]... ,[-2*alpha*beta alpha -alpha*beta+beta 1] ); W2 = tf([-1, 1], [...
function result = get_lyapunov_exponent(u) EPS = 1e-9; f = @(u) u.*exp(0.081 ./ u - 0.001 ./ (u.^2) - 0.305); fs = @(u) exp(0.081 ./ u - 0.001 ./ (u.^2) - 0.305) .* (1 + 0.002 ./ (u.^2) - 0.081 ./ u); sum = log(abs(fs(u))); res = sum; cur = u; n = 1; while abs(res - (sum + log(abs(fs(f(cur)))))/(n + 1)) > EPS ...
classdef Regular2Grid < handle % RegularGrid describes an evenly-spaced, 2-dim. Grid % All Coordinates are centered in grid boxes! properties (SetAccess = immutable) ex, ey % x and y distance Nx, Ny % number of grid boxes [aka pixels] for each direction xcMin, ycMin % start coordinates (lower le...
function net = trainSoftmaxLayer(X, T, varargin) % trainSoftmaxLayer Train a softmax layer for classification % net = trainSoftmaxLayer(x, t) trains and returns a softmax layer on the % input data x and the targets given by t. The user does not supply a % size for the softmax layer, as it will have the same siz...
function [CenterOfMass] = y_CenterOfMass_Surf(AtlasFile, SurfFile) % function [CenterOfMass] = y_CenterOfMass_Surf(AtlasFile, SurfFile) % Extract Eccentric Center of mass on surface % Input: % AtlasFile - the Atlas File % SurfFile - the Surface File % Output: % CenterOfMass - the Altals region table %____________...
function [ARRAY] = singleEmbeddedCode_(filename) count=0; [QRMTX,IdxVec,QSdim] = IdxSpacer_(filename); [m,~] = size(QRMTX); ARRAY = zeros(m,m,m); % ARRAY's size is based on the pixel dimension of the qr image numberofcols = length(IdxVec) % refeeres to the number of columns and rows in qr code cellsize = IdxVec(1); Z...
function [rakes, results, anglesbetween, misfit] = runComparison(faults, faultsHotspot, hotspotContribution, azimuth, faultOpening, comparison, slipData, stressData, eqData, eqDataStress, GPSData) %prepare inputs for tribemx d=zeros(sum(faultsHotspot.nEl), 3); d(sum(faults.nEl)+1:end, 3)=hotspotContribution; bc=one...
function enjambre = enjambreOptimizado(enjambre, trafico, configuraciones) printf('\n\nOptimizando pesos (PSO)...'); enjambre.w_min = str2num(configuraciones.pso_w_min); enjambre.w_max = str2num(configuraciones.pso_w_max); tamanoP = str2num(configuraciones.tamano_enjambre); enjambre.tamano...
function [ output_image ] = back_sub(background, foreground, threshold) %BACK_SUB Summary of this function goes here % Detailed explanation goes here output_image = (abs(background(:,:,1) - foreground(:,:,1)) > threshold) | ... (abs(background(:,:,2) - foreground(:,:,2)) > threshold) | ... (abs(background(:,:,3) - f...
%% Train an HMM on the word "four" and then find the Viterbi parse of a test signal into phones %#broken function wordSegmentation() setSeed(0); if(~exist('data45.mat','file')) error('Please download data45.mat from www.cs.ubc.ca/~murphyk/pmtk and save it in the data directory'); end helper(false); helper(t...
function [ corloc ] = eval_discovery addpath([cd '/VOCcode']); % initialize VOC options VOCinit; corloc = zeros(1, VOCopts.nclasses); for i = 1:VOCopts.nclasses cls = VOCopts.classes{i}; corloc(i) = VOCevaldis(VOCopts, 'comp4', cls, 'trainval'); % compute and display PR end end ...
% Basic implementation of the Kohonen Map % % Source: % T. Kohonen (1997). Self-Organizing Maps, 2nd. Edition, % Springer-Verlag. % % NOTE: This implementation aims to be simple and direct. More powerful % implementations of the SOM can be found in the SOMtoolbox demos. % % Authors: Guilherme ...
function A = divvy(A,k) A((mod(A,k))>0) = A((mod(A,k))>0)*k; end
function lambda = detecta_tecla(sinal, fs, sensibilidade) fh = [ 1209 1336 1477 1633 ]; fl = [ 697 770 852 941 ]; tecla1 = [ '10001000' '01001000' '00101000' '10000100' '01000100' '00100100' '10000010' '01000010' '00100010' '01000001' ...
function [ g ] = calc_g( Hz ) %% Calculates the magnetization from the magnetic field up to a constant value [kx, ky, k] = make_k(size(Hz,2), size(Hz,1)); Hz_fft = fft2(Hz); g_fft = Hz_fft .* (2 ./ k); g = ifft2(g_fft); end
function [f,d] = getImageSift(im, k) grayim = single(rgb2gray(im)); [fi,di] = vl_sift(grayim); [v,i] = sort(fi(5,:),'descend'); topk = i(1:k); f = fi(:,topk)'; d = di(:,topk)'; end
function [out]=Celastic(E,nu) % del = eye(3,3); % E = 1000; nu = 0.3; lamda = (nu*E)/((1+nu)*(1-2*nu)); mu = E/(2*(1+nu)); % for i = 1:3 % for j = 1:3 % for k = 1:3 % for l = 1:3 % out(i,j,k,l) = lamda*del(i,j)*del(k,l) + mu*(del(i,k)*del(j,l)... % + del(i,l)...
% Function that plots QB data and includes the experimental data for % comparison - takes some code from gui_averageQBall function plotQBs(t, Iset1, T, TT, QQ, Is, result, latencies, neff) % Plot shifted, averaged QB against experimental data figure; hold on plot(TT,QQ,'or',T,Is,'k',TT,result,'x'); title(['Ave...
function [ ] = FullIRLS( fn1, fn2, lowW ) %0.1 % close all; % run('D:\vlfeat-0.9.16\toolbox\vl_setup.m'); clf; [XSIFT, YSIFT, X_SIFT, Y_SIFT] = SIFT(fn1, fn2); figure(1); DRAW(fn1, fn2, XSIFT, YSIFT, X_SIFT, Y_SIFT, [], []); IRLS(fn1, fn2, XSIFT, YSIFT, X_SIFT, Y_SIFT, lowW); end
function [wpos, indpos] = compositivas(w) wp = []; ind= []; for i=1:length(w) if w(i) > 0 wp = [wp, w(i)]; % valor positivo del vector w ind = [ind, i]; % indice del valor positivo del valor w end end wpos = wp'; indpos = ind'; end
function [T,I,Y]=naivePerfusionResponseIVP2X4stacksub(ton,toff,Ttot) ode=modelODEP2X4stacksub(ton,toff); naive=zeros(7,1); naive(1)=1; setAuxiliaryP2X4stacksub(naive); [T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:7,'MaxStep',0.01)); I=getTotalCurrentP2X4stacksub(Y); end
function setDefaultParams(obj) % SETDEFAULTPARAMS Use SIFT default parameters % % Other m-files required: Matcha.m % Subfunctions: none % MAT-files required: none % % Author: Gabriel Moreira % email: gmoreira @ isr.tecnico.ulisboa.pt % Website: https://www.github.com/gabmoreira/maks % Last revision...
% Solving the linear and nonlinear inverted pendulum models with feedback % control from the LQR approach close all % File declaring the values of the various parameters to be used parameters; % Evaluating the various matrices for the linearized system [A,B] = get_system_matrices(); % Initial condition x0 = [0; 0; ...
clear all ; close all ; cd('C:\shared\mkt') ; fid = fopen('ES.txt') ; data = textscan(fid,'%s %s %f %f %f %f %f','delimiter',',','Headerlines',1) ; fclose(fid) ; offsetcount = 1 ; for offset=1:5 ; d5 = data{6} ; d5 = d5(offset:10:end) ; d5 = d5(250000:end) ; %d5 = d5(end-50000:end) ; % make a moving a...
classdef Genome < handle %GENOME, this class contains the entire gene pool for the neural net % AI that controls the computer mallet, genome can be shared across % various, simultaneous simulations of mallet properties (SetAccess = private) % NETWORK PROPERTIES height; % height of ...