text
stringlengths
8
6.12M
function res = intgrlterm2(solx, i, n ,T) if(i==1) disp('ACHTUNG!!!!!!!!!!!!!!!!!!!!!!!!!!!(intgrl, i cannot be 1)'); end temp = 0; for k=1:n temp = temp + norm(solx(1,:,k) - solx(i,:,k))^4; end res = T/n*temp; end
%% Filtering Demo % This program demonstrates Domain Transform filtering using cv.DTFilter % % <https://github.com/opencv/opencv_contrib/blob/3.1.0/modules/ximgproc/samples/live_demo.cpp> % function varargout = dtFilter_demo_gui(im) % Load an image if nargin < 1 src = imread(fullfile(mexopencv.root(),'...
function[alignment Ohist] = est_orientation(P,U,vect) %EST_ALIGNMENT(P,U,vect) - look at the fiber alignment if nargout >=3 histflag = 1; else histflag = 0; end X0 = P.X0; F = P.F; if histflag thetaN = 10; phiN = 10; Ohist = zeros(thetaN,phiN); Anorm = zeros(thetaN,phiN); theta_range ...
function TT_ZX = eikonal2D_edited(model,temp,Pilih) % TT_ZXY = eikonal2D(V_ZX, dx, XS, ZS) % % Fast-marching eikonal equation solver following Sethian & Popovici % (Geophysics 64 no 2 pp 512-523, 1999) % % V_ZX: unpadded velocity model % dx: grid spacing % XS, ZS: shot location as an index into the V_ZX. Note ...
function plot_periods figure; clf; hold on; f0 = 833000; hmin = 0; pp=0:0.1:30; % measured values delta = 0.8247./(pp+8.007)+1.135; cpar = 38100./(pp+20.54) + 578; cper = cpar./delta; addpath ~/he3lib/lib/matlab/ % cper = he3_text_cperp(0.1, pp); % cpar = he3_text_cpar(0.1, pp); nub = h...
function testResultChecker(tRes) %TESTRESULTCHECKER Summary of this function goes here % Detailed explanation goes here failBit = tRes.Failed; if failBit error(['test ' tRes.Name ' failed']); end end
function [hits] = findFileType(locn, type) % findFileType - for a given folder find all files in it with the specified % extension. This is useful for folders which haven't been indexed, like % Ottmar's hard drive or the Z drive. % if strcmp(locn(end),filesep) % locn = locn(1:end-1); % end % Can we do it purely i...
function com = combinations(n,k) % COMBINATIONS calculates the number of ways you may choose k elements from % n elements. For example, you can choose 2 elements from 3 elements in % 3!/(2!(3-2)!) = 3 ways if k > n error('Cannot calculate with given values') end com = factorial(n)/(factorial(...
% $Header: svn://.../trunk/AMIGO2R2016/Preprocessor/AMIGO_paths_PE.m 2487 2016-02-23 14:01:49Z evabalsa $ % AMIGO_paths_PE: Generates and adds necessary paths for PE % %****************************************************************************** % AMIGO2: dynamic modeling, optimization and control of biological syst...
classdef ConeOData < sbfsem.io.OData % CONEODATA % % Description: % Import cone outlines from OData % % Constructor: % obj = ConeOData(source); % % Methods % IDs = obj.getConeIDs(coneType); % % History % 5Jan2018 - SSP % 8Feb2018 - SSP - Added undefined (U) cone type % 5Mar2018 - SSP - Updated to new JSON...
function I = analyze75read(varargin) %ANALYZE75READ Read image file of Mayo Analyze 7.5 data set. % % I = ANALYZE75READ(FILENAME) reads the image data from the IMG file of % an Analyze 7.5 format data set (a pair of FILENAME.HDR and FILENAME.IMG % files). For single-frame images, I is an M-by-N array where M is ...
function step = ai(realcapture) % --------- 输入参数说明 -------- % % realcapture是摄像头捕获的图像(矩阵),具体格式是rgb、ycbcr或灰度 % 由你的user_camera函数的返回值(也叫realcapture)决定 % --------- 输出参数说明 -------- % % 计算出的操作放在step数组里,格式如下: % 若当前已无法找到可以相连的块,则step = -1 % 否则step里有四个数,代表把(step(1), step(2))与...
clear plan=3; switch plan case 1 load bird200.mat case 2 load fire500.mat ln=5; case 3 load yezi600.mat ln=1; case 4 load shizi1500.mat case 5 load fenghuang2000.mat case 6 load hudie3000.mat case 7 load niao21000.mat ...
function mask=generatemask(img) mask = zeros(size(img)); row = size(img,1); col = size(img,2); for i = 1:size(img,1) for j =1:size(img,2) if sum(img(i,j,:))~=0&&sum(img(min(i+3,row),j,:))~=0&&sum(img(i,min(j+3,col),:))~=0.... &&sum(img(max(1,i-3),j,:))~=0&&sum(img(i,max(1,j-3),:))~=0&&sum(img(m...
function A = jac6DoF(Z, U, trajData) ac = trajData.ac; VR = trajData.VR; % Z = [u,v,w,p,q,r,phi,theta,psi,x,y,z] % U = [df, da, de, dr] u = Z(1); v = Z(2); w = Z(3); p = Z(4); q = Z(5); r = Z(6); phi = Z(7); theta = Z(8); psi = Z(9); x = Z(10); y = Z(11); z = Z(12); df = U(1); da = U(2); de...
function E = calculeazaEnergie(img) %calculeaza energia la fiecare pixel pe baza gradientului %input: img - imaginea initiala %output: E - energia %urmati urmatorii pasi: %transformati imaginea in grayscale %folositi un filtru sobel pentru a calcula gradientul in directia x si y %calculati magnitudinea gradientului %E...
function D = NN_distance_matrix(points); %%NN_distance_matrix calculates mean of the minimum Euclidean distance between 2D coordinates %INPUT:points, n*2 coordinates %OUTPUT:D: distance matrix %%Author Nazanin Zounemat Kermani, Imperial college London, 2016 n=size(points,1); points = points'; L2 = sum(points.^2,1); D =...
% Copyright (C) Daphne Koller, Stanford University, 2012 function EU = SimpleCalcExpectedUtility(I) % Inputs: An influence diagram, I (as described in the writeup). % I.RandomFactors = list of factors for each random variable. These are CPDs, with % the child variable = D.var(1) % ...
clear all; close all; clc; line_widht = 2; %% Input data_type = input('signal(gate/step/rampa/seno): ', 's'); validatestring(data_type, {'gate', 'step', 'rampa', 'seno'}) file = strcat('../data/motor_', data_type, '.lvm'); data = load(file); %% DATA experimental proviene desde la planta u = data(:, 2); y = data(:, 4)...
% Produces data for figures 3 and 4. % How does the geodetically constrained core density and moment of inertia % compare to the geochemically predicted? % Figure 3, part a: geodetic constraints. lib_amp_Bertone_2021 = 39.03; dlib_amp_Bertone_2021 = 1.1; [C_m, dC_m] = fn_get_C_m(lib_amp_Bertone_2021, dlib_amp_Berto...
figure hold on clc; clear all; %% Parametros límite contenedores y escenario l_cont=2.5; lim_xi=-30+l_cont/2; lim_xd=0-l_cont/2; ml_min=2000; ml_max=50000; base_x=[-38 0 0]; base_y=[0 0 -30]; barco_x=[5 5 50 50]; barco_y=[15 -20 -20 15]; mar_x1=[0 5]; mar_y1=[-5 -5]; mar_x2=[50 68]; mar_y2=[-5 -5]; carro_x=[-38 68]; ca...
function [path] = dijistra_path(prev, s, v) % prev是最短路终点的前驱矩阵 % path将输出源点s到终点v的路径 path = v; if path(1)!=s path = [prev(path(1)), path]; endif path = [s, path]; endfunction
%% clear; clc; username = char(java.lang.System.getProperty('user.name')); toolpth_ = [ filesep 'Users' filesep username filesep 'Documents' filesep 'tools']; pth_ = pwd; assert(strcmp(pth_(end-3:end), 'code'), 'Please cd to folder'); data_pth_ = [pth_(1:end-4)]; addpath([toolpth_ filesep 'fieldtrip']); ft_defaults; s...
function [v, sub, sat] = LGF_proc_(p, u) % LGF_proc: Loudness Growth Function % function [v, sub, sat] = LGF_proc(p, u) % % Inputs: % p: Parameter struct, with the following fields: % p.Q: Percentage decrease of output when input is 10 dB below sat_level. % p.lgf_alpha: Curve shape fac...
function [output]=frac2bin(a,ibits,fbits); % [output]=frac2bin(a,ibits, fbits); % a= number to be converted % ibits=integer part bits, must be an integer >0 % fbits=number of fractional bits, must be an integer>=0 % This returns an array [output] that is the input number ...
function main_run % % To run, type: main_run % % Compare the solutions of the Burgers'Equation from % 1) Full order system % 2) POD reduced sytem % 3) POD-DEIM reduced system % % y(0,t) = y(1,t) =0, t \ge 0 % y(x,0) = y_0(x), x \in [0,1], % %% Solve the full-order system and collect snapshots n = ...
function [output_signal] = question1c(noise_magnitude) % The function takes in a parameter which determines the magnitude % of the noise relative to the norm of the input signal. It is expressed in % percentage. A 5% percent noise would mean noise_magnitude = 5 and not % 0.05. %The convolution kernel h = [1 2 3 4 3 2 ...
format long; format compact; gpudev = gpuDevice(1); % get the GPU device info = h5info('./temp/signal.h5'); sigSize = info.Datasets(1).Dataspace.Size; horizontalSignal_mpi_mat = h5read('./temp/signal.h5', '/signal', [1 1], sigSize); FFP_z = h5read('./temp/signal.h5', '/FFP_z', [1 1], sigSize); FFP_x = h5re...
function runTrainTest(fname,rfold, wfold ,arrFuzSig,oldarrFuzSig, param, w1) %UNTITLED Summary of this function goes here % Detailed explanation goes here feature = fname; numRaws=60; % default input files pred_vals = []; pred_lable = []; TP=0;FP=0;FN=0;TN=0; parfor i=1:numRaws trainData = csvread(strcat(rfold, f...
spmPath='/Volumes/Aidas_HDD/MRI_data/S1/Analysis/' load('/Volumes/Aidas_HDD/MRI_data/S1/Analysis/SPM.mat') mask_fn='/Volumes/Aidas_HDD/MRI_data/S1/Analysis/mask.nii'; target_betas = [15:29 36:50 57:71] %filenames=SPM.xY.P(target_betas,:); % raw epi's get loaded here, filtered, %saved as separate.nii's for i=1:length(t...
%DRAWAXIS Draw coordinate system axis from pose estimation % % img = cv.drawAxis(img, cameraMatrix, distCoeffs, rvec, tvec, length) % % ## Input % * __img__ input image. It must have 1 or 3 channels. In the output, the % number of channels is not altered. % * __cameraMatrix__ input 3x3 floating-point camera m...
function [rhsu] = HeatLDGRHS1D(u,time) % function [rhsu] = HeatLDGRHS1D(u,time,a,ax) % Purpose : Evaluate RHS flux in 1D heat equation using an LDG flux Globals1D; % Define field differences at faces du = zeros(Nfp*Nfaces,K); du(:) = (1.0+nx(:)).*(u(vmapM)-u(vmapP))/2.0; % impose boundary condition -- Di...
close all top_ROI= inputdlg("top"); %Top_ROI top_ROI=str2num(top_ROI{1}); bottom_ROI= inputdlg("botom");%Bottom_ROI bottom_ROI=str2num(bottom_ROI{1}); %Read filenames from list [Dateiname]= textread('/Users/fvalero/Documents/MATLAB/orig_datei/DateiListe.txt','%s ',150); %Folder for reading data and write res...
function [CompInfo] = DetectComp %============================ DetectComp.m ================================ % This function queries and returns information about the computer that the % function is run on, which can in turn be used to identify the machine and % load appropriate parameters. % % Written by Aidan...
function[out_img] = DetectLines(img, angle, sigma_val) img_size = size(img); angle_line = angle; angle_process = angle_line; sigma = sigma_val; line_length = 3; original = uint8(img); if img_size(3) == 3 img = rgb2gray(img); elseif img_size(3) > 3 original = uint8(img(:,:,1:3)); img = rgb2gray(img(:,:,1...
startFrame = 2; endFrame = 400; numFrames = endFrame - startFrame + 1; imHeight = 270; imWidth = 480; binImgThreshold = 0.35; k = 5; km_iters = 5; % places all the images into a nice array ims = cell(numFrames, 1); i=1; for f = startFrame:endFrame imName = strcat('imgs5/',int2str(f),'.png'); ims{i} = ...
function dfri_heel = dfri_heel(in1,s_heel) %DFRI_HEEL % DFRI_HEEL = DFRI_HEEL(IN1,S_HEEL) % This function was generated by the Symbolic Math Toolbox version 8.4. % 25-Jun-2020 15:35:57 q1 = in1(:,1); q2 = in1(:,2); q3 = in1(:,3); q4 = in1(:,4); q5 = in1(:,5); q6 = in1(:,6); qd1 = in1(:,7); qd2 = in1(:,8); qd...
function start global logger_file; logger_file = sprintf('logs/%s.txt', datetime('now', 'Format','d-MMM-y_HHmmss')); % state variables states = Stack(3); states.Cv2Str = @decode_state; states.push(START); while true curr_state = states.pop(); ...
falls_list = [10,3;11,1;12,1;13,1;14,1;15,1;16,1;17,2;18,1;19,1;20,3;21,1;22,3;23,1;24,1;25,2;26,1;27,1;34,4;35,1;36,1;37,1;38,2;39,3;43,1;44,1;45,2;46,1;47,1;48,1;49,1;50,1;51,1]; label_corridor_cha = ... ['bendpick ';'bendpick ';'bendpick ';'empty ';... 'empty ';'empty ';'jump ';'...
function allSlices = generateOptimizedPrintPlan3D(structure, angles, splitLineX, splitLineY, printPlanGrid, normalVectors, zmax, createPlotting) splitedInX = splitSector3DInX(structure, splitLineX); splitedInXY = cell(size(normalVectors, 1), size(normalVectors, 2)); printPlanGridTemp = reshape(printPla...
classdef structOptimalControlOutput < handle properties time; inds; q; c; ocStruct; optStruct; optPivot; splinePoints; constPoints; resnorm; end methods function obj = structOptimalControlOutput()...
%% Epoching varExist = exist('spect2Plot','var'); if varExist == 0 spec2Plot = true; end alignEvent_MI = spectrogramData{1}.state.ST_MOV; alignEvent_Base = spectrogramData{1}.state.ST_HOLD; alignEvent_OFFDECODED = spectrogramData{1}.state.ST_OFFDECODED; epochs_PSD_ONSET = extract_epochs_runs(spectrogramData,....
clear clc grade = input('what grade? '); if grade >= 90 letter = 'A' elseif grade >= 80 letter = 'B' elseif grade >= 70 letter = 'C' elseif grade >= 60 letter = 'D' else letter = 'F' end
% SAMPLE1 - Visual presentation of words at a constant rate config_display %this is equivalent to: %config_display(1, 1, [0 0 0], [1 1 1], 'Helvetica', 50, 4, 0) % Specifiy data file to be 'sample1.dat; config_data( 'sample1.dat' ); start_cogent; for i = 1:countdatarows % Get word from data word = getdata...
function output = runNetvlad(filelist) setup ; paths = localPaths() ; if(~iscell(filelist)) error('filelist must be a cell array'); end %save([folder '/tmp_netvlad_filelist.mat'], 'filelist'); % Loading model netID = 'vd16_pitts30k_conv5_3_vlad_preL2_intra_white' ; load( sprintf('%s%s.mat', paths.pretrainedCNN...
% % Tone Mapping Operator, by Reinhard 02 paper. % % input: % img: HDR img([row, col, channel]) % a: key value(high:0.36, noraml:0.18, low:0.09) % Lwhite: user determined, the smallest luminance to be mapped to 1. (1.5) % % output: % tone-mapped image (LDR) % function imgOut = tonemapGlobal(img, a, Lwhite) ...
function stats = kfold_validation(data, classifier, k) % performs a k-fold cross-validation on the data % using the model of the classifier (class) % and lastly computes and returns stats for the classification rows = size(data, 1); stats = zeros(1, 4); ceiling = ceil(rows/k); ...
function L = lap(A,nl) %LAP Calculate the Laplacian of an adjacency matrix. % % Input A: n by n adjacency matrix (symmetric). % nl: flag for normalization. % nl = 0 means unnormalized, nl = 1 means normalized. % Defaults to nl = 1. % % Output L: n by n Laplacian ...
function [xfrm_matrices] = loadXFRMMatrix(workspace_path,pathToFsInstallDirectory,fs_subj_dir) %LOADXFRMMATRIX Summary of this function goes here % Detailed explanation goes here wspace_dir=dir(workspace_path); if(~any(contains({wspace_dir.name},'xfrm_matrices'))) disp('To correctly convert Freeview data ...
function [ outputImage ] = removeNoise( originalImage ) %REMOVENOISE function removes the noise from the image by using blurring. % 2D order statistich and median filters are used to remove the noise % from the image and it appears blurred. %%grayImage = rgb2gray(originalImage); outputImage = zeros(size(originalIm...
clear all close all clc % Problem #3 % State 1: m_1 = 10; %[kg] P_1 = 105; %[kPa] T_1 = 300; %[K] R = 0.287; %[kJ/kg-K] V_1 = (m_1*R*T_1)/P_1; %[m^3] % State 2: P_2 = 1250; %[kPa] % Input W = -2000; %[kJ] % Relating temperatures and pressure of isentropic to work for an ideal % gas to determin...
global MPI_COMM_WORLD; load 'MatMPI/MPI_COMM_WORLD.mat'; MPI_COMM_WORLD.rank = 62; Alluxio_Row_mv_version3;
function y = corr(x) % sigma(x(n)*x(n-d)) % n=100; n = length(x); y = zeros(1,2*n+1); idx = 1; for num = n:-1:0 xd1 = [zeros(1,num),x]; xd2 = [x,zeros(1,num)]; y(idx) = sum(xd1.*xd2); idx = idx+1; fprintf([num2str(idx),'\n']); end for num = 1: n xd1 = [x,zeros(1,num)]; xd2 = [zeros(1,num),x]...
function [Y,Xf,Af] = myNeuralNetworkFunction(X,Xi,~) %MYNEURALNETWORKFUNCTION neural network simulation function. % % Generated by Neural Network Toolbox function genFunction, 08-Nov-2018 01:13:11. % % [Y,Xf,Af] = myNeuralNetworkFunction(X,Xi,~) takes these arguments: % % X = 2xTS cell, 2 inputs over TS timesteps % ...
function foo = GetSubFunNames(FIDSlurp,CONTENTS) % GETSUBFUNNAMES Get the names of the file's % subfunctions % % USAGE: % FID = fopen('xlsread.m','rt'); % a = GetSubFunNames(FID) TRUE = logical(1); FALSE = logical(0); if nargin<2 CONTENTS = FALSE; end; TESTREGEX=logical(0); % DEFINE REGEX FOR FUNCTION NAMES % ...
function coef = sgmga_vcn_coef_naive ( dim_num, level_weight, x_max, x, q_max ) %*****************************************************************************80 % %% SGMGA_VCN_COEF_NAIVE returns the "next" constrained vector's coefficient. % % Discussion: % % This function uses a naive approach to the computation,...
function [] = ISBN13Checker_FM(first12, last) % ISBN13Checker_FM(first12, last) vec = ones(12,1); vec(2:2:12)=3; check = mod(10 - first12*vec, 10); if check == last printf('No Error detected.\n\r') else printf('Error Detected: The check digit %d is different from the last digit %d.\n\r', check, last) end
close all; clear; clc %Reading logging file from veristand simple thrust allocation Array = csvread('C:\Users\MCLab\Documents\GitHub\GROUP4_CS_Enterprise_CRIOlab\Logs\2017\02\06\Log File_10_05_59.csv', 1); L2_continious = Array(:,1); PosXRight = Array(:,2); R2_continous = Array(:,3); alpha_VPS1 = Array(:,4); u_BT = ...
function track_updateFrame() calllib('NPTrackingTools', 'TT_UpdateSingleFrame');
%Renames files from outputfilename to rename basefolder = 'W:\Analysis\'; slideNames = {'AJ0188_P1', 'AJ0188_P2', 'AJ0188_P3', 'AJ0188_P4', 'AJ0188_P5','AJ0188_P6', 'AJ0189_P1', 'AJ0189_P2', 'AJ0189_P3', 'AJ0189_P4', 'AJ0189_P5', 'AJ0189_P6',... 'AJ0205_P1', 'AJ0205_P2', 'AJ0205_P3', 'AJ0205_P4', 'AJ0205_P5','A...
function res = wphflm_fit(Y,model,wpspecs,MCMCspecs) %wphflm_fit Fits the Wavelet-Packet Historical Functional Linear Model and returns % posterior estimates of the histrical surface as well as scalar % covariates. Also performs Posterior Functional Inference on all % covariates of interest via Bayes...
%% Setup energy intervals E_max=0.6*eV; E_min=0*eV; n_E=200; %number of energy points to be considered EE=linspace(E_min,E_max,n_E);
function [popX, popY, popZ] = populationDecay_02(decayX, decayY, time) %POPULATION Function calculates population values for isotopes X, Y and Z %when the relationship is X->Y->Z with decay rates respectively of decayX %and decayY at the moment of time 'time'. It is assumed inital conditions %are such that popX = 1, po...
radius = input("Enter radius of cone: "); height = input("Enter height of cone: "); volume = (pi/3)*radius*radius*height; %radius^2 disp("Volume of cone= " + volume);
clear all; clc; close all; %addpath SimulationData\ load Tensor_800NoF_300Basic.mat TrainPath = 'SABS\Train\NoForegroundDay\'; addpath(TrainPath); nrow = 120; ncol = nrow*160/120; p=nrow*ncol; %% Reading the GroundTruth %GroundTruth srcFiles = dir(strcat(TrainPath,'*.png')); if length(srcFiles) > videole...
function h = plot1x3D(name, time, xdata, ydata, zdata, segInfo, cropInfo) % plot the data h = figure; scatter3(xdata, ydata, zdata, 'b.'); % all data hold on % now find the data highlighted by segInfo [~, closeInd_start] = findClosestValue(segInfo.timeStart, time); [~, closeIn...
function vec = reorder(z) %This method turns the vector z = [q1,q2,..,qN,w1,w2,...,wN] into % vec = [q1,w1,q2,w2,...,qN,wN] which is the format used in the Lie % group integrators setting. N = length(z(:,1))/6; %Number of connected pendulums q = z(1:length(z(:,1))/2,:); w = z(length(z(:,1))/2+...
function [row,col,thre] = findCornerIndex(Corner_Image,num) thre = 0; count = 340*512; while count > num count = size(find(Corner_Image > thre)); thre = thre + 1; end [row,col,thre] = find(Corner_Image > thre);
function [P,Pi] = computePandPi(Dir_alpha,Dir2d_alpha) K = length(Dir_alpha); P = zeros(K); Pi = zeros(1,K); for j = 1:K PsiSum = psi(sum(Dir2d_alpha(j,:))); for i = 1:K, P(j,i) = exp(psi(Dir2d_alpha(j,i))-PsiSum); end; P(j,:) = P(j,:) ./ sum(P(j,:)); end PsiSum = psi(sum(Dir_alpha,2)); for i = ...
% Computes the semi-analytical solution to the steady, Euler equations % in terrain following coordinates using a coordinate transformation from % XZ to alpha-xi. The reference state is a standard atmosphere of piece-wise % linear temperature profiles with a smooth zonal jet given. Pressure and % density initialized ...
%% Stelling 10 % % Een functie kan worden aangeroepen vanuit % de Workspace. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
classdef longDTI_timepoint %longDTI_timepoint - timepoint data info for a participant % Detailed explanation goes here properties Date Datenum File Fullpath GMvol WMvol CSFvol TIV ROI ...
%% This is a simple test to test rungeKuttaNystrom integration %clear in correct order if cars exist clear vis clear mdl clear all %Create a visualizer vis = Visualizer('vis',960,720); %load up a model mdl = rlCModel('planar.xml'); mdl.forwardPosition(); %Create 20 srnsors and add them to the model for i=1:100 ...
function dx = getdx(v,theta) % Is = 2156; TWratio = 2.2; g = 9.801; dx = Is*v*cosd(theta)/TWratio/g; end
%> @brief Unstructed mesh object % ====================================================================== %> NdgMesh class stores the information of unstructed mesh, %> including the elements and interpolation nodes connection. %> Each NdgMesh objects only contain one kind of ref cell. For the hybrid %> mesh, the user ...
cfg = [];tf_d=[]; cfg.parameter = 'powspctrm'; for i=1:length(tf_speech) tf_d{i} = ft_freqdescriptives(cfg, tf_speech{i}); end cfg = []; cfg.channel = 'all'; cfg.latency = 'all'; cfg.parameter = 'powspctrm'; GA= ft_freqgrandaverage(cfg, tf_d{:}); cfg = [];tf_d=[]; cfg.paramete...
%Planejamento de caminho A* clear; clc; mapa = [1 1 1 1 1 1 1 1; 1 1 1 1 1 1 1 1; 1 1 0 0 0 0 1 1; 1 1 1 1 1 0 1 1; 1 1 1 1 1 0 1 1; 1 1 1 1 1 1 1 1; 1 1 1 1 1 1 1 1; 1 1 1 1 1 1 1 1]; copiaMapa = mapa; i = [4 5]; f = [1 8]; caminhoRes = star2(i,f,mapa,copiaM...
% This code solves a simple asset pricing model that does not permit an % analytical solution. See Appendix D of Han, Tan & Wu (2021): Analytic % Policy Function Iteration. clear close all clc % Parameters beta = 0.98; rho = 0.9; sig_e = 1; sig_u = 2; sig_v = 3; % Variables xp = 1; % Shocks sd = ...
classdef Controller < dynamicprops & PusherSliderSystem & Friction properties (Constant) h = 0.03; steps=50; num_xcStates = 4; num_ucStates = 5; uc_eq= [0.1634;0.1634;0;0;0]; %For Linearization purposes xc_eq = [0;0;0;0]; %For Linearization purposes Q = 10*dia...
%> @brief The abstract limiter class. % %> And here we can put some more detailed informations about the class. % ====================================================================== %> This class is part of the NDGOM software. %> @author li12242, Tianjin University, li12242@tju.edu.cn % ============================...
% This file is similar to main.m file, but you do not have to go through % the features calculation, which is very time consuming, anymore. clc; clear; data = load('temp/tweets_and_features.mat'); allTweets = data.allTweets; features = data.features; % Re-tweet removal fprintf('\nRemoving re-tweets...'); [f...
trust_region_w_dogleg([1.2,1.2]', @eval_rosenbrock, @grad_rosenbrock, @hess_rosenbrock) trust_region_w_dogleg([-1.2,1]', @eval_rosenbrock, @grad_rosenbrock, @hess_rosenbrock) function k = trust_region_w_dogleg(xk, eval_f, grad_f, hess_f) TRmax = 2; %maximum initial trust region radius TRk = 1; %trust radi...
%% Check for validity of installation mypath = mfilename('fullpath'); myDirectory = mypath(1:strfind(mypath, 'test/testInstallation') - 1); fs = 44100; sigmaT = 0.01; output = generateSparseFVNset(fs, sigmaT); tmpCmd = ['load ' myDirectory 'src/fvnMin10ms.mat']; eval(tmpCmd); diffChk = output.fvnSet - fvnMin10ms; if...
function[ u] = new_upacwe(u,c11,c22,Img,orginal,count,iterNum,oldth) if(count<iterNum) u=NeumannBoundCond(u); mu=1; lambda1=1; lambda2=1; timestep = .1; v=1; epsilon=1; pc=1; DrcU=(epsilon/pi)./(epsilon^2+u.^2); %eq.(9), ref[2] the delta function ...
function p = pdfTgivenLambda(t, lambda, m) % Conditional density of postsyn. ISI given presyn. rate % Note the difference between this implementation and Eqn. 13 of Berger & % Levy 2010: m is assumed to be a real number (rather than an integer) no less than 1. % Xin Wang <xinw@salk.edu> % Copyright 2014, CNL-S, The...
function writeOutputResultAtStepToVtk( obj, step ) %WRITEOUTPUTRESULTTOVTK Summary of this function goes here % Detailed explanation goes here time = ncread(obj.fileName{1},'time'); fprintf('===============================\n'); fprintf('Time of the current output is:%f\n',time(step)); fprintf('Date has been written i...
function setUserParameter_travellingWave_noI2 % parameters adapted from parameter sets for figure2 % of "Out-of-phase oscillations and traveling waves with unusual properties: the use of three-component systems in biology" global userParam userParam.nComponents = 3; %[activator; inhibitor1; BMP4]. Inhibitor1 inhibit...
%% Question 1 clear all close all bag = rosbag('tutorial4.bag'); laserscans = select(bag,'Topic', '/scan'); firstlaserscan = readMessages(laserscans, 1); cart=firstlaserscan{1}.readCartesian; plot(cart(:,1),cart(:,2)) %% QUESTION 2 clear all close all ranges=[1.4142 1.1547 1.0353 1.0000 1.0353 1.1547 1.4142]; an...
function [ S ] = SLIM( R, beta, lambda, miter ) %UNTITLED12 Summary of this function goes here % Detailed explanation goes here n = size(R,2); RR = R' * R; S = rand(n,n); S = S - diag(diag(S)); for iter=1:miter t = R-R*S; obj = trace_eff(t)/2; obj = obj + trace_eff(S)*beta/2; obj = obj + sum(sum(S))...
% Create rigid body tree from pelvis to left arm for inverse kinematics % utorso is taken as a Basename and from there to the left end-effector rigid body is created clear all; % Call the function written at the end of the code % Add the path to include all the folders and subfolders in the directory addpath(genpath...
function Y = ComputeRegressorNaive(model, q, qd, qdd) %% Y = ComputeRegressorNaive(model, q, qd, qdd) % Computes the classical regressor Y by repeatedly calling the inverse % dynamics routine, once for each column of Y. % (I call it Naive since there are more efficient ways to accomplish this % task, even if this way...
fileToLoad = uigetfile; load(fileToLoad); [sortedData] = organizeData(sessionInfo,experimentData); % iCond =1; %When you have only 1 condition respOri = [sortedData(iCond).trialData(:).respOri]; stimOri = [sortedData(iCond).trialData(:).stimOri]; respOri=wrapTo90(respOri); stimOri=wrapTo90(stimOri); estimate_initia...
function [dcbin,acbin] = imghide1(img,DCTAB,ACTAB,QTAB,msg) [m,n] = size(img); img = [img,repmat(img(:,n),1,mod(-n,8))]; % 补齐为8的整数倍 img = [img;repmat(img(m,:),mod(-m,8),1)]; M = m+mod(-m,8); N = n+mod(-n,8); M = round(M/8); N = round(N/8); L = M*N; blocks = zeros(8,8*L); for k ...
function [result] = pso_path_planning() clear all; close all; % joint limits (degrees) joint_limits = [... -97.494 97.494 0; ... % s0 -60 123 31.5; ... % s1 -174.987 174.987 0; ... % e0 -150 2.864 -73; ... % e1 -175.25 175.25 0; ... % w0 -90 120 15; ......
classdef CBiasDAC < handle %电压源共有12个电压输出 使用1~6为U1~U6 7~12 为D1~D6 %% properties fs; BaudRate=115200; end methods %初始化 function obj = CBiasDAC(server_ip) obj.fs=serial(server_ip); obj.fs.BaudRate=obj.BaudRate; ...
clear all; Ic1=1; Ic2=1.0*Ic1; Ic3=0.7*Ic1; r3=0; a=2*Ic3/(Ic1+Ic2); b=0.01; k=(Ic1-Ic2)/(Ic1+Ic2); bias=pi; r1=-pi:0.01:pi; r2=r1; figure; for n=1:length(r2) U(n,:)=-((1+k)*cos(r1-r2(n)-r3)+(1-k)*cos(r1+r2(n)+r3)+a*cos(2*r2(n)+bias-r3/a))+(1+2*a)^2*(1-k^2)/(2*a*b*(1+2*a-k^2))*r3.^2; end contourf(r1/pi,r2/pi,U,35);...
function kSpace_cart_out = pre_interp_radial_to_cart(kSpace_radial,x_coor,y_coor) [sx,nor,nf,nc,nSMS,ns] = size(kSpace_radial); data = double(reshape(kSpace_radial,[sx*nor,nf*nc*nSMS*ns])); x = reshape(x_coor,[sx*nor,nf]); y = reshape(y_coor,[sx*nor,nf]); x = repmat(x,[1 nc*nSMS*ns]); y = repmat(y,[1 nc*nSMS*ns]); ...
%% estimating the area between f(x)>0 (example: a bell curve) and the x-axis f = @(x) (1/sqrt(2*pi))*exp(-x^2/2); % define the function n = 1000; % number of points to use - estimate will be better for larger N count = 0; % x = -1 + 2*rand(n,1); % vectorized version % y = rand(n,1); for i = 1:n % ge...
%-------------------------------------------------------------------------- % Returns negative penalized log-likelihood of a point process % % Inputs: % % coef : coefficients of B-splines % spike_time : time of events (spikes) % pen_coef : penalty coefficients for smoothness % nb...
function [pd] = doglegpath(tau, pdU, pdB) if (tau >= 0) & (tau <= 1) pd = tau * pdU; else pd = pdU + (tau-1) * (pdB - pdU); end