text
stringlengths
8
6.12M
classdef PhySupport properties node fixedX = 1 fixedY = 1 fixedMoment = 1 end methods function obj = PhySupport(node, xFix, yFix, fixedMoment) if nargin > 0 obj.node = node; end if nargin > 1 o...
function rate=findseafloorrate(latitude,longitude,varargin) % rate=findseafloorrate(latitude, longitude, seafloorrate, seafloorrateerror) % specifying seafloorrate explicitly in input will speed up calculation, % but is optional. if nargin==4 && isstruct(varargin{1}) seafloorrate=varargin{1}; else load seafloor...
% 单个旋翼失效恢复实验 % 电机顺序为从右前方顺时针计数依次为1 2 3 4 clear clc figure_configuration_IEEE_standard %% 机体模型数据 c = (0.0166); l = (0.125); M = ([ 1 1 1 1; -0.7071*l -0.7071*l 0.7071*l 0.7071*l; 0.7071*l -0.7071*l -0.7071*l 0.7071*l; c -c c -c]); %% log说明:两个...
% function [num, indices, lengths] = track_numpart(tracks, minL) function [num, indices] = track_numpart(tracks, minL) % returns the number of particles in the coordinate vector tracks. optional: % minL specifies the min path length to count (ex. if minL = 2, then this % function will only return the number of part...
function [ result ] = reconstructionFilter( signal, Bw ) lfft = 2^ceil(log2(length(signal))+1); frequencySignal = fftshift(fft(signal,lfft)); lowPassFilter = zeros(1,lfft); lowPassFilter(lfft/2-Bw:lfft/2+Bw-1) = 1; filteredSignal = frequencySignal.*lowPassFilter; result = 2*real(ifft(fftshift(filteredSignal))); end
function [nums, numv] = CalcOrderMatSize(order) nums = (order+1)*(order+2)/2; numv = order*(order+2); end
classdef DsaGlmDirector < mlanalysis.Np755GlmDirector %% DSAGLMDIRECTOR implements builder/director design patterns to do GLM analysis % that regress DSA onto predictor variables. % Usage: from the session path: % dgd = DsaGlmDirector % dgd.createModel % from the s...
function [X, Y, normal] =normalize(x,y) n=size(x,2); m=size(y,2); % calculate the mean normal.xd=mean(x'); normal.xd=normal.xd'; normal.yd=mean(y'); normal.yd=normal.yd'; %shift x=x-repmat(normal.xd,1,n); y=y-repmat(normal.yd,1,m); % calculate the scale, a little like the standard deviation xscale=sqrt(sum(sum(x.^...
% MOTION shows a motion consisting of all directions, included in the matrix % 'channel'. 'channel' must be provided outside this M-File, and % includes the signals to plot in a motion. Depending on the status- % variable 'motion_dim' a 2D or 3D motion is produced. The motion is % la...
function [ S,K_inh] = lateral_inh( S,V,K_inh ) %侧抑制矩阵形成过程 % 此处显示详细说明 S_inh=ones(size(S)); K=ones(size(K_inh)); [Vi,Vj,Vk]=size(V); for i=1:Vi for j=1:Vj for k=1:Vk flag=0; if S(i,j,k)~=1%无输出脉冲,不发生侧抑制 continue end if K_inh(i,j)==0;%当侧抑制矩阵该处为0时...
function [outputColormap] = customColormap(colorList,varargin) % Creates a custom colormap. % Biafra Ahanonu % started: 2014.01.03 [19:13:01] % inputs % % outputs % if nargin==0 [outputColormap] = ciapkg.view.customColormap(); elseif nargin==1 [outputColormap] = ciapkg.view.customColormap(colorList...
function parsivel = catPSVstruct(data) % catPSVstruct(data) % This function merge a vector of structures of PARSIVEL2 data % % JValdivia - 07, 2018 time=[data(:).time]; RI=[data.RI]; dbZ=[data.dbZ]; SYNOP4680=[data.SYNOP4680]; SYNOP4677=[data.SYNOP4677]; N_d=[data.N_d]; v_d=[data.v_d]; raw=cat(3,data...
function VEPAnaRD1_ll animalid = '180619'; block = 3; basepath = ['C:\Users\Julia\work\data\' animalid '\']; penangle = 25; supath = ['C:\Users\Julia\work\data\' animalid '\singleunits\']; % supath = ['C:\Users\Julia\work\data\' animalid '\multiunits\']; basename = [animalid '_block' int2str(block) '_tet']; files = ...
function [Observability_matrix] = obs(A,C) %OBS Regner observabilitet av A og C matrisene i et system % Ingen mer detaljert beskrivelse er nødvendig Observability_matrix = obsv(A,C); [r,c] = size(A); if ((rank(Observability_matrix) == r)&&(rank(Observability_matrix)==c)) fprintf('The system is observable \n'); ...
function [imgF] = haar_reconst(imgC, horDs, verDs, level, isInt, visible) % haar_reconst : 1D horizontal T <- 1D vertical T for 2^n X 2^n % conver to grayscale if not if size(imgC,3)~=1, imgC = rgb2gray(imgC); end % resize the image : 2^n X 2^n min_n = floor(log(size(imgC, 2))/log(2)); level = min(level, size(horDs...
%built in dialog boxes %msgbox('My Error Message','Error Window Name','error'); %msgbox('My Help Message','Help Window Name','help'); %msgbox('My Warning Message','Warning Window Name','warn'); %question_ans = questdlg('Do you want a hard copy?',... % 'OUTPUT','Yes','No','No') %if strcmp(question_ans,'Y...
function posX = findPosition(x,y) posX = sum((x==y).*(1:size(x,2))); end
function [pdrtime, Ssize, Svelocity] = PDR(rawdata_accl, rawdata_attitude) %------------ init ------------% gravity_geo = cell(size(rawdata_accl(2,:))); %- coordinate transformation -% C_b_2 = cellfun(@(x) [cos(x(1)) 0 -sin(x(1)); 0 1 0; sin(x(1)) 0 cos(x(1))], rawdata_attitude(2,:), 'UniformOutput', false); C_1_t = ce...
%% Description and setup %Input data from: %Data from the UIC Machine Learning Repository: Energy Efficiency Data Set %https://archive.ics.uci.edu/ml/datasets/Energy+efficiency %% Program setup clear clc close all start_time=tic; %Timer rng(42) %% User inputs val_perc = 0.15; %percentage of data for validation set t...
function [choice_x, B, B_ci] = rr_fit_psychometric(signal, choice, numparams, signal_x) % function [choice_x, B, B_ci] = rr_fit_psychometric(signal, choice, numparams, signal_x) t = ~isnan(signal(:)) & ~isnan(choice(:)); signal = signal(t); choice = choice(t); LAMBDA_DEFAULT = 0;%1/6; GAMMA_DEFAULT...
function toyfun A=-5:1:5; B=-5:1:5; C=-5:1:5; %half max location D=-5:1:5; x = -5:.1:5; figure; hold on; for c=1:length(C) y = A(a)+(B(b)-A(c))./(1+10.^((C(c)-x)*D(d))); plot(x,y); end
function input_init (files, sett_list) % function customized by user % called before the first simulation step % % Param : depends on what you choosed, potentially, every % variables defined in master script, see input and output % scripts doc for further informations. % % Note : please follow the input_list...
clc clear all close all %-----------------Set variables---------------- w = 0.005; N = 1000; Vo = 1; L = 1; C = 1; Zl = 5*sqrt(L/C); t = (2*pi/w)/4 %--------------Calculate other variables------------ f = w/(2*pi); wc = 3*(sqrt(L*C)); B = w*sqrt(L*C); vp = w/B; lamb = vp/f; %--------------S...
clear rgb_R=zeros(8,256); rgb_G=zeros(8,256); rgb_B=zeros(8,256); zero=zeros(8,256); for i=1:256 rgb_R(:,i)=i; rgb_G(:,i)=i; rgb_B(:,i)=i; end red=uint8(rgb_R); green=uint8(rgb_G); blue=uint8(rgb_B); R=cat(3,red,zero,zero); G=cat(3,zero,green,zero); B=cat(3,zero,zero,blue); RG=cat(3,red,green,zero); RB=ca...
function [sum_ch_arousal,sum_ch_valence,sum_fb_arousal,sum_fb_valence,sum_sb_arousal,sum_sb_valence] = statisticalAnalysis(method) project_path = strcat(pwd,'\..\..'); method = 'fft';%'ica_fft','swt','ica_swt'; %%%%%%%%%%%%%%% if strcmp(method,'ica_fft')||strcmp(method,'ica_swt') if exist(s...
%Generalized Reduced Gradient Method %ploting x1=linspace(0,4,100); x2=linspace(0,4,100); [X1,X2]=meshgrid(x1,x2); f = @(x1,x2) x1.^4-2.*(x1.^2).*x2+(x1.^2)+x1.*(x2.^2)-2.*x1+4; f(X1,X2); Z=f(X1,X2); contour(X1,X2,Z,0:1:50) hold on ezplot('x1^2+x2^2-2',[0,4,0,4]) hold on ezplot('0.25*x1^2+0.75*x2^2-1',[0,4,...
# Application Problem 4 -- Integration # Adding the data x = [0; 0.375; 0.75; 1.5; 2.25; 3; 4.5; 6; 7.5; 9; 12; 15; 18; 21; 24; 27; 28.5; 30]; f = [0; 0.801; 1.083; 1.473; 1.74; 1.929; 2.157; 2.25; 2.28; 2.265; 2.142; 1.923; 1.641; 1.308; 0.924; 0.504; 0.276; 0]; g = [0; -.369; -.513; -.678; -.783; -.876; -1.05; -1.19...
function [speedMatrix, branchesMatrix] = speedMatrixForAllBranches(branchMap) mapKeys = keys(branchMap); speedMatrix = zeros(512, 512); branchesMatrix = zeros(512, 512); for keyIndex = 1 : size(mapKeys, 2) internalKey = mapKeys(keyIndex); internalKey = internalKey{1}; speedMatri...
function [wpt,n2m] = wpcutree(wpt,level) %WPCUTREE Cut wavelet packet tree. % T = WPCUTREE(T,L) cuts the tree T at level L. % % In addition, [T,RN] = WPCUTREE(T,L) returns % the vector RN which contains the indices % of the reconstructed nodes. % % See also WPDEC, WPDEC2. % M. Misiti, Y. Misiti, G. Oppenh...
clear %load data set of common trials from first condition (see %"plot_Figure_VA.m" for code that generates the output "cleanedmatrix") load cleanedmatrix %load parameter values for 30 common trials load testtrials %create frequency of risk taking and standard errors for 30 trials in high %vol condition %t indexes ...
%% Data syms t; u(t) = t^(exp(1) - exp(t^(1/11.7))); % Instantaneous Utility U = int(u); % Total Utility p(t) = int(u, 0, t)/t; % Productivity % Domain Ranges D = [0 10]; D2 = linspace(0.01, 10); % (xmax, ymax) is the global maximum of the productivity function p(t) rVals = double(p(D2)); indexmax = find(max(rVals) =...
function ctFIRE_1_ROIpost(filePath,fileName,ctfmatname, imgPath,imgName,savePath,roiP) %based on ctFIRE_1 as well as the funciton of analyzer_launch_fn in CTFroi %input: %filePath: original file path %fileName: original file name %ctfmatname: original fiber extraction mat file %imgPath: roi path %imgName: roi name ...
%%Program to find difference between two dates clear; clc; day1=input("Enter start day e.g 15: "); %%starting day if day1>=1 && day1<=31 month1=input("Enter start month e.g 02: ");%%starting month if month1>=1 && month1<=12 year1=input("Enter start year e.g. 2001:" );%%starting year day2=input("Ent...
function [] = visualizeWireframe2D(img, wireframe) % VISUALIZEWIREFRAME3D Takes in a 2D car wireframe (2 x 14 matrix), and % plots it in 2D (on a given image) while appropriately connecting vertices % Declare global variables globals; % Number of keypoints for the car class numKps = size(wireframe,2); % Generate d...
function [S_out,S_in,MSE,GMI,REF]= Th_LMMSE_Simu(K,N,H,snRdB,snrNo,modType,Q_StepSize,B_Bit1,B_Bit2,B_Bit3,S1,S2,S3) Q(1,:) = [2.638, 1.925, 1.519, 1.277, 1.131, 1.043, 0.990]; % optimal step size of 1-bit Q(2,:) = [0.992, 0.874, 0.801, 0.759, 0.735, 0.721, 0.713]; % optimal step size of 2-bit Q(3,:) = [0....
1; function [ inv_j ] = invJacobian( q ) %INVJACOBIAN Summary of this function goes here % Detailed explanation goes here theta1 = q(1,1); theta2 = q(2,1); j = [-44.6*sin(theta1)-26.3*sin(theta1+theta2)-17.4*sin(theta1+(5/3)*theta2), -26.3*sin(theta1+theta2)-43.5*sin(theta1+(5/3)*theta2); 44.6*cos(theta1)+26.3*cos(...
%% spectrogram. % n=102; % aver=NC(:,n); aver=hpc; % aver=aver(450:650); % aver2=PFC_spindles(:,n); % spectrogram(aver) %% Spectrogram HPC t_aver=1:length(aver); t_aver=t_aver-1; t_aver=t_aver/1000; t_aver={t_aver}; w=1; %toy=[1:60:length(t_aver{1})/1000]; %secs toy=[1:0.5:length(t_aver{1})/1000]; %secs %480 %toy=[-1...
function loadBitmap(packetPort,prog) % loadBitmap(packetPort, prog) % % Load the bitmap of packets corresponding to the received/missing code % fragments from program prog. It returns nothing, but it changes the % global array packetBitmask, and in the event of failure it displays error % messages. % ...
function obj=funh2struct(obj, verbose) % convert all function handles in the hierarchy to structs with meta data % obj=funh2struct(obj, verbose, recursive) % verbose true prints out every function handle that is repaired if ~exist('verbose', 'var') || isempty(verbose) verbose=true; end recursive=true; if isstruc...
%LCR circuit response to an AC voltage source clear all; %Component values L = 0.002; %Henrys, inductance C = 0.000003; %Farads, capacitance R = 5; %Ohms, resistance %Check that system is lightly damped disc = R^2 - 4*L*(1/C); if disc < 0 disp("System is under-damped"); elseif disc == 0 disp("System is critically ...
function inside = point_inside_rect(rect, point) rect_points = to_points(rect); rect_area = rect.half_extents(1) * rect.half_extents(2) * 4; a1 = triangle_area(rect_points(:, 1), rect_points(:, 2), point); a2 = triangle_area(rect_points(:, 2), rect_points(:, 3), point); a3 = triangle_area(rect_poin...
function main lac_operon Morris_Lecar end
% This script answers parts a, b, and c of problem 2 of assignment 2 % Authors: Antoine Bosselut and Magnus Skonberg % These two vectors set the numerator and denominator coefficients of our % difference function in terms of z^-N where N corresponds to vector index % of the coefficient. (i.e. 1 is the coefficie...
function h = fig(optionalIdx) %function h = fig(optionalIdx) %fig is like figure, except we place it in the top left corner if(nargin < 1) h = figure; else h = figure(optionalIdx); end p = get(h,'Position'); p(1) = 0; set(h,'Position',p);
function [sim_data, b, v]=plot_Synechocystis(sample, s, colour, d, n, rel, fit_weghting, phase, field_correction,gsh) % K H Richardson 29-07-21 Queen Mary University London % sample - sample DSC file % s - data smoothing % colour - colour of plot rbg % d - separayion of plots on y axis % n - experiment no. % rel - re...
function t = Tree(arg0, arg1, arg2) % Tree - create a tree object % t = Tree(C, R) creates an empty tree with an outer box % of center C and radius R. % t = Tree('foo') loads a tree from file 'foo' % % NOTE: call delete(t); clear t; to delete the tree from memory. % % Attributes % t.dim -...
function tl = make_ticklabels(cfg_in, ticks) cfg_def = []; cfg_def.insert_zero = 0; cfg = ProcessConfig(cfg_def, cfg_in); tl = cell(size(ticks)); for iT = 1:length(tl) tl{iT} = []; end tl{1} = ticks(1); tl{end} = ticks(end); if cfg.insert_zero zero_idx = ceil(length(t...
function L2 = Chol_insert(L, v, c) % function L2 = Chol_insert(L, v, c) % Chollesky decomposition update when we insert one column and one row % suppose that A = L*L' (A is symmetric PSD), L is low triangular % and A2 = [A v; % v'c] % suppose that A2 = L2*L2', calculate L2 efficienetly % Ref: http://www.cs.te...
clear all;close all;clc; %% read data addpath(genpath('..')); dimension = 500000; weightL2 = 3; weightL2Inf = 0.1; dataPart = [5*rand(1,dimension);5*rand(1,dimension)]; %dataPart = [1:10; 10:-1:1]; %% FlexBox main = flexBox; main.params.tryCPP = 0; %change, if C++ module is compiled numberT = main.addPrimalVar(size(...
function hello % This is the hello, world function written in MATLAB code % Copyright 2011 The MathWorks, Inc. % fprintf(1,'Hello, World\n' );
% RSMA CoMP JT SNR % Using CVX for optimization (download from: cvxr.com) function [WMMSE,p_1,p_2,p_3,p_123,X_1_123,X_2_123,X_3_123]=RS_1layer_CVX_Optimization(H,SNR,weight,g,u_opt,Rth) u1 = weight(1); u2 = weight(2); u3 = weight(3); [Nr,N_bs,N_user] = size(H); h1 = H(:,:,1); h2 = H(:,:,2); h3 = H(:,:,3); ...
%************ clear all and get screen size ******* *********************** clear all; close all; scrsz = get(0,'ScreenSize'); %************************************************************************** %***** call read_all_speakers for making matrices with mfccs ************** C4 = read_all_speakers(4); %see...
% Process the data from pyrogue strema interfaces % data is a multidimensiona matrix with the process data function data = processData(file, type) if nargin < 2 type = 'uint32'; end % Number of stream channels numChannels = 2 % Size of the header (8 bytes in 32-bit words) headerS...
clear all; %Choose dataset datasets = {'Twitter_Data/'};%Movie_Data/'}; %Dataset format %name_views.mat - Attributes views in n_samples*n_features format %name_links.mat - Relational views in adjacency matrix format if strcmp(datasets,'Twitter_Data/') name_views = {'tweets','lists','listmerged'}; name_links =...
function[x, uu, tt] = n1re_ks(N, m, Tf, p) % This functions solves the PDE % u_t = uu_x - u_{xx} - u_{xxxx}, x \in (0, 32*pi) % u(x, 0) = cos(x/16)*(1 + sin(x/16)) % and periodic boundary conditions with 2nd order centred differences in % space and null scheme with Richardson extrapolation in time. % % Key feat...
classdef WBFixation < WBTask properties type = 0; end methods function obj = WBFixation(nm) obj@WBTask(nm); end function start(this) start@WBTask(this); this.paintFixation(); end function stop(this) this.act...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Optical Flow % Cristian Duguet clc close all clear all % Gravitational Constant G = 9.80665; % Experiment name experiment_date = '20120718_2021'; % experiment_date = '20120704_1913'; %% General Parameters: %metrics in mm sigma2IMUacc ...
% Esercizio 2.5 % % Autore: Tommaso Papini, % Ultima modifica: 4 Novembre 2012, 11:10 CET f = inline('(x-1)^10'); f1 = inline('10*(x-1)^9'); tolx = 10^-1; disp('f1(x)=(x-1)^10') while tolx>eps disp(' '), str = sprintf('Tolleranza %d', tolx); disp(str) disp('Newton: '), newton(f, f1, 10, 1000, tolx, 0, 0, 0); ...
pd_dir = fileparts(which(mfilename)); rilling_dir = fullfile(pd_dir, '..', '..'); analysis_dir = fullfile(rilling_dir, 'analysis'); % predict macaque / lamantia addpath(genpath(fullfile(rilling_dir,'_lib'))); addpath(genpath(fullfile(rilling_dir,'_predict'))); load(fullfile(analysis_dir, 'caminiti_etal_2009', 'cam_dat...
function [der_ro, der_ssq, der_deltas] = logEvidenceGradient(hyper, ... p, q, Ds, mu, Sigma, Reg, sse) % % gradient of log evidence w.r.t. hyperparameters % [~, ssq, deltas] = asd.unpackHyper(hyper); Z = (Reg - Sigma - (mu'*mu)) / Reg; der_ro = 0.5*trace(Z); v = -p + q - trace(Sigma / Reg); ...
clc clear close all % opts = detectImportOptions('load.csv'); % preview('load.csv',opts) % % data = readmatrix() % opts.Sheet = '2007'; % opts.SelectedVariableNames = [1:5]; % opts.DataRange = '2:11'; pvData = readtimetable('load.csv'); l = numel(pvData); numPVData = 70; pvDataPerHour = zeros(24, numPVData); pvTim...
%Give the correct directory with Kilosorted files data_root = '/media/alex/4TB SSD/DATA/Ronnie_23_01_2018/bin_files/Preprocessed/CRA_done/P13-reverb_with_noise_same_cra/P13-reverb_with_noise_same_cra_sorted'; %Give the correct Benware Grid folder grid_root = '/media/alex/4TB SSD/DATA/Ronnie_23_01_2018/benware_gridinfo/...
%% fn_min %% Syntax % [m I] = fn_min(a) %% Description % find the global min in an array, and give its coordinates % % See also fn_max %% Source % Thomas Deneux % % Copyright 2005-2012 %
function gaussK = gaussK(x1,x2,sigma) gaussK = exp(-norm((x1-x2)/(2*sigma^2),2));
% echo_demo.m % 第二章例9 close all;clear;clc; % 首先调入一个声音信号 % load splat; [y,Fs]=audioread('bupt.wav'); whos; % 播放声音 sound(y,Fs); pause(1.5); % 画波形 t=(0:length(y)-1)/Fs; subplot(2,1,1); plot(t,y);xlabel('time (s)');ylabel('y(t)'); xlim([0 2.8]); % 用于产生回声信号的系统的单位样值响应,大家思考为什么是这样的? h=[1 zeros(1,Fs) 0.3]; % y是列向量,将h转置一下 h=h'; ...
function fn = RandString(myLength) %random filename is 10 (default) random alphabetic characters %97 = a through 122 % %good for appending to filenames to ensure uniqueness with high probability if(nargin < 1) myLength = 10; end p = ceil(26 * rand(1,myLength)) + 96; fn = char(p);
function accuracy=BayesAccuracyCal(faceM,meanV,covV,EiganVec) [~, ~, numSubjects]=size(faceM); counter=0; for i=3:3:36 a=faceM(:,:,i); if nargin>3 b=CondProbCal(faceM, a,meanV,covV,EiganVec); else b=CondProbCal(faceM, a,meanV,covV); end if b==1 ...
function queryMote(moteID) % queryMote(moteID) % Queries the report threshold and number of intervals before an LED turns % off. global APPS; global COMM; MAGLIGHT = APPS.MAGLIGHT; if isempty(MAGLIGHT) error('You must call magLightInit.m first to set up a connection.'); end if (nargin < 1) moteID = COMM.TOS_B...
function [stimfilename, trials] = makeUnequal(n1,n2,m1,m2,numTrials) % function stimfilename = makeUnequal(6,12,m1,m2) % makeUnequal Generates and saves pairs of stimuli for unequal-type trials % n1,n2 (pos int): set-size for each side. only works for n1=6, n2=12 now % m1, m2 (pos real): means 1 and 2 for the sets. ...
function varargout = czRBFidelityVsPlsCalParam(varargin) % <_o_> = czRBFidelityVsPlsCalParam('controlQ',_c&o_,'targetQ',_c&o_,... % 'rAmplitude',[_f_],'td',[_f_],'calcControlQ',_b_,... % 'numGates',_i_,'numReps',_i_,... % 'notes',<_c_>,'gui',<_b_>,'save',<_b_>) % _f_: float % _i_: integer % _c_: char ...
%% Studying the fitness effect of the position of the sonars % % Must be in the evo_ros directory % % GAS 11-7-17 %% Read in table and set up plotting arrays cd('./GA/logs'); %file_name = 'single_sonar_evolution_40pop_60gen_run1.dat'; file_name = 'double_sonar_evolution_40pop_60gen_run1.dat'; table = readtable(file_na...
function xPeriodsSim = simXperiods(MPIparams) xSpeed = 1/(MPIparams.Gxx*(1/MPIparams.Rs(1))); xPeriods = MPIparams.numTrianglePeriods*2*MPIparams.FOV_x*MPIparams.f_drive/xSpeed; t = (0:xPeriods-1)/MPIparams.f_drive; p = 1/(MPIparams.numTrianglePeriods/MPIparams.time); xPeriodsPos = MPIparams....
function [ ] = save_contours( g_num, l_num, height, contours, file ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here f = fopen (file, 'a'); for i = 1:size(contours,2) fprintf(f,'%d,%d,%d,%d',g_num,l_num,round(contours{i}.mid),height); for j = 1:...
function dog = diffOfGauss2(im, cntr, sur) edges = ceil(size(cntr, 1)/2); if size(im, 1) <= 2 * edges || size(im, 1) <= 2*edges warndlg('image is too small'); else imcen = conv2(im, cntr, 'same'); imsur = conv2(im, sur, 'same'); % divisive normalization dog = (imcen-imsur)./imsur; dog = dog(edges+1:en...
function y = normgauss(x,gG) y = 1/sqrt(pi)/gG * exp(-x.^2/gG^2); end
function creatPrototxt(w,h,fileName) fp = fopen(fileName, 'w'); fprintf(fp, 'force_backward: 1\n'); fprintf(fp, '\n'); fprintf(fp, 'layer {\n'); fprintf(fp, ' name: \"data\"\n'); fprintf(fp, ' type: \"Input\"\n'); fprintf(fp, ' top: \"dx\"\n'); fprintf(fp, ' top: \"dy\"\n')...
% TODO: 3.1 % Végezzük el a mérést a második fájlra (meres2.mat) % A névleges távolságok alapján számoljunk távolság mérési hibát! % Külön master és slave egységre! load("meres2.mat"); [DM, DS, PX, PY] = CalculatePosition(Measurement); % névleges távolságok: D = 1.4; % master és slave távolsága nominal_master_distance ...
function [ B ] = MPS_ReduceBondDim_left_sweep_up( A, B, rhor_B_B, rhor_A_B ) %pinv is used everywhere, not optimal. [N, ~] = size(B); fprintf('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n'); fprintf('The error at position %i in sweep is %d.\n', 0, normDifferenceBetweenStates_left(A,B)); ...
function [ index, dist ] = get_gt( base, q ) % get ground truth( the euler distance between q and each columns of base) % return a column vector which contains the sorted ground truth % and another column vector which contains the distance related to the % former one [row, col] = size(base); index = zeros(col, 1); dis...
function read_radiosonde_uas( year, ptu_data ) %read_radiosonde_uas Read radiosonde data from archived UAS format (on Cube) % Use instead of read_radiosonde.m for 1999-2007 (no .ptu.tsv data), this % function produces the same output % INPUT: year to be analysed % ptu_data: empty structure to save data i...
% Static force analysis of a Non minimal regular prism with 4 bars clear; clf; figure(1); % Parameter values r = sqrt(2); % Radius of the circle containing fixed nodes phi = pi/2; % Characteristic angle for a square h = 2.0; % Separation between the two parallel polygons alpha = 3*pi/8 ; % Twist ang...
classdef network3 < handle properties layers; layerCount; end methods function self = net_new() self.layers = struct; self.layerCount = 0; end % add hidden layer function add(self, type, in, out, trans) sw...
soc=[0 25 50 75 100]; % SoCs at which resistance data is available temp=[-20,0,20,40]; % Temperatures at which resistance data is available [soc,temp]=meshgrid(soc,temp); data=[0.094602697 0.048132397 0.036161367 0.028086448 0.08865539 0.037587896 0.026150316 0.02340783 0.087310664 0.036228646 0.02533813 0.022996474 0....
%estrutura das equacoes: x'Ax+b'x+c = 0 %erro admissivel ea = 1e-10; %maximo numero de iteracoes mi = 1000; %numero de equacoes e = 10; %numero de variaveis v = 10; %gerando aleatoriamente os coeficientes A = cell(0); b = cell(0); c = cell(0); for i=1:e A{end+1} = 5*(rand(v)-0.5); b{end+1} = 5*(rand(v,1)-0....
function y = pp_resample(x,L,M) h = create_lpf(L,M); h = pad_divisible(h,L*M); x = pad_divisible(x,L*M); h_pp_size = [L, length(h)/L]; %x_pp_size = [L, length(x)/L]; h_pp = reshape(h, h_pp_size); row_shift = floor((0:M:L*M-1)/L)+1; s = zeros(L,length(pp_decimate(x,h_pp(1,:),M))); for i=1:L s(i,:)=pp_decimate(x(...
function b = compute_slope( data, f0,f_start,f_stop ) % Compute average spectrum for every signal in data block. Fits line to % log-f log-power and returns slope. % NOTE: Compute LOG first of Sxx estmates, THEN computes MEAN of the logs % to get estimate of logf-logSxx % INPUTS: % data = data matrix [T x N], where...
function [newdata1, newdata2] = simulate_data(data1, data2, weight, NofSample) cs_weight = cumsum(weight); ch = rand(1,NofSample) < cs_weight'; y = NofSample - sum(ch) + 1; newdata1 = data1(y); newdata2 = data2(y); end
%========================================================================== % DYNAMIC TIME WARPING recognizer/temporal segmenter object %========================================================================== % a=dtw_recog(hyper) % % This is an object performing Dynamic Time Warping, modeled after % re...
ClearMonomialOrder[]; SetMonomialOrder[{a,b,c,d,e,f,g,h,i,j,k,l,m,n},1]; Iterations=5; rels={ a**a, b, a**b - c };
function [cflag, retsst, dbtq, dbt820, dbt960, dbtsst] = spectral_clear( ... IASI_Radiances, Satellite_Zenith, lsea, modsst, sflag, dbtqmin, ... dbt820max, dbt960max, dbtsstmax) % function [cflag, retsst, dbtq, dbt820, dbt960, dbtsst] = spectral_clear(... % IASI_Radiances, Satellite_Zenith, lsea, modsst, sfla...
format long dydt=@(t,y) t-y; t0=0; y0=2; h=[0.4; 0.1; 0.01]; tn=0.4; yn_exact=1.41096; n=size(h,1); % testa para todo valor de h fprintf('Método de Euler\n'); for i= 1:n % calculando para todo valor de h [yn]=euler(dydt,t0,y0,h(i),tn); fprintf('Com h = %.2f\nO valor de y(%.2f) é %.5f.\n',h(i),tn,yn); fprin...
function convergence_data = convert2originalDataStruct(all,data,project,file_name_suffix) %% convergence, divergence, convergence A, convergence B, rare events convergence_data = zeros(size(data,1),5); load([project.paths.processedData '/convergence/word_pair_position' file_name_suffix '.mat']); %% construct sequence ...
function [aS_ct] = mris_colorTableMake( a_labelVar, varargin) % % NAME % function [aS_ct] = mris_colorTableMake( a_labelVar, varargin) % % $Id:$ % % % ARGUMENTS % % INPUT % a_labelVar var multi-type: % + int: number of labels % ...
function [dx, dy, dz] = gradb(u, mask, vsz) %GRADB First order backward difference gradient. % Boundary condition: u^{k+1} - 2u^{k} + u^{k-1} = 0. % % [dx, dy, dz] = GRADB(u, [mask], [vsz]); % % See also GRADF, GRADC, GRADBADJ narginchk(1, 3); if nargin < 3, vsz = [1, 1, 1]; end if nargin < 2 || is...
function[answer] = SimetricMatrix(matrix) answer = true; [n,m] = size(matrix); if(n ~= m) answer = False; end for i=1:n for j=1:m if(matrix(i,j) ~= matrix(j,i)) answer = false; break; end end end ...
function [QQ,VP,VT,xxP,yyP,xxT,yyT]=Tcompanddump(fn,n,vT,bT,aP,bP,dPT,UPT) # n: delitev navpicnice trikotnika bT # vT: dolzina trikotnika, visina, v x smeri # aP,bP: dolzina in visina pravokotne plosce # dPT: razdalja med plosco in vrhom trikotnika, ki je pri (0,0) # UPT: napetost med plosco in trikotnikom mc=2.9732095...
% Test EM algorithm im = rgb2gray(imread('cameraman.jpg')); [mask,mu,v,p]=EMSeg(im,2); % for k = 1:nColors % color = im; % color(mask ~= k) = 0; % segmented_images{k} = color; % end % % imshow(segmented_images{1}), title('objects in cluster 1'); figure(2), imshow(mask, [])
% Nicole Ortega (c) 10/26/2017 % Decodes data files and fixes trials with corruptions %% Subject information % Edit as needed date = '9.1.2017'; subject_num = '11'; num_trials = '33'; %% Decode All Subject Files % Edit number of trials of subject path_subj_decode = '"/Users/Nicole/Documents/JHU/LIMBS/MotorSynchroni...
close all; clear; global Link ToDeg = 180/pi; ToRad = pi/180; th1=0; th2=-90; th3=0; d4=50; th5=0; th6=90; DHfk6Dof_Workplace(th1,th2,th3,d4,th5,th6,0,1);%零状态 view(134,12); %pause; step=30; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Joint1 for i=0:step:360 DHfk6Dof_Workplace(th1+i,th2,th3,d4,th5,th6,1,1)...
function [projAmp] = calcProjectAmpFromMrcExport(Y,Ydim) %function [projAmp] = calcProjectAmpFromMrcExport(Y,Ydim); nHarm = size(Y,1); nRoi = size(Y,2); nSbj = size(Y,3); nCnd = size(Y,4); nInv = size(Y,5); nType = size(Y,6); nHemi = size(Y,7); projAmp = zeros(size(Y)); %Nested loop from hell. for iHarm = 1:nHa...