text
stringlengths
8
6.12M
function [n1,val]=zerotest(y,m,w) [m,n1]=min(abs(y-m)); if sum(w)==0 val=1; else val=w(n1); end
function hHst = makehist(PixRng,ImgD,histOfFreq,histFreq,histCoord) %% histogram hHst.f = figure('Name','Histogram','numbertitle','off',... 'position',histCoord); hHst.ax = axes('parent',hHst.f); hHst.br = bar(PixRng,nan(1,length(PixRng)),'parent',hHst.ax); set(hHst.ax,'xlim',[PixRng(1) PixRng(end)],... 'yl...
function analysis = initializeAnalysis(deltaT) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Newmark Transient Analysis %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % analysis parameters beta = 1/4; gamma = 1/2; c1 = 1.0; c2 = gamma/(beta*deltaT); c3 = 1.0/(beta*deltaT*deltaT); a1 = (1.0 - gamma/beta); a2 = (deltaT)*(1.0 - 0.5*gamma/beta); a3 ...
function [ ] = completeInpaint( ) global input_puzzle_white global input_puzzle_red global try_again global shrink_factor % resize images for inpaint flag=1; resizeFactor=1; while (flag == 1) C = imresize(input_puzzle_red, resizeFactor); B = imresize(input_puzzle_white, resizeFactor); [r1, c1, d1] = size(C); if ...
% This is material illustrating the methods from the book % Financial Modelling - Theory, Implementation and Practice with Matlab % source % Wiley Finance Series % ISBN 978-0-470-74489-5 % % Date: 02.05.2012 % % Authors: Joerg Kienitz % Daniel Wetterau % % Please send comments, suggestions, bugs,...
function y=cubicspline3(f,x0,x) %第三类周期边界条件下三次样条插值; %x = linspace(-1,1,40); %x所求点; %y所求点函数值; %x0 已知插值点; %y0 已知插值点函数值; %f_0左端点一次导数值; %f_n右端点一次导数值; % x0 = linspace(0,2*pi,20); y0=feval(f,x0); n = length(x0); z = length(y0); h = zeros(n-1,1); k=zeros(n-2,1); l=zeros(n-2,1); S=2*eye(n); for i=1:n-1 h(...
% Calculates the total communication time if data is sampled at all 128*128 % antennas, and then sent to a subset of those antennas for computation. % Once the data is in the subset array, the communication time is the same % as for the original array. This is because the number of hops decreases % by X, but the packet...
x = (1:256); subplot(2, 2, 1); y = sin(0.1 * x) + 0.1*sin(10*x); plot(x, y); title(''); f = 1/3* [1, 1, 1]; x_tmp = [1, 2, 2, 3, 4, 4, 5]; y_tmp = [0, 0, 1/3, 1/3, 1/3, 0, 0]; subplot(2, 2, 2); line(x_tmp, y_tmp); F = freqz(f); subplot(2, 2, 3); plot(abs(F)); title(''); Y = conv(y, f, 'same'); subp...
search_seq ='AATACAATTAAAT'; M=length(search_seq); [header seqs]=fastaread('unique_IDS.fa'); shorter_seqs=cellfun(@(x)(x(2000:end)),seqs,'uniformoutput',false); [shorter_seqs I J]=unique(shorter_seqs); header=header(I); trans_mat=[eye(M);eye(M)*2;eye(M)*3;eye(M)*4]; final_mat=[]; for i=1:M*4 fi...
%% Examples of |odehybrid| % % This script contains numerous examples of using |odehybrid| to simulate % continuous and discrete systems, from a simple example to more complex % examples with non-vector states and logging, introducing all primary % features of |odehybrid|. It's meant for viewing directly in MATLAB by...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% hessian.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function h = mcs_hessian(i,k,x,x0,f,f0,g,G) % computes the element G(i,k) of the Hessian of the loc...
% testMatrix = [6,9,12,3;2,3,4,1;4,6,8,2;10,15,20,5]; testMatrix = [8, 10, 12;12, 15, 18]; [rows, cols] = size(testMatrix); rowVect = zeros(1, cols); colVect = zeros(rows, 1); newColVect = zeros(rows, 1); newRowVect = zeros(1, cols); usable = 0; %% get column vector (A) for irow = 1:rows for icol = 1:cols ...
function varargout=roo2prop(varargin) %ROO2PROP Convert from spectra to various optical properties. % ROO2PROP converts spectral values to specified optical values. % % Z=ROO2XYZ(ROO, PROPS, CWF, WL) with size(ROO)=[M N ... O W], % char array PROPS size [1 P] and row vector size [1 W], returns matrix Z % ...
function [J, grad] = linearRegCostFunction(X, y, theta, lambda) %LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear %regression with multiple variables % [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the % cost of using theta as the parameter for linear regression to fit the ...
function plotMUASpikeRatio(experiments,expType,StimArea,RespArea,channels) %% By Mattia Path = get_path; parameters=get_parameters; countAnimal=0; GoodSpikes=[]; for n_animal = 1:length(experiments); experiment=experiments(n_animal); if ~isempty(experiment.animal_ID) && experiment.expression(1)==1 && strcmp(exp...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % BME777: LAB 1: Bayesian Decision Theory. function [output1,output2]=lab1(FeatureX,Data,FeatureForClassification, LabelColumn) % Get number of samples. [ro,~] = size(Data); % Select feature for classification (1 or 2). SelectedFe...
function [ Pq, Psi1, Psi2 ] = pairwise_beliefs_gmm_C4( y, x, h, gmm, X_MARG_DOM ) %PAIRWISE_BELIEFS_GMM Computation of approximate outward messages % Detailed explanation goes here % % Created: Monday Sept 7, 2015 % inherited from 'factor_detect_approx_gmm.m' % Modified: Tuesday Sept 15, 2015 % improv...
function batch = select_optimal_batch(batch_size, soln, gradients, LB, UB, D, N, K, Y, varargin) % g = vector of partial derivatives of the cost function w.r.t. a % g = Q*soln + c; p = inputParser; p.addParameter('batch_method', 'probabilistic'); p.KeepUnmatched = true; p.parse(varargin{:}); batch_method = p.Result...
function [split_camera_tasks] = generate_split_camera_tasks_single_edge(... connected_camera_matrix, camera_data, point_data,... visibility_matrix, max_baseline_angle, max_split_cameras_per_edge,... group_assignments, group_sizes, group_idx1, group_idx2) [cams1, cams2] = find(triu(connected_camera_matrix, ...
function [Lstar] = generate_low_rank_matrix(dynamic_sing_vals,p,inc,rank) % U = eye(p); % V = eye(p); % ins_s = 0; % temp_vec = linspace(10,1000,1000); % for i =1:length(temp_vec) % [U1,~,~] = svd(U(:,1:rank)*U(:,1:rank)' + randn(p)/temp_vec(i)); % [V1,~,~] = svd(V(:,1:rank)*V(:,1:rank)' + randn(p)/temp_vec(i)...
function [ Data ] = angle_Velocity( Data, start_point) %compute angle and velocity initial = zeros(size(Data,1),length(start_point)); for i = 1:length(start_point) initial(:,i) = Data(:,start_point(i)+1) - Data(:,start_point(i)); end angle = initial(2,:) ./ initial(3,:); velocity = initial(2:3,:); start_point(:,len...
function [f, df] = myFunNew(X0, x, y, sn) if nargin == 0 clc; close all; x = [-20:0.1:60]'; y = rand(length(x), 1); n = length(x); sn = 0.1; X0 = [0.1 0.1 log([2.0 2.0])]'; end if isrow(x) x = x'; end if isrow(y) y = y'; end a = X0(1); b = X0(2); l = exp(X0(3)); l2 = ...
function [img1]=afcmclustering(IM1,nc) [x y]=size(double(IM1)); data=reshape(IM1,[],1); data_n = size(data, 1); in_n = size(data, 2); [center,member,obj_fcn]=fcm(data,nc); U2=member; maxU2 = max(U2); m5=U2'; for i=1:1:nc; index{i}=find(U2(i,:) == maxU2); [u{i} v{i}]=size(index{i}); img{i}(1:data_n)=0; f...
%批量删除1280*720以外的图片 clear;clc; Path = pwd; %pwd可获取当前工作目录路径 imagePath = strcat(Path,'\'); %路径后还要拼接\才正确 imageFiles = dir('*.png'); %读取目录文件下的所有图片文件 numFiles = length(imageFiles); %获取图片的数量 for i=1:numFiles imageFile = strcat(imagePath,imageFiles(i).name); image_data{i}=imread(imageF...
function adjust_ipopt_opt(N,nbus,ngen,nbranch,nstorage) A = regexp( fileread('ipopt.opt'), '\n', 'split'); A{2} = ['number_of_timesteps ' num2str(N)]; A{3} = ['number_of_buses ' num2str(nbus)]; A{4} = ['number_of_generators ' num2str(ngen)]; A{5} = ['number_of_lines '...
function b=dilation(x) function p=open(A) alpha = K1*A; beta = K2*A*alpha; gamma = K3*A*beta; p=(beta+gamma)/(1+alpha+beta+gamma); end global k1eff k2eff k3eff k4eff k5eff k6eff A EC1 EC2 EC3; setParamshill3P2X7(x); setAuxiliaryhill3P2X7(); Alow=0.1*10^-6; Ahigh=10*10^-6; A=Ahig...
function SAME = compareImages(size1,vdim1,size2,vdim2) SAME = true; if any(size1(1:3)-size2(1:3)) warning('Image and mask sizes are not the same'); SAME = false; end if any(vdim1(1:3)-vdim2(1:3)) warning('Image and mask pixdims are not the same'); SAME = false; end ...
%% 2-RSGF-V if (strcmp(cur_alg, '2-RSGF-V') == 1) fprintf(' \n'); fprintf('*** Running 2-RSGF-V\n'); num_2RSGF_V = num_2RSGF_V+1; else fprintf(' \n'); fprintf('*** Running MD-SA-GF\n'); num_MD_SA_GF = num_MD_SA_GF+1; end if N_iter <= 1000 seed_val = data.seed+120; else ...
function dx = aofun(t,x) global m w0 e a gamma E; dx = zeros(2,1); dx(1) = x(2); dx(2) = -(w0^2*x(1) + 2*gamma*x(2) + a*x(1)^2 + e/m*E(t)); end
%% Monte Carlo Integration Example 6 % We compute a double integral under a surface to find the volume. Again we % check for convergence of the solution to verify we used enough samples. % function from example 3 z = @(x,y) 3 + sin(x.*y).*cos(y.^2); xa = 0; xb = 6; ya = 0; yb = 3; % +----xa----+----xb % | | ...
function [ Sigma ] = my_covariance( X, X_bar, type ) %MY_COVARIANCE computes the covariance matrix of X given a covariance type. % % Inputs ----------------------------------------------------------------- % o X : (N x M), a data set with M samples each being of dimension N. % each co...
% ½»²æ²ßÂÔC£¬cross_tsp_c function cnew=cross_tsp_c(c1,c2,n) j1=ceil(n*rand); j2=ceil(n*rand); j3=min(j1,j2); j4=max(j1,j2); clear c3 c3=c2(j3:j4); j5=ceil(n*rand); k=1; for i=1:j5-1 if(isempty(find(c3==c1(i)))); cnew(k)=c1(i); k=k+1; end end cnew(k:k+j4-j3)=c3; k=k+j4-j3+1; for i=j5:n if(isempty...
function [y_lms, y_rls, y_lms_dd, y_rls_dd] = TimeDomainCancelMod(r, z, pulse, N, Nps, sps, bits, bitsPerSym, eBW, delta, lambda_inv, SequenceLength) MF = conv(r, pulse); init_idx = findLoc(bits, bitsPerSym, SequenceLength, sps, Nps, r, z); x = MF(init_idx:4:end); %x = ...
%Task 1 - Train clear; clc; load('train.mat'); %load training data %pre-processing data std_train_data = standardisation(train_data); [M,N] = size(std_train_data); %%for finding H matrix gram_matrix = zeros(N,N); h_matrix = zeros(N,N); C = 10^6; %really large value for hard margin threshold = 10^-4;...
A = [1 2 3 4 5 6 7 8 9 0]; found = 0; i = 0; for i=1:10 if A(i) == 8 found = 1; disp("found 8") break end end if found == 0 disp("no 8") end %%%%%%%%%%%%%% found = 0; i=1; while ~found if A(i) == 8 found = 1; disp("found 8") else i = i+1; end end...
function [error_test] = ... testError(X, y, Xtest, ytest, lambda_vec, error_val) % Given an array of lambda values and CV errors, finds the value of % lambda which minimizes error_val and the correspond test error. % Returns an array with test errors for each value of lambda. %%%%%% finds value of lambda whic...
clc clear info = audioinfo('author.wav') [x, Fs] = audioread('author.wav'); delay_sec = 0.05; N = 16000 * delay_sec; % Difference equation % y(n) = b0 x(n) + G x(n - N) G = 0.8; a = 1; b = [1 zeros(1,N-1) G]; r = 0.9; % pole radius % Pole-zero plot figure(1) zplane(b, a) title('Pole-z...
clear;clc;close all; timer = 0; if timer==2 tic end tt =-40; original_RGB = imread('10.jpeg'); original_YUV = rgb2ycbcr(original_RGB); width = size(original_RGB,1); height = size(original_RGB,2); if ~timer subplot(2,3,1); imshow(original_RGB); title('original'); subplot(2,3,2); imshow(origina...
function [ fibers_p, deg ] = OrientedNetworkPare(orient, fibers, num_nodes, str ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here abs_min_deg = 6; % absolute minimum degree for network fibers_pared = []; node1 = fibers(:,1); node2 = fibers(:,2); for m = 1:num_nodes deg(m) = sum...
function [] = plotData(data, dataTitle,col, type) %Extracting color channels switch type case 'mean' plotMeanIntensity(data, dataTitle, col); case 'threshold' %We use col here as the cutoff for plotThresh(data, dataTitle, col); end end function [] = plotThresh...
function nameTXT = toTXT(XYZ, outputName, folderName) %TOtxt - takes an Nx3 matrix and outputs an txt coordinate file % %Syntax: % % nameTXT = ejovo.fn.totxt(XYZ, outputName, folderName, atomName) % %Inputs: % % XYZ - an Nx3 matrix of XYZ coordinates % outputName - the name of the output file % ...
function mu = mu_t(data, phi, a_0, b_0, Sigma, d, k) sum_n = data' * phi; mu = zeros(k, d); for j = 1:k x = (a_0(j) * inv(b_0(:,:,j)) * sum_n(:,j)); mu(j,:) = Sigma(:,:,j) * x; end
x = zeros(1,100) for i= 1:length(x) x(i)= power(i,2) end save('file','x')
% compile_sfm_chanvese % % compiles sfm_chanvese_mex disp('Compiling sfm_chanvese_mex...'); mex sfm_local_chanvese_mex.cpp llist.cpp energy3c.cpp lsops3c.cpp disp('Compilation complete.'); disp('');
%画图 function plotdata(X,y) figure; hold on; pos = find(y == 1); %计算正项 neg = find(y == 0); %计算负项 plot(X(pos,1),X(pos,2),'k+','LineWidth',2,'MarkerSize',5); plot(X(neg,1),X(neg,2),'ko','MarkerFaceColor','y','MarkerSize',5);
function [A_bas,A_val] = get_eig_basis_3(A) [A_vec,A_val] = eig(A); A_bas = zeros(3,3,3); for ii = 1 : 3 A_bas(:,:,ii) = A_vec(:,ii) * A_vec(:,ii)'; end end
function [auc_val, auc_p,varargout]=slidingROC(stim, nostim, varargin) % [auc_val, auc_p,varargout]=slidingROC(stim, nostim, [boots, alph]) % takes 2 matrices , stim & nostim, of equal number of columns. % using ROC analysis (see auc.m) % returns a vector whose length is the column width of stim % # of columns must b...
function particlePositions = icyParticleInSelectedFrames( xlsFileName, frames ) % icyParticleInSelectedFrames is a function that extract icy spot detection results into a % strcuture array % Input: % (1) Xlsfilename: file path with file name. % (2) Frames: frames for extracting particle locations. input [] if applyin...
function [ilat_lim, lat_limits, h, coastlat,coastlon] = plotmap(lat,lon,latlim,maps,docbar,cbarPosition,icmap) % plot the coast line in a limited latitude absdlat = abs(abs(lat)-latlim); % |dlat| ilat_lim = find(absdlat==min(absdlat)); lat_limits = [lat(ilat_lim(1)) lat(ilat_lim(2))]; switch maps case 1...
function [aafA, aaafB, aafC, aafE ] = BuildingTemperatureSystemMatrices( afVentilationMassFlow ) % try % % BuildingTemperatureSystemMatrixOccupancyTestMatrixNonAdiabatic; % aafA = Ac_room; aafB = Bc_room; aafC = zeros(1,size(aafA,2)); aafC(1) = 1; aafE = Ec_room_r; % catch exception ...
close all; clear; clc; cols = ['r','b','k','g','y','c','m','r','b','k']; for p = 1:10 x = 0:0.01:1; y = (1 - abs(x) .^ p).^(1/p); plot(-x, y, cols(p)); hold on; plot(x, -y, cols(p)); plot(x, y, cols(p)); plot(-x, -y, cols(p)); end for i = 1:10 h(i) = plot(NaN,NaN,cols(i)); end legend(h, 'L1','L2','L3','L4','L5','...
function halfwayBreak(wPtr,b) global params; halfwayMsg = sprintf('You are halfway through the block!', (b-1), params.blockVars.numBlocks); getExpter = sprintf('Press space to continue with this block'); Screen('TextSize', wPtr, params.textVars.size); Screen('TextColor', wPtr, params.textVars.color); Screen('TextBac...
function [mag,phi,mag0]=compare_eigvec(e0,e1) %compare_eigvec % %[mag,phi,mag0]=compare_eigvec(e0,e1); %Gives the magnitudes and phase-angle for %eigenvectors. mag is the difference in magnitude %phi is phase difference and mage0 is magnitude of %reference vector e0. %@(#) compare_eigvec.m 1.1 96/08/21 14:00:...
function hash = hash_recurse(inArr, returnStr) %HASH_RECURSE (ps-utils): MD5 hash arrays, handles cell/struct recursively % hash = HASH_RECURSE(inArr) % % hash is a 16-element vector of uint8 values % returnStr: bool (default false): if true, return a 16char hex str. If false, return 16-byte array % % % ...
function st_sig=get_st_sig(trans_obj,field) st=trans_obj.ST; if isempty(st) st_sig={}; return; end st_sig=cell(1,numel(st.Ping_number)); nb_samples=numel(trans_obj.Data.get_samples); [~,N]=trans_obj.get_pulse_length; N_st=N(st.Ping_number); idx_r_st=st.idx_r-N_st; idx_r_et=st.idx_r+N_st-1; for ii=1:numel(st...
clear; clc; data = readPoints('points3D.txt')'; custom_box = [1 1 0; 1 -1 0; -1 -1 0; -1 1 0; 1 1 2; 1 -1 2; -1 -1 2; -1 1 2]; % Ransac routine [p_best, n_best, ro_best, X_best, Y_best, Z_best, error_best] = ransac_cus(data, 400, 10, 2, 40); % Get rotation matrix and translation created box rot_mat = generate_rotatio...
function [length1, direction, chosen_vertices] = cell_axes(l,C,V) %Calculates axial direction based upon distance between furthest vertices. vertex_list = C{l}; nk = length(vertex_list); A = -inf*ones(nk); for i = 1:nk for j = 1:i-1 A(i,j) = norm(V(vertex_list(i),:)-V(vertex_list(j),:)); end end le...
function [ res ] = T1( G,n ) res = 1; temp = 0; for i=1:n for j=1:n temp = temp + G(i,j); end%for if (temp==0) res = 0; %return; end%if temp = 0; end%for end%T1
classdef FileIterator < each.iterators.Iterable %FILEITERATOR Files Iterator % Iterator for looping over each file in a directory % % Example, a standard FOR loop: % % for i = X % ...% Loop Body % end % % We can think of it as the equivalent loop: % % sz = size(X); % numLoops = prod([sz(2:end)])...
I=csvread('1010.csv',11,2); [m,n]=size(I); avg_temp=0; sum_temp=0; max_temp=0; for x=1:4 avg_temp=0; sum_temp=0; for i=1:m for j=1:n sum_temp=sum_temp+I(i,j); end end avg_temp=sum_temp/(n*m); for i=1:m for j=1:n if(I(i,j)<avg_temp) I(i,j)=avg_temp; end end end en...
% Demo for aggregate channel features object detector on Caltech dataset. % % See also acfReadme.m % % Piotr's Computer Vision Matlab Toolbox Version 3.40 % Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] % Licensed under the Simplified BSD License [see external/bsd.txt] %% extract training and testing image...
function [filter_pts95,filter_pts50]=parfor_gridpoints(app,pt_idx,uni_dpa_index,step_size,cell_all_dpa,cell_75km_dpa) tic; %%%%%%Check for grid points file_name_50pts=strcat('filter_pts50_',num2str(uni_dpa_index(pt_idx)),'_',num2str(step_size),'km.mat'); file_name_95pts=strcat('fil...
function [ ] = Run_DCE_Perfusion( Subject_name, Subject_Path, Sim_Struct, PefusionOutput, Verbosity ) %Run_DCE_Perfusion Run Full DCE Perfusion Analysis display('---------------------------------------------------'); display('-I- Started Run_DCE_Perfusion execution at:'); c = clock; disp(datestr(datenum(c(1),c(2),c(3)...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2010 - 2015 Moon Express, Inc. % All Rights Reserved. % % PROPRIETARY DATA NOTICE: % The data herein include Proprietary Data and are restricted under the % Data Rights provisions of Lunar CATALYST Space Act Agreement % No. SAAM ID#...
function cur(n1,n2,val) % cur.m: % Add stamp for current source to the global circuit representation % ELEC4506, Lab-2 % Author: Nathan Lavoy % Date: October 3rd, 2018 %-------------------------------------------------------------------------- % define global variables global b; if (n1 ~= 0) b(n1) = b(n1) + v...
function [s] = sum_funct(V) s = 0; n = input("Introduceti n"); v1 = V(V < n); for i = v1(mod(v1, 2) == 1) s = s + i; endfor endfunction
clc clear close all %% input arguments d=4; n=20; TRr=5; SR=0.81; NR=0.1; tnsr=TR_rand(n*ones(1,d),TRr*ones(1,d)); %% sampling P=sampling_uniform(tnsr,SR); %% adding sparse noise tnsr_noise=noise_sparse_P(tnsr,P,NR,1); E=tnsr_noise-tnsr; %% solve problem via ADMM [x,y,RC,run_time]=RTRC(tnsr_noise,P,10^-2,false); %% eva...
classdef task < handle %TASK is a handle container for task objects for NIDAQ % If task is aborted/cleared before completion, the lines in use will % be in an unknown state! properties UserData; % Anything end properties(SetAccess=private) name; % Name ...
function train2MM() [f,y] = sampleDetector(@detector1,1000000,8); fprintf(2,'Fitting model...\n'); save 'samples_2mm_1.mat' f y; beta = logist2(y',f'); save 'beta_2mm_1.txt' beta -ascii; [f,y] = sampleDetector(@detector2,1000000,8); fprintf(2,'Fitting model...\n'); save 'samples_2mm_2.mat' f y; beta = logi...
function t =Acq(V,c) % computes an estimate of the trial at which conditioned responding began % V is the cumsum of poke elevation scores (# pokes during CS minus % # pokes during immediately pre-CS interval of same duration). c is the % decision criterion (amount by which cum rec must enduringly rise above % minimum i...
function [ output_vec ] = Update_Pos_Delay( delay, input_vec ) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here output_vec = zeros(size(input_vec)); output_vec(1 : delay ) = input_vec(end - delay + 1 : end ); output_vec(delay + 1 : end ) = input_ve...
%Does a compound contour plot over saved creep sweeps, displaying both %different time averaging and different force contours clear all; ramptimevec = [10 15 20]; Tvec = [ 0 1 10]; etavec = logspace(-1,0,5); alphavec = logspace(-1,0,5); stylevec = {'-','--','-.'}; colourvec = ['r','b','k','g','y','m','c','r','y','m','c...
ca;clear;clc; %% define animate %%% videos % th_r_arr = 0:60; th_p_arr = zeros(1,length(th_r_arr)); th_y_arr = th_p_arr; th_b_arr = 45+th_p_arr; vname = 'roll'; ii = 1; % th_p_arr = 0:-1:-15; th_y_arr = zeros(1,length(th_p_arr)); th_b_arr = 45+th_y_arr; th_r_arr = th_y_arr; vname = 'pitch'; ii = 2; % th_y_arr = 0:25;...
clear all close all % Load two speech waveforms of the same utterance (from TIMIT) [fname,fpath]=uigetfile('*.wav'); %selection du fichier audio a ecouter [d1,sr]=audioread([fpath,fname]); [fname,fpath]=uigetfile('*.wav'); %selection du fichier audio a ecouter [d2,sr]=audioread([fpath,fname]); % Listen to ...
function res = dmcSim(varargin) % res = dmcSim(varargin) % % DMC model simulation % Ulrich, R., Schröter, H., Leuthold, H., & Birngruber, T. (2015). % Automatic and controlled stimulus processing in conflict % tasks: Superimposed diffusion processes and delta functions. % Cognitive psychology, 78, 148-174. % Code a...
function pchoice = GetPChoice(k,sir,ldr,delay,realchoice) % By Chabris/Laibson 2008 (Likelihood function defined) % We calculate the likelihood of the data (real choice) which either % takes value 0 or value 1 (immediate or delayed reward respectively) % via the logit functions on the right hand...
function [ p_value, h ] = smk_freq_KTST(cfg,TF1,TF2) % smk_freq_KTST performs kernel two-sample test for the giving two time-frequency % representation of MEG data and it plots the topographic map of significant % channels if needed. % % % TH: As pointed out in nathan's email, convert the function to fieldtrip's % st...
function out = simp3D(func,a,b,c,d,e,f,NX,NY,NZ) % © Whayne Padden and Charlie Macaskill 2008 % The University of Sydney, Sydney, Australia % function out = simp3D('func',a,b,c,d,e,f,NX,NY,NZ) % func(x,y,z) returns the 3D function to be integrated at argument x, y and z. % a and b are x limits of integration, ...
clc clear all %% Monoharmoniczny f1 = 15; f2 = 100; A = 1; B = 0.5; t = 0:0.0001:1; Fs = 10000; y1 = A*sin(2*f1*pi*t); %% Wykladniczo malejacy X0 = 10; alfa = 1; y3 = 10*ones(1, length(y1)) while abs(y3(500)) > 5 % warunek na wygluszenie po 0,5 sekundy y2 = wykladniczy_malejacy(t, X0, alfa); y3 = y1.*y2...
function filter_bottom(trans_obj,varargin) % input parser p = inputParser; addRequired(p,'trans_obj',@(x) isa(x,'transceiver_cl')); addParameter(p,'FilterWidth',10,@isnumeric); parse(p,trans_obj,varargin{:}); results = p.Results; bot_data = trans_obj.get_bottom_idx(); % filter the bottom %bot_data_filt=round(filter2...
% determine c++ dimension vector % appropiate for write out as in cmmfile.h % e.g. via cmm_write_header(f, t, s) function s = cmm_dim(data) if isscalar(data) || ischar(data) s = []; return end s = size(data); l = length(s); if s(1)==1 && l==2 s = s(2); return end if l...
%George Mendez function comp = leastSQL(X,Y) %use these points to plot %X = [1 2 3 4]; %Y = [1.5 1.6 2.1 3]; %Vectorization [m,n] = size(Y); sumxy = X*Y'; sumx = sum(X); sumx2 = 0; sumy = sum(Y); %finding the sum of x squared for i = 1:n sumx2 = sumx2 + (X(1,i)*X(1,i)); end %defining our line ...
alpha = 0.1; watermark = uint8(randi([0,1],32,32)); embed = ss_embed(alpha); detect = ss_detect(0, alpha, 1024); originalImage = "lena_gs.png"; watermarkedImage = "wtma.bmp"; im = imread(originalImage); watermarked = embed(originalImage, watermark); imwrite(watermarked, watermarkedImage); [res, wps, sim] = detect(o...
function [EEG] = Artifact_removal(EEG, epoch_boundary, ar_rm_from_ch, mwpp_thld, tstep_thld, set_name, output_suffix, output_folder_cur) EEG = pop_artmwppth( EEG , 'Channel', ar_rm_from_ch:EEG.nbchan, 'Flag', [ 1 3], 'Threshold', mwpp_thld, 'Twindow', epoch_boundary, 'Windowsize', 200, 'Windowstep',... 50 ); % G...
function p = gammap(q,a) %GAMMAP Gamma distribution function. % GAMMAP(Q,A) is Pr(X < Q) where X is a Gamma random variable with % shape parameter A. A must be scalar. % % See also GAMMAQ, GAMMAR. % GKS 2 August 1998. if a < 0, error('Gamma parameter A must be positive'); end p = gammainc(q,a); k = find(q < 0); if...
function [ GC ] = GeneralizedCostMatrix( C, alpha2, lt, demand, k1, k2 ) % According to cost matrix C and other parameters, use objective function 2 % to generate generalized cost matrix GC. spaceNodeNum = size(C, 1); T = size(C,3); GC = k1*C; % Generalized arc cost matrix. for i2 = 2:spaceNodeN...
function [Itinerary,Probability,RouteChoiceRelatedPro] = ItineraryExtract(O,D,TapTime,LoopPath,PathIndex) %UNTITLED2 此处显示有关此函数的摘要 % 此处显示详细说明 global PathLineInf UpAccessTimeParameter UpEgressTimeParameter DownAccessTimeParameter DownEgressTimeParameter... UpDelayboardingParameter DownDelayboardingParameter ...
function [] = lookpc() for i=1:10 A=rand(i*100,1); B=rand(i*100,1); C=sin(B.^2); D=cos(A+C); M=[A,B,C,D]; % D=[]; % for j=1:size(M,2) % D=[D,M(:,j)/norm(M(:,j))]; % end try kpc(M,0.05) catch ME ME end end
function [css_binary_prob] = binary_cssi(css_images) num_of_images = length(css_images); css_image_model = ones(100,200); for i = 1 : num_of_images x_range = css_images(i).zero_crossings; y_range = repmat(css_images(i).sigma,[1 length(x_range)]); for j=1:size(x_range,2) css_image_model(100-floor...
% For computation define as function of 1 vector variable F.f = @(x) 100.*(x(2) - x(1)^2).^2 + (1 - x(1)).^2; % function handler, 2-dim vector F.df = @(x) [-400*(x(2) - x(1)^2)*x(1) - 2*(1 - x(1)); 200*(x(2) - x(1)^2)]; % gradient handler, 2-dim vector F.d2f = @(x) [-400*(x(2) - 3*x(1)^2) + 2, -400*x(1)...
#include "java_util_Hashtable_Entry.h" const struct clazz *base_interfaces_for_java_util_Hashtable_Entry[] = {}; struct clazz class__java_util_Hashtable_Entry = { DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_java_util_Hashtable_Entry ,0 , &__GC_MARK_java_util_Hashtable_Entry, 0, cn1_class_...
function Sc = symmxcell(mxcells) n = length(mxcells); Sc = cell(size(mxcells)); for i=1:n Sc{i} = symmxstack(mxcells{i}); end
% initTrackingParams.m % % Sets up initial tracking parameters for tracking algorithms. % Also initializes variables. Users shouldn't normally need to edit % this file, except the starting boundingSize. % % JSB 11/2010 function trackingParams = initTrackingParams() global trackingParams; % Tracking P...
function y = gmode(x) %GMODE Mode(s) of a grouped sample. % In some scientific works, once the data have been gathered from a % population of interest, it is often difficult to get a sense of what % the data indicate when they are presented in an unorganized fashion. % Assembling the raw data into a meaning...
fs=32; n=0:1:fs; y=sin(2*pi*n/fs); subplot(3,2,1); stem(y); ylabel('Amplituda'); xlabel('Numer probki'); title('Re(y)'); axis([-inf inf -inf inf]); subplot(3,2,2); stem(imag(y)); ylabel('Amplituda'); xlabel('Numer probki'); title('Im(y)'); y1=2*fft(y)/fs; subplot(3,2,3); stem(real(y1)); ylabel('Amplituda'); xlabel('Num...
function [r2p, dbv, oef, dhb] = ase_qbold_3d(nii_name,start_tau,delta_tau,end_tau,nii_out) % nii_name: Z-averaged ASE dataset % start_tau [ms] value of tau for first volume % delta_tau [ms] tau step size % set end_tau [ms] ... value of tau for last volume % nii_out ... output nifti's and save figs? 1=Yes,0=No %% Load...
%% error distance function distance_error = S_error(a,b,Sd) [r,~]=size(b); distance_error=zeros(1,r); for i= 1:r m=dist(a,b(i,:)); distance_error(1,i)=m+randn(1,1)*Sd; % distance_error(1,i)=m*(1+randn(1,1)*0.01); end end
function [model, b, free_variables, objective_const_term] = QP_Convert_to_Standard_Form(model) % ==================================================================================================================== % % QP_Convert_to_Standard_Form(model): % This function takes as input the data of an LP in the following ...
close all filename = 'ped1_prediction6_train.txt'; delimiterIn = ','; headerlinesIn = 1; A = importdata(filename,delimiterIn,headerlinesIn); train1 = []; id = 1; for k = [1,4] train1(:,id) = A.data(:,k); id = id + 1; end train1 = train1(1:36000,:); filename = 'ped1_prediction6_test.txt'; delimiterIn = ','; headerline...
% needs to be taken as an input parameter format compact disp('----------------------------------------------------------------------------------------') disp('The following parameters are critical for the') disp('proper representation of your tokamak. Please make sure they have been correctly defined ') disp('BEFORE ...