text
stringlengths
8
6.12M
function [sym] = symmetrize(clrs, rev) if ~exist('rev','var') || isempty(rev) rev = false; end N = size(clrs,1); fwd = [1:N] * (~rev) + [N:-1:1] * rev; bwd = fwd(end-1:-1:1); sym = [clrs(fwd,:); clrs(bwd,:)];
%% Script that loops every sequence of every participant % to fit the model (frugFunNoise.m) to the data (matdata) %% Import data from text file. % Initialize variables. filename = 'U:\Desktop\S_AdultCuriosity\BayesianModel\matdata.csv'; delimiter = ','; startRow = 2; %% Format for each line of text: % c...
% new_asdf = ASDFChangeBinning(asdf, factor) % asdf - {n_neu,n_bin} the old asdf binned with different bin size % factor - (1,1) the number of bins that you want to consider as one bin % in the new asdf. must be an integer. % % Returns: % new_asdf - {n_neu,n_bin_new} the new asdf binned with ...
function [out1,out2] = km_krlst(vars,pars,x,y) % KM_KRLST One iteration of the Kernel Recursive Least-Squares Tracker % Algorithm. Includes regularization and growing+pruning to maintain a % fixed budget. Assumes a fixed value for the lengthscale, the % regularization factor and the signal and noise powers. % INPU...
function send_acknowledge(handles,messageid) % SEND_ACKNOLEDGE - Send a message to client that acknowledge the % reception of an incoming OSC message (containing a identifyer) % % Usage: send_acknowledge(handles,messageid) % % Build message structure message.path = '/acknowledge'; message.tt = 'i'; message.data{1} = ...
function varargout=plClosedOrbit(varargin) %PLCLOSEDORBIT Plots H and V 4x4 closed orbit % %Helper function for atplot: plot %- H and V closed orbits on left axis %- Dispersion on right axis % % EXAMPLEs % >> atbaseplot(ring,@plClosedOrbit,{'dp',0.01}); % >> atplot(ring,@plClosedOrbit,'dp',0.01); (obsolete) % % S...
function [outVol] = compare_templates(tName1,tName2,type,tName3,tName4) % Compares two retinotopic templates % % Written by Andrew S Bock Oct 2015 %% set defaults if ~exist('type','var') type = 'ecc'; disp('Assuming template is ''ecc'''); end %% Load in templates t1 = load_nifti(tName1); t2 = load_nifti(tNa...
%The function implement the 2D Walash Transform which can be used in %signal processing,pattern recognition and Genetic algorithms. The Formula of %2D Walsh Transform is defined as : %% N-1 N-1 q-1 %% ---- ---- -- %% 1 \ \ | | b[i](m...
%% Test reg conf clear all f= @(x) 3+0.5*norm(x)^2; g=@(x) x; h=@(x) eye(3,3); x0=[1; 2; 1]; nb_max=10e6; delta_0=3; delta_max=10*norm(x0); g1=0.5; g2=2; n1=0.25; n2=0.75; eps=1e-3; [ngsol, nevals,nb_iter, xsol, f_xsol, delta_fin ] = regionsConf( f, g, h ,x0,nb_max, delta_0, delta_max, g1,g2,n1,n2,eps )
function hoba_sofa2wavh(SOFAfile,nbits,wavefile) %------Parse inputs:-------- %error(nargchk(1,2,nargin)); if nargin < 1 % test %SOFAfile = './examples/CIPIC_subject_003_hrir_final.sofa'; SOFAfile = './examples/LISTEN_irc_1002.sofa'; nbits = 16; %wavefile = './examples/CIPIC_subject_003_hr...
%This is a function to import an encoded file from the FPGA 4piBetaGamma %acquisition system, and decode the data into a matrix. function TheData = DecodeData(filename) EncodedData = load(filename); EncodedData = uint64(EncodedData); TheData = zeros(max(size(EncodedData)), 4); %Get channel 1 data, 1st column %Not s...
function [s,info] = mltutorShrinkOutput(M_in,com_max,max_size,max_show,max_show_fac,min_s,mklatex) % % Returns output of all kinds of arrays in a compressed form in the % string s % % works with single,double,logical,all integer types % works for real and complex numbers % % Standard call: % % s = mltutorShrinkOutp...
function Isum = falco_zwfs_sim_image(mp) %--Compute the DM surfaces outside the full model to save lots of time if(any(mp.dm_ind==1)); mp.dm1.surfM = falco_gen_dm_surf(mp.dm1,mp.dm1.dx,mp.dm1.NdmPad); end if(any(mp.dm_ind==2)); mp.dm2.surfM = falco_gen_dm_surf(mp.dm2,mp.dm2.dx,mp.dm2.NdmPad); end ...
%SimRIS_v18(Environment,Scenario,Frequency,ArrayType,N,Nt,Nr,Tx_xyz,Rx_xyz,RIS_xyz) clearvars tic Environment=1; % 1 Indoor (InH - Indoor Office) / 2 Outdoor (UMi - Street Canyon) Scenario=1; % 1 (RIS in xz plane - left side wall) or 2 (RIS in yz plane - opposite wall) Freque...
classdef RS232_Interface < handle % Provides a framework for essential communications with serial devices. % % RS232_Interface is an abstract class that contains the basic raw methods % and properties for connecting to and controlling a serial instrument. It % is defined as a handle subclass to prevent an instance of t...
function Img=BandImage(data, iband) % --- Jinrong He , Nov. 7, 2016 ---- % Show 2D image data on a given band index Img=data(:,:,iband); colormap(gray); imagesc(Img); title(['Image on ', num2str(iband), 'th band']);
function inputImg = thin( inputImg ) %thin 此处显示有关此函数的摘要 % Hilditch % 读取图像 [row, column] = size(inputImg); count = 0; %前景为1,背景为0 for i = 1:row for j = 1:column if inputImg(i, j) == 1 inputImg(i, j) = 0; else inputImg(i, j) = 1; end end end ...
function [kmlname filename] = TotalsAverage(dtime, input_dir, prefix) for i = 1:length(dtime); files{i} = [input_dir 'OI_' prefix '_' datestr(dtime(i), 'yyyy_mm_dd_HH00')]; end medianTime = datestr(median(dtime)); clear i tmp = load(files{1}); [r,c] = size(tmp); uv = nan(r,c,length(files)); for x = 1:length(fi...
function scheduler(gpus) % SCHEDULER runs an experiment schedule % SCHEDULER(gpus) runs the given list of experiments % on the gpus provided startup; useBnorm = true; local = false; if nargin == 0 gpus = []; end % benchmark('alexnet_imagenet', gpus, useBnorm, 'e2', 256, local); % benchmark('vgg_m_imagenet', ...
function CMTK_warp(ref, mov, out, initial) %CMTK_warp calls cmtk % disp disp("performing nonrigid registration with arguments:") % creates the command args tool = "cmtk warp"; init = join(["--initial" escape(initial)]); options = join([ "-v" "--fast" "--grid-spacing 40"...
%function refuwin function refuwin hpar=gcf; % Setup figure fh=750; fw=400; hfig = figure('Color',[0.8 0.8 0.8], ... 'Name','Refueling',... 'FileName','/cm/tools/source/mlab/cm_distplot/refuwin.m', ... 'Position',[800 200 fw fh], ... 'Tag','Refuwin', ... 'Resize','off',... 'MenuBar','none',... 'ToolBa...
function rECI = HCItoECI(obq, rHCI) rotation = [1, 0, 0; 0, cosd(obq), sind(obq); 0, -sind(obq), cosd(obq)]; rECI = rotation*rHCI; end
function def = sysPara() %% Parameter definitions in SI units def(1) = 8; %gravity (m/s^2) def(2) = 1; %leg length (m) def(3) = 0; %inital position X def(4) = 0.1629; %inital velocity X def(5) = 2*def(2); %inital position Y def(6) = 0; %inital velocity Y def(7) = pi/2; %in...
function f = print2D(XF_NAME,YF_NAME,plotName,xl,yl,col) xfile_pointer=fopen(XF_NAME, 'r'); yfile_pointer=fopen(YF_NAME, 'r'); formatSpec='%f'; x = fscanf(xfile_pointer,formatSpec); y = fscanf(yfile_pointer,formatSpec); if yl=="errorRel" for i = 1:length(y) if y(i)>=1 || y(i)<=-1 y(i...
function [ ] = knn_eval( X_train, y_train, X_test, y_test, k_range ) %KNN_EVAL Implementation of kNN evaluation. % % input ----------------------------------------------------------------- % % o X_train : (N x M_train), a data set with M_test samples each being of dimension N. % ea...
function a=imagediff(I1,I2) %membaca foto I1 = imread('086.jpg'); I2 = imread ('087.jpg'); %menampilkan foto imshow(I1) %mengubah rgb - greyscale foto 086 I3 = rgb2gray(I1); I4 = rgb2gray(I2); %mencari rata2 intensitas meanI3 = mean2(I3); meanI4 = mean2 (I4); [row, col, lay] = size(I2); for i = 1:row for j = 1:...
function [obj,obj_prime] = recover(obj,FEM,obj_prime,FEM_prime) % analysis results u_ee = FEM.u(obj.gdof,:); u_e = u_ee([1,2,4,5,7,8,10,11],:); nm = size(u_e,2); FEMCASE=FEM.CASE; % speeds up execution XN = [obj.x1(1:2),obj.x2(1:2),obj.x3(1:2),obj.x4(1:2)].'; XC = sum(XN)./4; if nargin < 3 % elem...
function w = train_mse_fusion(targets,non_targets,prior,w); % Train linear fusion with prior-weighted mean-squared-error objective. % % Usage: % w = TRAIN_MSE_FUSION(targets,non_targets,prior,weights) % w = TRAIN_MSE_FUSION(targets,non_targets,prior) % w = TRAIN_MSE_FUSION(targets,non_targets) % % Ti...
% a function which returns the sum of the magnitudes per direction of the gradient function res = getMag(discretized, gMag, bins) res = zeros(bins,1); [X,Y] = size(discretized); for i = 1:1:X for j = 1:1:Y idx = discretized(i,j); res(idx) = res(idx) + gMag(i,j); en...
classdef Controller %CONTROLLER Summary of this class goes here % Detailed explanation goes here properties Nstates; Nevents; end methods function Con = Controller() end function dxdt = derivative(Con,t,x,u) dxdt = zeros(size(x)); ...
%Sound pressure around a rigid sphere clear all; clc; N = 8; Lx = 10; Ly = 10; Lz = 6; res = 0.1; rcv_x = 5; rcv_y = 5; rcv_z = 3; [x,y,z] = meshgrid((0:res:Lx)-rcv_x,fliplr(0:res:Ly)-rcv_y,(0:res:Lz)-rcv_z); % Angles of arrival theta_k = pi/2; phi_k = pi/9; f = 63; c = 344; k = 2*pi*f/c; %k = 1; [x_k,y_k...
function param = setupParam() param = struct(); %Fluid sample composition %Assumes constant param.mole_fraction = [.0121 .0194 .65990 .08690 .05910 .09670 .04745 .01515 .00330]; %temperature and pressure at standard condition param.sc.Temp = (60+459.67)*Rankine; param.sc.p = 14.7*psia; %reservoir temperature param....
% print some stability run total data stats. % Barnett 1/9/19 clear fnam = {'torus/t','wobblytorus/wt'}; ps = [4 6 8]; runs = 0; maxN = 0; minN = inf; cputot=0; for shape=1:2 for iii = 1:numel(ps), p=ps(iii); m=p-2; % how we decided to runs load(sprintf('../expts/%s_T50_m%d_p%d_pulse.mat',fnam{shape},m,p)); ...
function [A,C] = fd_bilinear_coefficients(mn,mx,side,V) % FD_BILINEAR_COEFFICIENTS Given a grid from minimum corner mn to maximum % corner mx, with `side` nodes on each side, compute a matrix `A` so that % `V=A*C` if `C` are the node centers. % % [A,C] = fd_bilinear_coefficients(mn,mx,side,V) % % Inputs:...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ETH Zurich, Switzerland % Separation Processes Laboratory % % Project: Lithoplatelets % Year: 2021 % MATLAB: R2019b, Windows 64bit % Authors: Anna Jaeggi (AJ) % % Purpose: % Get the rotation with minimal angle...
function [m n] = findmn(q,varargin) % @brief Function to find the closest integer to q, such that q \approx 2^m*3^n % @author M.Moriche % @date 05-06-2014 by M.Moriche \n % Created % % m0 = 0; n0 = 0; mend = Inf; nend = Inf; misc.assigndefaults(varargin{:}); n = 0; mendtrial = ceil((log(q) - n*log(3))/log(2)); m...
function [Y idx] = topvals(X, n, MODE) %TOPVALS return the top maximum (or minimum) of array X % [Y idx] = TOPVALS(X, n, mode) returns top n maximum (or minimum if % mode='min') of X. mode can get a value "min" (default) or % "max". % % % Example % ------- % X = [2 1 4 3]; % ...
function bluered(n) if nargin < 1 n = 64; end r = linspace(0,1,n/2)'; map = [r, r, ones(size(r))]; map1 = flipud(fliplr(map(1:end-1,:))); map = [map; map1]; colormap(map); c = max(abs(caxis)); caxis([-c c]);
% Searches for the minimum of a function using a genetic algorithm populationSize = 100; numberOfGenes = 50; crossoverProbability = 0.8; mutationProbability = 0.025; tournamentSize = 2; tournamentSelectionParamenter = 0.75; variableRange ...
function [p_i, r_i] = pr_curve (top, rel, plot_style) p_i = [] r_i = [] rc = 0 for i=1:length(top) if (top(i) == 1) rc += 1 endif p_i = [p_i, rc ./i] r_i = [r_i, rc ./rel] endfor plot(r_i, p_i, plot_style, "linewidth", 2) hold on endfunction
T = 20; %in functie de rezolutia temporala, se vor introduce vectori diferiti T1_temaPCT2_Coman_Ionut_Ovidius_Cristian(0:0.002:T,1) % 2ms = 0.002s T1_temaPCT2_Coman_Ionut_Ovidius_Cristian(0:0.02:T,2) % 20ms = 0.02s T1_temaPCT2_Coman_Ionut_Ovidius_Cristian(0:0.2:T,3) % 200ms = 0.2s
function maxYieldHeterologous() logFile = sprintf('maxYields-Heterologous_%s.tsv', ... datestr(now, 'yy-mm-dd_HH_MM_SS')); global fileId fileId = fopen(logFile, 'a'); fprintf(fileId, ['target\tsubsystem\taerobic\tsubstrate\tthko\tyield\n']); subs = {'EX_glc(e)','EX_xyl_D(e)'}...
clc close all clear all % nifti files for Low-dose, High-dose and MR low = mat2gray(niftiread('/home/ajfer6/ab57/anthony-PET/MRI-Deeplearningtest/Matlab/backup/rPET11_low.nii')); high = mat2gray(niftiread('/home/ajfer6/ab57/anthony-PET/MRI-Deeplearningtest/Matlab/backup/rPET11_high.nii')); MR = mat2gray(niftiread('/...
%% Assignment II [Advanced Machine Learning] %% Make sure you have added the path of ML_toolbox to your directory. % % [ Circle clusters ] % You have to figure out the number of clusters present in the datasets by using kernel-PCA clear all; close all; %% Generate Circle Data num_samples = 1000; dim_samples = 2; ...
function [centers] = find_htrack_model_nonrigid(centers, radii, blocks, htrack_centers, theta, names_map, named_blocks, key_points_names, verbose, D) %% Compute attachments [attachments, global_frame_indices, solid_blocks, elastic_blocks, parents] = get_semantic_structures(centers, blocks, names_map, named_blocks); [...
% clear % path_data = '/home/pbellec/database/roche_multisite/simu_power'; % file_res = [path_data filesep 'results_simu_power.mat']; % file_data = [path_data filesep 'n_subject_estimation_bis.mat']; % load(file_res) % load(file_data) % % figure % hold on % plot(list_effect_size,squeeze(sens(1,:,[1 2 5])),{'r-','r--',...
function [y] = LaguerreL(varargin) % LaguerreL(c,x) Evaluates the Laguerre series given by the coefficients c(n) % LaguerreL(c,a,x) Associated Laguerre Polynomials c=varargin{1}; x=varargin{end}; if(nargin==2) a=0; elseif(nargin==3) a=varargin{2}; end n=length(c); y=(n>1)*c(n); yy=zeros(size(x)); for k=n-2:-1:1...
% testGraphicsTiming % % Shows a bunch of targets (top) or RDK (bottom) of increasing complexity & % tests for skipped frames SCREEN_INDEX = 1; % 0=small rectangle on main screen; 1=main screen; 2=secondary %% TARGETS % dotsTheScreen.reset(); s = dotsTheScreen.theObject; s.displayIndex = SCREEN_INDEX; dotsTheScreen...
% Read prec data from Yangkun clc;clear % data Location Location_Yangkun='E:\Data_ZL\国家青藏高原数据中心\中国区域高时空分辨率地面气象要素驱动数据集\Data_forcing_01dy_010deg\'; % read Irrigation area of Yilichang location_IRR_loc='E:\Data_ZL\ET\YinLichang\灌溉ET\'; ET_IRR_Yin_all=load([location_IRR_loc,'ET_IRR_Yin_all.mat'],... 'ET_IR...
function finalSamples = smcSimple(data) % Sampling with the simple version of smc. % % Inputs: % (1) data is a 1xT cell-array; each element is an nxd matrix of observations from a single point in time % % ---------------------------------------------- % Procedure: % 1) do static inference on t=1 % 2) for each t=2:T ...
function [threshIm,imThresh] = getCellThresh(Image,method,varargin) % getCellThresh Calculates threshold for object detection in image. % Calculates threshold for object detection for given image, using either a % local adaptive or a global method. Image is a two-dimensional grayscale % input image, while met...
function source_NMF_generation(matrix,rownames,colnames,k_start,k_inc,k_end,I_max,outprefix) % matrix : [cells x genes] matrix, matrix value only without row and column headers % rownames : [cells x 1] cell array, usually cell (row) names % colnames : [1 x genes] cell array, usually gene (column) names % k_start : inte...
%q1_2.2-2 ans1 = 1./A(20,0.01); ans2 = B(20,0.01); fprintf(1,'e^-0.01 = %.8f\ne^-0.01 = %.8f\n',ans1,ans2); %q1_2.2-3 for N=16:1:22 ans1 = 1./A(N,20); ans2 = B(N,20); fprintf(1,'N=%d\n',N); fprintf(1,'e^20 = %.8f\ne^20 = %.8f\n',ans1,ans2); end
function [coeffs, fun, F] = schrodinger_nep(n, alpha) %SCHRODINGERnep N-by-N NEP from a Schroedinger equation % [coeffs, fun, F] = nlevp('schrodingernep', N, alpha) generates the N-by-N % nonlinear matrix function A - lam*I + g(lam)*B1 + f(lam)*B2, which % iderives from the discretization of a boundary value problem ...
classdef MixMvnGibbs < MixMvn properties samples; end % Gibbs sampling for a mixture of multivariate normals methods function model = MixMvnGibbs(varargin) if nargin == 0; return; end [nmixtures,mixingWeights,distributions,model.transformer,model.verbose] = process_options(varargin,....
function [ ] = plot_ellipse_level(bw, ellipse_level, O, O_e, Color, lw) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here figure imshow(bw),title('Euclidean'), hold on %imshow(bw_crop),hold on for i=1:1:size(ellipse_level,1) a_pred = ellipse_level(i,1); b_pred =...
function ts = opents(files, numsubs, fileval) % a function to open a timeseries into a usable format % Inputs: % files: a struct containing filenames in the file(i).name category % numsubs: the number of subjects % fileval: the batch of subjects in the file being considered % this parameter enables proces...
function ft = meters2feet (m) ft = 3.28083989501312 * m;
function C = lab12m(A, B) C = zeros(size(A), 'int32'); for q = 1:size(B,1) C(A >= B(q,1) & A < B(q,2)) = q; end
load binary_defect_areas_ratios_new.dat areas = binary_defect_areas_ratios_new; % load binary_defect_areas_new.dat % areas = binary_defect_areas_new; % % load binary_areas.dat % areas_binary = binary_areas; disp(length(areas)); count = 1; for i=1:length(areas) if (mod(count, 2)) letter = 'A'; else ...
clear all choosefile load(result_name) sz=size(result); sz = sz(2); szz = 512; data = fitsread(name,'Table'); dsz=size(data{3}); dsz=dsz(1); numObj = size(result(1).A); numObj = numObj(1); r = 5; A = zeros(sz,2,numObj); show_img = zeros(szz,szz); for i=1:1:numObj ROW = result(1).A(i,2); COL = result(1).A(i,...
close all; clear, clc; %% 设置GUI按键 plot_button = uicontrol('style','pushbutton','string','运行', 'fontsize',12, 'position',[150,400,50,20], 'callback', 'run=1;'); stop_button = uicontrol('style','pushbutton','string','停止','fontsize',12,'position',[250,400,50,20],'callback','freeze=1;'); quit_button = uicontrol('style...
% QMG2box.m % DOING PHYSICS WITH MATLAB % https://d-arora.github.io/Doing-Physics-With-Matlab/ % Documentation % https://d-arora.github.io/Doing-Physics-With-Matlab/mpDocs/QMG2B.htm % IAN COOPER % matlabvisualphysics@gmail.com % 2300504 Matlab R2021b clear; close all;clc % ANIMATION SETUP =============...
function [bpsk, qpsk] = psk(Nb) %On genere Nb bits bits = rand(1, Nb)>0.5; %%Modulation BPSK %On transforme cette suite de bits en suite de -1 pour 0 et 1 pour 1 bpsk = bits*2-1; %%Modulation QPSK qpsk = zeros(Nb/2, 1); for k = 1:(Nb/2) %on teste les bits deux a deux if(bits(2*k-1:2*k) == [0, 0]) qps...
function cmap = connectomeColormap( m ) %CONNECTOMECOLORMAP Return the default connectome colormap. % The default colormap is currently hsv cropped roughly at half and black % added as first color. % INPUT m: (Optional) int % Number of different colors. % (Default: same length as current figures col...
%% Baseflow Separation with Uncertainty Propagation % loads catchments and performs baseflow separation by means of different % filters using (mainly) the parameter values from the model runs clc clear all close all % load catchment(s) % Barden_Lane BELLEVER BROAD_GREEN Whitebridge Cappenham TREGONY station...
function [id_changed_node] = nodes_case2( obj, id_parent, id_child_new, id_new_node ) % add id_new_parent to top obj.nodes_top(id_new_node) = true; obj.nodes_parent(id_new_node) = id_new_node; % id_parent cannot have a virtual parent (in this case, case1 would have % been successful) assert(obj.nodes_parent(...
close all; clc,clear; b = fir1(6,0.1,'low'); [h,w] = freqz(b,1,'whole',512); %plot(w/pi,20*log10(abs(h))) plot(w/pi,abs(h)) ax = gca; ax.YLim = [-0.2 1.2]; ax.XTick = 0:.5:2; xlabel('Normalized Frequency (\times\pi rad/sample)') ylabel('Magnitude') f1 = 40; f2 = 400; fs=1000; t=0:(1/fs):(1/fs)*100; x = sin(2*pi*f1*t)...
function [y] = Ackley(x) dim = 30; sumsq = 0; sumcos = 0; for i=1:dim sumsq = sumsq + x(i)*x(i); sumcos = sumcos + cos(2*pi*x(i)); end y = -20*exp(-0.2*sqrt(sumsq/dim)) - exp(sumcos/dim) + 20 + exp(1);
function [aTheta, I] = ExactSolution_PDFmatrix %output I(theta), theta [0,pi] myu = [0 0 1]; k = 2; radius = 1; nPhi = 600; nTheta = 300; dPhi = 2 * pi / nPhi; dTheta = pi / 2/nTheta; iSum = 0; for n = 1:nTheta theta = n * dTheta; jSum = 0; for m = 1:nPhi phi = m * dPhi; [x(1),x(2),x(3)] ...
clear; clc; format compact a(1) = 1; a(2) = 2; a(3) = 3; n=3; totalsum = 2; while a(n) < 4000000 n = n + 1; a(n) = a(n-1) + a(n-2); if mod(a(n),2) == 0 totalsum = totalsum + a(n); end end disp('the sum of all even numbers is:') totalsum
function configSync %configures the DAQ device used to generate TTL pulses global daq setupDefault if setupDefault.useMCDaq==1 daq = DaqDeviceIndex; if ~isempty(daq) %port 0 is used for stimulus related TTL pulses DaqDConfigPort(daq,0,0); DaqDOut(daq, 0, ...
%% program DCsystem.m clear all; clc; global kT kb R L N Je; %%%% simulation of dc motor kT=0.05;kb=0.05;R=1.2;L=0.05;Jm=8e-4;Jl=0.02;N=12; %%% define the parameters Je=Jl+N^2*Jm; %%% calculate Je t0=0; %%% define the initial time tf=4; %%% define the final time nsteps = 100; % Number of time ...
image_folders = 'scene_categories'; kernels_address = 'conv1_filters'; dir_image_folders = dir(image_folders); % variables number_of_windows = 4; nw2 = number_of_windows * number_of_windows; image_size = 256; number_of_kernels = 96; window_size = image_size / number_of_windows; counter = 0; for dir_num=1:size(dir_ima...
%------------------------- %if we deal with data.mat: %load('data.mat') %------------------------- %------------------------- %if we deal with 20 newsgroups dataset: % load train.data % trainX_ = spconvert(train); % [Docs, ~] = size(trainX_); % trainX_ = trainX_(:,1:5000); % randsel = randsample(1:Docs,5000,false,[]);...
function status = XuZBinningDicom(config_rebinning) reslice_para = XuReadJsonc(config_rebinning); reslice_binning = reslice_para.ResliceBinningCount; D=dir([reslice_para.InputDir '/' reslice_para.InputPrefix '*']); ImageRoi=zeros(512,512,length(D)); N=length(D); %dicom images should be sorted based on the UID UID_...
function [] = closemult(vec) for i=1:length(vec) close(vec(i)) end
function CompN_Learn() % Name: Senior Project Learning Phase % Author: Noah Libby % Version: 1.0 % Thanks to Peter Scarfe, Zall Hirschstein, and Dr. Justin Hulbert for code help and inspiration %% Figure out which computer we're using try %my computer cd('C:\Users\Admin\Desktop\noahSPROJ'); WORKING_DIR = 'C:...
% this code is coded by Prof. Junling Ma in 2014 % modified by Chentong Li in 2015 function x=sim_sir() % create random graph n=1000; % #nodes degrees = poissrnd(4,n,1); edges=[]; for i=1:n edges=[edges;ones(degrees(i),1)*i]; end L=length(edges); net=sparse(n,n); failed=0; while L>1 && failed<100 i=floor(rand()...
% [Pd] = one_sided_posterior(bo, Pf, cutpoint, [sign=+1]) % % Given a binning object and a probability distribution, zeros out the % probability distribution that lies to one side of a scalar cutpoint. % DOES NOT NORMALIZE AFTER THAT, NORMALIZATION IS LEFT FOR THE USER TO DO % IF DESIRED. Deals gracefully with bins...
function f_CCorAplot(result,Y,yLabels,X,xLabels,sLabels,offset,fmt) % - plot results from a CCorA analysis % % USAGE: f_CCorAplot(result,Y,yLabels,X,xLabels,sLabels,offset,fmt); % % result = structure of results obtained from f_CCorA % Y = matrix of original (transformed) Y variables % yLabels = cell array of Y ...
%% Molecular Dynamics Simulator % <md.m> Mark D. Shattuck 7/22/2010 % revision history: % 7/22/2010 Mark D. Shattuck <mds> md.m % MD Demo for HandsOn 2010 % 000 mds Initial Conditions and visualization %% Simulation Parmeters N=10; % number of particles D=2; % diameter of particles ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Autor: Prof. Alexandre Zaghetto % % E-mail: zaghetto@image.unb.br % % Disciplina: Sinais e Sistemas % % Departamento: Ciência da Computação % % Universiade de Brasília % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% a = [0 0 0 (sqrt(2)/4)*(1-j) (...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Author : Roger (Aohan) Mei % Date : 04/20/2020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function temp_group = Island_construction(candidates) saver = {} temp_saver = {} for i = 1 : length(candidates) if i == 1 cur_slot_num = candidates{i}.Slot_number...
function [ x ] = ctfrescale2( X, sidelength, oldpx, newpx, oldz, newz, cs, voltage ) lambda = 12.2643247 / sqrt(voltage * (1.0 + voltage * 0.978466e-6)); c = cs; l = lambda; Z = oldz; z = newz; T = oldpx; t = newpx; n = 1 / (sidelength); summand1 = c^2 * l^4 * n^4 * X^4; summand2 = 2 * c * l^2 * n^2 * T^2 * X^2 * Z;...
function d = kernel_Hamads(adjmat,dim) %tju cs for bioinformatics % Calculates the Hamming distance kernel from a graph adjacency % matrix. If tha graph is unipartite, ka = kb. %INPUT: % adjmat : binary adjacency matrix % dim : dimension (1 - rows, 2 - cols) %OUTPUT: % d : kernel matrix for adjmat over di...
% Plots symbol of wavelet filter % with two real numbers. close all clear all x=linspace(0,1,1000); %%%% create an array for x from 0 to 1 with 1000 points % Plot real & imaginary parts. plot(x, real(symbol(x))); title('Real Part'); figure(); plot(x, imag(symbol(x))); title('Imaginary Part'); figure(); plot(x, abs(s...
function [ G ] = makeG_nonlinPendulum( theta, T ) %Create the G matrix for the nonlinear pendulum problem % @param theta Array of theta angles rad (1xm) m = length(theta)-2; %interior points h = T/(m+1); for i = 2:m+1 G(i) = (theta(i-1) -2*theta(i) + theta(i+1))/h^2 + sin(theta(i)); end %G(1) = 1; %G(m+2) = 1;...
function exitcode = EM(self, varargin) % Perform EM iterations on this model % exitcode = EM(self, ...) % % Returns: % exitcode Numeric code indicating the outcome of this procedure: % 1: Completed successfully (terminated by maxIter) % 0: Completed successfully (conve...
function [FLTyre,FRTyre,RLTyre,RRTyre] = getTireForces(Car,FLTyre,FRTyre,RLTyre,RRTyre) % ************************************************************************* % FUNCTION NAME: % getTireForces % % DESCRIPTION: % Takes tyre classes and return with updated force values % Uses ISO tyre coordinate system ...
% check_bend_current_loop % % Routine used for topoff testing to find the peak current of the booster bend magnet checkforao; gotodata; cd BR_supply_trips f1=figure; f2=figure; [b,a]=butter(2,0.005); while 1 % bendI=get_dpsc_current_waveforms_cond; bendI=get_dpsc_current_waveforms; figure(f1); ...
classdef CircularTrajectory < handle properties center = [0,0]; radius = 0; start_angle = 0; alpha = 0; omega = 0; vf = 0; end_of_traj = 0; trajProj = [0, 0, 0]; end % properties methods function obj...
%% Params for Electrochemical Model % Created May 24, 2012 by Scott Moura % % Most parameters are from DUALFOIL model % D_e is from Capiglia et al, for c_e = 1000 mol/m^3 % Equilibrium potentials are from Bosch Klein TCST 2011 % Electrode area chosen to correspond to 2.3 Ah cell %% Geometric Params % Thickne...
function computeDFF(F, per) %computeDFF is an alias function for dff per pixel / per neuron switch per case 'neuron' dffNeuron(F); case 'pixel' dffPixel(F); otherwise warning('dff not computed'); end end
function plotquad(W,cadena,limites); % PLOTQUAD - Dibuja la conica de coeficientes a,b,c,d,e,f % % plotquad(w); % plotquad(w,cadena); % plotquad(w,[-5:0.1:5]); % plotquad(w,cadena,[-5:0.1:5]); % % w = [a b c d e f], donde % a = termino en x^2 % ...
function ob = out_of_bounds(sz,sb) %OUT_OF_BOUNDS checks if subindex sb is out of bounds of size sz % only works for 2D matrices ob = any(sb < 1) || any(sb > sz); end
function [svm_models] = generate_training_models(training_data, training_labels) % GENERATE_TRAINING_MODELS returns the k SVM training model files % for one-vs-all classification - uses LIBSVM % (we need k training models for k classes for one-vs-all approach % INPUTS %%%% % training_data => mxn matrix of training...
function trajlocked = Emergence_LockOnPoint( traj, lockobs, win ) % EMERGENCE_LOCKONPOINT locks a given trajectory on a particular % observation number and return the trajectory in a window around that % locked observation. % - "traj": a NxK matrix where N is the number of observations. % - "lockobs": a scalar spec...
function A4_prior_analysis %1) rection time vs gain %2) RT vs sigma %3) gain vs sigma %4) reaction time distribution close all clear all for jj = 2 switch jj case 1 subject = 'LJ' case 2 subject = 'HH' end switch subject case 'LJ' ...
function [tform,Rfixed] = referenceMap_registration(VFS) % recording registration maker doer, thing... %% first deterimining all the CoMs of the visual areas using the ccf stuff % outline = importdata('E:\_Code\CoherentMotionProject\Widefield\reference_map.mat'); % outline = imread('E:\_Code\CoherentMotionProject\Wide...