text
stringlengths
8
6.12M
%========================================================================= % % Program to estimate impulse responses for a VECM and a VAR % of money demand % %========================================================================= function coint_impulse( ) clear all clc % Load the data load ...
%%%%%%%% sobel算子提取边缘 %%%%%%%%%%%% function sobel(height,width,img_wider) A=zeros(width,height); B=zeros(width,height); C=zeros(width,height); D=zeros(width,height); % sobel算子求垂直方向边缘 for i=2:width+1 for j=2:height+1 A(i-1,j-1)=(-1)*img_wider(i-1,j-1)+img_wider(i+1,j-1)+(-2)*img_wider(i-1,j)+2*img_wider(i+1...
function [vector]= Cord( string ) %Cord: Translates traditional Battleship coordinates to matrix form. % % Input Arguments: % string = userInput from parent function (as a string) % % Output Arguments: % vector = matrix form of coordinates (as numericals) % Translates the letter (char) to corresponding num...
% % plotbumptraj.m % clear stdpatch vertx=[[0:dt:T-200]'; [T-200:-dt:0]']; vertx(:,2)=[sqrt(cmv)'; -sqrt(cmv(end:-1:1))';]; stdpatch.Vertices=vertx; stdpatch.Faces=[1:length(vertx)]; stdpatch.FaceColor=[250 128 114]/255; stdpatch.EdgeColor=[250 128 114]/255; figure(2), hold on, patch(stdpatch); for j=1:16, hold o...
global baseParameters iparam % baseParameters('L1')=1; % baseParameters('L2')=10; % baseParameters('L3')=1e-4; % baseParameters('L4')=0.03; % baseParameters('L5')=0.02; % baseParameters('L6')=10; % % baseParameters('r1')=3; % baseParameters('v1')=5; % baseParameters('r2')=2; % baseParameters('v2')=0.02; % baseParamet...
function [M,S,P] = initialize(k,X) %initializes the EM values indices=randperm(size(X,1)); M=X(indices(1:k),:); S=ones(k,1)*var(X)*0.1; P=ones(1,k); P=P/k; end
t=0:0.1:(200-0.1); nsamples = length(t); mov = zeros(100,100,nsamples); amp = .005; f =.1; sig = amp*cos(f*2*pi*t); s = reshape(sig,[1,1,nsamples]); SIG = repmat(s,[10,10,1]); mov(51:60,51:60,:)=SIG; sig2 = amp*cos(f*2*pi*t+.2*pi); SIG2=reshape(sig2,[1,1,nsamples]); SIG2=repmat(SIG2,[5,5,1]); sig3 = amp*cos(f*2*pi*...
clc; syms H(w) zeros = []; polos =[]; mag = input('mag: '); zeros = input('zeros: '); polos = input('polos: '); H(w)= mag; for n=1:length(zeros) H(w) = H(w) .* (1j*w + zeros(n)); end for n=1:length(polos) H(w) = H(w) ./(1j*w + polos(n)); end while 1 fprintf('%s\n', H(w)); w = input('w: '); fprin...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2 sample sizes % % - 2002-2018: TruestartYear and TotNbOfMonths % + ACWI.Fundam % + ACWI.TimeExt and Index.TimeExt % + FF.French % % - 2007-2018: startYear and NbOfMonths % + ACWI.Scores % + ACWI.Index and Index.Cedif % + ACWI.Chara...
function [trialList, levels, blocks] = nBackCreateTrialList_v1_2(lowestLevel, highestLevel,trialsPerBlock ,targetsPerBlock, numOfBlocks) %Creates stimuli list for n-back task. % Version 1.2 trialList = []; levels = []; blocks = []; for n = lowestLevel:highestLevel disp(horzcat('Crea...
Prompt = 'Enter the Augmented matrix in the form [1 2 3 ;4 2 1; 6 4 3] \n'; Ag=input(Prompt); [r,c]=size(Ag); A=Ag(:,[1:c-1]); B = Ag(:,c); L = tril(A, -1) D = diag(diag(A)) U = triu(A, 1) Xprev = input('Initial guess : in the form [1 1 1] \n'); Xnew = Xprev; count = 1; I=eye(r); while(1) fpr...
function [ G, J, H ] = G( x ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here G = [x(1) + x(2) - 3; x(1)^2 + x(2)^2 - 9]; J = [1,1;2*x(1),2*x(2)]; H = [0,0;2,2]; end
function output = my_imfilter(image, filter) %% % This function is intended to behave like the built in function imfilter() % See 'help imfilter' or 'help conv2'. While terms like "filtering" and % "convolution" might be used interchangeably, and they are indeed nearly % the same thing, there is a difference: % from 'h...
%Exercicio 8.4 %Diogo Knop e Xie Jiayu clear all; close all; clc; im = im2double(imread('IF69D_Atividade_08_arquivos/whitecells4.png')); th = graythresh(im); bw = imbinarize(im,th); % Display SE = strel('square', 3); imorf1 = imclose(bw,SE); % figure, subplot(1,2,1) % imshow(bw) % title('Imagem 1') % subplot(1,2,2) ...
% Machine Learning -- Assignment 1 % % This simple script should be run to test all components of the assigment. % Comment out any calls that aren't implemented when you are working on the % first parts clear; do_dist_test = 1; do_knn_reg = 1; do_knn_class = 1; do_prob_plots = 1; %%%%%%%%%%%%%%%%%%%%%%%%% % Test dis...
function [pts2] = epipolarCorrespondence(im1, im2, F, pts1) % epipolarCorrespondence: % Args: % im1: Image 1 % im2: Image 2 % F: Fundamental Matrix from im1 to im2 % pts1: coordinates of points in image 1 % Returns: % pts2: coordinates of points in image 2 [m,~] = si...
function suite = test_parseFloatAssertInputs initTestSuite; %=============================================================================== function test_tooFewInputs() assertExceptionThrown(@() xunit.utils.parseFloatAssertInputs(), ... 'MATLAB:nargchk:notEnoughInputs'); %================================...
function bp1 = bodeplotter2(G,glineopts,plineopts,col,fsta,fend) % プロットの設定 % fsta = 0; % 開始周波数の指数 10^fsta [Hz] % fend = 3; % 終了周波数の指数 10^fend [Hz] N = 1000; % プロット点数 % 独自ボードプロットの計算 f = logspace(fsta,fend,N); w = 2*pi*f; [mag pha] = bode(G, w); gain(1:length(w)) = mag(1,1,:); phas(1:length(w)) = p...
function draw_heater_over_temp_f(area, temp_inside) temp_outside = -30:temp_inside; temp_diff = temp_inside - temp_outside; ROOM_HEIGHT_M = 2.5; AIR_DENSITY = 1.293; % kg/m3 HEAT_CAPACITY = 0.28; % Wh/(kg*K) %calculating house_power_loss using optimal U found in lab 2 roof_U = ...
function [val ind] = SortSegmentationByBbox(segmentation, type) % sort instances within the segmentation map by area size % if nargin < 2 type = 'descend'; end if ~strcmp(type, 'ascend') && ~strcmp(type, 'descend') error('wrong type\n') end labels = unique(segmentation(:)); areas = zeros(1, numel(labels)); ...
%% Initialization addpath('C:\Users\Cmang\Desktop\Research\Central Planner','C:\Users\Cmang\Desktop\Research\Individual Roadmap Scripts',... 'C:\Users\Cmang\Desktop\Research\Local Controller'); load("PRM_V6.mat","G","H","valid_indices","Qi","Qf"); N = size(Qi,1); vehicle_dimensions = struct('length',3.2,'w...
function downloadGitHubRelease ( repository, varargin ) p = inputParser; % repository: The username/repository adress of the code on GitHub. addRequired ( p, 'repository', @check_repository); % version: this optional positional parameter defines the tag_name of the % version we want to download, or simply latest addO...
clear all ; close all ; cd C:\shared\freesurfer_segs\sub_russell\SUMA ; ls names = {'bot_right','bot_left','top_right','top_left','left_hemi','right_hemi','top_hemi','bot_hemi','full','fov','periph'}; elecbrain = load_untouch_nii('elecbrain_T1.nii.gz'); for title=1:length(names) avg = load_untouch_nii([...
function err = kendall(x) %KENDALL Kendall's correlation between the vector x and [1:length(x)] % % err = KENDALL(x) % returns Kendall's correlation between the vector x % and the vector [1:length(x)] if (size(x,1) > 1 && size(x,2) > 1) error('Error in ranking can be done only for vectors'); end ...
clear all clc parameter.trainmode = 1; parameter.dthr = .01; parameter.mofn =30; parameter.ecmepochs =2; parameter.mlpepochs =3; parameter.dispmode =1; load ('../../../dataset/seg.tra'); train = real(seg)'; train = [train(:,1:2) train(:,4:end)]; load ('../../../dataset/seg.tes'); test = real(seg)'; tes...
%@(#) test.m 1.1 05/07/13 10:29:42 % function test(dist1, dist2) a = readdist7(dist1, 'asyid'); %Läser in de angivna filerna i a och b. [b, mminj, konrod, bb, hy, mz] = readdist7(dist2, 'asyid'); c = mbucatch(a,b); %Läser in värden för respektive gammal och ny plats. d = mbucatch(b,a); l = 1; A = zeros...
close all clear setPlot line = {'k-o','r-o','b-o','m-o','g-o',... 'k--o','r--o','b--o','m--o','g--o'}; %% IEC Site definition Vref = 60; % Reference wind speed zref = 87.6; % Hub height above ground Uref = 12; % Wind speed at zref Iuref = 0.15; % Turbulence intensity zm...
% Author: LesPam function [lamn, w, k] = mPIinvShift1(A, q0, rho, tol) % Inverse Power Method with Shift error = 1; %k = 0; k = 0; A = A-(rho*eye(size(A))); while error>tol w = q0/norm(q0); q0 = A\w; lamn = dot(w,q0); error = norm(A\w - lamn*w)/norm(A\w); k =...
%%%%%%%%%%%%%%%%%%% data is splitted into x %%%%%%%%%%%%%%%%%%%%% xlen = length(x); xx=x; %% Filter implementation sig_mat = repmat(x,1,har_no) ; sig_rep = abs(fft(sig_mat)); if (IN==2)|(IN==4)|(IN==6) filt = D_sig60; band_low = 59 ; band_high = 61; sig_low =59.5; sig_high =60.5...
% This function is the primary driver for homework 3 part 1 function l3a close all; clear all; clc; % centroid for the three classes c1=[1 1]; c2=[3 1]; c3=[2 3]; sd=0.2; % number of data points per class N=100; rand('seed', 1); % generate data points for the three classes x1=randn(N,2)*sd+ones(N,1)*c1; x2=randn(N,...
function [ MMbyidimstats, Runstats, MMsummary,MM,uidim ] = testMMmethodOct31( testcaseid ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here if testcaseid == 1 load('test1.mat','sample','idim'); %NOTE: the above sample was generated from August15 code for %ExampleUpdated usin...
function Example1_16 %Example 1.16 Multicomponent gaseous diffusion with chemical reaction, p.44 Text. % Uses the function BVP4C to numerically solve the boundary-value problem. % BVPINIT is used to form an initial guess for the solution on % a mesh of ten equally spaced points. A guess for the unknown parameter % (t...
D = dir(['/Users/tamaregev/Dropbox/postdoc/Fedorenko/Prosody/Prosody-meaning/trial_lists/input_text_files']); D = D(~ismember({D.name}, {'.', '..','.DS_Store'})); % dir returns '.' and '..' (usually in first slot) Tl=cell(numel(D),1); Sent = nan(99,numel(D)); Cond = cell(99,numel(D)); Crit_Fill = cell(99,numel(D)); Mor...
clear all; close all; clc; load('filt_wav.mat'); im = imread('cameraman.tif'); im = double(im); hp = imfilter(im,a{2},'circular','conv'); hp = imfilter(hp,a{3}.','circular','conv'); imshow(real(hp),[]);
[~,~,~,~,gy,~,~,~,~] = import_tag_gyro2('tests/roll180.txt'); gr_reg = cumsum(gy ./ 12); gr_loop = (mod(gr_reg+180, 360) - 180); gr_unloop = unwrap_angles(gr_loop); eq = (abs(gr_reg - gr_unloop) > 0.0000001); disp('Mismatches:'); disp(sum(eq)); i = 1:size(gr_reg); hold on plot(i, [gr_reg, gr_loop, gr_unloop]); legen...
function [stateJacobian_x] = stateJac_x(dt) %STATEFCN Summary of this function goes here % Detailed explanation goes here % StateVec = [x y z u v w]; stateJacobian_x = [ 1 , 0 , 0 , dt , 0 , 0 0 , 1 , 0 , 0 , dt , 0 0 , 0 , 1 , 0 , 0 ,...
%Get all the files in the folder MatFiles=dir('*analysis_matlab.mat'); MatFiles_names={MatFiles.name}; %Design a regular expression that match your naming scheme (https://regexr.com/) fin = cellfun(@(x)regexp(x,'fish(\d+)_ENS(.*)_(\d)DPF','tokens'), MatFiles_names, 'UniformOutput', false); names=zeros(3,length(fin)); ...
%/************************************************************************* % * Replication file for Born/Pfeifer (2016): "The New Keynesian Wage % * Phillips Curve: Calvo vs. Rotemberg" % * % * Computes the Rotemberg wage adjustment cost parameter corresponding % * to a particular average wage duration % * % ********...
%% MIT KEMAR HRTF data import pos = 10; %angle in degrees rounded to nearest 5 degrees %load HRTF data if(pos<10) f=['H0e00',int2str(pos),'a.wav']; elseif(pos<100) f=['H0e0',int2str(pos),'a.wav']; else f=['H0e',int2str(pos),'a.wav']; end c = audioread(f); %you can leave it in f, or co...
% read the clasification images that cover the polygon area [img_669_259.z, R] = geotiffread('/Users/scholl/geo_uzh/data/KantonAargau/output/batch1/669000_259000.tif'); [img_669_259.x,img_669_259.y] = pixcenters(R,R.RasterSize(1),R.RasterSize(2)); [img_669_258.z, R] = geotiffread('/Users/scholl/geo_uzh/data/KantonAarg...
classdef ISO226 < handle %LoudnessContours Provide and manipulate loudness contour data properties contourSet f af Lu Tf Lp Ln currentSplLevel currentPhonLevel end methods (Static) function obj = ISO226() ...
function [META, REEF, RESULT, RECORD] = f_single_reef_for_calibration_bleaching(RESTORATION, warming_scenario, ... do_adaptation, do_rubble, sigma_cold, sigma_hot, esd, nb_time_steps, simul) %__________________________________________________________________________ % % TEMP script for running only one reef...
function [nodes, edges] = readGraph(fileName) %READGRAPH Read a graph from a text file. % % [NODES EDGES] = readGraph(FILENAME) % % Example % % create a basic graph, save it to a file, and read it again % nodes = [10 10;20 10;10 20;20 20;27 15]; % edges = [1 2;1 3;2 4;2 5;3 4;4 5]; % writeG...
% goes through experiment 10 and collects all the voided vols and voided % times % to see the results: %{ obj.data.plotData('raw'); obj.void_data.plotMarkers('raw','cpt'); obj.void_data.plotMarkers('raw','user'); %} obj = analysis.void_finder2; obj.data.loadExptOld(10); results = cell(8,...
TestsToRun = [2]; if any(1==TestsToRun) %% Compares input digits to output close all; itrCount = 6000; testDataSize = 20; netNum = 1; imageNum = 1; ran=[11:20]; % shuffled = randperm(size(Imgs_Test,3)); % Imgs_Test = Imgs_Test(:, :,shuffled); % disp(shuffled(1:10)); for...
directories = {'Fridge', 'Light', 'Microwave', 'Oven', 'Phone', 'Television', 'TurnOff', 'TurnOn'}; recordingDir = '/Users/Sam/Dropbox/Uni/EN2202/Recordings/'; [sample,fs,nbits] = wavread(strcat(recordingDir, directories{2}, '/', int2str(1), '.wav')); %words{word_i, sample_i} = sample; mfccs=getNormalisedFeatures(sam...
function probeFreq() global screen try Add2StimLogList(); % start the stimulus InitScreen(0) % Define the PD box pd = DefinePD(); totalFrames=0; halfPeriod = [2 1 .5 .25 .1]; repeatsN = 20; for i=1:length(halfPeriod) framesN = round(halfPeriod(i)/screen.ifi); ...
function coeff=new_coeff_d(coeff,net_size,coeff_bounds) a=floor((net_size(3))*rand)+1; b=floor((net_size(1)+net_size(2)+net_size(4))*rand)+1; coeff.dilations(a,b)=(coeff_bounds(4)-coeff_bounds(3))*((0.2-0)*randn)+coeff_bounds(3);
% Simple example of self-organizing maps x = simplecluster_dataset; net = selforgmap([5 5]); net = train(net,x); plotsompos(net);
m=int32(1920);%for testing only, just make sure for tests that dimensions of A match partition vector K=int32(13); density=single(100); [ A,b,partition,lambda ] = GenerateRandomGroupLassoDataSet( m,K,density ); %NOTE: maximum number of lambdas is 31, and best to keep the number of %lambdas less than smallest dimensio...
function [fitness x]=fitness_function(x, opts) %example fitness function to fit a neural network surface to % z= 0.5*sin(pi*y(1,:).^2).*sin(2*pi*y(2,:)); if nargin<2 N_neurons=5; else N_neurons=opts.N_neurons; end N_p=10;%number of points in each dimension y=[reshape(linspace(0,1,N_p)'*ones(1,N_p),1,[]);reshape((l...
function [ GPy, par ] = extractGPy( par, zipInf ) %extract parameters of GPy from a vector of parameter values as per zip %information currParIdx = 1; if zipInf.isSigmaF GPy.sigmaF = par(currParIdx, :); currParIdx = currParIdx + 1; end if zipInf.isSigmaL GPy.sigmaL = par( currParIdx : currParIdx + zipInf...
% reader of Neo spool files, 16 bit only (not 12-bit pack) function [data, tick64] = readNeoSpool(spoolfn,nx,ny,varargin) p = inputParser; addOptional(p,'nFrame',12) % for 2012-2013 Solis, was 11 ... addOptional(p,'AOIstride',8) %always 8? addOptional(p,'colfirst',true) %false for 2012-2013 Solis?, true for 2015 Solis...
function display_segmentation(B,M) % display_segmentation - display a level set segmentation % % display_segmentation(B,M); % % B should be <0 inside the region of interest % M is a background image % % See also: perform_active_contour % % Copyright (c) 2007 Gabriel Peyre if min(B(:))>=0 if max(B(:))...
%n = n; l = ell; fKOZ = fKOZ; fR2D = fR2D; ImplementationCosts = Cimpl; PerformanceValues = Performance; EnergyConsumption = Energy; %u = u; rix = componentPositions(:,1)'; riy = componentPositions(:,2)'; riz = componentPositions(:,3)'; %ai = ai; %bi = bi; % Adjazenzmatrix des networks, dann aber als Spaltenvektor eN ...
function packetChannelTest( SCOM, RCOM, RCOM2 ) % Perform basic testing with the wixels % Need to have sending on one wixel, and receiving on two global output1; global output2; output1 = []; output2 = []; % Open the serial connections s = serial(SCOM); r = seria...
function dX_dt = indirect_odes_tf(t,X,Chaser) % INDIRECT_ODES_TF Compute the state derivatives for the indirect % optimization method % % dX_dt = indirect_odes_tf(t, X, Chaser) % % Inputs: % % - t: propagation time, relative to mission start (t = 0) % - X: state vector, % X = [r, ...
function [c,a_match,b_match] = union_sorted(a,b) %UNION_SORTED Set union of sorted sets. % UNION_SORTED(A,B) where A and B are vectors returns the combined values % from A and B with no repetitions. A (and B) must be sorted and unique, and % the result will be sorted and unique. % % [C,A_MATCH,B_MATCH] = UNION...
function [FitnessMatrix,popsizenow] = fitness(Crowdness,preferenceMatrix,Population) popsizenow=length(Population)/Crowdness; for j=1:popsizenow individual=Population(((j-1)*Crowdness+1):(j*Crowdness)); p=zeros(Crowdness,4); % p is physical appearance of the individual for i=1:Crowdnes...
function SlideCut(FilePath,N,SaveFile); Set.filename = FilePath; fd = PetscOpenFile(Set.filename); Set.S = PetscBinaryRead(fd,'complex',true,'indices','int64','precision','float32'); %-vecload_block_size 1 close(fd); n = round( length(Set.S)^(1/3) ); Set.S = reshape(Set.S, [n,n,n]); x = zeros(N,1); step = 1/N; for j...
function [z dzm dzi] = p2z(rho,dpi,dpm,g,nz); % p to z for CESM outputs for iz = 1:nz % if (iz > 1) dzm(iz) = dpm(iz)/(rho(iz)*g); % dpm = rho * g * dzm from surface to mid-point and so on to the next mid-point, % add surface geopotential height phis/g, ma...
% characterizeProbe Characterize probe delay % % This method characterizes the delay for a PDV probe digitizer. Two % pieces of information are needed for this calculation: % -Transit time for the probe [measurement], including the optical % switch. % -Transit time for the optical switch only [reference]. % Thes...
% X: data matrix, each row is one observation, each column is one feature % d: reduced dimension % type: type of kernel, can be 'simple', 'poly', or 'gaussian' % para (input): parameter for computing the 'poly' kernel, for 'simple' % and 'gaussian' it will be ignored % Y: dimensionanlity-reduced da...
%% Reads in two flat files and generates the boxplot comparing % simulation data against the GMPEs. Mostly unmodified version % of the script from Ronnie Kamai ymin = 0.0003; ymax = 20000*ymin; % Name = ['-gmpe' num2str(Mag*10) num2str(Dist) ]; Sims = csvread(SimsFile); GMPEnum = csvread(GMPEFile); GMPELabe...
function str = insertCommas(num) str = num2str(num); FIN = length(str); for i = FIN-2:-3:2 str(i+1:end+1) = str(i:end); str(i) = ','; end
function zslice %% Prepare parameters lambda= .532; % wavelength [Ám] N = 1024; % Resolution type = 'axicon' img = []; for z=0:1:50 %% Prepare transfer function freqx=-10:20/N:10-1/N; % setup frequency axis [1/Ám] [freqx,freqy] = meshgrid(freqx,freqx); H = exp(1i*2*pi*(z/lambda)*sqrt(1-(lam...
function theta = q6_train(X, Y, xtest, tau) % Trains the locally weighted linear regression (LWLR) model using the % closed form solution given the training data X, Y, the test % input vector xtest and the parameter tau. % % INPUT: % X : [m x d] matrix, where each row is a d-dimensional input example % Y : ...
warning off all; clc; clear all; close all; FigWin = figure('Position',[50 50 650 500],'Name','EatIT-Calorie Prediction Application',... 'NumberTitle','off','Color',[ 0.82 0.81 0.77 ]); AxesHandle = axes('Position',[0.25 0.15 0.65 0.75], 'Box','on'); imageLoad='INPUT IMAGE'; h=uicontrol(F...
% Карасёв Марк Иванович % ТП1 Статистика % Слава СССР ! % 7.1 disp("7.1 :\n"); function [moy, ect, med, q1, q3] = statdesc(x) moy = 0; ect = 0; med = 0; q1 = 0; q3 = 0; if(nargin != 1) usage ("statdesc (vector)"); endif if(isvector(x)) n = length(x); moy = sum(x)/n; ...
function niceplot(h) % function niceplot(h) % This function takes a subplot handle and cleans up the plot % % Matthew A. Smith %set(h,'Color','none'); set(h,'Box','off'); set(h,'TickLength',[0.02 0.0]); set(h,'TickDir','out'); %set(h,'yticklabel',[]); %%%%%%%%%%%%%%%%%%%%%% % From Najib: %figure %set(gcf,'paperorie...
fr = 60e3 ; % butter design fd = 75e3 ; f1 = 90e3 ; f2 = 1*fd ; f3 = 1*fd ; q1 = 1.3 ; w1 = 2*pi*f1/fr ; w2 = 2*pi*f2/fr ; w3 = 2*pi*f3/fr ; b1 = [1 w1/q1 w1^2] ; b2 = [1 w2] ; b3 = [1 w3] ; b = w1^2*w2*w3 ; a = conv(conv(b1,b2),b3) ; w = 2*pi*logspace(-0.5,0.7,1000)' ; f = w/2/pi ; h = freqs(b,a,w) ; figure(1),clf...
% % img_undistorted = undistortImage(img,K,D,1); % img_undistorted = undistortImageVectorized(img,K,D); fig1 = figure(1); for img_idx = 1:7465 % if isfile(filename) filename = ['../data/images_grey_undistorted_cropped/',sprintf('IMG_%04d.jpg',img_idx)]; img = imread(filename); imshow(img) % ...
function calibration_pkey=add_calibration_to_t_calibration(ac_db_filename,varargin) p = inputParser; addRequired(p,'ac_db_filename',@(x) ischar(x)||isa(x,'database.jdbc.connection')); addParameter(p,'calibration_date',now,@isnumeric); addParameter(p,'calibration_acquisition_method_type','Standard sphere, in-situ',@...
close all; clear all; clc; Caps=[12 20 45 48 55 100 130 145 200 325 350 375 400 425 450 500 800 850 1000 2200]; NumData=10; B=[]; for i=1:NumData DataName='States'; DataName=strcat(DataName, num2str(i)); load(DataName); A=States; Concat=[B; A]; B=Concat; clear States; end States=B; MaxTrR...
function [directions, thresholds, leaf_probabilities] = train_tree( X, Y, max_depth, tree_type) % Dimensions: % N - number of data points % D - dimension of data points % L - number of labels % Input: % X - training data [NxD] % Y - training labels [N] % max_depth - highest allowed tree depth % (in the im...
function J = determine_greedy_indices(Phi_residual,Phi_stiffness,ni,K_stiffness) %% Following Algorithm 5 from Fahrat 2010 N = size(Phi_residual,1); n_R = size(Phi_residual,2); n_K = size(Phi_stiffness,2); J = []; K_set = []; n_bar = 0; m = 1; R_vec = Phi_residual(:, 1); K_vec = Phi_stiffness(:,1); w...
function out = rv( in ) % rv 3D rotation vector <--> 3x3 coordinate rotation matrix % E=rv(v) and v=rv(E) convert between a rotation vector v, whose magnitude % and direction describe the angle and axis of rotation of a coordinate % frame B relative to frame A, and the 3x3 coordinate rotation matrix E % that transfo...
function [x,count,e,flag] = LSRefinement(A,x0,b,error, maxiter) %LSRefinement refine a LS with x0 been the first approximation r = b - MatrixMulti(A,x0); c = LUSolver(A,r); x = x0 + c; e = Linfty(x,x0); count = 0; while (e > error) && (count < maxiter) x0 = x; r = b - MatrixMulti(A,x0); c = LUSolver(A,r);...
clear all %% input load('energy.mat'); %date time year-month-day hour:minute:second % Appliances, energy use in Wh % lights, energy use of light fixtures in the house in Wh % T1, Temperature in kitchen area, in Celsius % RH_1, Humidity in kitchen area, in % % T2, Temperature in living room area, in Celsius % RH_2...
function [train, test] = loadDataset(dataset) % dataset.{name, trainPerClass_num, normalization} % %% get data.mat's folder filename_dataset = [dataset.name '.mat']; address_dataset = fullfile('Mat', filename_dataset); if ~isfield(dataset, 'random') dataset.random = 1; end if ~isfi...
% change the file from gisaid, such that there are no unneeded linebreaks clear f = fopen('gisaid/gisaid_full.fasta'); g = fopen('gisaid/gisaid_cleaned.fasta', 'w'); % print the first line line = regexprep(fgets(f), '\n',''); fprintf(g, '%s', line); while ~feof(f) line = regexprep(fgets(f), '\n',''); if strcmp(...
function EliminateSensor( tComputer ) % iDevicesIDs % % iDevicesIDs iDeviceID = input( 'Enter the ID of the sensor to be eliminated\n' ); % iDevicesIDs % % iDevicesIDs % find the row % iDevicesIDs aiListOfDevicesIDs = tComputer.tDatabase{1}; % iDevicesIDs % % iDevicesIDs iRowIndex = find( aiListOfD...
function grid = runGrid(grid) % runGrid - run the grid for a single particle chosen at random. % This function runs each particle in the grid once, and manages % all the meta-level operations of dissolving the concentrations % and outputting any signals from particles affixed to the output pad. % inputs: % grid - t...
function randbattle % This function is a strategy to play battleships. The strategy is purely % relies on randomly shooting in a 10 X 10 grid until all ships have been sunked. % The strategy uses none of the information or feedback from any shots % fired. The only logic is that it remembers where it has previously fi...
function f_exportR(x,x_row,x_col,fname) % - export data for import into R % % USAGE: f_exportR(x,x_row,x_col,'fname'); % % -----Input:----- % x = matrix of numerical values % x_row = cell array of row labels % x_col = cell array of column labels % fname = output filename % % -----R commands for import/export:----- ...
%clear all %close all num = 1500; load('../output.dat') A = reshape(output, [49 49]); A = A'; N = 50; % Number of grid in x,y-direction L = 4*pi; % Domain size % Grid point x = linspace(0,L,N); y = linspace(0,L,N); % Make it staggered. x = (x(1:end-1)+x(2:end))/2; y = (y(1:end-1)+y(2:end))/2; [X,Y] = meshgrid(x,y); fig...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% IQM Tools - PopPK Example % % SCRIPT_01_popPK % --------------- % The purpose of this script is to go through a complete popPK analysis. % % The data that is used in this popPK example has been simulated from an % underlying popPK mo...
function [ v, w ] = ik_controller( x_c, y_c, theta_c, x_g, y_g ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here %Input = current pose -x_c,y_c,theta_c (in degrees) %output position = x_g, y_g %Output = List of v and omega (in rad/s) that will achieve this at a sampling rate of %dt =0...
% Filename : rectwg_gather.m % Author : Lnyan % Email : i@llonely.com % ============================================================================= % Description : % 所有模式的场量叠加 function [ex,ey,ez,hx,hy,hz,jx,jy,jz]=rectwg_gather(mode_list,x,y,z,t,f,a,b,A,epsilon_r,mu_r) m=mode_list{1}(1); n=mode_list{1...
function [tr] = linkFlowLDOF(data, options) p = data.height; q = data.width; nf = data.nframe; sample_step=options.sample_step; margin=options.margin; [ys,xs]=ndgrid(margin:sample_step:p-margin,margin:sample_step:q-margin); ys=ys(:); xs=xs(:); sinds=sub2ind([p,q],ys,xs);%将坐标(ys,xs)在原【p,q】大小矩阵中,转化成下标大小。得到是:采样的坐标 X=ze...
% qm001.m clear close all clc global E k tic % INPUTS ============================================================== % Energy of particles [eV]; E = 200; % X axis [nm] xMin = 0; xMax = 5; % Grid points N = 500; % CONSTANTS =========================================================== e = 1.6021766...
T = 8; %in functie de rezolutia temporala, se vor introduce vectori diferiti T1_temaPCT5_Coman_Ionut_Ovidius_Cristian(0:0.002:T,1) % 2ms = 0.002s T1_temaPCT5_Coman_Ionut_Ovidius_Cristian(0:0.02:T,2) % 20ms = 0.02s T1_temaPCT5_Coman_Ionut_Ovidius_Cristian(0:0.2:T,3) % 200ms = 0.2s
function dMdx = MnUBmsob2(x,M,p) % p is a structure with the parameters dMdx=zeros(size(M)); % Set the first derivatives I = 1:p.n; dMdx(I)=M(p.n+I); Msum = sum(M(I)); dMdx(p.n+1) = p.K1 * M(1)/(p.K2+Msum) - 2 * p.K6 * sum(M(2:p.n)); J = (2:p.n-1)'; dMdx(p.n+J) = p.K...
function [sleepLat latDef] = calcSleepLat(stages) % Stephanie Greer and Jared Saletin % Walker Lab, UC Berekeley 11/22/2010 % % Calculates sleep latencey as the first epoch of the first 90 secs of % continuous sleep. % sleep = find((stages > 0) & (stages < 6)); foundOnset = 0; sleepLat = sleep(1); count = 1; epCount =...
%% =======================================================================% % benchmarking Poisson solver % ========================================================================% clc NX = [64 128 256 288 320]; % 384 is too big and uses 64GB + swap for n = 1:numel(NX) MESH.NX = [NX(n), NX(n), NX(n)]; ...
addpath('../general_functions') load('../data/fig5_1a.mat') %% figure 5_1a x=1:N; y=u; legend_entries={"$\lambda = 1 - 10^{-2}$", "$\lambda = 1 - 10^{-6}$", "$\lambda = 1 - 10^{-10}$", "$\lambda = 1 - 10^{-14}$"}; legend_loc='northeast'; xLab='$k$'; yLab='$u_k$'; xLim=[0, 80]; yLim=[0, 1]; filename="../figures/fig5_1...
%MIT License %Copyright (c) 2018 Anaël Leinert %Permission is hereby granted, free of charge, to any person obtaining a copy %of this software and associated documentation files (the "Software"), to deal %in the Software without restriction, including without limitation the rights %to use, copy, modify, merge, publis...
%% AG. Mitchell - 23.01.19 %% Analysis for landmarks 2AFC task % Takes the data from the landmarks 2AFC task and calculates percentage of % 'top line longer' responses for each left/right shift. % Calculates psychometric curve (cumulative normal) based on this data %% Load data %% Edited demo to fit bias study data (L...
% CE3 - Вычислительный эксперимент ╧3 % Попытка ╧3 % Определение оптимального регулирующего воздействия по критерию % минимума СКО при заданных спектрах уставки, помехи и известном % объекте. %echo on %clc % Исходные данные задачи % Рассчитаем полиномы в числителе и знаменателе операторныx функций % y-уставка Ny = 3...
function [f_, stats] = getF_(f, mode, winSize) % f_ = getF_(f, mode) % default mode is linear, w/ robust fit estimation if ~exist('mode','var') || isempty(mode) mode = 'custom_wfun'; end if ~exist('winSize','var') || isempty(winSize) winSize = 27*2*60; % Assuming a framerate of 27 Hz; end switch mode cas...