text
stringlengths
8
6.12M
function [lgs_req,domains_req,time_req] = DRMfunc(num_stars,total_obs,range,sc_mass,sc_fuel,sc_isp,sc_max_thrust,total_mission_time,exp_time,exp_acc,max_simult_lgs) g0 = 9.8066; idxs = [1 3]; % Only looking at the first and third "stars" in the Fibonacci spiral phi = acos(1-2.*(idxs-0.5)./num_stars); theta = pi*(1+sq...
clear % Parameters rM = .05; rA = .1; K = 1; hA = 2; hM = 0.2; theta = 0; lamda = .1; tau = 5; % Parameters for changing To epsilon= .001; %rate of change (positive if To increases, negative if to decreases maxenv = 7.5; %Maximum To (used only when simulating a deteriorating environment) minenv = ...
%interpolation A = rand(1,2); B = rand(10,2); xq1 = -3:.01:3; v1 = spline(B(:,1),B(:,2),xq1); v = pchip(B(:,1),B(:,2),xq1); plot(v); plot(v1); %compute Euclidean distances: distances = sqrt(sum(bsxfun(@minus, B, A).^2,2)); %find the smallest distance and use that as an index into B: closest = B(find(di...
function y = apply_multiple_ouput(f, g, x) % apply_multiple_ouput - compose multiple arguments functions % % y = apply_multiple_ouput(f, g, x); % % compute y=f(g(x)) where f takes several input and g computes several outputs. % % Copyright (c) 2010 Gabriel Peyre if not(nargout(g)==nargin(f)) error('one must h...
function pvstar = satvappr(T) % saturation vapor pressure from the clausius-clapeyron equation % input [K] output [Pa] ptrip = 611.65; % Pa Ttrip = 273.16; % K E0v = 2.3740e6; % J/kg Rv = 461; % J/kg/K cvv = 1418; % J/kg/K cvl = 4119; % J/kg/K cpv = cvv + Rv; % J/kg/K% pvstar = ptrip.*(T./Ttrip).^((cpv-c...
function class_mem = class_Memberships(x, y, u, sigma, mask, beta) %CLASS_MEMBERSHIPS Summary of this function goes here % Detailed explanation goes here likelihood = zeros(size(x,1),size(x,2),3); prior = zeros(size(x,1),size(x,2),3); class_mem = zeros(size(x,1),size(x,2),3); for i=1:3 likelihood(:,:,i) = (1/(s...
function [S,NlogL,optimInfo]... =gmcluster(X,k,start,reps, CovType,SharedCov, RegV, options,probtol) %GMCLUSTER Gaussian mixture fit. % S = GMCLUSTER(X,K) fits a K-component Gaussian mixture model to the % data. The fit maximizes the log-likelihood of the data using % Expectation Maximization (EM). Rows of X...
% Get distance between two markers % Tim Dorn % April 2009 % % -------------------------------------------------------------------- % Usage: [distXYZ, distAVR, distAVRNORM, midpt] = getDistance2Markers(markerStruct, M1, M2) % -------------------------------------------------------------------- % % Inputs: m...
iclear fid=fopen('memory_hex.txt'); A=fscanf(fid,'%s '); %最後項為size,表示讀入二列資料,直到檔案底 fclose(fid); a = zeros(128); for i=1:16384 if(A(i*2-1)~='x'&&A(i*2)~='x') a(ceil(i/128),mod(i,128)) = hex2dec( A(i*2-1:i*2)); else a(ceil(i/128),mod(i,128)+1)=0; end end figure(1) imshow(uint8(...
function DrawGraph(psm, psm_q) % subplot(1,2,1) % plot PSM T_psm = FKine(psm, psm_q); R = T_psm(1:3,1:3,end); T = T_psm(1:3,4,end); trans_homo = rt2tr(R, T); psm_base = eye(4); psm_x = T(1); psm_y = T(2); psm_z = T(3); title(sprintf('The position: x:%.4f, y:%...
function combined_matrix = RBES_combine_DC_matrices(dc_matrices) combined_matrix = dc_matrices{1}; for i = 2:length(dc_matrices) combined_matrix = SuperimposeContinuityMatrix(combined_matrix,dc_matrices{i}); end end
function [CFG, DATA] = RTK(CFG, DATA, test_idx) [DATA] = RT_Core(CFG, DATA, test_idx);
function [ti, th, thd, thdd, tau] = link1(thT, th0, m, a) T = 10; %thT = pi; th0 = 0; m = 1; a = 1; g = 9.81; con = 2*pi/T; delth = thT -th0; iner = m*a*a/3; grav = m*g*a/2; for i = 1:51 ti(i) = (i-1)*T/50; ang = con*ti(i); th(i) = th0 + (delth/T)*(ti(i) - sin(ang)/con); thd(i) = delth*(1...
function [L,U] = GaxpyLU(A) % function [L,U] = GaxpyLU(A) % Gaxpy LU without pivoting. % GVL4: Algorithm 3.2.2. % A is nxn and has an LU factorization. % L is nxn and unit lower triangular. % U is nxn and upper triangular. % A = LU. [n,n] = size(A); L = eye(n,n); U = zeros(n,n); for j=1:n % Compute v(...
function [bin_gen, bits] = encoding(min_var, max_var, scale_var, popsize) bits = ceil(log2((max_var-min_var)./scale_var)); bin_gen = rand(popsize, sum(bits))>0.5;
%This function calculates the streamfunction and velocity potential %by converting to a regular staggered grid and outputing on this %grid. function [PSI,PHI,LON_p,LAT_p,LON_r,LAT_r,dx,dy] = HelmD(lon,lat,u,v) % $$$ ,Udiv,Vdiv,Urot,Vrot, ... % $$$ LON_u,LAT_u,LON_v,LAT_v %Get x,y: CF = pi*6371000...
function [IBI,IBIdoc,time,timedoc,meanIBI,meanIBIdoc,stdIBI,stdIBIdoc]=IBIplot_manythresh(N,xcord,ycord,threshs,threshdoc,switchtimes) %this funciton computes interbeat intervals of 9 pixels and displays their %statistics depending of how you set the threshold for getting rid of short %IBIs (doctoring the IBIs) %orig...
G=20;%true number of modes M=5;%number of modes fit for ii=1:1 atrue=randn(G,1).*[G:-1:1]';%3.*[G:-1:1]';atrue=atrue(1:G); NN=0:5000; %depth_ind=1:length(NN); depth_ind=[1:50:500]; for n=1:G Ftrue(:,n) = cos(n.*pi*NN'./NN(end)); end F1=Ftrue(depth_ind,1:M); eta_true=Ftrue(depth_ind,:)*atrue...
% Clear the workspace close all; clear all; sca; % Here we call some default settings for setting up Psychtoolbox PsychDefaultSetup(2); pause(0.5); Screen('Preference', 'SkipSyncTests', 1); % Get the screen numbers screens = Screen('Screens'); % Draw to the external screen if avaliable screenNumber = max(screen...
function [data_clean,spindle_det] = remove_spindles(data,f0,varargin) % Procedure to detect and remove all spindles. % Load data + remove mean ### check this direction m = nanmean(data,2); m = repmat(m,[1 size(data,2)]); data = data - m; nelectrodes = size(data,1); data_clean = data; if isempty(varargin) %...
%% Postural Stability in Lateral Box Transfer task (without exoskeleton segmentation): COM deviation from centre of Base of Support % Based on "Investigation and Analysis of the Effects of Manual Lifting and Carrying Activities on Postural and Gait Stability in Normal Subjects", Mohammed Alamoudi, University of Miami,...
n = 500; Data = [ 10, 0 ; 0 , 3 ] * randn( 2, n ); p1 = [ 63/12*30 ; 107/2.2 ]; p2 = [ 72/12*30 ; 170/2.2 ]; mu = mean( [ p1' ; p2' ] )'; theta = atan2( p2(2)-mu(2), p2(1)-mu(1) ); R = [ sin( theta ) , -cos( theta ) ; cos( theta ) , sin( theta ) ]; Data = R * Data; [U,V] = eig( Data*Data' ); Data = Data + repmat( mu,...
function [pv] = random_parent_limitation(EP,pv) % Randomly pick and remove EP parents from the given parent vector pv (dag column). while EP > 0 ps = find(pv); % parent set pi = randi(size(ps,1)); % parent index pv(ps(pi)) = 0; EP = EP-1; end end
function [es procSpec] = VR_LFP_power_new... (animal, iseries, iexp, chan2consider, beh, movingwin, internalRef) % Calculate the power spectrum at the different frequencies and sample at % the es rate global pepNEV SetDefaultDirs if nargin<7 internalRef = []; end addpath(genpath('..\Behaviour analysis\')) a...
function b=Haar(a) N=size(a); hN=N/2; ru2=sqrt(2); b=a; b(1:hN(1),:,:)=(a(1:2:N(1),:,:)+a(2:2:N(1),:,:))/ru2; b(hN(1)+1:N(1),:,:)=(a(1:2:N(1),:,:)-a(2:2:N(1),:,:))/ru2;
function [cmAdjMat, vVertPos, cmImageGraph, cmShuffledAdjMat, vShuffledVertPos] =... genBlockmodelWithBackground_rec(sPosDist, posNum, numRow, numColumn, unitGraphSize, bShuffle, vBackgroundProp, sBlockmodelType,... varargin) % % Generate blockmodels, using a stocastic blockmodel (generative) model....
function [ corners ] = rotateCannonicalBox( cannonBox ) % Rotates the cannonical box to get the four vertices of the arbitrary % oriented box % % Usage: % corners = rotateCannonicalBox(cannonBox); % % Input : % CannonBox = Cannonical box % % Output: % corners = Four corners...
function yl = wave_load_ylims % loads ylims from binary file and returns them as two element vector [fid, errmsg] = fopen('ylims.bin', 'r'); if ~isempty(errmsg) warning('something wrong with coordinates'); return; end yl = fread(fid,'double'); fclose(fid);
close all clear all clc %load('tx_data_7.mat'); Q=4; delta_f=1; %train=training_10; nr_bits_train_2=20; train=randn(1,nr_bits_train_2)+1j*randn(1,nr_bits_train_2); nr_train_bit=length(train); nr_data=1000; nr_guard=2; nr_blocks=10000; data=qpsk(randn(2*nr_data,1)>0); data_pre=qpsk(randn(4*nr_train_bit,1)>0); seq=[data_...
function [optval, acc] = xval_svm(X, L, vals, numfolds) % Split into folds foldsize = floor(size(X, 1) / numfolds); train_folds = cell(numfolds, 1); test_folds = cell(numfolds, 1); train_L = cell(numfolds, 1); test_L = cell(numfolds, 1); for i = 1:numfolds te = X((i - 1) * foldsize ...
address = hex2dec('C010'); %Address is the first number of the I/O Range of a COM Port. It is given as a Hexadecimal number but must be converted to decimal. config_io; %Needs to be run once in the beggining of the script before outp or inp can be used outp(address, 3) pause(0.005) outp(address, 0) %Useful Link %htt...
function WriteCSVBoundaryFile(filename, A) fid = fopen(filename, 'w'); fprintf(fid, '"Points:0","Points:1","Points:2"\n'); fclose(fid); dlmwrite(filename, A, '-append', 'precision', '%.6f', 'delimiter', ',');
function varargout = proj2circle(cfit,X) % PROJ2CIRCLE projects a set of points to the edge of a specified circle % Xproj = PROJ2CIRCLE(cfit,X) projects the N points contained in the 3xN % array X to the edge of a circle specified as a structured array. % % X - 3xN array containing points % cfit -...
function [] = plotFlux( results, legends ) %UNTITLED Summary of this function goes here % Detailed explanation goes here figure subplot(2,1,1) hold on; subplot(2,1,2) hold on; plots=[]; colors={'blue' 'magenta' 'cyan' 'red' 'black'}; for iResults = 1:length(results(:,1)) rhosHighway=results{iResults,2}; fl...
figure ccLSTM = confusionchart(YTrain,trainPred); ccLSTM.Title = 'Confusion Chart for LSTM';
function imageByLED = hdrCart2Led(image) % % Usage: imageByLED = cart2led(image) % % Convert the specified image (a 2D or 3D matrix) into a 1 x 1280 vector % using the mapping information provided by Greg Ward. % % Inputs: % 1. image - a 2D or 3D matrix % % Outputs: % 1. imagebyLED - a 1 x 1280 vector, in which 759...
%------------------------------------------------------------------------------------ % % M-file: CpWg.m (Specific heat gaseous water, CpWg. [J/(mol*C)]) % % Data from Felder, Rousseau "Elementary Principles of Chemical Processes", % 2nd ed., 1986, John Wiley & Sons, Inc. % Valid in the temperature range [0-1500]de...
function y=cons_fun(~,~) y = true; end
function deleteLine(srcBlock, srcPortNum, dstBlock, dstPortNum) % Deletes a connection between a particular pair of blocks/ports if one exists % % deleteLine(srcBlock, srcPortNum, dstBlock, dstPortNum) % % Deletes the line connecting srcBlock/srcPortNum to dstBlock/dstPortNum % if it exists % [srcPort, sysName] = make...
function [training_pixels, p_1, p_2] = Select_Pixel_Class(rgb_image, file) if file == true grayImage = imread(rgb_image); grayImage = RotateRgbImage(grayImage, 90); else grayImage = rgb_image; end % Get the dimensions of the image. numberOfColorBands should...
% this matlab file,generate all the frameid that contain object,and unique % the frameid,output to pos2.txt;to be used for combineTxtlines.m. clc,clear; bpath='H:\Resource\Cnds\VOC\ImageSets\Main\'; %% this part first execute txtnames=dir([bpath '*.txt']); fida=fopen([bpath 'pos.txt'],'a');%dui ying di yi ge fo...
function [ output_args ] = untitled( input_args ) %UNTITLED Summary of this function goes here % Detailed explanation goes here %% Punto A - Practica 3 %Leemos nuestra imagen DICOM img=dicomread('brain_014.dcm'); %Le damos un formato doble a nuestra imagen con im2double y luego le %damos un a...
error = 9999; %arbitrarily large h = .01; %step size for shooting corrections x = 0; % initial guess for dT/Dx(0) while error > .001 [t,y] = ode45(@MyFunc,[0 1],[200,x]); cCalc = y(end,1); cExact = 100; error = cCalc - cExact; if error > 0 x = x - h; end if error < 0 ...
clear clc %function [dF,Spikes,ROI,ROIbases,corr] = %ConnectivityAnalysis(filename,MinValROI,std_threshold,static_threshold,CellMapFig) % filename='Videos/Compressed/04_wNP_wmag.tiff'; % MinValROI = 1000; % std_threshold = 10; % static_threshold = 0.01; % CellMapFig=1; [Image_Stack,num_images,Width,Height]...
load('xForTraining.mat') load('labelsForTraining.mat') load('coeff.mat') x_ = ExtractFeatures(xForTraining, coeff); w = sqrt(size(xForTraining, 1)); y = labelsForTraining; y(y==0) = -1; y(y==9) = +1; At = w'*x_ + w0 < 1;%set of active samples CurrCost = lambda/2*(w'*w) + 1/N*sum((1-(w'*x_ + w0)).*At); SubGrad...
function x = lhs(Nsam, k); for j=1:k, x(:,j) = randperm(Nsam)'./(Nsam+1); %latin hypercube end
%{ vis2p.StatAreaParams (lookup) # area_opt : smallint # param index --- gwin=200 : smallint unsigned # m) gaussian window size to convolve the RF Site Map glim=50 : smallint # m) distance from reversal in pixels difining inne...
% Loads data values from file path provided and creates a spline of the % loaded points. % Takes in the file path and the number of points the spline should % interpolate. % Returns the points in [x;y] format, x,y and the spline function function [blue,yellow,mids] = loadData(filePathNum,numOfPoints) % Read csv [bp,bl...
function [mat] = arr2mat(arr, rowidx, colidx) % [mat] = arr2mat(arr, rowidx, colidx) % Transforms an array to a matrix. % INPUTS % arr the array to be transformed % rowidx array indices that map to rows % colidx array indices that map to columns (optional) % OUTPUTS % m...
prompt = 'Enter name of image with extension: '; imgName = input(prompt, 's'); [filepath, name, ext] = fileparts(imgName); Img = imread(imgName); [row, col, ch] = size(Img); new = uint8(zeros(row,col)); prompt = 'Want to enter the weightage for RGB? (y/n) [y]: '; check = input(prompt, 's'); if isempty(check) check...
function wave_save_coordinates(xyz_mm, xSPM) % just a convenience function that saves st.centre to a file because global % variables are scary xyz_vox = mm2voxelb(xyz_mm, xSPM); fid = fopen('coordinates.bin', 'w'); fwrite(fid, [xyz_vox', xyz_mm], 'double'); fclose(fid);
function GAoutput=GArun(params,GAparams,fhandle_fitness,station,condition) % PP=GArun(params,ngen,npop,nelite,nrep,p,func) % % Run the genetic algorithm % % params: initial gene of parameters, 1-by-(number of parameters) % ...may also be npop-by-(number of parameters) % GAparams: a struct with the following fields...
function [X1_result,Y1_result] = compute_reult(YX_candidate,sample_w,sample_h,SelectKFeatures,I,SelectMIU1,SelectDELTA1,SelectMIU2,SelectDELTA2) %此函数与用haar特征的MIL的函数compute_reult有不同之处,不同的地方我用%¥¥¥¥¥¥¥¥¥¥¥标记出 K = size(SelectKFeatures,1); num_candidate = size(YX_candidate,1); AllFeatures = zeros(num_candidate,K); YX_all = ...
format long g; % Carga de datos arch_xi = fopen('./utils/Taller-01-P03-X-214.bin', 'r'); Xi = fread(arch_xi, 'double'); arch_yi = fopen('./utils/Taller-01-P03-Y-214.bin', 'r'); Yi = fread(arch_yi, 'double'); % Calculo de covarianza y varianza para calcular a1 covarianza_XY = cov(Xi, Yi); covarianza_XY = covarian...
function gEvaluated = g(obj,element,xi,eta) % g computes the g term of the metric at the local positions % (xi,eta) for the element. For the crazy grid. % % USAGE % ----- % gEvaluated = obj.g(element,xi,eta) % % INPUTS % ------ % element :: the element number % (type: int32, size:...
function layers = basic_cnn_classifier() layers = [ imageInputLayer([29 29 3]); convolution2dLayer(5,20,'Stride',2); reluLayer(); maxPooling2dLayer(2,'Stride',2); fullyConnectedLayer(2); softmaxLayer(); classificationLayer(); ]; end
function dataMag = powerLog( data ) %POWERLOG Summary of this function goes here % Detailed explanation goes here dataMag = 10 * log10( abs( data ) + eps ); end
function [product , ind] = max_product(v,n) f=1; t=[]; if iscolumn(v)==1 v=v'; end if size(v,2)<n product=0; ind=-1; return end for i=1:size(v,2)-n+1 for s=1:n f=f*v(i+s-1); end t=[t f]; f=1; end product=max(t...
function plot_PFC_ArmReplay_triggered_spatialprecision(thisdir,label) load(thisdir,[label '_replay_singlebothjoint'],[label '_replay_replayarm'], ... 'other_cells',[label '_replay_seqmean'],[label '_replay_seqtimes'],[label '_replay_stnd'],... [label '_Cand_sig_modu_include'],[label '_pSSDarm'],[label '_rep...
function [delta_nabla_b, delta_nabla_w] = update_mini_batch(training_data, eta_passed) global psizes global num_layers num_layers = numel(psizes); global biases global weights y=psizes(2:end); global n_training_data n_training_data = length(traini...
%Part of exercise 4 and 16, Andrew Banman %Computes the distance matrix for an arbitrary number of points drawn from %the flat Torus. function distances = ex4_torusDistances(numPoints) %Initialize points and distance matrix. point_cloud = rand(numPoints,2); distances = zeros(numPoints); for i = 1 : numPoints for ...
function S = findS(x, n, MATRICES) S = zeros(n*2,n*2); for i = 1:(n*3) S = S + x(i)*MATRICES(:,:,i); end S = S + eye(n*2); end
function [G, nGrids, nDivs] = GridStructure(n, m) % GridStructure - Generate a grid deviding the first octant by polar % coordinates. Each element of grid is given by (m-1) integer numbers. % The structure is similar to that given by polar coordinates. % % [G, nGrids, nDivs] = GridStructure(n, m) % % Input: ...
function adjacencyMatrix = RemoveRandomNeighbour( adjacencyMatrix, f ) nodesToRemove = round(size(adjacencyMatrix,1) * f); for i = 1:nodesToRemove randomNodeIndex = randi(size(adjacencyMatrix,1)); candidates = find(adjacencyMatrix(randomNodeIndex,:) == 1); if (numel(candidates) > 0) candidate...
clear all; h = 0.1; % zadana dokładność przybliżenia a = 1; b = 9; x = [ a : 0.01 : b ]; % przedział na którym liczymy pochodne % liczymy wszystkie pochodne metodą nr 1 - dokładność O(h) for i = 1 : size(x,2) da1(i) = ( exp(x(i)+h) - exp(x(i)) ) / h; db1(i) = ( exp(-(x(i)+h)*(x(i)+h)) - exp(-(x(i)*x...
% 2019-03-08 AndyP % algorithm for determining nearest position sample-to-stimulus sample % get time of stim onset, timeOut0 % compute time+diff(time0) to end of stimulus, determined by timeOutStop0 or end of trial % interpolate time of stim to nearest position timestamp
classdef resonatorReadout < qes.measurement.prob % a resonator readout multiple qubits % % data: 1 by 2^(number of qubits) % Copyright 2016 Yulin Wu, University of Science and Technology of China % mail4ywu@gmail.com/mail4ywu@icloud.com properties n delay = 0 % syncDelay is added auto...
% Q-2(b) function Q2B(f, p) len = size(p); len = len(2); x = floor(sqrt(len)); y = len / x; img = cell(1, len); for i = 1:len subplot(x,y,i) img{i} = Q2(f, p(i)); imshow(img{i}); title("Compressed image for rank: " + p(i)); end end
%% transform T2 slices. From 512x512 to 256x256 % input T2Slices_SZ512.mat, % output T1Slices_SZ512.mat load('T2Slices_SZ512.mat') pos = [50, 490, 80, 430]; NUMROWS = 256; NUMCOLS = 256; T2Slices = single([]); for i =1 : size(data,3) im = flipud(data(:,:, i)') ; im = single(im(pos(1): pos(2), pos(3) :...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %E90: P300 Offline Implementation %Spring 2021 %Code by Rekha Crawford % %Description: %Loads data for specified participant number, creates K-Folds, runs %classifer, makes confusion matricies, saves data to "Data/paperA0x" where %wher...
clear, clc syms u1 u2 u3 s t1 t2 u = [u1; u2; u3]; R = (2 * s * s - 1) * eye(3) + 2 * (u * transpose(u) - s * skew(u)); q = transpose(sym('q%d%d', [4, 3])); qq = transpose(sym('qq%d%d', [4, 3])); t = [t1; t2; 1]; E = skew(t) * R; eqs = sym(zeros(5, 1)); eqs(1) = transpose(qq(:, 1)) * E * q(:, 1); eqs(2) = transpos...
function [ y ] = phaseErrorPdf(x,A,sigma,phase ) %phaseErrorPdf Calculates the PDF of phase error for a vector with noise %[ y ] = phaseErrorPdf(x,A,sigma,phase ) % %This function calculates the pdf of the phase error for a 2d vector %length A with additive uncorrelated noise with standard deviation sigma % % x: (vect...
function Xguess = RLonestep(Xguess, Htf, PSFstack, CompMeasure) volumeResolution = size(Xguess); HXguess = forwardProjectWFvolume( PSFstack, Xguess ); HXguessBack = forwardProjectWFvolume( PSFstack, HXguess ); errorBack = Htf./HXguessBack; Xguess = Xguess.*errorBack; Xguess = Xguess.*CompMeasure; Xguess(fi...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % endfire % refer to "A Dual-Microphone Speech Enhancement Algorithm % Based on the Coherence Function" % % broadside % refer to "A coherence-based noise reduction algorithm for binaural % hearing aids" % % %%%%%%%%%%%%%%%...
%addpath(fullfile(pwd,'TOOLBOX')); %addpath(fullfile(pwd,'images')); %Sobel Edge Detection I = imread('rocks.jpg'); I_gray = rgb2gray(I); I_gray_double = double(I_gray); f_ori = figure,imshow(I_gray_double); message = sprintf('Sobel Edge Detection'); f_c = figure, I_sobel = sobelEdgeDetection(I_gray_double); imshow...
function test_power % Test code for the quaternion power function (.^). % This also tests the exponential and log functions, plus sqrt/conj etc. % Copyright © 2008 Stephen J. Sangwine and Nicolas Le Bihan. % See the file : Copyright.m for further details. disp('Testing power function (.^) ...'); T = 1e-12; q = qua...
function [ mol_return, energy, accepted ] = getOptimizedStructure( mol, ... accepted, MAX_ROTATE ) %This function take the system given in the array mol and %rotates each atom around the oxygen atoms to give an optimized % structure according to ice rules: % 1. Every oxygen...
function [acVal] = aco(HighPrice,LowPrice,nDay,mDay) % accelerator oscillator % 输入 【数据】HighPrice, LowPrice (时间 X 股票矩阵) % 【参数】nDay, mDay 快速和慢速移动平均回溯天数 (默认 5, 34) % daniel 2013/4/16 % 预处理 if nargin <2, error('not enough input');end if ~exist('nDay','var'), nDay = 5; end if ~exist('mDay','var'), mDay = 34; end if...
function Create_data_66_large() load '../models/pdm/pdm_66_multi_pie'; load '../models/tri_66.mat'; % This script uses the same format used for patch expert training, and % expects the data to be there (this can be found in % https://github.com/TadasBaltrusaitis/CCNF) % Replace with your location of training data da...
% $Header: svn://.../trunk/AMIGO2R2016/Preprocessor/AMIGO_gen_intrinsic_C.m 770 2013-08-06 09:41:45Z attila $ % AMIGO_gen_intrinsic_fortran: translates intrinsic funtions to fortran % %****************************************************************************** % AMIGO2: dynamic modeling, optimization and control of ...
function [newPop] = roulette_wheel(pop,fitness,popsize) %Input: pop - population string in binary (popsizexl) % l is string length % fitness - fitness values for each string %Output: newPop - new population after roulette wheel based selection newPop = pop; % This part is to scale the negati...
function [ nndata ] = Rescale( psi,eta,data) % Rescale is a scaling method based on density-ratio % please see the paper for parameter settings. %INPUTS % psi = the resolution for scaling (default value is 100) % eta = the radius of eta-neigbourhood (default value is 0.1) % data = data set (m,n); m-objects, n-variab...
function [topwords,times_used]=mostusedwords(document) words=strread(document,'%s','delimiter',' '); words=selectionSort_word(words); %modify remove duplicates algorithm to create topwords/times_used nodups=[]; z=0; y=0; for i=1:length(words) if ~iswordmember(words{i},nodups) ...
function T = rotk(k) T = eye(4); angle = norm(k); if (angle ~= 0.0) vec = k / angle; kx = vec(1); ky = vec(2); kz = vec(3); s = sin(angle); c = cos(angle); v = 1-c; T(1,1) = kx*kx*v + c; T(1,2) = kx*ky*v - kz*s; T(1,3) = kx*kz*v + ky*s; T(2,1) = kx*ky*v + kz*s; ...
function x = BMPSK_mod(data,A,level,bias_ratio) %BMPSK_MOD 偏置相移键控(Biased Multiple Phase-Shift Keying)电平映射函数 % 先做幅度为A且M=2^level的MPSK, 然后将所有点向右平移A*bias_ratio % % 输入参数: % data 1*n double 待映射比特串 % A 1*1 double 电平幅度 % level 1,2,3 每电平比特数 % bias_ratio [0,1] double 偏置系数 % ...
%[sh, cw_valid, iter] = ldpc_decode_hard(LLRin, H, max_iter) % % Hard decoding of LDPC codes using Bit Flipping algorithm. % Input LLR vector is converted to hardbit. % % Arguments: % LLRin - vector of LLR % H - parity check matrix % max_iter - maximum nuber of iterations. % % Returns: % sh - bi...
function mVec = computeCoeffMatrixMulFluxForm(REFS, DOPS, xVec, sysDex) %% Set the dimensions OPS = REFS.NX * REFS.NZ; %% Carry out the block multiply (TO DO: THIS CAN BE PARALLELIZED) if isempty(sysDex) sysDex = 1:(4 * OPS); end zVec = zeros(4 * OPS, 1); zVec(sysDex) = xVec; udex ...
function [res,ov] = procfork2(fork,dstr,tx) if nargin == 2 tx = dstr; dstr = fork; fork = 'rotafork2'; end addpath /rota/Analysis/Fork hdata = nmrdata_update(dstr); for xx = {'demag_E','demag_K','demag_L','low_T'} fdat = load_fork_data([dstr '-' fork '-' xx{1} '.dat']); if ~isempty(fdat), break; end...
% simple wrapper for kappa function function [y] = kappa(x, alpha, const) if nargin < 3 const = 1; end if nargin < 2 alpha = 1; end y = 1./sqrt(const+pi/8*alpha*alpha*x);
%plot for explaining the configuration of the diagnostic Figure_Default_Setting; figure; hold on; %grid on; %Plot a unit circle dtheta=pi/100; theta=0:dtheta:2*pi; plot(cos(theta),sin(theta),'k'); axis equal; meas_center=[0.5 0]; meas_radius=0.1; axis off; camera_box_center=1+0.2; camera_box_length=0.2; camera_box_wi...
%% calculate the gas oil ratio given oil pressure function [Rs] = gas_oil_ratio(pressure, fluid, grid) Rs = zeros(grid.blocknums,1); for i = 1 : grid.blocknums if pressure(i) <= fluid.bubblePressure Rs(i) = (178.11^2)/5.615 * ((pressure(i)/fluid.bubblePressure)^1.3); else Rs(i) = (178.1...
function data=Ratio_of_50_to_90(data) window_size = 128; totalwindow=length(data); for windowindex=1:totalwindow tempwindow=data(windowindex).winSound; [Pxx,w] = pwelch(tempwindow,window_size); Pxx=Pxx/sum(Pxx); total_sum=0; index_90=0; while (total_sum < 0.90) index_90=ind...
function [yPredicted,yTrainPredicted,classifier] = apply_classifier_ICA(training,testing,varargin) %TEST_CLASSIFIER extract features that will be used later by the %classifier % YPREDICTED = TEST_CLASSIFIER(TRAINING,TESTING). training and testing % are structures where the temporal features(training.features.temp...
function [scores,blvals] = matching(file,mode) %% reading pairs to be tested from file f= fopen(file); data = textscan(f,'%s %s'); fclose(f); a = data{1,1}; b = data{1,2}; len = length(a); scores = zeros(len); blvals = zeros(len); % i = 12313; % score = Loc_based(a{i},b{i}); for i = 1:1:len if mode == 0 % using...
function [L, best_begin] = find_tracks( M, SC ) % number of tracks we want to find (tracks not indexes, i.e. indexes + 1 ) % cost matrix(t,j) cost of song width j starting at time t [T, W] = size(SC); V = -inf( M, T ); P = nan( M, T ); % points to end of previous song in best partition %cost of one track accross al...
clc close all clear all t=-3:0.01:3; x= exp(-0.7.*t).*(t>0 & t<1); h= (1+t).*(t>0 & t<2); subplot(4,1,1); plot(t,x); axis([-1 5 -3 3]); grid on; title('x(t)'); xlabel('t'); ylabel('x(t)'); subplot(4,1,2); plot(t,h); axis([-1 5 -3 3]); grid on; title('h(t)'); xlabel('t'); ylabel('h(t)'); p=length(x); q=length(h)...
function [ region ] = fetchregion( latRange, longRange, varargin ) %FETCHREGION Retrieves a region of USGS elevation data % Downloads, extracts, and indexes all 1x1 degree latitude/longitude % cells necessary to cover the specified latitude and longitude range % from the USGS database (1/3 arc-second, GridFloat f...
function out = powerPlot(vsfp_data) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Function to calculate power in specific frequency bands across each % pixel in vsfp imaging data % % Usage: out = powerPlot(vsfp_data) % where out is the matrix with power % %%%%%%%%%%%%%%%%...
function varargout = cuentafiguras(varargin) % FINAL MATLAB code for cuentafiguras.fig % cuentafiguras, by itself, creates a new cuentafiguras or raises the existing % singleton*. % % H = cuentafiguras returns the handle to a new cuentafiguras or the handle to % the existing singleton*. % % cue...
function [on,off] = parsecondonoff(ex,dataset,CondDCh,MarkDCh,lsr) %PARSECONDONOFF Try to get the most accurate timing of Condition On/Off % Detailed explanation goes here import NeuroAnalysis.Experica.* nct = length(ex.CondTest.CondIndex); on = [];off=[]; if ~isempty(dataset) && isfield(dataset,'digital') markd...