text
stringlengths
8
6.12M
%% film normal % localisation dossiers et fichiers fileFolder = "D:\Documents Importants\Professionnel\Stage 2A\daphnies\2021-07-02 cycles\2021-07-02_daphnies1_40-30_u3.4_i0.44_10fps_1\cycle 3"; dirOutput = dir(fullfile(fileFolder,'traitee *.jpg')); fileNames = {dirOutput.name}'; numFrames = numel(fileNames); ...
function sgmga_vcn_ordered_test ( dim_num, importance, level_weight, q_min, ... q_max ) %*****************************************************************************80 % %% SGMGA_VCN_ORDERED_TEST tests SGMGA_VCN_ORDERED. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % %...
function [sol,val] = tsp(sol,options) global pointMatrix; global WalkSpeed; global distMatrix sol; numvars=size(sol,2)-1; score =0; distance =0; time =0; penalty = 0; speed =0; toggleStart =0; for n=1:numvars if sol(n)==1 toggleStart =1; end if toggleStart ==0 && n==1 distance = dis...
function [ psnr_spl_adapt, rate_spl_adapt, avg_coff] = SPL_adapt( filename, current_image, num_levels, block_size, algorithm ) %SPL 此处显示有关此函数的摘要 % 此处显示详细说明 [num_rows, num_cols] = size(current_image); x = current_image; % projection_matrix_file = ['projections.' num2str(block_size) '.mat']; type = 'dpcm'; filename...
function centroids = Centroids_Intialize(X, K) %Centroids_Initialize This function initializes K centroids that are to be used in K-Means on the dataset X % Initialize the centroids to be random examples %Randomly reorder the indicies of examples rng shuffle; randidx = randperm(size(X,1)); % Take the first K examples...
function al_lineAndBack(taskParam) %AL_LINEANDBACK This function draws the background for intructions in the cannon task % % Input % taskParam: structure containing task parameters % % Output % ~ if ~isequal(taskParam.gParam.taskType, 'chinese') if isequal(taskParam.colors.background, 'black') ...
function [ES,ED] = computeReliabTime( nBins, binEdges, windowLen, windowType, SpikeTimesCell, P) %% for b = 1 : nBins switch windowType case 'Sliding' bin1 = binEdges(b); bin2 = binEdges(b)+windowLen; case 'Fixed' bin1 = timeBins(b); ...
function [mindistance, polypid] = Matching(x,y,z,FeatureVector) mindistance = 10000; polypid = 10000; for i=1:size(FeatureVector,1) cmp_dist = (FeatureVector(i,2) - x)^2 + (FeatureVector(i,3) - y)^2 + (FeatureVector(i,4) - z)^2; if(mindistance > cmp_dist) mindistance = cmp_dist; ...
clc,clear %% add all of the funciton in this folder include sub-folders addpath(genpath(pwd)); % addpath(genpath('c:/matlab/myfiles')); % add the functions in the folder with certain path %% the initial setting figure figure_all_plot=2; mesh_mode=0; % the normal mesh size unit plot_switch=0; % plot or not ...
classdef LieMapping < handle & matlab.mixin.Copyable & matlab.mixin.Heterogeneous %This is EKF implemented with the very basic equations properties %Lie Group Representation x_lg; dim = []; dim_state = []; end properties(SetAccess = protected) generators ...
% Universidade do Estado do Rio de Janeiro -UERJ % Calculo Numerico % Aula 2 - Noções de Programação para Computação Científica % Prof. Americo Cunha % Prof. Augusto Barbosa % Prof. Luiz Mariano Carvalho % Profa. Nancy Baygorrea % Operações lógicas e relacionais clc clear % números guardados em variáveis a = 5 b...
%% Output data from controllers fidData = fopen('output.txt'); tData = textscan(fidData, '%f%f%f%f', 'Delimiter', ';', 'headerlines', 1); fclose(fidData); fidData = fopen('err.txt'); eData = textscan(fidData, '%f%f%f%f', 'Delimiter', ';', 'headerlines', 1); fclose(fidData); fidData = fopen('ctrl.txt'); cData = textsc...
[y,Fs]= audioread('X:\My Documents\GitHub\Pattern-Recognition-coursework\Lab 4\corrupted_voice.wav'); y1 = fft(y); info =audioinfo('X:\My Documents\GitHub\Pattern-Recognition-coursework\Lab 4\corrupted_voice.wav') T = 1/Fs; % Sampling period t = (0:length(y)-1)*T; % Time vector P2 = abs(y1/l...
%for monto carlo function y=is_mc(cell_new,cell_old) %for initial energy sz=size(cell_new); cell_new=[zeros(1,sz(2)+2);[zeros(sz(1),1),cell_new,zeros(sz(1),1)];zeros(1,sz(2)+2)]; cell_old=[zeros(1,sz(2)+2);[zeros(sz(1),1),cell_old,zeros(sz(1),1)];zeros(1,sz(2)+2)]; e_new=0; e_old=0; kT=1; tao_s=1; for i =2:(s...
function [keypts] = getKeypoints_EdgeFoci(img_info, p) edgefoci_name = [img_info.full_feature_prefix '_EdgeFoci_keypoints.mat']; if ~exist(edgefoci_name, 'file') if ~ispc warning('EdgeFoci is TURNED OFF on LINUX and MAC (binary not provided by the authors)'); keypts = []; ...
function x=constrain(x,C) %CONSTRAIN Constrains a reconstruction solution according to C % X=CONSTRAIN(X,C) % * X is the reconstruction before applying the constrains % * C is the structure of constrains % ** X is the reconstruction solution after applying the constrains % if isempty(C);return;end if isfie...
function varargout = dislocateGUI(varargin) % DISLOCATEGUI MATLAB code for dislocateGUI.fig % DISLOCATEGUI, by itself, creates a new DISLOCATEGUI or raises the existing % singleton*. % % H = DISLOCATEGUI returns the handle to a new DISLOCATEGUI or the handle to % the existing singleton*. % % DI...
function [ P ] = image2Pixel( P ) % Tao Du % taodu@stanford.edu % Feb 13, 2015 % % Given pixels in the image space, clamp into pixel space. See README for % more explanation about these coordinates. Assume i and j are integeres. % then all the points lie in [i, i + 1) x [j, j + 1) are covered in the % pixel (j + 1, i +...
function [n a]=fdivisao (n,a,x,M) %Aplica Briot Ruffini M vezes for k=1:M %nucleo do Briot Ruffini b(1)=a(1); for i=2:n+1 b(i)=a(i)+x*b(i-1); end %redefinindo o polinomio quociente n=n-1; a=b; %nucleo do Briot Ruffini end aux=a(1:n+1);a=aux; %limpa a memoria dos coef...
%% Read MODIS EOS-HDF file and extract data import matlab.io.hdfeos.* % Information to modify site_lon = -72.1715; site_lat = 42.5378; filedir = '/Volumes/XiYangResearch/Data/2.SatelliteData/2.MODIS/MCD15A2/'; filename = dir('/Volumes/XiYangResearch/Data/2.SatelliteData/2.MODIS/MCD15A2/*.hdf'); gridname = 'MOD_Gri...
% TODO: You write this function! % input: f -> an 9-joint robot encoded as a SerialLink class % qInit -> 1x9 vector denoting current joint configuration % posGoal -> 3x1 vector denoting the target position to move to % output: q -> 1x9 vector of joint angles that cause the end % effect...
function [distance] = DLC_distancefrom(DLC_data, fixed) %DLC_distancefrom() calculated the distance from a fixed point of each body %part in a DLC frame % DLC_data = data in DLC format i.e. numeric matrix with no headers, % first column is frame number, % then groups of 3 columns for each tracked part (x,y,confiden...
% Author: Eseoghene Okonofua <EseO@Eseoghenes-MacBook-Pro.local> % Created: 2017-09-20 % Intersect-N-Lines % Input: % ( % [line1point1x, line1point1y, line1point1z], [line1point2x, line1point2y, line1point2z], % [line2point1x, line2point1y, line2point1z], [line2point2x, line2point2y, line2point2z], % [...
% Adjiman's Function % Range of initial points: -5 <= xj <= 5 , j=1,2 % Some references: -1 <= x1 <= 2 , -1 <= x2 <= 1 "different global minima" % Global minima: (x1,x2)=(5,0) % f(x1,x2)=-5 % Coded by: Ali R. Alroomi | Last Update: 11 May 2015 | www.al-roomi.org function fitness = Adjiman(ucode) fitness = ze...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % python script: call numerical_sde_cpp.py (simulate trace + plot result) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Parameters: % % dt -- time step size, e.g. 1e-5 % t_interval ...
% Granger Causality in frequency domain. only a prototype function [gcy2x, gcx2y, fx2y, fy2x, Sxx, Syy, Hw] = nGrangerFA2(A, noisecov, fftlen) if (exist('fftlen', 'var')==0) fftlen = 1024; end P = [1 0; -noisecov(1,2)/noisecov(1,1) 1]; Q = [1 -noisecov(1,2)/noisecov(2,2); 0 1]; [p, m] = size(A); m = round(m/p); ...
%Program for neural network of OR Gate clc; clear all; disp('1.OR'); disp('2.AND'); disp('3.NOR'); disp('4.NAND'); choice = input('Enter Choice - '); sprintf('\n'); switch choice case 1 input=[0 0; 0 1;1 0; 1 1]; expected_output=[0 1 1 1]; case 2 input=[0 0; 0 1;1 0; 1 1]; ...
function tcourse = xtractlist(hdr, data, list) % % function tcourse = xtractlist(hdr, data, list) % % UNTESTED % % extracts a single time series from a list of voxels % time series of images % % hdr - header structure of one of the images in the time series. % data - a 2D matrix where each row is an image and each ...
function XX = theory_qualitativeRT_type1_v1(A1, A6, sigma1, sigma6, rho, changeFlag) % horizon 1 parameters cMu_R_1 = sqrt( 1 / (2 *sqrt(2)*sigma1 * rho) ); cBeta_0_1 = rho * cMu_R_1; cMu_I_1 = A1 / (2 * sqrt(2) * sigma1 * cBeta_0_1); % horizon 6 parameters switch changeFlag case 1 % cMu_R changes ...
% Création d'un grid sag adapté à l'exportation dans zemax. %Création d'une deuxième surface pour corriger la première clear %Configuration des paramètres run config.m s_max = hfov.*(1-z/f); %Création de la fonction de grandissement G = fun_creation(type_dist,r1,r2,g1,g2); %Calcul du profil de distortion recherché [...
dolphin = imread('dolphin.png'); bicycle = imread('bicycle.png'); |% Absolute difference abs_diff = abs(bicycle - dolphin); imshow(abs_diff); % Better: Use image package pkg load image; imabsdiff(dolphin, bicycle); % order doesn't matter
function [Names IsMorph IsIntensity IsTexture IsGradient IsCyto IsHema IsEosin IsGray] = FeatureNames(Augmented) if(~Augmented) Names = {'AREA',... 'PERIMETER',... 'ECCENTRICITY',... 'CIRCULARITY',... 'MAJOR_AXIS',... 'MINOR_AXIS',... 'EXTENT_RATIO',... 'MEAN_INTENSITY',... %8 ...
% vesselSim NP Blockley's simple vessel simulator. Usage: % % [storedPhase, p] = vesselSim(p) % % This is the workhorse of the simple vessel simulator, and should be called by % Run_Simulation.m % % Created by NP Blockley, March 2016 % % % Copyright (C) University of Oxford, 2016-2019 % % % CHANGELOG: % % ...
% ~~~~ prior distribution ~~~~ % function logpriorprob = prior(chi) % chi = (gamma,pi,r,xip,phipi,phiy,rhoR,rhoz,rhob,... % sigMP,sigz,sigtheta,sigb) is the parameter vector % nu is a constant gamma = chi(1); pi = chi(2); r = chi(3); xi = chi(4); phipi = chi(5); phiy = chi(6); rhoR = chi(7); rhoz = chi(8); rhob ...
%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Vortex: basic statistics %%%%%%%%%%%%%%%%%%%%%%%%%%% % Generates the data for plots of 1B and 1C and writes a datafile to produce % the plots in R. %% LOAD DATA clc clear close all % More variables Vortex_load; Vortex_variables; % create some variables %% Logicals do.plotting ...
function display_figures(fig) addpath("export_fig") filename = "samples2/C3TextNovoSimple50cmPt1.wav"; [y, Fs] = audioread(filename); fontsize = 12; fontaxissize = 10; if(fig == 1) %For C3Blank50cmPt1.wav left = 0.15; bottom1 = 0.5; bottom2 = 0.01; width = 0.8; height = 0.45; figur...
function [f, c, bornes, Mi] = ariane1(m) %%%--- Cas test 2 : Ariane 1 ---%%% % indice constructif par étage k = [0.1101; 0.1532; 0.2154]; % vitesse d'éjection par étage ve = [2647.2; 2922.4; 4344.3]; % masse sèche ms = k.*m; % masse du satelite mu = 1700; % vites...
function ce30_Config(obj) % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % @Func ce30_Config; % @Brief 初始化ce30的通信配置; % @Param 属性,IN_BUFF_SIZE:输入缓存大小,IN_BUFF_SIZE:一个数据包大小,SAMPLE_PERIOD:采样周期 % @Retval NONE % @Date 2019/11/21; % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %% 函数主体 ...
% State-of-the-art and Comparative Review on Adaptive % Sampling Methods for Ordinary Kriging clear all; close all; %% Essential imports addpath(genpath('src')) warning('off', 'all') global plotFlag %% Start input prompt [ methodID, benchmarkId, numberSamples, numberRepetitions, Vis ]= run_input_prompts(); if strcmp(...
load('perturbations.mat'); N = 10; [x y z]=ndgrid(-N:N); data=(x.^2+(1.5*y).^2+z.^2)<N^2; %ellipsoid data = double(data); %data = smooth3(data,'box'); L2_data = norm(data(:)); maxL = maximum_l(N); [ALM, C, N, r_cut, jball, jjorigin,Y, dems_Y, dels_Y, r_select_ratio] = spherical_harm_coeff(data, maxL); [ALM_eig...
function binary=en_coef2D_double_deadzone(coef,delta) N=int16(size(coef)); H0=bitshift(N(1),-3); W0=bitshift(N(2),-3); Nsub=bitshift(int32(numel(coef)),-2); binary=SFcode(H0,1536); binary=[binary SFcode(W0,1536)]; binary=en_coef2D_double_deadzone_sub(coef,delta,H0,W0,binary);
function out = fload(fname) % FLOAD -- Load in and assign to variable. % % out = ... fload( 'file1.mat' ); loads the contents of 'file1.mat' and % assigns to the variable `out`. 'file1.mat' cannot contain multiple % variables. % % IN: % - `fname` (char) -- .mat file to load. % OUT: % ...
function y=approx_sum(x) y=x; while abs(y^2 - x)> 0.001*x y = (x/y + y)/2 end
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 ...
descriptor_matrix = []; image_index = []; index=1; for prefix = 0:53 if prefix == 7 || prefix == 25 || prefix == 44 || prefix == 45 continue end for suffix = 1:4 image_name = [num2str(prefix),'_',num2str(suffix),'.png']; [image, descriptors,locs] = sift(image_name); descripto...
function [GNCout] = ChooseNA(GNCin) % Choose number of sensors global NAMAX j = 1; for i = 1:length(GNCin) for na = 1:NAMAX GNCout(j) = GNCin(i); GNCout(j).NA = na; j = j + 1; end end return;
function UpdateEdgeCost(updated_region) global s_goal; global neighbour; global c; global g; global rhs; global xmax; global ymax; for i=1:size(updated_region,1)%检测周边点情况 s_updated=updated_region(i,:); %未越界 if s_updated(1)<1||s_updated(1)>xmax||s_updated(2)<1||s_updated(2)>ymax co...
function list = greedy_graphcut_function(similarity_mat, K, lambda1, lambda2) N = size(similarity_mat, 1); remain_list = 1:N; list = []; for idx = 1:K max_value = -inf; for jdx = 1:length(remain_list) new_list = [list, remain_list(jdx)]; if length(new_list) == 1 value = lambda1 ...
function [output] = GcodeToMatrix(gcode_file) %Fucntion reads gcode file, outputs all toolpath data to a matrix. FID = fopen(strcat(gcode_file,'.gcode')); line = fgetl(FID); k=1; output(k,:)= readGCode2(line); while line ~= -1 k=k+1; line = fgetl(FID); output(k,:)= readGCode2(line); ...
% Simulate time series EEG-data by controlling source level parameters: % --------------------------------------------------------------------------------- % Choose a random dipole position from the whole source space. %num_dip=1; %dippos=sourcemodel.pos(:,:); % The entire sourcemodel is copied to dippos %ran...
M = csvread('outputs/sheet_02.csv'); M = [zeros(128, 180); M ;zeros(128, 180)]; phase = 29.4056213110678; angle = 0.9996; im_I = iradon(M, [phase:angle:angle*179 + phase], 'cubic', 'Hamming'); imwrite(im_I, 'outputs/im_I.png') im_B = im2bw(im_I,0.2); % Get the ratio_de ratio_de = sum(im_B) / sum(im_I); ...
function [res] = mostType(data) [m,n]=size(data); res_distinct = unique(data(:,n)); res_proc = zeros(length(res_distinct),2); res_proc(:,1)=res_distinct(:,1); for i=1:length(res_distinct) for j=1:m if res_proc(i,1)==data(j,n) res_proc(i,2)=res_proc(i,2)+1; end end end for i=1:l...
function sps=samplespace(Mu,tsig,jn,r,cl) for i=1:r for j=1:cl sps(i,j,:)=normrnd(Mu(i,j),tsig(i,j),jn,1); end; end;
classdef headstage < handle %HEADSTAGE class describes headstages properties name@char manufacturer@char model@char filter@double samplingRate@double connector@char gains@double channelMap@double end methods ...
%% the 2D plane with 2D link experiments clc clear % define the auxiliary variables syms lmd y1 y2 real; nlink = 2; % robot configurations theta1 = pi/3; theta2 = pi/6; % forward kinematics xpos = cos(theta1) + cos(theta2); ypos = sin(theta1) + sin(theta2); % arbitrary wall: y <= x + bias % max_b = 2*(sqrt(2)/2 +...
%% Prepare environment clear all; close all; clc; %% Crash course % X = A*X + B*U + E*N % Y = C*X + D*U + F*N % Rows % size(Y, 1) % Columns % size(Y, 2) %% Parse initial condition % Open input file input_data = fopen('input.txt','r'); % Read file for i = 1:5 command = fgetl(input_data); eval(command); end ...
function [ z ] = isGameDone( board ) if (sum(board(:) == 2 ) == 0) z = 3; elseif (sum(board(:) == 3 ) == 0) z = 2; else z = 1; end end
clc, clear all, close all tic % start computation time % for calling helper functions addpath(genpath('\\bmi-nas-01\Contreras-UH\Infantdata\Infantdata\code\Zachs_Infant_decoding_files')) %% Generate List of Infant Data Folders InfantDir = '\\172.27.216.40\Contreras-UH\Infantdata\Infantdata\Data\'; files = ...
opts_fields = fields( opts ); varargin=[]; for i = 1 : numel( opts_fields ) eval( [ opts_fields{ i } , ' = opts.' , opts_fields{ i } , ';' ] ) ; varargin{end+1}=opts_fields{i}; varargin{end+1}=opts.(opts_fields{i}); end
function [BW,maskedImage] = segmentImage(X) % Adjust data to span data range. X = imadjust(X); % Threshold image - manual threshold BW = X > -5783; % Invert mask BW = imcomplement(BW); % Clear borders BW = imclearborder(BW); % Erode mask with rectangle dimensions = [3 3]; se = strel('rectangle', dimensions);...
%Analitical solution dt = 0.0001; %Try different values m = 70; k = 10000; gama = 100; tf=5; x = 0:dt:tf; y = exp(-(gama/(2*m))*x).*cos(sqrt(k/m - gama^2/(4*m^2))*x); plot(x,y) %%%
%%% Codigo para seguimento de trajetoria de um robo RP %%% %%% Oscar Schmitt Kremer %%% %%% Controle de robos - 2019-1 %%% %%% Ganhos proporcionais e derivativos%%% clear clc close all m = 1; t = 0:0.002:24; t = t'; t_plot = 0:0.002:23.996; t_plot = t_plot'; sizes = size(t); %Descomentar para segund...
function [range, faceimg, mask] = findFace(oriImg, tlow, thigh) %figure, imshow(oriImg) %get size [m, n, ~] = size(oriImg); top = 1; left = 1; down = m; right = n; %detect skin color region mask = detectSkin(oriImg, tlow, thigh); %figure;imshow(mask); %fill empty region fmask = imfill(mask); %figure;imshow(fmask);...
clc clear all % Circular wire % angle = linspace(0,360,20); % x= 0.020 * cosd(angle); % y= 0.020 * sind(angle); % % wire(:,1)=x; % wire(:,2)=y; % wire(:,3)=0; % %Figure8coil angle = linspace(0,360,100); x1= 0.040* cosd(angle) - 0.040; y1= 0.040 * sind(angle); x = [x1(1:end) -x1(1:end)]; y = [y1(1:end) y1(1:end)...
function [gradient,dInputs]=backwardOneLayerLinearOutNet(net,netState,delta,saturationControl,networkType) %networkType=0 --> comparisonNet, networkType=1 --> GNN %saturationControl e networkType sono inutilizzati perché il controllo di saturazione non ha senso qui. %Sono stati mantenuti per uniformità con le a...
% plot stim % what's this stim??? DUR = XStimParams.curr_stimdur; nPts = DUR*round(TDT.Fs/1000); nEpochmsecs = XStimParams.epoch_duration(1); % duration of each epoch at one SPL nEpochPts = round(nEpochmsecs * TDT.Fs/1000); nEpochs = round(nPts / nEpochPts); nPts = nEpochs * nEpochPts; DUR = nPts / ...
%compares MM2 with Laguerre's LG_val1(1,1) = polyVal(-3); LG_val1(2,1) = -3; MM2_val1 = polyVal(-3); MM2_val1(2,1) = -3; LG_val2 = MM1_compare(-5,-4,-3); MM2_val2 = MM2_compare(-3); LG_val = [LG_val1 LG_val2]; MM2_val = [MM2_val1 MM2_val2]; x = 0:15; MM1_plot = abs(LG_val(1,:)); MM2_plot = abs(MM2_val(1,:)); figure...
A = [2 pi; sqrt(2) log(2);0 -1] % set up the matrix A(1,:) = A(1,:)/A(1,1) % Row1 = Row1 / 2 A(2,:) = A(2,:)- A(2,1)*A(1,:) % Row2 = Row2 - sqrt(2)*Row1 A(3,:) = A(3,:)- (A(3,2)/A(2,2))*A(2,:) % Row3 = Row3 - (-1/-1.5283)*Row2 A(2,:) = A(2,:)/A(2,2) % Row2 = Row2 / -1.5283 A(1,:) = A(1,:)-A(1,2)*A(2,:) % Row1 = Row1 - ...
% MAT 240B - 2011/03/18 - Karl Yerkes % % this code was written in an effort to prototype an online, realtime % hrtf-based binaural spatializer. the evetual goal is to run this % spatializer on an iPhone as part of the AlloScope project, started % by Danny Bazo and Karl Yerkes, in the Winter of 2010. % % this code use...
% Asumiendo un modelo exponencial de la forma a*exp(b*x), este % sería el crecimiento del número de casos de COVID-19 % en los próximos días (con límites de confianza del 95%): %Este modelo fue ajustado usando los datos recopilados entre el 3 y 19 de marzo close all; clc clear all; y = [1,1,1,3,9,12,12,16,24,45,...
function queryAll queryLocations; queryAnchors; queryRanging;
clear all; close all; clc; Train = load('train.txt'); Test = load('test.txt'); C = cov(Train(:,2:end)); %find covariance matric MU = mean(Train(:,2:end))'; [V,D] = eig(C); %Take the principal eigenvectors pcs = 32; E = V(:,end-pcs+1:end); % from each observation - image, subtract the mean values and proj...
% Finding circles in an image of an eye close all; newD = 250; filename = 'eye_60.jpg'; A = imread(['cropped/', filename]); A = imresize(A, [newD NaN]); A3(:,:,3) = 128; A3(:,:,2) = 128; A3 = rgb2gray(imresize(A3, [newD NaN])); A1 = rgb2gray(A); % figure() % imshow(A1) B1 = imbinarize(A(:,:,1), .06); B2 = imbinari...
function DenoisedImg = PNLM(ObsImg,PatchSizeHalf,WindowSizeHalf,EstSigma,RhoSq) % FUNCTION: Probabilistic Non-Local Means (PNLM) for image denoising % ========================================================================= % INPUT: % ObsImg = 2D grayscale image % PatchSizeHalf = half of local square patc...
function [cell1,cell2] = SplitCells(I,bgcolor) % Function that performs color image thresholding using % histogram derived. % Inputs: % input - Input image as RGB % bgcolor – value for bg color eg 256 for white, 0 for black. % Output: % 2 binary images of cells: cell1,cell2 IG = rgb2gray(I); %histogram...
%% Swarm Switching Behaviors for Motion % Description : Switching Behaviors - Motion % Author : Sasanka Nagavalli % Date : February 5, 2016 % Other Files : %% Clean up clear; clc; clf; close all; %% Paths addpath('../behaviors'); data_folder = '../data'; %% Simulation parameters N = 10; ti = 0; dt = 0.1...
function [varDistParams, x] = efficientStochOpt(... x, log_emp_dist, variationalDist, stepWidth, dim, maxCompTime) %Memory efficient stocastic optimization for parfor loop %Perform stochastic maximization step debug = false; %debug mode updateRule = 'amsgrad'; % beta1 = .7; %the higher, the ...
function training(args) %training Train and test the eigenface reconstruction on the first face in the % test data and make sure it reconstructs correctly. Also display the mean % face and top 10 and bottom 10 eigenfaces training = train_eigenface(args); % Reconstruct first image in training data image = r...
clear all; close all; data=load('path.txt'); % Data reduction interval = 1000; x = data(1:interval:end,1); y = data(1:interval:end,2); theta = data(1:interval:end,3); %Arrow Parameters pointsize = 100; %pointsize of initial and goal points ArrowLength = 10; LineWidth = 1; %LineWidth of the arrow MaxHeadSize = 2; u =...
classdef WindFarm < handle properties windTurbine@WindTurbine WindModel@WindModel NwindTurbines Area@Area Power end methods function obj = WindFarm(windTurbine,WindModel,Area) obj.windTurbine = windTurbine; obj.WindModel = WindMode...
x = simplecluster_dataset; %x = x + rand(2,1000)*2 plot(x(1,:)', x(2,:)', 'o') %% iter = 100; initHood = 3; topologyFcn = 'hextop'; % 'hextop'(*), 'gridtop' and 'randtop' distanceFcn = 'linkdist'; % 'linkdist'(*), 'dist' and 'boxdist' % [2 2] is very interesting: it clusters the data net = selforgmap([8 8], iter,...
%% % Filename: m3dof_fkin.m % Desc: calculates the forward kinematics for the planar 3DOF robot % INPUT: % q (3x1): joint angles in radians % l (3x1): length of the links % OUTPUT: % f (3x1): planar position [f(1:2)] and rotation angle in radians [f(3)] of EE % % 2015 alessandro.giordano@dlr.de %% function [f] = m3...
function res = onedist(z,pt) % ONEDIST(z,pt) calculates the distance between point pt and each % row in matrix z % Copyright (c) 1996 by D. Kaplan, All Rights Reserved [r,c] = size(z); if c ~= length(pt) error('pt and z must have same number of columns'); end sum = zeros(r,1); for n=1:c foo = z(:,n) - pt(n); su...
function varargout = ARNquant(varargin) % ARNQUANT MATLAB code for ARNquant.fig % ARNQUANT, by itself, creates a new ARNQUANT or raises the existing % singleton*. % % H = ARNQUANT returns the handle to a new ARNQUANT or the handle to % the existing singleton*. % % ARNQUANT('CALLBACK',hObject,ev...
function [ tanstruct_out_filtered ] = apply_ace_filter_monthly2X( tanstruct_in) %A function to create zonally averaged climatologies of ACE measurements, %by each unique calendar month. 'make_ace_climatology.m' is called here. % *INPUT* % tanstruct_in: STRUCTURE - contains the gas specific ACE data. % ...
function [data] = read_CSV_or_FCSV(filename) %READ_CSV_OR_FCSV Summary of this function goes here % Detailed explanation goes here fcsv_string='.fcsv'; TF = contains(filename,fcsv_string); if TF data = FCSV_Read(filename); else data = importcsvfile(filename); end end
function [X_new] = ResampleParticles(X, W, L) %RESAMPLEPARTICLES Return new particles based on weighted particles. % Using clustering and normal pdfs. % [yl, xl] = size(L); zl = double(min(min(L))); N = size(X, 1); X_new = X(W>0,:); missing = N - size(X_new, 1); n_rand = floor...
% script to illustrate the properties of the different subtraction methods % in ASL figure; set(gcf,'Position',[10 10 650,450]); TR=1.4; nyq=1/(2*TR); %%%%%% if 1 load ('voxels.mat'); tlen = size(a,1); NITER = size(a,2); types=4 else tlen=500; NITER = 100; types=3 end simp = zeros(NITER,...
%========================================================================= function [CellCrop, i1, i2, i3, i4, i5, i6, i7, i8]=crop2(Ibox3,varargin) %========================================================================= global i1 i2 i3 i4 i5 i6 i7 i8 Ic=cell2mat(varargin); if size((Ibox3),2)==3 i1=imcrop(...
function [radbu] = band_unapod(radbpr); % function [radbu] = band_unapod(radbpr); % % Convert padded & rolled off Hamming CrIS spectra to unapodized spectra. % % Input: % radbpr - [1763/1411/1031 x nobs] padded/rolloed off Hamming spectra % % Output: % radbu [713/433/159 x nobs] unapodized CrIS spectra % % Cr...
% function CPFEM_Tensile_Spec__2D__GRIPS() global Lattice xmin = Lattice.size.xmin; xmax = Lattice.size.xmax; ymin = Lattice.size.ymin; ymax = Lattice.size.ymax; xincr = Lattice.size.i_incr; yincr = Lattice.size.j_incr; xlength = Lattice.size.xlength; ylength = Lattice.size.ylength; x = Lattice.si...
N=1000; figure; hold on; x=randn(1, N); y=randn(1, N); h = scatter(x, y, 'r.'); xlabel('Condition A'); ylabel('Condition B');
set(0,'defaultLineLineWidth',3) set(0,'DefaultAxesFontSize',15); mud=textread('../wells/MudWeightAverage.txt'); mud0=textread('../wells/MudWeightAverage0.txt'); mud1=textread('../wells/MudWeightAverage1.txt'); mud2=textread('../wells/MudWeightAverage2.txt'); mud3=textread('../wells/MudWeightAverage3.txt'); mud4=textre...
function [ssimval, ssimmap ] = ssim_function( A,ref); %UNTITLED Summary of this function goes here % Detailed explanation goes here ssimval = ssim(A,ref); % diff(getrangefromclass(A))=ssim(diff(getrangefromclass(A)),Name,Value,...); im_path1 = 'Reference Image.bmp'; ref = imread(im_path1); im_path2='Blurred Image...
function Xout = kaVirtualSignalBetaDiv(X,posAlpha,b) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Input : %% X : 2 channels actual signal (FFT representation) : %% 2 (channel) x freq x frames x source %% posAlpha : Vector of microphone position %% 1 x # of virtual mic %% b : beta divergence parameter : scalar %%...
%%%% now do the experimental data figure; set(gcf,'Position',[1 1 450,450]); warning off TR=1.4; nyq=1/(2*TR); %%%%%% load ('voxels.mat'); tlen = size(mytimeseries_act,1); NITER = size(mytimeseries_act,2); types=2; simp = zeros(NITER, tlen/2); run = zeros(NITER,tlen-1); sinterp=zeros(NITER,tlen); orig=zeros(NITER...
function plot_pretty_glms(betas,nBack, gridlines) if ~exist('gridlines', 'var') gridlines = false; end B=nanmean(betas); se = nansem(betas,1); figure; hold on; grey = [0.7,0.7,0.7]; % Horizontal grey dottend lines behind the data if gridlines ys = [-2:0.25:2]; for y = ys line([0, nBack + 1], [y,...
function makeLaserPulseTrain() % Make laser pulse train trial_duration_s=15+3+25; % total duration of the trial laser_on_s=[15.75 17.75]; % [start stop] for pulse train pulse_width_s=0.150; IPI_s=0.200; dbstop if error ephysSettings % Create blank command zeroCommand=zeros(1,settings.sampRate*trial_duration_s,1); ...
clear all; stateData = importdata("../vision_capture/run12/poses.dat"); xvelactual = stateData.data(:,37); groundpix = [387, 290]; pix2worldscaling = 1.3476; pixvel = zeros(length(xvelactual - 1),1); for j = 0:length(xvelactual) - 2 fr1 = rgb2gray(imread("../vision_capture/run12/ts" + j + ".png")); fr2 = rgb2g...
init; num = 13; errlist = zeros(1,num); path = strcat(saveImgTo,'train/'); for i = 1:num; [~,errlist(i),f] = main(i); title(strcat('Data Set:',int2str(i), ' error rate: ', num2str(errlist(i)*100), '%')); saveas(f,strcat(path,'Train-',int2str(i)),'jpg'); end