text
stringlengths
8
6.12M
% Command Window % ************** % >> cj = props.examples.CandyJar % % cj = % % CandyJar with properties: % % MaximumAmount: 0 % CandyBrand: '' % CurrentAmount: 0 % % >> cj.CandyBrand = 'Props Pops'; % >> cj.MaximumAmount = 25; % >> cj.CurrentAmount = cj.MaximumAmount; % >> cj....
% Barcode sampling % This script loads in the barcode sampling data which contains raw numbers % of barcodes found in samples at three different time points after initial % barcoding: %OGTP1 = 48h, 3% population which was 19.8x10^6 cells %OGTP2 = 96h, 3% population which was 75.9x10^6 cells %OGTP3 = 144h, 3% populati...
% bitReduction.m % Dan Hirlinger % 1/27/21 % synthesize signal Fs = 48000; Ts = 1/Fs; f = 2500; t = [0:Ts:1]'; x = sin(2*pi*f*t); N = length(x); y = zeros(N,1); % make noise to be added to signal % for dithering % brings down all the harmonics in THD dither = 0.001*randn(N,1); x = x + dither; % alter scale from [-1...
function varargout = plotyyP(input) % input is a struct, with the following mandatory fields: % x,y1,y2,y1lim,y2lim % optional fields: % xlim,xlabel,y1_label,y2_label,xtickpos,Nticks_x,Nticks_y,color_left,color_right,lwidth,fntsz,fnt,Nround % 'x' has to be of the size Nx1, and y1 has to be NxM, y2 has to be Nx...
function result = mycontains(str, pattern) % CONTAINS For pre-2016 matlab try result = contains(str, pattern); catch result = ~isempty(strfind(str, pattern)); %#ok<STREMP> end end
function angle_=constrain(angle) if angle > pi angle_ = angle - 2*pi; elseif angle < -pi angle_ = angle + 2*pi; else angle_ = angle; end end
% 2019-09-13 % Signals and Systems - Introduction to Discrete Time Sampling % Superposition principle % System parameters k = 1.5; % Spring constant b = 0.5; % Damper constant x_0 = 0.5; % Initial position F = 3; % Forcees F = F1 + F2 a = 2; % Simulation setup t_max= 5; T_s = 0.01; % Sampling time n_max = t_max /...
function [] = graficarModelo(modelo) %Respuesta escalar step(modelo) title("Respuesta escalar del modelo") grid on xlabel('Tiempo[s]') ylabel('Volumen') figure() %Respuesta Impulso impulse(modelo) title("Respuesta impulso del modelo") grid on xlabel('Tiempo[s]') ylabel('Volumen') figure() %Respuesta Funcion U t = li...
function obj = require_labels(obj, within, values) % REQUIRE_LABELS -- Remove elements that do not contain labels. % % obj = ... require_labels(obj, 'days', obj('outcomes')) will, for each % 'days', check if all 'outcomes' are present. If they are not, that % day will be removed from the output 'obj'. % ...
% Local Feature Stencil Code % CS 4495 / 6476: Computer Vision, Georgia Tech % Written by James Hays % 'features1' and 'features2' are the n x feature dimensionality features % from the two images. % If you want to include geometric verification in this stage, you can add % the x and y locations of the featur...
function varargout = Generation(varargin) % GENERATION MATLAB code for Generation.fig % GENERATION, by itself, creates a new GENERATION or raises the existing % singleton*. % % H = GENERATION returns the handle to a new GENERATION or the handle to % the existing singleton*. % % GENERATION('CALL...
function [residual, g1, g2, g3] = RBC_DTT11_rep_dynamic(y, x, params, steady_state, it_) % % Status : Computes dynamic model for Dynare % % Inputs : % y [#dynamic variables by 1] double vector of endogenous variables in the order stored % in M_.lead_lag_incid...
function [bestH, numOkMatches_all, numMatches_all, bestScale]= sift_mosaic_fast_MultiModal(im1, im2, saveDir,saveFlag,f1,d1,f2,d2,TransType,rotLimit,featureType) % Matches two images using given precalculated SIFT features %Input: %im1 -- Reference Image %im2 -- Moving Image to be matched %saveMatchesName -- String nam...
% this is a batch to call disc_kinetics3 as a fuction of Ttag clear; close all % tagging times tags = [1 1.2 1.4 3.5] % post inversion delay delays = [0.05 0.1 0.15]; ASLbuffer = []; ASLbase=[]; time = 1:50; legstr = cell(size(tags)); for count=1:max(size(tags)) Ttag = tags(count) % del = delays(count); ...
function kc_format_figure(xlen, ylen, marginsize) set(gcf, 'PaperUnits', 'centimeter'); set(gcf, 'PaperSize', [xlen+2*marginsize ylen+2*marginsize]); set(gcf, 'PaperPosition', [marginsize, marginsize, xlen, ylen]);
function [A_div,A_omegamod,b_bccoeff] = phasor_model_form(K,Ss,xb,yb,zb,bdry_types,varargin) % phasor_model_form: Low-level function which assembles the linear algebra % problem for the steady-periodic groundwater flow equation in 3D on a % finite-difference-type grid with a rectangular prism as boundary. % Bound...
% for proliferation function [Culture,Prol,HP]=proliferation(Culture,Prol,HP,r_n,r_t,cell_cycle) ind=find(Prol>cell_cycle); sz_c=size(Culture); ind=ind(randperm(length(ind))); for k=1:length(ind) [temp_i,temp_j]=ind2sub(sz_c,ind(k)); if Culture(temp_i,temp_j)<0 r_sp...
function coils_new = transform_coil(coils, m_affine, transl, coords, vis) % Transform coil to position and orientation given by a navigation system % % To match transformations from Nexstim navigation to world space of mesh % coordinates generated with SimNIBS, the coil should have the following % initial allignment...
% DEMO for testing MEDA on Office+Caltech10 datasets str_domains = {'Caltech10', 'amazon', 'webcam', 'dslr'}; list_acc = []; mode_new = 'jda'; for i = 1 : 4 for j = 1 : 4 if i == j continue; end if i~= 4 continue; end if j ~= 3 continue; ...
function FINetwork(folderWeights,networkpath,name) repopath = '/Users/jonathangornet/Documents/GitHub/SOSpikingModel/'; addpath(genpath(repopath)); repopath = '/Users/jonathangornet/Documents/GitHub/buzcode'; addpath(genpath(repopath)); %% %folderWeights = ["001","01","1","10"]; Ivals = linspace(0,400,21); %% clear...
%SCRIPT TO PERFORM INNER EM-LOOP FOR ESTIMATION OF %CALCIUM MODELS M ON A SUBSET OF DATA if( exist('setFQ') ~=1 ) setFQ=1; end % frame skipping if( exist('setH') ~=1 ) setH=1; end % spike-history dimensions if( exist('rate_b') == 1 ) rate_b=5; end N_spk=100; % spikes t...
function [matrix] = reduction_2(ma1) ma2 = zeros(4,11); %first col [ma2(1,2),ma2(1,1)] = comp2_2(ma1(1,5),ma1(2,4)); ma2(2,1) = ma1(3,3); ma2(3,1) = ma1(4,2); ma2(4,1) = ma1(5,1); %2 col [ma2(1,3),ma2(2,2)] = comp4_2(ma1(1,6),ma1(2,5),ma1(3,4),ma1(4,3)); ma2(3,2) = ma1(5,2); ma2(4,2) = ma1(6,1); %3rd col ...
function [M,behavior,stim] = GetTimeIndexedData(hfig,isAllCells) %#ok<INUSD> %{ % naming convention used: M = GetTimeIndexedData(hfig); M_0 = GetTimeIndexedData(hfig,'isAllCells'); %} isZscore = getappdata(hfig,'isZscore'); % main data input if ~isZscore, cellResp = getappdata(hfig,'CellResp'); cellRespAvr = g...
clc; clear all close all V = 10; A = 1; b = [.001,.01,.1,1,10]; %b=.001 [X,Y] = meshgrid(-.02:.0005:.02); theta1 = atan2(Y,X+b(1)); theta2 = atan2(Y,X-b(1)); f = V*Y+(A/(2*pi))*(atan2(Y,(X+b(1))))-(A/(2*pi))*(atan2(Y,(X-b(1)))); figure(1) contour(X,Y,f,25,'b'); hold on contour(X,Y,f,[0,0],'r') %b=.01 [X,Y] = meshgri...
function installPath( path ) addpath(path); fprintf('addPath: %s\n', path) % 注意输出格式前须有%符号, end
function W = getSpikeWaveformsFromOps(ops, sp, varargin) % PLOT WAVEFORMS % Inputs: % ops@struct - ops struct % sp@struct - spikes struct % Optional Arguments (as pairs) % 'numWaveforms' - default 500 % 'postSpikeBuffer' - number of samples after spike % 'preSpikeBuffer' - number of samples befor...
%%%%%%%%%%%%%%%%%%%% % 対象:媒質case66 % 設定音速:1580[m/s]=正解音速 % 焦点水平位置:y=0~4.8mm % 境界位置:強度分布により推定 % IMCL割合を0 %に固定する. % 波面遅延プロファイルにより音速推定 % 素子間受信波時間差は解析信号の正規化相互相関(FFTアプローチ)を用いる %%%%%%%%%%%%%%%%%%%% %% 初期設定(共通) clear dst_path = sprintf('H:/result/2018_12_06_IMCL_direct_estimation/case66/2018_12_12_flow'); if ~exist(dst_path,...
function out = todatetime(x, zonePolicy) % Convert values to datetime array % % out = todatetime(x) % out = todatetime(x, zonePolicy) % % TODATETIME converts an input array to a datetime array. It is an alternative % to the datetime constructor, and is provided because MPT thinks Matlab got the % datetime constructor b...
clear all; [original_audio, Fs, nbits] = wavread('sound_test1.wav'); %---------------------------------------------------------------------------- x = original_audio; p = 10; x_corr = xcorr(x,p,'unbiased'); x_corr = x_corr(p+1:2*p+1); x_rhs = x_corr(2:p+1); %x_rhs = x_rhs'; %x_matrix = [x_corr(1) x_corr(2) x_corr(3) x_...
function [result, fnc_compute_brightness, fnc_compute_chromaticity, fnc_gamma_correct, fnc_reconstruct] = evc_gamma_correction(input, gamma, saturate) % Diese Funktion ist die Hauptfunktion. % Sie ruft in der richtigen Reihenfolge die zu implementierenden Funktionen auf. % ACHTUNG: Diese Funktion darf nicht verändert w...
function next_gen = select(p, groups) % 种群个体筛选(轮盘赌),保留每次产生的随机数落入累计概率区间对应的个体 [num_ind, num_features] = size(groups); temp = rand(num_ind, 1); next_gen = zeros(num_ind, num_features); for k = 1 : num_ind for m = 1 : num_ind if temp(k) <= p(m) next_gen(k, :) = gr...
function [J, grad] = costFunctionReg(theta, X, y, lambda) % Initialize some useful values m = length(y); % number of training examples J = 0; grad = zeros(size(theta)); J=-1/m*(y'*log(sigmoid(X*theta))+(1-y)'*log(1-sigmoid(X*theta)))+lambda/(2*m)*sum(theta(:,1).^2-theta(1)^2); grad(1)=X(:,1)'*(sigmoid(X*theta)-y)/m;...
%add selected shots to the dataset %For 18010 % with_trapped_WLAN=[2 16 18 20 21 29 30 31 32 33 35:39 44 45 46 49 56 62 66 71 99]; % with_trapped_WLAN=[2:100]; % with_trapped_WLAN=[2:220]; with_trapped_WLAN=[5 18 23 24 37] % camera='CMOS_WLAN'; camera='CMOS_FAR'; %add the special shots to the dataset % special_struc_i...
# Distance to nearest prime for n = 1:20 d = 0; while (true) if (isprime(n+d) || isprime(n-d)) break; end d = d+1; end fprintf('The distance from %i to the nearest prime is %i\n', n, d); S(n) = d; end display(S);
%% Sistema detecció imatges amb histogrames de color (V1) %Autors: Alba Pérez i Marc Ortiz. %Data: 07/04/2018. %Assignatura: Visió per Computador. %VERSIÓ 6: %Combinar diferents estratègies: %1-Detecció d'equips directes: Barcelona i chelsea. %2-Detecció equips per dos passos: Liverpool + PSV + ACMilan % 2.1- Es det...
function F= myfun_trapfrequency_pseudo2(c,x) % the function of pseudo potential around the position used to calculate trap freuqency % myfun_trapfrequency_pseudo2 include 1.second order 2. cross term 3. first order 4. C0 constant % The difference between myfun_trapfrequency_pseudo is croos term % Psi = c1*(x-c4)...
classdef (Sealed = true) rect_aswp < qes.waveform.waveform % % Copyright 2016 Yulin Wu, USTC % mail4ywu@gmail.com/mail4ywu@icloud.com properties end methods function obj = rect_aswp(ln) if nargin == 0 ln = 0; end obj = obj@qes.waveform.wav...
function [gray] = GetGrayValueImage(bild, wR, wG, wB) x = size(bild,1); y = size(bild,2); gray = zeros(x,y); for i=1:x for j=1:y gray(i,j) = round(wR*bild(i,j,1) + wG*bild(i,j,2) + wB*bild(i,j,3)); end end gray = uint8(gray); end
%LOAD_STARFISH Loads the starfish test image and rescales the dynamic range % % Mehdi Bahri - Imperial College London % July, 2016 O = double(imread('starfish.jpg')); O = normalize_dynamic_range(O);
function RESULT = vuNerveImageAnalysis(X, Seg_X, varargin) % vuNerveImageAnalysis(...) performs analysis on image X, to find nerve % cells, and compute the myelin and axoplasm count per cell. % % SYNTAX: % RESULT = vuNerveImageAnalysis(X, Seg_X) % % OUTPUTS: % RESULT is the analysis results ...
function SubmitJobs_M400() % $Rev: 690 $ % $Author: maxim $ % $Date: 2014-10-28 07:25:19 +0400 (Tue, 28 Oct 2014) $ % Submit Tinker jobs global ORG_STRUC global POP_STRUC for indic = 1:ORG_STRUC.numParallelCalcs whichInd = find([POP_STRUC.POPULATION(:).Folder]==indic); DO_NOW = 0; if isempty (whichInd) ...
% Assignment 02, Exercise 03 by Georgia Markouleki(387232), Manuel Widdel(379704), Mohammad Teimoori(370543) function [ ] = a02e04Surf() x = -15:.2:15; t = (0:.2:10); [X,T] = meshgrid(x,t); count=0; for dim = [0 1;1 0;1 1]' count=count+1; U = a02e04WaveEq(T, X, dim(1),dim(2)); subplot(3,1,count) surf(X...
function [ y ] = IIRfilter( x, theta, r ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here y = zeros; y(1) = x(1) - r*x(1); y(2) = x(2) - r*x(2) + 2*r*cos(theta)*y(1); y(3) = x(3) - r*x(3) + 2*r*cos(theta)*y(2) - (r^2)*y(1); for i = 4:length(x) y(i) = x(i) - r*x(i) + 2*r*cos(theta)*...
function A = computeBlockPeriodicGraphLaplacian(tri,k,b) A = sparse(b*k,b*k); % For convenience, first create the Laplacian matrix of the 3 by 3 block triangulation. % Then use only the middle block to construct A. B = sparse(9*k,9*k); % Make a standard log-normal random matrix of size k by 9*k. % Only part of it wi...
function Wd = dict_learn( X, Wd, alpha, coeff_size, lr, conv_thres, conv_count, max_iter ) %DICT_LEARN Summary of this function goes here % Wd = dict_learn( X, alpha, coeff_size, conv_thres ) if all(Wd(:)==0) Wd=col_norm(rand(size(X,1),coeff_size),2); end; %% disp('Training'); j=0; Wd_diff1=0; count...
function [sum_error]=peuk_error(C_exp) global data sum_error=0; for i=1:length(data(:,1)) sum_error=sum_error+abs(C_exp(1)*data(i,1)^C_exp(2)-data(i,2)); end
clear; a = imread('model-t.png'); a = double(a); k1 = 1.0/8.0 * [1 0 -1; 2 0 -2; 1 0 -1]; gx = double(imfilter(a,k1)); imshow(gx,[]); k2 = 1.0/8.0 * [1 2 1; 0 0 0; -1 -2 -1]; gy = imfilter(a,k2); imshow(gy,[]); gm = sqrt(gx .^ 2 + gy .^ 2); imshow(gm,[]); figure('name','Edge Detection'); title('Edge Detection'); gm2=ui...
% Script to check pixel shift in Alexa channel do to removal of dichroic % mirror on scope 5. Using dftregistration function from https://www.mathworks.com/matlabcentral/fileexchange/18401-efficient-subpixel-image-registration-by-cross-correlation %to register images. % inDirs = {'/Volumes/Blemert12/20191223_TM31_PLX...
function ydot = testfunc(t, y) size(y) y ydot = zeros(size(y)); ydot(1, 1) = y(1, 2); ydot(1, 2) = -y(1, 1); end
function [terrain,terrDeriv] = computeTopoDerivative(TestCase,xlon,DS,RAY) ht = 0.0 * xlon; dhdx = 0.0 * xlon; %% Make a windowing function and its derivative LI = 0.5 * (DS.L - 3 * RAY.width); wdex = find(abs(xlon) <= LI); W = zeros(1, length(xlon)); DW = zeros(1, length(xlon)...
function dydt = nbody(t,y,m) %nbodies with gravity; mass is an array for n masses % [x1, y1, x2, y2, vx1, vy1, vx2, vy2] %nb is the number of bodies % nb is the number of bodies nb = numel(m); % number of space dimensions = nd nd = numel(y)/(nb*2); dydt = zeros(2*nb*nd, 1); for i = 1:nb for j = 1:nd % index rang...
function net = buildAutoencoder( n_in,n_hidden) %│§╩╝╗»autoencoder═°┬š▓╬╩ř net.hidden.w=0.005.*rand(n_hidden,n_in); net.hidden.b=zeros(n_hidden,1); net.out.w=0.005*rand(n_in,n_hidden); net.out.b=zeros(n_in,1); end
function channel_loc2tvs % start at the root and convert the channel_loc.txt files for BIDS % SPM12 dependency folders = dir('sub*') for f=7:length(folders) cd(folders(f).name) file = dir('*.txt') fileID = fopen(file.name); C = textscan(fileID,'%d %f32 %f32 %f32 %s %s'); fclose(fileID); %...
clc; clear all; %%Binarization of Train and Test data load spamData.mat; Xtrain_s = Xtrain; for i = 1:3065 for j = 1:57 if Xtrain_s(i,j) > 0 Xtrain_s(i,j) = 1; else Xtrain_s(i,j) = 0; end end end Xtest_s = Xtest; for i = 1:1536 for j = 1:57 ...
classdef FiniteFieldPoly properties field; end properties (Constant) zero = -Inf; one = 0; end methods function obj = FiniteFieldPoly(p,n) obj.field = gftuple((-1:p^n-2)',n,p); end end methods (Static) function r = add...
function repo_data = find_dependencies(repo_data) % Works through the function names in repo_data and finds the dependencies % between them. % % Args: % repo_data (structure): all functions found by the indexing routine. % Example: repo_data = find_dependencies(repo_data) disp('Calculating dependencies...'); for ...
function x = Continuation( fun, jac, x0, N) % Continuation homotopy continuation method. % X = Continuation(FUN, JAC X0, N) starts at the column vector X0 and % tries to solve the equations in FUN. FUN accepts input X and returns % a column vector of equation values FUN evaluated at X. JAC accepts % input ...
function [output,err] = classifier(resps1,resps2) % var 'mat' = 100 (neurons) x 401 (responses at each stimulus) % var 'resps1' = 500 (poissrnd responses) x 100 (each neuron) @ -0.1 deg % var 'resps2' = 500 (poissrnd responses) x 100 (each neuron) @ +0.1 deg training = [resps1(1:400,:); resps2(1:400,:)]; sample = ...
function n = psopendoc(f) %PSOPENDOC Open the file in Photoshop. % N = PSOPENDOC(F) F is the full path to the file. N is the resulting % name of the document. % % Example: % n = psopendoc('C:\MyFile.jpg') % % See also PSSETACTIVEDOC, PSCLOSEDOC, PSDOCNAMES, PSNEWDOC, % PSNEWDOCMATRIX, PSNUMDOCS, PSHISTOG...
classdef NdgNonVisSolver %NDGNONVISSOLVER 此处显示有关此类的摘要 % 此处显示详细说明 properties end methods function obj = NdgNonVisSolver( phys ) %Doing nothing end function matEvaluateRHS( obj, fphys ) %doing nothing end ...
function [results_SMF, results_NO_SMF, aic_scores] = fit_models(path) %wrapper: Wrapper function that calculates negative loglikelihoods and %AIC scores for different models %load data df = readtable(path); df = table2array(df); %columns for indexing sub = 1; act1 = 2; state2=3; act2= 4; reward = 5; turn_index ...
function [H,s,ang,t,R] = IRL_TformToSRT(H) %Convert a 3-by-3 affine transform to a scale-rotation-translation %transform. % [H,S,ANG,T,R] = IRL_TformToSRT(H) returns the scale, rotation, and % translation parameters, and the reconstituted transform H. % Scale modification by Scott - based on cvexTformToSRT % Extrac...
close all clear all clc % % function simmap1() [filename, pathname]=uigetfile('*.*','Select a image'); if isequal(filename,0) || isequal(pathname,0) fn='D:\FYP\h1.jpg'; else fn = fullfile(pathname, filename); end a=fn; imshow(a); [m1,n1,o1]=size(a); mapsize=input('Enter the Scale Factor '); m2=m1*map...
close all clear clc l = 0; % shows that 0.005 tolerance and lower resolution solution is just as good % as higher resolution (v7 is low) %RBC_core = {'With1Hgb_v6','With1Hgb_v7'} t_end = 180 clear WF m_f m_fr dt = 0.01; LineColor = {[1 0 0],[0 0 0],[1 0 1],[0 0 1/2],[1 0 0],[0 0 0],[1 0 1],[0 0 1/2],[0...
%%%% Nominal parameters of the AD model P_env=95; % Environmental stress load gamma_B=1; % Barrier-mediated inhibition of pathogen infiltration kappa_P=0.6; % Nominal skin permeability alpha_I=0.25; % Rate of pathogen eradication by innate immune responses delta_P= 1; % Basal pathogen death rate kappa_B=0.5; %Ba...
function Rinsel_paper(fig_list, out_path, collation, fh) % if ~exist('fh', 'var'), fh = []; end; script_dir = fileparts(which(mfilename)); rilling_dir = fullfile(script_dir, '..'); analysis_dir = fullfile(rilling_dir, 'analysis'); addpath(genpath(fullfile(rilling_dir, '_lib'))); addpath(genpa...
function [data,b_upper_plot,b_lower_plot,b_xfit,b_y] = NP_bin_param(x_param,y_param,w,xfit,opt) % NP_bin_param - To divide the dependent pRF parameter into different bins and calculate the mean of the % independent pRF parameter in the bins. % % if ~exist('w','var') || isempty(w) w = ones(size(x_param)); end x_T...
function Cord = line2dot(line) % Function to find the coordinates of points with a line specified by the % coordinates in the matrix line. % INPUT: line, matrix with 4 columns, corresponding to % [X_start, Y_start, X_end, Y_end] % OUTPUT: Cord, matrix with 2 columns. Each row has the x and y coordinates % ...
function[active, infected] = exp_susceptible_spread(G, start_node, ... full_soc, p, is_susceptible, niter) active = zeros(niter, 1); infected = zeros(niter, 1); parfor i = 1:niter [num_active, num_infected] = ... susceptible_spread(G, start_node, full_soc, p, is_susceptible); active(i) = num_active; ...
clc; addpath('lib'); addpath(genpath('textures')); %Lectura archivos de prueba test=dir('textures/test'); testname = extractfield(test,'name'); testname=testname(3:end-1); %Numero de clasificadores a=30; %Numero de grupos b=10; %Imagenes por grupo c=25; %Numero de bins k = 16*4; %almaceno clasificacion de cada i...
function spc_deletepolyLines; global spc; global gui; delete(findobj('Tag', 'poly'));
function cal = checkDispComp(test_frame, cal) %checkDispComp Checks the quality of the dispersion compensation and %improves it if necessary % todo: dispersion compensation part of cal could be optional % Dispersion compensation idx = cal_idx(cal, 'user'); Gc = cal(idx).Gc; p = 1:length(Gc); k0 = max(p)/2; % Wave...
% Starting in the top left corner of a 2×2 grid, there are 6 routes % (without backtracking) to the bottom right corner. % % How many routes are there through a 20×20 grid? % Ans: 137846528820 size = 2; nchoosek(2 * size, size) size = 20; sym( nchoosek(2 * size, size) )
%%scale image with a scale factor %function result = scale(img,factor) %img is a image %factor is a scale factor %result is a image multiply by a scale factor %example: %img = imread('xxx.jpg'); %img1 = scale(img,0.5); %img2 = scale(img,1.5); function result = scale(img,factor) %scale image factor result = ...
%% sosproof clearvars; clc; %Define a polynomial with its variables------------------------------------ pvar x1 x2; f =2*x1^4*x2^2+2*x1^2*x2^4+4*x1^2*x2 +2; %Check if f is %SOS----------------------------------------------------------------------- [feas,x,P] = issos(f); % if feasible display x,P such that xtrans*P*x...
%% Detecting Discontinuities and Breakdown Points % Signals with very rapid evolutions such as transient signals in dynamic % systems may undergo abrupt changes such as a jump, or a sharp change in % the first or second derivative. Fourier analysis is usually not able to % detect those events. The purpose of this examp...
function [eeSeq, matSeq] = tableSeqs(n) % 杨辉三角递推求EE序列和矩阵行数序列(后者已弃用) %{ 第一行是C_0^0,生成C_0^0到C_n^m的杨辉三角表。 params: n: 代表最大的待选取物品数 return: eeSeq: 由矩阵交互生成的ee数所组成的序列 matSeq: 矩阵行数序列 %} table = zeros(n+1,n+1); % 初始化递推表 for i = 1:n+1 table(i,1) = 1; table(i,i) = 1; fo...
%NEULERSED Método de Euler para SED. % [t,u,v] = NEulerSED(f,g,a,b,n,u0,vo) % u'= f(t,u,v), v'=g(t,u,v), t=[a, b], u(a)=u0 e v(a)=v0 % %INPUT: % f, g - funções do 2.º membro das Equações Diferenciais % [a, b] - extremos do intervalo da variável independente t % n - número de subintervalos ou iteraç...
function [x,y,u,v,w, vnames] = readDAT(files,quiet) if (nargin == 1), quiet = 0; end; if (ischar(files)), files = {files}; end; if (~quiet & (length(files) > 1)), showwait = 1; timedWaitBar(0,'Loading files...'); else showwait = 0; end; for i = 1:length(files), fid = fopen(files{i}); ln ...
function [ feature ] = image_feature_vector2( I ) %UNTITLED Summary of this function goes here % Detailed explanation goes here I = double(I); sizeI = size(I); a = floor(sizeI(1)/3); b = floor(sizeI(2)/3); j = 1; i = 0; feature = []; for k = 1:9 i = mod(i, 3) + 1; ...
function build_tens_mat CT = []; CR = []; CB = []; for i = 1:size(lprojs, 2) l1 = lprojs(:, i, 1); l2 = lprojs(:, i, 2); l3 = lprojs(:, i, 3); l4 = lprojs(:, i, 4); t_mat = util.cpmat(l1)*(l2*l3'); r_mat = zeros(3, 9); r_mat(1, 1:3) = -l2(...
%run('vlfeat-0.9.20/toolbox/vl_setup') load_vis = true; load_cla = true; load_lab = false; save_visual_dict = false; save_classifier=false; save_labels= true; %CNN variables %... tic; %im = imread('Caltech4/ImageData/airplanes_test/img001.jpg'); vocab_size = 400;%400, 800, 1600 train_percentage = 0.5;%0.5 color_type...
%----------------------------Funciones Aritmeticas---------------------------------------% ceil(x) %Redondea al entero mas cercano hacia el infinito positivo del valor de x fix(x) %Redondea al entero mas cercano hacia cero del valor x floor(x) %Redondea al entero mas cercano hacia menos infinito del valor de x mod(...
function CC_check_missing_runs data = importdata('../doc/CC_bipolar_label_counts.log',','); strs = cellfun(@(x) regexp(x,'_','split'),data.textdata(:,1),'uni',0); strs(1) = []; subs = cellfun(@(x) x{1},strs,'uni',0); runs = cellfun(@(x) x{2},strs,'uni',0); runs = str2double(runs); allsubs = unique(subs); for isub = 1...
function [ im, theta ] = imdeskew( src, max_angle , resolution) if nargin <= 1 max_angle = 50; resolution = 1; elseif nargin <= 2 resolution = 1; else %error('unsupported input format') end % input settings if size( src, 3 ) > 1 gray = rgb2gray( src ); src = gray > gra...
% Physical Costants - SI %%%%%%%%%%%%%%%%%%%%%%%% % Returns value of physical constants in SI % Example Usage: % % load physicalConstants-SI.mat % Load all variables % load physicalConstants-SI.mat me c % Load electron mass and light speed %%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2021 Rishabh Datta, MIT %%%%%%%%%%%%%%%%%%...
function [c,ceq,dc,dceq] = Cfun(Z,ac,N,D) VR = Z(end-1); tfin = Z(end); Psi0 = Z(end-2); t = ((tfin/N)*(1:N))'; % X = [u,v,w,p,q,r,Phi,Thet,Psi,x,y,z,df,da,de,dr,CTx,CTy] X(N,16) = 0; for j = 1:16 X(:,j) = Z((j-1)*N+1:j*N); end X(:,9) = X(:,9) + Psi0*t; F(N,12) = 0; ...
clc clear all fm=1;%defining fm fs=20*fm;%defining fs t=-3:(1/fs):3;%defining t am=1;%defining am m=am*cos(2*pi*fm*t);%the message signal del=(2*pi*fm*am)/fs;%defining del %Running a for loop for i=1:length(t) if(i==1) mq=0; d(i)=m(i); dq=(sign(d))*del; mq=dq; else d(i)=m...
function [Vs,Ds]= eigensorted(A) [V,D] = eig(A); [d,ind] = sort(diag(D),'descend'); d ind Ds = D(ind,ind); Vs = V(:,ind); end
addpath(genpath('/home/Pedestrian/Documents/PycharmProjects/Incremental_Learning_for_Detection/edges')); addpath(genpath('/home/Pedestrian/Documents/PycharmProjects/Incremental_Learning_for_Detection/piotr_toolbox/toolbox/')); voc_dir = '/home/Pedestrian/Documents/PycharmProjects/Incremental_Learning_for_Detection/dat...
clc; clear; dim = 1000; dens = 0.1; rc = 0.6; kind = 1; sparse_matrix = sprandsym(dim, dens, rc, kind); full_sparse = full(sparse_matrix); tic; L = chol(full_sparse); toc; block_dimension = 10; A_11 = full_sparse(1:block_dimension,1:block_dimension); A_12 = full_sparse(1:block_dimension,block_dimension + 1:end); A...
function [in,xx,m_SetElem,f,funbc,e_DatSet,e_VG] = read_data(file,path_file) %****************************************************************************************** %* FUNCION DE LECTURA DE DATOS Y GENERACION DE VARIABLES PRINCIPALES * %* ...
x=-pi:.01:pi; y=f(x); plot(x,y);
%% pedigree % gets classification tree of a taxon %% function [tree, nm, val, units, label] = pedigree(taxon, var) % created 2015/09/18 by Bernd Brandt; modified 2017/12/14 by Bas Kooijman %% Syntax % tree = <../pedigree.m *pedigree*> (taxon) %% Description % gets a tree of all species in the add_my_pet collection ...
%% RBES_Select_LaunchVehicle.m function [lv,pack_factor] = RBES_Select_LaunchVehicle % global params r = global_jess_engine(); %% Run lv RBES r.eval('(focus LV-SELECTION)'); r.run(1000); [~,lv] = get_all_data('MANIFEST::Mission',{'launch-vehicle'},{'single-char'},0); [~,values] = my_jess_query('MANIFEST::Mission','lv-...
function sub_payoff = subframe_payoff(parent) % 单账户管理-组合损益作图 %sub_single_sub_payoff = subframe_single_subframe_payoff(parent) % 吴云峰 230170318 sub_payoff.parent = parent; % payoff的作图句柄 sub_payoff.axes_payoff = axes('Parent', parent, 'Units', 'Normalized', ... 'Position', [0.07 0.08 0.9 0.85], 'FontSize' , 9 , 'Fon...
%LAB03 clear all; close all; clc x = load('xNew.dat'); y = load('yNew.dat'); theta = zeros(3,1); m = length(x); x = [ones(m, 1), x]; pos = find(y==1); neg = find(y ==0); %Procedure 3.1 plot(x(pos, 2), x(pos, 3), ('*')); hold on plot(x(neg,2), x(neg,3), 'o'); xlabel('Exam 1 Score'); ylabel('Exam...
function z = isocomplex(q, a) % ISOCOMPLEX Construct a complex number from a quaternion, with the same % modulus and argument as those of the quaternion. The result % will be in the upper half of the complex plane unless the % second (optional) parameter is supplied - in thi...
function results = util_find_maxlength_of_chs( SPT ) %UTIL_FIND_MAXLENGTH_OF_CHS 工具函数:利用MCS信息,找到Spike Table中最长的通道 % 给出Spike Train中Spike数目最多的通道 % 结果是以hwid给出,需要转换 % % 蒲江波 2008年 (为Gap Junction Paper编写的工具函数) max_length_of_channels = 0; for i = 1:64 if max_length_of_channels < length( SPT{i} ) ma...
function [Q,S] = Q1(A,b,n) j = length(A); if nargin < 3, n = j; end b = b/norm(b); Q = zeros(j,n); Q(:,1) = b; S = zeros(min(n+1,n),n); for k=1:n z = A*Q(:,k); for i=1:k S(i,k) = Q(:,i)'*z; z = z - S(i,k)*Q(:,i); end if k < j S(k+1,k) = norm(z); if S(k+1,k...