text
stringlengths
8
6.12M
v=1:1:max_speed; v=v./3.6; trac=Power./(v)/(Mass*1000); figure, plot(v*3.6,trac.*1000*Mass) grid on kec = 1:0.1:max_speed; kec = kec'; a_trac = Power./kec./mass; Power_brake = max_brake.*kec; braking = Power_brake./kec; Res = zeros(size(kec)); for i = 1:length(kec) if a_trac(i,1) > max_accel ...
%% Plane XY q_xy=[phi_z; theta_z]; q_xy_dot=[phi_z_dot; theta_z_dot]; x_xy=[theta_z, phi_z_dot theta_z_dot]; u_xy=T_z; T_f=-((r_s*r_w*I_b_xy*sin(alpha)*T_z)/(r_w^2*I_b_xy+r_s^2*I_w_xy*sin(alpha)^2)); f_xy = [theta_z_dot; -(((r_w^2*I_b_xy+r_s^2*I_w_xy*sin(alpha)^2)*T_f+r_s*r_w*I_b_xy*sin(alpha)*T_z)/(r_w...
function[] = permutation_test_review(which_strain, which_nucleus) %e.g.: permutation_test_review('RC',{'dLGN','vLGN','OPN','pret'}) rng(1); %for reproducibility Nshuffle = 100000; filepath = 'Data\classification\'; filename = []; count_nuclei = 0; count = 0; x_infra = []; x_gamma = []; x_both = []; x_mfr = [];...
function [ ids ] = nearestRT( data, w ) % Solves tracking problem in the easiest way - just selecting the nearest % rect from the next frame. Distance is measured using coordinates, scale, % velocity and hog with some weights w. % % Inputs: % data - struct that can be read from data.mat or generated with % redu...
function b = npend_alphas_DAE_b_1(I1,L1,d1,g,m1,omega1,theta1,in8) %NPEND_ALPHAS_DAE_B_1 % B = NPEND_ALPHAS_DAE_B_1(I1,L1,D1,G,M1,OMEGA1,THETA1,IN8) % This function was generated by the Symbolic Math Toolbox version 8.1. % 04-Dec-2018 02:30:11 d_a1 = in8(:,1); d_a2 = in8(:,2); t2 = omega1.^2; b = [0.0;-g.*m1...
function script() close all; monte_carlo = load('monte_carlo.txt'); figure; hold on for i = 1 : length(monte_carlo) plot(monte_carlo(i,1) , monte_carlo(i,2),'+'); end hold off mean(monte_carlo(:,1)) mean(monte_carlo(:,2))
%-------------------------------------------------------------------------- % Plot data consisting of 8-bit samples with 1 channel % % The input format is [ch1 sample 1 | ch1 sample 2 | ch1 sample 3 | ... ] %-------------------------------------------------------------------------- clear; % input file % fn='/raid/ibo...
function MPHI=mphi(results,NAR,N) A=[]; for i=1:N A=[A;results(i).beta(1:N*NAR)']; end MPHI=zeros(N,N*NAR); for i=1:NAR PHI=zeros(N,N); for j=1:N PHI(:,j)=A(:,(j-1)*NAR+i); end MPHI(:,(i-1)*N+1:i*N)=PHI; end
function [FIRA, W, MTindex] = getML_RLSimPerceptualLearning9(Monk, NSEN, NTUNE, eln, DIRS, MTDIRS, SIMNUM, RECOMPUTE) % Simulation learning of the motion discrimination task with a % reinforcement learning rule (A-reward-penalty rule) using response % statistics of real MT neurons % % % add constant pooling noise (not...
solver = 'mosek'; basis = 'CG_red'; slack = 1; % nout = 2; P_ABC = get_dist('W-type'); nout = 2; P_ABC = get_dist('complete correlation'); % nout = 2; P_ABC = get_dist('anti-correlation'); % nout = 4; P_ABC = get_dist('EJM'); % Constraints [A_, b_, tmp, tmp] = get_spiral_constraints(nout, P_ABC, basis); K = struct();...
endTime = 0.005; tau = 0.1; tau1 = 0.1; k = 1; r = 2; l = 20; m = 100; p = 10; alpha = 1.0; beta = 1.0; main_event(endTime,l,k,r,tau,tau1,m,p,alpha,beta) %Softmax function, takes in a tau parameter and a normalized list of values for actions (should be the length of 'actions'); here these are estimated success p...
function [act_val, grid_pos, grid_coords] = eric_calc_winner_location(activations) %% Function called by eric_choice.m global NUM_ROWS NUM_COLS NUM_INPUT_DIMS global ETA G [act_val grid_pos] = max(activations(:)); %% Returns activation value and position in grid of winner %fprintf('\nact_val = %f\n', act_val); %fpr...
function ret = refineU(u,periodic) % refineU - Refine u using linear interpolation. Assuming u periodic. % Syntax: ret = refineU(u) % % Input: % u - A vector of size (1,M) containing the function u % periodic - A boolean value which decides if u is interpreted as periodic % % Output: % ret - A vector conta...
function metric = behaviouralMetrics_n(data, func, nobs) % function behaviouralMetrics_n(data, func, nobs) % Runs behavioralMetrics(data, func) with nobs randomly sampled (without % replacement) observations from data. NOBS = size(data,1); if nobs > NOBS; nobs = NOBS; end i = randsample(NOBS, nobs); ...
function FI=filt(I,F) %dimensioni del filtro [r,c] = size(F); %dimensioni dell'immagine [h,w] = size(I); %padding dell'immagine v_off = floor(r/2); h_off = floor(c/2); %crea un immagine nera di dimensioni adeguate PAD = zeros(h+r-1, c+w-1); %copia al centro l'immagine da filtrare PAD(v_off+1:(h+v_off),h_off+1:(w+h...
function gsr_resp = infer_gsr_resp(ID,can_corr,can_wrong) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Function computing the mean response w.r.t. some mode of our experiment. % % Parameters: % ------------- % ID {int} ID of the subject % CAN_CORR {double} canonical SC...
function [mag, phase, freq, powerDb]=fftTwoSide(signal, fs, plotOpt) % fftTwoSide: Two-sided FFT for real/complex signals % Usage: [mag, phase, freq, powerDb]=fftTwoSide(signal, fs) % Roger Jang, 20060411 if nargin<1, selfdemo; return; end if nargin<2, fs=1; end if nargin<3, plotOpt=0; end N = length(signal); % 點數 ...
%% 0.4 C1 a x = [10^-1, 10^-2, 10^-3, 10^-4, 10^-5, 10^-6, 10^-7, 10^-8, 10^-9, 10^-10, 10^-11, 10^-12, 10^-13, 10^-14]; a = @(x) (1-sec(x))./(tan(x)).^2; xa = a(x); %% 0.4 C1 b %% 1.1 E5 a x = linspace(0, 3); y = @(x) x.^4 - x.^3 - 10; a = y(x); plot(x, a); % P? ploten ser vi klart och tydligt att x = 0 i interval...
function []=svsNucleiInstrumented(impath,filename,fileext, resultpath, validationpath) %%, folder,tile) if nargin==0 image = {'astroII.1/astroII.1.ndpi-0000008192-0000008192',... 'gbm2.1/gbm2.1.ndpi-0000004096-0000004096',... 'oligoIII.1/oligoIII.1.ndpi-0000012288-0000028672',... ...
%Limpar close all clear all clc %Inicio mdl_sawyer %Load do Modelo Sawyer t = [0:.05:2]; % Tempo da transição: 1 a 2 com incrementação de 0.5 posicao1 = [0, -pi/2, 0, 0, 0, 0, 0] % Posição angular inicial (radianos) do Robot Sawyer posicao2 = [0.4, 0, -pi/2, 0, pi/2-0.2, 0, -0.3] % Posição angular s (ra...
function phase=BiChannels2Phase(encoder,varargin) % CopyRight:vastera@163.com % General introduction:% Convert the two channels of signals into a single monotonously increasing phase %% analyze two channels of encoder signals by combining them together as % complex nubmers %% ====================== INPUT ==============...
clear all; % clears plot close all; % closes plot xlim = [0 1]; % establish range for x t = 0.25; % time for Hubbard u = linspace(0,1,1001); % 1001 points between 0 and 1 y1k = hubbard(u,t); % y1k is hubbard using 1001 points iplot = 0; ...
function [profile,zero] = level_norm(profile) % input: profile - gaussian distributed value vector % output: profile - normalized profile value, so the distribution converges % to zero, zero - subtracted amount [hist_count,hist_binval] = histcounts(profile,round(abs(min(profile)-max(profile)))); [~, max_index] = m...
fromPath = '../../sumMe/videos/'; toPath = '../../data/temporalAttention/'; videos = dir(fromPath); nVid = length(videos); for i = 4:nVid [temporalAttention,~] = getTemporalAttention(strcat(fromPath,videos(i).name)); temp = strcat(toPath,videos(i).name); newName = temp(1:size(temp,2)-4); save(strc...
%{ example.Session (manual) # an experiment recording session for the given animal -> example.Animal session :smallint # recording session number for this animal ---- user :varchar(16) # experimenter's name session_date :date # the date on which the recording session began session_fol...
function y = fun2_lc num=[1 -7 0]; den=[1 3 8]; [num2,den2]=cloop(num,den); step(num2,den2); grid on; end
function target=returnsubstituted(value,target,index) % target=returnsubstituted(value,target,index) % return Target with all values indicated by Index substituted with Value if length(value)>1 error('Multiple values suggested') elseif length(value)<1 error('Attempted to fill nonexistent value') else target...
function [Bx,By,Bz,x,y,z,zx,zy,zz]=phase2 clc T = 290; %K P = 101.3e3; %Pa % C1, C2, C3, nC4, nC5, H2O, CO2, N2 index = [61,100,132,181,223,20,46,29]; n=[0.588235,0.058824,0.058824,0.058824,0.058824,0.058824,0.058824,0.058824]; % c2 c3 N-hexane water xylene %[Bx,By,Bz,x,y,z,zx,zy,zz]=phase...
function [ wp ] = wpDecision( peakx ) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here wp = cell(1,2); for i=1:size(peakx,1) wl = []; for j=2:size(peakx,2) s = setdiff(peakx{i,j}.peaki,peakx{i,j-1}.peaki); wl = [wl, selectNew(s,peakx{i,j}.peaki)]; end wp{i} = wl; ...
classdef (Abstract) IlluminationAbstractHandler < handle %ILLUMINATIONHANDLER helps use illuminants properties(Access = protected) solution space Magnituds scalingCoef filename end methods function obj = IlluminationAbstractHandler(solution, space) % Construct an object with existing values ob...
function obj = geom_interval( obj,varargin ) p=inputParser; my_addParameter(p,'geom','area'); my_addParameter(p,'dodge',[]); my_addParameter(p,'width',[]); parse(p,varargin{:}); obj.geom=vertcat(obj.geom,{@(dobj,dd)my_ci(dobj,dd,p.Results)}); obj.results.geom_interval={}; end function hndl=my_ci(obj,draw_data,param...
function tree = BuildGenericTdTreesViaClustering(data, params) [vecs, vals] = CalcEigs(data, params.eigs_num); embeddings = vecs*vals; %initialize root (top-most level): N = size(embeddings, 1); rev_tree{1}.folder_count = 1; rev_tree{1}.folder_sizes = N; rev_tree{1}.clustering = ones(1, N); rev_tree{1}.super_fo...
%start the ROS node in MATLAB and connect to the existing ROS network rosinit(); %determine the location of the Vel_pose_connect file vel_pose_connect_folder = fullfile(autoware.getRootDirectory(), ... 'benchmark', 'computing', 'perception', 'localization', 'autoware_connector', 'vel_pose_conne...
# -*- octave -*- function [f,b,bcic,bp,bt]=cic_design(N, ... # CIC order M, ... # diff. delay R, ... # reduction factor fc) # passband edge L = 64; # fir filter order Fo = R*fc; p = 2e3; s = 0.25/p; fp = [0:s:Fo]; fs = (Fo+s):s:0.5; f = [fp fs]*2; Mf = [1 abs(M*R*sin...
function ann = ProjectOutPose(obj,ann) %ProjectOutPose Summary of this function goes here % Detailed explanation goes here shape = obj.Ann2Shape(ann); shape = shape - obj.L2Shape(obj.Shape2L(shape)) + repmat(obj.pose_mu,[1,size(shape,2)]); ann = obj.Shape2Ann(shape); end
classdef M_2D %M_2D Summary of this class goes here % Detailed explanation goes here properties n_level = 0 sm w tm end methods function obj = M_2D(sm,w,tm) obj.n_level = length(sm); obj.sm = sm; obj.w = w; obj.tm = tm; end [n...
%This script allows to evaluate statistics of a given face detector. %Assuming haarCascade is loaded in memory, representing the detector %this code confirms that the 20 x 20 pictures are represented %with rectangles numbered from 0 to 19. Scale=1; x=0; y=0; minW=Inf; maxW=-Inf; RectX=[]; RectY=[]; RectWidth=[]; RectH...
function [S_period,fit_model,accel_axis,other_axis_fit,other_axis]=fit_man_accel(Data,si,f_name,poi,if_plot_figures) [~,D_y] = size(Data); [~,poi_y] = size(poi); S_period = cell(1,poi_y); fit_model = cell(1,poi_y); accel_axis = cell(1,poi_y); all_axis=2:D_y; other_axis_fit=cell(2,poi_y); ...
function string_without_number=Number2Word(string_with_number,library_set) if nargin<2 library_set='ENGLISH'; end %constructing language library LIB.ENGLISH={'Zero','One','Two','Three','Four','Five','Six','Seven',... 'Eight','Nine'}; LIB.SPANISH={'Cero','Uno','Dos','Tres','Cuatro','Cinco','Seis','Siete',... ...
clear clc close all format bank %%%%Wing Cube Loading - I get to decide this WCL = 9; %%%Weight Estimate (oz) weight_servo = 3; x_servo = 2; %%%in reference to the LE of the main wing weight_battery = 5.0; %% x_battery = -3; weight_esc = 4; %%% Power supply x_esc = -2; weight_motor = 4; %% and propulsion x_motor =...
f = open('Fig149.fig'); % f_children = get(f, 'Children'); f_grandchildren = get(f_children, 'Children'); f_lines = f_grandchildren{2}; time_scales = [25, 128, 250, 500, 1000] / 1000; mfcc_none_inst = f_lines(12).YData; mfcc_none_mode = f_lines(11).YData; mfcc_lmnn_inst = f_lines(10).YData; mfcc_lmnn_mode = f_lines...
%% SVD & SVD Analysis % Finding ranks rank_X_crp = rank(X_crp); fprintf('\nRank of X_crp is %d',rank_X_crp) rank_X_unc = rank(X_unc); fprintf('\nRank of X_unc is %d',rank_X_unc) % Taking the SVDs fprintf('\nTaking SVD of the cropped images...\n') [U_crp,S_crp,V_crp] = svd(X_crp,'econ'); V_crp = conj(V_crp)'; fprin...
function output = convInterp(pathInput, pathOutput, pathA, pathB, xFade) % CONVOLUTION W/ INTERPOLATION - compute an interpolation b/t FIR filters using a phase-vocoder % output = convInterp(pathInput, pathOutput, pathA, pathB, xFade) % use this for filtering problems % impulse responses should be ...
clc clear addpath(genpath('F:\Matlab_Home_HonsLab_sync')); %% CAPTURE LONG_AVERAGE_1 AND LONG_AVERAGE_2 frames_for_capture = 20; crop_scale = 0.5; sizeX = crop_scale*320; sizeY = crop_scale*240; downsample_gridstep = 10; [D1, D2, I1, I2] = Senz3D_capture_long2( frames_for_capture, crop_scale ); ND1 = cropD...
clear,clc SA='../../'; %add utilities to the path temorarily addpath ../../utilities %read inputs from LESinputs.txt readinputs(SA) z_u=linspace(dz/2,l_z+dz/2,Nz); z_w=linspace(0,l_z,Nz); awt=loadbin('../../output/temperature/awt.bin',Nz,'l')*u_star*scalarScales; Mwt=mean(awt(size(awt,1)/2:end,:)); figure; ...
function degree_data = pixel2degreexy(eyedata,col_t,col_x,col_y) % this function can convert pixel data of x/y to velocity of saccade degree in x/y in every ms % inputdata shoule be in at least three column. The first column is for time marker, the second is for x-axis position in pixel, the third is % for y-axis po...
% HAMZA HAFEEZ(2K18/ELE/37) % MUHAMMAD WASEEM HAYAT(2K18/ELE/75) clear all clc %Detect objects using Viola-Jones Algorithm %To detect Face FDetect = vision.CascadeObjectDetector; %Read the input image I = imread('Hamza37.jpg'); %Returns Bounding Box values based on number of objects BB = step(FDetect,I); figure,...
% TN 11: American Options via Monte Carlo Simulations % =================================================== close all clear all %tic % starting the clock timer % ========== % Parameters % ========== % ===== % Stock % ===== sigma=0.6656; % Volatility S0=8.15; % ============= % Interest rate and Dividend Yield % ===...
function [J, grad] = costFunction(x, A, L, y, lambda) %COSTFUNCTION Compute cost and gradient for gradient descent % J = COSTFUNCTION(x, A, y) computes the cost of using x as the % parameter for ||Ax-y||^2 + lambda*||Lx||^2 c = y'*y; Q = (A'*A)+lambda*(L'*L); J = x'*Q*x - 2*y'*A*x + c; grad = 2*A'*(A*x - y...
% 3차 스플라인 보간법으로 보간 clear; clc; close all; % 초기값 설정 % h=pi/10; t = 0:h:2*pi; n=size(t',1); % t는 z의 범위, n은 단면의 개수 the=t; % 나눌 평면의 개수 X=zeros(n); Y=X; Z=X; % 단면을 나타낼 X행렬과 Y행렬을 초기화 for ik=1:n r=2+cos(t(ik)); % 반지름 X(ik,:)=r*cos(the); ...
function all_tri = get_area_tri(face, key_idx) %input: % face should be 3*N % key index corrosponding two eye, nose, two mouse % %output: a 22*1 cell containing area triangle tri_idx{1} = [2 6 19]; tri_idx{2} = [2 6 7]; tri_idx{3} = [2 7 8]; tri_idx{4} = [2 8 9]; tri_idx{5} = [2 9 10]; tri_idx{6} = [2 10 11]; tri...
function retval = build_tree (rows,labels) bestsplit = find_best_split(rows,labels); %disp(bestsplit{1}); if(bestsplit{1}(1)==0 )%best gain retval = struct('predictions',rows); return; endif true_branch = build_tree(bestsplit{2},labels); false_branch = build_tree(bestsplit{3},labels); ret...
function FillKapaCylinderSym(nGx,nGy,epsa,epsb,L,R,Na,a1,a2,d1) global Kapa; invepsa1=inv(epsa); invepsa=[invepsa1(1,1) invepsa1(2,2) invepsa1(3,3) imag(invepsa1(1,3))]; invepsb1=inv(epsb); invepsb=[invepsb1(1,1) invepsb1(2,2) invepsb1(3,3) imag(invepsb1(1,3))]; nk=length(invepsa); ff=Na*pi*R*R/(a1*L); d11=d1/L...
function sol=simulationEulerACablation_Competence_v9(solutionorfates) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % v1 Vertebrate...
function [overlap] = polyoverlap(x1, y1, x2, y2) [xi, yi] = polybool('intersection', x1, y1, x2, y2); A1 = polyarea(x1, y1); A2 = polyarea(x2, y2); Ai = polyarea(xi, yi); overlap = Ai / (A1 + A2 - Ai);
clear,clc %Get access to the data files. parpath = fileparts(pwd); datapath = [parpath, filesep, 'ResData']; %Access to all files. dataFilesInfo = dir([datapath, filesep, 'EOG*']); dataFilesName = {dataFilesInfo.name}; thisFile = [datapath, filesep, dataFilesName{9}]; cblink(thisFile)
function [dp,sp] = params() %% Author: James Wilmott % Function that defines and returns the relevant parameters needed for % running the eyetracking hemifield relation experiment global display_params global stimulus_params rng(now+rem(now,1)*1000+cputime*1000); %change the seed of the random number generator %% D...
function handle = initializeMagTrackingNetworkStatistics() %initializeMagTrackingNetworkStatistics() % %This function will initialize the histogram part of mag tracking, which %shows stats about the incoming packets global MAG_NET_STATS subplotRows=3; subplotCols=1; %create the figure that we'll be using MAG_NET...
function im_pol = im_cart2pol(im_cart, origin, interp_method) %{ Converts an image from cartesian coordinates to polar coordinates. The output image will expand to fit the entirety of the Cartesian coordinates. It does this by computing the largest distance from origin to any pixel and setting that value as the radial...
function [y]=compute_fit(observed,model,varargin) % Takes a vector of observed latencies and a vector of simulated latencies % and computes some measure of fit: How well does the simulated % distribution approximate the observed data? To call, type for example % 'y=compute_fit([observed distribution], [simulated %...
% Question 1 Part 2 % Quang Anh Tran - 40075748 n = [0:9]; x=zeros(1:10); x(1:3)=1; y=zeros(1:10); y(1)=0; for (i=2:10); y(i)=x(i)+((1/4).*y(i-1)); end stem (n,y); xlabel('n'); ylabel('y[n]'); title('Output Response y[n]');
%------------- BEGIN CODE -------------- % ekran ve bellek on temizleme close all ; clear all ; clc ; % cikti formatini ayarlama format compact ; format short ; disp("A * x = b") % A = [4 -2 1 ; 2 3 -1 ; 8 -5 2] A = [3 -0.1 -0.2 ; 0.1 7 -0.3 ; 0.3 -0.2 10] b = [7.85 ; -19.3 ; 71.4] % A = [-1 -2 1 1 ; 2 1 1 0 ; 4 ...
function [m,p] = max_env(h) %function [m,p] = max_env(h) % % MAX_ENV calculates the maximum value and its position of the envelop % of an impusle response env=etc(h); [m,p]=max(env); end; 
function [updatedFeatureMat,updatedRealColInfo] = getHOGFeature(greyImg,binImg,avgWidth) [nRw,nCol] = size(greyImg); avgWidth = round(avgWidth); % Now we try to divide the image using avgWidth, if the image width can be % truly divided by the avgWidth, then it is very good but it is a bit hard % to happen % So, here ou...
function FeatureName=ParseFeatureName(FeaturePath, FeatureCategory) if exist([FeaturePath, '\', FeatureCategory, '_Feature.m'], 'file') FileType='.m'; else FileType='.p'; end if ~isdeployed && ~isequal(FileType, '.p') %Mcode FeatureName=[]; for i=1:2 switch i cas...
function [Tx,G,I,X]=HovorkaModelSimulation(T,x0,d,u,par) % HOVORKAMODELSIMULATION Simulation using the Hovorka model % % Syntax: [Tx,G,I,X]=HovorkaModelSimulation(T,x0,U,D,par) options = odeset('RelTol',1e-6,'AbsTol',1e-6); nx = length(x0); N = length(T); Tx(1) = T(1); X = x0'; for k=1:N-1 x = X(end,:)'; [...
function varargout=sml1_imana_repsup(what,varargin) % ------------------------- Directories ----------------------------------- baseDir ='/Users/eberlot/Documents/Data/SuperMotorLearning'; %baseDir ='/Volumes/MotorControl/data/SuperMotorLearning'; betaDir =[baseDir '/betas']; behavDir =[...
% Copied from https://gitlab.erlichlab.org/erlichlab/elutils.git/stats function y = nanstderr(x,dim) if nargin==1 dim=1; end gd=sum(~isnan(x),dim); y=nanstd(x,0,dim)./sqrt(gd-1); y(y==Inf)=nan; y(gd==0)=nan;
classdef (Abstract) Filling methods (Access = public, Static) function fillingData = generate(polygon,section) fillingData = []; offset = section.hatchOffset; distance = section.hatchDistance; pattern = section.hatchPattern; Xgenerate = ... ...
function im_chscaledepth(img,num1,num2)
% function [out]=readShake(fold) fold='B:\SmartSimResults\11_26\LWvary'; c=dir2(fold,'folders'); for i=1:length(c) d=regexp(c(i).name,['\d*.\d*'],'match'); d=abs(str2double(d)); lw(i)=d(1); n(i)=d(2)*d(3); inFolds=dir2(fullfile(fold,c(i).name),'folders'); for j=1:length(inFolds) data...
function [true_heatmap] = cal_heatmap_groundtruth(person1_data,person2_data,calib_const) % % % Input % person1_data: the location of the first person over time % person2_data: the location of the second person over time % % % Output % true_heatmap: the true heatmap cc = calib_const; nX = floor((cc.x_range(2)-cc.x_rang...
function [constraintFcns,isterminal,direction] = guardFunctions(t,x,contactMode) % Split up state vector into generalized coordinates and velocities q = x(1:2); dq = x(3:4); % Compute constraint function (transition if goes negative) a = compute_a(q); a = a(setdiff([1:3], contactMode)); % Solve the equations of motio...
[FileName,PathName] = uigetfile('*.nii','Select the registered template file','/home/sophie/Desktop/'); file=strcat(PathName,FileName) D=MRIread(file); Masks=D.vol; Sm=size(Masks); Masks2=zeros(Sm(1),Sm(2),Sm(3),87); for j=1:87 Masks2(:,:,:,j)=(Masks==j); end load('87to75.mat') R2stack=zeros(Sm(1),Sm(2),Sm(3)); Co...
clc; clear all; close all; %% 원신호 생성 % 원신호의 주파수 설정 fm = 2; % 원신호의 진폭 설정 A=2; % 원신호와 sinc 함수의 discrete time 설정 T0 = 0.04; t=[0:T0:1]; f0=1/T0; % 원신호 x=A*cos(2*pi*fm*t); %% 샘플링 신호 생성 % 샘플링 주파수 fs=4.2; Ts= round(1/fs,2); sample_step = floor(Ts/T0); n= 0:1/Ts; t_s(1) = t(1); x_s(1) = x(1); for i1 ...
%{ bs.TuningCondition (lookup) # conditions for tuning tuning_cond : tinyint # brain condition index ----- bs_min : float # brain state min value bs_max : float # brain state max value %} classdef TuningCondition < dj.Relvar properties(Constant) table = dj.Table('bs.TuningCondition') end met...
% Henry_Haustein_Lars_Ortscheidt_P1_Octave clear all fun = @(x) (1+cos(1.5*pi*x)).^(2/3); fun_abl = @(x) -pi*sin(1.5*pi*x)*(1+cos(1.5*pi*x))^(-1/3); %N = input('Anzahl der Stuetzstellen -1 :=N : ') for l = 0:11 N = 4* 2^l %Abstand Stuetzstellen h h = 2/N; %Stuetzstellen x x = -1:h:1; for...
function [fs] = ExtractGridHistogram(im, ng, bins) %EXTRACTGRIDHISTOGRAM Summary of this function goes here % Detailed explanation goes here xs = floor(linspace(1, size(im, 2) + 1, ng + 1)); ys = floor(linspace(1, size(im, 1) + 1, ng + 1)); fs = zeros(1, bins*ng*ng); count = 0; for i=1:ng ii = xs(i):xs(i+1)-1; ...
%-------------------------------------------------------------------------- % EXERCISE: BINARY CLASSIFIER %-------------------------------------------------------------------------- close all; clear variables; %Training N_images = 500; N_images_types = 10; path_train = 'train/imagen'; images=zero...
clc clear all close all x1=[1 2 3 4]; x2=[4 3 2 1]; x3=x1+x2; x4=x1.*x2; x5=x1-x2; subplot(611); stem(x1); ylabel('amplitude'); xlabel('time'); title('first sequence'); subplot(612); stem(x2); ylabel('amplitude'); xlabel('time'); title('second sequence'); subplot(613); stem(x3); ylabel('amplitude'); xlabel('time'); tit...
function POW = getcorpow(CSpect, ASpect) [Lng, Width, Height] = size(ASpect); %CCOR = real(ifft(CSpect)); ACOR = real(ifft(ASpect)); %inverse fft, correlation function, 0 delay is variance VAR = squeeze(ACOR(1,:,:)); %estimate of total variance for each pixel TVAR = VAR(2:Width-1,2:Height-1); %surrounding 8 pixel...
%% Iterative Shrinkage-Thresholding Algorithm (ISTA) %----------------------- A Proximal-Gradient Algorithm Method-------------------------% % CS_ISTA Algorithm (迭代收缩阈值算法 ISTA) % 输入:y---测量信号 M X 1 % A---恢复矩阵 M X N % lambda---正则化参数 % iter---最大迭代次数 % 输出 :xhk---估计的稀疏向量 N X 1 %...
classdef Orientation < handle %ORIENTATION Summary of this class goes here % Detailed explanation goes here %---------------------------------------------------------------------------- properties(Constant) HFS = 'HFS'; HFP = 'HFP'; FFS = 'FFS'; FFP = 'FFP'; end methods end end
function temp_PAUSE_exec(PauseInBetween, PauseDuration) % THIS FUNCTION CAUSES A TEMPORARY PAUSE IN EXECUTION FOR A TIME DURATION SPECIFIED BY "PauseDuration", ONLY IF "PauseInBetween == 1" if PauseInBetween == 1 pause(PauseDuration) end end
function score = scoreData( data ) %SCOREDATA Calculate a score for the data % The score is a combined measure of how good the data is % to be used when selecting S-parameters for classification end
%script allOff %turn off all channels %Note this resets all frequencies and eta values for n=0:511 configCryoChannel( rootPath, n, 0, 0, 0, 0, 1 ); end
function [type, MtypeLIST, numIons]=GetPOP_MOL(numMols) global ORG_STRUC MtypeLIST = []; for ind = 1: length(numMols) MtypeLIST = cat(1, MtypeLIST, ind*ones(numMols(ind),1)); end numIons = []; type = []; for num = 1:length(MtypeLIST) if length(ORG_STRUC.atomType)==1 type = cat...
% University of British Columbia, Vancouver, 2017 % Alex Kyriazis % William Choi % % Separates a large clump of cells into its constituent cells % function [ flag, somas ] = resolve_clump( dpcell ) somas = 0; flag = 0; Iobrcbr = dpcell.oImage; % % figure; % forshow = I...
function vi = KinematickaViskoznost(ro,ni) vi = ni/ro; end
function VAF=getVAF(Mb,E2,S) T=size(Mb,1)/S; M=size(Mb,2); % Get mean muscle pattern Mmean=zeros(T,M); for s=1:S Mmean=Mmean+Mb(T*(s-1)+1:T*s,:)/S; end % Total Variance SST=0; for s=1:S Mb0=Mb(T*(s-1)+1:T*s,:)-Mmean; SST=SST+norm(Mb0,'fro')^2; end % Variance Accounted For VAF=1-E2/SS...
% This loop generates a wide array of simulation outcomes for every % combination of parameter values. % See notes on Numerical Simulation Parameters for details on where these % parameter values come from % Note that the parameter vector should take the following form: % par = [a,b,c1,c2,x,k,t,Qm,s,entry,alpha,bet...
function [J_history, Theta1, Theta2] = trainNN(X, y, hidden_layer_size, num_labels, lambda, alpha, iters, Theta1, Theta2) input_layer_size = size(X, 2); if isnan(Theta1) Theta1 = randInitializeWeights(input_layer_size, hidden_layer_size); Theta2 = randInitializeWeights(hidden_layer_size, num_la...
function [ flag] = ConflictTest(A,row_i,col_j) flag=0 %% col test p=256; for ii=1:p if ii~=row_i if A(ii,col_j)==A(row_i,col_j) return end end end %%row test for jj=1:p if jj~=col_j if A(row_i,jj)==A(row_i,col_j) return end ...
clear all a = arduino('/dev/cu.usbmodem1421', 'Uno', 'Libraries', 'Adafruit\MotorShieldV2'); for i = 1:10 writeDigitalPin(a, 'D13', 1); pause(0.5); writeDigitalPin(a, 'D13', 0); pause(0.5); end clear a
function geneCopyFactor = childCopyGivenFreqsFactor(alleleFreqs, geneCopyVar) % This function creates a factor whose values are the frequencies of each % allele in the population. % % Input: % alleleFreqs: A list of the frequencies of the alleles in the population % genotypeVar: The variable number for the g...
function [ S] = sigma(A ) S = A; a = 1; if S(1,1) == 0 if S(2,1) ~= 0 S = swap_rows(S); S = givens_columns(S); elseif S(1,2) ~= 0 S = swap_columns(S); S = givens_rows(S) elseif S(2,2) ~=0 S = swap_rows(S); S = swap_columns(S); end else if det(S) < 0 ...
function [TRI,U] = trimeshgrid(d) % Opis: % trimeshhgrid sestavi triangulacijo trikotnika z oglisci % (0,0), (1,0), (0,1) in izracuna tocke triangulacije v % obliki baricentricnih koordinat % % Definicija: % [TRI,U] = trimeshgrid(d) % % Vhodni podatek: % d stevilo intervalov, na katere je razdeljena s...
function [ result ] = gauss( fx, x_ ) %gauss(fx, x) Summary of this function goes here % fx is the input function and must be a string % x is the limit of integral f = sym(strcat('(', fx, ')* exp(-x^2)')); result = double(int(f, -inf, x_)); format long end
% restoredefaultpath startup addpath([home '/ls_brain/methods/MASNET/Integrated Code']) addpath([home '/ls_brain/methods/MASNET/SRL'])
function [ labels ] = sample_split( nElem, split ) %SAMPLE_SPLIT(nElem, split) assignes labels to a nElem length array with % frequency given by split % e.g. split = [0.8 0.1 0.1] % Will give a labels vector with 80% 1, 10% 2, 10% 3 % % Written by: Michael Hutchins %% Check inputs if numel(nElem) ~= 1 error('nElem...