text
stringlengths
8
6.12M
function lkDpxTuningExp(varargin) % lkDpxTuningExp(varargin) % % EXAMPLES % Standard grating tuning curve: % lkDpxTuningExp % Grating speed tuning curve with different contrasts vertical % lkDpxTuningExp('mode','Speed', 'stim','Grat', 'dirdeg',90) % Random dots speed t...
function [x,xp] = twalkEnds(xxp) n=size(xxp,1)/2; x=xxp(1:n,end); xp=xxp(n+(1:n),end); end
function [J grad] = rnaCusto(nn_params, ... input_layer_size, ... hidden_layer_size, ... num_labels, ... X, y, lambda) %RNACUSTO Implementa a funcao de custo para a rede neural com duas camadas %voltada p...
clc;close all;clear all % lenght for testing n = 500; % Modeling signal Y1 = (0.5 .* sin((1:2500)/2)); Y2 = (0.5 .* sin((1:2500)/10)); Y = [Y1 Y2]; U = [ones(1,2500) 2*ones(1,2500)]; % create data for testing Yz = [Y1(1:(n/2)) Y2(1:(n/2))]; Uz = [ones(1,(n/2)) 2*ones(1,(n/2))]; figure('Color','w'); plot(Yz,'k');hold...
function [x,y] = findK %%%%%%%%%%%%%%%%%%%%%%%%% % READING IN DATA %%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%% % Initialize Questionnaire Data % Four columns: % 1. Order % 2. SIR (small immediate reward) % 3. LDR (large delayed reward) % 4. Delay qdat = readtable('kirby.csv'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SIMUL...
C1 = [2,1;1,2]; C2 = [2,1;1,2]; m1 = [0;2]; m2 = [1.7;2.5]; numGrid = 50; xRange = linspace(-6.0, 6.0, numGrid); yRange = linspace(-6.0, 6.0, numGrid); P1 = zeros(numGrid, numGrid); P2 = P1; for i = 1:numGrid for j = 1:numGrid x = [yRange(j) xRange(i)]'; P1(i,j) = mvnpdf(x', m1', C1); ...
clear all; close all; alpha=load('hur_data'); iters=2; sigma=[0 2 5 10 20]; RunL=1000; err=zeros(iters,RunL); A=[1 -10;10 1]; for j=1:5 fptr=fopen(strcat('hur',num2str(j)),'w'); err=zeros(iters,RunL); for i=1:iters [err(i,:)]=construn(A,sigma(j),alpha(j,2),RunL); end; err_mean=mean(err); err_std=std(err); ...
%******************************************************************* % Region Based Stereo Matching Algorithm by Global Error Energy % Minimization by Smoothing Functions method explanied in the % "Obtaining Depth Maps From Color Images By Region Based Stereo % Matching Algorithms" % % It uses stereo color ima...
function lengths = grEdgeLength(nodes, edges, varargin) %GREDGELENGTH Compute length of edges in a geometric graph. % % Deprecated, use 'grEdgeLengths' instead. % % LENGTHS = grEdgeLength(NODES, EDGES) % % Example % grEdgeLength % % See also % grEdgeLenghts % ------ % Author: David Legland...
function make25Hzraw(tag) % % make25Hzraw(tag) % [s,fs]=swvread(tag,[],2) ; save(['/tag/data/raw/' tag 'raw25'],'s','fs')
function result = Runge_Kuuta(start,finish,stride,u0)%依次是 起点,终点,步长. %题目要求四级四阶方法,对应 m = 4 , f = tu^2 u0 = 1 ; %给定初始值 t = start;%t(0) n = (finish - start)/stride;%结点数 u=[];u(1) = u0;%u(1)实际的u(0) for i = 1:n k1 = t*u(i)^2; k2 = (t + stride/2)*( u(i) + stride/2 * k1)^2; k3 = (t + stride/2)*( u(i) + strid...
function [ output_args ] = testhypergraph( input_args ) %TESTHYPERGRAPH Summary of this function goes here % Detailed explanation goes here H= [0 1 0 0 0 1; 1 0 1 0 1 1; 1 0 0 1 1 0; 1 1 1 0 1 1; 0 1 2 1 1 1; 1 0 1 1 0 1]; Dvm = diag(sum(H,2)) Dem = diag(sum(H,1)) Dwm = eye(6); A=Dvm^(-1/2)*H*D...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright ?2011,2012 Yuchao Dai, Hongdong Li, Mingyi He % This file is part of NRSFM_DLH. % % NRSFM_DLH is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as p...
function [Delta,beta] = cnum2sys(delta0,w0) % Delta = cnum2sys(delta0,w0) % % The complex number delta0 and frequency w0>0 are given. % This function constructs a stable, LTI system Delta(s) such that % Delta(j w0) = delta0 and || Delta \|_infty <= |delta0| if isreal(delta0) beta = 0; Delta = ss([],[]...
function [bin_NUB_len,final_emUBdata,tag_NUB1,tag_NUB2,tag_NUB3,tag_NUB4,tag_NUB5,tag_NUB6,tag_NUB7,tag_NUB8,Second_pro_bitplane1,Second_pro_bitplane2,Second_pro_bitplane3,Second_pro_bitplane4,Second_pro_bitplane5,Second_pro_bitplane6,Second_pro_bitplane7,Second_pro_bitplane8] = Preprocess2(compress_type_len,tag_prepro...
function [M] = subsMatrix(N, pos, t1, t2, t3, t4, t5, t6) % Calculates the numeric value of a symbolic matrix at a specific point. % M is a 6x6 double % N is a 6x6 sym % pos is a 1x6 double of actuator angles if(length(pos) ~= 6) return; end t1 = pos(1); t2 = pos(2); t3 = pos(3); t4 = pos(4); t5 = pos(5); t6 = p...
function [RT] = rigbt(Phi, Psi, Theta, x0, y0, z0) %刚体变换函数:rigid body transformation %输入参数: % φ=Phi 绕x轴转动的角度 % ψ=Psi 绕y轴转动的角度 % θ=Theta 绕z轴转动的角度 %输出参数: % RT 将坐标轴进行刚体变化(旋转+平移)成新的坐标轴 % %% 程序 R1 = [1 0 0; 0 cos(Phi) sin(Phi); 0 -sin(Phi) cos(Phi)];%绕X轴旋转 R2 = [cos(Psi) 0 -sin(Psi); 0 1 ...
function pop = eraseWeak(pop,varargin) % population/eraseWeak % % pop = eraseWeak(pop,N=1) % % Erases the weakest N individuals in the population. %************************************************************ %* * %* vgGA: The Virtual Gene Genetic Algorithm ...
% UMI filter and plot % remove UMIs w/ small number of counts; threshold determined by dynamic cutoff, top3 UMI family size does not distinguish different genotypes clear all; close all; uniqUMInum1 = zeros(1,226); uniqUMInum2 = zeros(1,226); uniqUMInum3 = zeros(1,226); uniqUMInum4 = zeros(1,226); alignedreads = zeros...
function [FBAsols,DRgenes,constrainedRxns,cycleStart,states] = optimizeRegModel(model,initialRegState) % optimizeRegModel - finds the steady state solution of a model with % Boolean regulatory constraints % % [FBAsols,DRgenes,constrainedRxns,cycleStart,states] = optimizeRegModel(model,initialRegState) % % model ...
function [Gc,Kp,Ti,Td,H]=cohenpid(key,vars) K=vars(1); L=vars(2); T=vars(3); N=vars(4); a=K*L/T; tau=L/(L+T); H=[]; if key==1, Kp=(1+0.35*tau/(1-tau))/a; Gc=tf(Kp,1); elseif key==2, Kp=0.9*(1+0.92*tau/(1-tau))/a; Ti=(3.3-3*tau)*L/(1+1.2*tau); Gc=tf(Kp*[Ti,1],[Ti,0]); elseif key==3 | key==4 ...
%% second_level_MVPA % Runs 1 sample t-test and/or displays results % % MM/DD/YY -- CHANGELOG % 05/01/20 -- Log started, forked for MVPA function second_level_MVPA(subj, study, dd, ss, classifier) %% check inputs if length(subj) < 2 error('Submit ALL subjects!') end if ~isstruct(subj) || ~isstruct(study) er...
function pic = PictureReader(index, p) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Read in a picture with the given index and folder name % % INPUTS: % index - the # in the file name. % p.smoothing - 0 if there should be no smoothing. 'n' if there should % ...
% Script to return a vector of coefficients of elastohydrodynamics modes of a % slender rod for angle data %chosenOnes = [3,4,7,32]; % Chosen ones for 560_lessthan_0.6tc(20170411T131818268) chosenOnes = [49, 48, 45, 42, 34, 25, 20, 13, 11, 7, 6, 5, 4, 35, 22, 15, 3]; nmax = 3; bcs = 'free'; % Only know free end stu...
clear; clc; fs = 10000; recorder = audiorecorder(fs, 8,1); recordblocking(recorder,2); %recorder turned ON for 2 seconds play(recorder) %y - Array to store the recorded data y = getaudiodata(recorder); filename = 'speech2.wav'; %Write data in y to .wav file audiowrite('speech2.wav', y, 10000);
function [X] = unorigami( X, dim) X = reshape(X, dim(1), []); for i = dim(2)+1:2*dim(2):dim(2)*dim(3) X(:,i:i+dim(2)-1)=fliplr(X(:,i:i+dim(2)-1)); end end
function [config_clearance_value adj_list] = invalidBasedConfigsClearance(configs,adj_list,prm_distances,valid_nodes,invalid_nodes ) %Compute clearance of each configuration. % Compute clearance of each configuration based on the distance from the % nearest invalid configuration. total_configs = size(configs,1); ...
function [net, ehist, act] = train_srn(net, ipat, tpat) % Train an SRN with one input, one hidden, and one output layer. The % sigmoid function is used as the activation function of the hidden units. % The softmax function is used as the activation function of the output % units. ninput = net.ninput; nhid = net.nhid; ...
% Sourced from "Pattern Recognition" function [SVMstruct,svIndex,pe_tr,pe_te]=... SVM_clas(X1,y1,X2,y2,tol,C,sigma) options = statset('Display','iter',... 'MaxIter',20000); %Training and Ploting parameters [SVMstruct,svIndex]=svmtrain(X1, y1,... 'KERNEL_FUNCTION','rbf',... 'RBF_SIGMA',sigma,'BOXCONSTRAINT',C,'sh...
function [ timeInfo ] = find_time( data ) %find_time It finds the time %Initialize timeInfo timeInfo = zeros(1,4); %Define hundreds, tens, and ones matrices hundreds = [200 100]; tens = [80 40 20 10]; ones = [8 4 2 1]; %Determine year using the dot product yearTens = dot(tens, data(46:49)); yearOnes = dot(ones, dat...
% Learning phase of trials a=0 for a=0:2 visStim= fget1(a + '.txt') audStim= read(a + '.wav') display(visStim) pause(1) wavplay(audstim) end
% V - różnica potencjałów między wewnętrzną a zewnętrzną stroną membrany V = 60; % bramka typu 'm' m = 0.2; % bramka typu 'n' n = 0.3; % bramka typu 'h' h = 0.2; % wektor czasu t = 0:0.0001:10; % wektor p składający się z czterech elementów: V, m, n oraz h p=[V;m;n;h]; % funkcja do rowiązywania równa...
function []=Write_vtk_point(Pts,Normals,filename,Scalar) % Usage: % Write_vtk_surface(Pts, Tri, Normals, Scalars, LUT, filename); fid = fopen(filename, 'w'); fprintf(fid, '# vtk DataFile Version 3.0\nvtk output\nASCII\n'); fprintf(fid, 'DATASET POLYDATA\n'); fprintf(fid, 'POINTS %d float\n',size(Pts,...
function [solver, a] = rule_lab2_1( class1, class2, pr) %UNTITLED Summary of this function goes here % Detailed explanation goes here M1 = mean(class1); M2 = mean(class2); n1 = length(class1); n2 = length(class2); err1=0; err2=0; err1_2=0; err2_2=0; err1_3=0; err2_3=0; S1 = cov(class1); S2 = cov(class2); AS1 = inv(S1);...
clear;clc;close all SamFreq=5120; N=5*SamFreq; fs=SamFreq; t=0:1/fs:(N-1)/fs; s_f1=(2.5*t.^2+2*t);s_f2=(25*t.^2+20*t); f1=5*t+2;f2=20+50*t; f1_zheng=f1;f2_zheng=f2; figure(1); plot(t,f1,'r');hold on;plot(t,f2,'b'); sig=cos(2*pi*s_f1)+sin(2*pi*s_f2); %另别的sig %sig=cos(2*pi*(10*t.^2+2*t))+cos(2*pi*(20*t.^2+4*t)); %另别的sig...
% md5 % Halla el resumen MD5 del mensaje, como una cadena hexadecimal. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% PASO 1.- INTRODUCIMOS VARIABLES Y CONSTANTES NECESARIAS clc %PASO 1.1.- ESCRIBIMOS EL MENSAJE mensaje= input('Introduce el mensaje entre comillas:'); while(~ischar(mens...
% This defines a data structure that describes the physical state of a % superconducting material for a given range of positions and energies. % This class inherits the internal structure of the 'Metal' class. % % Written by Jabir Ali Ouassou <jabirali@switzerlandmail.ch> % Inspired by a similar program written by Sol ...
% weighting function [gen, weight_a, weight_b] = fusion_strategy(features_a, features_b, source_a, source_b) [m1,n1] = size(source_a); % resize resize_temp1 = imresize(features_a, [m1, n1]); resize_temp2 = imresize(features_b, [m1, n1]); % soft-max weight_ave_temp1 = resize_temp1./(resize_temp1+resize_temp2); weight_a...
function [G,abitazione,indirizzo,vincoli]=inserisci_nodo(G,abitazione,indirizzo,vincoli) % inserisci_nodo: l'utente può aggiungere un nodo al grafo iniziale n=G.get_size(); m=n; while m==n ...
% speccos.m plot the spectrum of a cosine wave f1=50; phi=0; % specify frequency and phase f2=150; f3 = 250 time=2; % length of time Ts=1/1000; % time interval between samples t=Ts:Ts:time; % create a time vector x=cos(2*pi*f1*t+phi) + cos(2*pi*f2*t+phi...
%This file is used to test dilation. A = imread('wirebondmask.tif') temp = IPdilate('wirebondmask.tif', [1 1 1; 1 1 1; 1 1 1]) figure; subplot(121); colormap(gray(256)); imagesc(A); axis equal; axis tight; title('INPUT IMAGE') subplot(122); colormap(gray(256)); imagesc(temp); axis equal; axis tight;...
function loop_test3() err = 1; for i = 1:10 err = 0; for l = 2:10, for k = 2:10, if (err <= abs(pi)) err = abs(pi); end; end; err; end; err; end; err;
function [a] = commondivisor(a,b) while(b) t=mod(a,b); a=b; b=t; end end
function PixelSize=as_improc_pixelsize(scale) if ~exist('scale','var') scale=inputdlg('length of the bar in Ám'); if ~isempty(scale) scale=str2double(scale{1}); %Ám : scale of the bar that appears in your image end end if ~isempty(scale) && ~isnan(scale) h=imline; PixelSize=scale/length(find...
function varargout = Edge_Detection(varargin) % EDGE_DETECTION MATLAB code for Edge_Detection.fig % EDGE_DETECTION, by itself, creates a new EDGE_DETECTION or raises the existing % singleton*. % % H = EDGE_DETECTION returns the handle to a new EDGE_DETECTION or the handle to % the existing singleton...
load('npfda_pho_norm.mat'); % Normalization x_timegrid = phoX'; sample_mean = mean(mean(phoY)); sample_std = 2*std(phoY(:)); phoY = phoY - sample_mean; phoY = phoY / sample_std; hyper = make_hyper(); prior = nhgpprior(x_timegrid, ... hyper.mu_m, hyper.G_m, hyper.L_m, ... ...
obj = analysis.void_finder; obj.loadExpt(2); obj.loadAndFilterStream(1,1); data = obj.filtered_cur_stream_data; d1 = data.dif2; d2 = d1.dif2; figure plot(data) yyaxis right plot(d2) threshold = 3*10^-8; d = d2.d; [pks,locs] = findpeaks(d,'MinPeakHeight',threshold); tic dd = -d; [mins,m_locs] = findpeaks(dd,'MinPeakH...
function Phasemovie tmax=20; x=-5:0.5:5; y=-3:0.2:3; axis([-7,7,-4,4]); hold on xlabel('x') ylabel('y') plot(0,0,'m*',-pi,0,'m*',pi,0,'m*') [X,Y]=meshgrid(x,y); P=Y; Q=sin(X+Y); D=sqrt(P.^2+Q.^2); quiver(X,Y,P./D,Q./D,0.5,'k') [x0,y0]=ginput(1); [T,Y]=ode45(@ff,[0,tmax],[x0; y0]);% ili s ...
function [classifier, parameters,ROC_values] = as_axonSeg_make_DA_classifier(axonSeg_step1,axonSeg_segCorrected,axonSeg_gray, parameters,type,val) % OUTPUTS ----------------------------------------------------------------- % Rejected_axons_img (OUT) : binary image of rejected axons % Accepted_axons_img (OUT) : binary i...
% Cs Ax2 and Na 'x' Scan %% load d = replot2([20180116, 213631]); ParamsNa = [linspace(18.04, 18.26, 18), linspace(18.98, 19.24, 14), ... linspace(19.48, 19.74, 18)] * 1e6; ParamsCs = linspace(-180, 250, 50) * 1e3; % Ax2,3 Full %% Cs i=1; %which scan? m=2; %which survival? SurvProb = d(i).Analysis.SurvivalPro...
%% Finite Difference BOUNDARY Honeycomb Spectra clear %% set grid size a = 1; mx = 200/(1*a); %% set up honeycomb lattice q = 4*pi/(a*sqrt(3)); k1 = q*[1;sqrt(3)]/2; k2 = q*[1;-sqrt(3)]/2; k3 = k1+k2; v11 = sqrt(3)/2; v12 = sqrt(3)/2; v21 = 1/2; v22 = -1/2; %% different edges ktilde = k2; %% quasimomentum vectors ...
function options = sgplvmFOLSOptions(type) % SGPLVMFOLSOPTIONS Returns options struct for fols model % FORMAT % DESC Return a options struct for the fols model % ARG type : options specifier % RETURN options : fols option struct % % SEEALSO : sgplvmCreate % % COPYRIGHT : Neil D. Lawrence, Carl Henrik Ek, Mathieu Salzm...
clc; clear all; close all; x=[0 0 1 1;0 1 0 1]; t=[0 1 1 1]; x1=x(:,1);x2=x(:,2);x3=x(:,3);x4=x(:,4); t1=t(1);t2=t(2);t3=t(3);t4=t(4); w1=[0.5 0.5] b1=0.1 eta=1; e=1;eteration=0; while(e~=0) a1=hardlim(w1*x1+b1); e1=t1-a1; if e1~=0 w2=w1+eta*e1*x1'; b2=b1+e1; else w2=w1; ...
%% Script for debugging CLEAN close; dynamic_range = 12; % dB xmin = -.25; xmax = .25; ymin = -.25; ymax = .25; xmin = -1.5; xmax = 1.5; ymin = -2; ymax = .5; Pimp = P; Pimp(real(Pimp)<0) = 0; SPLint = 20*log10(sqrt(real(reshape(Pimp, N_X, N_Y).'))/2e-5); maxval = ceil(max(real(SPLint(:)))); minval = maxval - dynamic...
function test_hybrid_simulation % number of states Nq = 5; Nv = 5; q_idx = 1:Nq; v_idx = Nq+1:Nq+Nv; % initialize states and parameters q0 = zeros(Nq,1); q0(3) = pi/8; q0(2) = 2.5; v0 = zeros(Nv,1); x0 = [q0;v0]; p = example_parameters; p_array = param2array(p); ...
function [np] = ppmv2np(ppmv,d,scatteringVolume) %------------------------------------------------------------------------------- % Version 20180101, Silviu Rei % function [np] = ppmv2np(ppmv,d,scatteringVolume) % The function returns the number of partices in the scattering volume % based on volume concentration inp...
function dydt = pknmm(time,ini) C1 = ini(1); C2 = ini(2); C3 = ini(3); Ceff = ini(4); g = ini(5); weight = ini(6); height= ini(7); age = ini(8); % concentration variance equations if g==2 lbm = 1.1*(weight) - 128*(weight/height)^2; else lbm = 1.07*weight - 148*(weight/height)^2; end V1 =...
function saveSubjectInfo(trialinfo,const,subject) % save subject information nameOut=['data/' const.code '.mat']; if exist(nameOut,'file') name=dir(['data/' const.code '.mat']); nameOut2=['data/' const.code '_' date '.mat']; copyfile(nameOut,nameOut2); end save(nameOut,'const','trialinfo','subject');
%function ImageClassification folder_path1 = './cs558s18_hw4/ImClass/'; %get the histogram bins = 8; train_label = zeros(12,1); train_data = zeros(12,bins*3); test_label = zeros(12,1); test_data = zeros(12,bins*3); classes_filenames = {'coast', 'forest', 'insidecity'}; count = 1; k=11; %get the datasets f...
function [ commonDataInfo, aggregationInfo ] = firstguess_fillcomputesol(commonDataInfo,refInfo, aggregationInfo,periodIndex,aqiIndex) fName=strtrim(commonDataInfo.pathANN(periodIndex).ANNs(aqiIndex,:)); aggregationInfo.extraInfo=0; if (strcmp(fName,'-999') == 0) [alpha, omega, radius, flatWeight, pollutantList]=f...
function [CO_no_UT,UT_ind]=find_UT_ind(general_behavior_data_file_name,behav_params_file_name,CO_ind) load(general_behavior_data_file_name) load(behav_params_file_name) % U-turns are defined like CO that one of the bat changed his direction X % meters after CO %1. find ind that bats change directions (vel ...
clc; clear all close all; load('BAT_data.mat'); % %% Find the Charge, Discharge and Idle States % % Add a state of the battery % % i = -1 * i; % % SoC(:,2) = 0; %% add initially all state is zero % % for time_index = 1:length(t_vec)-1 % % if( i(time_index) > 0 ) % battery is discharging % So...
classdef Market < Estimate % MARKET Calculates market equilibrium % Based on ownership structure and conduct. properties firm p %prices c %Costs gamma = 0 % Scale effects demand % Demand class marketid % Protected? end prope...
function Ei400_uvw100_at110auto(varargin) data_source= fullfile(pwd,'Data','Fe_ei401.sqw'); avrg_par=[0,0,1139.482]; no_chkpnts= 'True'; Imax = 1; % fitting considered wrong if intensity deviates from average by this range if nargin == 0 repPoints1= [-0.3375,-0.175,0,0.175,0.375; 135,30,0,30,190]; ...
function write_alarms_ffb % function write_alarms_ffb % % This routine writes the corrector magnet and IDBPM safety trip points, which are used % by the fast feedback system. % % Christoph Steier, August 2002 % % 6-19-06 T.Scarvie, modified to work with new Middle Layer % % Eric's routines seem to work differently than...
% Copyright (c) 2017 Zi Wang function K = compute_gram(xx, hyp, hyp_idx, z) % This function computes the gram matrix for an add-GP. all_cat = unique(z); K = 0; for i = 1:length(all_cat) K = K + computeKmm(xx(:,z==all_cat(i)), hyp.l(hyp_idx, z==all_cat(i))', ... hyp.sigma(hyp_idx, all_cat(i)), hyp.sigma0(hyp...
% qhist1 Quick histogram calculation for 1D values % % This function quickly calculates histogram values for a uniformly spaced % grid. % weight=qhist1(value,bin); % NOTE: this function does generate histogram plots! To display the % results, use the plot or bar function. % plot(bin,weight); % bar(bin,weight,1);...
% Estimates the homography H such that H * x = b. Performs RANSAC iterations % times. Returns H along with the number of inliers and its total score (the % amount of error; lower is better). function [best_H, best_num_inliers, best_total_score] = estimate_homography(x, b, iterations) threshold = 5; best_num_inliers...
clear all; N=10; %number of neurons per population numCluster=5; % number of populations k_intraCluster=1; %connections strenght within cluster delay_intraClust=0.1; %connections delays within cluster k_interCluster=1; %connections strenght between cluster delay_interClust=0.3; %connections delays between cluster k...
% bayermask provides sampled bayer CFA data and bayer mask % % [bayer mask] = bayermask(data,pattern) % % %Output parameter: % bayer: bayer data. Zero is set for non-observed pixel. % mask: One is set for observed pixel and zero is set for non-observed pixel. % % %Input parameter: % data: rgb full color imag...
function loadlayerprofile(varargin) %************************************************* %DATE: 10/8/2007 (created); 10/8/2007 (modified) %FUNCTION: load layer profiles %INPUTS: NULL %OUTPUTS: NULL %muwn.gu@gmail.com %************************************************* global Layerprofile Layerprofile.color.sil...
function savecal(tag,varargin) % % savecal(tag,type,val,...) % Add calibration data to a correctly-named file in the % cal directory on the tag path. The data type is a % string selected from the following: % 'AUTHOR' - string containing the initials or name of creator % 'CAL' - structure of ca...
% function [mBestImage, mBestMembership, bestObjVal, bestMatApproxVal, idealEucObjVal, idealManhObjVal, runningTime, totalIterNum] = runBMAlgor(mAdj,... % sObj, sAlgor, posNum, convEpsilon, runNum, sDist, sPosAlgor, bDiscretiseMembership, bColNormalise, varargin) function [mBestImage, mBestMembership, bestObjVal, c...
% in the same units as the spectrum), % the forth row is the mask array. % % The spectra are binned log-linear. Units are 10^(-17) erg/cm^2/s/Ang % http://classic.sdss.org/dr7/products/spectra/read_spSpec.html % Notice that the wavelength vector is not contained in the image, % but must be generated from parameters in ...
function status = s88x_waitForCommandSent(timeout) %s88x_waitForCommandSent: waits for the last non-query command sent to be %completed. -Adam C. Snyder adam@adamcsnyder.com if nargin<1, timeout=10; end; [~,status] = s88x_dataStatus; cmdCompleted = bitget(status(1),2)==1; th=tic; while ~cmdCompleted&&toc(th)<tim...
function [commandc] = feat_HCLV_Photo_7T(outFile,funcVol,anatVol,EVs,WA) % Write a .fsf file for first-level feat for the HCLV_Photo_7T protocol % % Usage: % feat_HCLV_Photo_7T(outFile,funcVol,anatVol,EVs,WA) % % Inputs: % outFile = name of output .fsf file (fullpath) % funcVol = name of input functi...
function S = predict_list_linear_regression( test_data, beta_list, mode ) % test_data is in common format % beta_list is length B cell array. beta_list{i} is [d,1] % % S is [N,B] B = length(beta_list); N = length(test_data); S = zeros(N,B); for k = 1:B features = conseqopt_features(test_data,S(:,1:k-1),mode); for i...
clear clc source_file1 = 'C:\Temp\Oscop data\result_No.mat'; source_file2 = 'C:\Temp\Oscop data\result_ga.mat'; dest_dir = 'C:\Temp\Oscop data\'; load(source_file1,'No'); for i = 1:length(No) a=No{i,5}(1:120) end load(source_file1,'ga'); for i = 1:length(ga) b=No{i,5}(1:120) end
function [M,G] = perform_geodesic_interpolation(W,points,f,options) % perform_geodesic_interpolation - interpolate function values % % [M,G] = perform_geodesic_interpolation(W,points,f,options); % % f(:,i) is the value of the function at the point points(:,i). % % options.method can be 'powerlaw' or 'gaussian'. ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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#...
% SWAPMODEL returns a structure for a three-component model % with guesses and swaps. Based on Bays, Catalao, & Husain (2009) model. % This is an extension of the StandardMixtureModel that allows for % observers' misreporting incorrect items. % % In addition to data.errors, the data struct should include: % data.dist...
function [Hd,g] = filter1 %FILTER1_1 Returns a discrete-time filter object. % Author: ECE486 Spring 2015 Lab Group 2 % Author: Jacob Allenwood, Travis Russell, Jeremiah Simonsen % % This function generates a low-pass filter for the purpose of filtering % the samples input waveform for the FSK demodulator developed for ...
function [m, s] = henry (x, nb, k) % % For reference, look for: % - Q-Q plot (droite de henry in french) qqplot.m % - P-P plot ppplot.m % - normal probability plot % % For normality test, use skewness and kurtosis (both should be tiny) % - D'Agostino's K^2 test % - Jarque-Bera test % or by comparing dat...
% Stability analysis n=-5:1:5; x1=n; y1=n.*x1; subplot(4,1,1) stem(n,y1,'g--s'); title('1.4(f)-1'); xlabel('x_1[n]=n'); ylabel('y_1[n]=nx_1[n]'); % invertibility and time-invariant analysis x2=[zeros(1,5) 1 zeros(1,5)]; x3=3 .* x2 y2=n .* x2; y3=n .* x3; y4=(n+1) .* x2; subplot(4,1,2); stem(n,y2,'r--h'); title('1.4(...
function [sys,x0,str,ts] = scrqp(t,x,u,flag,T0,nr,nq,np) % FBFW feedforward feedback controller % Output of the controller is calculated follows: % % R(z^-1) Q(z^-1) % U(z^-1) = ---------- * W(z^-1) - --------- * Y(z^-1) % P(z^-1) P(z^-1) % % Ord...
function lik = q4_likelihood(mu, m, H) % Returns the likelihood for different values of mu, given the scalar parameters m and H. % % INPUT % mu: [1 x N] vector, containing N different values for mu % m: scalar % H: scalar % % OUTPUT % lik: [1 x N] vector containing the likelihood values associated with the entries ...
%%Pràctica 1 Fonaments de Comunicació 1 %% Apartat A w0=4*pi; T=2*pi/w0; u = inline('t>=0') t=-4*T:T/100:4*T; x1=3*u(t-0.5).*cos(4*pi*t+pi/3) ; plot(t,x1) axis([-4*T 4*T -5 5]); title('Señal 1a'); grid; xlabel('Tiempo (segundos)'); ylabel('x1(t)'); %% %Apartat b %% Apartat A w0=4*pi; T=2*pi/w0; u = inline('t>=0'...
% Gregor Barth (GRBH), Jan Draegert (JADT), Ercan Kücükkaraca (ERKA) #used octave packages: control, general, image, signal, sockets, specfun function aufgabe4() pkg load all; #variables clc; #set all variables here #(max_L) *(k_Lx k_Ly) * (x) (b_L) #(max_H) (k_Hx k_Hy) (y) (b_H) global k_Lx; globa...
function corrected = correctOdometry(nr) global odometry global last_correction_y last_correction_y = 0; global last_correction_x last_correction_x = 0; global corr_x global corr_y if nr <= 12 x = odometry(1)-corr_x; y = odometry(2)+corr_y; elseif nr <= 21 x = odometry(1) - corr_x; y = odometry(2) + co...
Pic=imread('IMG.jpg'); %%%% % a) grayscale a=rgb2gray(Pic); figure; subplot(3,2,1); imshow(a); title('a) Grayscale image'); %b) negative image b=imcomplement(Pic); subplot(3,2,2); imshow(b); title('b) Negative image'); %c) mirror image % http://www.mathworks.com/help/matlab/ref/flipdim.html?searchH...
% Split data into TRAINING SET and UNSEEN DATASET , permutation dataset and % classes %This script is for datasets with 18 features function [TRAININGSET, UNSEENDATA, UNSEENCLASSES, PERMUDATA, PERMCLASS] = firstsplit(data) classes = data(:,19); %choose the classes row actualdata = data(:, 1:18); % choose all data o...
function create_job_shell(outDir,job_name,matlab_string) % Writes out a shell script to run matlab code on the cluster. % % Usage: % create_job_shell(outDir,job_name,matlab_string) % % example: % outDir = '~/cluster_scripts'; % job_name = 'job_example'; % matlab_string = 'sort_nifti(''~/data/session_dir'')...
function C = generate_candidates (L) C = {}; k = 1; for i = 1 : length(L) - 1 for j = i + 1 : length(L) if L{i}(length(L{i})) ~= L{j}(length(L{j})) && length(setdiff(L{i}, L{j})) == 1 C{k} = union(L{i}, L{j}); k = k + 1; end end end return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %master.m (the first script that you would call when you start analysing %%USEFUL OUTPUT VARIABLES %%cell_rok is the structure containing all the relevant informatio...
function [eff,X, SR_new, SR_oud, rho_n, z] = efficient2(input) % Computes the Prior year efficient returns and Sharpe ratio improvements av12lag = zeros(1,length(input)); for i = 2:length(input) %if i < 13 if i > 12 % av12lag(i) = mean(input(1:i-1)); %else av12lag(i) = sum(input(i-12:...
%% Various criterion to consider: % 1. Repeatability of peak position % 2. Repeatability of peak rate % 3. Min peak firing rate % 4. Dymamic modulation range (max-min)/mean % 5. Spatial information (calculate) % 6. Range of peak llim = 00; hlim = 200; peakPosVarLim = 200; peakVarLim = 2; % peak > mean + peakVarLim*(std...
function plot_med_coal_blend_egrid(boot_cq_TE, subrgn) %% do the following % distribution of each plant % find the median, min, max, 25th %, and 75th % % sort by medians with plant info and the above percentiles % plot cdf % plot 25th and 75th distributions in the same manner, use triangle for % 25th, square for 75t...
function [c,ceq] = TYpowerConstraints_AS_GlobalOnly(x,currentConstraints,pulseTR,sinc_pulse) ceq = []; % c<=0 % ceq=0 % See https://uk.mathworks.com/help/optim/ug/nonlinear-constraints.html for % the form of g and geq % x is the vector of optimisation parameters (typically RF mag, RF phase, gradient??) % currentConstr...
function accuracy=evaluateMP(Test_adjusted,Testlabel,priorVector,meanMatrix,stdMatrix,lambdaMatrix) n=0; for i=1:length(Test_adjusted) labelpredict=labelMP(Test_adjusted(i,:),meanMatrix,stdMatrix,lambdaMatrix,priorVector); if labelpredict==Testlabel(i) n=n+1; end end accuracy=n/length(Test_adj...
function [breath_cycle] = nb_cycles_respiration(convoluted_signal, order, durationVideo) %Suite à la convolution du signal (using FFT & LowPass Filter) %%%%%%%%%%%%%%%%%%%%%%%Compteur du nombre de cycles respiratoires%%%%%%%%%%%%% dcon=diff(convoluted_signal); %dérivée du signal filtré (entré en paramètre) ch...