text
stringlengths
8
6.12M
function [imgcell, axonseg, myelinseg]=as_save_3dcell(Axonlist, img, blocksize) % [myelinseg, axonseg]=as_save_3dnii(Axonlist, imgsize, blocksize) imgsize=size(img); centroid=cat(1,Axonlist.Centroid); xcentre=centroid(:,1); ycentre=centroid(:,2); count=1; nbB=length(1:blocksize:imgsize(1))*length(1:blocksize:imgsize(2)...
classdef TextArea < handle & CustomGuiInterface events ValueChangeEvent end methods function obj = TextArea() obj.uiInstance = uitextarea(); obj.uiInstance.ValueChangedFcn = @(textarea, event) obj.textChangeCallback(); end % % Set...
clear all;close all;clc; load data; % 读取数据 Data = data; % ?100个样本进行归?化处? min-max标准化方法[0,1]区间 % 缺点是当有新的数据加入时,max和min可能发生变化,需要重新定? for i=1:100 for j=1:3 Data(i,j)=(data(i,j)-min(data(:,j)))/(max(data(:,j))-min(data(:,j))); end end D1=Data(1:80,:); D2=Data(81:100,:); k=20; % 训练集是80个样本,测试集是20个样? for i=1:20 temp=D2(i,...
function c = thermalsunriseFunction(X,Z,t,tsr) %X: the state %Z: observed value %t: time % To = zeros(NUMBER_ROW,NUMBER_COLUMN,Ns); %TESTINGCYCLE_DATA(jN,iN).To(n(jN,iN)); % Ta = zeros(NUMBER_ROW,NUMBER_COLUMN,Ns); %TESTINGCYCLE_DATA(jN,iN).Ta(n(jN,iN)); % tm = zeros(NUMBER_ROW,NUMBER_COLUMN,Ns); %TESTINGCYCLE_...
classdef PolicyEXP3M < Policy properties K L Gamma Wvec Pvec S0t Level Beta end methods function self = PolicyEXP3M(K_, L_, gamma_, level_) self.K = K_; self.L = L_; self.Gamma = gamma_; ...
classdef kalman % Kalman class % Created by: Lee A. Harrison % On: 2/20/2019 % % Copyright (C) 2019 Artech House (artech@artechhouse.com) % This file is part of Introduction to Radar Using Python and MATLAB % and can not be copied and/or distributed without the express permission of Artech H...
clear clc close all %% % USER-DEFINED PARAMETERS filename = 'data.2d'; filedir = fullfile('Z:','Data','JYU','CPMG (summer 2017)','26July','P250.2015e_acetone_overnight'); nMeas = 60; nSmooth = 21; omitEchoes = 0; %front-end echoes to omit guess = [0 1 0.008]; %[y-offset, amplitude, T2 in s] t0 = datetime('26-Jul-...
function qa_uprobe(fn,sacflag) %%function to plot receptive fields of uprobe neurons %%fucntion takes nev filename, along with sacflag (0 if want to analyze %%visual period, 1 if want to analyze motor period) % fn='Wi130813_s104au1_dirmem_0005.nev'; % fn='Wi130816_s105au5_dirmem_0001.nev'; fn{1}='Wi140127...
function [y0] = perturbModel(expanded_model,initial_conc,x1,x2) % This code perturbs the enzyme fraction(s) in the model (PMID:24928774). % % % INPUTS: % ------- % expanded_model: model structure that containts the information of the % expanded and unexpanded model % initial_conc: The initial conce...
function y = pa_gsmooth(x,fs,sd,sdextra) % Y = PA_GSMOOTH(X,FS,SD,SDEXTRA) % % Gaussian smoothing % % x = data (samples) % y = smoothed data % fs = sample frequency data (samples/s = Hz) % sd = standard deviation gauss (s/SD) = fs*sd samplepoints/SD % % sdextra = number of sd's added to data edges (5 = ...
file = fullfile('Datasets','DatasetA','car-1.jpg'); %file = fullfile('Datasets','name.png'); img = imread(file); %img = rand(7,7,3); output = ICV_rotate(img, 30); imwrite(output, 'rotate30.png'); %{ output = ICV_rotate(img, 60); imwrite(output, 'rotate60.png'); output = ICV_rotate(img, 120); imwrite(out...
function E=plot_grid(fname,varargin) % plot_grid(fname, [optional inputs]); % % Inputs: % fname The filename containing the D struct from grid_search % % Optional Inputs: % do_fit If true, the data will be fit with a quadratic. % % Outputs: % E A struct with the fits of a 2D quadratic for each of the cro...
function InitPoints = initPoint(Line_rpes, Label_te) % UPDATE = false; if nargin > 1 UPDATE = true; end for ni = 1 : length(Line_rpes) Line_rpe = Line_rpes{ni}; for orient = 1 : 2 % 1 for left point and 2 for right pos_ni = Line_rpe{orient}; if max(...
function Probabilities = GetConditionalProbabilities(obj) % This function is used to get the conditional probability table (CPT) in correct order. % % The default order of CPT is the order that the parents are added, but the correct order of the CPT is according to the indexes of its parents. % % For example, ther...
% inverseFullPCA.m % % The inverse of Principal Component Analysis on column data. % % inputs: sortedEigenValues 2D matrix, one column per slice, slices % sorted in descending order % (these values is the key for sorting % ...
classdef SoftMembershipMultDing % % Ding's Multplicative soft membership update function. % % Introduce row normalisation of vertex membership as well as L1 and L2 % regularisation as options. % % % @author: Jeffrey Chan, 2013 % properties m_bNormalisedCol = false...
%Voice Based Biometric System %By Ambavi K. Patel. function disply(nmatch) %indicate result mx=max(max(nmatch)); if mx<1 h1 = msgbox('INCORRECT','your password is','error'); soundsc(wavread('denied.wav'),50000); uiwait(h1,1); close(h1); else h1 ...
function im=CropBackground(im,t,l,b,r) % Removes the 'background' of the image. % The background is given by the sizes of the top, left, bottom, and right padding already on the image. % The image can be a string or a matrix. if ischar(im); im = imread(im); end; im = im(t+1:end-b,l+1:end-r);
%% findP % Calculate the coordinates of a series of points on a curved edge. %% %% Syntax % P =findP(V,A,s); % %% Description % Calculate the coordinates of a point on a curved edge. % %% Inputs % * V - a 2-by-2 matrix with the starting and ending points. % * A - a variable containing the curvature angle of the ed...
classdef CasadiMeta < SwigRef %CASADIMETA Collects global CasADi meta information. % % % %Joris Gillis % %C++ includes: casadi_meta.hpp % methods function this = swig_this(self) this = casadiMEX(3, self); end function self = CasadiMeta(varargin) %CASADIMETA ...
function ShowResults( path, range, trainError, validError, validationLabels, validEstimatedLabels ) pos = dir(strcat(path, 'VldP*.pgm')); neg = dir(strcat(path, 'VldN*.pgm')); files = vertcat(neg, pos); if validError == 0 bestEstim = validEstimatedLabels; else figure; plot(range, trainError, 'b'); hold o...
function [maskStack minValue] = seg3D(cube, featherSize, groupObjects, minSize) %Pass in a Z-stack (cube) and perform Otsu thresholding in all 3 dimensions %to segment out the object. If there is only 1 Z-section then seg2D.m is %used instead. Pass it back as a stack of binary masks. numY = length(cube(:,1,1)); numX ...
function result = mInverseJacobiDN( X, M ) %MINVERSEJACOBIDN Inverse of the Jacobi function DN. % MINVERSEJACOBIDN(X,M) is the inverse of Jacobi function DN for the % elements of argument X and parameter M. X and M must all be real and % the same size or any of them can be scalar. % % See also INVERSEJACOBID...
function rc = write_dcdstep(h, x, y, z) % % rc = write_dcdstep, handle, x, y, z); % fwrite(h.fid, 4*length(x), 'int32'); fwrite(h.fid, x, 'float32'); fwrite(h.fid, 4*length(x), 'int32'); fwrite(h.fid, 4*length(x), 'int32'); fwrite(h.fid, y, 'float32'); fwrite(h.fid, 4*length(x), 'int32'); fwrite(h.fid, 4*length(x)...
function [ temp ] = DGeval_1D(DGcoeffs,vpoint,data) % written by Pierson Guthrey v1 = vpoint(1); %Periodic Conditions in x domainv1 = data.v1_ub - data.v1_lb; v1tilde = -mod(data.v1_ub - v1,domainv1)+data.v1_ub; indexv1 = ceil((v1tilde - data.v1_lb)/data.deltav1); etav1 = 2*(v1tilde-data.v1centers(indexv1))/data.del...
function [ index, labels, limits ] = NeuromagAnatomicalReorder %UNTITLED4 Summary of this function goes here % Detailed explanation goes here % Sensors recording the frontal region Left_frontal = {'MEG0121', 'MEG0341', 'MEG0311', 'MEG0321', 'MEG0511', ... 'MEG0541', 'MEG0331', 'MEG0521', 'MEG05...
## Copyright (C) 2021 Robertson ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is dist...
nmos = csvread('../data/experiment1_nmos_1.csv', 1); [Is, VT, kappa] = ekvfit(nmos(:,1), nmos(:,2), 1e-3, 'on') % Is = 1.9361e-06 % VT = 0.5576 % kappa = 0.6821
% devuelve la malla de rectángulos rxl en coordenadas XYZZ. % maxmin está en coordenadas XYZ2origin. function [grid,n,m] = gridinplane(maxmin,r,l) ly = lineab(maxmin(2,2),maxmin(1,2),l); lx = lineab(maxmin(2,1),maxmin(1,1),r); lengthx = length(lx); lengthy = length(ly); grid = zeros(lengthx*lengthy,2); for i=1:l...
READSIZE = 1000000; % - Open file. ds1 = datastore('../data/data1.csv','TreatAsMissing','NA'); ds2 = datastore('../data/data1.csv','TreatAsMissing','NA'); ds1.SelectedVariableNames = { 'PERMNO','date','TICKER','COMNAM','PRC','VOL'}; ds2.SelectedVariableNames = { 'RET' }; ds2.SelectedFormats = {'%q'}; ds1.ReadS...
function [X,Xb,XI,N,Nb,NI]=points(char,h,a,b) % Inputs: % char can be chosen by the user Regular or distmesh (it needs to be downloaded this package that is free for the user) % h is the maximum distance between two distinct points % a & b are chosen here 0 & 2, respectively % Outputs: % X is the total number o...
% written by professor Jay McClelland function [ ] = showState() global p w d a; FONTSIZE = 13; % plot rewards over time axes(d.rwd); plot(w.rS.time, a.aCurRwd,'-b*'); hold on; plot(w.rS.time, a.cCurRwd,'-r*'); legend({'move', 'number'},'Location','northeast', 'fontsize', FONTSIZE) ylim(d.rwd,[p.r.bigNeg ...
% This script assumes the following variables exist and are correct: % config % res_coupling_near % res_piezoscan_postBlast % res_wideFSW config.n_c = [100:50:700]; % target n_c %% sides = {'B'}; % initial target detuning attens = getAttensFromPowers(... nca...
function atclass=getclass_6d(elem) %GETCLASS_6D Private. Guess class for 6d motion % % Returns the element class ignoring its Class field when non-ambiguous % Simplified and faster version of atguessclass if isfield(elem,'BendingAngle') atclass='Bend'; elseif isfield(elem,'PolynomB') && elem.Length > 0 if i...
load('USPS.mat'); p = [10,50,100,200]; errors = zeros(length(p),1); % error rate [10,50,100,200]; for j = 1:4 % digit from 0 to 9 for i = 0:9 % get data for perticular number. data = A(L==i,:); temp_mean = mean(data,1); data = data - repmat(temp_mean,size(data,1),1); ...
function varargout = grDilate(varargin) %GRDILATE Morphological dilation on graph. % % LBL2 = grDilate(EDGES, LBL1) % Each label of the graph is assigned the highest label of its % neighbours, or it keeps the same label this one is bigger. % % Example % grDilate % % See also % grErode, grOpen, grClose % ...
function scores = Funcion_de_busqueda(x,array_config,Potencia_sensores,freq_config,range_config,Numero_de_sensores,posicion_X,posicion_Y,posicion_Z,clusters_fijados) global mejor_idx; global mejor_centro_cluster; global estacion; global mejor_scores; global mejor_x; global estacion_no_deseada; global estacio...
I= imread('INTERT/1.jpg'); imshow(I); Igry = rgb2gray(I); J = histeq(Igry); %figure, imshow(J); BW = imbinarize(J); %figure, imshow(BW); BW = 1- BW; SE = strel('line', 40, 90); BW = imopen(BW,SE); %figure, imshow(BW); E= edge(BW,'canny',[],3); figure ,imshow(E); title("Lines"); % Potential improvement later. % [H,T,...
function AMPX_Naris_fig_2_task(all_data_pre, all_data_post, varargin) %% AMPX_Naris_fig_2_task: generates figure 2 which contains the heatmaps % for the average rewarded/approach gamma 50 and gamma 80 events for the % two rats that reached task criterion % % % EC - 2016-05-31 %% extract inputs extract_varargin %% loa...
function [pass,maxerr] = test(opt) % Check that zero-time correction works when maximum is at later times t_true = linspace(-5,1,400); r = time2dist(t_true); P = dd_gauss(r,[4,0.2]); V = dipolarkernel(t_true,r)*P; tshift = 1.2343; t = t_true + tshift; [t_corr,czt] = correctzerotime(V,t); % Pass 1: corrected time-ax...
scan = load("-ascii","laserscan.dat"); angle = linspace(-pi/2,pi/2,size(scan,2)); x1 = scan .* cos(angle); y1 = scan .* sin(angle); plot(1,0.5,'@1') hold on X_roboter = X(1,0.5,(pi)/4); X_laser = X(0.2,0,(pi)); pos_laser = X_roboter*[0.2;0;1]; plot(pos_laser(1,1),pos_laser(2,1),'@3') for i = 1:size(scan,2) pos_res =...
classdef datatype % excentury.core.DATATYPE: Container to hold matlab objects % % This container holds the object along with a name and the % interface that creates it. This class is meant to be use % by excentury.core.communicator. % properties obj %# matlab object name %# object name inter...
function model = fnc_jointCoord_PatellaL (model,DoF_Types) % Bone Mesh Female Toolkit % Licensed under the zlib license. See LICENSE for more details. jointCenter_patellaL_global = ... model(7).vertices_global(model(7).LandmarkIndices(1),:); jointAxes_patellaL_global = eye(4); jointAxes_patellaL_global(...
%Charlie Nitschelm function solve = GaussSolver(i,j,k,T1,h,q,dx,dy) a = dx; b = dy; c = k(i-1,j); d = k(i,j+1); e = k(i+1,j); f = k(i,j-1); g = T1(i-1,j); u = T1(i,j+1); z = T1(i+1,j); l = T1(i,j-1); v = h(i-1,j); r = h(i,j+1); s = h(i+1,j); t = h(i,j-1); m = q(i-1,j); n = q(i,j+1); o = q(i+1,j); p = q(i,j-1); solve = ...
function setFreqSMC100A(SMC100A,freq) fprintf(SMC100A, [':SOURce:FREQuency:CW ' num2str(freq)]); end
function [combinations, combMasses] = AAcombinator(symbols, existingCombinations, masses) R = length(existingCombinations(1))+1; N = length(symbols); combLength = factorial(N+R-1)/(factorial(N-1)*factorial(R)); combMasses = zeros(combLength,1); currentIndex = 1; for i=1:length(symbols) for j=1:length(existingCom...
function output = align_face(frame, left_eye, right_eye, chin) output = []; imshow(frame); size_x = size(frame, 1); size_y = size(frame, 2); %if((right_eye(1,1) - left_eye(1,1)) < (size_x/3)) % disp('waste only'); %return; %end center_eye = uint32((left_eye + right_eye)/2); half_interocular_...
function stats = olscluster(y,X,g,varargin) % Multiple linear regression using ordinary least squares (OLS) with % 1-way or 2-way cluster-robust covariance estimator (borrowed from % Gow, I.D., Ormazabal, G., & Taylor, D.J., 2010). % % stats = olscluster(y,X,g,varargin) calculates OLS regression with 1-way % or 2-wa...
function [L] = lp_loss_epb(Z, NIN, Z_vec) % % Calculates the loss L(Z_vec) in Z-frequencies Z_vec given % a attenuation pole vector Z for the LP case % with equiripple passband. % Also the number of attenuation poles at infinity NIN is required. % Author: Per Loewenborg % Modified by: LW % Copyright...
fid = fopen('b.txt','wt'); fprintf(fid,'MEMORY_INITIALIZATION_RADIX=2;\nMEMORY_INITIALIZATION_VECTOR=\n'); for i=1:1:256 y=dec2hex(randi([0 15])); fprintf(fid,'%c',y); y=dec2hex(randi([0 15])); fprintf(fid,'%c',y); y=dec2hex(randi([0 15])); fp...
function [ Anext ] = NextGeneration( Anow, n ) Anext = zeros(n,n); i=2; while(i<(n)) k=2; while (k <(n)) window=zeros(9,1); inc = 1; for g=1:3 for h=1:3 window(inc)=Anow(i+g-2,k+h-2); inc=inc+1; end end ...
function [fld]=read_nctiles(fileName,fldName,varargin); %usage: fld=read_nctiles(fileName); reads full field using fileName as field name %usage: fld=read_nctiles(fileName,fldName); reads full field (all depths, all times) %usage: fld=read_nctiles(fileName,fldName,tt); reads 3D or 2D field, at...
close all; % define sstate inputs; sstate_input = Define_sstate_input(); % load and manipulate data dbs = dbload('est_data.csv'); obs = struct(); obs.z = (dbs.z - mean(dbs.z))/mean(dbs.z); obs.g = (dbs.g - mean(dbs.g))/mean(dbs.g); obs.tax = (dbs.tax - mean(dbs.tax))/mean(dbs.tax); obs.debt = (dbs.b - 100*sstate_inpu...
function displayResultsHop(type, results, ... percentBlackMin, percentBlackMax) %HOPSIZE Performance for different hopsizes if ~exist('percentBlackMin', 'var') percentBlackMin = 75; end if ~exist('percentBlackMax', 'var') percentBlackMax = 80; end if strcmp(type, 'size') pattern = '\-hop([0-9]+)'; else...
% StudyName='RoAs_20080122'; % StudyName='WhSa_20070813'; BasePath=[BaseBaseP StudyName filesep]; WorkingP=BasePath; FinalT1=load([BasePath 'AfterCTC.mat'],'FinalT1'); FinalT1=FinalT1.FinalT1; MskC=load([BasePath 'MskC.mat']); MskC=MskC.MskC; Sims=load([BasePath 'SimSigNoised.mat']); Sims=Sims.Sims; disp('Loaded simula...
function plottopo(basename,bandidx) loadpaths if ischar(basename) EEG = pop_loadset('filepath',filepath,'filename',[basename '.set'],'loadmode','info'); else EEG = basename; clear basename end bpower = mean(mean(EEG.spectra(:,... EEG.freqs >= EEG.freqwin(bandidx) & EEG.freqs <= EEG.freqwi...
function J_G1 = getJacobian(p,z); %syms a l1 l2 l3 %syms th1 th2 th3 th4 th5 th6 th7 %syms th1_dot th2_dot th3_dot th4_dot th5_dot th6_dot global a l1 l2 l3 table_height th1 th2 th3 th4 th5 th6 th7 [z p] = getPointsAndAxes(); ze =[0 0 0]'; z2 = z(:,3); z3 = z(:,4); z4 = z(:,5); z6 = z(:,7); z7 = z(:,8...
% pWriteSequencesWithRotations writes the sequences in FASTA to a file, and if they are from an internal loop, rotates the sequences and writes them again, etc. function [AllSequencesFile] = pWriteSequencesWithRotations(ModelPath,FASTA,loopType,Rotations,CF) if nargin < 5, CF = ''; end r = 1; ...
fval = 300; while (fval > 20) [x,fval,exitflag,output,population,score] = generate_1; end
function PauseButton %PauseButton Summary of this function goes here % Detailed explanation goes here %% Layout der GUI % Größe der GUI festlegen guisize = [250 70]; % Auslesen der Bildschirmauflösung scrsz = get(0,'ScreenSize'); MainWindow = figure('MenuBar','none', ... 'Name','Pause Execution', ... 'ToolB...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 train_svm_model(p,stage,branch) feature_file=sprintf('%s/svm_feature/stage_%d_%d.txt',p.data_path,stage,branch); model_file=sprintf('%s/model/stage_%d_%d.mat',p.data_path,stage,branch); if ~exist(feature_file,'file') disp(['data file has not been computed:',color_data_file]); return end if exist(model...
function handle = VisualizePoints(points,handle) delete(handle.scatter); hold on; N = length(points); X = []; Y = []; Z = []; Xd = []; Yd = []; Zd = []; for k = 1:N [x,y,z] = Sph2Cart(1,points(k).theta,points(k).phi); if ~points(k).isDuplicate X = [X x]; Y = [Y y]; Z = [Z z]; e...
addpath('../matlab'); %=========================================================================% % % % Autor: Enrico Bertolazzi % % Department of Industrial Engineering ...
clear all close all clc k = 1:5; dzeta = [pi^2/6 pi^4/90 pi^6/945 pi^8/9450 pi^10/93555 691*pi^12/638512875]; res = []; for i = 2:length(dzeta) res = [res, (dzeta(i-1)-1)/(dzeta(i)-1)]; end asimpFromDzeta = 2*((-1).^(k+1)).*(res.*gamma(2*k+1)./((2*pi).^(2*k))); disp('Asimpfrom dzeta:'); disp(asimpFromDzeta) k = 1...
function bIsACurrentWeather = IsACurrentWeather( iSignalID, iDeviceID ) % try % % if( 80000 == iSignalID ... || 81000 == iSignalID ... || 82000 == iSignalID ... || 83000 == iSignalID ... || 84000 == iSignalID ... || 85000 == iSignalID ... || 86000 == iSignalID ) % bIsACurrentWeather...
function varargout = poseSelectionWindow(varargin) % POSESELECTIONWINDOW MATLAB code for poseSelectionWindow.fig % POSESELECTIONWINDOW, by itself, creates a new POSESELECTIONWINDOW or raises the existing % singleton*. % % H = POSESELECTIONWINDOW returns the handle to a new POSESELECTIONWINDOW or the hand...
function TScreateSingleTSlibCodeFile % Creates a text file containing all of the TS commands, with each function % delimited by 'startfunction' and 'endfunction'. The TSsystem can be % installed by calling TSwriteoutfunctions with 'TSlibCodeFile.txt' as the % input argument %% fid =fopen('TSlibCodeFile.txt','a'); % fi...
function lkDpxTuningExpAnalysisDiPhiVsIhp(D,filterMode,normalize) % D should be the output from lkDpxTuningExpAnalysis [is,whynot] = dpxdIs(D); if ~is error(whynot) end if ~exist('filterMode') || isempty(filterMode) filterMode='includeall'; end if ~exist('normalize...
%Anteckningar från möte 16/2 %Primitiver som flaggor, 3 färger svårt att mappa till en bildpunkt --> %lättare och mer logiskt att använda flaggornas medelvärden som mätpunkt. %Svårt att se översiklgihet om bilderna INTE är brusiga, därmed är %brusiga flaggor inget problem! %Sätta till ett standrardrektaungulär är ...
function addTextToAvi(srcName, tarName, strTxt, varargin) % adds text to given avi video. % SYNTAX: % addTextToAvi(srcName, tarName, strTxt) outputs avi file with name % "tarName", by converting strTxt to image and adding it to the top left % corner of avi file srcName. % % addTextToAvi(srcName, tarName, s...
function flag=findSubset(set) flag=[]; zeroPlaces=find(set==0); onePlaces=find(set==1); if isempty(onePlaces)==0 zeroPlaces=zeroPlaces(zeroPlaces>onePlaces(end)); end for i=1:size(zeroPlaces,2) setHelp=set; set(1,zeroPlaces(1,i))=1; flag=[flag;findSubset(set)]; set=setHelp; end flag=[flag;set]; end
function result = ex_gazeContingent(e) global wins r=5; while 1 pt = samp .* wins.pixelsPerMV + wins.midV; pt(2) = wins.voltageDim(4) - pt(2); % flip Y coordinate % obj 1 is fix spot msg('set 1 oval 0 %i %i %i %i %i %i',[round(pt) r 255 0 0]); msg(...
function [sizes] = images_size_infos(images) % width and height sizes = [0 0]; for i=1:length(images) im = imread(images(i).name); sizes(1) = sizes(1) + size(im, 1); sizes(2) = sizes(2) + size(im, 2); end sizes = round(sizes ./ length(images)); end
function B = repdiag(A,d) % REPDIAG repeat a matrix along the diagonal a certain number of times, so % that if A is a m by n matrix and we want to repeat along the diagonal d % times, we get a m*d by n*d matrix B such that: % B( (k*m+1):(k*m+1+m-1), (k*n+1):(k*n+1+n-1)) = A % for k from 0 to d-1 % % B = ...
function [cov_mean, cov_median, cov_mode, cov_max, cov_min, cov_skewness, cov_kurtosis] = OriDataForPlot(path) cov_mean = []; cov_median = []; cov_mode = []; cov_max = []; cov_min = []; cov_skewness = []; cov_kurtosis = []; if path == "angle" load('stat_vector_angle'); cov_mean = cov_mean4; cov_medi...
function rfExamples(fitobjs, featureMapNm) if nargin < 2 featureMapNm = 'pixel'; end ind = randi(numel(fitobjs)); fobj = fitobjs(ind).fits(1); if ~strcmpi(featureMapNm, 'pixel') A = io.loadFeatureBasis(featureMapNm); else A = 1; end figure; colormap gray; nd1 = 1; nd2 = 4; subplot(nd1,nd2,1); plotRf(fob...
% This script calculates the critical temperature of a bulk superconductor, % by performing a binary search for the temperature where the gap vanishes % numerically. The result should be numerically one in the given unit % system, so this script can be used to calibrate other simulation parameters. % % Written by Jabir...
function call_pushUndo (buttonHandle, ~, ~) % Bone Mesh Female Toolkit % Licensed under the zlib license. See LICENSE for more details. % Define Variables buttonHandle.Parent.UserData.model_current =... buttonHandle.Parent.UserData.model_undo; buttonHandle.Parent.UserData.model_undo = []; buttonHandle.Parent.User...
data = csvread('cervicalCancerFix.csv', 1, 0); Hinselmann = data(:,29); Schiller = data(:,30); Cytology = data(:,31); Biopsy = data(:,32); data = data(:,1:28); % centering the data for k = 1:28 colSum = sum(data(:,k)); for j = 1:668 data(j,k) = data(j,k) - (colSum/668); end end sumH = sum(Hinselm...
disp('======= KITTI DevKit Demo ======='); clear all; close all; dbstop error; % error threshold tau = 3; % stereo demo disp('Load and show disparity map ... '); D_est = disp_read('data/disp_est.png'); D_gt = disp_read('data/disp_gt.png'); d_err = disp_error(D_gt,D_est,tau); figure,imshow(disp_to_color([D_est;D_gt])...
% step1a_doNegotiation_first.m description % Add your first-price sealed-bid agent models and edit this file to create % your first-price sealed-bid auction. % This file uses the matrix generated in determineCommunicationCandidates.m % (in step1_performCommunication.m) that contains every communication % candidate for...
function hBuildMenu = open_editdevice list = getBuiltDevices; if ( size(list) ~= 0) hExistingDevMenu = figure('Visible', 'on', ... 'Position', [500, 50, 550, 575], ... 'Name', 'Availible Devices', ... 'NumberTitle', 'off', ... 'MenuBar', 'none...
function sfn_tr = trunc_fort_sfn( sfn, parms ) %Takes streamfunction from the fortran code (which lives on multiple %grids)and truncates the parts the overlap with finer grids to return a %streamfunction that is consistent with the matlab base flow solver. mg = parms.mg; m = parms.m; n = parms.n; %size of st...
clear all; clc; close all; %% N = 1000; %% Create von Mises Fisher distribution on a circle along a direction nd = 3; xg = ones(nd, 1); %45 degtree angle xr = zeros(nd,1); %robot is always at origin. mu = [-0.1226, 0.0310, -0.0997]; kappa = 20; %concentration parameters vonmises_samples = randvonMisesFisherm...
% Thin the variables used to build the Gaussian Process % % This thins the variables used to build the Gaussian Process. % % >> object=thinVariables(object,x); % % If x is 1D array then it represents the elements to kept. % If x is a scalar, then it is taken to be a stride such that the % build points kept are 1...
function [error] = kernreg_xval_error(X, Y, sigma, part) % KERNREG_XVAL_ERROR - Kernel regression cross-validation error. % % Usage: % % ERROR = kernreg_xval_error(X, Y, SIGMA, PART) % % Returns the average N-fold cross validation error of the kernel regression % algorithm on the given dataset when the dataset is par...
function [DLcomm] = Xi_comm_k_DL(DLcomm, k) J = DLcomm.DL_num; Xi_DL_k = 0; for jj = 1:J alpha_dj = DLcomm.alpha_DL(jj); W_jd_k = DLcomm.DL_weights{jj,k}; E_jd_k = DLcomm.DL_MMSE_nop{jj,k}; Xi_DL_k = Xi_DL_k+alpha_dj*real(trace(W_jd_k*E_jd_k)); end DLcomm.Xi_DL(k) = Xi_DL_k; end
function answer = even_fibonacci_numbers() answer=2; for i=3:50 a(1)=1;a(2)=2; a(i)=a(i-1)+a(i-2); if a(i)<4000000 if rem(a(i),2)==0 answer = answer + a(i); end end end
global C1; global C1a; global C2; global C2a; global C3; global C3a; global poziom_zawor1_poprawiony; global poziom_zawor2_poprawiony; global poziom_zawor3_poprawiony; global x01; global x01a; global x02; global x02a; global x03; global x03a; global alfa; global alfa2; global alfa3;
function tpsbooster % TPS booster lattice % Created by Peace Aug/19/2009 % Modified and Tested by Peace Aug/25/2009 global FAMLIST THERING GLOBVAL GLOBVAL.E0 = 3.00e9; % Energy = 3.0e9; GLOBVAL.LatticeFile = 'B6P4D'; % mfilename FAMLIST = cell(0); disp(['>> Loading TPS booster lattice ', mfilename]); AP = ape...
%___________________________________________________________________% % Multi-Objective Dragonfly Algorithm (MODA) source codes demo % % version 1.0 % % % % Developed in MATLAB R2011b(7.13) ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Authors: Hamza Bourbouh <hamza.bourbouh@nasa.gov>, Andreas Katis <andreas.katis@nasa.gov> % Notices: % % Copyright @ 2020 United States Government as represented by the % Administrator of the National Aeronautics and Space Administration. All % Rights R...
function [err, p_bin, score] = cal_p_bin(filter, weight, f_num, nonf_num, data_bin, bin_num) %UNTITLED14 Summary of this function goes here % Detailed explanation goes here filter_num = size(filter, 2); p_bin = zeros(bin_num, filter_num); err = zeros(filter_num , 1); score = zeros(bin_num, filter_num); for i = 1:1:f...
% CheckLatex checks the Qs printed by LatexQ for normalization and % orthogonality to P'*I. for d = 0:3 for j = 1:4 disp(['---------- d = ' num2str(d) ', j = ' num2str(j) ' -----------']); P = FindP(d, j); P_denom = LCD(P); P = round(P*P_denom); disp(['P = 1/' num2str(P_denom)]); disp(P); ...
function dataSet = plotTimeGraph(csi_trace) % plot time-CSI graph % input : csi_trace - csi infomation(n*3) % output : dataSet - new csi_trace % ----------------------------------------------------------------------- m = size(csi_trace, 1); dataSet = zeros(m, 3) ; for k=1:m t = get_scaled_cs...
function [Q, R, x]=GramSchmidt(A, b) % Returns an orthonormal basis for C(A), the QR decomposition, and % optionally solves Ax=b. n=size(A,2); Q=A; for i=1:n for j=i+1:n Q(:,j)=Q(:,j)-proj(Q(:,j), Q(:,i)); end end for i=1:n n=norm(Q(:,i)); if(n>eps) Q(:,i)=Q(:,i)/n; end end R=Q'*A; i...
x = -pi:.01:pi; y = sin(x) plot(x,y) title ('grafica de la funcion seno'); xlabel('x') ylabel('Sin(x)')
function haar_im = filter_image_haar(im, block_size, haar_4, fcnHandleBlockSplitter) % Input arguments: im - input image (of type double in range 0..1) % N - block_size % haar_4 - haar matrix of size 16x16 % fcnHandleBlockSplitter - function handle to block splitter (see problem 1.1 for signature) % Output argumen...
function SVM = train_allvsall_svm(X, Y, K, kernel, hyperparams, varargin) % X is a matrix of training data, m by N % -- (m examples of dimension N, one example per row) % % Y is an m-dimensional vector of labels in {1, 2, \dots, K} [SVM, Xn] = svm_preprocess(X, 'normalize', true); % We need to build K-1 different b...