text
stringlengths
8
6.12M
function loseRateExcMaxNpercentRet = loseRateExcMaxNpercentRet(ret,N) % % 扣除最大亏损后收益率,输入参数Account是总资产变动情况 if nargin < 2 N = 5; end; [~,I] = sort(ret,'ascend'); I=I(1:round(size(I,1)*N/100),:); ret(I) = []; loseRateExcMaxNpercentRet = prod(ret+1)-1; ...
function [dX,dA] = valve(Xp,ups) dX = -Xp(1)^3/3 + Xp(1) + Xp(2); dA = -ups * Xp(1); end
function [xtrack,ztrack,xmtrack,zmtrack,w,sdrift] = nls_stepper_periodic_1d(K,ad,anl,cg,k0,kval,Om,om,sig,ep,tf,dt) % Llx is domain size, i.e. solve on domain [-Llx,Llx] % sig is -1 for bright/focusing, +1 for dark/defocusing % tf is total simulation time % mu is magnitude of damping on envelope of dar...
function M = mergematfiles(infiles,vars,varargin) %MERGEMATFILES Merges variables in multiple .mat files % function M = mergematfiles(infiles,vars,...) % % Merges variables in multiple .mat files. infiles specifies the files and vars specifies % the variables to merge. If vars is empty or equal to '-all', then merge...
clear all; close all; clc; global iter_prcd NUM_UAV SetTaskAllocation p_i p_f p_task NUM_TASK TASK_STATUS TASK_STATUS_ini global OBS_NUM OBS_VRT vrt_config DistPathForTask UNOBS_NUM iter_wpt cnt_terminate global HLI_vel HLI_max_dyaw dt chk_range cnt HLI_pos second_choice wpt global idxMinTask MinDistTask cntt ...
close all clear all clc % load the parameter values run Nominal_parameters.m t_ODE=[0 10]; IC_States=[50 1]; IC_Switches=1; jj=0; %% for ii=1:1:4 %% select the values of the bifurcation parameters if ii==1 % healthy control kappa_P=.6; % healthy control alpha_I=.3; Col='k...
function fitness = CalculateRouteFitness( route, locations ) origin = locations(route(1),:); length = 0; for i = 2:size(route,2) destination = locations(route(i),:); length = length + CalculateDistance(origin, destination); origin = destination; end length = length + CalculateDistance(origin, loca...
function saveanddisplay9(imagein) fun=@(x)nonuniforlbt(imagein,x); [step f]=fminbnd(fun,0.0001,3); % step=0.1290; %%CONSTRUCTING ACTUAL IMAGE LBTim = LBT(imagein,8,sqrt(2)); C8=dct_ii(8); Y=colxfm(colxfm(LBTim,C8)',C8)'; [Yq,entropynew]=dctquantise(Y/8,step); %%Calculating Entropy entropyold=bpp(quantis...
function [Ell_AA,E_AA,Ell,E,x0_AA,x0,y0] = get_ellipsoids(P) % GET AXIS-ALIGNED INNER ELLIPSOID [E_AA,x0_AA] = getAAInnerEllipsoid(P); % GET INNER ELLIPSOID [E,x0,y0] = getInnerEllipsoid(P);x0 = x0';y0=[y0(1) y0(3)];y0 = y0/norm(y0); % PROJECTIONS % ELLIPSOIDS DESCRIBED BY (x-q)Q^-1(x-q) % Also E'E = Q gives Ex+F fo...
function im = normImage(im, qt, lv) if ~exist('qt','var') qt = 0.995; end if ~exist('lv','var') lv = min(im(:)); end % from matt im = im - lv; softImMax = quantile(im(:), qt); im = im / softImMax; im(im > 1) = 1; im(im < 0) = 0;
function reverse_nodes_map= get_reverse_nodes_map(nodes_map) % Create a reverse map from node index to node name % % nodes_map - input map from node name to node index node_names= keys(nodes_map); reverse_nodes_map= containers.Map('KeyType','uint32','ValueType','any'); n= length(node_names) for i= 1:n ...
% -------------------------------------------------------- % ObjectNet3D % Copyright (c) 2016 CVGL Stanford University % Licensed under The MIT License [see LICENSE for details] % Written by Yu Xiang % -------------------------------------------------------- % Display the 3D shape retrieval results from ShapeNet % Note...
%% splitting frequency figure() FigH=figure('Position', get(0,'Screensize')); sgtitle('Comparison of splitting frequency per algorithm for varying burst durations with 5 minimum photon(s) per burst') subplot(3,4,1) bins=.9:.2:2.1; histogram(SplittingFrequencySlidingTimeWindow{1,3},bins,'facecolor','b','facealph...
function track = drawtrack(gui,row,scale,nRows) track.panel = uipanel('parent',gui.ctrl.panel,... 'position',[0.01 (row-.5)/(nRows+1) 0.98 scale/(nRows+1)],'bordertype','none'); temp{1} = uicontrol('parent',track.panel,'Style','text',... 'String','Window size (sec)','horizontalalign','right',... ...
function analyze_report_const( obj ) %ANALYZE_REPORT generates graphes for a single simulation run % Generates four Graphes and saves them as .eps and .fig % Included Graphes: % -Hive Statistics % -daily change in stored food and bees % -daily max/min of scouts and foragers % - count of active food patches an...
function [A1,A2,A3,A4,A5,A6,A7] = read_traj(file) %A1,A2,...A7 = dt,dEE,B,q,ptch,E,Pz traj1 = importdata(file); traj1 = traj1.data; for i = 1:7 eval(['A',num2str(i),'=traj1(:,i);']) end
f = @f1; a = 0; b = 1; eps=0.0001; [T, n] = bbct(f, a, b, eps); disp(T);
init_params; global b2 b2=15; tic D_arr=[logspace(0,2,100)]; p2_arr=[0.05:0.005:0.49]; qdata = zeros(length(p2_arr),length(D_arr)); for i=1:length(D_arr) currD = D_arr(i); for j=1:length(p2_arr) currp2 = p2_arr(j); [ Q1, Q2, Q3, V1, V2, V3, F1, F2 ] = abundances_region_d_CM( c...
%calculate the interfacial tension of methane + n-butane at310.95K and %108 Bar %reference comp. : highest boiling point clear all initNeqSim system1 = neqsim.thermo.system.SystemPrEos(310.95,108); % system1.addComponent('methane', 0.8); %mole frac like feed system1.addComponent('n-butane',0.2); system1.createDataba...
classdef MondrianTester < MondrianHandler %MONDRIANTESTER super class of VCETester and wbTester properties (SetAccess = protected) Iexperimental_corrected Iperceptual_corrected Ioutput Idiff corrFunc costFunc end methods %% MondrianTester: constructor function obj = MondrianTester(space, solution,...
function elem=atthinmultipole(fname,varargin) %ATTHINMULTIPOLE(FAMNAME,POLYNOMA,POLYNOMB,PASSMETHOD) % creates a thin multipole element % % FAMNAME family name % POLYNOMA skew [dipole quad sext oct]; % POLYNOMB normal [dipole quad sext oct]; % PASSMETHOD tracking function. Defaults to 'ThinMPole...
function [ pout ] = KLT_tracking(current_frame,value,Y,X,context,pin,other,affine) OtherIterations=other; AffineIterations=affine; pout=pin; for i=1:OtherIterations+AffineIterations; %while norm(delta_p)>threshold && iter<n %% calculate the error image [wimg,flag]= warp_a(current_frame, pout,X,Y); if flag==0; pout=...
clc; close all; clear all; setup; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%Scanning window character detection%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%% load test image imgpath='E:...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Charles Chen - SID: 810797715 % CSCI5722 - Computer Vision % Final Project - Force Field Transform Demo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Based on the work of Hurley, David J., Mark S. Nixon, John N...
%-------------------------------------- % Chris Dalke % CSC 249 - Project 01 %-------------------------------------- % Performs Gaussian Blur filter % on an image, and saves the result to % a file. %-------------------------------------- function resultImage = GaussianFilter(inputImage, imageName) % Perform basic...
pkg load symbolic function resultado = runge_kutta(str_funcion, a, b, n, x, y, orden) % Metodo de Runge-Kutta para aproximar la solucion de un problema de valor inicial % :param str_funcion: string con la funcion que se debe evaluar % :param a: Extremo inferior del intervalo % :param b: Extremo superi...
%% Creates a scatter plot of the fitnesses for each generation and overlays a plot of average and best fitness % % Must be in the evo_ros directory % % GAS 10-30-17 %% Read in table and set up plotting arrays cd('../GA/logs'); file_name = '6_sonar_symmetric_placement_without_failure_run4.dat'; %file_name = 'double_son...
% script to inverse the 3D shear velocity structure of PNG, using ambient noise and earthquake rayleigh wave inversion % % written by Ge Jin, jinwar@gmail.com clear load yzinv/regions.mat load tomo.mat [Nlat Nlon] = size(tomo(1).phV); Ndepth = size(region(1).outmod,1); shearV3D = zeros(Ndepth,Nlat,Nlon); regmap = ...
% CMPU250 - Professor Eric Aaron % HW2 - Kyle Patterson % April 2018 % #################################################################### % ### ### % # ...
function p_y=posteriorPredictiveLogisticRegressionVB(x,mu_prior,Pi_prior) %Jaakola, & Jordan (1996). A variational approach to Bayesian logistic %regression models and their extensions. putative_y=1; [mu_posterior,Pi_posterior,ksi]=logisticRegressionVB(putative_y,x,mu_prior,Pi_prior); lambda=@(ksi) (1/2-sigmoid(ksi))...
function show(elements3,elements4,coordinates,u) trisurf(elements3,coordinates(:,1),coordinates(:,2),u',... 'facecolor','interp' ) hold on % trisurf(elements4,coordinates(:,1),coordinates(:,2),u',... % 'facecolor','interp' ) Sqx = zeros(4,size(elements4,1)); Sqy = zeros(4,size(elements4,1)); Sqc = zeros(4,size(elemen...
function delta = calcDelta( l, a, b, dy, dx ) if dy ~= 0 dl = circshift(l, dy, 1); da = circshift(a, dy, 1); db = circshift(b, dy, 1); end if dx ~= 0 dl = circshift(l, dx, 2); da = circshift(a, dx, 2); db = circshift(b, dx, 2); end postive = l - dl...
clear all %% Script to run Canonical Correlations between Structurals and Demographics %% Read in relevant files OS_for_analysis = 2 % 1 for Mac, 2 for Windows if OS_for_analysis == 1 load('/Users/_omsa-tech/Dropbox/OldLaptop/DropBox_Documents/ABCD/Preprocessing/Release1.1/Residuals/ABCD_lm_CortVol_SS.mat') AB...
function deB_I = deBruijnImage(col,row,colPixels,savefile) %This function creates a col x row de Bruijn image using 6 colours %and a specified pixel-width for each colour band. A deBruijn pattern %with k = 3 (the effective number of colours is 3 because of the XOR == 2 %requirement which means that each colour can ef...
% utility: matrix_completion(alg_name,m,n,p,r,epsilon) % % Make sure all the called algorithms have the same form of Input and Output % Input for these algorithms: % 1) [m,n]: size of the matirx; r: rank of the matrix % 2) Omega: position of the known entries % 3) data: values of the known entries % 4) start: ...
% RSMA SNR function WSR = RS_Rate(H,SNRdB,weight,tolerance,Rth) u1 = weight(1); u2 = weight(2); u3 = weight(3); h1 = H(:,:,1); h2 = H(:,:,2); h3 = H(:,:,3); % Decoding order of messages at layer 2: 12-->13-->23 WSR_order(1) = RS_Rate_oneorder(H,SNRdB,weight,tolerance,Rth); % Decoding order of me...
function [y] = weak_incr_left(x) y = cumsum([x(1) subplus(diff(x))]); end
% input de 8 bits function [output] = fk(in,subkey) L = in(1:floor(end/2)); R = in(floor(end/2)+1:end); F = mapingF(R, subkey); first = xor(L, F); second = R; output = horzcat(first, second); end
function [ newD,newp2,seed_set_p1,seed_set_p2,con_pollen_p1,con_pollen_p2,hetero_pollen_p1,hetero_pollen_p2 ] = FULL_plant_dynamics( D,p2,Q1,Q2,Q3,V1,V2,V3,F1,F2) %assume we have Q1,Q2,Q3 V1,V2,V3 F1,F2 global z_rate global Smax global h %global half_saturation global generation_length_in_seconds global a1 g...
% Main % real u = sin (2*pi*x) % real p = Gu % p =-(2*((cos(2*pi*x) - cos(2*pi*(delta - x)))/(2*pi) + delta*sin(2*pi*x)))/delta^2 % % RHS f = -G^*G u % f =(4*sin(2*pi*x)*(cos(2*pi*delta)/2 - delta^2*pi^2 + delta*pi*sin(2*pi*delta) - 1/2))/(delta^4*pi^2) % % %% -----------------------------------...
function [obj] = calcByRound( PTL, mode ) % 潘其超,20140705,V1.0 % 潘其超,20140730,V2.0 % 1. 加入了对空TradeList的处理。 % 潘其超,20140814,V3.0 % 1. 加入了计算模式的选择。R by Round,P by Pair. if nargin == 1 mode = 'R'; end if mode == 'R' rStats = PTL.sumRound(); elseif mode == 'P' rStats = PTL.sumPair(); end obj = TradeSum(); ...
%% Initialization close all; clear; clc; warning('off' ,'images:initSize:adjustingMag'); robot = {[0 0; 8 0; 8 1; 0 1] + [4 24], 'robot'}; B1 = {[0 0; 10 0; 10 1; 0 1]+[0 18], 'CB'}; %% calc all layers [matrix_map, maps] = Q1_(robot,B1); %% show and save relevant layers maps{1}.Visible = 'on'; matrix_map{1}.Visible =...
classdef robot_triangle_new %robot_triangle Summary of this class goes here % Detailed explanation goes here properties pA0; PB = [2; 2]; % position of object B PC = [1; 0.6]; % position of object C (human) v_max = 0.5; % max linear velocity w_max = ...
function [ Adv, HorizVis, VertVis ] = initSolver( obj ) if obj.option.isKey('AdvDiffHorizontalDiffusionType') type = obj.getOption('AdvDiffHorizontalDiffusionType'); if type == enumHorizontalDiffusion.Constant HorizVis = NdgHorizDiffSolver( obj ); else HorizVis = NdgNoneHorizDiffSolver( obj ...
function [heading_time, forward_signal_time, hDeltaC_output_time, u_time, local_output_time, pfl3r_heading_time, pfl3l_heading_time, pfl2_heading_time, pfl3r_time, pfl3l_time, pfl2_time] = mutual_inh_model_n8_paper(gain_wind, gain_inh, opto_pattern, wind_angle, heading_angle, t_pre, t_stim, t_post, allocentric) %% Mode...
function [J grad] = nnCostFunction(nn_params, ... input_layer_size, ... hidden_layer_size, ... num_labels, ... X, y, lambda) %NNCOSTFUNCTION Implements the neural network cost func...
%% Opdracht 1 % In de onderstaande code staat een fout. Los de foutmelding op. % Let op! Bij het oplossen mag je geen variabele verwijderen je % mag indices ook niet aanpassen. rolWrijving= 1:3:91; Flucht=sin(0:length(rolWrijving)-1); Fstuw= rolWrijving+F1ucht;
function mui=MUIz(X,Z) %mui=MUIz(X,Z) %Mutual information estimation for a continuous + discrete variables. % X should be p1 x n array of n observations of the realizations of a % p1-dimensional continuous-valued random variable X, Z should be a % p2 x n array of the observations of a p2-dimensional discrete-valued ...
% regularization parameter tester % tests: % modesolver_reg % modal_filter % % 08/11/14 % mics = 2; order = 4; winsize = 1000; mscale = 0.1; mshift = 0.9; alpha = 1000; base = "/media/joe/Milarepa/experiments/2014_08_11/reg_eigs/"; directory = [base, num2str(clock)]; %mkdir(directory); [ve...
clearvars close all clc A = zeros(6,6); n=36+3; Tab = zeros(1,n); Tab(2) = 1; for i=3:n Tab(i) = Tab(i - 1) + Tab(i - 2); end x=3; for i=1:6 for j=1:6 A(i,j)=Tab(x); x=x+1; end end disp(A); %zad2 B = A([2,4,5],[1,3,5]); disp(B);
% *********************** Main Plot Function *********************** function y = plot_Pan(hObject, eventdata, handles) % Reset Plot for each new input delete(handles.axes1.Children); % No Runs Selected M = handles.panel; if sum(M) == 0 || isempty(handles.plot_data) plot(0); grid minor xlim([0 4]); ax =...
%{ Jacob Leonard ITP 168 - Fall 2015 jaleonar@usc.edu Revision History Date Changes Programmer ------------------------------------------------- 9/9/2015 Original Jacob Leonard %} fprintf('Average Calculator \n') trials = [1:10]; trials(1,1) = input('Trial 1: '); trials(1,2) = ...
% Make a base Rects of 300 by 300 pixels baseRect = [0 0 300 300]; %set the color of the rect allColor = [1 1 1; 1 1 1; 1 1 1]; %Screen X positions of our filled left rectangle squareXpos = [screenXpixels * 0.25]; numSquares = length(squareXpos); %Make our rectangle coordinates leftRect = nan(4, 3); for ...
function final_mat=ANMS(metric1) q=1; global metric1 final_mat %global x_cord_new y_cord_new x_cord_rot_new y_cord_rot_new for i=1:size(metric1,1) for j=1:size(metric1,2) if(metric1(i,j)~=0) metric1_array(q)=metric1(i,j); x_cord(q)=i; y_cord(q)=j; q=q+1; end ...
cfg = []; % Build simulation data cfg.data.run = true; cfg.data.patients = {'Simulation'}; cfg.data.simscenario = 'Merge'; % Choice: 'Null', 'Expand', 'Contract', 'Split', 'Merge' cfg.data.nbsim = 1; % Run a single simulation of one "seizure". cfg.data.seizures = {{[cfg.data.simscenario '_1...
function Integral = DiscreteSimpsonsRuleQ(Val,Phi) % % DiscreteSimpsonsRuleQ: Quick, discrete Simpson's rule % % Performs Simpson's rule integration with no input checking (quick), % aside from a determination of the interval count being odd or even. % % Val must be a matrix with independent values (not spacings) in th...
%UTILITIES: Non-user-facing documentation functions for the Props package
function [strxx,stryy,strzz,strxz,stryz,strxy,sxx,syy,szz,sxz,syz,sxy] = stress(nx,ny,nz,ns,exx,eyy,ezz,exz,eyz,exy,u,ib,pix,cmod) %Subroutine that computes the six average stresses and six nxy=nx*ny; % set up single element strain matrix % dndx, dndy, and dndz are the components of the average strain % matrix in a pi...
function [ Norm ] = NormRGBHist( Source, Target, verbose ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NormRGBHist: Normalise the RGB histogram of Source Image with respect to % a Target image using the Histogram Specification Method % % % Input: % Source - RGB Source ...
function []=DrawRectangle(x1,y1,x2,y2,x3,y3) %Make drawing of traingle DrawLine(x1,y1,x2,y2); DrawLine(x2,y2,x3,y3); DrawLine(x3,y3,x1,y1); end
function [Dint,DMat] = recallIntDelayTableWS_emp(R,p,m) %% Converts from fx order (in compile function) to whatever arbitrary node sequence is specified in the configuration % Starts off with canonical table based upon order of list in fx functions % fx{1} = @ABC_fx_bgc_mmc; % mot...
function Bootstrap = uq_OLS_bootstrap(Psi,Y, options) % BOOTSTRAP = UQ_OLS_BOOTSTRAP(PSI,Y,OPTIONS): return the bootstrap % estimates of the OLS regression problem with regressors PSI and % responses Y. OPTIONS. 'Replications' contains the number of Bootstrap % replications to calculate. % % See also: uq_PC...
function [score] = simplePolicyComparison(dates,agentOpts,envOpts,agentFolder) slashes = strfind(agentFolder,'/'); runFolder = agentFolder(1:slashes(end)); solutions = load([runFolder 'solutions.mat']); solutions=solutions.solutions; animalReducedStateSeqs = load([runFolder 'animalReducedStateSeqs.mat']); animalReduced...
function rssi_per(sname, rname) %s = load('sender_10.dat'); %r = load('receiver_10.dat'); %scrsz = get(0,'ScreenSize'); scrsz = [ 1 1 1600 1200 ]; figure('Visible', 'off','Position',[10 scrsz(4)/4 scrsz(3)/2 scrsz(4)/2]) s = load(sname); r = load(rname); MIN_RSSI = -5; own_rec = r(find(r(:,6) == 1),:);...
function figh = PlotResponses(stim,spike,totstim,stimlabels) fighh = figure('Position',[256 40 651 678]); width = 170; hgap = 50; height = 105; vgap = 25; across = 3; down = 4; % Set up axes for i = 1:down for j = 1:across bottom = 500-(i-1)*(height+vgap); left = (j-1)*(width+hgap) + 25; vaxh((j-1)*down+i...
clear all addpath /home/leonhard/spm8_r4667/ spm('defaults','eeg'); addpath('/data1/sleep/meg/scripts') rootDir = '/data1/sleep/meg'; cd(rootDir) s = ['find -L -mindepth 3 -maxdepth 4 -type d '... '| grep -E ".*subj[0-9].*sleep.*_0[1-2]\.ds$" '... '| sort -n > folderList_subjMegDirs.txt'] system(s); folderLi...
if ~exist('eyerecording', 'var') disp('loading compressed recording from file...') load('eyerecording-10.mat') end %% activityConstant = 20000; eyerecording = activity(eyerecording, 20000); %% skip = 100; scatter(eyerecording.ts(1:skip:end), eyerecording.activityOn(1:skip:end)) hold on scatter(eyerecording.ts...
clear all %% --------------- Importing the dataset ------------------------- % ---------------------------- Code --------------------------- data = readtable('D:\Machine Learning for Data Science using MATLAB\Classification\K-Nearest Neighbor\Social_Network_Ads.csv'); %______________________________________________...
classdef Experiment %< handle properties (Constant) % global constants see Par file end properties name = 0; Type = 'hand_reach'; % 'lick' 'pedal' Depth = 200; ImagingSamplingRate = 360/12; BehavioralSamplingRate = 2400/12; ...
function [A_k S] = task3(image, k) A = imread(image); A = double(A); [m n] = size(A); mniu = zeros(m, 1); Z = zeros(n, m); for i = 1 : m mniu(i, 1) = sum(A(i,:)) / n; endfor A = A - mniu; Z = A'; for i = 1 : n for j = 1 : m Z(i, j) = Z(i, j) / sqrt(n - 1); endfor ...
function [ mie3InputFileName ] = writeMie3InputFile( varargin ) %UNTITLED Summary of this function goes here % Detailed explanation goes here %% Define Default Parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%% D E F I N E D E F A U L T I N P U T P A R A M E T E R...
% Syntax % err = PS_StartStimChannel(StimN, ChN) % Description % Starts stimulation for channel ChN with previously configured parameters. % StimN - stimulator number to configure (starts from 1) % ChN - channel number to start stimulation (starts from 1) % Returns: % -1 - invalid argument(s) ...
function m_SigmaPos = f_AutoValPos2D(m_Sigma,e_VG) %La verificación de que si es tensor de tensiones es nulo y imponer que angle=0,sigmacri=0 no es %necesario ya que atan2 si es 0/0 (todas las tensiones nulas) devuelve angle=0. %Tampoco es necesario considerar el caso en que las dos tensiones principales ...
for i = 1:92 % choose a random expert and lay observation and generate a point % near to them new_exp(i,:) = mvnrnd(exp(randi(8),:),eye(size(full_score,2))); new_lay(i,:) = mvnrnd(lay(randi(7),:),eye(size(full_score,2))); end % train the svm model ...
%parameters to fill up clear all dz=6; z1=8; [FileName,PathName] = uigetfile('*.nii','Select the Nifti file','/home/sophie/Desktop/'); file=strcat(PathName,FileName) D=MRIread(file); Data=D.vol; S=size(Data); for i=1:S(4) Z0=1:size(Data,3); Zinit=((Z0-z1)*dz+dz/2); z_psf=abs(Zinit)*0.239+5.46; % Average the stack la...
function DATA = uitable1(col_headings, nRows) global DATA H %% Simple data entry table (GUI) nCols = length(col_headings); DATA=NaN*ones(nRows,nCols); SCRN = get(0,'ScreenSize'); ht=SCRN(4)-SCRN(2); wd=SCRN(3)-SCRN(1); indx=1/(nRows+2); H.DataTable_fig = figure('Units','pixels',... 'Position',[SCRN(1)+0.05*wd SC...
function allplots_cortex(sa, headdata, colorlimits, cm, unit, printfolder, varargin) % Stefan Haufe, 2014, 2015 % stefan.haufe@tu-berlin.de % If you use this code for a publication, please ask Stefan Haufe for the % correct reference to cite. % License % % This program is free software: you can redistribu...
function [zdc, slop] = f012zdc(q, f01) % calculates z dc bias amp from f01 % if f01 not given, finds the symmetric point(zdc where f01 is maximum) % Yulin Wu, 2017/3/9 if numel(q.zdc_amp2f01) ~= 4 throw(MException('QOS_setF01:illegaleAmp2f01Func',... sprintf('%s: illegale zdc_amp2f01, zdc_a...
fromHz = 44100; toHz = 44100; fromBits = 24; toBits = 16; fromDir = 'audio'; toDir = 'audio_AddSub'; fromFiles = dir(strcat(fromDir, '/*.wav')); for file = fromFiles' fileName = strcat(fromDir, '/', file.name) data = wavread(fileName); Fs = 44100; %44100 * 30 = 1323000サンプル %40ms毎に区切る %40ms = 44100 * 40 / 100...
clear all; close all; clc; [xTrain, tTrain, xValid, tValid, xTest, tTest] = LoadMNIST(1); xTrainMean = 0; for i = 1:size(xTrain,2) xTrainMean = xTrainMean + xTrain(:,i); end xTrainMean = xTrainMean./(size(xTrain,2)); xTrain = xTrain - xTrainMean; xValid = xValid - xTrainMean; xTest = xTest - xTrainMean; netwo...
function [icl, opl, ipl] = segmentInnerLayersCirc(bscan, Params, rpe, infl, medline, bv) % SEGMENTINNERLAYERSCIRC Segments some inner retinal layers from a BScan. % Intended for use on circular OCT B-Scans. % % [ICL, OPL, IPL] = segmentInnerLayersCirc(BSCAN, PARAMS, RPE, INFL, MEDLINE, BV) % Segments some inner layer ...
function [op] = charPurge(ip,replaceWith) % charPurge - remove everything that is non-alpha/numeric from a string % Specify choice of replacement if nargin == 1 charRep = '_'; elseif nargin == 2 charRep = replaceWith; end % Find, and replace lx = isstrprop(ip, 'alphanum'); fx = lx == 0; ip(fx) = charRep; op =...
function T = buildT(nh) T = 4 * eye(nh, nh); T(1, 2) = -1; T(nh, nh-1) = -1; for i = 2:nh-1; T(i, i-1) = -1; T(i, i+1) = -1; end; end
function [X_filtered,tnew] = avg(t,X,period) elements = round(max(t)/period); if(elements-1)*period < max(t) elements = elements + 1; end X_filtered = zeros(elements,1); tnew = transpose([0:period:(elements-1)*period]); j = 1; for i=2:length(tnew) n = 0; while t(j)<=tnew(i) X_filtered(i) = X_...
%% Implementing alpha-trimmed filter function mean = a_trim_filter(img) [m,n] = size(img); sum = 0;d = 0; for i=1:m for j=1:n sum = sum + img(i,j); end end mean = sum*(1/m*n - d);
function [coords, counts, means, stds] = plotTrialCorrelation(... trial, d_vars, i_vars, outlier_thresh, t_span, n_bins) if nargin < 2 t_span = 1:size(trial.fuse.xsmooth,2); end if nargin < 3 n_bins = 100; end
% xAllt: values of SemNet for the concept pair (-1...+1) % yAllt: cosSimilarities of concept pairs % zAllt: average degree of concept pairs % will show concept pair with largest distance from average (i.e. outlier) % in terms of prediction, cosS, degree. xAllt=xAll; yAllt=yAll; zAllt=zAll; xmean=mean(xAll...
clc; clear; img1=imread('rice.png'); background = imopen(img1,strel('disk',15)); I2 = img1 - background; img2=im2bw(I2,graythresh(I2)); x=[1 1 1]*1/3; s=convn(img2,x,'same'); I = imadjust(s,[0.3 0.7],[]); B = bwboundaries(I); RGB_label = label2rgb(img2,[.0 .0 .0], 'black', 'shuffle'); imshow(RGB_label) hold on for k = ...
% Interactive Graph cuts Segmentation Algorithm % Towards Medical Image Analysis course % By Ravindra Gadde, Raghu Yalamanchili % Interactive Graph cut segmentation using max flow algorithm as described % in Y. Boykov, M. Jolly, "Interactive Graph Cuts for Optimal Boundary and % Region Segmentation of Objects in...
function snr=snr_estimation(signal,format) load SNRModel_2PSK.mat load SNRModel_QPSK.mat load SNRModel_8PSK.mat load SNRModel_8QAM.mat load SNRModel_16QAM.mat load SNRModel_32QAM.mat x = real(signal); y= imag(signal); tmp = [x;y]; tmp = tmp'; %tmp = tmp1(randsample(10000,1000,'false'),:); switch format case '2PSK' ...
function newTracklets = filterTracks( tracklets ) % Gets nonzero tracklets [T,~,N] = size(tracklets); newTracklets = []; counter = 1; for n=1:N for t=1:T if (tracklets(t,:,n) ~= [0 0]) newTracklets(:,:,counter) = tracklets(:,:,n); counter = counter + 1; break; ...
function [IntervalMatrix] = bisection_func(a, b, delta, max_iter) %function that look for zeros in whole generally given interval LocalIntervals = localInterval(a, b, delta); IntervalMatrix = zeros(1,2); for i=1:size(LocalIntervals) IntervalMatrix(i,:) = bisection_funcLocal(LocalIntervals(i,1), LocalInterv...
function xmlStruct = ReadXMLHeader(xmlString) re = '<(?<property>[^/?<>]*)>(?<data>[^/?<>]*)(</\k<property>>)*'; matches = regexp(xmlString,re, 'names'); xmlStruct = struct(); i = 1; while i <= length(matches) if strcmp(strtrim(matches(i).data), '') sub_struct = matches(i).prop...
x = -10 : 0.1 : 10; y = -10 : 0.1 : 10; [x_new, y_new]=meshgrid(x,y); for k1 = 1:size(x_new, 1) for k2 = 1:size(x_new, 2) X = [x_new(k1, k2), y_new(k1, k2)]; z(k1, k2)=ObjectiveFunction(X); end end surfc(x_new, y_new, z); xlabel('x'); ylabel('y'); zlabel('Objective Wert') shading flat
function plotc(x, y, varargin) x = [x(:); x(1)]; y = [y(:); y(1)]; plot(x, y, varargin{:}); end
function [ command ] = create_distance_command_function( x_dist, y_dist, z_dist ) % Creates distance command by concatenating parameters separated by commas % starting with d addpath(genpath('../')); command = strcat('D', num2str(x_dist)); command = strcat(command, ','); command = strcat(command, num2str(y_di...
function [ HPT, Cycle ] = HPT1Stage( CycleIn, HPT_In, HPC, DesignInputs, DesignCriteria ) % Set outputs equal to inputs, add to outputs throughout function HPT = HPT_In; Cycle = CycleIn; % Determine row indeces for HPT stations Station_4 = find(ismember(Cycle(:,1),4),1); Station_41 = find(ismember(Cycle(:,1),41),1); ...
function [force,torque] = force_z(n,m,a,b,p,q) % force_z.m: Finds z component of optical force and torque % % Usage: % [Fz,Tz] = force_z(n,m,a,b,p,q) % OR % [Fz,Tz] = force_z(n,m,ab,pq) % % What units are you using for a,b,p,q? % If you have simple units like (using incoming/outgoing): % power = sum( abs(a).^2 ... ...
%%Ejercicio 4 % datos=csvread('clouds.csv'); %alto=20; %ancho=20; %nro_epocas=10; % %w=SOM(alto, ancho, datos(1:3000,1:2), nro_epocas); %ww=[w(:,:,1); w(:,:,2)]; %csvwrite("pesos.csv",ww); %w=csvread("pesos.csv"); w=csvread("pesos2.csv"); w_aux=w; w=zeros(size(w,2),size(w,2),2); w(:,:,1)=w_aux(1:size(w,1),:); w(:,:,2)=...
function [void] = speedComp(a_trials) %// %// SYNOPSIS %// speedComp(a_trials) %// %// ARGS %// a_trials in number of trials to run %// void out dummy output %// %// DESC %// Does a quick and dirty speed trial on matrix multiplication. %// %// HISTORY %// 04 September 2002 %// o Ini...