text
stringlengths
8
6.12M
%按照序号顺序排列各节点R值、V值(展开为长向量) function [R_list,V_list] = calc_RV_list(R,V) R_list=[];V_list=[]; for i = 1:length(R) % for j = 1:length(R{i}) R_list=[R_list,R{i}]; V_list=[V_list,V{i}]; % end end end
function y = flow_projection(start,end_point, index, theta) % function y = flow_projection(start,end_point, index, theta) % % letting the flow starting at start and flowing linearly to end_point % intersect the hyperplane defined by x(index) = theta % INPUT % start element of R^(MxN)+ % end_point sink of th...
% Copyright 2018-2020, by the California Institute of Technology. ALL RIGHTS % RESERVED. United States Government Sponsorship acknowledged. Any % commercial use must be negotiated with the Office of Technology Transfer % at the California Institute of Technology. % ------------------------------------------------------...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2012 Analog Devices, Inc. % % Licensed under the Apache License, Version 2.0 (the "License"); % you may not use this file except in compliance with the License. % You may obtain a copy of the License at % % http:/...
function res = imshowScaled(image,low,high) % imshowScaled: displays image with low and high (fractional) values specified % PURPOSE: read, scale, and display an image % (well, add a choice to scale or not, later) % low and high are proportions of the range, not intensity values % A=imread(image); if high<l...
function [pose] = find_closest_data_points(pose, view_axis, settings) D = settings.D; %% Inpaint I = pose.back_map_for_rendered_data(:, :, 1); [H, W] = size(pose.rendered_data); for h = 1:H for w = 1:W if pose.rendered_data(h, w) == 0; continue; end if I(h, w) ~= 0; continue; end [u, v] = i...
function [cI] = crop2(im) % This function allows you to crop a square of the image of % the hand according to the points drawn. % Grayscale I = rgb2gray(im); % Find the 4 corners [C1,C2,C3,C4] = searchCorner4(im); % Put the points in order % Sorting by x G1 = [C1(1),C2(1),C3(1),C4(1)]; G2 = [C1(2),C2(2),C3(2),C4(2)...
% MUTUAL INFORMATION DECAY cd('/Users/carolinaditella/Dropbox/Social Preferences/Trial Selection - Study 1') load ('SCORES.mat') figure plot(1:2934, ordered_scores+log(3),'k','LineWidth', 2); hold on plot([100 100],[0 0.25],'Color',[160 160 160]/255); %, 'LineStyle','--' title('Mutual information decay') xlabel('Ran...
clc;clear %Variables c01 = 10; c03 = 20; %known concentration variables Q01 = 5; Q03 = 8; Q15 = 3; Q12 = 3; Q31 = 1; Q23 = 1; Q25 = 1; Q55 = 2; Q54 = 2; Q24 = 1; Q34 = 8; Q44 = 11; %known flow variables syms c1 c2 c3 c4 c5 %symbolic variables for concentrations we're looking for %Equations for each reactor eq1 = Q...
%% KalmanBaB.m % Testing to see whether or not the filter will work real time %% Live Run no Filters cs.interv = 200; input(1:cs.interv) = cs.balanced; pos(1:cs.interv) = 0; t(1:cs.interv) = 0; [pos(1), ~, ~] = getPos(cs.a, cs.sensorPin1, cs.sensorPin2, cs.n_startup, cs.interp.interpTable); cs.weightNew = 1; cs.wei...
% Find when the subject is standing in a sit-to-stand exercise based on: % a. Force Threshold % b. Right and Left Knee angles % figure(1) % plot(ModelOutputHelp.Var3{15,1}(:,end), 'r') % plot(ModelOutputHelp.Var3{14,1}(:,end), 'b') %Directions x=1; y=2; z=3; direction=x; clf figure(1) hold on plot(Mod...
%% patch2EdgeIm % Below is a demonstration of the features of the |patch2EdgeIm| function %% % clear; close all; clc; % Plot settings for the examples below figColor='w'; figColorDef='white'; fontSize=10; faceAlpha1=1; faceAlpha2=0.3; %% EXAMPLE 1: CONVERTING A PATCH TYPE SURFACE TO AN EDGE IMAGE WI...
clc; nsamples = 100000; smpl = zeros(nsamples,2); s = 0.9; proppdf = @(x,y) unifpdf(y-x,-s, s); proprnd = @(x) x + rand*2*s - s; for i = 1:nsamples pdf = @(x)(((x>=0)&(x<=1))* (x.^3)); smpl(i,1) = mhsample(rand,1,'pdf',pdf,'proprnd',proprnd,'proppdf',proppdf); pdf = @(x) (((x>=0) & ...
function [ vol ] = BF_3D( vol, radius, r_sig, d_sig ) % 3D Bilateral Filter % Ref: % C. Tomasi and R. Manduchi % "Bilateral Filtering for Gray and Color Images" % Proceedings of the 1998 IEEE International Conference on Computer Vision % % Inputs: % vol: grayscale image to filter % radius: filter radius % r_sig: photom...
W = train_lr; load ('Y.mat'); row_=zeros(11,1); row_(2)=150; row_(3)=150; row_(4)=150; row_(5)=150; row_(6)=150; row_(7)=150; row_(8)=150; row_(9)=150; row_(10)=150; row_(11)=150; [row1,col1]=size(Y); T=zeros(row1,1); r=1; for i=1:10 for j=1:150 T(j+(i-1)*150,1)=i; end end activ...
function ind_set=find_Indcernability(table) %============================================================================================================================= % This function calculates the sets of 'B' indecernable example(or objects) where 'B' is a subset of Total attribute set 'A' % (creates the...
function [ tN,wN,hN ] = paso_RK23( f, tj, wj, hj, tol) %in: tj ... tiempo viejo % wj ... aprox. vieja % hj ... paso sugerido % tol ... tolerancia para error relativo % f ... lado derecho de la EDO (como funcion) % %Out: tN ... tiempo despues de est...
% creates and initializes various robot parameters function robot = createRobot( initialGroundTruth, initialPoseError, encoderError, sensorError, distanceBetweenWheels, robotID ) % forces randn to produce different set of numbers... % each time the randn is called rng('shuffle'); % distance between the two w...
% (a) K = [1000*0.5*2, 0; 0, 1000*1*2]; % (b) X = zeros(2, 12); for i=0:1:11 X(1,i+1) = 0.01 * cos(2 * pi * i / 12); X(2,i+1) = 0.01 * sin(2 * pi * i / 12); end F = K*X; % (c) figure(); quiver(X(1,:), X(2,:), 1000*X(1,:), 1000*X(2,:)); axis equal hold on quiver(X(1,:), X(2,:), F(1,:), F(2,:)) xlabel('x positi...
function addRigboxPaths(savePaths) %ADDRIGBOXPATHS Adds the required paths for using Rigbox % % Part of the Rigging toolbox % TODO: % - Paths to 'cortexlab' and 'cb-tools' were incorrect % - Consider renaming above folder to something more informative % % 2014-01 CB % 2017-02 MW Updated to work with 2016b if nargi...
% Copyright (c) 2017 Zi Wang function [f, g] = evaluatePI(x, xx, yy, KernelMatrixInv, l, sigma, sigma0) % This function computes the acquisition function value f and gradient g at % the queried point x using PI given sampled function values maxes, and % observations Xsamples (size T x d), Ysamples (size T x 1). if nar...
%% HMDGazeDirection % % Provides properties for the HMD gaze direction. % % hmd_gaze_direction = HMDGazeDirection(unit_vector,... % validity) % %% classdef HMDGazeDirection properties (SetAccess = protected) %% UnitVector % Gets the 3D unit vector that describes the ga...
function res = computeO1X2(A1, A, D1, D, O) [o x] = size(O); d = size(D1,1); res = zeros(o, x); for ind_o1 = 1:o for ind_x2 = 1:x for ind_d1 = 1:d for ind_x1 = 1:x res(ind_o1, ind_x2) = res(ind_o1, ind_x2) + ... O(ind_o1, ind_x1) * A(ind_x2, ind_x1, ind_d1) * D1(ind_d1, ind_...
function [MinPixVal, MaxPixVal]=max_min_pix_value(im_array); % function [MinPixVal, MaxPixVal]=max_min_pix_value(im_array); % % function for calculating most often occuring Min and Max intensity values % in images % Perfromed by calculating means of pixels within the moving boxes of 5x5 pixel size throughout the ...
function M0 = Consis_term(C,ne,np,p,Verts,Xe,he) % Function calculant le terme de consistance pour l elasticite orthotrope % 2D: M0 % SYNOPSIS: M0 = Consis_term(C,ne,np,p,Verts,Xe,he); % INPUT : C : la matrice des deformations .ne : nbre de noeuds % np : nbre de monomes .p :...
function RTrec=NMES_ResultadoTrechos(R,vol,prot) param={'ErroAbsMedio','EM','ErroMaxPos',... 'ErroMaxNeg','ErroSTD','ErroMax'}; clear tempV RMT tempV=[]; for pr=1:length(prot) % para todos os protocolos for pa=1:size(param,2) % para todos os parametros for v=1:length(vol) % para todos os voluntarios ...
function fcns = inputProcessingFcns(net) % Copyright 2012-2015 The MathWorks, Inc. fcns = {}; for i=1:net.numInputs fcns = [fcns net.inputs{i}.processFcns]; end fcns = unique(fcns);
function [backColor] = background(image) hSize = size(image, 2); vSize = size(image, 1); colors = zeros(256, 256, 256); for i = 1 : vSize for j = 1 : hSize c = int16(reshape(image(i, j, :), 1, 3)) + 1; colors(c(1), c(2), c(3)) = colors(c(1), c(2), c(3)) + 1;...
clear all; N = 64; fin=fopen('cam1_64_64.raw','r'); I=fread(fin,N*N,'uint8=>uint8'); ft_Z=reshape(I,N,N); ft_Z=ft_Z'; im = ft_Z; %subplot(1,2,1); imshow(ft_Z); for i = 1:64; f = fft(im(i,:)); for k = 1:64; f(k) = f(k) * exp((-j*pi*(k-1))/128); if k == 1; f(k) *= 0.5*((1/64)^0.5); ...
function label = label_identify(person, file_vector) %Creates label with 1 for person of interest and 0 for the rest label = 1-2*cellfun('isempty', strfind(file_vector, person)); end
N = 256; x = randn(1,256); X = fft(x); result = conj(fliplr(X(2:end)))-X(2:end); figure(1) hold on subplot(2,1,1); stem(x) title('Original Signal - Warmup a') xlabel('Time (sample)') subplot(2,1,2); stem(result); title('FFT of Signal - Warmup a') xlabel('Sample (value of k)') Y=(randn(1,256)+1i*randn(1,256))/sqrt(2)...
function [centers, radii] = initialize_model_centers(points, num_centers) P = zeros(length(points), 3); for i = 1:length(points) P(i, :) = points{i}'; end %% Initialize centers = cell(num_centers, 1); radii = cell(num_centers, 1); figure; subplot(1, 2, 1); hold on; axis equal; %xlim([0, 1]); ylim([0, 1]); scatte...
function [dV,dF,b] = lazy_cage(V,F,m,varargin) % LAZY_CAGE Build a cage that strictly encloses an input triangle soup. This % is lazy because it's reducing the problem to a 1D search rather than an % optimization like "progressive hulls" or "nested cages". Also it was easy to % implement with existing tools. ...
function dy = AND_gate_ode(t,y) a=1;b=2;c=3;ANDgate_A_C__c=4;ANDgate_B_C__c=5; ANDthd_C=6; k_app=2*10^5; k_app_thd=10^6; dy=zeros(6,1); dy(a)=-k_app*y(a)*y(ANDgate_A_C__c); dy(b)=-k_app*y(b)*y(ANDgate_B_C__c); dy(c)=-k_app_thd*y(c)*y(ANDthd_C)+k_app*y(a)*y(ANDgate_A_C__c)+k_app*y(b)*y(ANDgate_B_C__c); dy(ANDgate_A_C...
%in barnamei baraye Gamma corection dar tasvir ast,BARAYE %EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command %Window MATLAB PASTE KONID,SEPAS YEK ADAD BARAYE ZARIB Gamma BEDAHID. clc; clear all; close all; %tasvire vorudi IN_IMG = imread('1.1.tif'); %IN_IMG = imread('1.2.tif'); %ijade zarib...
function metadata = get_xml_content(xml_file,metadata_template) % GET_XML_CONTENT - Load sound metadata from XML file. % % Usage: metadata = get_xml_content(xml_file,metadata_template) % % Define maximum number of elements in the temporal evolution matrix MAX_EVO_ELEMENTS = 3700; % Check input args if ~exist(xml_f...
function refocused_Im = refocus(LF, slope) [U, V, row, col, ~] = size(LF); M = U * V; LF_Image = zeros(M, row, col, 3); for u = 1 : U for v = 1 : V k = (u-1)*V + v; LF_Image(k, :, :, :) = squeeze(LF(u, v, :, :, :)); end end clear LF shifted_Imr = zeros(M, row, col); shifted_Img ...
% Figure 3.19 Feedback Control of Dynamic Systems, 5e % Franklin, Powell, Emami %script to generate Fig. 3.19 % fig3_19.m clf; num=[2 1]; % form transfer function den=[1 2 5]; sys=tf(num,den); % form system t=0:.1:6; % define time vector y=impulse(sys,t); %compute impulse...
%{ this is my code applied to Stathis's Experiment structures after I updated them using the TSupdateStructure function so that the current (10/23/2019) TSlib code works with them. For expository reasons, the numbering of the groups in the MS differs from the numbering in this script: Group 4 from what was originally ...
% Ce script Matlab automatise la production de resultats % lorsqu'on doit faire une serie de simulations en % variant un des parametres d'entree. % % Il utilise les arguments du programme (voir ConfigFile.h) % pour remplacer la valeur d'un parametre du fichier d'input % par la valeur scannee. % %% Parametres %% %%%%%%...
addpath('../control') addpath('..') addpath('../plotting') global params; params.Kp_h = 10; params.Kd_h = 5000; params.Ki_h = 5; g = 9.8; m = 1; R = 0.1; x = 0; y = 0; v_y = 0; a_y = 0; h_desired = 2; lift = 0; dt = 0.02; y_last = 0; lift = 0; t = 0:dt:20; y_a = zeros(size(t,2)); tic for i = 1 : size(t,2) lift = h_pid...
function wipe close all clear clc end
% idfig06 -- Ideal Figure 06: Ideal Damping in Wavelet Domain % % The ideal reconstructions of figure 5 depicted in % the wavelet domain. The reconstructions have a sparse % wavelet transform. % global whblocks whbumps whheavi whDoppler global L % clf; claxis % subplot(221) IMJPlotWaveCoeff(whblocks,L,0.05); ...
%Despiking_UFF clear all;close all; letras= 13; %MODIFICAR %abertura do arquivo contendo o nome dos arquivos de CTD com extensão fid=fopen('estaçoes.txt','r'); name=fscanf(fid,'%s',[letras inf]); name=name'; fclose(fid5);fclose(fid6);
function Lvv = Lvvtilde(image, shape) % Makes sure the shape is set to 'same' if (nargin < 2) shape = 'same'; end % Difference approximations of first order derivative dx = padarray([1/2, 0, -1/2], [2, 1], 0, 'both'); dy = padarray([1/2, 0, -1/2]', [1, 2], 0, 'both'); % Difference approximations of second ord...
format long; %{ % load('EE_max of PRO in ROPRO (Phi=0.2) calculated in 28-Aug-2014.mat'); figure;plot(y0,100*(SES_d_min-SES_I_min)./w_ro(1:length(y0))); load('EE_max of PRO in ROPRO (Phi=0.5) calculated in 28-Aug-2014.mat'); figure;plot(y0,100*(SES_d_min-SES_I_min)./w_ro(1:length(y0))); load('EE_max of PRO in ROPRO (Ph...
a = 5; b = 7; c = 8; result = a + b + c; disp(['Hasil penjumlahan = ' num2str(result)]); s = input('Masukkan nilai sisi persegi : '); luas = s*s; disp(['Luas = ' num2str(luas)]); N = input('Masukkan bilangan bulat : '); if(N>0) disp('Positif'); elseif(N<0) disp('Negatif'); else disp('Nol'); end %loop s...
% This script runs simulations of the alternative ideal observed models. In % particular we constrast the repeating pattern detector to various Markov % chains of different orders. The simulations are run on sequences that % were presented to the subjects. We considered several alternatives. % % NORMATIVE SINGLE-SYSTEM...
function price = HestonPriceCarrMadan(PutCall,kappa,theta,sigma,... rho,v0,S0,K,T,r,q,M,N,CF,intMethod) % Carr-Madan form % M: upper bound; N: number of points in the grid. dx = M/N; if strcmp(intMethod,'TR') x = dx*(0:N-1); % N values. x(1) = 1e-22; % weights: trapezoidal. Maybe I can use the function...
%% KSVD implementation for Elad 2006 vDictionary Recovery function [Count] = K_SVD_DR(Y1,D_,D,noIt,s) % D_ = Dummy Dictionary % D = Original Dictionary ; Ground Truth [n,K] = size(D_); D_ = D_*diag(1./sqrt(sum(D_.*D_))); % D_ = D_.*repmat(sign(D_(1,:)),size(D_,1),1); % multiply in the sign of the first element. Count ...
function DialogAnalysis(~,~,object) [result,connect,label]=analyze(object); N=numel(result); if N==0 h=errordlg('No connections have been defined','No connections','modal'); uiwait(h); return end data=cell(N,6); for n=1:N for k=1:4; data{n,k}=sprintf('%d',connect(n,1)); end dat...
function display_point_cloud(database,text) if ~exist('text','var') text = ''; end %-- Extract points that belong to each class X_train_c0 = database.X_train(:,database.Y_train==0); X_train_c1 = database.X_train(:,database.Y_train==1); %-- Display them figure; plot(X_train_c0(...
clear all close all clc %% KALMANF % Define the system as a constant of 0 deg: clear s s.x = 0; s.A = 1; % Define the brain to measure the location itself: s.H = 1; % Define a measurement error / sensory noise (stdev) of 15 deg: s.R = 5^2; % variance, hence stdev^2 % Do not define any system input (co...
function p = hex_to_int32(h) %HEX_TO_INT32 Convert hexadecimal string to int32 number. % % HEX_TO_INT32(H) converts the hexadecimal string H and returns the % corresponding int32 numbers. Each row in H, representing one output value, % must only contain characters in the set '0123456789abcdefABCDEF'. % % For e...
function display_bb_video(dataset, i, boxes_frames, varargin) ip = inputParser; ip.addParameter('sub_class', {} , @iscell); ip.addParameter('score_thres', 0.1, @isscalar); ip.parse(varargin{:}); opts = ip.Results; % Display human_bb of ith video in dataset % % i index % show_gt whether to display g op...
% American Style option (as stepsize == 1 day everyting ok) %exerciceFunction_ = @(actualDate, maturityDate, stepSize) true(size(actualDate)); exerciceFunction_ = @(datetimeArray, maturityDatetime, stepSize) repmat([zeros(1,size(datetimeArray,2)-2),1,1],size(datetimeArray,1),1); % NO barrier barrier_ = @(subyacentPr...
clear close all % set ID variables and file paths addpath('utilities') project = '20190613_eve1spot'; % project = '20190613_eveGtMut_eS1'; dataPath = ['../dat/' project '/']; figPath = ['../fig/' project '/']; mkdir(figPath); % load load([dataPath 'nucleus_struct.mat']) % extract useful vectors ap_vec = [nucleus_str...
%Gustavo Franco Reynoso %Sept 6th, 2017 % Execution Main Script %% This script will produce butcher trees of the desired order and the formulas that accompany it. % The arguments are [p] = Desired order % The outputs are [btrees, names] = the butcher trees and the names that % correspond to each close all; clear all; ...
function fitnessVal=fitness(x) % fitnessVal=sin(10*pi*x)./x; fitnessVal=-1*sin(10*pi*x)./x; end
function result = check_me(me) %the size affordable for inverse if(me < 1000) result = true; else result = false; end end
function [obj,position2enforce,velocity2enforce] = periodicity_constraints(obj,~, ~, ~ ) % x0 are the initial conditions % xPlus are the values after impact % NB = rbm.model.NB; % % q_0 = x0(1:NB); % qd_0 = x0(NB+1:2*NB); % % q_plus = xPlus(1:NB); % qd_plus = xPlus(NB+1:2*NB); %tol_per = 1E-12; position2enforce ...
function out = cat_cellornum(dim, varargin) % % out = cat_cellornum(dim, varargin) % % Concat each input along dimension. If all are numeric, output is numeric. If any is a cell, convert % numeric to cell array (with each number in a cell) and return a cell. Output length is always the sum of % input lengths. % Us...
%% Intro % This script runs the coherentContrast experiment % This revision is for March 2015, data collection for Dan's FYP project. %% Retinotopy + MTLoc % The 16ch head coil should be installed and you should have already % collected an in-plane anatomy. % % Retinotopy WEDGES 1: % mglRetinotopy('displayName=fMR...
function p= GetVectorPlan (plan, obs) % premier coin du plan p0 = plan.Sommets(:,1); % vecteurs orthogonaux v1 = plan.Sommets(:,2) - p0; v2 = plan.Sommets(:,4) - p0; u1 = v1 / norm(v1); u2 = v2 / norm(v2); % Verification de la validite des vecteurs orthogonaux if cross(cro...
function durTensors = estimateDurTensors(train, ... iter_ind, ... numObs,... skip, ... span, ... obsDim, ... ...
function hints = dataHints(net,data,hints) % Copyright 2012 The MathWorks, Inc. % Simulation Info hints.doDelayedInputs = true; % TODO hints.doProcessInputs = false; % TODO %hints.doDelayedInputs = ~isfield(data,'Pd') || (sum(size(data.Pd))==0); %hints.doProcessInputs = (~isfield(data,'Pc') || (sum(size(data.Pc))==0...
Screen('Preference', 'SkipSyncTests', 1); % 跳过同步性测试 % 清理窗口和变量 sca; close all; clearvars; answer = inputdlg({'序号'},'信息',1,{'0'}); % 记录被试编号 % 基本设置 PsychDefaultSetup(2); screens = Screen('Screens'); screenNumber = max(screens); white = WhiteIndex(screenNumber); black = BlackIndex(screenNumber); [window, ...
% object=add(object,bound); % object=add(object,bound1,bound2,...); % % object=add(object); % function object=add(object,varargin) % handle input if nargin==1 % attempt automatic add allowed=object.Allowed; assert(numel(allowed)==1,'ERROR: automatic add not possible here'); name=sprintf('SMASH.ROI.%s...
function [beta] = beta_time(sigma_in,sigma_out,L) beta = sqrt((sigma_out^2 - sigma_in^2)*sigma_in^2)/ L; end
%% Introduction to Programming and Data Processing % module 002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Exercise 2C clear all; close all; v1 = [1:5] v2 = [3:7] v3 = ones(1,4) %% dot product dot(v1,v2) v1*v2' %% elememt wise v1.*v2 %% sin function sin(v1) %% length of length(v1) %% dot product v1.*v3...
function spike = GenerateSessionSpikeTrains(groupname,gdf,muaCluster) %GenerateSessionSpikeTrains Creates session data. % spike = GenerateSessionSpikeTrains(GROUPNAME,GDF,MUACLUSTER) % creates a spike structure that stores all the spike trains % by trials and clusters. This function opens a .GDF file (named % GROUPNAME...
% Copyright (C) 2001-2009 Nicolas Guilbert %% %% 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 2 of the License, or %% (at your option) any later version. %% %% This program is ...
% partition data set % % requires 'sparse sub access' by Bruno Luong: % http://www.mathworks.com/matlabcentral/fileexchange/23488-sparse-sub-access % % inputs: % ratings - the entire rating matrix (N*M, 0 for missing value, ratings in 1,2,...,L) % minrpu - minimum number of ratings per user (filter the incapable user...
function[Starts Goals Decoded Vec_l FirstError LastError Steps] = VectorCellModel(GC_cpm,DrawFig) %% Rate-coded vector cell model of vector navigation with grid cells % Daniel Bush, UCL Institute of Cognitive Neuroscience % Reference: Using Grid Cells for Navigation (2015) Neuron (in press) % Contact: drdanielbush@g...
function Y = passaAlta() x = imread('Penguins.jpg'); x = double(rgb2gray(x))/255; h = ones(25,25)/(25*25); y = conv2(x,h,'same'); figure(1); imshow(x); figure(2); imshow(y);
function y = applanet_func(x) % heliocentric distance function % input % x = simulation time argument (days) % output % y = heliocentric distance (kilometers) % Orbital Mechanics with MATLAB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% global tisaved jdtdbi drsaved iap_flg iplanet1 % compute planet stat...
%% CLASS HEADER INFORMATION %By: QuocBao Vu %Created: Dec, 28, 2012 %Modified: Dec. 28, 2012 %Version: 1 % %This class is a dialog window for the dicom reslicing program. It will %notify when the gui is processing the data and tell the user to wait for %the process to be finish. Once the process is finish the dialog wi...
%This function initializes the position of agents in the search space, randomly. function [X]=initialization(dim,N,up,down) if size(up,1)==1 X=rand(dim,N).*(up-down)+down; end if size(up,1)>1 for i=1:dim high=up(i); low=down(i); X(i,:)=rand(1,N).*[0.5 0.9 1 100 4]; end end
function [hypo_list, score_list, bbox_list, recog_result] = ... sc_detector_on_edge(I_edge,codebook,para,verbose) para_sc = para{1}; para_fea= para{2}; para_vote=para{3}; voter_filter = para_vote.voter_filter; win_thresh = []; recog_result= []; img = I_edge(1).edge; nb_scale = length(I_edge); ratio ...
Im = imread('sphere5.jpg'); for i = 1:size(Im , 1) for j = 1:size(Im , 2) Im_gray(i,j) = 0.3 * Im (i , j , 1) + 0.3 * Im (i , j , 2) + 0.3 * Im (i , j , 3); end end for i = 1:size(Im_gray,1) for j = 1:size(Im_gray,2) if Im_gray(i,j) > 100 Im_bw(i,j) = 1; else ...
function [alpha, count] = mb_wolfeLineSearch(objFunc,objFuncValue,x,dx,dir) alphaMax = 1; alpha = alphaMax; fac = 1/2; c_1 = 1e-1; c_2 = 2e-1; count = 0; while objFunc(x+alpha*dir) > objFuncValue + c_1*alpha*dir'*dx && mb_numDiff(objFunc, x+alpha*dir)'*dir < c_2*dx'*dir count...
%% Ideal voltage source with trapezium pulse form % U0 - maximum value [V], % t1, t2, t3 - rise time, on time and fall time of the pulse [s], % t - current time [s] function [out_vol] = Voltage(U0, t1, t2, t3, t) out_vol = ((t>=0) & (t<t1)).*U0.*t/t1 + ((t>=t1) & (t<(t1+t2))).*U0 ... + ((t>=t1+t2) & (t...
% ************************************************************************* % File Name : plotXYAxis.m % Author : Dingjiang Zhou % Boston University, Boston, 02215 % Create Time : some day in 2012 % Last Modified : % Purpose : plot the x, y axis in a plot % % INPUTS...
% roi: [x,y,w,h]; function [bestPlane,bestPlanePoints] = fitUvdPlaneRANSAC(points,roi,trials) global intrinsics baseline; planePoints = zeros(3,3); numSupportersMax = 0; imgSize = size(points); for i=1:trials while(true) p=1; while(p <= 3) u=0; v=0; while (u < roi(1) || u > roi(1)+roi(3)) ...
function Ke = stiff(xi,xvec,d1,d2,L,E) % This function calculate integrand of element stiffness matrix for an % element (xvec) at one gauss point (xi) % ======================================================================= N = [-xi*(1-xi)/2, 1-xi^2, (xi+1)*xi/2]; xe = N*xvec; tht = (d2-d1)/L; dx = d1 + tht*xe; A =...
function [ vals ] = solveRLC2D( points, run_real ) % Solve for grid values at nodes in points. 2D. %% TODO: % obscure bug where grid tries to refine the same point more than once - % maybe an issue with precision in writing points to csv? or is this a % tasmanian bug? %% Load parameters and database file bef...
function [phi]=superbee(r) % Gives the Superbee limiter functional values % % [phi]=superbee(r) % % phi: the Superbee limiter functional values % r: Sweby's r factor % Calculation phi=max(0,max(min(2*r,1),min(r,2))); end
function pf = make_planform( varargin ) % MAKE_PLANFORM creates a planform, a sum of 4 or 6 sine wave gratings. % pf : A data structure for the planform with fields % % img_pix: image size in pixels % X: array of X values [img_pix, img_pix] % ...
function [bestPartition EMSteps tFinal] = greedy( data, maxClusters, maxIterations, maxKMSIter ) %GREEDY greedy algorithm based on PR03_Zhang % %Parameters: %data : dataset to be clustered NxM where N is the number of objects and M the number of features %maxClusters : maximum number of clusters to e...
function rho = dens_wright_eos(T, S, p) % Equation of state for sea water given by Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-740. % Units: T[degC],S[PSU],p[Pa] % Returns density [kg m-3] a0 = 7.057924e-4; a1 = 3.480336e-7; a2 = -1.112733e-7 ; b0 = 5.790749e8; b1 = 3.516535e6; b2 = -4.002714e4; b3 = 2.084...
% Example 6_4 - Blandford p297 % Creates a Butterworth filter such that % fs = 44,100 Hz % pass band 0 - 4000 Hz; stopband 8000 Hz to fs/2 % pass band ripple = .01; stopband ripple = .03 fs = 44100; fs2 = fs/2; fpass = 4000; Rp = .01; RpDB = -20*log10(1-Rp); fstop = 8000; Rs = .03; RsDB = -20*log10(Rs); [N fc] = butt...
load filtradoegm fs = 1e3; ts = 1/fs; N = length(x1); t = ts*(0:N-1); figure(1), plot(t,x1); axis tight, xlabel('t (s)'), ylabel('mV'); X1 = abs(fftshift(fft(x1))); f=linspace(-fs/2,fs/2,length(X1)); figure(2), plot(f,X1), axis tight, xlabel('f (Hz)'), ylabel('X(f)'); % Filter at 300 Hz h1 = fir1(64+1,2*300/fs); [H1,f1...
function plotRaceTracing(obj) %Plot all trees separately with color corresponding to the %relative time between start and end of all tree annotations. % Author: Benedikt Staffler <benedikt.staffler@brain.mpg.de> annTimes = cellfun(@(x)x(:,8),obj.nodesNumDataAll, ... 'UniformOutput',false); %relative to first node ...
%% translate % Translates the cell Network %% %% Syntax % N = translate(N,T) % %% Description % Multiplies the vertices by a fixed number. % %% Inputs % * N - a cellNetwork object % * T - a translation vector % %% Outputs % * N - a new cellNetwork object % %% Examples % >> N = translate(N,[1 2]); % translate the ...
% Filename: rsr_simpleCollection.m % Author: Samuel Acuņa % Date: 03 Oct 2016 % About: This m-file will run one collection of J Zunker's RSR % collection protocol. % simplifying assumptions % 1. only one level of SR % 2. only one stimulus location of RSR % % Procedure % % 1. find sensory threshold % %...
clear clc %%Nyquist plot inphaseA=load("inphase_A.mat"); inphaseA=table2array(inphaseA.vibrationlabS2); inphaseD=load("inphase_D.mat"); inphaseD=table2array(inphaseD.vibrationlabS2); inphaseV=load("inphase_V.mat"); inphaseV=table2array(inphaseV.vibrationlabS2); outofphaseA=load("outofphase_A.mat"); outofphaseA=table2a...
%declaracao de variaveis internas [h,j]=size(code); % verifica tamanho do codigo x=0; % linha inicial do dicionario y=2; % colunas do dicionario (usado para verificar se e necessario aumentar) dictam=2; % colunas do dicionario dic2=0; % dicionario zerado %Reconstrucao do dicionario for i=1:h %realiza varredur...
function out = forward_DSC(uniqueNodes, modules, mods_per_all_nodes, qmod, qcon, pfav) import java.util.* import java.lang.* %% Randomly connect two proteins in each module specificConnections = cell(1,2); count = 1; for t = 1:size(modules,1) MOI = modules(t,2:end); MOI = MOI(~cellfun('isempty', MOI)); rand...
function [X,Y,Z]=cylinder1(P1,P2,R,N) % % P1 - center of the first base of cylinder % P2 - center of the second base of cylinder % R - radius of cylinder % N - number of sectors of the base of cylinder if nargin<4 N=100; end P1=P1(:); P2=P2(:); P12=P2-P1; A=[0 0 1;1 0 0;0 1 0]'; B=[]; z1=P12/norm(P1...
clc; clear all; close all; r=1; T=0.5; mp=5; ts=1.5; a=-1.95; b=2.28; p0=a+b*1i; p1=0; p2=-1/T; anx=angle(p0-p1)+angle(p0-p2)-pi; anp0=angle(p0); anzc=anx/2+anp0/2; anpc=anp0/2-anx/2; zc=a-b/tan(anzc); pc=a-b/tan(anpc); kc=1/(abs((p0-zc)/(p0-pc))*abs(1/p0/(T*p0+1))); t=0:0.01:5; kc=3; s=tf('s');...