text
stringlengths
8
6.12M
function [R_back, T_back] = ShowBackPose(path) %% 计算前端初始位姿和优化后的位姿的平移及其旋转的欧拉角 back_pose = importdata([path '/node_pose.txt']); T_back=[]; R_back=[]; for i=1:length(back_pose) pose_estT=back_pose(i,1:3); pose_estR=quat2rotm(back_pose(i,4:7)); T_back=[T_back;pose_estT]; eulerAngles = fliplr(rotm2eul...
% =========================== main_ultravist ============================== % Script for pH mapping with Ultravist phantom (work in progress) % CT 20170113 %% ------------------------- CEST-pH calibration -------------------------- %% Load phantom scans and fit z-spectra clear directory; sequenceType = 'Mz'; READIMAGE...
function sys = IdentifySystem(input,output,S_Order,Ts) global u y SystemOrder k; u = input; y = output; SystemOrder = S_Order; k = 0:Ts:(length(u)-1)*Ts; theta_0 = rand(1,SystemOrder(1) + SystemOrder(2) + 1); % Nb parameters = Nb poles + Nb zeros + 1 (Static Gain) theta = fminsearch('cost',theta_0); Num...
% sig2 %63x1 Raw signal % ti % 63x1 times % % veamos %Epochs where ripples were detected wrt sig2. 58x1 % cara %58x3; sample where they occur % cara_times %58x3; times where they occur %% function plot_traces(sig2,veamos,cara,ti,amp_vec,iii,labelconditions,chtm,include_hpc,cara_hpc,veamos_hpc,chtm_hpc) % amp_vec=[...
% LOGEXECTIMEFORCOVMAPGEN Log the execution time for coverage map % generation. % % Yaguang Zhang, Purdue, 08/14/2019 if ~exist('flagProcessInterrupted', 'var') flagProcessInterrupted = false; end numOfHsInspected = length(towerPathLossMapsEHata); numOfCellAntsObserved = length(towerPathLossMapsEHata{1}); numOfM...
% Assigments 3, surf plot of the solution u of the poisson eq % By Alessandro Piccolo and Anton Sj÷berg clear all; close all; filename = 'output.txt'; delimiterIn = ' '; [u,delimiterOut] = importdata(filename) figure colormap parula %mesh(u,'FaceColor','interp','EdgeColor','none','FaceLighting','gouraud') ...
De volgende code geeft een foutmelding: x = sin(t) Neem aan dat de variabele t correct gedefinieerd is.
function ardSetStripes(width, spacing) global ardVar; panelConstants; ardI2Cecho(SETDATA, X1, width, 0, 0); ardI2Cecho(SETDATA, X2, spacing, 0, 0);
load('sinal.mat'); N = length(x); n = 0:N-1; [Xdtft,wdtft] = dtft(x/N,n); Xdft = fft(x/N); wdft = linspace(0,2*pi-2*pi/N,N); plot(wdtft,abs(Xdtft)); hold on; x2 = 2*2*cos(n*3*pi/4) + 2*1.5*cos(n*pi/5) + 2*1*cos(n*pi/3); [X2dtft,w2dtft] = dtft(x2/N,n); X2dft = fft(x2/N); plot(w2dtft,abs(X2dtft));
function[im3] = loadim3(fdir,n,fstr,fsuff,zerofloat,yind,xind) %LOADIM3 - loads in a stack of images of format im##.tif %fdir is the directory of the stack %n is either a final index or a range or indices to read in % %zerofloat = 0 - means it goes im1, im2, ... %zerofloat = 2 - means it goes im001, im002, ... if leng...
function [bb] = frompoints(ij) %-------------------------------------------------------------------------- % % Copyright (c) 2011 Jeffrey Byrne % %-------------------------------------------------------------------------- ijmin = min(ij,[],1); ijmax = max(ij,[],1); bb = [ijmin(2) ijmin(1) ijmax(2)-ijmin(2) ijmax(1)-ij...
function [pMean, pVar] = prediction(xtrain,xtest,ytrain,nTest,alpha,nv,freq,var,K) % Q = length(freq); nTrain = length(xtrain); xtest = xtest(1:nTest); K_cross_set = kernelComponent(freq,var,xtest,xtrain); K_test_set = kernelComponent(freq,var,xtest,xtest); function K_sum = sumup_kernel(K, Q, alpha) K_sum...
% Erstellt einen Hoehenlinienplot eines Potentials % % Eingabe % mesh Kanonisches kartesisches Gitter % phi Potentialvektor % indz z-Index der darzustellenden x-y-Schnittebene % % Rueckgabe % figure(1) Plot des Potentials (wird abgespeichert in plotPot.pdf) functio...
function [total,am,std]=ML_00781035_func_Final(x) total=sum(x) am=total/length(x) n=length(x) for i=1:n d(i)=(x(i)-am)^2 end std=sqrt(sum(d)/(n-1)) end
function [flg,Offsets] = find_offsets(qa,qb,qc,qd,qe) tol = 10^-1; flg = 0; Offsets = zeros(5,4); ref = [1 0 0 0]; Rqa = [0.9462 0.0441 -0.0089 0.3203]; Rqb = [-0.8582 0.0157 0.0320 -0.5120]; Rqc = [0.9509 0.0499 -0.0263 0.3042]; Rqd = [0.9918 0.0159 0.0481 0.1170]; qrA = quatmultiply...
function []=exportTable(eigBF,TransBF,LineNameBF,LineCoffBF,ErrorBF,OmegaBF,eigAF,TransAF,LineNameAF,LineCoffAF,ErrorAF,OmegaAF,LineFailed,name) for i =1:size(eigBF) lineEta(i,:)= strcat("eta:",num2str(i)); space(i,:)= ""; end %eigBF char(65) char(90) % place=0; title=[char(66),'1'] index=[char(65+place),'2'] ...
clear; clc; valuesDoubleSeq = csvread('tiemposGFLOPS/Ejercicio2.csv'); valuesDoublePara = csvread('tiemposGFLOPS/Ejercicio3.csv'); valuesFloatSeq = csvread('tiemposGFLOPS/Ejercicio4Seq.csv'); valuesFloatPara = csvread('tiemposGFLOPS/Ejercicio4Para.csv'); dims = (100:20:1000); figure, plot(dims, valuesDoub...
function y = dlogPhi(x) y = zeros(size(x)); idx20 = (x<-20); idxN20 = (~idx20); y(idx20) = -x(idx20); y(idxN20) = normpdf(x(idxN20))./normcdf(x(idxN20));
function p = findmanyzeros(f, a, b, n, tol) Zeros = []; x = linspace(a, b , n+1); for i = 1:n if f(x(i)) * f(x(i+1)) < 0 temp = findzero(f, x(i), x(i+1), tol); Zeros(length(Zeros) + 1) = temp; end end p = Zeros; end
%Practice 6.2 function vectors(vec) r=size(vec,2) for i=1:r fprintf('Element %d is: %.1f.\n',i,vec(i)); end
function plot_traces(input,scale,t1,t2,color,FigN) d_obs=input; ti=0:0.1:100; for j=1:2:length(d_obs(:,1)) E1=interp1(0:100/(length(d_obs(j,:))-1):100,d_obs(j,:),ti); figure(FigN),hLine=plot(ti,-1*(scale*E1-j),color,'linewidt',2);axis([t1 t2 0 j+1]), hold on,xlabel('Time (ns)','fontsize',12),y...
function initFromMesh( obj, mesh, filename, casename, outputIntervalNum, OutputFieldNum, VarIndex, fieldname, dt ) % ( mesh, filename, casename, outputIntervalNum, OutputFieldNum, varIndex, fieldName ) % % set vtk output % if (obj.mesh.type == enumMeshDim.One) % obj.vtkOutput = VtkOutput1d(obj.casename, obj.Nfield,...
function [ vVertices ] = oneringv( mesh, nVertex ) % [ vVertices ] = oneringv( mesh, nVertex ) % return indices of one-ring vertices at nVertex vVertices = find(mesh.e(nVertex,:)~=0)'; end
function [ AR, R_tMaj ] = aspectRatio( tj_A, Rj_A, mP) %UNTITLED11 Summary of this function goes here % Detailed explanation goes here y_bar = mP(2); x_bar = mP(1); % figure(1) % subplot(1,2,2) % plot(tj_A,Rj_A,'-o') %%% step through each angle and find a second angle that is closest to being %%% 180 ...
function optbound = getOptpolicyBoundary(optpolicy,params) % Get optimal policy boundaries from 3D optimal policy matrix % Outputs the x,y,z values of the 3D boundaries optbound = struct; val = params.Rs'; fNames = {'dec','switch','accum'}; for fi = 1:length(fNames), optbound.(fNames{fi}) = cell(1,2); end for y = 1:2...
function RBES_evaluate_ref_arch(results,archs) ref = PACK_ref_arch; [~,results2] = RBES_add_arch(ref,results,archs); us = RBES_compute_utilities3(results2,{'sciences','costs','programmatic_risks','launch_risks'},{'LIB','SIB','SIB','SIB'},[0.5 0.35 0.1 0.05]); pr = RBES_compute_pareto_rankings([-results2.sciences result...
% $Header: svn://.../trunk/AMIGO2R2016/Preprocessor/AMIGO_check_data.m 2114 2015-09-18 12:19:54Z attila $ function [inputs,results]= AMIGO_check_data(inputs,results) % AMIGO_check_data: Checks experimental scheme % %****************************************************************************** % AMIGO2: dynamic modelin...
function dY = oriboODE(T, Y, model, hPR, cPR, cXlist) %% oriboODE % % Function which builds ODEs for simulate a synthetic circuit utilising % orthogonal ribosomes for circuit execution. % % dY = oriboODE(T, Y, model, hPR, cPR, cXlist) % %% retrieve current values iS = Y(1); eE = Y(2); mT = Y(3); cT = Y(4); zT = Y(...
function templateVar = setTemplateVariables templateVar.datestr = 'yyyy_mm_dd'; templateVar.timestr = 'HH_MM_SS'; end
function summary_fig = gen_summary_fig( stats, currents ) % ATTEND % If there are attend stats, create a 1x6 figure for each current if isfield( stats, 'attend_fixation_stats' ) att_fig = figure(); att_fields = {'attend_fixation_stats', 'attend_visual_stats', 'attend_atte...
function results = PACK_evaluate_architectures(archs) global params narc = size(archs,1); for i = 1:narc fprintf('Evaluating arch %d of %d...\n',i,narc); res = PACK_evaluate_architecture8(archs(i,:)); results.sciences(i) = res.science; results.costs(i) = res.cost; results.data_continuities(i) = res....
clear clc T = [300 250 200 80]; %temperature tau = [0.3332 0.3655 0.3942 0.4151]; %P3/P1 dt = [0.0039 0.0071 0.007 0.0072]; %error bar X = tau(1); dx = dt(1); Y = tau(4); dy = dt(4); T = 287.9; avg = T/2*(log(Y)-log(X))^-1; % intrinsic phonon lifetime % error propagation err = sqrt( (T/...
function batchProcessPhasor %BATCHPROCESSPHASOR Summary of this function goes here % Detailed explanation goes here addpath('phasorAnalysis'); startDir = '\\ROOT\projects\NIDA'; actiDir = fullfile(startDir,'actiwatchData'); dimeDir = fullfile(startDir,'daysimeterDataLocalTime'); dimeListing = dir(fullfile(dimeDir,'...
% Downloads neuron images and transforms them to dramatically reduce the size before saving %VFB_00014201 % need also to get 0000, .... for k=0:9999 for i=0:9999 try url=strcat('https://v2.virtualflybrain.org/data/VFB/i/',sprintf('%04d',k),'/',sprintf('%04d',i),'/VFB_00101567/volume.nrrd') outfilename = ...
function [W,C,T,U,P,R]=plscr(E0,F0) %PLS partial least square 偏最小二乘法 %该函数用于提取PLS建模中所有可能的成分 %E0 自变量标准化的样本数据 %F0 因变量标准化的样本数据 %W 模拟效应权重 %C 因变量权重 %T 自变量系统主成分得分 %U 因变量系统主成分得分 %P 模型效应载荷量 %R 因变量载荷量 A=rank(E0); % rank returns the number of singular values of A that are larger than the default tolerance, max(size(A))*eps(norm(A...
function entryWindowAddBox(source,~) h = guidata(source); ss = h.ss; fn = strrep(h.expt.addField.String{h.expt.addField.Value},' ','_'); if(isempty(fn)|fn(1)=='_'|fn(1)=='-') return; end nRows = 2; scale = []; h.fields(end+1).wrap = uipanel(h.f,ss.subpanel{:},'units','pixels','position',[15 h.bump 750 ss.rowsi...
function sum = summation(X,Y,prior_mean,j) sum = (X - prior_mean(1,j)).^2 + (Y - prior_mean(2,j)).^2; end
r = input('enter r\n'); theta = input('enter theta\n'); rad = (theta*pi)/180; x=r*cos(rad); y=r*sin(rad) fprintf('The rectangular coordinates are ( %6.2f ,%6.2f ).\n',x,y);
function out=tracefilter(filename,thrs,ROI,varargin) trace=load(filename); if nargin==4; invert=varargin{1}; else invert=0; end if invert==0 if max(trace(ROI(1):ROI(2)))>=thrs out=1; else out=0; end elseif invert==1 if min(trace(ROI(1):ROI(2)))<=thrs out=1...
tic; parfor i = 1:10^3 A = rand(1000); A = inv(A); end toc;
% CS 543 Assignment 1, starter Matlab code % Adapted from A. Efros % (http://graphics.cs.cmu.edu/courses/15-463/2010_fall/hw/proj1/) % name of the input file imname = '00270v.jpg'; % read in the image fullim = imread(imname); % convert to double matrix (might want to do this later on to same memory) fullim = im2doub...
function [uavkp1, Reward] = Control_Vector_Selection_Horizon (xk, pf, obs, UAV_Sets, Ms, alpha, Area) Ns = pf.Ns; sigma_v = pf.sigma_v; nv = size(sigma_v,1); nu = size(UAV_Sets,2); R = zeros(1,nu); % Reward function for a = 1:nu u = UAV_Sets(:,a); if sum(...
%https://www.edmundoptics.com/resources/application-notes/imaging/understanding-focal-length-and-field-of-view/ %https://www.raspberrypi.org/documentation/hardware/camera classdef FieldOfView properties robot_h height_room end methods %Constructor to define constants function thi...
function [ sum ] = GetEnergy( data,weights,theta,nH ) %%%%%% % Get the measurment of squared errors sum = 0; for i = 1:size(data,1); O = RunNetwork(data(i,1:end-1)',weights,theta,nH); %% sum = sum + 0.5*(data(i,end)-O{end})^2; end end
clear;clc;%close all tic recdate='Feb_03_15'; cellnum='B'; module='FI_OU'; load([module '_' recdate '_' cellnum]) % trials=1:numel(whos)-3; trials=[1 2]; points=[3 4 3 4]; sample_rate=10000; % Sample rate in Hz shouldplotFV=1; % Should the function plot the F-V curves? 1 for yes, 0 for no. % saveit=0; [rate_all,nu...
function [x, xf] = xi_k(i, k, a, b, n) x = cos(pi * (4 * i - 1) / (4 * n + 2)); for j = 1 : k - 1 x = x - polynomial(x, n) / polynomial_dx(x, n); end xf = (a + b) / 2 + x * (b - a) / 2;
function [EMG] = structure(data) %%This allows to change the data structure when acquired from Dragonfly bin %%to mat converter %Line to test github branching %**************************************************** % Load and declare % %************************************************...
dt = 2; % Sekunden v = 20; % m/s h = 0; % Offset in meter r = 100; % m outputs = sim('kurvenradius_modification')
load f2 global letter label gfeatureSet gfeatureSet2 fileID = fopen('out.txt','w'); %p={'usr_112/','usr_113/','usr_114/','usr_115/','usr_116/','usr_117/','usr_118/','usr_119/',... % 'usr_120/','usr_121/','usr_122/','usr_123/','usr_124/','usr_125/','usr_126/','usr_127/','usr_128/','usr_29/',... % 'usr_130/','usr...
clear all close all global Xd % test t = tcpip('127.0.0.1', 6340); fopen(t); fclose(t); fopen(t); % figureHandle = figure('Name','Data','Color',[0 0 0]); % axesHandle = axes('Parent',figureHandle,'YGrid','on','YColor',[1 1 1],'XGrid','on','XColor',[1 1 1],'Color',[0 0 0]); % xlabel(axesHandle,'Number of S...
function [p,k]=Degree_Dist(A) %% Computes the degree distribution of network with adjacency matrix A % Input: % A: Adjacency Matrix % Output: % p: Vector with probabilities % k: Vector with degrees %% n = max(size(A)); %Número of Nodes Deg = sum(A,2); %Degree of each nodo p = zeros(1,n); for i = 1:n ...
function func2(x) disp(x + 10); end
% Name:Tommy Lee Truong % Last Edit:May 20 2021 % Program Name: LU decomp V1 %% Q1(HW3) function [L,U] = my_LUdecomp(A) % check the size of A [n,m] = size(A); if n~=m error("The matrix should be square") end % essential computation starts here L = eye(n); U = A; for i=1:n-1 % check whether the cur...
LOG_PATH = 'C:\Users\linnl\OneDrive\Dokumenter\GitMarreg\mareg2\Logs\2020\03\02\Log File_15_57_59.csv'; log = readtable(LOG_PATH); eta_hat_x = log.eta_hat_x; eta_hat_y = log.eta_hat_y; eta_hat_psi = log.eta_hat_psi; eta_m_x = log.eta_m_x; eta_m_y = log.eta_m_y; eta_m_psi = log.eta_m_psi; joy_surge = log.PosYLeft; joy_...
function hmainOpts=setOpts(algIndex) global tdalabStatus paraList algOptions paraTypeList algs; global NumOfComp; if nargin==0 tdalabStatus.algIndex=tdalabStatus.algIndex(1); algIndex=tdalabStatus.algIndex; end if isempty(algIndex) errordlg('No algorithm selected.','Error','modal'); return; end fo...
data = csvread('train_2008.csv', 1); data = data(:, 4:end); x_train = data(:, 1:end-1); y_train = data(:, end);
close all clear all clc %Load object array of junctions obtained by running findEdges.m %load('junctions.mat') %load('junctions_wildtype.mat') %load('junctions_GBE_240713_z4.mat') load('junctions_GBE_OFA_post_1.mat') load('flow_code/OFA_GBE.mat') %%%%%%%%%%%%%%%Find the midpoint and length of each junction%%%%%%%%%...
function [e,gamma] = sinkhorn(C,varargin) % See "Sinkhorn distances: Lightspeed Computation of Optimal Transport % Distances", Marco Cuturi, 2013. opts.epsilon = 1e-3; opts.N_iter = 2; opts = vl_argparse(opts,varargin); b = ones(size(C,2),1,'like',C); gamma = exp(-C/opts.epsilon); for iter = 1:opts.N_iter a = 1./(g...
function [C, iterations] = simplex_new(A, b, c) n = size(A,2); m = size(b,1); iterations = 0; N_indices = 1:1:n; B_indices = n+1:1:m+n; size(B_indices) B = eye(m); N = A; xs_B = b; zs_N = -c; while(min(zs_N) < 0) % step 2 [tmp j] = min(zs_N); % step 3 ...
close all figure('Color','w','Name','Instructions','numbertitle','off','menubar','none'); imshow('dice.jpg') % The instructions screen waitforbuttonpress close all Graphics % The entire code for the game's graphics load('gui.mat','p') % Loads an essential variable 'p' that determines the number of players pos = {-1.*on...
function y = sigmoidfxn(x) y = exp(x)./(1+exp(x));
function ionExtract(varargin) %ionExtract - master function that extracts ions, via a graphical user %interface... % Input arguments and stuff... [opt] = readArgsData(varargin); % First we draw a window that will contain all the interesting bits. We'll % need a series of controls down one side, and an image axes dow...
function [filtered_archs,filtered_results] = SCHED_explain_down_selection(archs,results,i) global params r = global_jess_engine(); close;SCHED_plot_results2(results,archs,i); disp('Repeating Down-selection in explanation mode...'); jess reset; SCHED_Decadal_down_selection_constraints; % assert all selection archite...
function [A, w, y0, x0, varargout] = gaussianFit(x,y,a0,x00,sigma0) % fit data x to a lorentzian: % y = y0 + (2*A/pi)*(w/(4*(x-x0)^2+w^2)); % % Yulin Wu, SC5,IoP,CAS. wuyulin@ssc.iphy.ac.cn/mail4ywu@gmail.com Coefficients(1) = y00; Coefficients(2) = A0; Coefficients(3) = w0; Coefficients(4) = x00; ...
clc; clear; addpath('./data') load JapaneseVowels_mergeData mergeData=JapaneseVowels_mergeData; rho=0.02; maxIt=100; tol=1e-6; classnumber=length(mergeData);%类别个数 attributenumber=size(mergeData(1).data,2);%属性个数 means=[];%保存均值 Theta=cell(1,classnumber); for i=1:classnumber means=[means;mean(mergeData(i).data)]; ...
function [varargout] = enumerateDirectory(obj, pathval, varargin) % ENUMERATEDIRECTORY List of DirectoryEntry objects for the specified directory % Enumerates the contents of a directory, returning a table of directory % object metadata, one row per file or directory in the specified directory. % To avoid overwhelming ...
%% Load Data Path = 'Dataset'; imds = imageDatastore(Path, 'IncludeSubfolders', true,... 'LabelSource', 'foldernames','ReadFcn',@customreader); [imdsTrain,imdsValidation] = splitEachLabel(imds,0.9,'randomized'); numTrainImages = numel(imdsTrain.Labels); %% Load Pretrained Network load MNIST_net inputS...
% $Header: svn://.../trunk/AMIGO2R2016/Postprocessor/Post_Report/AMIGO_report_residuals.m 2086 2015-08-31 07:49:03Z evabalsa $ % AMIGO_report_residuals: reports information about residuals at optimum % %****************************************************************************** % AMIGO2: dynamic modeling, optimizati...
function ctrl_begin(varargin) %CONTROL_BEGIN % Start a control problem formulation with objectives and constraints if(evalin('caller',sprintf('exist(''ctrl_prob'',''var'')'))) error('The variable ctrl_prob is being used to temporarily store a control problem. Don''t assign it please.'); end lti_problem = evali...
figure('Renderer', 'painters', 'Position', [10 10 900 600]); hold on; %% Iteration 4 res = load('../data/conf/all_1.residuals'); res_out = load('../data/conf/outliers_1.residuals'); S = scatter(res(1:2:end,1),res(1:2:end,2),30,'MarkerEdgeColor','k',... 'MarkerFaceColor','k',... 'LineWidt...
function [ x_s] = cross_sct_jvgr( a, freq, e_s_rel ) %CROSS_SCT_JVGR % Raleigh Absorption Cross Section for a Spherical Particle % using JVGR definition % % Input: a - particle radius (m) % freq - frequency (Hz) % e_s_rel - Permittivity of Scattering medium (relative to e0) % Output: x...
[fName,fDir,fFilter] = uigetfile('*.txt;*','Open data file','C:\Users\debivort\Desktop\Decathlon Data Files'); numReps = 10000; fInfo = dir([fDir fName]); date = fInfo.date; replace = find(date == '-' | date == ':' | date==' '); date(replace) = '_'; %% Initialize variables. filename = strcat(fDir,fName); delimiter = ...
function my_funct_6(x) if mod(x,2)==0 fprintf('%d is even \n',x) else fprintf('%d is odd \n',x) end %以上是函數你知道的
function [ sim1,sim2 ] = coTrans_v2_( positive, negative, affmat ) % Co-transduction, v2 global spnum para % negative: boundary nodes; sim1 = zeros(spnum, 1); sim1(negative) = 1; % positive: objectness nodes. sim2 = zeros(spnum, 1); sim2(positive) = 1; step = 0; check_back = 10; check_obj = 10; win_size = 20; watch_...
function z=CB1(x) global ProblemSettings; nVar=ProblemSettings.nVar; z=0; for i=1:nVar-1 z=z+(x(i)*x(i+1)-1)^2; end z=z+(x(nVar)*x(1)-1)^2; end %% % 0<xi<100 i=1,2 % 10<xi<200 i=3,4
function zeroFormDiscrete = DiscretizeZeroForm(f, mesh, p, gridType) %DiscretizeZeroForm discretizes a zero form. % % USAGE % ----- % zeroFormDiscrete = DiscretizeZeroForm(f, mesh, p, gridType) % % INPUTS % ------ % % f :: The 0-form to discretize. A matlab function: f(x,y), % ...
% function [] = init(isMeg,subject,numBlock) times = []; % addpath(genpath('/usr/share/matlab/site/m')) %%pathSeqs ='~/.local/share/gdrive/MA_Gianluca/Data/faceemo/sequences'; subject = 'gt'; block = 1; numTrials = 100; isMeg = false; if ispc pathSeqs = ''; pathData = ''; else pathSeqs = '~/Datasets/MasterT...
function [array] = bubbleSort(array) %% This function sorts a given array by bubble sort. swapped = true; while swapped swapped = false; for i = 1:length(array)-1 if array(i) > array(i+1) swapped = true; temp = array(i); array(i) = array(i+1); array(i+1) =...
% plot polymer on a wall % created nov 8 2019 clear; whichfig = 1; % 1 = no bending stiffness, 2 = bending stiffness ifsave = 1; if(whichfig == 1) savefile = 'polywall_free_image.epsc'; ptfile = 'Data/PolymerWall_n20_k1_pts.txt'; ix = 192; % which one to plot % xmin = -4; % xmax = 3; ...
%% analytical solution close all; clear; clc; % define parameters eps0 = 8.85e-12; % vacuum permittivity Lz = 9e-2; % Lx = 3cm Lr = 3e-2; % Ly = 3cm z0 = Lz/2; % z coordinate of the center of the source sphere r0 = Lr/6; % radius of the source sphere hi rou0 = 8.85e-12; % charge density in the sphere nr = 100;...
close all; clear; clc; disp('this program just design for a 2D trus'); n=input('n as number of nodes='); m=input('m as number of elements='); %make an excel file that every row is node i & node j for each element nodes= xlsread('n&e.xlsx'); inform= xlsread('trust information.xlsx'); % now we will make hardness matr...
% Copyright (c) 2008-2010 Joris Mooij [joris.mooij@tuebingen.mpg.de] % All rights reserved. See the file COPYING for license terms. % % Take y = x + x^3 (b=0) and vary the parameter q in the probability % distribution, which is sampled from a Gaussian and then taken to the % power q (with a random sign in front) an...
function state = BCI_load_state_code() state.ST_START = [100 123]; %1st one is 123 state.ST_HOLD = 200; % state.ST_FILL = 300; % state.ST_CLOCK_MOV = 333; state.ST_MOV = 400; state.ST_STOP = 555; state.ST_OFFDECODED = 666; ...
function [fval,fjac]=pfchoice(x, RF, er, prob, c, alg) fjac = []; alpha=x(1); if alg<3, fval = -sign(c)*prob'*((RF+alpha*er).^(c-1).*er); if alg==2, fjac=-sign(c)*prob'*((c-1)*(RF+alpha*er).^(c-2).*er.^2); end; end; if alg==3, fval=-sign(c)*1/c*prob'*((RF+alpha*er).^c); % note: ...
function RMSEplot(SID,fignum,lfe,lbd,lelbfe,lelbfe1,lie,rfe,rbd,relbfe,relbfe1,rie) Row = find(lfe(:,3)<10); lfe(Row,:) = []; Row = find(lbd(:,3)<10); lbd(Row,:) = []; Row = find(lelbfe(:,3)<10); lelbfe(Row,:) = []; Row = find(lelbfe1(:,3)<10); lelbfe1(Row,:) = []; Row = find(lie(:,3)<10); lie(Row,:) = []; Row = ...
%% Sampling Sin(nx) in a grid of 10 points n = 4; m = 40; x = linspace(0,2*pi,161); % y = sin(n*x) + sin((n-1)*x); y = sin(n*x) + sin(m*x); figure plot(x,y); axis equal
function countDown2_osx(w,startSecs,rect,fixSize) % function countDown2_osx(w,startSecs,rect,fixSize) % % startSecs is the (integer) number of seconds for the entire countdown sequence % startScan is the (real) number of seconds remaining in the countdown when scanner % is to be started % % Purpose: Counts down from...
function Start = startpoints(varargin) N_Agents = varargin{1}; % InitialVelocity = 0.025; InitialVelocity = 0.1; if nargin == 1 if N_Agents == 3 % Starting position, attitude and initial velocity Start.pos(:,1) = [0.1; 0.1; 0.5]; Start.vel(:,1) = InitialVelocity ; Start.ang(:,1) = ...
function [itemVec] = item2vec(obj,seqNo) itemVec = zeros(length(seqNo),length(obj.headers)); for i = 1:length(obj.headers) itemVec(:,i) = obj.(obj.headers{i})(seqNo); end end
function profile = multigauss_profile(variances,amplitude,grid_v) %input: variances vector,their proportion %output: total sum of the gausse curves with the given variances and the %gauss curves themselves if isempty('grid_v') || ~exist('grid_v','var') grid_v = 0:100; end if isempty('amplitude') || ~exist('a...
function specmatrix(haxes,info) % by Guoxu ZHOU definfo=struct('signal',sin(0:.1:2*pi),'window','hamming','winlength',128,'noverlap',8,'tag','specmatrix','opos',[0.01 0.01 0.98 0.98],'units','normalized',... 'title','Spectrogram analysis'); if ~exist('info','var') info=struct; end info=scanparam(definfo,info);...
function [depl, vel, accl] = newmark(sdof,R,m,k,c) % Newmark step-by-step time integration scheme %========================================================================% % Written by : Siva Srinivas Kolukula (allwayzitzme(at)gmail.com) % % Reference : Finite Element Procedures - Bathe ...
function [Dataout removalstat] = getcleandata(Data) % Goes through the data and removes any parts which do not have the app % permission % % usage> [Dataout rejectpercent] = getcleandata(Datain); % Datain Tap Data using gettapdata % Dataout in the some format % rejectpercent as the % data rejected due to per...
function bot=BotReflect(n,bots,world,UV); bot=bots(n); if bots(n).x>world.Bounds; bot.x=2*world.Bounds-bots(n).x; bot.p=-bots(n).p; end if bots(n).x<-world.Bounds; bot.x=-2*world.Bounds-bots(n).x; bot.p=-bots(n).p; end if bots(n).y>world.Bounds; bot.y=2*world.Bounds-bots(n).y; bot.q=-bots(n).q; end if bots(n).y<-w...
%% General datadir = '/host/fladgate/local_raid/HCP_data/structuralData/mpc/myelinMap/'; subjList = []; % enter your subject list here numSurf = 12; % or 14 nVertices = 20484; % fsa5 surface % Load parcellation parc = 'schaefer-200'; [vert_lh, label_lh, ctb_lh] = read_annotation(['/data_/mica1/03_projects/jessica/mica...
function [Resultado]=convolution(b) clear; clc; SerialHandler = serial('COM4'); fopen(SerialHandler); a=[1,2,3,4,5] Numprocesos=length (a) b=zeros(1,Numprocesos); Resultado=zeros(1,((Numprocesos*2)-1)); for contadoringreso=1:((Numprocesos*2)-1) if(contadoringreso<=Numprocesos) b(1,1) = input('Introduce el ...
function [ y, lb, ub ,x, M ] = Hartmann_6d() n = 6; lb = 0*ones(n,1); % lower bound ub = 1*ones(n,1); % Initial samples x = scaled_TPLHD(n*10,lb,ub); M = @(xx) Hartmann_6d_function(xx); y = zeros(size(x,1),1); for i=1:size(x,1) y(i,1) = M(x(i,:)); end end function y = Hartmann_6d_function(xx) alp...
clear;clc; data = csvread('C:\Users\DaTui\Desktop\sample7-20rpm-60kx_2D_comsolbuild_AC_binary_03-Feb-2015_IP10+50_run_1_CompPermReal.csv'); x = log(data(:,1)); fid = fopen('weights.csv','w'); fprintf(fid,'%s,','w1'); fprintf(fid,'%s,','w2'); fprintf(fid,'%s,','w3'); fprintf(fid,'%s,','w4'); fprintf(fid,'%s,','w5'); fp...
% Declaration % ------------ % Date: 2014 / 12 / 1 % Author: WU Tongshuang, 40782306 % initialization clc; addpath('orignFeature'); Nfeature = 3; uniqueWordNum = 149; repeatTime = 28; wordNum = uniqueWordNum * repeatTime; Data = []; for i = 2:uniqueWordNum+1 s = ['Data_word' int2str(i) '=[]']; eval(s);...
% example % f = [2,2,1,-4;5,-4,1,5]'; function [L,f_cor] = f_correction(f) f_cor = f; for i=1:size(f_cor,2) m = f_cor (:,i)== -4; f_cor (m,i)= mode(f_cor (~m,i)); end L = length(find(m==1)); end