text
stringlengths
8
6.12M
function class = algorithm(sig1) X = [real(sig1(1:200)), imag(sig1(1:200))]; E = evalclusters(X,'linkage','silhouette','KList',[4,8,16,32,64]); plot(E) if E.OptimalK==4 class = 1; elseif E.OptimalK ==16 if(abs(hos(sig1,2,0))>0.45) class=3; else if(abs(hos(sig1,4,0))>0.35) class ...
function [ sW_v, nmax ] = psdSWMass( DREMass, k, uN, D_v ) %PSDSWMASS Return Particle Size Distribution based on % Dense Rock Equivalent Mass % Input: DREMass (g) % k: Shape factor % uN: Mode of particle size % D_v: Vector of diamter sizes % Output: sW_v: Vector of particle si...
function [values_spec,n]=getval_spectra_All(P,Q,labelconditions2,label1,s,w,win_size) n=([length(P.(labelconditions2{1}).(label1{w}){s}) length(P.(labelconditions2{2}).(label1{w}){s})... length(P.(labelconditions2{3}).(label1{w}){s}) length(P.(labelconditions2{4}).(label1{w}){s})]); for condition=1:length(lab...
function [bgProb, bdCon, bgWeight] = EstimateBgProb(colDistM, adjcMatrix, bdIds, clipVal, geoSigma) % Estimate background probability using boundary connectivity % Code Author: Wangjiang Zhu % Email: wangjiang88119@gmail.com % Date: 3/24/2014 bdCon = BoundaryConnectivity(adjcMatrix, colDistM, bdIds, clipVal, geoSigma...
function yVal = quadPolation(xPoint, yPoint, xVal) % Function implementing the Quadratic Spline Interpolation % % Input: % xPoint = given set of independent data % yPoint = given set of dependent data % xVal = given value of independent variable % % Output: % yVal = interpolated appx. value of dependent va...
function [UpperX, LeftY, RoiSize] = ConvertROIs(CenterX, CenterY, Options) % UpperX, LeftY, RoiSize] = ConvertROIs(CenterX, CenterY, Options) % inputs: The center of the ROIs in X and Y % Options - a struct with the following fields regarding the % referance stack and wanted ROIs ( = ? is default value...
function rhs = matAssembleRightHandSide(obj) z = obj.meshUnion.z; rhs = eval(obj.SecondDiffCexact); % rhs = -2*ones(size(x)); % Temprhs = diag(obj.meshUnion.J(:,1))*obj.meshUnion.cell.M * rhs; % rhs = Temprhs; % Tempdata = -pi^2/4*sin(-pi/2*obj.meshUnion.x); % rhs = zeros(Np*K, 1); % for i=1:K % rhs((i-1)*Np+1:i*Np...
function [f BlkIdx] = HashingHist(PCANet,ImgIdx,OutImg) addpath('./Utils') NumImg = max(ImgIdx); f = cell(NumImg,1); map_weights = 2.^((PCANet.NumFilters(end)-1):-1:0); % weights for binary to decimal conversion for Idx = 1:NumImg Idx_span = find(ImgIdx == Idx); NumOs = length(Idx_span)/PCANe...
% Inverted Pendulum Parameter File % Physical parameters of the inverted pendulum known to the controller P.m1 = 0.35; % Mass of the ball, kg P.m2 = 2.0; % Mass of the beam, kg P.ell = 0.5; % Length of the rod, m P.g = 9.8; % Gravity, m/s**2 % parameters for animation P.w = 0.02; % Width of th...
function w = SGD(f, v, n, T) w = zeros(1,T+1); for i=1:T x = ceil(rand * size(v,2)); w(i+1) = w(i) - n * f(x); end w = 1/T * sum(w); end
%% GRID SEARCH FOR SVM. DATA IS REBALANCED BY BORDERLINE SMOTE %% Dataset, exploratory data analysis and Method %There are 6497 entries (before removal of missing values and SMOTE), 12 physiochemical wine quality predictors and 1 %target value – the quality of the wine. Continues values would need %to be normaliz...
function [hfig,hax1,hax2,hax3,hplot1,hstem2A,hDottedConnection,hstem2B,hstem3] = createVIPAxaxisFigure(figtitle,expStemCallback,simCallback) if nargin == 1 % Create figure hfig = figure; else hfig = figure('Name',figtitle,'NumberTitle','off'); end % Create axes hax1 = axes('Parent',hfig,... 'Position',[0.0607...
close all clear clc source "./bawm_landmarks.m" #robot pose #Xr = eye(4); Xr = v2t([1;2;3;0.1;0.2;0.3]); ## Z = zeros(15,1); ## Z(1:3,1) = [10;5;4]; ## #RZ = eye(3); ## RZ = Rx(0.5)*Ry(0.6)*Rz(0.7); ## Z(4:12,1) = RZ(:); ## Z(13:15,1)= [1;1;1]; ## Xl = transLand(Z, Xr) ## [e,Jrn,Jln]=landmarkErrorAndJacobian(Xr,Xl...
function varargout = autoFormatFig(varargin) % standardizes a figure to Ben approved specifications %% parse inputs fh = gcf; recolor = true; preset = []; for i = 1:length(varargin) arg = varargin{i}; if ishghandle(arg) switch arg.Type case 'figure', fh = arg; case ...
clc x = [1 2]; y = [56.1 78.6]; %n = 3; % grado del polinomio p = 1.5; % El polinomio se evalua en p (valor a hallar) function suma = lagrange(x, y, p) % Calcule P(p) n = length(x) - 1; suma = 0; for k=1:1:n+1 ter_sig = (multiplique(k, n, p, x))*y(k); suma = suma + te...
function test_divnormpointwise() test_onepixvalues(); test_manybandsize(); end function test_onepixvalues() ims(1, 1, 1) = 10; % three bands of a single-pixel image ims(1, 1, 2) = 1; ims(1, 1, 3) = 1; r = 1; s = 6; expect(1, 1, 1) = 1; % avg=4, plus s=6, makes a denominator of 10 ...
classdef fullyConnected3D < nnet.layer.Layer properties OutputSize end properties (Learnable) % Layer learnable parameters Weights Bias end methods function layer = fullyConnected3D(outputSize,name) layer.Name = name; % Set lay...
%Generate cars, start location and assign reward to the map function map=Q_generateMap(map, hasCars, pNoCarOnRow, fixedStart) if nargin==3 fixedStart=false; end global actionsRewards; [sx, sy]=size(map.Grid); if(fixedStart==false) %set start position at random map.Start=[sx...
% XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MAR_CRI XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX % % Author : Mario Hartanto % Date : Jan 24 2014 % Function : performs fuzzy inference using CRI % Syntax : mar_cri(data_input, net) % % ensemble - FIS net structure % data_input - input data, can have multiple colu...
%% Demonstrate trust region methods %% Setup data for the Rosenbrock function p = problem2d('rosen'); region = [-1.2 -0.8 0.2 1]; x0 = [-1;0.5]; %% Setup data for Trefethen's wild function % You should only execute code for one of these functions. p = problem2d('chebfun_opt_manymin'); region = p.region; x0 = [0; 0.6...
%% decode l2 的期权数据 clear all; rehash; % 输入是经过解码的level2数据,txt格式,按日存储 % 输出是Ticks类,可存成.m % optionDataPath = 'G:\上海9002期权解码数据\'; % date = '20150207'; % path = [optionDataPath , date , '\']; % path = 'G:\逗号分隔期权解码数据\'; path = 'W:\逗号分隔期权解码数据\'; filenames = dir(path); for idt = 23 : length(filenames) if filenames(...
% % ROMS Forcing Fields % =================== % % These functions are used for preparing ROMS forcing NetCDF files. % % % d_core2_frc - Driver template script showing how to create ROMS % forcing NetCDF file(s) using ROMS metadata % structure. The data source is the CORE 2 Gl...
function h9_eqn = h9_eqn(L1,L7,theta3) %H9_EQN % H9_EQN = H9_EQN(L1,L7,THETA3) % This function was generated by the Symbolic Math Toolbox version 7.0. % 22-Oct-2018 17:33:25 t2 = cos(theta3); t3 = sin(theta3); h9_eqn = [0.0;(L1.*7.58692698884342e19+L7.*t2.*7.58692698884342e19-L7.*t3.*5.2272425937558...
function [barPairSortingStructure, numPhases, epochsOfInterestFirst] = SortBarPairBarLocations(params, epochsOfInterestFirst) if nargin<2 epochNames = {params.epochName}; epochsOfInterestFirstLeft = find(~cellfun('isempty', strfind(epochNames, 'L++')), 1, 'first'); epochsOfInterestFirstRight = find(~cellfu...
function [f_1_0, B] = least_square_pond(found_partials) % This function uses a least square to compute the inharmonicity B and % the fundamental frequency (f_1_0) corresponding to the given partials. % found_partials : the computed partials n = size(found_partials,2); % number of partials base = (1:n).'; ...
syms x y z eqn = cos(y)^2+sin(y)^2-z^2+z*z-5*y+6*x; tic simplify(eqn,'Steps',3); toc
clear,close all; clc; points = [245,508,117,592,238,455,335;410,386,321,275,230,214,161]; %% %compute the rate from pixel to distances P1 = [points(1,1) points(2,1)]; P2 = [points(1,2) points(2,2)]; Pixel_D = norm(P1 - P2,'fro'); Real_D = 300*sqrt(2); global rate; rate = Real_D / Pixel_D; %mm %% %get th...
function J_out = eval_J(k,Jcoeffs,Jpowers,N) % J_out = eval_J(k,Jcoeffs,Jpowers,N) % % Given a Jacobian matrix represented as a coefficients matrix and a powers % matrix (see diff_wk_wrt_k), evaluate the jacobian at the point k (2-by-1) J_out = zeros(N,2) ; J_out(:,1) = Jcoeffs(:,1:N)'*(prod(repmat(k',size(Jpo...
% Script for ME 106 Problem Set 5 % Problem 1) % By Chiyu 'Max' Jiang, 03/06/2016 % Time Span: tspan = linspace(0,20,1001); t0 = 0; % Solve 1st Order Diff Eqn Systems [t,x] = ode45(@velocity,tspan,[0;0]); % Plot figure() xlabel('X');ylabel('Y');title('Trajectory of Particle') comet(x(:,1),x(:,2))
function [Y2, F2, B2, E2, r, A2] = oneStepBackMean(s, time, Pe, A0, F0, YDelta, D, r) % oneStepBackMean One-step backward smoothing for point estimates. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %-------------------...
% aggregate stats for each AS according to topology function [data_as] = aggregate_as(data) data_as{1} = data{1}+data{2}; data_as{2} = sum_as(data,3:7); data_as{3} = sum_as(data,8:11); data_as{4} = sum_as(data,12:14); data_as{5} = sum_as(data,15:20); data_as{6} = data{21}+data{22}; data_as{7} = data{23}; data_as{8} =...
figure scatter(1e3*dx*(freq_data.HM_y_max-(Ny/2)),1e3*dx*(freq_data.HM_x_max-(Nx/2)) ); ylabel('x-position [mm]'); xlabel('y-position [mm]'); set(gca,'YDir','reverse'); title('FWHM centre as a function of frequency'); for i = 1:Num_steps+1 txt = sprintf(' %i' ,freq_data.frequency(i)/1e3'); text(1e3*dx*(freq_dat...
function [x, f] = calculatePDF2(sample, nPoints, normalize) %intervallumok s=(max(sample)-min(sample))/nPoints; for i=1:nPoints x(i) = min(sample)+(2*i-1)/2*s; end %minta elemeinek berakása az intervallumokba f(1)=0; for j=1:length(sample) if sample(j)>=min(sample) && sample(j)<=min(sample)+s; f(1)=f(...
clear all; clc; addpath(genpath([cd '\Codes'])); % Graphs path_g = [cd '\Graphs']; imprime = @(x) print( gcf, '-depsc2', [path_g filesep x]); imprpdf = @(x) eps2pdf( [path_g filesep x '.eps']); formataxis = @(x) set(x, 'Fontname', 'Times', 'FontWeight', 'normal', 'Fontsize', 19, 'Box', 'On', 'PlotBox...
function new_q = projection_eval_q( q, normal, points ) % ABSTRACTING PLANE Hx FORMED BY <q, normal>, % 1. Project points onto Hx % 2. Find weighted-squared-distances from projected Hx_points to q end
%% Use a network with 4 binary input elements, %%4 hidden units for the R st layer, and %% one output unit for the second layer. conv = 0; n = 0; while (n <= .5) epochcount = 0; n = n + .05; lrate = n; conv = conv + 1; disp(n) data = [0 0 0 0 0 0 0 0 1 1...
function FFPlotFreq(Outbreak_tot,whichcase,logo) % FFPlotFreq(Outbreak_tot,whichcase,logo) % % Plots outbreak probability as function of Test Frequency and Compliance % or Sensitivity. % % logo = 0: Absolute probability (maximum nomalized to 1) % logo = 1: Log2(Absolute Probability) % logo = 2: Ratio to Best % % load...
%% Genertate a Gaussian Mixture Function(Protein) N = 10; M = 5; radius = 5; range = [-2*M,2*M,-2*M,2*M]; [X,Y] = Generate_Centers(N,M/2); x1 = -2*M:0.1:2*M; y1 = -2*M:0.1:2*M; [x2,y2] = meshgrid(x1,y1); G = Gaussian_Mixture(X,Y); % Fucntion what we want to reconstruct %% Show the 2_D picture figure h...
function obj = setHessianPattern(obj, hes_sp, sp_form) % This function configure the sparsity pattern of the Hessian % of the function % % The form of given sparsity pattern is determined by the input % argument 'sp_form'. It can be one of the followings: % 'MatrixForm': the sparsity pattern is...
function T = repmatPMTK(T, sizes) % repmatPMTK Like the built-in repmat, except repmatPMTK(T,n) == repmat(T,[n 1]) % T = repmatPMTK(T, sizes) if length(sizes)==1 T = repmatC(T, [sizes 1]); else T = repmatC(T, sizes(:)'); end
% best pops why plots %% clear projFilters projFilters = [pMatrixA(:,1:5)]; % % % projFilters = [pMatrixK(:,1:numEigsK) pMatrixH(:,1:numEigsH) pMatrixB(:,1:numEigsB)]; % % projFilterMeans = mean(projFilters); % projFilterStds = std(projFilters); % % projFilters = zscore(projFilters); % % projFilters = [pMatrixA(...
function plotSolution(mesh,nodes,solution) hold off; N = length(mesh(:,1)); CAXIS([0.8 1.2]); for iCell=1:N n = nodes(mesh(iCell,:),:); X = [ [n(1,1) n(2,1)] ; [n(4,1) n(3,1)] ]; Y = [ [n(1,2) n(2,2)] ; [n(4,2) n(3,2)] ]; C = ones(2)*solution(iCell); sur...
clc clear close all load('data_1'); load('data_2'); Fs = 120 ; % sampling rate [Hz] Ts = 1/Fs; % sampling period [sec] t_end=0.2 ; % [sec] t_countinues = 0:1e-4:t_end; t_sampling = 0:Ts:t_end; x_original = data_2; x_sampling = data_1; N = length(t_sampling); % number of samples % x...
%% snaps any state to the center of the appropriate cell in the current grid function X_snapped = snapToGrid(X,grid_eps) % X_snapped = truncate(X./grid_eps).*grid_eps + grid_eps/2; grid_eps_mat = repmat(grid_eps,rows(X),1); % why use truncate when fix is there? % doesn't handle sign(0) properly! returns 0!! % X_snappe...
% SR_DEMO_BATCH % % Example script for super-resolving all images in folder in a batch mode % % Jia-Bin Huang % Electrical and Computer Engineering % University of Illinois, Urbana-Champaign % www.jiabinhuang.com % ========================================================================= % Environment settings % =====...
function o = clamp(in,lowerbound,upperbound); if(nargin == 2) if(length(lowerbound == 2)) upperbound = lowerbound(2); lowerbound = lowerbound(1); end end o = min(upperbound,max(lowerbound,in));
function B = opumbral(I,p) [y, x] = size(I); B = zeros(y,x); for i = 1:y for j = 1:x if I(i,j) <= p B(i,j) = 0; else B(i,j) = 255; end end end B = uint8(B); end
function E = electric_field(Pr,Tr, R, TX, RX,varargin) %ELECTRIC_FIELD Retourne le champ electrique d'une composante multi-trajet % Detailed explanation goes here global beta G_TX P_TX; if ~isempty(varargin) D = varargin{1}; end E = zeros(size(Pr,3),1); %gamma = propagation_...
function [output] = fact(n) n = int32(n); % Screen out non-integers %Do work if (n > 1) output = n * fact(n-1) ; %recursiion else output = 1; %end recursion end end
function im(t,sc) filename=sprintf('t%07d.dat',t); tt=load(filename); n=length(tt); n=sqrt(n); tt=reshape(tt,n,n); % tt=tt-mean(mean(tt)); imagesc((tt')); colorbar; caxis(sc) set(gca,'YDir','normal'); axis square set(gca,'XTick',[1,n]) set(gca,'XTickLabel',{"0","2\pi"}) ...
clear all; close all; fs=1000; f=50; mida=0.1; n=0:fs*mida; y1=sin(2*pi*n*f/fs); y2=sin(2*pi*n*f/fs+pi/2); % senyal desfasada 90º figure(1); % senyals y1 i y2 stem(n, y1); hold on; stem(n,y2); hold off; legend('y1(n)=sin(2pinf/fs)','y2(n)=sin(2pinf/fs + pi/2)'); grid; % correlacio(y1, y2) [c1,lags...
close all; clear all; clc x = [1 3 5 6]; y = [4 8 15 9]; polyfit(x, y, 1) % Doğrusal denklemin katsayılarını verir
% FactorProduct calcula el producto de dos factores % C = FactorProduct(A,B) calcula el producto de dos factores, A y B, % donde cada factor esta definido sobre un computo de variables con dimension dada % La estructura del factor tiene los siguientes campos: % .var Vector de variables en el factor, ...
%Nhom 1 %53 %Pham Ba Tung %B15DCDT221 Xmin=0;Xmax = 10 Ymin =0;Ymax = 10 detalX = 1 detalY = 1 i = Xmin while i <= Xmax i = detalX; j = Ymin; while j <= Ymax j = detalY; fprintf("6.1f" ,(i^2 + j^2) ) end; fprintf("\n"); end;
% Given a (blended) Laplacian pyramid, starting from the smallest scale, % expand it, then add this previous scale. Repeat this until we get to the % original scale and this is the output function [col_output] = collapse(lapl_pyr) lapl_pyr_copy = lapl_pyr; for i = length(lapl_pyr) : -1 : 2 % S...
%% 使用的solve方法求解微分方程的解析解 clc, clear syms x y % 定义符号变量 diff_equ = 'x^2+y+(x-2*y)*Dy=0'; dsolve(diff_equ, 'x') % 此外,还有常微分方程组,齐次、非齐次常微分方程组 % 用时直接查
function [X_estimate,t_b_estimate,length_estimate]=GMTCPHD_estimation(weights_u, means_u,t_ini_u,length_u,Lscan,means_k_old_u,cardinality_u) %Estimation for the GM-TCPHD filter %We take the N highest peaks (according to the maximum of the cardinality) and report the mean of the trajectories at %these peaks %Author: A...
image=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0;% structure A 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0; 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0;% structure C 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0; 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1; 0 0 1 1 1 1 0 0 0 0 0...
% for interface figure(101); nam = char('exper'); ht = uicontrol('Style','text', ... 'Position',[left1 bot4-0.2*bot14 wid1 1.5*height], ... 'String','Name data file',... 'BackgroundColor', roza); hnam = uicontrol('Style','edit', ... 'Position',[left2 bbot4-0.2*bbot16 wid2+0.2 1.5*height], ... '...
function model = generate_model_lin() function frequency = activation(potential) frequency = potential; frequency(frequency < 0) = 0.0; end function I = solution_by_input(model) I = model.mu .* (model.potential .* model.Q + model.thr - model.frequency .* model.alpha ./ model.mu); end model.mu ...
% Plot J_KIR against Kp using v_i % vi_max = vi_max(2:2:end); % vi_min = vi_min(2:2:end); % K_p = K_p(2:2:end); % Extract different parts of graph K_p_oscillations = smooth(K_p(2253:end), 0.1,'rloess').*1e3; K_p_top = smooth(K_p(1:740), 0.1,'rloess').*1e3; K_p_bottom = smooth(K_p(1110:2248), 0.1,'rloess').*1e3; vi_m...
function [y] = funcderiv(a) %this function returns value of derivative in point y = 1.4 * cos(a) - 1.4 * a * sin(a) - 1/a; end
function [fragments, frames] = dicom_encode_jpeg_lossless(X, bits) %DICOM_ENCODE_JPEG_LOSSLESS Encode pixel cells using lossless JPEG. % [FRAGMENTS, LIST] = DICOM_ENCODE_JPEG_LOSSLES(X) compresses and % encodes the image X using baseline lossles JPEG compression. % FRAGMENTS is a cell array containing the e...
polynomialCoefficients = [10 -2 -1 1]; %Defines the polynomial 10 - 2x - x^2 + x^3. startingPoint = 2; tolerance = 0.0001; iterationValues = NewtonRaphson(polynomialCoefficients, startingPoint, tolerance); if (length(iterationValues) > 0) PlotIterations(polynomialCoefficients, iterationValues); end
function [parts] = parts_push(parts) if isempty(parts.trajectories) return; end; parts.trajectories = cellfun(@(t, p) cat(1, t, p), parts.trajectories, num2cell(parts.positions, 2), 'UniformOutput', false); end
classdef EDF8 < handle %UNTITLED Summary of this class goes here % Detailed explanation goes here properties(GetAccess= 'private', SetAccess= 'private') %state vars cur_state; start_state; desired_state; %recorded vars phi; theta; ...
clc, clear load('/Users/jovo/Research/projects/papers/priority/ind_edge_classifier/data/BLSA0317_Count_Lhats.mat') %% % AA=As; for i=1:49 AA(:,:,i)=AA(:,:,i)+AA(:,:,i)'; end A0=mean(AA(:,:,constants.y0),3); A1=mean(AA(:,:,constants.y1),3); eps=1/(10*constants.s); params.lnprior0=log(constants.s0/constants.s); ...
global MPI_COMM_WORLD; load 'MatMPI/MPI_COMM_WORLD.mat'; MPI_COMM_WORLD.rank = 58; Alluxio_Row_mv_version3;
function t = globalGridSearch(t, xyInitialize, gridSpacing, stressCutoff) %xy = globalGridSearch(t, xyInitialize, gridSpacing, stressCutoff) %this function imposes a grid on the bounding box and finds the position on %the grid that minimizes stress for all nodes. It returns that position %for each node. % %kd - ...
%%% Autor: Francisco Rossi %%% Materia: 86.54 - Redes Neuronales, Facultad de Ingeniería (U.B.A) %%% +-+-+-+-+ +-+ +-+ +-+-+-+-+-+-+-+-+-+ +-+ %%% |G|U|I|A| |1| |-| |E|J|E|R|C|I|C|I|O| |4| %%% +-+-+-+-+ +-+ +-+ +-+-+-+-+-+-+-+-+-+ +-+ %%% Temperatura critica en el modelo de Ising 1D %% Cleaning clear all; close all; c...
function [tri_area] = get_TriArea(AB, AC) AB_temp = [AB, 0]; % re-sizing AB to have dim = 3 for cross product AC_temp = [AC, 0]; % re-sizing AC to have dim = 3 for cross product Pgram_area = abs(cross(AB_temp, AC_temp)); % parallelogram area = ||ABxAC|| tri_area = max(Pgram_area/2); % triangle area = h...
function [OE2PTBfit, PTB2OEfit,PTB2OE, maxreconstructionerror ] = sync2OeClock_trial(PDS, filenameE) % SYNCOPENEPHYSCLOCK synchronizes the pdlaps PTB clock with open-ephys recording % Inputs: % PDS - PDS struct (or cell-array of PDS structs) % filenameE - string (or cell-array of strings) path to OE event...
function [b, have, want] = hPassFct1(Hhat, dimWeights) [rows, cols] = size(Hhat); have = rows; want = dimWeights * cols; b = rows >= dimWeights * cols; end
function []=DrawSnowSegment(sx,sy,l,angle); %Drawing a segment of showflake sl = l/( 2 + 2/sqrt(2)); ex = sx+sl*cos(angle); ey = sy+sl*sin(angle); DrawLine(sx,sy,ex,ey); sx = ex; sy = ey; ex = ex+sl*cos(angle+pi/4); ey = ey+sl*sin(angle+pi/4); DrawLine(sx,sy,ex,ey); sx = ex; sy = ey; ex = ex+sl*cos(angle+pi/4-pi/2); ey...
function[F V] = mergevertex(F,V,v1,v2,X) %MERGEVERTEX - merges 2 vertices together %by removing one vertex and have it's neighbors link to the new %the other vertex f1 = V(v1).f; f2 = V(v2).f; fboth = intersect(f1,f2); f1only = setdiff(f1,fboth); f2only = setdiff(f2,fboth); ...
function [ u ] = u_gen( A, ind ) %u_gen Generate u matrix of combinations. % Example: % If A = 2 and ind = 1 : 4, then % u = [0, 0; 1, 0; 0, 1; 1, 1]. % If ind is missing, then return full matrix. if nargin < 2 ind = 1 : (2^A - 1); end u = de2bi(ind, A); end
%% Description % this code generates visiblity field for a target represented by a % gaussian model addpath('..\ASAP1','..\multi_target_tracking\','..\plotregion\'); addpath('..\multi_target_tracking\polytopes_2017_10_04_v1.9') addpath(genpath('..\robot10.1')) addpath(genpath('.\Matlab_Polygons_intersection\')) addpa...
function out = Laplace_unfold_BIDS(manual_masks,output_dir,quantitative_dir,labeldescription_fn,suppress_visuals) % performs laplacian unfolding on the image of manually labelled structures % % INPUTS: % manual_masks: BIDS directory containing manually labelled structures. % This should contain the string 'label-HippUn...
function [ t ] = absolute_scale( t, ground_truth, frame_id, lastframe_id ) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here %% GT pose subject to first frame true = [reshape(ground_truth(frame_id+1,:),[4,3])'; 0 0 0 1]; prev_true = [reshape(ground_truth(lastframe_id+1,:),[4,3])'; ...
function []=exp4(facility,delta,windowtype) % Experiment #4 % ------------- % For gaussian windows, do the resulting offsets depend on the window % sigmas? % Plot offsets versus a global sigma multiplier. % As it turns out, the looks a lot like a step function with the % limit as mult->0 selecting the largest of the t...
function [rx_wave] = wave_awgn_channel(tx_wave,S,SNR) % % Function of the awgn channel of wave % %****************** variables ************************* % tx_wave : the wave at the exit of transmitter % S : the power of symbol % SNR : the signal-noise ratio (E_s/n_0) % rx_wave : the wave at the entrance of receiver % ...
function diplayGraph(handles, coef) if ~isempty(handles.Axes.Graph.Children) delete(handles.Axes.Graph.Children) end if isempty(coef) return end % Seperate the coefficients to get the numbers coef = strsplit(coef{1},{',','\t',' '}); if i...
function this = horzcat(varargin) % A Comprehensive Guide to Object Oriented Programming in MATLAB % Chapter 13 example cStar::horzcat % (c) 2005 Andy Register mismatched = varargin(~cellfun('isclass', varargin, mfilename('class'))); if ~isempty(mismatched) error('MATLAB:UnableToConvert', ... ['Convers...
%% %% Analysis of paralysis caused by muscle expression of HyCal receptor... % & pan-neuronal HyPep %% Pull data for analysis & sort for bar graph order. % assumes 'data' folder in working directory dataDir=fullfile(pwd,'data'); if ~exist(dataDir) dataDir=uigetdir('C:\', 'Where are data?'); end [fileList] = pullEs...
%time_trigger_capturing example T = 0.033; % Period of data capture init_time = 1000*T*floor(t(1)/(1000*T)); buffer_idx = 1; valid_idx = 0; global_timer = tic; for i=1:20 while((elapsed_time = toc(global_timer)) < i*T) read_frame = 1; while (read_frame) if ((t(buffer_idx) >= init_time+1000*((i-1)*T...
%test energy program sphere %z_test = [ rand rand rand]; ebs = 0.00001; H_curva %Hi is at 220th point Fold = H_curvature(220,:); derder = Derivative_Hi (x,v,nt,442,220,A_mat); x(442,:) = x(442,:) + ebs*z_test; H_curva Fnew = H_curvature(220,:); derderder=0; for i_test = 1:3 derderder =derderder + z_test(i_test...
% This script recovers saved annotations from a backup file and uploads % them to the portal. Can be used to complement % saveTrainingAnnotations2File. clear all; % clear all; close all; clc; tic; addpath('C:\Users\jtmoyer\Documents\MATLAB\'); addpath(genpath('C:\Users\jtmoyer\Documents\MATLAB\ieeg-matlab-1.8.3'));...
clear close all %% ---可修改u mix和mix 是否合并所有人的总特征 for u = 2:28 name_mix_En = sprintf('ucd%03d_mixf6_En',u); name_wake_En = sprintf('ucd%03d_wakef6_En',u); name_deep_En = sprintf('ucd%03d_deepf6_En',u); if u~= 4 && u~= 16 %% 以下分出训练集和测试集,合并熵作为特征 %% mix -----------...
function [sibhfs,manifold,oriented] = determine_sibling_halffaces_tet( nv, elems, varargin) %DETERMINE_SIBLING_HALFFACE_TET Determine the sibling half-faces. % DETERMINE_SIBLING_HALFFACE_TET(NV,ELEMS,SIBHFS) Determines the % sibling half-faces. % % SIBHFS = DETERMINE_SIBLING_HALFFACE_TET(NV,ELEMS) % SIBHFS = DETE...
clc clear all close all f=50; t=linspace(-20,20, 500); sig= cos(2*pi*f*t); rect_sig = sig > 0; % Half-Wave Rectification figure plot(t(rect_sig), sig(rect_sig)); grid on
% animal % slice % import path % experimenter % notes % check / insert animal % check / insert slice % insert new session % import data % go directly to new sketch function NewSession(pb,src,event) sexes = {'M','F','Unknown'}; strains = {'C57/BLK6','Other'}; figH = f...
N = 16 fc_q = 1/4 fc_oc = 1/8 time = (0:N-1) x = cos(2*pi*fc_q*time) + cos(2*pi*fc_oc*time) C = [1, -1.848, 1.000465] % 補償項 y(1) = C(1) * x(1) y(2) = C(1) * x(2) + C(2)*x(1) % 做convolution的項次 for n = 3:N y(n) = C(1) * x(n) + C(2)*x(n-1) + C(3)*x(n-2) end subplot(3,1,1);plot(time,x,'.-');title('sinusoid signal combin...
% Crea la matrice di estensione al bordo inferiore di una immagine % % E = MATRIX_EXTEND_BORDERS_DOWN( D, EXT, M, N ) % % D = dimensione della estensione al bordo inferiore % EXT = stringa per il tipo di estensione al bordo inferiore % 'e' = estensione pari % 'o' = estensione dispari % 'z' = zero padding...
function c = modifiedfalsepos(f,xl,xu,max_iter,max_rel_err) if(f(xl)*f(xu)>0) fprintf('Invalid Input\n'); return; end xr=(xl+xu)/2; x(1)=xr; fx=f(xr); N=2; iter=2; error=[]; x1=xr; if(f(xr)*f(xl) > 0) xl=xr; else xu=xr; end if(f(xr)~= 0) while(1) xr = xu + (-f(xu))*((xu-x...
clear all nInstances = 1000; nVars = 25; X = [ones(nInstances,1) rand(nInstances,nVars-1)]; w = randn(nVars,1); y = sign(X*w + randn(nInstances,1)); flipPos = rand(nInstances,1) > .9; y(flipPos) = -y(flipPos); funObj = @(w)LogisticLoss(w,X,y); fprintf('Running L-BFGS\n'); options = []; %options.Met...
function [ score ] = gameStatus( board, agentTurn ) [ x dummy ] = find(board == 0); [ length dummy ] = size(x); if length > 0 score = 5; return; end if agentTurn == 22 [ x dummy ] = find(board == 2); end [ agentScore dummy ] = size(x); agentScore = agent...
function [ X ] = KM(M) % data : cell array that contain location of landmark points. Each cell % array should be 2xn matrix % scf : cell array that contain feature representation of all landmark %----------------------------------------- % load house.mat % data = data(1:2); % scf{2} = [scf{2};scf{2}(1,:)]; % data{2} ...
function [ TrainingData ] = ExpertSystem(Classifier, TrainingData) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here x = -0.05:0.01:0.05; % for mesh y = x; [X, Y] = meshgrid(x, y); Plus = 0; Minus = 0; for i = 1:TrainingData.num fprintf('%d/%d tra...
function BB=templateMatching(I,template) I = rgb2gray(I); template = rgb2gray(template); I = double(I); template = double(template); [height,width] = size(template); every = filter2(template,I); maxVal = max(max(every)); [y,x]= find(every == maxVal); xmin = x - width/2; ymin = y - height/2; BB = [xmin ymin width heigh...
%% LRA METAMODELLING: DEMONSTRATION OF BASIC USAGE % In this example, a Low Rank Approximation (LRA) of the Ishigami function % is computed and the LRA responses are plotted against the actual % responses at a validation set. %% 1 - INITIALIZE THE UQLAB FRAMEWORK AND CLEAR THE WORKSPACE clearvars uqlab %% % set th...