text
stringlengths
8
6.12M
%% stopButtonVNA % %% Description % % |[f, h] = stopButton(x, y, h, w)| displays a Stop button to check abort of data collection - % based on <http://uk.mathworks.com/matlabcentral/answers/100558-how-do-i-set-up-a-uicontrol-callback-to-interrupt-a-routine MathWorks solution 1-15JIQ> and <https://uk.mathworks.com/...
function [ predictions] = get_prediction_views(Iteration) n_views = size(Iteration(1).view,2); [~,n_labels] = size(Iteration(1).view(1).predicted_labels); n_unlabelled = size(Iteration(1).view(1).classifier(1).PosterioriPos,1); predictions = zeros(n_unlabelled,n_labels); for label_id =...
% Figure_VesselDistributions.m % % Displaying the form of the various vessel distributions on a single graph % % Based on figure_sharan.m (and similar) by NPB. % % Created by MT Cherukara, 3 May 2019 clear; close all; setFigureDefaults; %% Make the distributions % Sharan Rr_sh = [ 2.8, 7.5 , 15 , 22.5, 45 , 90 ...
yalmip('clear') clear all close all clc umax = 1.5; umin = 0; Ts = 1/5; quad = Quad(Ts); [xs, us] = quad.trim(); sys = quad.linearize(xs, us); [sys_x, sys_y, sys_z, sys_yaw] = quad.decompose(sys, xs, us); % Design MPC controller mpc_x = MPC_Control_x(sys_x, Ts); A = mpc_x.A; %don't forget the "_x" indice B = mpc_x.B...
clear all close all %Domain values xmin= 1; xmax=15 ; % Domain set domain= xmin:xmax; lamda=5 pdx= poisspdf(domain,lamda); %Getting pdf of poisson distribtion m=max(pdx); i=1 while (i<10000) t=rand; x_sample=(xmax-xmin)*t +xmin; u= m.*rand; x=round(x_sample) pdxi=poisspdf(x,lamda);...
function [] = psclosedoc(o) %PSCLOSEDOC Close the active document in Photoshop. % PSCLOSEDOC() closes the current active document in Photoshop. If this % document needs saving, a dialog will pop in Photoshop. % % PSCLOSEDOC(1) forces the document to close without saving changes. % Recommended. % % PSCLOSED...
% Connect the piBot to the arena. Include out group number % Near door: 172.19.232.11 % Near far wall: 172.19.232.12 %Pb = PiBot('172.19.232.191'); %Pb.setVelocity([0, 50], 3.33) %Pb.setVelocity([50, 100], 3.245) % Read localiser % Pb = PiBot('172.19.232.104', '172.19.232.12', 32); blueLEDs(Pb, 0); figure; x = 0; y =...
M0 = csvread('caffe.workstation.cv.log.INFO.20150425-104039.31275.test.csv',1,0); M1 = csvread('caffe.workstation.cv.log.INFO.20150425-104121.32941.test.csv',1,0); M = [M0;M1(2:end,:)]; h = figure; subplot(1,3,1);plot(M0(:,1),M0(:,3)); xlim([0,600]); legend('learning rate: 0.01','Location','southeast');legend('boxoff')...
function A=Cholesky(A) % Cholesky Factorization for symmetric positive definite matrix % Algorithm 2.7 Heath, p.86 % Factorize A such that A = L*L', % where L is a lower triangular matrix whose diagonal entries are not % necessarily unity % In the output the lower triangular part of A is over-written by L % The upper t...
function daq_Quit %Quit the data acquisition toolbox. global GAI global GAO ai = GAI; ao = GAO; stop([ai,ao]); %clean up delete(ai); clear ai; delete(ao); clear ao;
function [x, u, Tf] = FE_ammc(N, m, Tf) % This function solves % u_t = u_{xx} / (1 + u_x^2) - 1/u, x \in (0, L) % u(0, t) = u(L, t) = 1 % u(x, 0) = 1 + 0.1*sin(2*pi*x/L) % with centred differences in space and forward Euler in time. % The PDE models axisymmetric motion by mean curvature (ammc). % % Some refere...
function [dr] = f_dr(R_rho) % dr = R_rho.*1.85 - 0.85; M1 = find(R_rho>=1); O1 = R_rho(M1); M2 = find(R_rho<0.5); O2 = R_rho(M2); dr(M1) = 01 + O1.^0.5 .* (O1 - 1).^0.5; dr(M2) = O2.*0.15; end
bcl = pinv(cat(2,wL(1:4),ones(4,1)))*torl(1:4); bcr = pinv(cat(2,wR(1:4),ones(4,1)))*torr(1:4);
classdef Agent %AGENT Summary of this class goes here % Detailed explanation goes here properties ID = 0; x = []; % state variable y = 1; % z = 0; phix = 0; phiy = 0; rhox = []; rhoy = []; k = []; do = 0; ...
function Vlin =LinReach(f,x,w,l1,sopt) % function V = LinReach(f,x,w,l1,sopt) % % DESCRIPTION % This function performs a linear reachability analysis for a polynomial % system, xdot=f(x,w), about the equilibrium point x = 0. The linearization % is computed around x=0: xdot = A*x + B*w. This function generates a...
args = asl_spm01; %% Build the Design Matrix %% experiment date: 10.26.09 TR = 4; exp_duration = 1144; % one back blocks onsets{1} = [ 13 66 303 380 681 1046 ]' -7; durations{1} = [48 96 72 48 72 96]'; % four back blocks onsets{2} = [ 167 468 604 758 870 958 ]' -7 ; durations{2} =[ 96 96 72 72 48 48...
function T = qrexstep( T ); % explicit QR iteration for sym matrices with Wilkinson shift % note: we assume T to be symmetric, no check here % reference: Golub, Van Loan; 3rd ed; 8.3.4 % $Id$ ident = eye( size( T ) ); mu = wilkinsonshift( T( end-1, end-1 ), ...
clear all; clc;clc %% patches all you need img = imread('bird.jpg'); img = imresize(imread('bird.jpg'), [256 256]); patches=im2colcube(img, [32 32], 1); pat = reshape(patches, 32,32,3,64); for i=1:(size(pat,4)) figure(1), imshow(pat(:,:,:,i)),pause(0.2) end function color_patches=extract_color_patches(img, patc...
function GT = Gas_trapping(GT_map,mask_data,cutoff,exp,jac) maski = {1:6}; GT = zeros(length(maski{1})+1,4); mask = ismember(mask_data,[maski{:}]); 'GT Range Used for QAT' cutoff for i=1:4 GT_map1 = GT_map(:,:,:,i); GT_map1(exp(mask)<cutoff(1,2)|exp(mask)>cutoff(1,3)) = 0; % set voxels outside Exp[-985 -250]...
for i=1:1 test_obtData1=single_boxData{i}; speed_box=findBoxspeed(test_obtData1(:,2)); box_stat=checkBox(ref_speed_box,speed_box,variation_box); % Test metal presence if box_stat==1 %Box presence resultant = find_resultant(test_obtData1); cvVal=findCV(resultant); % roller_noise ...
addpath('/data/cees/huyle/sep/sep-matlab-io'); tempdata=sepread('../line1/ddata1.dragon2d.30.H',8333,2501); data=tempdata'; ntrace=size(data,2); samplingRate=0.004; Fmax=0.5/samplingRate; nt=2501; t=(-(nt-1)/2:(nt-1)/2)*samplingRate; df=2*Fmax/(nt-1); f=(0:(nt-1)/2)*df; spectra=abs(fft(data,[],1)); spectrum=...
function D = rad2deg(R) %RAD2DEG Converts angles from radians to degrees % % deg = RAD2DEG(rad) converts angles from radians to degrees. % % See also DEG2RAD, RAD2DMS, ANGLEDIM, ANGL2STR % Copyright 1996-1998 by Systems Planning and Analysis, Inc. and The MathWorks, Inc. % Written by: E. Byrns, E. Brown % $Rev...
function err = ... errorfun_spectralintegration14(V,IA_fullspec,... ILD_piece1,... ILD_piece2,... ILD_piece3,... ILD_piece4,... ILD_piece5,... ILD_piece6,... ILD_piece7,... ILD_piece8,... IA_bestloc) %This function takes only ILDAlone mean arrays % errorfun_spectralintegratio...
% Name, ID % Date % Rec Time % Homework 5 Problem 1 % Guided by Ryo Takei, OSU ID 933927846 clc; clear; clf; % Variables we're given theta = 89; % degrees g = 9.8; % m/s/s v_0 = 13.5; % m/s % Equations we're given x = @(t)v_0 * t * cosd(theta); y = @(t)v_0 * t * sind(theta) - 1 / 2 * g * t^2; %% STEP 1 % Uncomment ...
% myPotenzmethode.m start function [z,lambda] = myPotenzmethode(A,z0,tol,maxit) xk = z0; for i = 1:maxit + 1 % abbruch bei zu vielen iterationen if i > maxit break; end % berechne naechsten vektor xk = A * xk; xk = xk / det(xk); % berechne naechsten eigenwert lk % myPotenzmethode.m end
% % bc = 3 % number = 3; % dis = 5; % % dx=l-2*bc; % dy=w-2*bc; % % lines = 4 % numofpoint = lines*2;
function [ sediment_concentrations, sediment_params, sediment_matrix_templates] = sediment_init( pH, max_depth, temperature, rate_estimator_switch) % Input: % bottom pH of the lake, temperature at SWI. % Output: % init sediment_concentrations - concentrations read from file % sediment_params - all sediment p...
function carr = importFolderResp(folder) if (~exist(folder, 'dir')) "couldnt find requested folder" %#ok else lf = cd(folder); I = dir( "*.csv"); % for the ith file in I read file to ith index for i = 1:1:length(I) vinfo = textscan(I(i).name,"resp_testPattern%d_%d.csv"); carr{vinfo{1},v...
function [nv, ne, edgs, sibhvs, v2hv, vvs] = pinchoff_curv(vid1, vid2, nv, ne, ... edgs, sibhvs, v2hv, vvs) %#codegen %PINCHOFF_CURV Pinch-off a curve locally. % [NV, NE, EDGS, SIBHVS, V2HV, VVS] = .... % PINCHOFF_CURV(HVID1, HVID2, NV, NE, EDGS, SIBHVS, V2HV, VVS) % pinches off a curve locally at vertice...
function varargout = iq2prob_02(varargin) % iq2prob_02: calibrate iq to qubit state probability, |0> and |1> % % <_f_> = iq2prob_02('qubit',_c&o_,'numSamples',_i_,... % 'gui',<_b_>,'save',<_b_>) % _f_: float % _i_: integer % _c_: char or char string % _b_: boolean % _o_: object % a&b: default type is a, but type ...
%r = zadoffchu(n, N_zc, u = 1) % % Generates a u-th Zadoff-Chu sequence of length N_zc. % % Arguments: % n - vector of indices % N_zc - length of ZC sequence % u - sequence number % % Returns: % r - Zadoff-Chu sequence % Copyright 2017 Grzegorz Cisek (grzegorzcisek@gmail.com) function [r] = zadoffchu (n...
% Script for plotting ground truth/estimated state histories and inertial % parameters clear close all %% Ground Truth % % chaser_truth_pose = readmatrix('chaser_gt_pose_stat_good_DEC10.csv'); % chaser_truth_twist = readmatrix('chaser_gt_twist_stat_good_DEC10.csv'); % chaser_est_pose = readmatrix('chaser_est_pose_sta...
%學號:B41052021 %姓名:許文杰 clear A=[123]; B=[-1 3 -1]; % dot c=dot(A,B) %cross D=cross(A,B)
function nice_barplot(y,x,c1,c2, boxon, pointOn) if nargin < 3 c1 = [0 0 0]; c2 = [1 1 1]; end if nargin < 5 boxon = 1; pointOn = 1; end y = y(~isnan(y)); %remove NaNs barWidth = .6; wisOffset = barWidth./6; linewidth=2; boxColor = [0 0 0]; wisColor = [0 0 0]; meanColor = [0 0 0]; faceColor = c2; ...
function Res = CalcV_all(H) %计算船的总体积 [A,B] = setValue(); if nargin == 0 [~,~,H] = setValue; end syms x y0 = sqrt( (H - A*x.^2)/B); VolMin = vpa(-sqrt(H/A),4); VolMax = vpa(sqrt(H/A),4); funVol = (H-A*x.^2) .* y0 - y0.^3 * B/3; Res = 2*int(funVol,VolMin,VolMax); end
rgbImage = imread('/home/nofear/Downloads/image1.jpg'); [rows columns numberOfColorBands] = size(rgbImage); set(gcf, 'Position', get(0, 'ScreenSize')); imshow(rgbImage, []); title('Original Color Image', 'FontSize', 20); col1 = 1; col2 = floor(columns/2); col3 = col2 + 1; row1 = 1; row2 = floor(rows/3); row3 = row2 ...
function policySearchMouselabMDPSavio(c) addpath('/global/home/users/flieder/matlab_code/') addpath('/global/home/users/flieder/matlab_code/MatlabTools/') %% Direct Policy Search nr_episodes=1000; ER_hat=@(w) evaluatePolicy([w(:);1],c,nr_episodes); d=2; x_input_domain = [-1 1; -1 1]; nb_iter=25; result_display=true;...
% Other params will be added in later eg threshold for "on" conversion and % probably some other things function [] = process(imagePath) % Prepare to Supress Warning about image size s = warning('off', 'Images:initSize:adjustingMag'); % Read image and convert to binary image = imread(imagePath); bw = imcomplement(im2b...
function drivertest % Sample script drivertest v1.33 % % Checks for bugs in graphics drivers % % Usage:- drivertest % switch nargin case 0 otherwise PrintUsage return end %************************************************************* % Initialise Cogent, check the version number, open the % graphics, get the ...
function [ceq,ceq_grad]=ankle_push_cons(x,p) %% ceq1 = zeros(p.phase1_idx-1,1); % -1 since the first frame must be correct ceq2 = zeros(p.phase1_idx-1,1); ceq_grad1 = zeros(p.numJ,size(x,2),size(ceq1,1)); ceq_grad2 = zeros(p.numJ,size(x,2),size(ceq2,1)); % ceq2 = zeros(p.phase1_idx,1); % ceq_grad2 = zeros(size(x,1),si...
function [ WordSeq ] = GenerateWord(LetterSamplesFolder, Word , Class) % Summaty: % This function gets a connected component word as inglisg letters and % output a 2-dimentional vector that describe the word part contour % Input: % Word - The word in english letters ex. 7L, 8BA % Output % WordSeq - 2xN d...
clc clear all E= {}; experiencias.E = []; experiencias.A = []; experiencias.R = []; experiencias.s_E = []; load('RM.mat');
function [output] = drawline(input,d,s,r1,r2) %照參數畫線 YCBCR=rgb2ycbcr(input); Y=YCBCR(:,:,d); sigma=s; output=edge(Y,'canny',[r1 r2],sigma,'Thinning'); end
%***********************************************************% % INPUT: % DB: price data series % Asset: complete information of trading account asset %***********************************************************% % OUTPUT: % no output but plot the evolution of the trading account %*************************************...
function sliceTimer(root, TR, Ttag) % interpolates the data to the center of the TR % Assumes The first slice is acquired at TR+Tag % [data h] = read_nii_img(root); Nslices = h.dim(4); Nframes = size(data,1); Npix = h.dim(2) * h.dimi(3); Tslice = (TR-Ttag)/Nslices; TRtimes = TR * ([1:Nframes] -0.5 ); outdata = zeros(s...
function x = add_dc(y,dc,columns) %ADD_DC Add DC channel to signals. % X = ADD_DC(Y,DC) adds the specified DC value to the (possibly % multi-dimensional) signal Y, returning the result as X. DC should be a % scalar value. % % X = ADD_DC(Y,DC,'columns') where Y is a 2D matrix and DC is an array of % length siz...
%Assignement 2, Julian Hedén clear all, close all, clc rng(200); %Load data trainingSet = 'data_batch_1.mat'; validationSet = 'data_batch_2.mat'; testSet = 'test_batch.mat'; [Xtrain, Ytrain, ytrain] = LoadBatch(trainingSet); [Xval, Yval, yval] = LoadBatch(validationSet); [Xtest, Ytest, ytest] = LoadBatch(testSet); %...
close all; clear all; clc; %<-----------Définition des variables-----------> tmax = 10 ; % Durée g=10; % Constante gravitationelle m=46*10.^-3; %Masse de la balle de golf r=21.5*10.^-3; %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<mettre ce que c'est % Constantes liées aux foces extérieures s'applicant sur la bal...
function color_balance(inPic,outPic,Rw,Gw,Bw); in=imread(inPic); meanIntensity=(Rw+Gw+Bw)/3; in(:,:,1)=double(in(:,:,1)).*meanIntensity./Rw; in(:,:,2)=double(in(:,:,2)).*meanIntensity./Gw; in(:,:,3)=double(in(:,:,3)).*meanIntensity./Bw; imwrite(in,outPic);
dirdata=dir('*.xls'); filename={dirData.name}; Temp=[]; for iFile=1:numel(fileNames) [path,Fname,Ext]=fleparts(fileNames{iFile}); LD=xlsread(FName) Avg=mean(LD); Temp=[Temp;Avg] end
function obs_cov = get_random_coverages(obs, c) % GET_RANDOM_COVERAGES - returns a random collection of observations to % form "c" full coverages. In situations where the % desired number of observations is not available % for a given slice, all obser...
% training FBPConvNet % modified from MatconvNet (ver.23) % 22 June 2017 % contact : Kyong Jin (kyonghwan.jin@gmail.com) clear reset(gpuDevice(1)) restoredefaultpath run ./matconvnet-1.0-beta23/matlab/vl_setupnn load preproc_x20_ellipse_fullfbp.mat W = 512; % size of patch Nimg= 500; % # of train + test set Nimg_te...
function Td = pintalampo(dp,p) T = 23 + 273; % lämpötila, K M = (2 * 1.008 + 15.999)*1e-3; % veden moolimassa, kg/mol R = 8.3144598; % kaasuvakio, J/mol*K D = 0.282e-4; % veden diffuusiokerroin, (m^2/s) L = 2260e3; % veden höyrystymislämpö...
function isLegal=isLegal(x,y,board,turn) [rows cols]=size(board); isLegal=false; currentPos=turn*10+turn; [cRow cCol]=find(board==currentPos,1); if(board(x,y)==0) if ((x-1==cRow || x+1==cRow)&& y==cCol) isLegal=true; elseif((y-1==cCol || y+1==cCol)&& x==cRow) ...
function[mov]=transformationVideo(video, nbreTrame, imIncruste) %Initialisation mov = VideoWriter('F_1.avi'); open(mov); [imBase] = read(video,1); %Positionnement des coins initiaux de la feuille figure; imshow(imBase); nbPoints = 4; [XNow,YNow]=ginput(nbPoints); %Initialisation...
function error = L1_noprior_solver(H,y,x0,k) % function [A,C]= sysGen(m,n) % Description: % min||y-Hx||_{l1} % Inputs: % H: [N-by-n] system parameters % y: [T*m-by-1] measurements in T time horizon % x0: [n-by-1] actual initial state % k: [scalar] number of...
function g_ij = mth_os_mt_cov(e, a, eta) % MTH_OS_MT_COV computes the covariant matric tensor g_ij of the % oblate spheroidal coordinate system. % %----------------------------------------------------------------------- % Copyright 2020 Kurt Motekew % % This Source Code Form is subject to the terms of the Mozilla Publi...
function output = readStrfile(filename,minTime,maxTime,tsamp,maxPlotrec) % % readStrfile ver 1.0 % % Script som läser in RELAP5 stripfil (plotvariabler i textformat) % % % syntax: readStripFileGUI(filname,minTime,maxTime,tsamp,plotrecCnt) % % Input % filename = sökväg till .str-fil (string) %...
%Joint angles of Wearable Jacket connected with Kinect clear all; close all; clc; telapsed = 0;i = 1;tt = 0;lkinef = 0;font = 18;flag=0; addpath('F:\github\wearable-jacket\matlab\KInectProject\Kin2'); addpath('F:\github\wearable-jacket\matlab\KInectProject\Kin2\Mex'); addpath('F:\github\wearable-jacket\matlab\KInectPr...
%OpenCLInterface Class: Provides a wrapper for interfacing with OpenCL. %Create an object of this class to be able to run any kernel on any device %that supports OpenCL and query all the devices available to the system. % Copyright (c) 2014, MESC Labs % All rights reserved. % % Redistribution and use in sourc...
function [ outImg ] = invert_L( inImg ) x = inImg; for y = 1:3 x(:,:,y) = 255 - x(:,:,y); end outImg = x; end
%% Now become the observer % So now I can only observe the Y values. You told me the weather and I am % going to try and predict where you are located. %first get the weather %b=weather (y values) clear, close all generateDataWithGivenPiQR b=y %We are using Bayes rule to calculate the probability of X given Y. %Need:...
function [isect_m, cell_m, length_v] = ... signalIntersection(obj,rayIn, plumeIn) % rayIntersection Calculate intersection of ray with Plume % Input: rayIn (ray3D) % plumeIn (Plume) % Output: isect_v (M+1x3) Intersection points % cell_m (Mx3) Location ...
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/OPT_solvers/sres/AMIGO_SRES.m 770 2013-08-06 09:41:45Z attila $ function [xb,BestMin,neval,cpu_cost,conv_curve,x] = AMIGO_SRES(fcn,inputs,results,privstruct) %******************************************************************************** % AMIGO_PE_SRES: modification of S...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Description: find clusters using agglomerative hierarchical clustering % % Input: % D: n-by-p matrix of input data % % Output: % best_cmbrship: best cluster memberhsip % best_cvi: best cluster validity index value % ...
%d = nr_38_212_rate_unmatching_ldpc(g, base_graph, N_layers, Q_m, rv_id, tbs) % % Performs rate un-matching and code block de-concatenaion of 5G NR SCH according % to 3GPP 38.212 sec. 5.2.4 and 5.5. % % Arguments: % g - vector of concatenated LLR % base_graph - LDPC base graph (1 or 2) % N_layers - numb...
% [xzg,s,x,z]=fit_min2D_buckle(xzgInit,sInit,xx,zz,Lx) % fit (X,Z) to an Esuler buckling shape, minimizing the sum of squares i % both x and z-directions. % % fit function: x(i) = x0 + Lx*X(s(i),g); % z(i) = z0 + Lx*Z(s(i),g) % % objective fun: sum_i (X(i)-x(i))^2+(Z(i)-z(i))^2 % % free fit parameters: x0...
function varargout = ArbitrageGUI(varargin) % ARBITRAGEGUI MATLAB code for ArbitrageGUI.fig % ARBITRAGEGUI, by itself, creates a new ARBITRAGEGUI or raises the existing % singleton*. % % H = ARBITRAGEGUI returns the handle to a new ARBITRAGEGUI or the handle to % the existing singleton*. % % AR...
function compute_initial_coords(gtobs,hobs) epoch_count=0; obs=[]; for i=1:5 [obs_epoch staifo cdate gtcount]=getobs2(gtobs,hobs,epoch_count); obs=[obs;obs_epoch]; end % There are 5 epochs of data in ofile1 for q = 1:20 [time1, dt1, sats1, eof1] = fepoch_0(fid1); NoSv1 = size(sats1,1); % ...
function carrierType_prs(obj, evt, stage) hndl = get(gcf, 'Userdata'); hndl = get(hndl.mainFig, 'Userdata'); switch stage case 1 hndl.setting.Pre.carrier.carrierType_P = get(obj, 'Value'); switch hndl.setting.Pre.carrier.carrierType_P case 1 set(hndl...
function scdata = scaledata(data,u) %=============================================================================== % SCALEDATA % Scale time series data by a scalar factor u. % % OUTPUT % scdata Scaled data. % % INPUT % data (1) data vector % (2) matrix where each row episode or trial % ...
function [ pix ] = patch_filtered_pix( x, y, img, h ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here % patch_size = 9; window_size = 21; pix = 0.0; patch_init = img(round(max(1, x-4)):round(min(x+4, size(img, 1))), round(max(1, y-4)):round(min(y+4, size(img, 2)))); ...
h5create('timeseries_MEG.h5','/100307/1',[360 length(timeseries1)],'Datatype','double', ... 'ChunkSize',[360 1018],'Deflate',9) h5create('timeseries_MEG.h5','/100307/2',[360 length(timeseries2)],'Datatype','double', ... 'ChunkSize',[360 1018],'Deflate',9) h5create('timeseries_MEG.h5','/100307/3...
function [ut, up, ub] = mth_helix_tpb(r, c, t) % MTH_HELIX_TPB Computes unit basis vectors associated with a circular % helix originating about the Cartesian reference frame origin and % spiraling about the z-axis. % %----------------------------------------------------------------------- % Copyright 2018 Kurt Motekew ...
%Author: Salma Elmalaki %selmalaki@ucla.edu % Get the charging duration ... How long it was plugged % Get the time of the day when it is plugged function [ chargingintervals, timeofdayplugged] = getChargingDuration( pluggeddata, leveldata, id ) path='../../user-datasets/CambridgeDataGenerated/'; %Make a local co...
%% Mutual Information Demo 1 % This demo goes through calculating the mutual information for time locked % trials from two discrete time series. % Data Type: Discrete % Number of Variables: 2 % Information Analysis: Mutual Information % Trial Based or Single Trial: Trial Based % Significance Testing: Off % De...
% Dispersion Relation for 2D Graphene % Can be modified for 2DEG materials % % Properties of Graphene Sample taken from: % Terahertz plasmonics in ferroelectric-gated graphene % Define frequency sweep w = 2*pi*linspace(0,14e12, 1000); ep0_0 = 41.5; ep0_inf = 19.5; epe_inf = 10; epe_0 = 26; w_t0 = 2*pi*4.6e12; w_te ...
function drawImages(wPtr, imageMap, fileNames, widths, heights, hOffsets, ... vOffsets, xc, yc) for iImage = 1:length(fileNames) imageWidth = widths(iImage); imageHeight = heights(iImage); imageStruct = imageMap(fileNames{iImage}); if (isnan(imageWidth) || isempty...
function [ feature_v ] = featureLogVariance( enf ) %compute log variance feature_v = log(var(enf)); end
function [C, sigma] = dataset3Params(X, y, Xval, yval) %EX6PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = EX6PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You should co...
function [flash_time, flash_color, flash_zone, flash_pos, flash_color_name, target_flash_time] = convert_flash_sequence(x, green_or_cyan) flash_time = [x.red_distractor_flash; x.green_distractor_flash; x.white_distractor_flash]; flash_pos = [x.red_flash_pos; x.green_flash_pos; x.white_flash_pos]; flash_color = [on...
function [label, D_atom, dist, counter, index] = eNN_BSearch(obj,pts,epsilon,batch_size) % eNN_BSearch: epsilon nearest neighbors batch search % input: % pts: enquery points, dxN, with d points of dimension N % epsilon: error of eNN search % batch_size: batch search size, d...
% --------------------------------------------------------- % exampleSummary % --------------------------------------------------------- % Dynalog Analysis Package % Michael Hughes December 2010 % --------------------------------------------------------- % This is an example showing how to use various functions % in th...
function Mpause(str) disp(str);pause; % Mpause=@(str) (eval(['disp(str);pause'])); end
% inscore : normal score BACK transform % % CALL : % d=inscore(d_nscore,o_nscore) % % d_nscore : normal score values to be back transformed % using the 'o_nscore' object, obtained using % 'nscore' % % See also nscore.m % function d_out=inscore(d_normal,o_nscore,style) if nargin<3 style='...
function [TTS,PIndexTrain,PIndexTest] = MakeTTS(nExmpl,nTrain,nTrainParts, nTestParts); %function [TTS,PIndexTrain,PIndexTest] = MakeTTS(nExmpl,nTrain,nTrainParts, nTestParts); % %nExmpl is the total number of examples %nTrain is the number of examples to reserve for training. % % below are optional % %nTrain parts is ...
% The data for experiment 2 can be found in % '/Volumes/BCI_Data/own_experiments/motor_imagery/movement_detection/long_ % movements/' % % First, make sure you have the following folders added to your matlab path: % % 'BCI_code/toolboxes/jf_bci/' % 'BCI_code/toolboxes/classification/' % 'BCI_code/toolboxes/eeg...
function llr = score_gmm_trials_onlyGMM(models, testFiles, trials) % computes the log-likelihood ratio of observations given the UBM and % speaker-specific (MAP adapted) models. % % Inputs: % - models : a cell array containing the speaker specific GMMs % - testFiles : a cell array containing feature matric...
function [ y ] = propSig(p,q,W,s) % Computes the propagation of a signal s from layer p to layer q if (size(W,1)~=size(W,2)) disp('dimension Mismatch propSig'); end if (size(W,1)~=size(s,1)) disp('dimension Mismatch propSig'); end g = @nonLin; y = s; for i=p:q-1 temp = g(W(:,:,i)*y); y=temp; en...
function quant = findmininvect(x,method,def_quant,belowquant) %Function in CycIF_Segmentation_normfit_opencellsizeover5_medianpercell %shave off excess of cell x = real(x); x = x(x>0); if length(x) >0 [n,h] = ksdensity(x); [~,maxima_loc,widths,~] = findpeaks(n); num_peaks = length(maxima_loc); if method == 1 % ie 'mi...
function [ F ] = f_alpha( RP, alpha ) %F_ALPHA calculate total model accuracy using "recall" and "precision" %measures. % F = f_alpha( RP, alpha ) calculate F_alpha accuracy measure for every % RP row (recall, precision) using `alpha` as a weight. label_count = size(RP,1); F = zeros(label_count,1); fo...
function test_PID_para %画不同参数下位置变化图 close all global dt lim_v % PID=[0.3 0.5 0.3;%Kp Ki Kd % 0.9 0.5 0.3;%第二组参数 % 1.5 0.5 0.3]; PID=[1.5 0.1 0.3;%Kp Ki Kd 1.5 0.2 0.3;%第二组参数 1.5 0.5 0.3]; % PID=[0.9 0.9 0;%Kp Ki Kd % 0.9 0.9 0.5;%第二组参数 % 0.9 0.9 0.9]; D=0;%目标位置 lim_v=1;%是否有速度限制 dt=0.1;%仿真步长 t=10...
function [lon, lat] = dg_llg2lld(longg, latgg) % this function convert from glider lon/lat to lon/lat in decimal degrees % DG 20121012 dbstop if error if size(longg,2) > 1 longg = longg'; end %if nnanind = find(~isnan(longg) & (longg <= 36000 & longg >= -18000) & (latgg >= -9100 & latgg <= 9100)); lon = repmat(N...
%-------------------------------------- % Chris Dalke % CSC 249 - Homework 02 %-------------------------------------- % Takes in a region image and % deletes regions below a minimum size. %-------------------------------------- % Function Definition %-------------------------------------- function returnImage = Delete...
classdef (Abstract) Appender < handle %APPENDER Interface for performing output of log messages. % % Appender implementations perform the actual output of log messages. New % output strategies must implement this interface. properties % The name of the Appender. name = 'Undefined'; end methods(Abstract) ...
function [n, s] = find_y(x,y) ndata = size(x,1); % Create matrix to hold points and pairwise distances pts = [x,y]; d_c = zeros(nchoosek(ndata,2),3); k = 1; for i = 1:ndata for j = i+1:ndata d_c(k,1) = pdist([pts(i,:);pts(j,:)],'euclidean'); d_c(k,2) = ...
% Rotate all vertex coordinates. % - If two or three arguments are provided, the second is assumed to be the % rotations translation matrix and the third a flag that indicates whether % or not it should be inverted. % - If six arguments are provided, they are assumed to be the rotation and % translation values. func...
% output time series of transformations function leg_frame = crankKinematics(leg_length, crank_angle) abduction_max = pi/4; abduction_angle = abduction_max*(sin(crank_angle)<0); sweep_amp = pi/4; sweep_angle = sweep_amp*cos(crank_angle); R = angle2dcm(0,sweep_angle,abduction_angle); T = R*[0 0 -leg_length]...
%%%Simulate Particles orbiting and combining close all clear clc global m Numparticles = 10; load('data/10.mat'); %%Generate Vectors xpos_vec = [0]; ypos_vec = [0]; xvel_vec = [0]; yvel_vec = [0]; m = [0]; r = [0]; xposition = [-50 50 0]; yposition = [0 0 50]; %%Generate initial conditions pos = 100; vel = 100; for...
%% Machine Learning Coursework 2015 % Regression Models to predict online news popularity %%By: Arshad Ahmed %% %%Import and Check data %% d = readtable('OnlineNewsPopularity.csv'); [n k] = size(d) d(1:10,:) colnames = d.Properties.VariableNames colnames = colnames(:,3:end) %Drop unnecessary columns and check %% d = d...