text
stringlengths
8
6.12M
function [d, bestColor, LUT, X] = singleFrameLUT(data, media, dApprox, minus, plus, dt) % data is the image you want to fit. % media is the emersion media (i.e., 'air', 'water', 1.34, etc.) % dApprox is the nominal SiO2 thickness, in nanometers. % first, get the average background values of the images fbk = figure('...
function testPriorityQueueDesc p = PriorityQueue(); for i=10:-1:1 p.push(i,i); end for i=10:-1:1 v = p.pop(); assertEqual(v, 10-i+1); end
function [ state ] = WaypointController_throughPoint( state, W, P) wCurr = 2; W_2 = [[state(1); state(2)], W(:,1),W(:,2), W(:,3), W(:,4), [W(1,4)+ 10; W(2,4)]] [WrowLength WColLength] = size(W_2); while(wCurr < WColLength) Wimin1 = W_2(:,wCurr-1); Wi = W_2(:,wCurr); Wiplus1 = W_2(:,wC...
function [rx,ry,alpha,beta,dalpha,dbeta] = motorRampStep(config, direction) global gimbal global autocol startX = config.gimbalRxZero; startY = config.gimbalRyZero; step = config.gimbalRampStep; dt = 1; N = config.gimbalRampPoints; alpha = []; beta = []; ...
SimuCond = {'SVG/5HM_Heri', 'SVG/5HM_CT', 'SVG/5HM_Rand'}; cut_file_path = 'svg_cut.svg'; f_num = [1:3; 4:6; 7:9]; N = 3000; print_flag = true; spike_flag = true; for i = 1:length(SimuCond) PlotSP_func(N, f_num(i,:), SimuCond{i}, print_flag, spike_flag) svg_name = dir(SimuCond{i}); svg_name = svg_name(3:end...
function [node_order] = GetNodeOrder(G,path) %Takes an Eulerian path and returns a vector of node E = G.Edges.EndNodes; path_edges = E(path,:); %Find last node of graph [last_node] = FindLastNode(G,path); %Use edges to find each preceding node in order node_order = last_node; current_node = last...
function [A,B,D,E,I]=mdds(X) % gets A, B, D, E & I arrays for magnet driver N=2;U=3;M=1;Y=1; A1=zeros(U+N);B2=zeros(U+N,N+M); % % X = [R1 R2 R3 C1 C2] % R1=X(1);R2=X(2);R3=X(3);C1=X(4);C2=X(5); % % V1 V2 V3 iC1 iC2 column labels for A1 % 1 2 3 4 5 % A1(1,1)=-1/R1;A1(1,4)=-1;A1(1,5)=-1; % From 1st equati...
function g = newGrid() % % Create a new grid % size g.N = 20; % reward location g.reward_position = [0.8 0.8]; g.rewardRadius = 0.1; % rewards g.reward_at_target = 10.0; g.reward_at_wall = -2.0; % random move g.epsilon = 0.5; % learning rate g.eta = 0....
% nsAC.m clear close all clc global uF vF dt Iext e g d % INPUTS ============================================================== I0 = 1.6; % External stimulus (not in paper) dx = 0.5; dt = 0.01; N = 101; NT = 3000; Du = 0.5; Dv = 0; e = 0.1; % epsilon g = 0.5; % gamma ...
function [] = generate_sfl_spectrum(surfaceToGenerate) % sample code that uses HSXLineFollow and bs_derics_aux_me to perform line % following and generate puncture plot data. Events are enabled in this % demo. DEBUG = 0 % This is incremented because the Condor system starts counting from 0, not % from 1. % ...
function nx = Normalize2D(x) maxx = max(max(x)); minx = min(min(x)); nx = (x-minx)/(maxx - minx);
fileID = fopen('result.txt'); step = 513; y = zeros(101); x = [0:0.01:1]; for i =1:130 for j =1:101 y(j) = fscanf(fileID,'%f',1); end plot(x,y,"linewidth",1,"r"); hold on; end
function [aV, mu] = antieig(A) %ANTIEIG Antieigenvalues and antieigenvectors. % [aV, mu] = ANTIEIG(A) computes the antieigenvectors and antieigenvalues % of the non-singular square matrix A. % % usage % [aV, mu] = ANTIEIG(A) % % input % A = square matrix % = [n x n] % % output % aV = anti...
PI = '/Volumes/Data/PX/Baboons/DataSortReady/T1/BUDDY/5823_009_COR3D_FSPGR_14_Flip_2_NEX_20110510/BUDDY_20110510_5823_009_Gill_Baboon_new_3_COR3D_FSPGR_14_Flip_2_NEX.img'; PO = '/Volumes/Data/PX/Baboons/DataSortReady/T1/BUDDY/BUDDY_reslice.img'; dim = ''; mat = ''; reslice(PI,PO,'','',0)
new_map = map; for i = 1:length(map) newPts = [map(i, 1) - 8,map(i, 2) - 8; map(i, 1) - 8,map(i, 2) + 8; map(i, 1) + 8,map(i, 2) + 8; map(i, 1) + 8,map(i, 2) - 8]; out = inpolygon(newPts(:, 1), newPts(:, 2), inpolygonMapformatX, inpolygonMapformatY); index = find(out); if(length(...
%% Preparer les données % Charger les donnees load('Chap17_Data') % Donner une liste des variables whos % Trouver les champs de la varialbe "spike" fieldnames(spike) % Nombre de décharges pour l'essai 1 size(spike(1).times) % Afficher tous les temps de décharge pour l'essai 1 spike(1).times % Assigner les donnee du p...
function [Pearson_lin, Spearman_lin, RMSE_lin] = ex2q5q3_lin % function relative to question 2.5.3 Benchmarking % linear fitting is applied load DMOS load CI load MOS %% point-to-point MSE distance load error_MSE_pcc_geo load error_MSE_cwi_plc obj_metric = [error_MSE_pcc_geo; error_MSE_cwi_plc]; p_lin = polyfit(ob...
%A=im2double(imread('fireworks.jpg')); A=im2double(imread('sun_fw.png')); m = [0.299 0.587 0.114;-0.169 -0.331 0.5;0.5 -0.419 -0.081]; [a b c] = size(A); B = zeros(a,b,c); B(:,:,1) = 0.299*A(:,:,1)+0.587*A(:,:,2)+0.114*A(:,:,3); %Y B(:,:,2) = -0.169*A(:,:,1)-0.331*A(:,:,2)+0.5*A(:,:,3); %Cb B(:,:,3) = 0.5...
function delta_pos = getDeltaPosition( oldpos_pul, newpos_pul, current_ang ) % GETDELTAPOSITION Calculates the displacement between the old position and % the new position. % % delta_pos = GETDELTAPOSITION(oldpos_pul, newpos_pul, current_ang) % @PARAM % oldpos_pul - the previous location of the robot. % newpos_pul - c...
%Sean Marino %CSC2262 - Numerical Methods %cs226245 %Assignment 4a c = .0016; t = 0:.001:15; f = @(t,v) ((3*t^2 + 6*t + 150)/(sqrt(t^2 + 4*t + 20)))-c*v^2; u0=0; options = odeset('RelTol',1e-7, 'AbsTol',1e-7); [t, v] = ode45(f, t, u0, options); v = v*60/88; plot(t, v, 'b'); axis([0 15 0 120]); set(gca, '...
% Cluster embedding and generate figures and output files % ***************************************************************@ %% Configuration numClusters = 7; intrinsicDim = Dim; % can be varied slightly but shouldn't be much larger than Dim %% Clusters IDX = kmeans(Psi(:,1:intrinsicDim),numClusters); %% Figures fig...
% Corresponds to the workspace of the same name. % USING VARIABLES % test = allSigsBucketed_30good{j}' --> test motion j % test(:,1) --> accX of motion j % ... % test(:,6) --> gyroZ of motion j % example of how to use a useful wrapper: get accY of good shot testcase 15 % accY = getMotionStream(allSigsBucketed_30good,...
function ProbabilisticModelStochastic(InputFile, OutputFile, ... nIterations,startyear,endyear, ... temperature_source, chla_source, ... MeHg_source, DOC_source) %This script runs a stochastic version of the model by selecting parameters %from predefined distribution...
%-------------------------------------------------------------------------- % Examples for <load_air.m> function % % The provided impulse responses are only a subset of the AIR database. % The full database is available here: http://www.ind.rwth-aachen.de/air %------------------------------------------------------...
function [ img_grad ] = DnCNN_prior_grad( img, res ) %DnCNN Summary of this function goes here % Detailed explanation goes here % addpath(genpath('C:/caffe/caffe-master/matlab')); %% % Please change if you use CPU caffe.set_mode_gpu(); gpu_id = 0; caffe.set_device(gpu_id); net_weights = ['DnCNN_6ds_iter_...
%Bridge Analysis Code version 7 %Set up parameters load('TrussDesignN_NicoleKathleenEsther_A5.mat','C','Sx','Sy','X','Y') L= [0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0]; %Calculate Number of Joints and Members [Joints, Members] = size(C); %Create Matrix to find Non-Zero Indices K = zeros(2, Members); q = 1; while q < ...
function []=vlasovDG(k,p) % One dimensional DG [0,L] L=8; xe=linspace(0,L,k+1)'; % Element boundaries [Dx,xn,wn]=legD(p); % Diff matrix, nodes and quadrature J=diff(xe)/2; % Jacobian x=kron(J, xn)+kron((xe(1:end-1)+xe(2:end))/2,ones(p,1)); % Advection Numerical Flux c=1; % velocity s=1; % s=0 average, s=1 upwind F=ze...
clear all clc clf %% outline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % pre en with trained net % rand 6000, rmsd 2000 % % choose one best trained net. % use XP gen new random ser 16,20,41,60, each group choose about 500 ser % atom dis as ANN input % %% load data %%%%%%%%%%%%%%%%%%%%%%%%%%%...
global data nstp=100; sflag=1;
% PolyDeg=2; % Tmp=dec2base((0:(PolyDeg+1)^3-1),PolyDeg+1)-'0'; % Powers=[0 1 2 3 4]; % GoodOnes=Tmp((sum(Tmp,2)<=PolyDeg),:); % GoodOnes=Powers(GoodOnes+1); % Tmp=double(RefVolX); % for i=1:size(RefVolX,3) % H = fspecial('gaussian',10,2); % RefVolXs(:,:,i)=imfilter(squeeze(Tmp(:,:,i)),H,'replicate'); % end % c...
function report_sol(x,d) d2=d*(d+1)/2; p=x(1); p=exp(p)/(1+exp(p)); mu1=x(2:(d+1)); mu2=x((d+2):(2*d+1)); S1=inv_vstack_half(x((2*d+2):(2*d+1+d2)),d); S1=S1'*S1; S2=inv_vstack_half(x((2*d+1+d2+1):end),d); S2=S2'*S2; fprintf("p1: %f, p2:%f\n",p,1-p); fprintf("mu1:\n"); disp(mu1); fprintf("mu2:\n"); disp(mu2); fprint...
function func_problem5() % define the vector x x = [0 0 0 2 0 1 -1 3 0 0 0]; % define the index for vector x nx = [-3 : 1 : 7]; % define the index for y1,y2,y3,y4 ny1 = [-3+2:1:7+2]; % for y1 = x[n-2] ny2 = [-3-1:1:7-1]; % for y1 = x[n+1] ny3 = [-7 : 1 : 3]; ny4 = [-7+1 : 1 : 3+1]; %plot x figure(...
function Ms = get_shaking_moment(F41x, F41y, M21, r1, r4) %{ The following function will calculate the shaking moment with respect to the wall. Input: F41x, F41y, M21, r1, r4 Output: Ms %} % Convert to meters from cm r1 = r1/100; r4 = r4/100; Ms = M21 - (F41x * r4) - (F41y * r1); end
%% This script is called from 'popup_Callback_ZT', so only have access to information in ud = get(hObject,'UserData') (from popup_Callback) %% Getting necessary userData elements. nt = ud.nt; coordinates = ud.coordinates; % This creates the 'background' axes ha = axes('units','normalized','position',[0,0,1,1]); % M...
num_split_trees = length(split_camera_trees); if num_split_trees == 1 disp(' ') disp('Done, no need to do merging') return end disp(' ') disp('Merging...') group_assignments = compute_split_group_assignments(split_camera_trees); group_sizes = compute_group_sizes(group_assignments); disconnected_inliers ...
zeta=0.25; mu=10; gamma=9; u=20; f0=1.5; f=0:0.01:36; lamda=f/f0; delta=((1-(f/f0).^2).*(1+gamma-1/mu*(f/f0).^2)-1).^2+4*zeta^2*(f/f0).^2.*(gamma-(1/mu+1)*(f/f0).^2).^2; z1_q=gamma*(((1-lamda.^2).^2+4*zeta^2*lamda.^2)./delta).^(0.5); %G_z1的新增代码 G_q_n0=2.56*10^(-4); n0=0.1; G_q=G_q_n0*n0^2*u./f.^2; G_q_dot=4*pi^2*G_q_...
function G = gram_norm_matrix2(X1, X2, kernel) % GRAM_NORM_MATRIX2 Computes the normalized Gram matrix between two sample sets % % SYNOPSIS: G = gram_matrix2(X1, X2, kernel) % % INPUT: % - X1, X2: matrices containing one sample feature vector per row, % they must have the same number of columns % - kernel: a ...
function [ev, alfa, p,q]=getSVD(A) % % [ev, alfa, p, q]=getSVD(A); % % ev: eigenvalues % inseparability index, alfa=0: separable, alfa=1: inseparable % p, q: in case of separability: A=p*q % [U,S,V]=svd(A); ev=diag(S)/max(diag(S)); fac=S(1,1); S1=zeros(size(A)); S1(1,1)=sqrt(fac); P=U*S1; p=P(:,1); ...
function [p_best,n_best,ro_best,X_best,Y_best,Z_best,error_best]= ransac_cust(p,no,k,t,d) %Initialize variables iterations=0; %Until k iterations have occurred while iterations < k clear p_close dist p_new p_in p_out %Draw a sample of n points from the data perm=randperm(length(p)); sample_in=perm(1:n...
%global pMATLAB pMatlab_Init; script_file_head = '.pRUN_Parallel_Stub_'; script_file_tail = '_temp'; script_file = dir([script_file_head,'*',script_file_tail]); m_file = regexp(script_file.name, [script_file_head,'(.*)',script_file_tail], 'tokens'); clear('script_file_head','script_file','script_file_tail');...
function result = strRemoveChars( text, chars ) % % Purpose : This function removes the set of characters defined in chars % from the string text. % % Use (syntax): % result = strRemoveChars( text, chars ) % % Input Parameters : % text: an array of characters to be processed % chars: an array of charact...
% process kraken data % run using eeglab 8.0 but will probably work on later versions clear all ; close all ; cd c:/shared/FourRoses_Pilot/FourRoses_EEG_DATA ; ls EEG = pop_loadbv('.','M3.vhdr') ; EEG = pop_resample(EEG,250) ; EEG = pop_chanedit(EEG,'lookup','C:\eeglab10_0_0_0b\plugins\dipfit2.2\standard_BESA\...
function resolutionsuperlenscliscript(secondinterface, thetamax) %eyabs is now intensity zi=-5; xi=-10; zf=15; xf=10; zstepfrac=0.1; xstepfrac=0.01; size=ceil(((zf-zi)/(zstepfrac)))+1; sizex=ceil(((xf-xi)/(xstepfrac)))+1; eta='pi'; eps2=-1; mu2=-1; thetai='0'; dsource=1; %secondinterface=3*dsource; g=0.001 %for x=1:1...
f = 1000; fs = 5000; t1 = 0:1/(10*12000):10/f; t = 0:1/fs:255/fs; %As maximum samples we are taking is 256 x = 10*cos(2*pi*f*t)+ 6*cos(2*pi*2*f*t) + 2*cos(2*pi*4*f*t); x1 = 10*cos(2*pi*f*t1)+ 6*cos(2*pi*2*f*t1) + 2*cos(2*pi*4*f*t1); subplot(3,2,1); plot(t1,x1); grid on; %axis([-6000, 6000, 0, 3]); title("or...
classdef Copula < handle % % --------------------------------------------------------------------- properties % bPrintDebugInformation; % aafOriginalSamples; afOriginalSamplesJulianDates; % atMarginalCDFs; % % the actual copula function aafCopula; % % the copula family strCo...
function s=getWatchedStatesP2X4StackDeMix2(y) s=[y(:,3),y(:,5),y(:,7),y(:,9),y(:,10),y(:,11),y(:,12),y(:,13),y(:,14),y(:,15),y(:,16),y(:,17),y(:,21),y(:,25),y(:,29),y(:,32),y(:,31)]; end
clear; clc; close all; % ------------------------------------- % % Delta u(x,y) = f, (x,y) in [a,b]^2 % % ------------------------------------- % % Dirichlet BCs : u(x,y) = 0 % % ------------------------------------- % m = 32; % num of intervals per dimension a = 0; b = 1; h = (b-a)/m; f = ones((m-1)^...
function COPSE_setup % Set up COPSE paths % Add new directories to this list paleodirs={'code','code/core','code/forcings', ... 'code/copse', ... 'code/configuration','code/utils', ... 'libraries/YAMLMatlab_0.4.3', ... 'examples/copse'}; paleopath = pwd; % get current path as semicolon-separated li...
classdef (Enumeration) TYP_LIGHTING_CSW < Simulink.IntEnumType enumeration LIGHTING_CSW_FOR_EUROPE (0) LIGHTING_CSW_WORLD_WITHOUT_ALS (1) LIGHTING_CSW_WORLD_WITH_ALS (2) end end
Data = obj.features.matriz_alfa(1,125); Alpha_values = [Data.canal1 Data.canal2 Data.canal3 Data.canal4 Data.canal5 Data.canal6 Data.canal7 Data.canal8 Data.canal9 Data.canal10 Data.canal11 Data.canal12 Data.canal13 Data.canal14 Data.canal15 Data.canal16 ]; figure1 = plot_topography({'Fp1','Fp2',...
function set_fig_units_cm( width, height ) set(gcf,'units','centimeters'); pos = get(gcf,'position'); set(gcf,'position',[pos(1:2),width,height]);
function seminar2(subj, rec) db = "baza"; subject = string(subj); record=[]; for i=0:2 record = [record string(num2str(rec+(i*4), '%02d'))]; end t1s = {}; t2s = {}; for i=1:size(record,2) if (strcmp(db,"")==0) recName=strcat("/",db,"/",subject,"/",subject,"R",record(:,i),"...
% Jason Tam % Testing script % testPath = './data/WDBC/wdbc.test'; % nnPath = './myOut/trainedNN_grades.txt'; % testPath = './data/grades/grades.test'; % outPath = './myOut/results_grades.txt'; nnPath = './myOut/trainedNN_prostate.txt'; testPath = './myData/prostate/prostate.test'; outPath = './myOut/results_prostat...
function [ suit ] = classify_card( i, morph, regions, props) isRed = findRedBlack(i,regions, props); [numberIm, symbolIm, numberProps, symbolProps] = extractSymbols(morph, regions, props, isRed); predictedClasses = []; suit; if isRed load('trained_models/symbols_red...
% xyData reader % script that reads from a file using textscan % instantly transforms data into arrays % see number inside array with {1} % {1} shows first array made % open the file file_id = fopen('xyData'); if (file_id == -1) error ('The file could not be opened.'); end % program aborts if file is ...
n_bits = 10; n_param = 1; pop_size = 6; max_iter = 100; x = round(rand(pop_size, n_bits)); m = 0; iter = 0; ff_av_init = mean(sum(x, 2)); while m < 8 && iter < max_iter ff = sum(x, 2); prob = ff / sum(ff); parents = []; for i = 1:pop_size shot = rand(1); ...
clc % % % syms t a b x y % % rho=sqrt(x^2+y^2); % % R=sqrt((a*cos(t))^2+(b*sin(t))^2); % % f=(rho-R)^2 % % f=simplify(f); % % pretty(f) % % % g=(x-a*cos(t))^2+(y-b*sin(t))^2 % % g=simplify(g); % % pretty(g) %---------------------------------------------------- format long % a=2; % b=1; % t...
clear all close all clc done = 0; countera = 0; while done == 0 countera = countera+1; [TheExperiment,subpath,FilterIndex] = uigetfile({'.tif'},'Select the Dictionary','C:\Users\Nicolas\Desktop\Data'); [FileName,PathName,FilterIndex] = uigetfile({'.tif'}, 'Pick the data to process','MultiSelect', 'on...
function phi = GG(varargin) % Returns a polytope assert(nargin == 1, 'GG takes one variable'); % Returns a polytope if strcmp(varargin{1}.type, 'inner') || strcmp(varargin{1}.type, 'ap') phi = struct('type', 'inner', 'Op', 'GG', 'args', {varargin}, ... 'formula', strcat('GG(', varargin{1}.formula, ')')); el...
function display_seam(im,seam,seamDirection) imshow(im); hold on; for i = 1:size(seam,2) if (strcmp(seamDirection,'HORIZONTAL')) plot(i, seam(i), 'r.', 'Markersize', 5); else plot(seam(i), i, 'r.', 'Markersize', 5); end end end
function [v_I, r_I] = position_eq(v_I_0,r_I_0,dt,a,dcm) % 加速度とDCMから速度と位置を計算 % dt:時間間隔[s], a:加速度[m/s2], dcm:方向余弦行列 if v_I_0 == NaN v_I_0 = 0; end g = 9.8; % 重力加速度 v_I = v_I_0' + dcm * a' * dt + [-g;0;0] * dt; r_I = r_I_0' + v_I * dt; end
% 'src' and 'evt' are arguments passed automatically by the 'timer' objects, % thus they need to be handled even if not used % function RunPI( src, evt, tController, tTCPConnection ) % try % % if( tController.bPrintDebugInformation ) % fprintf('Entering Low Level Run()\n'); % end;% % ...
% Input: number of iterations L % number of labels k % matrix X of features, with n rows (samples), d columns (features) % X(i,j) is the j-th feature of the i-th sample % vector y of labels, with n rows (samples), 1 column % y(i) is the label (1 or 2 ... or k) of the i-th samp...
% mainScript to organize calling of all other functions clear all; clc; close all; % addScriptPaths(); % run('/net/store/nbp/phasesim/src_pebel/matlab/addScriptPaths.m') % dataPaths(); load('dti_20141209_preprocessed.mat'); % get SC matrix, use average SC % recalculate avg_ci, o...
% BigEx1.m % Message Generation m=['Put any message here of your choice, preferably something with ' ... 'at least a couple hundred characters. This message might suffice.']; % Frame parameters frameParams.userDataLength=1; frameParams.preamble=''; frameParams.chanCodingFlag=0; frameParams.bitEncodingFl...
%in barnamei baraye GRANULOMETRY ast,BARAYE %EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command %Window MATLAB PASTE KONID. clc; clear all; close all; Img = imread('14.tif'); figure(1);subplot(1,3,1); imshow(Img), title('tasvire vorudi'); %eleman sakhtari B = strel('disk', 20); %smoothing h =...
% \\\\\\\\-------- MASTER SCRIPT --------//////// % % Main script for importing data and running external scripts (m files). % Image data is imported here and manipulated/plotted in the custom % scripts section. clear variables; % Clear all workspace variables from memory. % IMPORTS addpath('./Classes'); a...
%%%%%%%%%%%%%%%%%%%%Configuring%%%%%%%%%%%%%% clc; % clear variables; close all; addpath('/mnt/LinuxDrive/matlab project/Asthma_TMTB/m files'); run Config.m; addpath(CRP_tools); cd(D_2min); PatientList = dir; PatientList = {PatientList.name}.'; startindex=4; endindex=size(PatientList,1); %% List index of patients' n...
% Dimension adjustment for ERP data --------------------------------- % The Dimention of data must change to % Channel x Sample x Stim x Subject x Group function inData=DimPrep(Data,Chan,Sa,St,Subj,G) O1= find(size(Data)==Chan);% finding position in Data for each dimention O2= find(size(Data)==Sa); O3= fin...
function all_dice=dice_from_median() all_data=dir('Data(median ROI)/*.mat'); all_dice=struct; for data_file_number=1:numel(all_data) load(strcat('Data(median ROI)/',all_data(data_file_number).name)); load(strcat('Simplified_data/',all_data(data_file_number).name,'/ROIs.mat')); load(strcat('Simplified_data/'...
function [xvect]=vect(x) xvect=x(:);
function [eulers] = Quat2Euler(quat) % Quat2Euler turns quaternions to Euler Angles % % quat = a n x 4 matrix of quaterinions, one quat for each row % % eulers = a n x 3 matrix of euler angles:, phi theta psi % round(quat,5); % phi calc eulers(:,1) = atan2((2.*(quat(:,3).*quat(:,4)+quat(:,1).*quat(:,2))),( quat(:...
classdef BetaBinomDist < ProbDist properties a; b; N; support; productDist; end %% Main methods methods function obj = BetaBinomDist(varargin) % betaBinomdist(N, a, b, productDist) [obj.N, obj.a, obj.b, obj.productDist] = processArgs(varargin, ... ...
clc; clear; fileID1 = fopen('QP_problems_performance_prof_time.txt','r'); fileID2 = fopen('QP_problems_performance_prof_iter.txt','r'); A_t = fscanf(fileID1,'%f'); A_it = fscanf(fileID2,'%f'); num_of_probs = size(A_t,1)/2; c_t = zeros(num_of_probs,2); c_it = zeros(num_of_probs,2); c_t(:,1) = A_t(1:num_of_probs,1); ...
function [p, d, bc, rems, obs] = poly3d2tribem(file) % Read .in file as text a = opentxt(file); % Find indices of objects, nodes, and elements objects = findstr(a(:, 1)', 'o'); nodes = findstr(a(:, 1)', 'v'); els1 = findstr(a(:, 1)', 'e'); els2 = findstr(a(:, 2)', ' '); els = intersect(els1, els2); % Index differe...
function phone = alphaToPhone(alpha) L = length(alpha); phone = alpha; for i = 1:L if alpha(i) == 'A' || alpha(i) == 'B' || alpha(i) == 'C' phone(i) = '2'; elseif alpha(i) == 'D' || alpha(i) == 'E' || alpha(i) == 'F' phone(i) = '3'; elseif alpha(i) == 'G' || alpha(i) == 'H' || alpha(i) == 'I...
function [ seMatrix ] = VecTose3( spatvel ) % this is a full spatial velocity %Usage %Input - 6d spatial velocity %Output -4 by 4 se(3) matrix. %Example %Input = [11,1,2,-2,-4,5]' %Output % 0 -2 1 -2 % 2 0 -11 -4 % -1 11 0 5 % 0 0 0 0 seMatrix = []; if...
% 画椭圆 t = 0 : pi/50 : 2*pi; x = 5 * cos(t); y = 9 * sin(t); plot(x, y), grid on
% nevEdit.c, simple command line nev sort code editor % Usage: % nevEdit(filename,operationType,args...) % e.g. % 1) move all sort codes 4 to sort code 7 % nevEdit('foo.nev','m',4, 7) % 2) move all waveforms with extent exceeding +-300 mV to sort code 9 % nevEdit('foo.nev', 't', 300, 9) % 3) move all waveforms th...
clear all %% load('T2_data.mat') %% x = X'; NF=20; % 15 for T1 case [idx, z] = rankfeatures(x(1:960,:),Y,'NumberOfIndices',NF); X_new = x(idx,:); % NF features(of all patients) remained tabulate(Y) % each 0&1class percentage %% Box plot of significant features for i=1:NF subplot(1,NF,i) boxplot(...
function readOnlyfoot_shoe(scenePath, modelName) scenePath = 'E:\ArtShoe2_reconstruction\code\data\m004_dc_right\data'; modelName = 'points_all_1_o.ply'; model = Model([scenePath '/' modelName]); model.readModel(); [K, R, t] = readPose(scenePath); filelist = dir([scenePath '/mask/*.bmp'])...
function para=rand_pos_or_neg() para=(-1)^round(randi([14 19])*0.1); %[a b] %(15-a)/(b-a)=propotion of negative, cooperate %1-negative=positive,compete end
function Out=ToShortName(in) notcell=0; if(~iscell(in)) in={in}; notcell=1; end for i=1:length(in) % S=regexp(in{i},'[ _]','split'); S=regexpsplit(in{i},'[ _]'); Out{i}=[upper(S{1}(1)) lower(S{1}(min(numel(S{1}),2))) upper(S{end}(1)) lower(S{end}(2))]; end if(notcell) Out=Out{1}; end
% NEWQUATERNION - Construct quaternion % % Q = newquaternion(theta, axis) % % Arguments: theta - angle of rotation % axis - 3-vector defining axis of rotation % Returns: Q - a quaternion in the form [w xi yj zk] % % See Also: QUATERNION2MATRIX, MATRIX2QUATERNION, QUATERNIONROTATE % Copyright (c) ...
% ========================================================================= % ========================================================================= % ================================CHECKERS================================= % ========================================================================= % ==========...
% matriz=calcular_matriz_de_cambio_de_base(eje,angulo) % La funcion calcula las matrices de cambio de base respecto a un eje % elegido. El valor de estas matrices dependen de los angulos que se % utilizan para definirlas. % ENTRADA % eje: es una variable de tipo char cuyas opciones son 'x','y' o 'z' y % define sobr...
clear %获取表格中的数据 [exceldata] = xlsread('/Users/tianyu/PycharmProjects/BigDataAna/data/data.xlsx'); %取出其中的第五列稠密度 density = exceldata(:,8); group = exceldata(:,2); %使用该函数判断在非高斯分布情况下的单因素方差分析 [p,tbl,stats] = kruskalwallis(density,group)
% Spatial Criteria cpa.elec_list = {'CPz','FCz', 'Fz', 'Cz'}; cpa.elec_method = 'peak'; % consider 'grubbs' as recommended by Wessel? cpa.n_max_elec = 5; % number of peak elecs for method = 'peak' cpa.min_elec_match = 2; % number of electrodes that must...
% % W = Ws{7}; % % ngramsW = BigramFinder.generateAllNGrams(W, 3, true); % ngramsW.findBigrams(); % ngramsW.termFrequencies(); % ngramsW.w2vCount(); % N = 3; % q = ngramsW.B == N & ngramsW.ViCount >= 1; % d = ngrams_pdist(W.m, ngramsW.V(q), N); dump_folder = fullfile(echolex_dumps, 'clusters'); %pL_ = bernoulli_div...
function depthintPE = modeAmp2PE(pamp, H, N2, modeProf, nmd) % depthintPE = modeAmp2PE(pamp, H, N2, ntype) % % inputs % - pamp: pressure modal amplitude. % - H: water depth (in meters). % - N2: buoyancy frequency squared (in radians per s^2). % - nmd: mode number. % - ntype (optional): d...
function [target,xArray,yArray,nArray,fArray,FArray] = solve(p) n0 = p(1); lambda = p(2); global AVGPROD; % Skill density described mu = -1; sd = 0.39; f = @(n) lognpdf(n,mu,sd); F = @(n) logncdf(n,mu,sd); % Initialize arrays to store solution N = 2000; nStep = 0.001; nArray = zeros(N,1); uArray = zeros(N,1); ...
function n = my_numel(A) n = 0; for i=1:numel(A) if iscell(A{i}) n = n + my_numel(A{i}); else n = n + numel(A{i}); end end end
% Turns the hitsequence input into a sequence indicaitng if each duration is censored, Input may be a % matrix of hit sequences (with equal length) with 1 series in each column. % Or it can be a 1 column vector of a single hit-sequence % % USAGE: % c = fCensoreds(I,D) % % INPUTS: % I - TxN hit-seque...
function outputdata = importSingleFileFunction(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % UNTITLED = IMPORTFILE(FILENAME) Reads data from text file FILENAME for % the default selection. % % UNTITLED = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads data from rows % ...
clear clc addpath(pwd) function resp = compress(originalImg, k) img = imread(originalImg); img_info = imfinfo(originalImg) [H,W,dim] = size(img) #Size of the new matrix n = (img_info.Height+k)/(1+k) h = 1; for i = 1 : H w = 1; if(mod(i,k+1) == 0) for j = 1 : W if(...
% initialize % all parameters should be set in this block % clc; clear; close all; set = 2; B = 3; % budget length surrogate_loss = 'hinge'; % choices for features features_choice_struct.append_lib_contexts = false; features_choice_struct.append_down_levels = true; features_choice_struct.append_type = 'averaging'; % {...
% Copyright (C) 2001 Michel Juillard % % computes second order partial derivatives % uses Abramowitz and Stegun (1965) formulas 25.3.24 and 25.3.27 p. 884 % note that we have to reshape the result of this function. Also, if we use % a minimizer, we have to multiply the result by -1. %e.g. %Hess = hessian('postfourier',...
% Solves the alpha equation (isolated from the complete multiphase solver) with Um!=0 % by the KTcFlux method (and eventually another method for comparison) % % u is more dense phase volume fraction (alpha_l) % % du/dt+d/dx[F(u)]=0; % u=[u], F(u)=[Um-V0*u^a*u*(1-u)] % a=1 % Since Um is divergence free the value selec...
function err = naivePerfusionSSEIntegratorP2X4StackDeMix7(ton,toff,Ttot,amp,T,I) %#codgen; naive=getNaiveP2X4StackDeMix7(); V=-60*10^-3; err=errorIntegratorP2X4StackDeMix7(ton,toff,Ttot,amp,naive,T,I,V); end
clc clear % close all KK=[-1.0801 -0.7715 -0.4629 -0.1543 0.1543 0.4629 0.7715 1.0801]; delta=0; beta_skew=0; zel=[-1.0801 -0.7715 -0.4629 -0.1543 0.1543 0.4629 0.7715 1.0801]; sefr=zeros(1,8); alpha=1.7; SNR_inx=1; EQ=[-2.5:0.05:2.5]; SNR=-2:2:8; kappa=5; % gamma_g=((inv(10^(SNR/10))...