text
stringlengths
8
6.12M
classdef Crop < dagnn.ElementWise %CROP DagNN cropping layer. % This is a pecurial layer from FCN. It crops inputs{1} to % match the size of inputs{2} (starting with a base crop amount). % A future version properties crop = [0 0] end properties (Transient) inputSizes = {} end methods f...
function [ tracks ] = network_connections( wwlln, apdata, nlegs ) %NETWORK_CONNECTIONS returns the great circle paths connecting strokes to % their locating stations. % % Written by: Michael Hutchins %% Initialize tracks and load station data tracks = [NaN, NaN]; stations switch nargin case 2 nlegs = 10;% ...
% The following code is testing the a04ex02getPDE for different % approximations for u' on the example from Assignment 3 Ex. 4 N = 100; % set the number steps h = 1.0./(N-1); xh = linspace(0,1,N)'; consts = [1, -4, 1, 1, 2]; f = @(x) -3. * x.^3 + 40 * x.^2 -14 * x - 7; [Lh,fh] = a04ex02getPDE(xh,f,consts,'0'); u =...
function CalcSSRT_autotest() % CALCSSRT_AUTOTEST - correct SSRTs obtained using QuantileMethodSSRT.m on a % set of GoRT, SSD-homogeneous datasets with NaNs for some values for goRT = 0.50:0.10:0.200 for ssd = 0.10:0.10:0.40 go_GoRT_sparse = goRT*ones([3 3 8]); go_GoRT_sparse(:, :, 7) = 30; ...
%% Projection of device eigenfunctions onto lead modes Chi=zeros(nl_t,n_alpha); for n=1:n_alpha for m=1:nl_1 Psi_p=zeros(1,nl_1); for i=1:nl_1 Psi_p(i)=Psi_c(c_table(i,1),n); end; Chi(m,n)=sum(Psi_p(:).*Xi_1(:,m)); end; end; for n=1:n_alpha for m=1:nl_2 P...
function vidsToFeats(retrieveHandImagesFrom, toFolder) signFolds = getFolderList(retrieveHandImagesFrom, false, false); signFolds = sortFolderNames(signFolds, ''); foldCnt = length(signFolds); for sID=1:foldCnt %different signs videoFolds = getFolderList([retrieveHandImagesFrom filesep s...
function [x,xr,x0] = SE2P_Laplace_fftnd(x,opt) %SE2P_LAPLACE_FFTND 3-dimensional discrete Fourier Transform. % [x,xr,x0] = SE2P_Laplace_fftnd(x,opt) % Returns the 3-dimensional DFT of the 3D array x with two periodic % directions and one free direction, in the arrays x, xr and % x0. The output xr conta...
% The information decomposition of the transfer entropy from two neighboring spins to a target % spin is evaluated according to the approach described % in Bertschinger et al., Entropy 16(4), pp. 2161-2183, 2014. %As an example, the file G6spin_256_0.mat cointans the probability distribution of six %spins, arrange...
function [K,f,a,error] = ej1_cp(M,L) % ------------------------------------------------ % aproximacion de 1 + sin(pi*x/2) usando residuos ponderados, con % colocacion puntual % ------------------------------------------------ % genera los puntos donde se evaluara el error x=linspace(0,L,(M...
function param = Parameters_spm(init_cell_soc_percent) % Cell SOC [%] to begin simulation with param.A = 2.05268559698939; % m^2; overall active surface area % param.I_1C = 60; % Amps (1C current of the cell, i.e. cell capacity in disguise) %% Solid particle radius [m] param.R_n = 2e-6; param.R_p = 2e-6; %% Soli...
function [dXdt,u,F] = dyn_aerial(t,X,p) params = p.params; Kp = p.Kp_sw; % proportional gain Kd = p.Kd_sw; % derivative gain Krh = p.Krh; % constant for raibert hopper M_r = p.M_r; B_EMF = p.B_EMF; if ~p.isMotorDynamics % if not adding motor dynamics M_r = 0*M_r; ...
%set up given vectors v1 = [3; 7; 0; 0]; v2 = [2; 5; 0; 0]; v3 = [1; 2; 9; 11]; v4 = [2; 5; 4; 5]; P = [v1 v2 v3 v4]; w1 = [1; 3; 4]; w2 = [-1; 0; 3]; w3 = [0; 5; 2]; w4 = [-2; -3; 1]; Q = [w1 w2 w3 w4]; %compute standard matrix A = Q*inv(P)
function load_modules() global params r = global_jess_engine(); r.eval(['(bind ?mod_clp_file "' char(params.module_definition_clp) '")']); r.eval('(batch ?mod_clp_file)'); end
function PEGSimMain(SNfile,PEfile,Pctrlrfile) % The main module for the sensor network simulator. This is a discrete % time simulator. The main loop is structured as follows: % 1) Check for capture... stop if capture % 2) Increment Time % 3) Using the position of the pursuer(s) and evader(s), check if the % senso...
% Image Reconstruction With Bandlimited Sensors Example % % This example demonstrates how the bandwidth of sensor elements can give % rise to artefacts in time reversal photoacoustic image reconstruction. It % builds on the previous 2D time reversal examples. % % author: Bradley Treeby % date: 27th August 2010 % last ...
function [c0,c1] = ... GradientDescent(x, y, c0, c1, learning_rate_c0, learning_rate_c1) % Default Learning rates if nargin < 5 learning_rate_c0 = 1e-9; learning_rate_c1 = 1e-12; elseif nargin < 6 learning_rate_c1 = 1e-12; end % set arbitatry initials...
data = readmatrix('sensorRead.csv'); %Create image in heatmap form h = heatmap(data, 'Colormap', jet(256)); grid off; h.title("Image from CSV"); h.XLabel = 'X'; h.YLabel = 'Y'; %fills in missing points with gray h.MissingDataColor = [0.8 0.8 0.8]; h.MissingDataLabel = 'No Data';
% Test preference-based optimization based on RBF+IDW on % multiobjective optimization problem. % % (C) 2019 A. Bemporad, September 22, 2019 clear all close all run_bayesopt=1; run_rbf=1; rng(0); % reset counter (for replicability of results) Ntests=1; % number of tests to repeat with different random seends RBFcal...
function sig_raw(varargin) %% Plot raw picture of the signal. %% In list operation data is not modified, %% pictures are saved in cache folder. func=@sig_raw1; sigproc2013.sig_process_list(func, '', varargin{:}); end function data=sig_raw1(data, list_file) % multiple files are not supported here if ...
function TPA_MainGUI % TPA_MainGUI % Integrates Behaivior data and Two Photon Experiments % and allows ROI extraction and Analysis. It also supports Electro Physiology data and Two Photon Experiments. % Important: % Expected Data Directory Structures for Behavioral experiments: % <your path>\Data - directory with...
function fourier_transform (wave, sampling_freq) fs = sampling_freq; y = fft(wave); n = length(wave); f = (0:n-1) * (fs/n); power = abs(y).^2/n; figure; plot(f,power) xlabel('Frequency') ylabel('Power') y0 = fftshift(y); % shift y values f0 = (-n/2:n/2-1)*(fs/n); % 0-centered frequency range power0 = abs(y0)....
% %%% extract data %%% % load bound_cfg % load BOUND_NAMES % load BOUND_PATHS % BOUNDPILOT=Group('names',BOUND_NAMES,'subjects_paths',BOUND_PATHS,'cfg',cfg); % save('BOUNDPILOT','BOUNDPILOT','-v7.3');%%%save%%% % %%%%%%%%%%%%%%%%%%%% %%%%example: plot%%%% (expdefs) %%%group_name.subject_name.dataset_name.function_nam...
%%% Function for calculating Cost Escalation Factor % Updated 11/9/2015 Author: --- function [CEF] = CEF(b_year, t_year) b_cef = 5.17053 + 0.104981*(b_year-2006); t_cef = 5.17053 + 0.104981*(t_year-2006); CEF = t_cef/b_cef; end
% count and plot figure plot(hitting1/100,'ro-','LineWidth',2); hold on plot(hitting2/100,'r+:','LineWidth',2); plot(hitting3/100,'bo-','LineWidth',2); plot(hitting4/100,'b+:','LineWidth',2); xlabel('Resampling number','FontSize',14); ylabel('Optimum found (%)','FontSize',14); legend('RMHC', 'RMHC,FHT', '(1+1)-EA'...
function main_batch(specStruct, run_mode, cost_function_names, outputString, variableFactorsInput, fileStackTemp, pathToOutput) % preamble loading of background parameters addpath(genpath(fullfile('Common'))); addpath(genpath('Libraries/Robotics_Corke')); addpath(genpath('Libraries/rl/ik_framework/...
clc; clear; n = 10; A = 2*diag(ones(n,1),0)-diag(ones(n-1,1),1)-diag(ones(n-1,1),-1) norm(abs(eig(A)),inf) k = 90; for i = 1 : k [Q,R] = qr(A); A = R*Q; end A
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%README: %%This function is used to compute the constraint violations of the system. %%It returns a vector containing which constraints are violated ('1') and a %%number indicating the total number of violations. %%%%%%%%%%%%%%%%%%%%%%%%%...
function [pcaData, coeffs] = calcPrincipalComponents(data, dimReduct, coeffs) % The PCA analyzes the variance of the dataset. Assumption: Dimensions with % a high variance contains more information than dimensions with a low one. % It transforms the data into a complete different space, keeping the % vectors with the h...
h = input('The initial height of the projectile above the ground in meters: '); v = input('the magnitude of the velocity in m/s: '); th = input('the angle in degrees with respect to the +-x-axis at which the projectile is fired: '); ax = input('the x-component of the acceleration, considering the sign, in m/s^2: ');...
function Y = triu(X,offset) % Symbolic upper triangle. % TRIU(X) is the upper triangular part of X. % TRIU(X,K) is the elements on and above the K-th diagonal of % X. K = 0 is the main diagonal, K > 0 is above the main % diagonal and K < 0 is below the main diagonal. % % Examples:...
function [ ] = make_ace_climatology_multiple_by_eql( clim_type, varargin ) %A function to read theACE v3.5/6 .mat data and calculate a climatology, %using equivalent latitude, with the relevant information. The directory %containing the .nc data, as well as the directory to which you want to %write the .mat data, shoul...
% SEA_ICE_EXTENT - calculates sea ice extent. %monthly files of aice (sea ice concentration in percent) for the Southern Hemisphere (sh) file1 = strcat('/c/ksmith/WACCM_piCtrl/aice_sh_piControl.0.allyrs.nc'); file2 = strcat('/c/ksmith/WACCM_piCtrl/aice_sh_piControl.1.allyrs.nc'); file3 = strcat('/c/ksmith/WACCM_piCtrl...
%% StaphSizer Code % Calculates S. aureus cell size from brightfield and fluorescent images. % Input: Brightfield image and widefield fluorescent image file from .nd2 % format % Output: lengths and widths of S. aureus in 4 different categories: full % septa, partial septa, no septa, and misplaced septa. Saves...
function [ sigNam,sigVal ] = anovaPH( mz,y,anno ) %statDiffs - starting point for visualising Nicole's bacterial data % mz - m/z values % y - spectral intensities % anno - cell of annotations (can be species,genus,etc... though not sure % of the technique's validity when compared multiple distributions ...
% 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 found_bi_sturct = ... Recover_bi_path(current_bi_point_sturct) %For a single bi point we need to find the path, next gen of bi points and %its coressponding bi points %IMPORTANT - the bi points are removed to pervent one bi point picking up %the other bi points as its neigbour % %I - % current_bi_po...
function Prep_for_EDDY_batch(varargin) % Written by Penny Cristinacce 11/05/16 % text loading changed 01/12/16 list=importdata('D:\WT\ANALYSIS\STUDY\foldersandinfo_temp.txt'); folderlist=char(list.textdata{:,1}); folderlist=cellstr(folderlist); analysislist=char(list.textdata{:,2}); analysislist=cellstr(an...
function spc_DendriteAnalysis(fn) % DendriteMatrix: row = timepoint, column = pixel % DendriteMatrix1: DendriteMatrix subtracted by baseline time point if ~nargin a = dir('*_ROI2.mat'); fn = a(1).name; fn = fn(1:end-4); end load(fn); evalc(['data = ', fn]); pixelPerMicronAt20Zoom = 10.666; %%%%Measure ...
% The following algorithm was implemented with help of the Book "Computergrafik und % Bildverarbeitung, Band II: Bildverarbeitung". 3. Auflage, 2011 % by Alfred Nischwitz,Max Fischer, Peter Haber?cker, Gudrun Socher % Adaptive Color Plane Interpolation (improved) function rgbfloat = iacpi_debayer(arifloat) % numbe...
% This script explores the pzplot() function in Matlab. We use different % transfer functions to plot the zero-pole graphs via pzplot(). clc; clear; num1 = [30 -180]; den1 = [1 4 13 7]; G1s = tf(num1, den1) zpk(G1s) num2 = [1 0 1 1]; den2 = [1 1 0 6]; G2s = tf(num2, den2) zpk(G2s) z = [-4 -2+4*1j -2-4*1j]; p = [2 -...
%% data of sin(2x) patterns = (0 : 0.1 : 2*pi)'; targets = sin2x(patterns); %% simple case given units units = 80; fun = 'x2'; eta = [1.5, 0.0005]; [m, var, Iter, F] = makerbf(patterns, units); Iter = [0, 20, 10000]; residual = diter(patterns, m, var, Iter, F, units, fun, eta, 0); %% tests units for given residual va...
function policy = policyIter(v1,policy,PSS) stable = false; gama = 0.9; c = zeros(1,10); q = zeros(10,10); N = 0; while stable == false b = policy; for s = 1:10 for a = 1:10 for sprime = 1:10 c(sprime)= PSS(s,sprime,a)*(sprime+gama*v1(sprime)); end ...
function [ surplus_nodepot surplus_gas surplus_depot unit_comp ] = calcProd(bases,orbitals,gas,units) %clear; %close all; %%%%%%% INPUTS %%%%%%% %bases = 3; %orbitals = 3; %gas = 6; % %% Command Center Units %scv = bases; %(Constant Worker Production) %%scv = 0; %(Stop Worker Pro...
%% Declaration of Authoriship % This code was written by Jason K. George % for the purpose of his final year project at Stellenbosch University % in partial completion for the subject Project (E) 448 %% Code % Second attempt to model the Mathematical principle behind interferometry amplitude = 50; distance = 10; inco...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ACA utility: pre-compute variables/parameters for ACA procedure % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function ACAUtils(file_names, NCmin, NCmax) if(~exist('hand_feature', 'dir') || ~exist('hcluster', 'dir')) ...
Met de functie randn() produceer je alleen negatieve willekeurige getallen.
classdef ItemBase < handle % 一個試題的基礎類別 properties data; % data: 試題向量 nd; % nd: 測驗的維度, nd = 1 代表這個 obj 只含1個試題 % nd = 2 代表含有多個試題 n; % n: 試題數 end methods % ItemBase 類別的建...
%迭代式阈值选择,背景图上面显示过分割,欠分割 %1对象叠加在原图上,看对象是否露出来,看是否有前分割现象 %2背景叠加在原图上 ImageInRGB=imread('G:\大三下\数字图像处理与机器视觉\code_matlab\2\apple2.png'); ImageIn=(rgb2gray(ImageInRGB)); imshow(ImageIn); %创建直方图 ImageGray=0:255; ImageBar=ImageGray; for i=1:size(ImageGray,2)%求频数 ImageBar(i)=sum(sum(ImageIn==ImageGray(i))); end b...
classdef Gear_Set < Gear % This class implements SOME procedures for the calculation of the load % capacity of cylindrical involute gears with external or internal % teeth. Specifically the calculation of contact stresses for the % assessment of the surface durability of cylindrical gears. % In a pl...
%setupADCtoDACloopback % script to define variables used by ADCtoDACloopback.slx % SS 17Nov2015 format compact Fs = 307.2e6; Ts = 1/Fs; Fgen = 20e6
% Program Active learning scheme to speed up learn phase % Author: Carlos Affonso / Olli Silven / Riku % Oulu University 7/sep/17 % Dataset Active learning criteria % Sguario = 1 Random selection = 1 % Balanced = 2 QBC = 2 ...
%% Solves qs 1.9 for assignment 1 % This function calculates the approximate value for e^x, according to the % given formula in question function expVal = exponential(x) % isNegative indicates if x is negative or not isNegative = false; % actual value actualVal = exp(x); % expVal is the compuatation of the e^x expV...
function dir = getdirection(direction) % % s = size(direction); % if length(s) > 2 % n = s(1,3); % else % n = 1; % end n = 1; dir = zeros(1,2); for i = 1:n mag = abs(direction(:,:,i)); s = sign(direction(:,:,i)); if mag(1,1) > mag(1,2) ...
clc; clear all; close all; %--------Inputs------------------------------------------------- N=1e6; %Number of data samples to send across the Rician Channel EbN0dB=0:11; %Eb/N0 in dB overwhich the performance has to be simulated totPower=1; %Total power of LOS path & scattered paths K=[1 5 20 30 60 80]; %A list of Rici...
function [ULb,FEVULB,IR,FEVm,ULb2,F4]=bootbands(Data,p,constant,iter,hor,conf,varargin) % The function [ULb,FEVULB,IR,FEV,ULB2]=bootbands(Data,p,constant,iter,hor,conf,varargin) % computes structural impulse response functions and variance decomposition % with bootstrap bands. % % INPUTS: % Data - t*n dataset...
% Marco Bettiol - 586580 - BATCH SIZE ESTIMATE % % CBT Full Test % % Estimate distributions obtained with CBT fixed different n % % Based on cbtsimpletest code clear all; close all; clc; % input logn_max=15; c=100000; % generate the test batch size x=1:logn_max; testsizes=2.^x; % resulting estimate distribution % E...
% ========================================================================= % % function [CI]= LeemisPark_ConfInt(MeanIn,NumMC,NPlot) % % ========================================================================= % % Created: 1 Nov 2009 (Dr. Temple) % Modified: Feb 2010 (Dr. Temple) % % Confidence Intervals (CI) Ca...
function ParentInfo=Shape_Category(CDataSetInfo, Mode, Param) %%%Doc Starts%%% %-Description: %1. This method is just a layer on Shape_Feature.m. %2. Image and binary mask are passed into Shape_Feature.m to compute the related features. %-Parameters: %No %-Revision: %2014-01-01: The method is implemented...
function InvPerm = PermInverter(Perm) % InvPerm = PermInverter(Perm) %Input: Perm, a 2 row matrix representing a permutation of a distinct set %of numbers. The first row has the numbers listed in increasing order, the %second row the same list permuted. Outputs = Perm(2,:); [a Ind] = sort(Outputs); InvPerm = Perm; I...
%% Swarm Simulation Video % Description : Switching Behaviors - Video % Author : Sasanka Nagavalli % Date : February 7, 2016 % Other Files : %% Clean up clear; clc; clf; close all; %% Paths addpath('../behaviors'); data_folder = '../data'; %% Find data trial_id = 'trial_20161205T045935'; data_file = 'N_...
function s = fn_structedit(s,varargin) % function s = fn_structedit(s[,spec][,hp]) % function s = fn_structedit(fieldname1,value1,fieldname2,value2,...) %--- % allow user to interactively modify a structure, and returns the modified % structure; returns an empty array if the figure is closed % this function is a wrappi...
clc; close all; clear ; %% %************************************* % Rigid Flexible Wings % without Control %************************************* nx = 12; %翼展小段 nt = 5 * 10^4; %时间 L2 = 2; %翼展长度 tmax = 100; Ttr = 50; dx = L2 / (...
%work in progress %by Dave Kaplan num_female_training = 341; num_male_training = 342; num_female_test = 38; num_male_test = 38; nrow = 200; ncol = 180; % Stack the images, male and female, in flattened row vector vectors into a 2d array % The first num_female_training row or num_female_test rows are female % fol...
function [y0, A, w, x0, varargout] = lorentzianPkFit(x,y,varargin) % LorentzianPkFit fits Lorentzian shaped peak/dip (single peak/dip) % y = y0 + (2*A/pi)*(w/(4*(x-x0)^2+w^2)); % Original data length should not less than 20 (length(x)>20) % % A function call returns the following fitting Coefficients: % y0, A, w(FWHM),...
function figHandle = mT_plotSetsOfSeries(PlotData, PlotStyle, varargin) % Produces subplots plots of sets of series % INPUT % PlotData [subplots in y-drection by subplots in x-direction] strct array, % with fields... % Xvals Either single strcutre or [num series] long strcut array with % fields... % ...
listPRN=unique(cmpPPP(:,2)); for k=1:9 st(k).st=[]; end for i=2:size(listPRN) mp2 = cmpPPP(cmpPPP(:,2)==listPRN(i),:); mp2 = mp2(2:end,:); if size(mp2,1)>50 mp=mp2; mp(1:5,3)=mp2(1:5,3)-mean(mp2(1:5,3)); mp(1:5,4)=mp2(1:5,4)-mean(mp2(1:5,4)); mp(end-4:end,3)=mp...
close all; clear; clc; %% Read customers locations origFile = sprintf('input/ecbd_customers.txt'); tripDataOrig = dlmread(origFile, ' ', 0, 0); origX = tripDataOrig(:,2); origY = tripDataOrig(:,3); %% Read bookings bookingFile = sprintf('input/ecbd_sorted_bookings.txt'); tripDataB = dlmread(bookingFile, ' ', 0, 0); ...
%A = load('C:\!\battery\battery\code\build\A.txt'); %B = load('C:\!\battery\battery\code\build\b.vec'); %load('C:\!\battery\battery\code\python\matrix.txt'); %rhs = load('C:\!\battery\battery\code\python\B.txt')'; A = load('../build/A.dat'); A(:,1:2) = A(:,1:2) + ones(size(A(:,1:2))); A = spconvert(A); B = load('.....
function dxds = mth_dcart_dsphere(r, theta, phi) % MTH_DCART_SPHERE computes the partials of 3D Cartesian coordinates % w.r.t. sphereical coordinates. % %----------------------------------------------------------------------- % Copyright 2017 Kurt Motekew % % This Source Code Form is subject to the terms of the Mozilla...
function [impres, tstep, err, errmsg] = spimpres_1208a(spmat,varargin) %% Description: generate impulse response of an S-parameter element. % For example, the impulse response of S(2,1) is the output at port 2 % when port 1 is excited by an impulse function. % input variables % spmat (double): s...
function [x, CostFinal] = GradientProjection(f, gradf, lb, ub, x0, maxIter, tol) % Solves the following problem via Projected Newton: % % minimize f(x) % subject to lb <= x <= ub %OUTPUT: % x - Constrained optimal solution % active - Set of active constraints % Cost - vector of decreasing cost %PARAMS ...
function LG=getinteraction_ellipse3(cam,Z,truedepth,Zact,z, a, b, alpha,xd,yd) KK=cam.K; px = KK(1,1); py = KK(2,2); v0=KK(1,3); u0=KK(2,3); Zact=([Zact' Zact'])'; if(truedepth) Zarr=Zact(:); else Zarr=Z*ones(8,1); end delta=0.01; a=a+delta;%for matrix conditioning b=b+delta;%for matrix conditioning x0=z(1)...
function [betaEstimate,thresholdEstimate]=QuestBetaAnalysisGauss(q,fid) % betaEstimate=QuestBetaAnalysisGauss(q,[fid]); % % Analyzes the quest function with beta as a free parameter. It prints (in % the file or files pointed to by fid) the mean estimates of alpha (as % logC) and beta. Gamma is left at whatever val...
function dicParm = getDicParmDiscrete(options,N) % % options - 'std', 'noFreq', 'noTimeShift' % % %%%%%%%%%%%%% L=log2(N); a=2; l=1; P_FIM = zeros(1,L+1); K_FIM = zeros(1,L+1); numAtom=0; if strcmp(options,'std') for j=0:L P_FIM(j+1) = N*(a^(l-1-j))-1; K_FIM(j+1) = ceil((a^(l-1+j))/2) - 1; ...
function mfiles = findAllFilesWithTag(tag) % Find all of the files in the PMTK directory structure that have the specified % tag. cd(PMTKroot()); [info,allfiles] = mfilelist(); mfiles = {}; for i=1:numel(allfiles) if(tagsearch(which(allfiles{i}),tag)) mfiles = [mfiles,allfile...
tk1=zeros(36000,50); for loop=1:50 img=strcat(num2str(loop),'.','jpg'); FDetect = vision.CascadeObjectDetector; %Read the input image I = imread(img); % b=I; % p=im2bw(b); I = medfilt2(I); [tempy,tempx]=size(I); o=1; tk= reshape(I,size(I,1)*size(I,2),1); tk1(:,loop)=tk; % o=1; end si=zeros(...
function [max_z, max_q, outinfo] = community_modularity(A, varargin) % function [z, q, outinfo] = community_modularity(A, optional_inputs) % % feature: This function conduct the greedy agglomerative algorithm to find % community structure that maximizes the network's modularity (Q). % % input: A adjac...
file= 'exa3_1'; load([ '2filter_',file,'.mat']); for p=1:Psensor figure(p); clf; subplot(211); ha= []; for n=1:Nspkr temp= plot(k_birth(n):k_death(n),true_tdoa(k_birth(n):k_death(n),p,n)*Ts,'k','linewidth',2); if n==1, ha= [ ha; temp(1) ]; end; hold on; end; ...
function res = f_dy(x, y) res = 2 * y;
clear; clc; %%%%%%%%%%%%%%% How to create a linear regression model %%%%%%%%%%%%%%% %linear regression model VehicleData = readtable('data\VehiclesItaly.xlsx'); VehicleData(1:10,:) lrm = fitlm(VehicleData,'Registrations~Population'); plotResiduals(lrm); plotResiduals(lrm,'probability'); outliers = find(lrm...
function [Total_Slave_Right_Distance,Total_Slave_Left_Distance,Total_Master_Right_Distance,Total_Master_Left_Distance] = Process_Overall(phns_Slave_Right,phns_Slave_Left,phns_Master_Right,phns_Master_Left,Out_Put,num,Flag_DanMaster) fpn_Slave_Right = fopen (phns_Slave_Right, 'rt'); fpn_Slave_Left = fopen (phns_Slave_...
clc;clear all;close all; %% initialization % başlatılıyor... swarm_size = 64; % suru parcaciklarinin sayisi maxIter = 50; % maximum iterasyon sayisi inertia = 1.0; % cıkıs kosulu correction_factor = 2.0; % düzeltim % ilk sürülerin yer...
% computes the g-functional for an lp space 1<=p<=inf function [s] = gLp(x, y, p) n = length(x); nrmxp2 = norm(x, p).^(2-p); s = 0; for i=1:n s = s + abs(x(i)).^(p-1) .* sign(x(i)) .* y(i); end s = nrmxp2.*s; end
% The data for experiment 2 can be found in % '/Volumes/BCI_Data/own_experiments/motor_imagery/movement_detection/long_ % movements/' % % First, make sure you have the following folders added to your matlab path: % % 'BCI_code/toolboxes/jf_bci/' % 'BCI_code/toolboxes/classification/' % 'BCI_code/toolboxes/eeg_analysis...
function cmc = CMCcurve(res, gnd_q, gnd_db) % param: res, each column for each query % param: gnd_q, each column for each query % param: gnd_db, each column for each query num_q = size(res,2); num_db = size(res,1); isfind = zeros(num_q,num_db); S = (gnd_q'*gnd_db)>0; for i = 1:num_q tmp_idx = res(:,i); tmp_S ...
% Este programa retorna a resposta do exercício 10 da lista 1. disp('10)Calcule o diâmetro interno de uma engrenagem cilíndrica que tem um diâmetro primitivo de 75 mm e um módulo igual a 1,5.') dp=75 % diâmetro primitivo e mm. m=1.5 %módulo. disp('10)A resposta do exercício 10 da lista 1 é : o diâmetro interno em m...
load('NN.mat'); f = fopen('finalW1L1.txt', 'w'); for i = 1:784 for j = 1:200 fprintf(f, '%f ' , finalW1L1(j,i)); end end
function [d]=feargenET_PFfitting_SimulationPSImargYN0(alphas,SDs,total_trials,p0,logname) % % This function simulates the PF Fitting Process PAL_AMPM for different % alphas (i.e. thresholds), betas (in SD units) and trials per fitting process (total_trials). % Output is the difference of the estimated parameter alpha/b...
%predicts which class a new point x belongs to x = [4 7]; probs=[]; for c = 1:3 probs(c) = density_norm(x, class_mean(c,:), class_covar(:,:,c)); end probs posteriors = (1/3)*probs max(posteriors) %largest posterior probability find(posteriors == max(posteriors)) %index of the largest posterio...
function [ binary,score ] = pts2binary( I,J, score ) %turns binary image with score image into x,y,s combo binary = zeros(size(score)); binary(sub2ind(size(score),round(I),round(J))) = 1; end
%% This script will calculate 10 measures for all files containing RS in the folder: filepathName % All files fcn*.m contain Matlab functions used in calculating measures. %% This will suppress al Matlab warnings warning('off','all') %% Add path to use EEGLAB Matlab functions; Change path to your local copy of ...
function niih = avw2nii_hdr(hdr) %funtion avwh = avw2nii_hdr(hdr) niih = define_nii_hdr; niih.sizeof_hdr = hdr.sizeof_hdr ; %hdr.pad1 = niih.? niih.extents = hdr.extents; %hdr.pad2 = niih.? %hdr.regular= niih.? %hdr.pad3 = niih.? if hdr.tdim>1 niih.dim(1)= 4 ; else niih.dim(1)= 3 ; end niih.dim(2) = hdr.x...
function predicted = trueDistance710S1(data) % Distances from AP to RP's in July 10th S1 walk values = [ 5.385164807 3.605551275 2.236067977 2.236067977 3.605551275 5.385164807 7.280109889 9.219...
%This program is used to solve one-dimension elliptic equation by Finite Element Method %Chang Liu %2016/6/1 clear all; close all; clc; N = 100; %This is the number of all elements xleft = 0; xright = 1; x = linspace(xleft,xright,N+1); %initialize the x coordinate h = diff(x); a = zeros(2,2,N); %initialize the local st...
function model = f_trainSVMmodel(clipsFile,modelFile) % load training data and assign labels to it clipsFile = fullfile(runDir, sprintf('/Output/seizures-training-data.mat',params.label,params.technique)); tlabels = zeros(length(featurePts),1); k = 1; for i = 1: length(features) if isempty(strfind(labe...
function [V_,F_,C_] = makeEnvelopeMesh(paperThickness,contentsThickness,height,length,flapProportion,meshDetail,jitterScale) % Some shorthands Tp = paperThickness; Tc = contentsThickness; H = height; L = length; N = meshDetail; % Storage global V F C V = nan(0,3); F = nan(0,3); C = nan(0,3); hsv = [0....
function TEST_rr_exact_test_decode() % function TEST_rr_exact_test_decode() % code to test the conceptual validity of statistical testing in high % dimensions by first decoding. eff_size = [0.1,0.5,1,2,5]; ndims = [1,5,10,100]; niter = 10; p_vals_null = nan(niter, length(ndims), 2); p_vals_true = ...
clear all; s = tf('s'); figure; hold all on; S=100*s/((50*s+1)*(2*s+1)); bode(S); tabk = [2 4]; tabti = [12 3]; tabtd = [6 7]; for i=1:2; for j=1:2; for k=1:2; S=tabk(i)*(1+s*tabtd(k)/(0.01*s+1)+1/(tabti(j)*s)); step(S,0.1); end; end; end; grid on; axis([0,0.1...
function [y] = mars_regressor2(model,X) %MARS_REGRESSOR : Evaluate The Output of a MARS Model % Given an Input Vector X (NxVars) % y (NxVars) MaxBasis = size(model.knotdims,1); BasisDepth = size(model.knotdims,3); K = sizeModel(model,MaxBasis); [N] = size(X,1); y = model.coefs(1)*ones(1,N);%first value is the bias ...
function [area,Number] = area_number( c , v , num ) Number = zeros(num, 1); area = zeros(num, 1); for i = 1 : num ind = c{i}'; area(i) = polyarea(v(ind, 1), v(ind, 2)); Number(i) = size(c{i}, 2); end end