text
stringlengths
8
6.12M
function [Z]=GaCanaryObj(x,events_flag) %Decision variable HW=x(1); OT=x(2); BED=x(3); ET=x(4); %Round Decision varaibles HW=roundn(HW,0); OT=roundn(OT,-3); BED=roundn(BED,0); ET=roundn(ET,-3); % Read Template fid=fopen('Template.yml'); A=textscan(fid,'%s','delimiter','\n','whitespace',''); fclose(fid);...
clear;close all;clc Main_MMRE=zeros(56,1); Main_RMSE=zeros(56,1); for i=1:56 X=csvread(i+".csv"); n_rows=size(X,1); Y=X(:,21); X(:,21)=[]; %% Normalizing the data minimum=min(X); maximum=max(X); X_norm=(X-minimum)./(maximum-minimum); X_norm(isnan(X_norm))=0.5; %% Dividing into train...
cases = {'case9.m', 'case14.m', 'case57.m', 'case118.m', ... 'case2383wp.m', 'case3120sp.m'}; attack_levels = [1.1, 2.0, 3.0, 5.0]; Ks = [2, 3, 4, 5, 8]; %methods = {'top_k', 'max_mismatch'}; %cases = {'case9.m', 'case14.m'}; %attack_levels = [1.1, 2.0]; %Ks = [2, 3]; methods = {'max_mismatch'}; logfilename ...
function [... iavg, itime, istd_obs, istd_avg, idof, istd_inp, istd_scale] ... = smoothitud (... time, obs, std, dof, dt, itime, ... ignore_self, robustify, detrendit, ... rigorous_residuals, interp_method, idof_method) %SMOOTHITUD Uncertainty-weighted running average, with varying degree of freedom. if (nargin <...
function result = check_cell(matrix,i,j,num) if check_row(matrix,i,j,num)==false result=false; elseif check_col(matrix,i,j,num)==false result=false; elseif check_3_by_3(matrix,i,j,num)==false result=false; else result=true; end end
function DataInfo=EEG_GetDataInfo(... base_dir,Task_list,tmpl_subj) %this can only be done after the processing paradigms are determined and at %least one subject is done % base_dir='/nfs/jong_exp/EEG_PFC/'; % Task_list={'4POP','WM'}; % tmpl_subj='PFC103_040313'; %place holding task information DataInfo=struct(); ...
function initPhysFromOptions( obj, mesh ) initPhysFromOptions@Adv_DiffAbstract( obj, mesh ); [ obj.advectionSolver, obj.HorizontalEddyViscositySolver, obj.VerticalEddyViscositySolver ] = obj.initSolver(); end
h = 10; % estimated sensor height (mm) d2 = 30^2; % distance threshold (mm^2) % if ispc % scalpFile = 'Z:\anatomy\FREESURFER_SUBS\skeri0074_fs4\bem\skeri0074_fs4-head.fif'; % elpFile = 'Z:\projects\nicholas\mrCurrent\MNEstyle\skeri0074\Polhemus\skeri0074_battery_20080808.elp'; % regFile = 'Z:\projects\nicholas...
function [data_set1,test_label1] = test_patches(testImg,testImgMask,w) %% Set Parameters: % orimg=rgb2gray(orimg); [m,n,~]=size(testImg); r=(w-1)/2; %N=(m-2*r)*(n-2*r); Num=0; d=0; for i = (1+r) : (m-r) for j = (1+r) : (n-r) Xmin = i-r; Xmax = i+r; Ymin ...
%% ------- view activator, inhibitor and their ratio for all shapes at last timepoint. %close all; masterFolder = '/Users/sapna/Desktop/testModel/Parameters4_check3/'; shapes = {'Circles', 'Triangle', 'pacman'}; outputFile = 'k0radius25_t100.mat'; quadrantCut = [0 0 1]; nSides = [1 3 1]; colonRadius = 25; lattice = ...
function words = translate(signalVec) binVec = ones(length(signalVec),1); binVec(find(signalVec == -1)) = 0; words = bin2str(binVec); end
%% ²¥·ÅÊÓÆµµÄ²âÊÔ´úÂë function playVideo(videoFile) video=vision.VideoFileReader(videoFile); % hFig1 = figure(1) hFig1=figure('position',[0 0 960 544]); hPanel = uipanel('parent',hFig1,'Position',[0 0 1 1],'Units','Normalized'); axis1=axes('position',[0 0 1 1]); % hFig2=figure('pos ition...
syms x t A alphat xt pt gammat smi hbar mass omega diffxt diffpt diffalphat diffgammat; psi = A*exp(-alphat*(x-xt)^2+smi/hbar*pt*(x-xt)+smi/hbar*gammat); lhs = smi*hbar*(diff(psi,xt)*diffxt + diff(psi,pt)*diffpt + diff(psi,alphat)*diffalphat + diff(psi,gammat)*diffgammat); rhs = -hbar^2/(2*mass)*(diff(psi,'x',2)...
function plot_planet(radius, color, location) %% Draw Planet [xx, yy, zz] = sphere(100); %Creates sphere coordinates surface(radius*xx + location(1), radius*yy + location(2),... radius*zz + location(3), 'FaceColor', color, 'EdgeColor', 'none',... 'FaceAlpha', 0.5); %Draw the sphere a...
T = 0.4; c = @cosh; s = @sinh; A = [c(T), s(T); s(T), c(T)]; G = eye(2); C = [0, 1]; Q = 8/4 * [s(2*T) - 2*T, c(2*T)-1; c(2*T)-1, s(2*T) + 2*T]; R = 1; tic [M,P,Z,E] = dlqe(A,G,C,Q,R); toc figure hold on for ratio = 0:.1:10 Q = ratio/4 * [s(2*T) - 2*T, c(2*T)-1; c(2*T)-1, s(2*T) + 2*T]; [~,~,~,E] = dlqe(A,G,...
classdef Cloneable < handle %CLONEABLE Interface: Object can clone itself % Detailed explanation goes here %---------------------------------------------------------------------------- properties end %---------------------------------------------------------------------------- methods(Abstract) %----------...
function xplus = g_m(x) %-------------------------------------------------------------------------- % Matlab M-file Project: HyEQ Toolbox @ Hybrid Systems Laboratory (HSL), % https://hybrid.soe.ucsc.edu/software % http://hybridsimulator.wordpress.com/ % Filename: g_ex1_2.m %-------------------------------------------...
function pixel_cells = dicom_decode_rle(comp_fragment, decomp_segment_size) %DICOM_DECODE_RLE Decode a run-length encoded byte-stream. % PIXEL_CELLS = DICOM_DECODE_RLE(COMP_FRAGMENT, DECOMP_SEGMENT_SIZE) % decompresses the run-length encoded fragment COMP_FRAGMENT and % returns the decompressed PIXEL_CELLS. ...
%% make_rotating_image_LR % Shift an arena image (16x72) rightwards. % Frame sequence is the same regardless of ypos. % xpos=72, ypos=16 is a dark screen clear all; close all; clc %% Pattern-specific info % filename='Pattern_008_drifting_grating_6px_vertical_stripes'; % infile=load('C:\Users\amoore\akm_matlab\...
function [test_valid_score, test_final_score, train_valid_score, train_final_score]=compare_files(truth_file, predict_file, round) %[test_valid_score, test_final_score, train_valid_score, train_final_score]=compare_files(truth_file, predict_file) % Compare a truth value file and a prediction file. % Returns the scor...
sCMD = 0; CMD = 0; disp('Command List:') disp('1. Start Polling') disp('2. Stop Polling') disp('3. Read Data') disp('4. Read Data Status') disp('5. Read Battery Status') while CMD < 1 || CMD > 5 CMD = input('Select Command Number: '); end sCMD = CMD; switch CMD case 1 N = input('Enter number of samples...
function[svs,sv_coefs,b,gamma] = get_svr_rbf_parameters(c,MaxSvs) %get_svr_parameters extract the svm co-oordinates from the constant c N = length(c); NFr = (N-2)/(MaxSvs)-1; svs_temp = reshape(c(1:NFr*MaxSvs),[MaxSvs,NFr]); sv_coefs_temp = c(NFr*MaxSvs+1:end-2)'; %pruning nzeros = 0; for i=1:M...
function [] = AllGlobalParameters(varargin); Development = 0; numvarargs = length(varargin); if(numvarargs >=1) MainPath = varargin{1}; end; if(exist('MainPath')) Development = 1; end; %Set All Global Parameters %Set Cell Parameters global CellThresholdParameter; global CellconnectivitySize; global C...
%% s_vaCurrent % % Vernier acuity in human shows the positional acuity is around 6 sec of % arc. Here, we are analyzing stimulus, optics, and eye movements and % basing the calculation on photocurrent. % % Testing if people can see the difference between: % 1) A straight line % 2) Two straight lines with ...
% a script to compare implicit and explicit schemes for doing FDTD % simulations with a convolutional PML. % A little history: % Began with a 1D code, have expanded to a 2D TM (Hz, Ex, Ey, modeled) % Branched from Rob Marshall's CPML script, which was an explicit, % matrix-free implementation of 2D FDTD for a goofy le...
function v = countGL_9(im) %this function first checks whether input im is type uint8 %then count the gray level if im is uint8 %clear all; %clc; [rows,columns]=size(im); if rows>=columns a=rows; else a=columns; end v=linspace(0,0,a); if nargin>0 if isa(im, 'uint8') ...
function [GWeights , Rnk, RMSE] = calc_grappa_kernel(TargetPoints, Neighbors) % function [GWeights , rank, RMSE] = cal_ncgrappa_kernel(TargetPoints, Neighbors) % % solve inverse problem for interpolation kernel: % TargetnPoints = Neighbors*GWeights % so ... % GWeights = inv(Neighbors) * TargetPoints ; % we use a ...
function [item] = findclose(sequence , value) % 找一列数sequence中最靠近给的value的日期 % -------------------------------- % 唐一鑫,20150730 minvalue = inf; k = 0; for i = 1 : length(sequence) delta = abs(sequence(i) - value); if(minvalue > delta) minvalue = delta; k = i; end end item = k; end
function error = error_lwlr(X_train, y_train, X_test, Y_test, tau, res) size_test = size(X_test); size_test = size_test(1); pred = zeros(size_test,1); right = 0; wrong = 0; for i=1:size_test pred(i) = lwlr(X_train, y_train, X_test(i,:), tau); if pred(i)==Y_test(i) ri...
function V = ls_lasso(X,Ds,rDs,param) V=mexLasso(X,cat(2,Ds,rDs),param); % % for i=1:size(X,2) % Ms=max(max(abs(Ds'*X(:,i)))); % Mrs=max(max(abs(rDs'*X(:,i)))); % % if Ms>=Mrs % vs=mexLasso(X(:,i),Ds,param); % X(:,i)=X(:,i)-Ds*vs; % vrs=mexLasso(X(:,i),rDs,param); % V(:,i)=cat(1,full(vs),full(vrs)); ...
classdef MvnGibbsInfEng < GibbsInfEng %MVNGIBBSINFENG properties diagnostics; model; end methods function eng = MvnGibbsInfEng(varargin) % end function computeLogPdf(eng,varargin) % notYetImplemented('MvnGibbsInfEng.computeLogPdf()'); end function computeMarginals(eng,varargin) % ...
function data = read_nls_file(fname, numdims, typ, varargin) % READ_NLS_FILE - reads a .mff file format that comes from Non-Local STAPLE % % data = read_nls_file(fname, numdims, typ) % % Input: fname - the filename to read % numdims - the number of dimensions in the data % typ - the type of the data to re...
function T = GetDHTransform( link_length_m, link_twist_rad, joint_offset_m, joint_angle_rad ) l = link_length_m; a = link_twist_rad; d = joint_offset_m; th = joint_angle_rad; T = [cos(th) -sin(th)*cos(a) sin(th)*sin(a) l*cos(th); sin(th) cos(th)*cos(a) -cos(th)*sin(a) l*sin(th); 0 si...
function x = LoiBernoulli(p) nbr = rand; x = 0; if nbr<p x = 1; end end
function z=f(r,a,n) % Lab #2 - Ex2.a z=0; for i=0:n z=a*r^i+z; end end
function [modlist,funlist,fun_info]=mean_make(typestrlist) % fun_info is a 1x2 cell. fun_info{1}=>1 result is pointer, 0=>not % fun_info{2}=>typestr ('r' or 'c' usually) declare_globals funname='mean'; modlist='';funlist=''; r=[char(10)]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
% Script for generating CRLB % (C) Copyright 2019 The Huang Lab % % All rights reserved Weldon School of Biomedical Engineering % Purdue University % West Lafayette, Indiana % USA % % A...
function [ ] = HW1_1(Input_image) [row, column] = size(Input_image); for i = 1:row FlippedImage(i,:) = Input_image(row-i+1,:); for j = 1:column TransposedImage(i,j) = Input_image(j,i); Right_shift(i,mod(j+2,column)+1) = Input_image(i,j); Left_shif...
function q = restrictions(B0inv,res_cov, Theta1) % Long run multiplier Upsilon = Theta1 * B0inv; % Restrictions - custommise these q = [ vec(B0inv*B0inv'-res_cov);... B0inv(2,2);... % Short-run restrictions (insert indices in () ) Upsilon(:,2);... % Long-run restri...
I = imread('DinosaurPrints.jpg'); I = rgb2gray(I); I = I(1:700,100:800); I = im2double(I); %figure; subplot(2, 3, 1), imshow(I), title('Original') filter = fspecial('prewitt'); Ip = imfilter(I, filter); subplot(2, 3, 2), imshow(Ip), title('Prewitt Filter') filter = fspecial('sobel'); Is = imfilter(I, filter); subplo...
function X = simgauss(T,hmm,Gamma) if iscell(T) if size(T,1)==1, T = T'; end T = cell2mat(T); end T = sum(T); ndim = size(hmm.state(1).W.Mu_W,2); K = size(Gamma,2); X = zeros(T,ndim); mu = zeros(T,ndim); switch hmm.train.covtype case 'uniquediag' Std = sqrt(hmm.Omega.Gam_rate / hmm.Omega.Gam_shap...
clear % Must run this command. syms x diff((x-1)*(x-1.5)*(x-2.0)*(x-2.5))
function lyapunov(data) N = length(data); % create return map next = zeros(N, 1); for i=1:N-1 next(i) = data(i+1); end next(N) = data(i+1); % plot return map figure(1), plot(data(1:N-1), next(1:N-1), '.'), title('Return Map'); % FFT fftcoeff = fft(data, N); t = 2:N; % plot absolute value of FFT coefficients fi...
function matrixIndices = blockToMatIndices(blockIndex, blockSize) % We have a matrix with 2x2 blocks. We say that we want to access block % i and the function returns (2*i-1:2*i), i.e., the entries that belong to % the block numBlocks = length(blockIndex); matrixIndices = zeros(numBlocks*blockSize,1); for i=1:numBloc...
classdef rlModelInstance < handle % < rlModel properties % constants sensorNormThreshold = 100; % subject specific data datasetName = []; subjectId = []; body_height = []; body_weight = []; gender = ''; % linkage attachment mo...
function x = exciteUV(N) x = normrnd(0,1,[1,N]);
% events='StationA_events_flag_train.csv'; % % flags= 'StationA_events_flag_train.csv'; % event_data=csvread(events); %Load normal dataf % flag_data=csvread(flags); %Load data with events % len = size(event_data,1); % start = 1500; % ends = 3000; % x = start:ends; % index = 1; % % subplot(211) % plot(x,event...
function [] = overlayparametricmapV2( AnatomicalImage,MAP,mask ,range, titulo) %UNTITLED Summary of this function goes here % [] = overlayparametricmap( AnatomicalImage,MAP,mask ) % AnatomicalImage = grey anatonical reference % MAP= parametric map % mask = binary mask % GFC version 1.0 % Sep, 2017 !! % parametric m...
% computes SNR in MTL subfields for comparing EPI to mux data % % note: if using motion-corrected or smoothed data, will first need to % combine 3D files into a 4D image: system('fslmerge -t rmux rmux0*') addpath(genpath('/Users/vacarr/Desktop/MCI/mciExpt/scripts/kendrick/')); subs={'mt01'}; fType = 'mux'; %epi or m...
function M = mmBerreman(layerArray, wavelengths, aoi, bReflect, bNormalize) aoi = aoi*pi/180; A = [1,0,0,1;1,0,0,-1;0,1,1,0;0,1i,-1i,0]; Ainv = [0.5,0.5,0,0;0,0,0.5,-0.5*1i;0,0,0.5,0.5*1i;0.5,-0.5,0,0]; Nlayers = size(layerArray,2); Nlam = length(wavelengths); layerMat = zeros(4,4,Nlam,Nlayers-2); if strcmp(layerArra...
function ColorSet=varycolor(NumberOfPlots, wrapBool) % VARYCOLOR Produces colors with maximum variation on plots with multiple % lines. % % VARYCOLOR(X) returns a matrix of dimension X by 3. The matrix may be % used in conjunction with the plot command option 'color' to vary the % color of lines. ...
function [nodesID, coor, basestationID] = hearst_setting nodesID = 1:50; coor = []; for i = nodesID x = mod((i - 1), 10) * 8; y = fix((i - 1) / 10) * 8; coor = [coor; x, y]; end % swap 21 and 1 temp = coor(21, :); coor(21, :) = coor(1, :); coor(1, :) = temp; basestationID = 1;
function [trueOrFalse] = isThisALocalMedialPoint(pdeGeomPadded,parents,pt) global debug; global MMA_ABS_TOL; global MMA_REL_TOL; trueOrFalse = 1; % default newParents = integerSet([]); if (length(parents) ~= 3) parents error('Invalid input in isThisALocalMedialPoint'); end for n = 1:length(parents...
function affichegroupes(gpe, listeX, listeY, agit1, agit2) plot(agit1(1), agit1(2), '*', 'color', 'r'); xlabel('m', 'Interpreter', 'latex'); ylabel('m', 'Interpreter', 'latex'); set(gca,'TickLabelInterpreter','latex') xlim([0 0.265])%0.265 ylim([0 0.355]) hold on text(agit1(1) + ...
function p = codeit(str) s=double(str); for i=1:length(s) if s(i)>=65 && s(i)<=90 s(i) = (65+90)-s(i); elseif s(i)>=97 && s(i)<=122 s(i) = (97+122)-s(i); end end p=char(s);
function [Pbit, Pe, err_count, sym_err_count] = simulation_bound(Nbits, SNR) bits = round(rand(Nbits, 1)); a = QPSKmodulator(bits); sigma2_a = 2; SNR_lin = 10^(SNR/10); sigma2_wc = sigma2_a / SNR_lin; wc = sqrt(sigma2_wc/2) .* (randn(length(a), 1) + 1j.*(randn(length(a), 1))); y = a + wc; [dec_bits, dec_syms] = QPSKd...
function [data, tags] = loadAll() files = dir('../data_test/*.csv'); %files = dir(filepath,'*.csv'); %files = dir('*.csv'); l = length(files); disp(l); disp(['numb of files',l]); X1 = {}; i = 0; tags = {}; for file = files' i = i + 1; %disp(i); basename = strsplit(file.name ,'.'); %disp(file.name); ...
function [time,quality] = local_update() %clear all %close all %clc load test.mat Xn = T; [n1,n2,n3] = size(Xn); X = Xn; % rule out the area obstructed by the building bx = (n1*3/4); by = (n2/4); % original data considering the building Xn = rule_out(bx,by,n1,n2,n3,Xn); % find the real max real_max = 0; rx=0; ry=0;...
function training_data = balanceReactionsInTrainingData(training_data) [MW, Ematrix, elements] = getMolecularWeight(training_data.nstd_inchi, 0); training_data.Ematrix = Ematrix(:, 2:end); % remove H, columns are [C, N, O, P, S, e-] elements = elements(:, 2:end); conserved = training_data.Ematrix' * training_data.S; ...
% generate timetag vectors g{1}='bran3000_03d.l12'; g{2}='bran3010_03d.l12'; g{3}='bran3020_03d.l12'; g{4}='bran3030_03d.l12'; g{5}='bran3040_03d.l12'; igs{1}='jplg3000.03i'; igs{2}='jplg3010.03i'; igs{3}='jplg3020.03i'; igs{4}='jplg3030.03i'; igs{5}='jplg3040.03i'; res=[]; for ifile=1:5 itime=...
function [eccentric] = kepler (mean_anomaly, eccentricity) % [eccentric] = kepler (mean_anomaly, eccentricity) % The subroutine kepler finds a solution to the % kepler's equation. % % Input: % mean_anomaly % mean anomaly in radians. % eccentricity % eccentricity. % % Output: % eccentric % eccentric anomaly in radian...
% compute the difference between the post- and pre-manipulation measurements x = data2b - data2a; %actial mean of data actualval = mean(x); % centering x xcentered = x - mean(x); % now, let's use bootstrapping to see what sort of x-values are likely % to be observed given our sample size vals = zeros(1,10000); for p=1:...
function dat = wwtoday( ) % wwtoday IRIS serial date number for current week. % % Syntax % ======= % % dat = wwtoday( ) % % % Output arguments % ================= % % * `dat` [ numeric ] - IRIS serial date number for current week. % % % Description % ============ % % % Example % ======== % ...
function [ f ] = objective_function( w, b_alpha, lambda ) %OBJECTIVE_FUNCTION returns the function value f(alpha) % returns the SVM dual objective function f(alpha) , which is % -equation (4) in the paper. % The arguments are w = A*alpha and b_alpha = b'*alpha. f = lambda/2 * (w'*w) - b_alpha; end % object...
%% TENSOR_RANK_ITERATE Numerically estimates an optimization over states with tensor rank <= k % This function has one required argument: % X: a square positive semidefinite matrix % K: a positive integer % DIM: a vector with positive integer entries % % val = tensor_rank_iterate(X,K,DIM) is a lower...
x=[0 3 6 10 11 15]; f=[6.7 8.2 9.5 12.0 14.9 18.5]; plot(x,f,'or') [p1,s1]=polyfit(x,f,1) xaux=0:0.1:15 yaux=polyval(p1,xaux) hold on; plot(xaux,yaux,'b') [p2,s2]=polyfit(x,f,2) yaux2=polyval(p2,xaux); hold on plot(xaux,yaux2,'g') [p2,s2]=polyfit(x,f,2)
function [] = basicGOL(steps) % [] = basicGOL(steps) % https://cs.wikipedia.org/wiki/Hra_života#Algoritmus n=100; % počet řádků a sloupců t=steps; % čas U=rand(n); % matice s náhodnými elementy p=0.25; % počáteční poměr A=(U<p); % počáteční matice se kterou se hraje B=zeros(n); % pomocná matice, kam zapisuji další ite...
clear all; clc; SingCellNetGUI();
clear; %% Maintaining a constant seed for experiment reproducibility s = RandStream('mcg16807','Seed',0); RandStream.setGlobalStream(s); %% Creating the DBN node structure intra = zeros(2); intra(1,2) = 1; % node 1 in slice t connects to node 2 in slice t inter=zeros(2); inter(1,1)=1; % node 1 in slice t-1 connects ...
%Removes directory and contents %note that rmdir will fail if the directory does not exist. %caviar version clear all task_prfx='categ'; sess_prfx = 'sess'; fs = filesep; %file sep %dir_start = '/Users/dharshankumaran/Documents/TINF_FMRI_data'; dir_base = '/Users/dharsh/Documents/Self_FMRI_data/func...
function [movie] = predic(MovObj, NumPredic) %UNTITLED Summary of this function goes here % Pasamos vídeo en VideoReader y devolvemos movie avi nFrames = MovObj.NumberOfFrames; movie = avifile('Video1.avi'); for i = 0 : (floor(nFrames/NumPredic)-1) frame = im2double(read(MovObj, (i*NumPredic)+1)); movie = a...
% Finds X that minimizes % 1/2 || X - Y ||_F^2 + tau || X ||_* function X = singular_value_soft_threshold(Y, tau) [m, n] = size(Y); %disp(['Computing ' num2str(m) ' x ' num2str(n) ' SVD...']); [U, S, V] = svd(Y, 'econ'); s = diag(S); s = max(0, s - tau); X = U * diag(s) * V'; end
function [ Se ] = Stress( E,C,s,v,TYPE,displacement ) % Siffness matrix in global coordinates [Ke]=(AE/L)[B'][B] % [B] is the matrix that relates strains to displacments % E is modulus of elastcity of the element % L is the length of the element % A is the area of the element % v is Poisson's ratio % ...
function [erd,time,P,R] = compute_ERD(epochs,channelEEG,rate,intervalBaseline,freq,win,noverlap) %COMPUTE_ERD Summary of this function goes here % Detailed explanation goes here erd = []; nChannel = length(channelEEG); for iChannel = 1:nChannel theseEpochs = epochs.data(:,channelEEG(iChannel),:); for i...
function output=mask_analysis(data,mask_data,voxel) % claculate the volume and mean HU for whole-lung % Input: exp image, exp label, voxel size % Output: volume and mean HU % Specify mask: default is Heidelberg (Right=[1 3], Left=[4 6]) maski = {1:6}; mask = ismember(mask_data,[maski{:}]); output(1,1)=sum(mask(mask))...
%knn學生角度 function ans=stufill2(M,k) rs=M; tt=M; cnt=0; while(sum(sum(isnan(rs)))>0) cnt=cnt+1; if(cnt>5) break; end for i=1:size(rs,1) imv=sort(rs(i,:),'descend','MissingPlacement','last');%目標stuvec imv(isnan(imv))=[]; nei={}; nei.dis=[]; nei.kn=[]; for j=1:size(rs,1) if...
% Testing various ways to do Spectral Mseq clear %% Bounce between two frequencies fs = 48828; f1 = 500; f2 = 550; dur = 1; t = 0:1/fs:dur-1/fs; fm = 5; x1 = sin(2*pi*f1.*t); x2 = sin(2*pi*f2.*t); sqt = linspace(0,2*pi*fm*dur,length(t)); AM = 0.5*(sin(2*pi*2*fm.*t)+1); A = square(sqt); A = (A+1) /2; %make A a sqaure...
%% WRITEPARREC Write a Philips PARREC image file % % [SUCCESS] = WRITEPARREC(FILENAME,DATA,INFO) % % FILENAME is a string containing a file prefix or name of the PAR header % file or REC data file, e.g. SURVEY_1 or SURVEY_1.PAR or SURVEY_1.REC % % DATA is an N-dimensional array holding the image data. ...
function gaussianKernel=buildGaussianKernel(xDim,yDim,sigma,kernelWeight) gaussianKernel=zeros(yDim,xDim); xCenter=xDim/2; yCenter=yDim/2; sigma=sigma*yDim; for i=1:xDim for j=1:yDim gaussianKernel(j,i)=(1/(2*pi*sigma^2))*exp(-((i-xCenter)^2+(j-yCenter)^2)/(2*sigma^2)); end end % Normalize kernel gau...
% This file needs to be ran after dynare finished its computations % First thing what we do is calculate steady state & then specify parameters % needed for second order welfare approximation. % This code calculates welfare. It corresponds to the model in the second % chapter. % before running this file dont clear the ...
% ************************************************************ % % shaded.m % % % Author: Jonas Tillman % Date: 2017-04-16 % % ************************************************************ % clear format short pkg load image #Load DEM load DEM.txt; #ALLOW FOR USER INPUT, pos of sun, convert to radi...
% 30/05/19 close all clear all load acmod load('./results/eightExp_001'); ac.p_exp = 0.25; N = (length(Z)-2)/18; dsSoln = struct; dsSoln.N = N; dsSoln.p_exp = ac.p_exp; VR = Z(end-1); dsSoln.VR = VR; tf = Z(end); dsSoln.T = tf; dsSoln.t = linspace(tf/N,tf,N).'; % X = [u,v,w,p,q,r,Phi,Thet,Psi,x,y,z,df,da,de,dr,CT...
function [] = delta_rule_steps(inp, out, beta) [m n] = size(inp); w = []; s = -1; sth = -1; for (i = 1:n) w(i) = rand(1); end e = 1; while (e == 1) e = 0; for (i = 1:m) y = 0; for (j = 1:n) y = y + inp(i,j) * w(j); end s = y; if (s > 0) sth = 1...
function ideal = idealFun(n) switch n case 1 ideal = @(t) - 2*exp(-t) - 3*exp(-t/6) + 5; case 2 ideal = @(t) exp(-t/5).*cos(t) + exp(-t/5).*sin(t); case 3 ideal = @(t) cos(t); case 4 ideal = @(t) exp(2*t).*(-10*cos(4*t) - 7.5*sin(4*t)); case 5 ideal = @(t) 1.7...
function colorLine(X,Y,rgb); %function colorLine(X,Y,rgb); % % wraps 'line' and sets color to rgb if(nargin < 3) line(X,Y); else h = line(X,Y); set(h,'Color',rgb); end
function RRTree = PlotAndAdd(xP,yP,x,y,RRTree,k) %Plot the Point hold on plot(x,y,'g+'); %Make a Connection Color = 'r'; PlotLine(xP,yP,x,y,Color); %Add Node to tree RRTree=AddNode(xP,yP,x,y,RRTree,k); end
%sherpaTTJacobianSymbolicAnalysis.m %author: wreid %date: 20150121 %This script is used to generate the Jacobian that maps the velocity of a %Sherpa_TT's leg joint space to the leg's wheel/ground contact point. %The inverse Jacobian is calculated. This allows the leg's contact point %rates to be mapped to the joint ra...
function size_populationana_simple % % Scnn Halo % %SCNN Population % animalids = {'140618', '140619', '140620', '140703', '140703', '140704', '140709', '140709', '140711', '140715', '140717', '140717', '140806', '140806', '141024', '141028', '141103', '141110', '141112', '141112', '141113', '141201', '141201b', '141...
function [t, y] = adaptiveRK34(f, y0, t0, tf, tol) h0 = (abs(tf-t0).*tol.^(1/4)) ./ (100*(1+norm(f(t0, y0)))); h = h0; i = 1; t(i) = t0; y(i) = y0; errold = tol; while t+h < tf; [ynew, err] = RK34step(f, y(i), t(i), h); y(i+1) = ynew; t(i+1)=t(i)+h; h=newstep(tol, err, errold, h, 4); i=i+1; end %Vad händer om h blir j...
function [S] = l_calculate_coefficient(IDP,ntime) % computes the linear interpolation weights % Please citing: % Guo, Z., H. Pan, A. Cao, and X. Lv (2018), A harmonic analysis method adapted to capturing slow variations of tidal amplitudes and phases, % Cont. Shelf Res.,...
function [sigma_new,hvar_new,aux_var] = rmapfi_elas_barra2D (eps_new,hvar_old,Eprop,ce) %****************************************************************************************** %* RETTURN-MAPPING (TENSOR DE TERNSIONES) PARA BARRAS EN 2D * %* MODELO ELASTICO ...
%% ArtO2Cnt CVO2Cnt ArtPO2 CvPO2 ArtO2Sat CvO2Sat Hgb HCT BloodGasMeasurementReading; % this pigs does not have blood gas measurements, thus CPP140 is deleted % from analysis for now! CPP(end) = []; %% Metabolic signal % Control{SpecimenPairs(i,1)} = ATPconcentration(Control{SpecimenPairs(i,1)}); % % An...
%% image change % Randomly load image. After seperating R,G,B, chage the data as R multiplied by 0.8, G by % 0.6, B by 1,2 and create another color image. %% code % load image x = imread('ironman.jpg'); % seperate R, G, B R = x(:,:,1); G = x(:,:,2); B = x(:,:,3); % adjust R,G,B R = R * 0.8; G = G*0.6; B = B*1.2; %...
function lol = findFFTMean() load('C:\Users\Simon\Documents\aKandidat\Exchange students\Canada-project\ourCode\Shimmer Matlab Instrument Driver v2.8\Data\Cut\Yao\New Folder\left.mat') load('C:\Users\Simon\Documents\aKandidat\Exchange students\Canada-project\ourCode\Shimmer Matlab Instrument Driver v2.8\Data\Cut\Yao\Ne...
function [outVid1, outVid2, TSFile] = twoCameraAcquisition(path, recTime, vid1, vid2, colPos, notes) %Inputs: % %path - output filepath %trialLength - trial length (in seconds) %vid1 and vid2: nest and foraging camera objects %colPos: position of current colony within tracking Arena (positions 1-12) %t: Overall ...
function [u_s_signal,new_xaxis,newlines] = u_sample(signal,... xaxis,n_directions,n_lines,resample_factor) % function [u_s_signal,new_xaxis,newlines] = u_sample(signal,... % xaxis,n_directions,n_lines,resample_factor) % % U_SAMPLE resamples the i...
%% Stelling 1 % % Een functie kan niet meer dan 1 input hebben. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
%% Alumnos % Ulmete, Nicolás % Pérez Leonardi, Mariángeles %% Reset clear; clc; %% Creación de la matriz A = 1:20; for i = 2:20 A(i,:) = A(1,:).^i; end %% Cálculos determinante = det(A); fprintf('DETERMINANTE: %e\n', determinante); inversa = inv(A); disp('================================================ INV...
% MIRT2D_GRID2NODES transforms the dense gradient to the % gradient at each node (B-spline control point). % % Input % ddx, ddy - the gradient of similarity measure at each image pixel % in x and y directions respectively % % F - is a precomputed matrix of B-spline basis function coefficients, see. % mirt2D_F.m file ...
clear all close all % load example data exampledata = load('Processed_Data.mat') % get spacing parameters % FIXME - hack - spacing error ? PASpacing = [ exampledata.DepthPA(2) - exampledata.DepthPA(1),... exampledata.WidthPA(2) - exampledata.WidthPA(1),... (exampledata.ElevPA(2) - ...