text
stringlengths
8
6.12M
% Script for selection of regions for analysis % reset: count = 0; %naio = 10; %no.images before bleach posb = naio + 1; %postbleach picture % averaging over first naio pictures for selection interface for j = 1 : naio if j == 1 ia = sequence(:,:,j)/naio; else ia = imadd(ia,sequence(:,:,j)...
% Let's have a look at a few images in detail to figure out how to % noise-correct this thing... % Initialize and load some files clear all outpath = 'C:\Users\jaker\Pictures\Oregon_Eclipse\code\matlab\out'; dirname = 'C:\Users\jaker\Pictures\Oregon_Eclipse\16bit\png'; offsets = load(fullfile(outpath,'offsets.mat')); ...
function [ax, ay] = acceleration(vx, vy) ax=-0.01*vx*abs(vx); ay=-0.01*vy*abs(vy)-9.81; end
function[cuadrado_residuos] = ajuste_punta_1_param_2_camaras(separador, datos_x, datos_y) % me armo 2 regiones de datos para ajustar indices_region_1 = datos_x < separador; datos_x_1 = datos_x(indices_region_1); datos_y_1 = datos_y(indices_region_1); datos_x_2 = datos_x(~indices...
clear all; clc %% To show on a graph how the number of points between tfinal and tstart affects %% the accuracy of cov_num % Parameters for forming t vectors npts1 = 100; npts2 = 1000; npts3 = 10000; tstart = 0; tfinal = 10; % Forming column vectors t with constant delta t (size nx1) t1 = tsample(tstart,tfin...
% it creat 'l' variable that is like 'll' but the only parameters which is % wanted to show as legend in plot % selectedl: the selected parameterts for legend view % ll : all avialable parameters for that x y selection function [l, lbond] = plotset(selectedl,ll,list) l = {}; for i=1:length(selectedl) for j=1:size(...
%%Normalize data to regular time updates %Usage: point to folder with robot and optitrak files function [runData, Dir] = tNormData %%Get filenames Dir=uigetdir('..'); dirinfo = dir(Dir); for i = 1:length(dirinfo) j = strfind(dirinfo(i).name, 'Tracking'); if (~isempty(j)); optFName = f...
function [new_vert] = extendEuclidean(closest_vert,xy) new_vert = [0;0]; minimum = 0; for i = 1:20 u = -5 + i*0.5; [t,y] = ode45('pendulumcats',[0 0.1], closest_vert,'mysterious', u); dimensions = size(y); end_point = y(dimensions(1),:).'; if end_point(1) < - pi/2 end_point(1) = 3*pi/2 ...
A = imread("batman.png"); s = 1.55; theta = 315; alpha = s*cosd(theta); beta = s*sind(theta); m = size(A,1); n = size(A,2); x0 = ((m+1)/2); y0 = (n+1)/2; H = [alpha beta (((1-alpha)*x0)-(beta*y0)); -beta alpha (beta*x0 + (1-alpha)*y0); 0 0 1]; B = applyhomography(A,H); imshow(B)
function obj = viewSubjectMovieFrames(obj) % Creates frame snippets from movies of a subject, used to get a sense of how well cross-session alignment should work. % Biafra Ahanonu % branched from controllerAnalysis % started: 2014.08.01 [16:09:16] (2015.09.14 14:40) % inputs % % outputs % % changelog % 20...
%%%%%%%%%%%%%%%%%%%%% The Hybrid scheme 2d %%%%%%%%%%%%%%%%%%%%%%%%%% % plots a single realisation of a VMMA % Claudio Heinrich, August 2016 clear all; close all; kappa=2; %depth of the Hybrid scheme a=-0.5; %roughness parameter n=100; %grid resolution g=0.2; ...
function [u]=pause_time(last_real_t,clock_t_in,last_clock_t,time_gain); real_t=now; time_diff=(real_t-last_real_t)*100000; clock_diff=(clock_t_in-last_clock_t); if time_gain>0 pause_t=(clock_diff-time_diff)/time_gain; else pause_t=0; end if pause_t>0 pause(pause_t); end real_t=now; clock_t=clock_t_in; u(1)=...
function [H,P] = lab2_cw3_tcdf %H1 - srednie ceny wsrosly mniej niz 49% r = 38 + 14.*randn(18,1); t = (mean(r)-49)/std(r)*sqrt(17); P = tcdf(t,17); H = 0; if (P <= 0.01) H = 1; end end
%% some numbers. %% all times are in [ms] dt = 2; tmax = 1998; tmin = -1200; fs = 1/dt; len_sample = floor((tmax-tmin)*fs); t = linspace(tmin, tmax, len_sample); noise.tscales = [200, 200]; noise.amplitude = [0.5 1]; noise.jitters = [0 20:20:180] ; noise.jitter = 0; % noise.randn = 0.1; noise.pink_alpha = -2.4; jit...
clear clc close all addpath(genpath('C:\Users\EF503A\Desktop\XT')) folderpath = 'Z:/'; topo = [... 9108, 1, 9108, 1, 9109, 1; 9107, 1, 9107, 1, 9109, 2; 9115, 2, 9115, 2, 9109, 3; 9301, 1, 9308, 1, 9305, 2; 9303, 1, 9303, 1, 9305, 3; 9306, 1, 9306, 1, 9305, ...
function Moments = uq_triangular_PtoM( Parameters ) % Moments = UQ_TRIANGULAR_PTOM(Parameters) returns the values of the % first two moments (mean and standard deviation) of a triangular % distribution based on the specified parameters if length(Parameters) ~= 3 error('There are exactly 3 parameters required for d...
function [skel,nBW] = util_accurate_skeleton3D(bw,res) res = res./res(1); [r,c,~] = size(bw); r1 = ceil(1/res(3)*r); c1 = ceil(1/res(3)*c); rsBW = imresize(bw,[r1,c1],'box'); lbl = bwlabeln(rsBW,6); stats = regionprops(lbl,'Area'); [~,inxMain] = max([stats.Area]); if ~isempty(inxMain) nBW = lbl==inxMain; ske...
function cmom = central_moments(im,i,j) rawm00 = raw_moments(im,0,0); centroids = [raw_moments(im,1,0)/rawm00 , raw_moments(im,0,1)/rawm00]; cmom = sum(sum( (([1:size(im,1)]-centroids(2))'.^j * ... ([1:size(im,2)]-centroids(1)).^i) .* im )); end
function [copy_map,P] = get_tiling(y,x,patchsize) % computes a nearest neighbor matching between patches of x and y. Then % determines what percentage of locations were verbatim copied, over % multiple resolutions. copy_maps contains visualizations of the copy maps % over every resolution, innovation_capacities contain...
%{ # miniature event detection -> psp.Traces -> psp.EventOpt --- event_count : int # performance avg_amplitude : float # average amplitude of psps avg_rise_time : float # average amplitude of psps avg_decay_time : float ...
figure, surf(double(bg(1:8:end, 1:8:end))),zlim([0 255]); set(gca, 'ydir', 'reverse');
%% Range of movement of Hip in Lateral Box Transfer % Code AUTHOR: Yaiza Benito Molpeceres. DATE: January-May 2020. % Adapted to Octave by Guillermo Asín Prieto % Exoskeleton trials segmentation: 54, 55, 56, 62. % Five phases shown in figure 1: % 1: Subject picks up the box in the sagittal plane (idxO1:idxF1) ...
% path to save graph outputs folder = 'C:\Users\Skylar\Documents\GitHub\CS3200\Assignment4\output'; n = 10^5; % set some number of iterations e = 10^-15; % acceptable error threshold % initial values for iteration x_values = zeros(2,n); % array to hold x1 and x2 values x_values(:,1) = [1 0.1]; % ini...
function [rls] = rls_nuprimal (X,y, opt) % rls_nuprimal(X, y, opt) % computes the regression function for the nu method in the primal space. % The regularization parameter (i.e. the number of iterations) is set to the one found in opt.paramsel. % % INPUTS: % -OPT: struct of options with the following fields: % fields...
function [x,fval,exitflag,output,population,score] = PACK_run_GA(hObject,MAXSATS) handles = guidata(hObject); nvars = length(handles.params.instrument_list); options = gaoptimset; options = gaoptimset(options, 'PopulationType' , 'doubleVector'); % options = gaoptimset(options, 'CreationFcn', @PACK_create); % optio...
function RungeKuttaMetodos() clc, clear all, close all; syms x y; h = 0.1; decisionUno = 0; while(decisionUno ~= [1 2 3]) decisionUno = input("Teclee la función que desee \n1)f(x,y) = 4x^2-2y \n2)f(x,y) = x^2-3y \n3)f(x,y) = -2x^3+12x^2-20x \nOpción: "); fprintf("\n") end ...
function X = fourierseries(t, T, coeffs) d = size(coeffs); N = (d(1)-1)/2; d = d(2); X = zeros(2,d); X(1,:) = coeffs(1,:); for i = 2:N+1 for j = 1:d X(1,j) = X(1,j) + coeffs(i,j)*cos(2*pi*(i-1)*t/T) + coeffs(i+N,j)*sin(2*pi*(i-1)*t/T); X(2,j) = X(2,j) - coeffs(i,j)*(2...
function plotTradeMap2(dayTick,dayEL,dayT) if dayEL.latest ==0 disp('No Trade!'); return; end dayTick.time2 = str2num(datestr(dayTick.time,'HHMMSSFFF')); coreM = zeros(dayEL.latest,14); numRound = max(dayEL.roundNo); for i = 1:numRound idxTrade = find(dayEL.roundNo==i); idxOpen = idxTrade(1); idx...
function plotProgresskMeans(X, centroids, previous, idx, K, i) %PLOTPROGRESSKMEANS is a helper function that displays the progress of %k-Means as it is running. It is intended for use only with 2D data. % PLOTPROGRESSKMEANS(X, centroids, previous, idx, K, i) plots the data % points with colors assigned to each cen...
Se = sessions(); %1 MDSSFO2 Se = add(Se,'CMO',... [2014 04 13 15 11 22],... 'W:\CheetahData\AMP4\ContextSwitch\2017-05-19_15-53-44',... 'Neuralynx G',32,... 'File 6',... [4 4 4 4 4 4 4 4 4 4 4 4 4],... % channels per electrode/home [NaN NaN NaN NaN NaN NaN]); %2 MDSSFO2 Se = add(Se,'CMO',....
function result=Ger_std(data) % Get std % data: input data % Author: LBJ result=std(data); end
%Asks for the number of measurements made. k = readmatrix("input.xlsx","Range",'A1:A1'); %Asks for the vectors in reference frame. %Value of t required to select AOR in SQR. t = readmatrix("input.xlsx","Range",'A2:A2'); %Asks for weigts if any. w = readmatrix("input.xlsx","Range",strcat('B1:B',string(k))); %Asks for th...
% testing rec2sph [ r t p ] = rec2sph( 1 , 0 , 0 ); assert(max(abs([ r ; t ; p ] - [ 1 ; pi/2 ; 0 ])) < 1e-10) [ r t p ] = rec2sph( -1 , 0 , 0 ); assert(max(abs([ r ; t ; p ] - [ 1 ; pi/2 ; pi ])) < 1e-10) [ r t p ] = rec2sph( 0 , 1 , 0 ); assert(max(abs([ r ; t ; p ] - [ 1 ; pi/2 ; pi/2 ])) < 1e-10) [ r t p ] = re...
% This script runs the delta rule clear; % "Global" variables SEPARABLE_DATA = 0; NONSEPARABLE_DATA = 1; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Set to 1 for LaTeX labeling, 0 for default labeling LATEX = 1; % Choose data set to be used mode = SEPARABLE_DATA; % Set number of hid...
close all; clear all; for Kp = [50 300] Kd = Kp/5; sim('linearyzacja_EDDA.slx',60); figure(); subplot(2,1,1); plot(t,e1); title('Błąd położenia pierwszego przegubu (e1)'); xlabel('czas [s]'); ylabel('błąd'); hold on; grid on; subplot(2,1,2); plot(t,e2); title('Błąd p...
%% --- Read, Display and Writing Images using Matlab --- %% %% --- Init --- %% clear, close all clc %% --- Step1: Reading an image und display it's dimension --- %% % Images are read into the Matlab environment using the 'imread(filename(or path))' built-in function % % The following statement reads the image fr...
clear all; clc; t = 0:0.3:30; y = sqrt(t); plot(t,y,'m--+') grid off; xlabel('t') ylabel('sqrt(t)') title('Графік sqrt(t) від t') text(1, 1, '\it {Варіант 9}')
%% Mean Photon deviations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %the data used gets reshaped thus only run the script once on saved data, %then load the saved data again to replot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for i=1:3 MeanPhotonStartDeviationSlidingTimeWindo...
function [rxBits,nBlocks] = LDPC_decoder(LLRs,PCM_FEC,idx_FEC,nIter_FEC) % Last Update: 09/11/2019 %% Input Parameters [nBits,nPol] = size(LLRs); %% Initialize LDPC Decoder ldpcDec = comm.LDPCDecoder(PCM_FEC,'MaximumIterationCount',nIter_FEC); [OH_blockLength,LDPC_blockLength] = size(PCM_FEC); nBlocks = floor(nBits...
function [inputMovie] = normalizeMovie(inputMovie, varargin) % Takes an input movie and applies a particular spatial or temporal normalization (e.g. lowpass divisive). % Biafra Ahanonu % started: 2013.11.09 [09:25:48] % inputs % inputMovie = [x y frames] 3D matrix % outputs % inputMovie = [x y frames] 3D matri...
function matAssembleStiffMatrixAndRHS( obj, TempRHS, PSPX, PSPY, Wold, Wnew, deltatime, PWPS, Unew, Uold, Vnew, Vold, PUPX, PUPY, PUPS, PVPX, PVPY, PVPS, PHPX, PHPY) rho = obj.NonhydrostaticSolver.rho; K31 = PSPX; K32 = PSPY; mesh = obj.meshUnion(1).mesh2d; cell2d = mesh.cell; edge = mesh.InnerEdge; W = cell(1); W{1}...
function z = interleave_matrices(x,y) % General-Purpose Toolbox - a package of utilities used primarily for % in-house analysis workflows. This set of tools was developed as an % in-house package by the Stroke Rehab Team of the Functional Electrical % Stimulation (FES) Center in Cleveland, Ohio. This software is a...
function [S_corr,T2,T2curve] = T2filter_vsasl3dflex(S,T2weight,navpts,TE,dt) % function [S_corr,T2,T2curve] = T2filter_vsasl3dflex(S,T2weight,navpts,TE,dt) % % Fits the echo train to a T2 decay curve and then multiplies the echo % train by a compensation function to correct for the decay , like this: % echo_out(n) = ec...
camlist = webcamlist; for i=1 : length(camlist) cam = webcam(i); cam.name end
function [postParticles] = Estimator(prevPostParticles, sens, act, estConst, km) % The estimator function. The function will be called in two different % modes: If km==0, the estimator is initialized. If km > 0, the % estimator does an iteration for a single sample time interval using the % previous posterior partic...
classdef (Abstract) iC %Interface_Compose Summary of this class goes here % Detailed explanation goes here % Interface Class methods [qpr_ann,q,p,r] = UpdateAnn(obj,sm,ann,delta,q,p,r) end end
load "config.m"; F<nu> := QuadraticField(5); ZF := Integers(F); N := ideal<ZF|[1]>; prec := 100; M := HMFSpace(F, prec); X := HeckeCharacterGroup(N); triv := X!1; eta := Random(X); psi := Random(X); E2 := EisensteinSeries(M, N, eta, psi, [2,2]); E4 := EisensteinSeries(M, N, eta, psi, [4,4]); assert E2...
function [ x ,y ] = foo() %UNTITLED2 Summary of this function goes here % Detailed explanation goes here x = 1; y = 2; end
function [dZ_dEta] = dZ_dEta(p,eta,xi) dZ_dEta = 1/(p.Zn-1) *(p.Lmax + (p.Lmin - p.Lmax) * ( xi/(p.Xn-1)) ^p.alpha); % dZ_dEta = 1/(p.Zn) *(p.Lmax + (p.Lmin - p.Lmax) * ( xi/(p.Xn)) ^p.alpha); end
classdef qRegisters < handle % % Copyright 2016 Yulin Wu, USTC % mail4ywu@gmail.com/mail4ywu@icloud.com % how to use: % qRegs = sqc.qobj.qRegisters.GetInstance(); % q1 = qRegs.get('q1'); % % before running a script, it is recommended to relaod all qubits: % qRegs = sqc.qobj.qRegisters.GetInstance(); % qRegs.rel...
function [ REST,REFT ] = InsertTimeCompute( taskDAG, nodeCount,ProcessorComPower,serverCount,transRate,transData,computeCost, candidateNode,candidateServer,scheduletable,schedule,scheduletemp,schedulelength,computeStartup,searchStart,timeslot) %InsertTimeCompute "处理器中的任务调度--插入子任务(包括重复子任务)" % 将candidateNode卸载到candidateS...
function [ys, W, err] = do_nlms(x, d, n, mu, lambda, T) % Execute the NLMS % d - signal to compute % n - order % miu - step % lambda - Filter for the error squared % T - Number of steps epsi = 1e-300; % Divison by zero protection % This is for storing the results W = zeros(T + 1, n...
function [success] = viewLineFilledError(inputMean,inputStd,varargin) % Makes solid error bars around line. % Biafra Ahanonu % started: 2014.01.03 [19:13:01] % inputs % inputMean - Vector [1 timePoints] of y mean for each value of % inputStd - Vector [1 timePoints] indicating the std or SEM at each time point i...
function [inp_struc] = Load_history(type, time, varargin) % LiTrack_prepData_LCLS prepares an input file for LiTrack % that describes the longitudinal parameters of the LCLS % accelerator. % % INPUTS % type: 0 = design machine. Parameters from constants % 1 = extant machine. Parameters from control system...
%% figure; load('foconmuchexc') plot(double(t(1:end-1) - t(1))/1000, [fc;fv;fo]) axis([0 35 -0.05 0.2]) legend('fc','fv','fo') xlabel('t(s)') title('Convergence of RLS parameters with much excitation') %% figure; load('foconnoexc') plot(double(t - t(1))/1000, [fc;fv;fo]) axis([0 35 -0.05 0.2]) legend('fc','fv','fo') xl...
function [coefCellnew, ntheta] = coefcheck(coefCell) % COEFCHECK checks the cell array of coefficient functions defining a % possibly forced linear system of llinear differential equations. % % COEFCHECK goes through the following steps: % % 1, each cell is checked for being a struct object. % If this test is no...
function [PcaOutputSpatial PcaOutputTemporal PcaOutputSingularValues PcaInfo] = run_pca(inputMatrix, num_PCs, varargin) % runs PCA on an input 3D matrix aiming to output number of PCs specified in input % inputs % inputMatrix: input movie (give a character string pointing to the movie file) or matrix ([...
% -------------------------------------------------------------------------- % % Copyright (C) 2018-2020 David Papp and Sercan Yildiz. % % Redistribution and use of this software are subject to the terms of the % 2-Clause BSD License. You should have received a copy of the license along % with this program. If not, see...
% exm7_ztrans_iztrans.m % 例7,ztrans和iztrans示例 % 北京邮电大学,尹霄丽 % 2018年12月 syms n a b z x=a^n; X=ztrans(x); H=1/(1-b*z^(-1)); Y=X*H; y1=iztrans(Y) y=simplify(y1)
load('rit18_data.mat'); %% Relabel Training labels relabeled_training = relabel(train_labels); %change the name of the first argument to the desired file name. save('train_labels_', 'relabeled_training'); %print("train label") %% Relabel Validation Label relabeled_val = relabel(val_labels); %change t...
function yn = isonpath(dirs) % ISONPATH Checks if given directory ison the current MATLAB path. % Accepts cell-arrays of strings. % % y = ISONPATH(dirs) for string [dirs] checks whether the specified % directory is on the MATLAB search path. The output [y] is a logical % scalar equal to 'true' when ...
clear all; close all; hinfo = hdf5info('CASE.sim.h5'); dset = hdf5read(hinfo.GroupHierarchy.Datasets(12)); dx = 5; dy = 5; dz = 1; tmax = size(dset,1) var = 5; for t = 1:tmax l=0; for i=1:dz for j=1:dy for k=1:dx l=l+1; Mat(k,j,i,t) = dset(t,var,l); ...
function LBCN_plot_Kurtosis_Skewness(fname,threshold) % Function to compute and plot the Kurtosis and the Skewness of each % channel. A 'bad' channel detection can then be performed based on % computed thresholds. % Inputs: % - fname : Name of file to look at (SPM format) % - threshold: Whether to perform threshold...
function PDOT = PDOT(P3,P1) % PDOT= rate of change of power if (P1>=50.0) % P3= actual power, P1= power command if(P3>=50.0) T=5.0; P2=P1; else P2=60.0; T=RTAU(P2-P3); end else if (P3 >= 50.0) T=5.0; P2=40.0; else P2=P1 T...
function[flag]= calcola(handles, t) %inserisco i dati nella struttura handles.dati.degree=str2double(get(handles.edit2,'String')); handles.dati.mid_point=str2double(get(handles.edit4,'String')); handles.dati.algorithm=get(handles.popupmenu1,'Value'); %converto le stringhe di punti in array points=str2num(get(ha...
function cmd = set_speed_tcp(obj,varargin) % set the tcp speed in tcp coordinate frame % v: [x,y,z,rx,ry,rz] x,y,z:m/s rx,ry,rz:rad/s if strcmp(obj.s2.status,'closed') % if s2 is not open then open it fopen(obj.s2); end v = varargin{1}; if nargin==3 a = varargin{2}; else a = obj.a_tool; end t=1;...
%LOAD_HIGHWAY1 Loads the basketball test video and rescales the dynamic range % % Mehdi Bahri - Imperial College London % July, 2016 load('highway.mat'); X = normalize_dynamic_range(X); clear rowidx colidx
x = [0,0,0,0,1,1,1,1]; y = [0,0,1,1,0,0,1,1]; z = [0,1,0,1,0,1,0,1]; interval=0:.01:1; [X,Y] = meshgrid(interval); a=2.8456160940803605; b=2.992423524879141; c=3.0273892995886458; d=7.956427158845949; Z=(d- a * X - b * Y)/c; surf(X,Y,Z) shading flat xlabel('x'); ylabel('y'); zlabel('z') plot3(x,y,z,'ro', Z)
function [h] = getImageFeaturesSPM(layerNum, wordMap, dictionarySize) % Compute histogram of visual words using SPM method % Inputs: % layerNum: Number of layers (L+1) % wordMap: WordMap matrix of size (h, w) % dictionarySize: the number of visual words, dictionary size % Output: % h: histogram of visual...
% a function to get node features function nodesFeatures = getNodeFeatures(nodes,img,M,N) % a simple example to compute the features of each node, here a node is assigned a boolean whether it is a boundary or not % initialize nodesFeatures = zeros(length(nodes),1); % 1. Is it a boundary pixel for i = 1: length(nodes...
% the MVDR beamformer % h = PhiN^-1 * steerVec / steerVec^H * PhiN^-1 * steerVec % input: PhiN, (Nch, Nch, Nbin) the noise covariance matrix % PhiX, (Nch, Nch, Nbin) the speech covariance matrix % refMic, the reference microphone, default = 1 % output: h, (Nch, Nbin) the beamformer coefficient...
% Developed by Arian Shoari. Copyright 2017 John Foxe's Lab, University of Rochester. % 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://www.apache.org/licenses/LICENSE-2.0 % Unless agreed t...
function updateNowLocation() global num_node for i = 1:num_node getNowLocation(i); end end
function mi = ModulTorzijeZice (l, r, C) b = (2*l)/(pi*(r^4)); mi = C.*b; endfunction
%usar solo con datos generados por PUTTY %usar solo con datos generados por processing [ALL]=csvread('Corriente_escalon4.csv'); %%valor de muestras [A]=ALL(:,2); %temp [B]=ALL(:,3); %hum [C]=ALL(:,4); %pres [D]=ALL(:,5); %densidad [E]=ALL(:,6); %lec DdP (V) [F]=ALL(:,7); %DdP (P) [G]=ALL(:,8); %DdPc/filtro [H]=ALL(:,9...
function res = manny() % find the velocity that _just_ gets the ball over the wall initial_guess = 45; % m/s velocity = fzero(@crossover_func, initial_guess); res = velocity; end function res = crossover_func(velocity) % this function crosses through zero when the height of the ball at ...
function f_value = ecmnobj_fast(samples, c, n_lat, n_lon) %ECMNOBJ_FAST A fast version of ECMNOBJ to evaluate negative %log-likelihood function by the DFT. % % F_VALUE = ECMNOBJ_FAST(SAMPLES, C, N_LAT, N_LON); % % Inputs: % SAMPLES - the row vector of stacked (u, v) observations with length % p*n, where p=2 % ...
function [Xmoy] = image_moy(I) Xmoy = mean(I,3); end
% This function computes the r, L, and C in per unit length from the ABCD % constants of a transmission line. % % Copyright (C) 1998 by H. Saadat function [r, L, C, f] = abcd2rlc(ABCD) global resp model par1 par2 linelngt freq if exist('ABCD')~=1 A = input('Enter the complex line constant A = '); B = input('E...
load AIS_dataset.mat ps=[] for elec=5:100 %69 index_speech=find(strcmp("Speech",AISvals(:,3)) & str2double(AISvals(:,4)) > 100); ais_speech_nan=AISvals(index_speech,elec); ais_speech_elcd = ais_speech_nan(~isnan(str2double(ais_speech_nan))); index_comp=find(strcmp("Comprehension",AISvals(:,3))& str2double(AISvals(:,4)...
% % function [deltas,indx_sort]=sortMeasures(measures,corners); % % Calculates sensitivity of measurement to independent variables. Assumes that corners are in % ascending binary order. % % measures - measurements % corners - corner values % % deltas - measurement sensitivity % indx_sort - sensitivity indexe...
function [] = set_keithly195(varargin) %GET_KEITHLY195 Sets up a Keithly 195 %% Instrument Connection % Find a GPIB object. obj1 = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 16, 'Tag', ''); % Create the GPIB object if it does not exist % otherwise use the object that was found. if isempty(obj1) ...
function [ ] = SR_by_PCA( par, El, Eh, mY, mX, X, Vl, Dh ) %reconstruct face images img_path = par.test_path; img_type = par.test_type; img_dir = dir( fullfile(img_path, img_type) ); img_num = length(img_dir); for i = 1:img_num imHR = imread(fullfile( img_path, img_dir(i).name)) ; [imHR, imLR] = get_LR( im...
function spcorr=corarr(xk); %CORARR spcorr=corarr(xk); % xk is 4D array: % frequency x taper x time x channel % spcorr is 3D array: % frequency x frequency x channel % % spcorr - correlation coefficients % of log(S(f1,t)) and log(S(f2,t)) % with their means removed, where % f1 and f2 = fmin, ... ,...
function out1 = dw1dmngr(option,win_dw1dtool,in3,in4,in5) %DW1DMNGR Discrete wavelet 1-D general manager. % OUT1 = DW1DMNGR(OPTION,WIN_DW1DTOOL,IN3,IN4,IN5) % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96. % Last Revision 08-May-2012. % Copyright 1995-2012 The MathWorks, Inc. % $Revision: 1.18.4.1...
function[A] = contatoreelem(X) A = [X(1), 1]; for i=2:size(X,1) justinsert = 0; j = 1; while (justinsert==0) if(A(j, 1) == X(i)) A(j, 2) = A(j, 2) + 1; justinsert = 1; end if(j == size(A,1)) A = [A; [X(i), 1]]; justinsert = 1; end j++; endwhile end A=...
function cond = annotation_exist(img, mode) if nargin ==1 mode = 1; end dim = size(img); dim_2d = dim(1:2); x = dim(1); y = dim(2); indexs = []; cond = 0; img_new = zeros(dim_2d); img_new2 = img; for i = 1:x for j = 1:y value = img(j,i,:)...
%{ 通过中断,读取串口数据,显示传感器压力数据速度变化曲线和某传感器块滤波前后的压力数据曲线 %} function myserial_Arduino_interupt %% 如果matlab已经打开了串口,关闭它,防止占用 if ~isempty(instrfind) fprintf('关闭已打开串口: \r\n'); fclose(instrfind); delete(instrfind); end %% 中断设置 global s n linedata_last line maxSize = 300; ...
function mu = msmu(simu, mavp, t0, t1) % Constant installation error angles 'mu' estimation between master- & slave- INS % using transfer align method. % % Prototype: avp = insinstant(imu, avp, t0, t1) % Inputs: simu - slave IMU % mavp - master AVP % t0 - start time in second. % t1 - end time in...
function [net, info] = lienet_train_g3d(net, lie_train, opts) opts.errorLabels = {'top1e'}; opts.train = find(lie_train.lie.set==1) ; opts.val = find(lie_train.lie.set==2) ; for epoch=1:opts.numEpochs learningRate = opts.learningRate(epoch); % fast-forward to last checkpoint modelPath = @(e...
function theta=cal_theta(mesh1,normal_vector) %输入mesh 和 基面的法向量 返回弧度制的角度 if nargin==1 normal_vector = [0;0;1]; end [T,Xb]=search(mesh1); TR = triangulation(T,Xb); F = faceNormal(TR); theta = acos((F*normal_vector)./norm(normal_vector,2));%弧度制 end
%% Program to find Consecutive points inorder to find the flow of data WindSpeed %% Cleaning history and command Window clear; clc; %% Importing Data file filename ='..//Raw Data//Raw Met Data.dat'; %File path startRow = 2; formatSpec = '%10f%7f%7f%8f%7f%f%[^\n\r]'; %datatype specifiers f1 = fopen(filename,...
function [energies,psiSquared]=PEspectrum(s_ion,ladderind,eMax,varargin) % This function calculates the PhotoeElectron spectrum from the output of % the 0D StrongFieldIonization code based on the population of the chosen % ladder states. if nargin==3 timeind=size(s_ion,1); elseif nargin==4 timeind=va...
function [pts2] = epipolarCorrespondence(im1, im2, F, pts1) % epipolarCorrespondence: % Args: % im1: Image 1 % im2: Image 2 % F: Fundamental Matrix from im1 to im2 % pts1: coordinates of points in image 1 % Returns: % pts2: coordinates of ...
classdef BohaiEstuary < SWEBarotropic3d %BOHAIESTUARY 此处显示有关此类的摘要 % 此处显示详细说明 properties( Constant ) hcrit = 0.1; SMSFile = [pwd,'\Application\SWE\SWE3d\Benchmark\@BohaiEstuary\Data\fort.14']; tidalFile = [pwd,'\Application\SWE\SWE3d\Benchmark\@BohaiE...
function [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = fmincon(FUN,X,A,B,Aeq,Beq,LB,UB,NONLCON,options,varargin) %求解下列形式非线性规划问题: % min f(x) s.t. Ax<= b, Aeqx=beq, % c(x)<=0, ceq(x) = 0, lb<=x<=ub %调用格式为: % x=fmincon(fun, 初值,A,b,Aeq,beq,lb,ub,nonlcon) % 此时当约束条件中缺A和b、Aeq和beq或lb和ub时, ...
% Model L1 = 1e-5; C1 = 1e-6; L2 = 1e-5; C2 = 1e-5; R = 1; Vdc = 10; T = 100; tau = 5e-7; regularization = .1; sw_cost = 1.5; Gtilde = [ 0, -1/L1, 0, -1/L1 1/C1, 0, -1/C1, 0 0, 1/L2, 0, 0 1/C2, 0, 0, -1/(R*C2) ]; htilde = [...
%% Assumptions % Cannot Surrender hands % Can double down % Can only split once % Dealer hits on soft 17 (so does player per dealto.m) % Insurance never used % Blackjack pays 1.5x n = 1000; countthreshold = 19; maxbet = 50; wins = zeros(n,1); handsatcount = zeros(40,1); winsatcount = zeros(40,1); for i = 1:n %% In...
n = 5; V = zeros(factorial(n-1),n*(n-1)/2); for index = 0:factorial(n-1)-1 it = index; cycle = [1 zeros(1,n-1)]; remains = 2:n; for k=2:n temp = floor(it/factorial(n-k))+1; cycle(k) = remains(temp); remains(temp)=[]; it = mod(it,factorial(n-k)); end v0=1; ...
%% calculate the fluid properties based on the pressure and saturation given function [fluid] = fluid_property_calc(P_vec, fluid, grid) % gas viscosity is a function of pressure gasViscosity = @(pressure) 3E-10 * pressure.^2 + 1E-6 * pressure + 0.0133; % Relative Permeability k_ro = @(s_g) (1 - s_g) .^ 1.5; k...