text
stringlengths
8
6.12M
function [ u ] = perona( u0, nit , dt, alpha, n) % PERONA applique l'algorithme de Perona Malik a l'image u0 u=u0; tau=dt; for i=1:nit [gradx grady] = gradient(u); norm_u = sqrt( gradx.^2 + grady.^2); cu = cfunction(norm_u, alpha, n); u=u + tau*divergence(cu.*gradx, cu.*grady); ...
function x=logReg_GD(X,Y, x, C1, C2, term1, term2,lambda_logistic, gdStep, rho) for j=1:100 % for i=1:size(X,1) % mu(i,1)=1/(1+exp(X(i,:)*x)); % end %mu=mu'; %temp=(Y./(1+exp(Y.*(X*x)))); g=-(X'*(Y./(1+exp(Y.*(X*x)))))+lambda_logistic*x-C1+C2+rho*x+term1+term2; %g=X*(mu-Y)+lambda_logist...
function b = testSolutions(M, b) if(~exist('b')) b = 0; end % On cherche un zéro zero = min(find(M(:)==0)); if isempty(zero) % S'il n'y en a pas... b = 1; % C'est qu'on a une solution ! else % Sinon, on teste tous les chiffres possibles dans la case [i,j] = ind2sub([9,9],zero); for k=1:9...
function [] = CorrectUniformMeshes(Nels) % CorrectUniformMeshes: Correction of Node vector for unoform mesh. % opens and deletes corresponding file % INPUTS: % Nels : No of Elements Ntyps = length(Nels); for i=1:Ntyps load(sprintf('UniformMesh%dElements.mat',Nels(i))); Nds = OutputNodes; ...
function [On Ar] = reorder_mod(A,M) %REORDER_MOD Reorder connectivity matrix by modular structure % % On = reorder_mod(A,M); % [On Ar] = reorder_mod(A,M); % % This function reorders the connectivity matrix by modular structure and % may hence be useful in visualization of modular structure. % %...
classdef NeighbourhoodGenerator < Generator %Iteratively generates the neighbourhood of the current instance. % % For the k-exchange neighborhood: % All paths and cycles that involve k machines, in which at least one % of the k machines is loaded. % %The Neighbourhood of an instance can ...
% Crea la matrice di filtraggio di una immagine per righe % % A = MATRIX_FILTER_ROW( H, EXT, M, N, TR ) % % H = coefficienti del filtro % EXT = variabile carattere per il tipo di estensione al bordo % 'e' = estensione pari % 'o' = estensione dispari % 'z' = zero padding % 'p' = periodica % M = numer...
close all imagefiles = dir('*.jpg'); nfiles = length(imagefiles); for index=1:nfiles currentImage = rgb2gray(imread( imagefiles(index).name)); [x, y] = size(currentImage); %calculate maxiumum size of area minimumSize = uint32(x*0.09 * y*0.09); MaximumSize = uint32(x*0.25 * y*0.25); blurValue = ...
% HW 9 %% %6.1-1 part E %signal f = @(x) [x.*(0<=x & x<1) + (x+3).*(-3<=x & x<=-2)]; x = linspace(-4, 4); axis([-4 4 -1 2]) xlabel('t'); ylabel(''); grid n = 1:10; a_n(1) = 1/6; a_n(n+1) = (3./((2.*(pi.^2)*(n.^2)))).*(cos(2.*pi.*n./3)+(2*pi*n/3).*(sin(2*pi*n/3))-1); b_n(1) = 0; b_n(n+1) = 0.504*8*n./(1+16*n.^2)...
function runme_extra_PCLA(fitnum, data_savename, savename) % Read in data load('PCLA_Pt_Lobos_pre2007_31Aug2015_metadata'); load(strcat(data_savename,'_R',num2str(fitnum),'.mat')) disp(strcat(data_savename,'_R',num2str(fitnum),'.mat')) disp('it loaded mockdata!') % Now make some adjustments reflecting the mock-...
function output = average_FLIM_parameters(dname, nFrame, freq, pulses_to_average, threshold, threshold2) %% Select the directory where you put your files %Name of variables %tau_m_Array %n_tau_mArray: normalized tau_m, all data %fraction2_Array %n_fraction2_Array: normalized fraction2, all data %int_int2_Array: inten...
function compressPIVimage(in,out, ratio) nfrcalc = 100; info = aviinfo(in); N = info.NumFrames; cmap = repmat((0:255)'/255,[1 3]); i = 2:info.Height-1; j = 2:info.Width-1; npix = info.Height*info.Width; timedWaitBar(0,'Compressing...'); mov = avifile(out,'compression','none','quality',100); for fr = 1:N, I = fr...
%myNanSum(X, dim) %same as nansum, but dim can be a set of dimensions. function M = myNanSum(X, dim) M = X; for i = 1:length(dim) d = dim(i); M = nansum(M, d); end end
%%% LUT based log calculator function log_ut = loglut(ln_in,f_int,f_lns) %%% In hardware, check the MSB whether it is '1' or not to indicate whether %%% the number is >1 %%% Here simply checking shift = 0; lut_prec=64; lut = zeros(1,lut_prec); ln_in_rnd = round(ln_in*2^f_int)/2^f_int; %%% Calculating shift for i=1:f...
% This function finds the aspect ratio of connected regions. If the aspect % ratio is approxiamtely (1), i.e the connected region is an ellipse % Inputs: %D = matrix containing coordinates of the connected region %sortIndex: the connected regions sorted from the largest to %smallst ...
function [slft_data, pred_delay]=get_UNBRT(cdate,hobs) doy=ymd2doy(cdate(1:3,1)); if floor(doy)<10 strdoy=[ '00' num2str(floor(doy))]; elseif floor(doy) >= 10 & floor(doy) < 100 strdoy=['0' num2str(floor(doy))]; else strdoy=num2str(floor(doy)); end filename=[lower(hobs.stn) '_mf' num2str(cdate...
function k=kernelLinear(x,y,param) % linear kernel % Usage: % k=kernelLinear(x,y) % x,y: column vectors, or matrices. % param: [] % k, scalar or matrix, the kernel values k=x'*y; end
function [scores] = pred_dual_nystrom(X,y, opt) % pred_dual_nystrom(X,y,opt) % computes predictions of the input samples passed in the X matrix, % using the predictor stored in opt.rls. % % INPUTS: % -X: input data matrix % -y: labels matrix % -OPT: structure of options with the following fields (and subfields)...
function g = flip_image(img) %FLIP 此处显示有关此函数的摘要 % 此处显示详细说明 g = flipud(img); end
function a = log10(a) %LOG10 Taylor logarithm log10(a) % % written 05/22/09 S.M. Rump % a = log(a); if isa(a.t,'intval') global INTLAB_INTVAL_STDFCTS_LOG10_ a.t = a.t .* infsup(INTLAB_INTVAL_STDFCTS_LOG10_.INF,INTLAB_INTVAL_STDFCTS_LOG10_.SUP); else a.t = a.t / log(10); end
classdef source % class storing the forcing due to rainfall (or recharge following the problem) properties(Access=public) type % type of source term: steady, periodical, data_based, random, etc. time % time_properties object storing the time properties of the simulation...
function TorqueOut = DMSTorque(TorqueIn,GlassTorque,varargin) %UNTITLED Summary of this function goes here if nargin > 3 error('too many arguments.'); end TorqueOut = TorqueIn; TorqueOut.Analysis.GlassTemp = GlassTorque.Temp; Angle = round(TorqueIn.Angle); TField = TorqueIn.Field(1); X = TorqueIn.X; Y = TorqueI...
cd('D:\XY_matdata\AllSessions') aa1 = []; aa2 = []; smi = []; aa3 = []; tt1 = []; d2 = dir('*.mat'); corrcut = 0; jumpcut = 1.1; label = 'RP'; for id = 1:size(d2,1) thisdir = d2(id).name; % load(thisdir,[label '_pSSDarm'],[label '_moduarm']) % if ~exist([label '_pSSDarm'],'var') % get_PFC_...
function OCECgo_Tab_Calibration(h) % This function creates the fields within the calibration tab. % Get parent pnt1 = findobj(h, 'tag', 'Tab_Cal'); %% CREATE DATA SECTION % Create panel str = '1) Calibration Data'; pnt2 = uipanel(pnt1, 'Units', 'pixels', 'Position', [5 375 440 260], 'Title', str, 'FontSize', 16); ax...
function [PCF, r, error] = SingleImageUnNormalized2DPCF (xy_pairs, dr) % disp('*** SingleImageUnNormalized2DPCF') n_of_particles = numel(xy_pairs(:, 1)); max_x_distance = max(xy_pairs(:, 1)) - min(xy_pairs(:, 1)); max_y_distance = max(xy_pairs(:, 2)) - min(xy_pairs(:, 2)); max_r = sqrt(max_x_distanc...
% This function computes the classification error % Input: Y, W, X % Output: Percentage classfication error function [ pct_err ] = ClassificationError( Y, W, X ) d = size(X, 1); % Check if 1 is appended if (size(W, 1) > size(X, 2)) X = [ones(d, 1) X]; end O = repmat(W', d , 1).*X; O = sum(O, 2); ...
function q = gauss3_bersusun(a,b) %input = a dan b batas integral, N banyak subinterval %output = nilai aproksimasi dengan integrasi gauss bersusun N = 0; while N<1000 N=N+1; h = (b-a)/N; xx = a:h:b; %partisi domain t = [0.7745966692, 0,-0.7745966692]; %absis c = [0.5555555556, 0.888888889,0.555555...
%% Opdracht 8 % Gegeven: een rijvector met tijdstippen waarop een rugbyspeler een bal % vast heeft (1) en de bal door niemand wordt vastgehouden (0). % % De positie van de bal (de x-coordinaat) wordt gegeven in Pos. % % Geef de indexen van de tijdstippen waarop een speler de bal vast heeft en % naar achter rent. Zo'n...
%RANDOMSTATEGENERATOR Generates N number of random states that are valid in %the Sherpa_TT leg's configuration space. % %Inputs: %-N: The number of random states to be generated. %-jointLimits: A 2x10 array of joint angular limits and angular positions. %-kC: A structure containing the kinematic constants of the Sherpa...
classdef conv2d_adv_gq < conv2d %CONV2D_ADV_GQ Summary of this class goes here % Detailed explanation goes here properties(Constant) x0 = -0.5; y0 = -0.5; u0 = 0.5; v0 = 0.5; end properties uq, vq % flow variables at quadrature points end ...
function [m, v] = meanvar(X) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here N = length(X); m = sum(X) / N; T = zeros; for i = 1:N T(i) = (X(i) - m)^2; end v = (1/(N-1))*(sum(T)); end
function [app] = compSimpsons(f, left, right, n) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here if mod(n, 2) ~= 0 error('Input n must be an even number: %d given', n); end step = ( right - left ) / n; fA = f(left); fB = f(right); f1 = 0; f2 = 0; for i = 1 : n - 1 x = left ...
clear vars; LF=zeros(512,512,9,9,3); imgPath='hci_dataset/training/boxes/'; num=1; for i=1:9 for j=1:9 imgDir = dir([imgPath '*.png']); LF(:,:,i,j,:)=imread([imgPath imgDir(num).name]); num=num+1; end end LF_pinhole=reshape(permute(LF,[3 1 4 2 5]),[9*512 9*512 3]); %LF_pinhole=reshape(permu...
function H = hessian(VI_dW_dp, N_p, w) % HESSIAN - Compute Hessian % H = HESSIAN(VI_DW_DP, N_P, W) % Iain Matthews, Simon Baker, Carnegie Mellon University, Pittsburgh % $Id: hessian.m,v 1.1.1.1 2003/08/20 03:07:36 iainm Exp $ if nargin<3 error('Not enough input arguments'); end H = zeros(N_p, N_p); for i=1:N_p h...
function matrice_tabou = maj_matrice_tabou(matrice_tabou, permutation,... taille_tabou) % fonction qui met à jour la matrice tabou (contenant les permutations % interdites) entre deux itérations. % matrice_tabou : matrice_tabou(i,j) est le nbre d'itération durant % laquell...
%子函数:在L_index+1到R_index-1个可能的边界点中寻找熵最小的划分点 %Revised by JLM on 2020-05-26 function [IndexBestCut,Index_left,Index_right,EntS1,EntS2,EntS,Entropy_min,L1,L2]=Get_best(BoundaryPoints,L_index,R_index,X,Label_Mass,Num_Initial) Num_boundary=R_index-L_index-1; Index_left=cell(Num_boundary,1); %存储在每个边界点左边的数据索引位置 Index_ri...
function heid = hv2he(hvid, mesh, mode) %%HV2HE : map half-vertex <hvid> to incident half-edge % hv2he(hvid,mesh,mode) % mode == 'any' : id of some half-edge starting at the vertex % corresponding to <hvid>, 0, if there is no such edge in <mesh> % mode == 'match' : id of ha...
%% select % gets list of species that belongs to a taxon %% function Species = select(taxon) % created 2015/09/18 by Bernd Brandt % modified 2015/10/07 by Dina Lika; 2016/11/08, 2021/11/24 by Bas Kooijman %% Syntax % Species = <../select.m *select*> (taxon) %% Description % gets all species in the add_my_pet collec...
function ia_plot1(level_difference,time_difference,direction_matrix,... n_directions,frq_axis,single_plane) % function ia_plot1(level_difference,time_difference,direction_matrix,... % n_directions,frq_axis,single_plane) % % IA_PLOT1 plots the interaural level difference ...
%sujets = { 's01','s02','s03','s04','s05', 's06', 's07', 's08', 's09'};%,'s02','s03','s04','s06','s07','s08','s09'}; %inserer le noms des fichier des sujets sujets = {'s11', 's12'}; eventsOI = {'_UnPred','_Pred','_Scramb'}; min_freq = 2; max_freq = 80; num_frex = 40; freq = linspace(min_freq,max_freq,num_frex); lo...
function [ issym, err ] = issymmetric( M, use_epsilon ) % [ issym, err ] = issymmetric( M, use_epsilon ) % returns 1 if M is symmetric (within tolerance use_epsilon) if ~exist('use_epsilon','var') use_epsilon = sqrt(eps); end err = sum(sum(abs(M-M'))); if err > use_epsilon issym = 0; else is...
function pyout=pydec(C,h) %X=pydec(C,h) %Takes C as an input a cell: Y0,Y1,...,Yn,X(n+1), returns the set of low pass %images Z as a cell in the following format:(Zn,...,Z0) [m,n]=size(C); pyout{1}=C{n-1}+interpolate(C{n},h); for i=2:(n-1) pyout{i}=C{n-i}+interpolate(pyout{i-1},h); end end funct...
%% Build the Design Matrix %% experiment date: 10.26.09 TR = 4; doASLmod=1; exp_duration = 1144; % 150 * TR; % add three seconds for instructions on each trial %shifts = [1:5]*3; onsets{1} = [ 13 66 303 380 681 1046 ] -7; durations{1} = [ 48 96 72 48 72 96]; onsets{2} = [ 167 468 604 758 870 958...
function match_gc_to_fc(gc_lb,gc_ub) % tm 11/2/98 % match gc spd and trq range to that of the fc assignin('base','gc_spd_scale',round(evalin('base','max(fc_map_spd*fc_spd_scale)/(max(gc_map_spd)*0.95)')*1000)/1000); assignin('base','gc_trq_scale',min(max(round(evalin('base',... 'max(fc_max_trq*fc_trq_scale)/interp...
%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&% %&% %&% %&% Simulation and Control Algorithms %&% %&% %&% %&% Deformable Body Model %&% %&% ...
% PlotTCPBEL4s is a slice-plot version of PlotTCPBEL expand % to the basis { |00> |10> |01> |11> }. % Author: Yulin Wu % Date: 2009/8/14 % Email: mail4ywu@gmail.com function PlotTCPBEL4s(Ec1,Ec2,Em,Ej1,Ej2,varargin) NgLim=[0.25 0.8]; % Default ploting range: Ng, [-0.25 0.8], nP=400; % 400...
function [I] = light_intensity_matrix(p,I,A) % Calculates the light intensity at all grid points with Beer-Lamberts law, % using the trapezoidal method to compute the integrals. % Assumes A is a matrix with the dimensions [p.Yn, p.Xn] % returns a matrix I with dimensions [p.Yn, p.Xn] for x = 1:p.Xn-1 integral = 0;...
function ClusterFunctions(action,hfig) global selWidth unselWidth selWidth = 2; unselWidth = 0.5; mstyle = 's'; msize = 2; if (nargin < 2) hfig = gcbf; end hmembership = findobj(hfig,'Tag','memberline'); delete(hmembership); % Notes: % Figure contains a number of user properties with the following names: % clustnums:...
function [scanpath_out] = normalize_scanpath_rate(scanpath, samplerate) if size(scanpath,1)<1 scanpath_out=[]; return; end tstart=scanpath(1,3); tend=scanpath(end,3); timeintervals=tstart:samplerate:tend; totaltime=tend-tstart; scanpath_out(:,1)=interp1(scanpath(:,3),scanpath(:,1),timeintervals,'linear...
function [ mz2,sp2,sp3 ] = jsmPeakPick(mz,sp,method) %jsmPeakPick - perform various peak picking methods (eventually) % % % INPUTs % mz % sp % method - simple so far % Save the original data spOrig = sp; snr = 10; % Determine reference spectrum sp = 1000000 * bsxfun(@rdivide,sp,nansum(sp,2)); refSp = nanmean(sp,1); ...
clear members members=properties(gNLv); idx=strmatch('all',members); members(idx)=[]; for i=1:numel(members) if ( strcmp( class( gNLv.( members{ i } ) ) , 'Subject' ) && ~strcmp( members{ i } , 'all' ) ) xl_s2m_rateL( i) = gjpsv_all.default.apply_classifier( gNLv.( members{i}).default , 'name' , 'groupL' , 'targe...
%% Intitializations clear; clc; prompt = {'Enter the file name of the network to be analyzed'}; title1 = 'Input'; dims = [1 50]; definput = {'ko04141'}; answer = inputdlg(prompt,title1,dims,definput); filename1=strcat('D:\rishika\4_work_boolean_logic\KEGG_data\',answer,'.xml'); filename=char(filename1); fid=...
% % Script ECCN Tutorial: Tasks 1 - 3 % % Task 1 [XA,XB,XC,YA,YB,YC] = ecnn_data(0); % Load data Net = ecnn_train(XA,XB,YA,YB,0.0001,1.1,100,true); % Train ECNN Z = ecnn_test(Net,XC,YC); % Test ECNN plot_class_boundaries(Net,XC,YC,Z); % Plots % Task 2 ecnn_analysis(Net); % Feature Importance Analysis % Task 3 % learn...
function control = raftcontrol(theta,thetaOld,dt,thetades, thetaError,IError) %Simple PID controller for raft heading, for testing purposes Kp = 5; Kd = 2; Ki = 0; % dt = 0.1; % thrustmax = pi; offset = 30; %to account for motor not moving for commands less than offset thrust = -Kp*(thetaError) - Kd*(theta ...
close all; good = load('lab_bioimaging/imT2.mat'); seg = load('t2.mat'); seg = double(seg.scirunnrrd.data(:,:,1)); x1 = good.imT2(:,:,1).*seg; x2 = good.imT2(:,:,2).*seg; x3 = good.imT2(:,:,3).*seg; x4 = good.imT2(:,:,4).*seg; x5 = good.imT2(:,:,5).*seg; x6 = good.imT2(:,:,6).*seg; x7 = good.imT2(:,:,7).*seg; x8 = ...
function [packet,dataBitsCrc]=genPacket(Mbps,Bytes) [p, ref] = generate_preamble; [data_sym,dataBitsCrc] = txData(Mbps,Bytes); bytes = length(dataBitsCrc)/8; signal_sym = txSignal(Mbps,bytes); data_sym=data_sym(:); packet = [p(1:end-1);signal_sym; data_sym]; %%add noise % Pnoise = -94.797; % numSa...
function [S,labels]=score_image(A,ref) S=zeros(1,4); %MSE S(1)=immse(A,ref); %PSNR and SNR [S(2),S(3)]=psnr(A,ref); %SSIM S(4)=ssim(A,ref); labels={'MSE','PSNR','SNR','SSIM'};
clc; clear; close all; L(1) = Link([ 0 0.147 0 0 ], 'modified' ); L(2) = Link([ 0 0 0.033 pi/2 ], 'modified'); L(3) = Link([ 0 0 0.155 0 ], 'modified'); L(4) = Link([ 0 0 0.135 0], 'modified'); L(5) = Link([ 0 0.218 0 -pi/2], 'modified') ; youbot = SerialLink(L, 'name', 'youbot');...
function grid_rectangular(a) %% % I started writing a post today about the |ConvexImage| property returned % by |regionprops|. But I got sidetracked along the way, and this post % turned into a description of how to overlay a pixel grid on an image. % (I'll come back to the original |ConvexImage| idea in a future post....
clear %This script simulates a three-link headless human figure on a slackline %in the frontal plane, %as used in assignment 5 of the course "human and robot locomotion", 2020. % %Dimensions and weight of segments are inspired by anthropometric data %(mass of arm equivalent to two arms, mass of trunk contain...
%% Process and fit the distributions clear % % ------ Gamma % % % Optimization settings % options=optimset('Display','iter','TolX', 1e-16, 'TolFun', 1e-16, 'MaxFunEvals', 500); % % Initial values - [shape, scale] % x0=[1e-2, 10.0]; % % Optimization % [x,fval]=fminsearch(@gamma_search, x0, options); % % data = load(...
function runAllTests() import matlab.unittest.* import matlab.unittest.plugins.* import matlab.unittest.plugins.codecoverage.* try artifacts = "artifacts"; mkdir(artifacts); junitResults = fullfile(artifacts, "junit"); mkdir(junitResults); covRe...
function [blob, im_scales] = get_image_blob(conf, im) [ims, im_scales] = arrayfun(@(x) prep_im_for_blob(im, conf.image_means, x, conf.test_max_size), conf.test_scales, 'UniformOutput', false); im_scales = cell2mat(im_scales); blob = im_list_to_blob(ims); end
function [GNCout] = ChooseNS(GNCin) % Choose number of sensors global NSMAX for ns = 1:NSMAX GNCout(ns) = GNCin; GNCout(ns).NS = ns; end return;
function Stimulator2 %prepares the setup getSetup; Priority(5); %Make sure priority is set to "real-time" % priorityLevel=MaxPriority(w); % Priority(priorityLevel); mList=moduleListSlave; configurePstate(mList{1}{1}) %Use grater as the default when opening configureMstate; configCom_tcp; %configures communicat...
function random_paths h = figure(1); handles.start = []; handles.goal = []; handles.region_p = []; handles.region_e = []; handles.region_seed = []; handles.traj = []; handles.obs = []; clf % Configuration start = [-17;0]; % goal = [16;-15]; % goal_iregion_idx = 2; goal = [16;18]; goal_iregion_idx = 3; % goal = [-16...
function Y = vl_mysoftmaxloss(X,c,dzdy) % classNum = size(c,2); % s = X; % s = bsxfun(@minus, s, max(s, [], 1)); % s = exp(s); % s = s + 1e-8; %avoid NaN % y = s./repmat(sum(s,1),[classNum 1]); % if nargin < 3 % loss = -c'.* log(y); % Y = sum(loss(:)); % else % % gradient computation % ...
% Simon Mekonend % 12/9/18 % ECE 202: Project 1 - part 6 % Power Series Expansion of cosine function % f(t) = A * cos(wt) clear format shortG % ----- ANSWERS TO QUESTIONS ------ % a) Number of terms = 10 % % b) The function seems to rapidly decrease. I think this happens because % the polynomial from the power s...
% parcellation_colormap.m % % Code here to make a nice aparc colormap that can be used for a number of things % Assumes that you have 82 regions i.e. 34 Desikan killany regions Left: 7 Subcortical regions (from aparc) for each hemi % % 2020 % Kevin Aquino <aquino.km@gmail.com> % function cmap_aparc = parcellation_c...
% WBL 25 Sep 2002 Use P450 training data to train Matlab MLP Neural Network versn = '$Revision: 1.7 $'; %$Date: 2002/10/31 11:17:37 $ %read training data, one training case per line, %each case has the same number of attributes, %numbers are separated by spaces. in = load('TRAIN+11_FULLtrn'); in = in'; %read ...
function intervals = cleanUpIntervals(endpts) % VARIABLES % endpts: J x 2 table which mark the start and end indices of a % jump for a particular experiment. % % Takes endpts and removes any jump intervals which are nested. % Clean up nested intervals. endpts = sortrows(endpts);...
%-------------------------------------------% % BEGIN: function brachistochroneEndpoint.m % %-------------------------------------------% function output = osimOptimalTrackingEndpoint(input) % % Variables at Start and Terminus of Phase 1 t0{1} = input.phase(1).initialtime; tf{1} = input.phase(1).finaltime; x0{1} = inp...
function [X, info] = IRrestart(A, b, varargin) % IRrestart Restarted Krylov subspace methods % % options = IRrestart('defaults') % [X,info] = IRrestart(A,b) % [X,info] = IRrestart(A,b,K) % [X,info] = IRrestart(A,b,options) % [X,info] = IRrestart(A,b,K,options) % % This function provides a general framework for a varie...
function [Pav] = advection(A,B,L,Ncells,t_final) % This function solves 1D transport equation using finite volume method. % Input arguments % A,B Constants in Gaussian function (as initial condition) % L The length of interest % Ncells Number of cells % dt Time step % t_...
% ======== Loading Data ======== % Y = load('course-ratings.txt'); % Y is a 15x80 matrix, containing ratings (1-10) of 15 courses on % 80 students. % Courses which are not rated by a particular student are given a rating % of 0. % Converting R to logical matrix R = logical(Y); % R is a 15x80 matrix, where R...
function [w_id,unique_w_id,w_ii] = getXstar(w,X,r) w_id = zeros(size(w,1),r); w_ii = zeros(size(w,1),1); for i = 1:size(w,1) [u,uid] = sort(w(i,:)*X','descend'); w_id(i,:) = uid(1:r); end unique_w_id = unique(w_id,'rows'); for i = 1:size(w,1) for j = 1:size(uniqu...
function [outputArg1,outputArg2,outputArg3,outputArg4] = batchClassify(Job,params,allocate) %BATCHCLASSIFY Summary of this function goes here %first input is [Job] 1 to compute 0 to avoid %Job.classify =1 % Job.predict=1 %second input is [params] %supplied with data so there is no need to change %third input ...
val_data = readmatrix('a0_valueset_dist_n0.csv'); figure; lhp = plot3(val_data(:,1),val_data(:,2),val_data(:,4), '.', 'DisplayName', 'Lower half'); lhp.Color = '#0072BD'; hold on; uhp = plot3(val_data(:,1),val_data(:,2),val_data(:,5), '.', 'DisplayName', 'Upper half'); uhp.Color = '#EDB120'; title('Fraction of...
classdef NdgFlatBottomNonhydrostaticBoundaryValueTest < NdgFlatBottomWetDryTestWithWallBoundary %UNTITLED 此处显示有关此类的摘要 % 此处显示详细说明 properties end methods function obj = NdgFlatBottomNonhydrostaticBoundaryValueTest(N, cellType) obj = obj@NdgFlatBottomWetDryTestWithWallBo...
clear all; % clear all variables from the workspace video = mmread('Video1.mpeg'); % call the function mmread to load the video. % The variable video is a structure with different fields. Type 'video'on Matlab command and see what metadata is associated % to this structure. number_of_frames=video.nrFramesTotal; % nrF...
function ShowImage(result,bounds,spacing,f_hand,title_string,cscale) if bounds(5) == bounds(6) Show2DImage(result,bounds,f_hand,title_string,cscale,'X (m)','Y (m)'); elseif bounds(1) == bounds(2) bounds = bounds(1,3:end); Show2DImage(squeeze(result).',bounds,f_hand,title_string,cscale,'Y (m)','Z (m)'...
function rot = rotate_image(img, theta) rot = zeros(size(img)); % we set the values inside the matrix to zero n = size(img); for i = 1:n(1) for j =1:n(2) mire = [cos(theta), sin(theta);-sin(theta), cos(theta)]; rots = (inv(mire))*([i;j]-[n(1)/2;n(2)/2])+[n(1)/2;n(2)/2];...
function subobj_weights = RBES_get_array_subobj_weights() global params w = params.subobj_weights; np = length(w); no_vec = cell2mat(cellfun(@length,params.obj_weights,'UniformOutput',false)); subobj_weights = zeros(1000,1); ii = 1; for p = 1:np for o = 1:no_vec(p) sobj = params.subobj_weights{p}{o}; ...
% Calculate inertial parameters regressor of coriolis matrix for % %RN% % Use Code from Maple symbolic Code Generation % % Input: % %INPUT_QJ% % %INPUT_QJD% % %INPUT_PKIN% % % Output: % cmat_reg [(%NQJ%*%NQJ%)x(%NQJ%*10)] % inertial parameter regressor of coriolis matrix % %VERSIONINFO% function cmat_reg = %FN%(q...
function [ResultStruct, ResultStructBW]=HistEqualization_Enhance(CDataSetInfo, Param) %%%Doc Starts%%% %-Description: %This method is to perform 3D contrast enhancement using histogram equalization. %-Parameters: %1. NBins: The number of bins. %-Formula: %Matlab build-in function histeq is used. %-Revi...
clc clear all close all [file,path] = uigetfile('*.txt'); if isequal(file,0) return; end fid = fopen(fullfile(path,file),'r'); x16=fread(fid,Inf,'uint16');%Persian fclose(fid); fid = fopen(fullfile(path,file),'r'); x8=fread(fid,Inf,'uint8');%English fclose(fid); hist(x8,max(x8)-min(x8)+1) x8u=unique(x8...
for j = 1:8 delete(figure(j)); end warning('off','all') preSample = [1000,10000,25000,50000,75000,100000,150000,200000,300000,400000,500000,750000,1000000,1500000,2000000]; %preSample = [1000,2000,3000,4000,5000,6000,7000,8000,9000,10000,11000,12000,13000,14000,15000]; %for k = 1:500 %preSample(k) = k*25000; %end for ...
function r = cap_range(r, low, high) % Clips the value between high and low r = min(r, high); r = max(r, low); end
O = zeros(1,K,10) ; M = zeros(1,ndim,K,10) ; C = zeros(ndim,ndim,K,10) ; O(:,:,1) = o1 ; M(:,:,:,1) = m1 ; C(:,:,:,1) = c1 ; O(:,:,2) = o2 ; M(:,:,:,2) = m2 ; C(:,:,:,2) = c2 ; O(:,:,3) = o3 ; M(:,:,:,3) = m3 ; C(:,:,:,3) = c3 ; O(:,:,4) = o4 ; M(:,:,:,4) = m4 ; C(:,:,:,4) = c4 ; O(:,:,5) = o5 ; M(:,:,:,...
function signal(varargin) %SIGNAL % Define custom signals for the plant formulation, e.g. define a % reference input. Multidimensional signals can also be declared as e.g. % r(3), for a (reference) signal of dimension 3 or e(2) for an (error) % signal of dimension 2. Omitting (.) creates a 1-dimensional signal....
function writeStructureToRhinoScript(self, structure, path) memberNum = size(structure, 1); [Cn, Nd] = self.generateCnAndNdList(structure); [radius, nodeRadiusList] = self.getRadiusList(structure); fileName = [path, '\createStructure.py']; fid = fopen( fileName, 'wt' ); fprintf(fid, 'import Rhin...
function M = RateCorrelation(SimValues) %% poprate.dt = 50; overlap = 1; winsize = poprate.dt.*overlap; [spikemat,t_rate,~] = SpktToSpkmat(SimValues.spikesbycell, [], poprate.dt,overlap); N = length(SimValues.EcellIDX)+length(SimValues.IcellIDX); rate = zeros(length(t_rate),N); for ii = 1:N rate(:,ii) = sum(...
% +INIT Package for initializing dataset for code applied to population analyses using Kalman filter approach % MATLAB Version 9.7 (R2019b Update 5) 29-Aug-2020 % % Functions % spikeData - Initialize spike data % lfpData - Initialize LFP data % kinData - Initialize kinematic data...
function[x_real, y_real] = interpolacion_lut_funcion(lut, x_ccd, y_ccd) datos_y = importdata(lut, '\t', 1); datos_y = datos_y.data; x = datos_y(:, 1); y = datos_y(:, 2); px = datos_y(:, 3); py = datos_y(:, 4); % Interpolo Y en función de px, py %%%%%%%%%%%%% F_y = scat...
clear all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55 % % Aufgabe b % % Für Jacobi: % F1 nach x1: 3/|x| % F1 nach x2: -2*x2 % F2 nach x1: 4x1 - x2 - 5 % F2 nach x2: -x1 x=[2;2]; F=[1;1]; zahl=1; k=0; while (norm(F)>=10^(-10)), F=[x(1)-x(2)^2+3*log(abs(x(1)));2*x(1)^2-x(1)*x(2)-5*x(1)+1];...
%Part 1 Part1 %Part 3 Gompertzian
classdef IPGrayImage < SYObject properties end methods(Static) function result = grayImage(image,range) % result = grayImage(image,range) % Class method to convert given image to gray scale image. % Argument image is either bitmap raw data or SYImage instance. % Argument (double[2]) range. % Return value is (uint8[...
function [ climstruct_out ] = reduce_climstruct_data_by_obs_nr( climstruct_in, obs_min ) %A function to reduce the ace data according to the provided observation % number minimum. Data that do not correspond to the indices are changed to % NaNs. % *INPUT* % climstruct_in: STRUCTURE - the ace climatology data...
agent = UTMPlane4D([0 -2 0 0], pi/10, 3, 0, [1:4], 5, 0.1); dt=0.05; T = 20; close all; for i=0:dt:T %agent.updateState([pi/10,0], dt); agent.updateState([0,0.01],dt); extraArgs.Color = 'red'; extraArgs.ArrowLength = 3; %j prev 1 extraArgs.LineStyle = 'none'; extraArgs.LineWidth = 0.1; %j ex...
% Bode plot for one amplitude bins of a neuron which requires recordings at % different frequencies of stimulation. %% Input filename is 'Trials_freq_dep.mat', range is the FNames range in the struct function plot_ampbins_bode(filename,range) H=load(filename); S=struct(); FNames=fieldnames(H); count=1; ...