text
stringlengths
8
6.12M
function trans = fitAffineTransform3d(ref, src) %FITAFFINETRANSFORM3D Compute the affine transform that best register two 3D point sets. % % TRANS = fitAffineTransform3d(REF, SRC) % Returns the affine transform matrix that minimizes the distance between % the reference point set REF and the point set SRC after tr...
function [F,G]=funOfC(C,A,B,S,R) lambda=0.01; F=0.5*(sum(dot(C*A-B,C*A-B,1))+lambda*sum(dot(C*S-R*C,C*S-R*C,1))); G=C*A*A'-B*A'+lambda*(C*S*S'-R'*C*S-R*C*S'+R'*R*C); % F=0.5*sum(dot(C*A-B,C*A-B,1)); % G=C*A*A'-B*A'; end
function [MNew] = completeMatrixToPoints(varargin) M = varargin{1}; [m, n] = size(M); if nargin == 3 rangeX = varargin{2}; rangeY = varargin{3}; if numel(rangeX) > 2 error('rangeX'); end rows = linspace(rangeX(1), rangeX(2),m); cols = linspace(rangeY(1), rangeY(2),n); else ...
w_length = 100;%滑窗大小 interval = 90;%滑窗间隔 alpha = 0.1;%阈值更新权重系数 false_positive_interval = 4;%至少间隔多少个滑窗在进行报警 threshold_multiple = 3;%阈值倍数 sequence = second_pca; sequence = medfilt1(sequence,40);%中值滤波 threshold = var(sequence(1:2 * w_length -1));%计算初始阈值 plot(sequence) hold on; window = zeros(w_length); array_length = ...
function [t_index, fuse_event, split_event, biogen_event, stressor_event, mitochondria, damage, atp, adp, amp, pcr, cr, pi, atp_ig, dpsi, h_x, nadh_x, pi_x, qh2, cred, o2, k_x, atp_x, adp_x] = getInitialState(input0,input) sz = [21, 79]; xN = sz(2); yN = sz(1); uN = xN*yN; dx = 1; dy = 0.75; dt = 0.01; tf = input0...
function r = ANUM2es5(x) u = x; u(1) = norm(u,2) + u(1); H = ANUM2es4(u); r = x'*H; end
% Utilities for MEX files % Copyright 2008-2009 Levente Hunyadi % % Examples % example_linalg - Examples for linear algebra functions. % example_sparse - Examples for cell to sparse matrix catenation. % example_sqdist2 - Examples for pairwise squared Euclidean distance. % % Functions % cell2sparse ...
function w=awfm(d,fs,wf) % ** function w=awfm(d,fs,wf) % 'arbitrary waveform frequency modulation' does principally the same as % vco.m, the difference being that an arbitrary waveform instead of a sine % will be modulated in frequency % Notes: % 1. this is a potentially memory-demanding task. If the load is too hig...
function varargout = DynaPort_Tug_Timed_2(varargin) % DYNAPORT_TUG_TIMED_2 MATLAB code for DynaPort_Tug_Timed_2.fig % DYNAPORT_TUG_TIMED_2, by itself, creates a new DYNAPORT_TUG_TIMED_2 or raises the existing % singleton*. % % H = DYNAPORT_TUG_TIMED_2 returns the handle to a new DYNAPORT_TUG_TIMED_2...
clear; load('data.mat'); %% N = length(All.Composition); ids = randperm(N); Xs = All.Composition(ids,:); Ys = All.STYAcOH(ids,:); test_N = floor(N / 4); X_train = Xs(1:(N-test_N), :); T_train = Ys(1:(N-test_N), :); X_test = Xs((N-test_N+1):N, :); T_test = Ys((N-test_N+1):N, :); %% params = struct('MinLeaf', 4, ...
function [ C ] = Cm( A, B ) %C measure Summary of this function goes here % Detailed explanation goes here numB = size(B,2); numA = size(A,2); isDominated = zeros(1,numB); for m = 1:numB indA = 1; for indA = 1:numA if ( all(A(:,indA)<=B(:,m)) && any(A(:,indA)<B(:,m)) ); isDominate...
function state_estimator_ekf % init_quad_new_leg_raibert_strategy_Naman close all; clear all; freq=10000;% in hertz keep it as high as possible - paper has done it on very slow moving robot T=10; data_T=200; ctrl_freq=400; offset_r=[0;0;0]; assumeFlatFloor=true; only_predict=true; load('ground_truth.mat'); ctrl_state=l...
function []=fixedbedNT2 %1D fixed bed u=1; a=10; km=1; krxn=0.1; %reation rate n=2;%rxn order rhof=1; %density of f DH=-1e4; %enthalpy of rxn Cf0=5; %inlet concentration of f C=40; %toatal concentration L=1; %reactor length Tin=20;%inlet T Cp=40; ap=200;%alpha p Cs0=km/(km+krxn)*Cf0; init=[Cf0 Cs0 Tin T...
% shows an animation of a propagation % % Copyright (c) 2005 Gabriel Peyre path(path, 'toolbox/'); n = 100; name = 'road2'; name = 'peaks'; name = 'mountain'; name = 'constant'; [M,W] = load_potential_map(name, n); W = rescale(W,0.01,1); [start_points,end_points] = pick_start_end_point(W); k = 500...
% Quadrature formula calculation classdef quadrature properties pFunc fFunc alpha lowBound = 0 highBound = 0.5 end methods % Constructor function obj = quadrature(pFunc, fFunc, alpha) obj.alpha = alpha; obj.pFunc = pF...
%% -*- matlab -*- % Bayesian K-means; split and merge % % data: double array DxN where D is the dimension and N is the % number of datapoints. function [K,clusters,data] = bkm_sm(data,use_kdtree); THRESHOLD = 1.0e-8; switch nargin case 1 % up to use_kdtree use_kdtree = 1; case 2 use_kdtree; % to be valid fo...
% %% the discount of femto-matching can be change at Line 15 of the file 'auctionmatch_mobi.m' LOOP = 1000; for L=1:LOOP fprintf('+++++++++ LOOP %g +++++++++\n',L); clear; college_data = []; matching_data = []; RAT_data = []; x = []; poly = 9; %多项式拟合中,多项式的次数 numloop=300; weight = 1; %暂未用到 % in_thresh...
function [m,f] = setupJ(J,m,f,ops) f.frec = f.DFREC*max([J-1 0.01]); f.ome = 2*pi*f.frec; f.come = f.ome; if f.dwn==true %amortiguamiento de las fuentes periódicas/y los polos f.omei = -1*pi/f.TW; f.come = f.ome + 1i * f.omei; else f.omei = 0; end f.come = f.come * (1 - 1i/(2*f.Q)); %amortiguamiento hister...
function[plus minus] = quadratic(A,B,C) plus = ((-1) .* B + sqrt(B .^ 2 - 4 .* A .* C)) ./ (2 .* A); minus = ((-1) .* B - sqrt(B .^ 2 - 4 .* A .* C)) ./ (2 .* A); end % Function quadratic uses inputs A, B, and C to solve the quadratic formula % in the form % Ax^2 + Bx + C
% sweep input power, LNNB04, 20180410, WTJ, FM % Modified to do same thing on LNNB05 % Using red santec, instead of velocity % 20180427, WJ %% parameters global INSTR; P0 = 2.7; % usual power in uW with 20 dB input atten gain0 = 200; % gain usually used for ~35 uW input power Pmin = P0/100; Pmax = 100*P0; ...
global vid rect scra yelrg firstch blackrg bluerg brownrg grayrg redrg greenrg getall getallc bot1rg bot2rg leaveredcones; while(firstch==0) a= getsnaphsot(vid); a = imcrop(a,rect); if(firstch==0) blue = findcol(a,bluerg); [~,n]= bwlabel(blue); bluebb = regionprops(blue); indicator = 1; area =0; for i =1:n...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Created: 18-Sep-2014 20:15:23 % Computer: GLNXA64 % Matlab: 8.1 % Author: NK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [meanAB]=ComboMean(NA,NB,meansA,meansB) zyx=@(yx) permute(full(yx),[3,1,2]); nansum2d=@(A,B) sparse(permute(nansum([zyx(A); zyx(B)],1),[2,3,1])); ...
% n = 2 RGB original = imread('lalaland.png'); i = im2double(original); i = encode(i,2); i = decode(i); i = im2uint8(i); imwrite(i,'a2.png'); psnr_1 = PSNR(original,i); fprintf('RGB n=2 PSNR = %f\n',psnr_1); clear all % n = 4 RGB original = imread('lalaland.png'); i = im2double(original); i = encode(i,4); i = decode(...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ETH Zurich, Switzerland % Separation Processes Laboratory % % Project: Lithoplatelets % Year: 2021 % MATLAB: R2019b, Windows 64bit % Authors: Anna Jaeggi (AJ) % % Purpose: % Samples uniformly distributed qu...
clear all addpath(genpath('/gs/project/gsf-624-aa/quarantaine/niak-boss-0.13.4/')) addpath(genpath('/gs/project/gsf-624-aa/quarantaine/niak_dev_git/extensions/surfstab/')) in_path = '/gs/project/gsf-624-aa/database2/adni2/fmri_preprocess/fmri/'; part_path = '/gs/project/gsf-624-aa/database2/preventad/templates/temp...
function y = diff2Tn(n,z) y = -n^2*cos(n*acos(z))/(1-z^2)+n*sin(n*acos(z))/(1-z^2)^(3/2)*z;
function outputA = Method_MLI2(inputA,k1,k2,K) % inputA=cW; % k1=5; % k2=5; bl=4; %双层迭代 dimA=size(inputA); dimD1bl=dimA(1,1)/K;%第一层迭代子矩阵维度 %最小分块矩阵及逆矩阵的存储 bln=dimA(1,1)/bl;%最小分块矩阵数目 D2bl=cell(1,bln);%存储最小分块矩阵 for i=1:bln D2bl{1,i}=inputA(bl*(i-1)+1:bl*i,bl*(i-1)+1:bl*i);%矩阵赋值 end D2blinv=cell(1,bln);%存储最小分块矩阵的逆矩...
function dir_MLEfit_ott(task) % task should be a string % standard: 50% suc/malto % threeOutcomes: suc/malto/water % cued: suc/mal-predictive cue master_root = ottBari2020_root(); allTasks = {'intBlocks','threeOutcomes','cue'}; taskMask = contains(allTasks, task); if all(~taskMask) == 1 % task no fo...
function [monomer_to_microbe_flux, co2_assim_flux]=monomer_microbe_yield(monomer_uptake_matrix, par_mic, x) % %usage %compute the first step yield rate for each microbe. The first step yield %may be quite independent from the type of microbes %author: Jinyun Tang %input argument %monomer_uptake_matrix: monomer_microbe ...
function [ATERY, limits] = getAterialRegion(V,t_low_atery,t_high_atery, t_low_roi, t_high_roi, rDilate) %% PARAMS zExtFactor = 1/3; rErode = 1; % erode a little to find ateria rDilate = rErode + rDilate; % dilate more to get Search Region rErodeCleaning = 3 * rErode; % just to get one fully connecte...
% ARS = AnomalyResponseSim('act',0); % for actuator dynamics ARS = AnomalyResponseSim('del',0); % for time delay dynamics % shorthand notation - just sloppy modification to use this script with new % sim class format SP = ARS.simPars; PSP = ARS.postSimPars; CS = ARS.controlSim; ts = SP.ts; ts_rm = SP.ts_rm; tfin...
clc; close all; clear; load('data_new1.mat') %% Full Tree Accuracy tree_full = fitctree(Xtrain_full, Ytrain); % training accuracy y_hat_train_full = predict(tree_full,Xtrain_full); train_accuracy_full = sum(y_hat_train_full == Ytrain) / size(Ytrain,1); % testing accuracy y_hat_test_full = predict(tree_full,Xtest_fu...
function [ finalInfo ] = firstguess_Finalize( refInfo, intermediateResult, commonData, precursor, indicators, ... x, y, nx, ny, precName, indiciMAT, splitResult) % x, y, nx, ny, totalCells, inq_deb, indiciMAT, optimizerValues, optimizerCondition) dimx=nx; dimy=ny; valori_emi=precursor; rad=commonData.firstguess...
function [ b_star ] = EstimateDistribution_SlovakiaSAMCMC( FL ) % ********************************************************** % EstimateDistribution : Slovakia (Scenario with SA-MCMC approach) % ********************************************************* % Code for the nonlinear model described in the Appe...
function main_test_200_by_200_init(varargin) PBS_ARRAYID = varargin{1}; FID = dir([ sprintf('%04g-', PBS_ARRAYID),'*_in.h5']); FID = FID.name; dt = 0.1; sec = round(10^3/dt); % 1*(10^3/dt) = 1 sec step_tot = 1*sec; % use 10 second! hw = 101; % sptially embedded network hw_0 = 31; % half-width, (31*2+1)^2 = 3969 ~ 40...
% ADD FUNCTION HEADER COMMENTS function [y, t] = timeshift(x, Fs, t0) % Create a vector of zeros to be inserted at the beginning or end % of the input signal x depending on the time shift nz = ceil(abs(t0) * Fs + 1); z = zeros(nz, 1); % Perform time shifting operation, produce sound vector y and ...
%Programa: teste7.m clear all; syms f x %f = 5*exp(x); %f = 4*exp(x); %f = 3*exp(x); f = 2*exp(x); F = int(f,x,0,1); display(double(F)); %Método dos Trapésios Repetidos m = 4; N = m+1; a = 0; b = 1; xp = linspace(a,b,N); h = xp(2) - xp(1); %h = (b - a)/m; Itr = (h/2)*(subs(f,x,xp(1)) + 2*sum(subs(...
function [ folder_front, folder_right, folder_left, folder_neg ] = getAllClassFolderNames( handDataSetFolder, ... croppedSize,isCentered ) %UNTITLED Given a particular gestureName this function will return folder %names of positive examples(particular gesuture) and negative e...
classdef IR_sensor % IR_SENSOR Class % Defines the size and shape of the simulated IR sensor % Note: The sensor is treated as a continous sensor bar % Uses the InterX function to determine if the sensor bar overlaps % with the target path and returns the position of the intersection % from the...
function u = inFun(tt,i,example) % Arbitrary Input functions if example == 1; cc = sin(tt/i); % Each experiment these input functions keep changing z = cos(tt/i)-sin(tt/i); % i is the ith experiment uu = cos(tt/i); u = [z;cc;uu]; elseif example == 2; cc = sin(tt*i); ...
function ret = cd1(rbm_w, visible_data) % <rbm_w> is a matrix of size <number of hidden units> by <number of visible units> % <visible_data> is a (possibly but not necessarily binary) matrix of size <number of visible units> by <number of data cases> % The returned value is the gradient approximation produced by CD-1. ...
function varargout = w_AddSphere_gui(varargin) % W_ADDSPHERE_GUI MATLAB code for w_AddSphere_gui.fig % W_ADDSPHERE_GUI, by itself, creates a new W_ADDSPHERE_GUI or raises the existing % singleton*. % % H = W_ADDSPHERE_GUI returns the handle to a new W_ADDSPHERE_GUI or the handle to % the existing si...
close all set4 = ["spring_0,110kg_30mm_3.tsv" "spring_0,140kg_31,7mm_3.tsv" "spring_0,235kg_38,1mm_2.tsv"]; figure('Renderer', 'painters', 'Position', [10 10 390 380]) hold on i = 0; aa = []; bb = []; rr = []; spconstA=dlmread('Före.tsv'); spconstB=dlmread('Efter.tsv'); for file=set4' i = i + 1; measurement...
function varargout = GUI_Dipole_Run(varargin) % GUI_DIPOLE_ALL MATLAB code by Edi Suprayoga % feel free to contact me at suprayoga.edi@gmail.com % last edit 17 Mar 2016 gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gu...
function [sol4c] = solveEkman_bcp4v(f,K,ug,z,opts,varargin) %% Inputparseer p = inputParser(); p.CaseSensitive = false; p.addOptional('Kp',zeros(size(K))); p.parse(varargin{:}); %%%%%%%%%%%%%%%%%%%%%%%%%% Kp = p.Results.Kp ; % derivative of eddy diffusibity for momentum solinit = bvpinit(z, [ug; 0;0;0]); ...
%% Load whisking and neural time series struct clear load('C:\Users\jacheung\Dropbox\LocationCode\DataStructs\excitatory.mat') %L5b excitatory cells %load('C:\Users\jacheung\Dropbox\LocationCode\DataStructs\interneurons.mat') %L5b inhibitory cells %% Across the population, which timescales best capture location tuning?...
%Fourier Transform Profilometry close all; clear; %==========Experimental Parameters=========== L = 1465; D = 390; %dBest = 390 f = 10.8/116*.20; % f = 10; %==========Read in Images=========== refim = im2double(rgb2gray(imread('IMG_0055.CR2'))); dataim = im2double(rgb2gray(imread('IMG_0060.CR2'))); refim = imcrop(re...
function [foreground] = smartAIFire(foreground, userBoard, coordinate) code = spriteCode(); % get the coordinate and separate it to row and column variabless row = coordinate(1,1); col = coordinate(1,2); % hit if (userBoard(row, col) > code.water_sprite && foreground(row, 11 + col) == code.blank...
function CLMS = consecutive_limit_move_stocks( ref_day,ref_end_day,up_down,count) %%We count the number of stocks that limit move in a consecutive way. % 此处显示详细说明 %We have an auxillary table that records all limit move of all stocks %OHLC. %so we only need to compute all the C data, and adds them up. %all stocks tha...
%AFFINITYMATRIX Affinity matrix between all graph nodes. % C=AFFINITYMATRIX(W,X) returns a matrix C whose sparsity pattern equals % W's and whose entry C(I,J) is the L2 affinity between X(I,:) and % X(J,:). % % See also: AFFINITY_L2.
clear distanceMiles = 1870; timeSecs = 343440; speedMPH = 55; secsPerHour = 3600; secundaePerHour = 3600 / 24; timeHours = timeSecs / secsPerHour % calculates elapsed time in hours speedMPH = distanceMiles / timeHours % calculates the speed in mph
%%%%%%%%%%Programmed by: Chi-Hang Kwan%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%Completion Date: December 13, 2012%%%%%%%%%%%%%%%%%%% function posc_new = AI_advanced(window,pos,vel,posc,tstep) tb = get(window,'UserData'); posf = pos + vel*tstep; %position of puck at next time frame maxspeed = 1; %maximum moving spee...
%% for i = 1:9 d = dir(['digits/trainingDigits/' '*.txt']); fileName = d(177 * i).name; fid = fopen(['digits/trainingDigits/' fileName], 'r'); data = fscanf(fid, '%s'); thisTrainPic = str2num(data(:))'; fclose(fid); thisImg = zeros(32,32); for j = 1:32 thisImg(j,:) = thisTr...
function X = ceilto(Xin,n) %CEILTO (ps-utils) take ceil to n decimal places % CEILTO(X,n) like ROUNDTO but takes the ceil rather than rounding % e.g. CEILTO(3.141592,4) returns 3.141500000.. % % See also CHOP, ROUNDTO, FLOORTO % % MH - http://github.com/histed/tools-mh X = ceil(Xin .* 10.^(n)) ./ 10.^(n);
A=imread('thresholding.jpg'); B=rgb2gray(A); subplot(2,2,1); imshow(B); title('Original image'); K=(B>100); subplot(2,2,2); imshow(K); title('Original image after thresholding'); for i=1:size(B,1) for j=1:size(B,2) N(i,j)=uint8(abs(255-B(i,j))); end end subplot(2,2,3); imshow(N); title('Image after digital negative');...
%%PLS_D1D2D5.m % Script to run a PLS regression and confidence limits calculation of a series of Cell-Free Synthesis (D1 & D2, D5) %% Copyright % Carlos Alberto Duran-Villalobos June 2020 University of Manchester. % Data provided by UCL and Sutro % Copyright (c) Future Targeted Healthcare Manufacturing Hub % Referen...
function eyeMovieV4 % eyeMovie Version 4.0 % Construct a movie from nev and ns5 data. % % Note: Must run in the foreground, program takes screenshots % %%%%%%%%%%%%%%%%%% % % - Mike Morais, Matthew Smith, Adam Snyder % %%%%%%% disp(sprintf('- - - EYEMOVIE V4.0 - - -\n')); % Get filenames [filename,~]=uigetfile('*...
% bpf_88_108.m % Band Pass Filter Design for FM band % Copyright 2002-2013 The Mathworks, Inc. % Dick Benson %% Low pass to band pass transformation from Handbook of Filter Synthesis, % Anatol I. Zverev. pp 154 section 5.5 fbp1 = 88e6; % low end of FM band fbp2 = 108e6; % high end of FM band f...
r=0.00001; M=100; m=20; A=19.99; B=0; time=250; step_size=0.001; B_array=zeros(1,time/step_size); A_array=zeros(1,time/step_size); rt=0:step_size:time; j=1; A0=20; for i=0:step_size:time A=A+r*A*(A-A0)*(1-(A/M)); A_array(1,j)=A; j=j+1; end plot(rt,A_array); xlabel('Time'); ylabel('Population'); grid; hold on...
%% Old files %file = [20180409, 152624]; file = [20180409, 174357]; file = [20180409, 182037]; file = [20180409, 184715]; file = [20180409, 191155]; file = [20180409, 192757]; file = [20180409, 194201]; file = [20180409, 195421]; file = [20180409, 200840]; %vertical file = [20180409, 204128]; file = [20180409, 205712];...
function [fw_unsorted] = create_fw( KE, ... load_distribution_x, load_distribution_y) % % [fw_load_vector] = create_fw( KE, load_distribution_x, % load_distribution_y) is a function that creates the load vector fw, % which gives the contact forces that result from an externally load. It % is not important wh...
function [cv_split, cv_trn_X_Xf, cv_trn_X_Y, cv_tst_X_Xf, cv_tst_X_Y] = get_std_xmlc_tune_data( trn_X_Xf, trn_X_Y ) cv_split = split_data(trn_X_Y,[],[],1); cv_trn_X_Xf = trn_X_Xf(:, cv_split==0); cv_trn_X_Y = trn_X_Y(:, cv_split==0); cv_tst_X_Xf = trn_X_Xf(:, cv_split==1); cv_tst_X_Y = trn_X_Y(:, cv_split==1); e...
function [ M , P ] = makeSBM( n,k ) %UNTITLED2 Summary of this function goes here % n = number verticies % k = number blocks P = rand(k); P = .5*(P+P'); %gives symmetric probability matrix for i = 1:k for j = 1:k if i~=j P(i,j) = P(i,j)/3; elseif i==j && P(i,j)<.3 P(i,i)...
function [sumLL] = sumloglikelihood(c0,ctest) %% Loglikelihood fx draft version 1 % Will Hockeimer JHU Neuroscience baseps = [0.75,0.05]; [adj,betamat] = sbm(100,c0,baseps,assortive); adj_test = kmeans(adj,ctest); sumLL=sum(adj_test*log(betamat)+(1-adj_test)*log(1-betamat)); end
function [abc] = archive_truncature(abc) %ARCHIVE_TRUNCATURE apply a crowding distance truncature if the archive size is exceeded S = length(abc.config.problem.functions); N= length(abc.archive); ovs = reshape([abc.archive.ovs],[N S]); distances = zeros(1,N); %the norm of each current objective function norms = zeros(S...
function varargout = GUI(varargin) % GUI MATLAB code for GUI.fig % GUI, by itself, creates a new GUI or raises the existing % singleton*. % % H = GUI returns the handle to a new GUI or the handle to % the existing singleton*. % % GUI('CALLBACK',hObject,eventData,handles,...) calls the local % ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Initialization %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% G1_Mice=[1 2 3 4]; G2_Mice=[5 6 7 8]; G1_Days=[3 4 5 6]; G2_Days=[3 4 5 6]; % G3 Base line G3_Mice=1:8; G3_Days=[1 2]; load...
function sepmask = assessSeperability(weights, sep_thresh,disp) if nargin<2 sep_thresh = 0.5; end if nargin<3 disp = 1; end [numweights, RF_width, RF_height, clip_length] =size(weights); for ii = 1:numweights this_scomp = svd(reshape(weights(ii,:,:,:),RF_width*RF_height,clip_length)); s_components(ii,:)...
% relperm and capillary pressure curves % to be used with FVTool package % Written by Ali A. Eftekhari % This is what this function does: % res=zeros(size(sw)); % for i=1:numel(sw) % if swc(i)<=sw(i) && sw(i)<=1-sor(i) % res(i)=kro0(i)*((1-sw(i)-sor(i))/(1-sor(i)-swc(i)))^no(i); % elseif 0.0<sw(i) && sw(i)<sw...
function a = find_left A = readin; T = []; for i = 1:209 B = A{i}; if(isempty(find(B(:,1)<255, 1))) T = [T i]; end end a = T; end
clear; %Jpeg directory: save converted dicoms JpgDir=[pwd '\datasets\ColitisDevkit2015\Colitis2015\']; %Dicom directory DicomDir='data\Colitis\'; %directory of dicoms %Patient Name patientList={'302','304','306'}; for kk=1:length(patientList) patient=patientList{kk}; %load d...
for i=1:numel(bad_mlst_files) % Need to get the original file name for the conversion below [PATHSTR, NAME, EXT] = fileparts(bad_mlst_files{i}); NAME = NAME(1:findstr(NAME, ';bandpass;')-1); orig_file = fullfile(PATHSTR, [NAME EXT]); cmd = ['ffmpeg -y -i "'... orig_file '" -i "...
function better_xi = Newton_beta(beta, xi, bar_xi) % function better_xi = Newton_beta(beta, xi, bar_xi) % % purely numerical run looking for a numerical solution to our Hopf % problem. % % INPUT % beta scalar, fixed parameter % xi Xi_vector % bar_xi Xi_vector % % OUTPUT % better_xi Xi_vec...
function plotlink(listname,conntype,measure,bandidx,varargin) param = finputcheck(varargin, { 'ylabel', 'string', [], measure; ... 'xlim', 'real', [], []; ... 'ylim', 'real', [], []; ... 'legend', 'string', {'on','off'}, 'off'; ... 'xlabel', 'string', {'on','off'}, 'off'; ... }); fontname = 'H...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % z-Transform properties % Convolution in the time domain n=0:50; x1=0.9.^n; x2=0.8.^n; y=conv(x1,x2); stem(0:100,y) legend('convolution '); figure syms n z x1=0.9.^n; x2=0.8.^n; X1=ztrans(...
clear close all clc %% Data Simulation Scripts nrEchoes = 128; tEcho = 120e-6; % echo time (s) T2 = 2e-3; %s? % T2D Data Sim gamma = 267.513e6; % Gyromagnetic Ratio (rad T-1 S-1) G = 6.56; % Magnet Gradient (T/m) Delta = 2e-3; %Big Delta (s) D = 1e-08; % Diffusion Coefficient % Little delta loop deltaMin = 10e-...
H= 4000;%4000; %meters a = 1; lambda = 100000; k = 2*pi/lambda; g = 9.81;%9.81;%m/s omega = -sqrt(g*(k^2)*H); A = -omega*a/(k*H); x0 = 0; z0 = 0; za0 = -50; zb0 = -100; tf = 10000; dt = 0.001; t = 0:tf; x = 0*t; z= 0*t; za = z; zb = z; x(1) = x0; z(1)= z0; x(2) = u(x(1),z(1),t(1),t(2),A,k,H,omega); z(2) = w(x(1),z(1),...
%% ------------------------------------------------------------------------------------- % % 创建用户界面 % % uicontrol: 创建用户界面控件 % % getfile: 获取图像文件并打开 % % beautification: 图像处理的主程序 % % save_image: 保存图像 %% ------------------------------------------------------------------------------------- %% ----------------------...
% Copyright @2015 MIT License Author - Harshal Priyadarshi - IIT Roorkee % See the License document for further information function condition = bearOffPossible( board,userChance ) % board --> the readable board condition = false; if(userChance == 1) totalCheckersInHome = 0; for i = 6:-1:0 total...
load rk/cranknic.mat; # Question 5 # Problem 8.18 A = [0 -6; 1 -5]; fun = @(t,x) x*A; # Solution for k = 1:5 t = linspace(0,5,10*2^k+1)'; x = 3*exp(-2*t) - 2*exp(-3*t); v = 6*exp(-3*t) - 6*exp(-2*t); u = rk(fun,cranknic,t,[1 0]); e(k) = max(abs(x - u(:,1))); end log(e(1:4) ./ e(2:5)) / log(2)
function [ valFilter ] = ... repeatingEventsFilter(segments,N,centroidDist,offTimeLim) %-------------------------------------------------------------------------- % % repeatingEventsFilter.m: % Subfunction of scriptFretFilter.m % % Description: % The function evaluates whether trace_i is part of a serie...
% CN05.m % SIMPLE RC CIRCUIT: SQUARE WAVE EXCITATION % Finite Difference Method for RC circuit anlysis % Ian Cooper % email: ian.cooper@sydney.edu.au % School of Physics, University of Sydney % DOING PHYSICS WITH MATLAB % https://d-arora.github.io/Doing-Physics-With-Matlab/ % 180216 clear all close all clc % ...
clear, close all, clc; %%% High pass %%% HP = readtable('HP_swept_sine_10_1k_1V', 'HeaderLines', 8); figure(); subplot(2,1,1) semilogx(HP.Freq, HP.Amplitude); title('20 Hz high pass filter, 10-1 kHz, @1 V') xlabel('Frequency [Hz]') ylabel('Magnitude [dB]') ylim([-81 50]) grid subplot(2,1,2) semilogx(H...
function de_ibd = ibd_expected(ibs_data, epl) % 0: ibs0 % 1: ibs1 % 2: ibs2 % 3: missing genotype ibs0 = 1; ibs1 = 2; ibs2 = 3; missing = 4; ibd0 = 1; ibd1 = 2; ibd2 = 3; Nmarkers = length(ibs_data); ce(1:3,1:4) = 0; % cummulated emmission for i = 1:Nmarkers ce = ce + epl{i}; end ce = ce'; N(ibs0) = nnz(i...
function normImage = normRGB(image) % gets the RGB values in the [0,1] range. normImage(:,:,1:3) = image(:,:,1:3); normImage(:,:,4:6) = image(:,:,4:6) / 255; end
clear clc %% %OGRANICZENIA A = [1000 1000 1000; 1000 1000 1000; 1000 1000 1000]; b = [1500;0.5;1500]; tic model = 'PIDpodgrzewacz'; load_system(model); %% %Algorytm GENETYCZNY % GENERATIONS - liczba generacji % DISPLAY - śledzenie pracy algorytmu genetycznego % POPULATIONSIZE - liczba populacji % CROSSOVERFRACTION - m...
function state_dot_cart = RHS_Asteroid(t,state,par) % Dynamique à 2 corps % mu = par(1); state_dot_cart = zeros(6,1); state_dot_cart(1:3) = state(4:6); state_dot_cart(4:6) = -mu*state(1:3)/(norm(state(1:3))^3); return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%Function: solved static linear elastic problems % %Input: p_1=polynomial degree in direction 1 % p_2=polynomial degree in direction 2 % n_1=number of basis functions in direction 1 % n_2=number of basis functions in di...
function [p,y,a] = qint(ym1,y0,yp1) %QINT - quadratic interpolation of three adjacent samples % % [p,y,a] = qint(ym1,y0,yp1) % % returns the extremum location p, height y, and half-curvature a % of a parabolic fit through three points. % Parabola is given by y(x) = a*(x-p)^2+b, % where y(-1)=ym1, y(0)=y0, y(1)=yp1....
function X = ForwardEulerNew(fhand, x0,p,u,tvec) X(:,1) = x0; for n=1:length(tvec)-1 dt = tvec(n+1) - tvec(n); f = fhand(X(:,n),tvec(n), p,u, p.b); X(:,n+1)= X(:,n) + (dt * f); end
function out = calcTran_X(k1, k2, h1, h2, delta_x1, delta_x2, delta_y1, delta_y2, miu, B) beta_c = 1.127e-3; Ax1 = delta_y1*h1; Ax2 = delta_y2*h2; out = 2*beta_c/(miu*B)/(delta_x1/(Ax1*k1) + delta_x2/(Ax2*k2)); end
% Current_ROI_info.m % Script for displaying info about current ROI % Jan Axelsson 2011-10-27 % % Initialize % StoreVariables % Remember variables Export %ROI_data_to_workspace; ExportROIs(imlook4d_ROI_number) TAB=sprintf('\t'); % % Get parameters % try dX=imlook4d_curr...
function varargout=gui_set(varargin) % % Graphical User Interface for store and set value(s) v 1.1 (Nov 2008) % % % % panel_handle=gui_set(panel_handle,names,values,codes) % % creates a gui_set interface in panel_handle filled with names, values, codes returning a % % handle to gui_set panel; if panel_handle ...
function [B,A]=coefDes(Fc,Fs,N) if (nargin > 3) | (nargin <= 2) error('Invalide number of arguments.'); end if (Fc > 0.88*(Fs/2)) error('Design not possible. Check frequencies.'); end pi = 3.14159265358979; Fs=44100; f1= Fc/1.09; f2= Fc*1.09; Qr=Fc/(f2-f1); Qd=(pi/2/N)/(sin(pi/2/N))*Qr; alpha=(1+sqrt(1+4*Qd^2))/2...
% Example for Canonical Discriminant Analysis % % by David L. Jones, May-2008 % % This file is part of the FATHOM Toolbox for Matlab and % is released under the GNU General Public License, version 2. % % Jan-2011: updated % Jun-2012: added f_chanceClass % File: '.../examples/iris.mat' % Load Fisher's Iris data: lo...
function vol_n = twi_normalize_slices(vol); %% Normalize the average of even vs odd slices vol_n = zeros(size(vol)); mask = niak_mask_brain(vol); mask1 = mask(:,:,1:2:end); mask2 = mask(:,:,2:2:end); for num_t = 1:size(vol,4); vol1 = vol(:,:,1:2:end,num_t); vol2 = vol(:,:,2:2:end,num_t); m1 = mean(vol1(mas...
figure; load('/media/RAID0/danny/sharedFolder_168/work/RVA-package/logs/xp2.mat'); % load('/media/RAID0/danny/sharedFolder_168/work/RVA-package/logs_std_0.1/xp.mat'); plot(y15,'LineWidth', 1.5,'color','r');hold on; plot(y16,'LineWidth', 1.5,'color','g');hold on; plot(y17,'LineWidth', 1.5,'color','b');hold on; plot(y1...
%A function which would iterate through a matrix and find the first peak %after the first zero crossing from all the rows. Used in conjunction with %freqDomainACF %Submitted by Deepak Gopinath - 903014581 function [indexArray, nOfRows ] = MaxValueCalcAfterFirstZeroCrossing(ACFMatrix) % so after freqDomainACF the ret...
%Setup code for MPC_regul_linear in simulink. This model test an MPC with CVXgen on a linerar process %derived from Gräfverts nonliner model through linearization. clear all; %global parameters used by mysolve function. global Ts; global Asystem; global Bsystem; global Csystem; global Dsystem; global Qglobal; global R...
% clc; % n = 3; % while(true) % c1 = 0.5 * rand(n ,1); % c2 = 0.5 * rand(n ,1); % x1 = rand(1 ,1); % x2 = rand(1 ,1); % r1 = max(x1, x2); % r2 = min(x1, x2); % p = rand(n, 1); % if norm(c1 - c2) > r1 % break; % end % end function [f, Jc1, Jr1, Jc2, Jr2] = energy1_case2_numer...