text
stringlengths
8
6.12M
function [ normData ] = normalizeData( data ) %NORMALIZEDATA %Normalizes training data given that each row is a data point, each column %is a feature numFts=size(data,2); %Normalize the data meanFts = zeros(1,numFts); varFts = zeros(1,numFts); for ft = 1:numFts %Get feature array from the provided data ...
figure data1=importdata('SM4'); x1 = data1(1:1:157152,1); y1 = data1(1:1:157152,2); plot(x1,y1); %axis([0 2000 0.3 1.5]); title('SM4')
%V1.1 % % % FUNCTION: compare cards % % % MTRX5700 Major Assignment 2015 % % % Authors: Sachith Gunawardhana & Kausthub Krishnamurthy & James Ferris % % % REVISION HISTORY % % % v0 function stub % % % v1.1 % % % SUBFUNCTIONS LISTING % % % % % % 0000 1111 % % % 0000 1010 % % % 0000 1010 function [matchFlag, matchInd...
%% Clean environment close all; clear; clc; %% Model % As described in in: % Strogatz, S. H. (1987). % Human sleep and circadian rhythms: a simple model based on two coupled oscillators. % Journal of Mathematical Biology, 25(3), 327–347. http://doi.org/10.1007/BF00276440 pars = genPars('strogatz1987'); pars.w2 = 0.8...
function newmat = inc(oldmat, row, col); % This function is used to increase an element of a matrix. % If the matrix does not include the specified element, % the matrix is extended and the element is set to 1. matsize = size(oldmat); if (row > matsize(1)) | (col > matsize(2)) oldmat(row, col) = 1; else oldma...
function varargout = KWDM_Nerki(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @KWDM_Nerki_OpeningFcn, ... 'gui_OutputFcn', @KWDM_N...
% Chapter 8 - Planar Systems. % Program_8b - Phase Portrait (Fig. 8.8(a)). % Copyright Birkhauser 2013. Stephen Lynch. % Phase portrait of a linear system of ODE's. % IMPORTANT - Program_8a is vectorfield.m. clear; % sys=inline('[2*x(1)+x(2);x(1)+2*x(2)]','t', 'x'); sys = @(t,x) [2*x(1)+x(2);x(1)+2*x(2)]; ve...
function [V_ge,V_ef,V_ge_0_lio,V_ef_0_lio]=window_fun_HEOM2_f2(N,HL,om_3_rng,sup_op_full) %Changes, this version uses the / lin solver op % This version works in frequency space, i.e. using % int_0^inf dt_3 exp(-i \omega_3 t_3) e^(L t_3) = 1/(i \omega_3 - L) % this version that works in the exciton basis with n...
clear all close all addpath('../MRF/'); % addpath('../Chan-Vese/'); load('../data/prior/shapePriorShift.mat');loadDataFruitfly; %generateData; %Run MRF edgeStruct = createImgStructure(X,nStates); lambda = 1; beta = 10; Epsilon = 1; prior_phis = Phi(:,:,1:2); no_ex = size(prior_phis,3); % Compute kernel sigma kerne...
cc=hsv(3); hold off; train = load('q1atrain.txt'); test = load('q1atest.txt'); validation = load('q1avalidation.txt'); h1=plot(train(:,1),train(:,2),'color',cc(1,:)); hold on; h2=plot(validation(:,1),validation(:,2),'color',cc(2,:)); h3=plot(test(:,1),test(:,2),'color',cc(3,:)); legend([h1 h2 h3],{'training','validati...
close all; [V, F] = openOFF('../../ex3/model.off', 'newplot'); figure %P = patch('Vertices', V, 'Faces', F, 'FaceVertexCData',0.3*ones(size(V,1),3)); axis equal; shading interp; camlight right; camlight left; %% using homogeneous projection matrix projectedVerts = pinholeProject([0, 0, -1], 5, V); patch(projected...
classdef (Hidden) AbstractLevel < amg.level.Level %LEVEL A single level in the multi-level cycle. % This class holds all data and operations pertinent to a single % level in the multi-level cycle: right-hand-side, residual % computation and single-level processes such as relaxation. %====...
function [x, y] = myMin(v) %This function takes in vector v and outputs the smallest value of the %vector and the index of the first occurence of that vector. %Inputs: % v- vector input of any length %Outputs: %x- scalar input that is the smalled value of vector v %y- scalar input that is the index of the smalles...
function [T,I,Y]=perfusionResponsepotentP2X4two(y0,ton,toff,Ttot) ode=modelODEpotentP2X4two(ton,toff); [T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:21)); I=getTotalCurrentpotentP2X4two(Y); end
function [ ] = test_Heat2d_stream( ) %TEST_HEAT2D_STREAM tests the numerical solution against its analytical one %given in the book % %"Quantitative Hydrogeology" by Ghislain de Marsily (1986) % %in section 8.5. We solve the problem in two dimensions but independant of %the second one. % %The problem consist of an aqui...
% pColumnsForModel lists out what column each part of a JAR3D model should go into when displayed function [T] = pColumnsForModel(Node,ModelName) T = pColumnsForModelRecursive(Node,1); % start with Node 1 for i = 1:length(T), T{i} = [ModelName '_' T{i} ' appears_in_column ' num2str(i)]; end
% NODEWISE_CAMD Nodewise elimination procedure: METIS + simple reordering % % See also NODEWISE_ABSTRACT, METIS. function reduced_data = nodewise_amd_dummy( G, is_ext_node, ~ ) p = amd(G); p_terminals = is_ext_node(p); Perm = [p(p_terminals==0) p(p_terminals==1)]; reduced_data = struct; nodewise__fixed_ordering; end
% SNP needs to have at least two fields, "position" and "chr". % This implementation is very slow and stupid because I was lazy. you can % just compare the start and end positions of the annotation to the % position of SNP instead of using the more general genomic intersection % script. % Pejman April 2015, This code ...
clear; % max_frame 11114 % min_frame 2 % all_ids [0, 1, 2, 3, 4, 5] % max_frame 17424 % min_frame 11540 % all_ids [1, 3, 4, 2, 0] % max_frame 23689 % min_frame 18041 % all_ids [0, 1, 2, 3, 4, 6, 7] % max_frame 35057 % min_frame 24413 % all_ids [2, 3, 4, 0, 1] % max_frame 46870 % min_frame 41829 % all_ids [0, 1, 2, 4, ...
function [Filtered, FilteredCov, Predicted, PredictedCov, logLik] = ... KalmanFilter(Y, TranMX, DistMean, DistCov, MeasMX, ObseCov, State0, StateCov0) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here [~, d, T] = size(MeasMX); Filtered = zeros(d, T); FilteredCov = zer...
% init_leg leg.I1 = 0.66; leg.I2 = 0.33; leg.I3 = 0.33; leg.m1 = 2.25; leg.m2 = 5.2; leg.m3 = 15; leg.l1max= 0.3; leg.d2 = 0.15; leg.l2 = 0.3; leg.l3 = 0.2; leg.spring.Ksp = 2e3; leg.spring.Ksp2 = 5e5; leg.spring.kmax = 0.28; leg.spring.Kb = 1e3; leg.spring.k0 = 0.25; leg.damper.Kd = 1e3; leg.l1min = leg.l1max - le...
%%%%%%%%%%% % Algorithm for estimating the rate constants for thorium and particle % cycling. Fits a single particle class model for thorium and particle % cycling to 228Th, 230Th, and/or 234Th, their resepctive radioactive parents, % and particle data using a constrained % optimization routine (either the Algorithm of...
function bm_ext_base xib = 0.1e-3; %% Rl 100 ohm Rl = 1.0e7; frlist = logspace(0,3,600); wlist = 2*pi*frlist; Vplist = zeros(size(frlist)); Iplist = zeros(size(frlist)); Pplist = zeros(size(frlist)); tic for k = 1:length(frlist) [Vp, Ip, Pp] = bm_ext_eig(frlist(k), Rl); Vplist(k) = Vp; Iplist(k) = Ip; ...
function demoFACEclean %DEMOFACECLEAN demo of image denoising using a binary state Markov Random Field import brml.* f=imread('face.jpg'); xclean=f(:,:,1)>125; % binary clean image Gx=321; Gy=265; N=Gx*Gy; st = reshape(1:N,Gx,Gy); % assign each grid point a state if exist('W0.mat') load W0 else disp('buildi...
function f = get_values_at_nodes(xs) ys = zeros(1,length(xs)); for i =1: length(xs) x = xs(i); ys(i) = (1+x^4)/(1+x^6); end f = ys;
function [x_0,P_hidden_L] = block_gibbs(x_0,W,L) [n_input,n_hidden] = size(W); for k = 1:L % Generating h p = 1./(1+exp(-2*(x_0*W))); test = double(rand(1,n_hidden)<p); h = test + (-1).*(1-test); % Generating x p = 1./(1+exp(2*(h*W'))); test = double(rand(1,n_input)<p); ...
dimension = 0; total_runs = 100; filtrationgap = .00005; maxfilt = 0.2; timesamples = 1000; %whichModel = 'noInteraction' whichModel = 'model'; %NOTE ON FILE NAMES: for model exp 1-4, use 'Fullh' instead of 100h. Change %on BOTH of the below lines. Sorry about my terrible naming practices. for expnum = 5:9 all...
% % Cette énumération contient les type de fichier qu'Analyse pourra ouvrir/convertir. % % Le nom doit rester exactement comme il est écrit ici car nous utilisons ce nom pour % former le nom de la fonction qui sera appelé pour lire le fichier voulu. % % ex: pour un fichier texte, la classe s'appelle: CLireTexte % ...
function [ycomb_noage, summary, tr, tr_] = gather_outputs(y1,y2,TT) global Tin num_pops num_cascade num_age num_intervention num_engagement num_region ycomb=[y1(1:end-1,:,:,:,:,:,:,:);y2]; %Make everyone susceptible for R0 calculation ycomb_S = zeros(length(TT),num_pops, num_cascade, num_age, num_intervention, num_eng...
%% Plotting the time series of bacteria and virus populations, and immune response lwidth=3; lbsize=25; tlbsize=20; set(0,'DefaultLineLinewidth',lwidth) set(0,'DefaultAxesLinewidth',lwidth) set(0,'DefaultAxesFontSize',tlbsize) bpop(bpop<para.thres)=0; vpop(vpop<para.thres)=0; % Time s...
%Create Tyre data structure in car structure% % Car.Tyre = struct(); % Car.Tyre = addParametersFromFile(Car.Tyre,'TyreCoefficientsHoosierLC0_LatCombinedFrom13R25B.xlsx'); Fz=1000; Camber=0; SRinc=0.01; SRmax=0.2; SAinc=0.01; SAmax=15; SR=-SRmax:SRinc:SRmax; SA=-SAmax:SAinc:SAmax; Fx=zeros(length(SR),leng...
%%%%%%%%%%%%%%%% FIND SNAKE %%%%%%%%%%%%%%%% % Finds the blob boundaries using a snake algorithm. This program requires % code found in sdemo (Prince and Xu). The snake algorithm is initialized with % the convex hulls outputted by findBoundaries.m % % Inputs: % params - contains many snaking parameters (...
n = 1e6; x = rand(1,n); fun = sqrt(1-x.^2); y = rand(1,n); ns = sum(y <= fun); % счетчик попаданий внутрь окружности pi_ = 4*ns/n
function dataStruct = loadDataStruct(dictors, utterances,... variance, data, noise, voice, noiseValue, mode) if strcmp(noise, '_orig') noiseValue = ''; end names = getFileNames(dictors,... utterances, voice, variance, data, noise, noiseValue); struct_data = loadData(names); flat_data = []; for i=1:length(n...
t = linspace(0,2*pi); r1 = sin(4*t)+2; x1 = r1.*cos(t); y1 = r1.*sin(t); r2 = sin(8*t)+2; x2 = r2.*cos(t); y2 = r2.*sin(t); P = InterX([x1;y1],[x2;y2]); plot(x1,y1,x2,y2,P(1,:),P(2,:),'ro')
function A = fem_compute_A_lin(lambda,mu) %COMPUTE_A_LIN % A = COMPUTE_A_LIN(LAMBDA,MU) % This function was generated by the Symbolic Math Toolbox version 7.0. % 06-Jul-2016 17:00:24 t2 = mu.*2.0; t3 = lambda+t2; A = reshape([t3,0.0,0.0,0.0,mu,0.0,0.0,0.0,mu,0.0,lambda,0.0,mu,0.0,0.0,0.0,0.0,0.0,0.0,0.0,lamb...
clc; clear; close all; % Electrical Parameters Rc = 0.33; Rl = 2; Ron = 0.05; Ro = 100; C = 56e-6; L = 10e-3; Vin = 15; Vj = 0.1; % Sampling period Ts = 1e-4; % Compute the equilibrium point x2_eq = 5; x1_eq = x2_eq/Ro; x_eq = [x1_eq;x2_eq]; u_eq = (Ro*Vj + Rl*x2_eq + Ro*x2_eq)/(Ro*Vin + Ro*Vj - Ron*x2_eq); % Crea...
function Vxterm = get_Vx_term(x, V0, a, E) % get the RHS of Schrodinger's equation ... hbar = 1.0546E-34; %hbar in SI units mp = 1.6726E-27; %mass of proton in SI units qe = 1.6022E-19; %charge on electron to convert eV -> J if abs(x) > a Vx = 0; else Vx = V0; end Vxterm = 2.*mp.*(Vx-E).*qe/(hbar.^2...
clear;clc;close all; global ay;ay=[]; global gun;gun=[]; global ortalamaFiyat;ortalamaFiyat=[]; global ortalamaSicaklik;ortalamaSicaklik=[]; global maxFiyat;maxFiyat=[]; global minFiyat;minFiyat=[]; global minSicaklik;minSicaklik=[]; global maxSicaklik;maxSicaklik=[]; veri=importdata('veri2013.mat'); boyut=size(veri); ...
function f = lfilter(a, cond) f = {}; for i=1:length(a) if (cond(a(i)) == 1) f(end+1) = {a(i)}; end end
%{ # Rig rig_manufacturer: varchar(50) rig_model: varchar(30) --- rig_note : varchar(100) %} classdef Rig < dj.Manual end
function[phi_nr,phi_rear,phi_r,B] = all_loss(n_i,n,p,phi_rear_no_bias,Cn,Cp,tau_SRH,SRH_depletion_zero_bias,phi_r_zero_bias,V,Tc,E,alpha,nr,L) fund_consts; B = SVR(V,E,n,p,alpha,nr,Tc); % bimolecular recombination coefficient SRH = (SRH_calc(n,p,n_i,tau_SRH))*L; Auger =(Auger_ca...
function [t,x] = extract_anchored_timeseries(ratN,chanN,fileN,offset,len,skip) % % Return values % % % x - data values % t - time in days plot_on = 0; if (~exist('ratN','var')); ratN=4; end if (~exist('chanN','var')); chanN=2; end if (~exist('fileN','var')); fileN=26; end if (~exist('of...
%% prepare mean trajectories - MUA each cell mean only % one colour per recording figure; hold on sp1=subplot(1,2,1);hold on title('WT (N=15) Mean Burst Trajectories') cmap=hsv(numel(meta.archive.WT_filenames)); clear X Y Z for file_idx=1:numel(meta.archive.WT_filenames) [X{file_idx} Y{file_idx} Z{file_idx}] =tubeplot...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function loadHistos(type) % Loads all the histograms and stacks them into several ~500MB structure. % Should greatly speed up the nearest-neighbor computation % % Input parameters: % - type: either 'sky', 'ground' or 'vertical'. Indicates ...
% plot coverage of nxn scara discretizations belt = ConvBelt; goal_y = belt.robo2goal; belt_bottom = belt.robo2bottom; belt_top = belt.robo2top; blr = belt.left_right; height = belt.height; top_corners = [-blr belt_bottom 0; -blr belt_top 0; blr belt_top 0; blr belt_botto...
function convolvedFeatures = cnnConvolve(patchDim, numFeatures, images, W, b, ZCAWhite, meanPatch) %cnnConvolve Returns the convolution of the features given by W and b with %the given images % % Parameters: % patchDim - patch (feature) dimension % numFeatures - number of features % images - large images to convolve...
function Tr = epoch_rmnan(Tr) kp = []; for i=1:size(Tr.data,1) tmp = Tr.data(i,:,:); tmp2 = sum(tmp(:)); if ~isnan(tmp2) kp = [kp i]; end end ecfg.kp = kp; Tr = epoch_trs(Tr,ecfg); end
%problem parameters b = 0.5; h = 0.3; L = 5; P = 0.01; U = @(Y) P*L.^3/4/b/h^3./Y; %shape parameter A = 25; %scale parameter B = 1200; %% %%MONTE CARLO disp('======================MONTE CARLO========================') %number of samples, Monte Carlo Nmc0 = 1e6; %draw random samples Nmc times disp('sampling.............
% written by professor Jay McClelland function [ ] = Act( ) % here we act according to the action selected % by selectAction global w p; if w.out.chooseHand == 1 w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.td = p.handTime; else w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = p....
function varargout = doc_nlpsol(varargin) %DOC_NLPSOL Get the documentation string for a plugin. % % char = DOC_NLPSOL(char name) % % % % [varargout{1:nargout}] = casadiMEX(812, varargin{:}); end
clear all; close all; image = imread('../data/desert/sun_adpbjcrpyetqykvt.jpg'); I = im2double(image); [filterBank] = createFilterBank(); [filterResponses] = extractFilterResponses(I, filterBank); for k = [3,8,13,18] figure(k) resp = filterResponses(:,:,k*3-2:k*3); for i = 1:3 subplot(1,3,i),imshow(...
function linearODESSEP2X4Inact2factor2(T,I) global k1 k2 k3 k4 k5 k6 L1 L2 L3 L4 L5 L6 W1 W2 H0 H11 H5 kd1 kd2 kd3 kd4 ks1 ks2 ks3 ks4 H3 H3D H4 g1 g2 E1 E2 delta epsilon mu A J V n1 n2 n3 r1 r2 r3 v1 v2 v3 Acell p0 err Q; %#codegen generatorMatrixP2X4Inact2factor2(); Nt=length(T); for i=1:Nt p0=p0*expm(Q*...
function [C X Y X_nonorthogonal fhandle] = sgplvmDisplayPrivate(model,x,type,N,display,fid,verbose) % SGPLVMDISPLAYPRIVATE Display orthogonal subspace of sgplvm model % FORMAT % DESC Displays the output variance over observation orthogonal % latent subspace % ARG x : latent location % ARG type : type of display % ARG ...
%%--------------------------------------------------------------- %% Function to generate tone (DDS) at any sampling frequency %% %% (C) MMRFIC Technology Pvt. Ltd., Bangalore INDIA %%--------------------------------------------------------------- %% Version History: (in reverse chronological order please) %% %% V0.1 ...
function r_rot=rotate_points(pr,dir,rot_cen,angdeg) % Rotate points around vector, parallel to one of 3 cartezian axis. % Inputs: % pr -- 3xNpoints in 3D space % dir -- 1,2 or 3 -- selector for one of the rotation axis % rot_cen -- centre of rotation : row vector of 3 elements % (size(rot...
function render_SHREC( subset, reverse_flg ) % subset = 'train_normal' addpath(genpath('mvcnn_utils')); fig = figure('Visible','off'); if nargin < 2 reverse_flg = false end dirpath = ['data/' subset] imdirpath = ['images/' subset] mkdir(imdirpath) files = dir(dirpath) inds = 3:length(files); if reverse_flg ind...
%% Redes Neuronales Competitivas Multi Capa clear all %limpiar Workplace close all %limpia ventanas clc %limpia command window %% Cargar Datos load LogReg1.txt; data = LogReg1; Y = data(:,3)'; X = data(:,1:2)'; %% Conjunto de Entrenamiento y Prueba ndat = round(0.9*size(Y,2)); Ytrain = Y(:,1:ndat); Xtrain = X(:,1:ndat)...
% this function generates an input vector according to the number of % heterozygous and homozygous carriers %input: %NumOfPersons - the number of persons in the test %NumHeterozygousCarriers - the number of Heterozygous in the Subject groups %NumHomozygousCarriers - the number of Homozygous in the Subject groups func...
function [U,ELEM,d] = assembleSolution(ELEM,BSpline,BC,solutionVector) % Extract information from BSpline eCONN = BSpline.elementConnectivity; C = BSpline.decomposition.localExtractionOperator; x = sym("x","real"); d = solutionVector; nElem = length(ELEM); % Node->DOF mapping DOFS = fieldnames(BC); nDOF = length(DOFS...
%% Equation 3 omega = logspace(0, 5, 1000); eqn = 20*log10(0.00006) + 20*log10(omega/2 + 1) + 20*log10(omega/100 + 1) - 20*log10(omega/1000 +1) - 20*log10(omega/10000 + 1); semilogx(omega, eqn, '-*'); grid on; title('Equation 3: H(s)'); xlabel('Frequency(Hz)'); ylabel('H(s) = Gain(dB)'); print('equation3db', '-dpng');
function [mCHE, mCVE, mCHS, mCVS] = idCalcFeedForwardCorTables(idName, idParams, fileNamesMeasCOD, dirMeasCOD, dirMeasCorResp, arIndsBPMsToSkip) %Calculate Feed-Forward Correction Tables vs Undulator Parameters for 2 Horizontal and 2 Vertical correctors. %NOTE: Horizontal correctors are those displacing electron orbit ...
function F3rdDraft % al & bt must be grater than one.. according to paper global r1 a b c al bt Tau % Inputs a=0.1; b=0.2; c=0.1; al=1.5; bt=3; Tau=nan; % the treshold valu, nan= mean of data nn=20000; % the number of samples to plot the graphs % sample generation data % n=10000; % number of Series % k=2; % number of a...
load('history_734829708443'); r=hisrr(1,:,:); hp=plot(r(1,:,1),r(1,:,2),'k.'); axis equal; for lc=1:3:size(hisrr,1) r=hisrr(lc,:,:); %hp=plot(r(1,:,1),r(1,:,2),'k.'); set(hp,'Xdata',r(1,:,1),'Ydata',r(1,:,2)); drawnow; end
clear; %clear la mémoire clc; %clear le texte de la console % --------------- INITIALISATION --------------- disp('TP3') %[ Dev vbaf vbof rba rbo tballe ] = Devoir3([ 0 0 0 ]', [ 6.85 0 6.85 ]', 0.66); %[ Dev vbaf vbof rba rbo tballe ] = Devoir3([ 0 0 0 ]', [ 28 0.5 10 ]', 1.1); %[ Dev vbaf vbof rba rbo tballe ]...
%% PERPDIST - Perpendicular Distance Calculator % % Usage: perpDist = perpdist(p_x, p_y, grad, y_int, x_int, vertFlag) % % Arguments: % p_x - x coordinate of point % p_y - y coordinate of point % grad - gradient of line % y_int - y intercept of the line % ...
classdef downSample % DOWNSAMPLE contains methods to downsample a signal with consecutive % integers, or downsample a signal by a factor of two and continue to % downsample the result by a factor of two. It also plots the results % Returns a cell array of downsampled signals % Takes a signa...
function h = pa_verline(x, style) % PA_VERLINE(Y) % % Plot vertical line through current axis at width X. % % PA_VERLINE(...,'LineSpec') uses the color and linestyle specified by % the string 'LineSpec'. See PLOT for possibilities. % % H = PA_VERLINE(...) returns a vector of lineseries handles in H. % % See also PA_HO...
MatFiles=dir('*analysis_matlab.mat'); name=strcat(MatFiles(1).name); Calcium=load(name, 'DenoisedTraces'); Calcium=Calcium.DenoisedTraces; MatFiles(1).number=size(Calcium,1); %Spikes=load(name, 'Spikes'); %Spikes=Spikes.Spikes; Noise=load(name, 'Noise'); Noise=Noise.Noise; Fitness=load(name, 'idx_components');...
function plot_Gaussian_Elimination_Scaling() % Plots the operation count required to row reduce a square matrix to % reduced row echelon form versus the size of the matrix for a % variety of matrix sizes. This script calls the script % "go_Go_Gaussian_Elimination", which takes number of rows/col...
function [coordinate] = input_shipcoordinates(prompt, index, length, direction, user_ships) code = spriteCode(); close(figure(1)); fprintf(prompt,index); scene = simpleGameEngine('Battleship.png',84,84); drawScene(scene,user_ships); % get the coordinate of the mouse [row,col] = getMouseInput...
%This file demonstrates the use of the function %"magnetic_field_current_loop.m". %Kilian O'Donoghue %30th July 2013 clc clear close all %Define global variables global u0 u0=4*pi*1e-7; %permeability of free space %Define coil parameters I0=1; %Coil current in Amps a=.1; %Coil radius in m x_p...
function varargout = func_1d_lobatto(varargin) % Grab input arguments %------------------------------------------------------------------------------- verts = varargin{1}; order = varargin{3}; qx = varargin{4}; gbool = (nargout > 1); % Perform some error checking %---------------------------------------------------...
function [MeHgMicroP MeHgNanoP MeHgPicoP] = getPhytoplanktonHg(DOC,MeHgWaterConc) %GETPHYTOPLANKTONHG % phytoplankton MeHg concentration in micro, nano, and pico plankton % Cell Radius Radius = [1 11 110]; %[pico nano micro] um %Volume in um3 VolumeOfCell= 4./3.*pi.*Radius.^3 ; % um^3 %uptate rate amole/um...
function q = example_kinematic_trajectory % create a trajectory that extends the leg then bends the knee N = 50; q = zeros(5,2*N); q(2,:) = 1; q(3,1:N) = linspace(-pi/4,pi/4,N); q(3,N+1:end) = pi/4; q(4,N+1:end) = linspace(0,pi/3,N); end
%% Noisy Data Test %% Generate Noisey Trainning Data probaddnoise = 0.1; nsample = size(train,1); temp = rand(size(train)); train(train==0) = temp(train==0)<probaddnoise*1; %% Train EM based on original EM for i = 0:9 eval(['lambda = EM' num2str(i) '.lambda;']); eval(['P = EM' num2str(i) '.P;']); P(P==0) =...
function res = log_post_CES(y,X,gamma,h,gamma_0,V_0) %res ... logaritmus jadra posteriorni hustoty %CES funkce fx = gamma(1)*(gamma(2)*X(:,2).^gamma(4) +gamma(3)*X(:,3).^gamma(4)).^(1/gamma(4)); %logaritmus (5.24) z Koop res = -1/2*h*(y-fx)'*(y-fx) -1/2*(gamma-gamma_0)'*inv(V_0)*(gamma-gamma_0); %osetreni nulove hustot...
function pick_ALOT_of_Points() NVec = [1:1:10 20:5:100 125:50:1000 1500:250:10000 15000:5000:1e5]; for i=1:length(NVec) distN(i) = estimate_Point_Distance(NVec(i),1); end semilogx(NVec, distN, 'r*'); xlabel('N'); ylabel('Estimated Distance'); set(gca, 'Fontsize',18);
function [new,win] = iceSkate(cellarr) skater = cellarr(:,1); if strcmp(cellarr{1,2},'Long Program') LP = cellarr(:,2); elseif strcmp(cellarr{1,2},'Short Program') SP = cellarr(:,2); else BE = cellarr(:,2); end if strcmp(cellarr{1,3},'Long Program') LP = cellarr(:,3); elseif strcmp(cellarr{1,3},'...
function [M] = invmat(A,B) % the objective is to calculate A^{-1}B, A is n*n, B is n *m % it is better if A is sparse % tic [n, m] = size(B); M = sparse(n,m); [F,t1] = linfactor(A); for i = 1: m M(:,i) = linfactor(F,full(B(:,i))); end % toc % t= toc - tic;
function [f,xi] = fObj_U(U, theta_rj, T_rj, Vt, L, C, l) T_rj = double(T_rj); T_rj(T_rj~=1) = -1; UV = U*Vt; xi = max(l-T_rj(:).*(theta_rj(:)-reshape(repmat(UV,L-1,1),[],1)), 0); f = 0.5*sum(U.^2) + C*sum(xi); end
function result = mxm_write(data) result = mxMonarch('write',data); end
function ShowGraph(GraphPoint, Arc) %绘图函数 %输入: %GraphPoint:计算得到的各点位置 %Arc:图的连接 scatter(GraphPoint(:,1),GraphPoint(:,2),'filled','b'); hold on len1 = length(Arc); for i = 1 : len1 len2 = size(Arc{i},1); for j = 1 : len2 p1 = Arc{i}(j, 1); p2 = Arc{i}(j, 2); x1 = GraphPoint(p1, 1); ...
function SeismicData = getSeismicData(s1, s2, dataNum) %%% 진동센서로부터의 데이터를 무선으로 받는 함수 value1_Save = []; % initialize seismic data matrix1 value2_Save = []; % initialize seismic data matrix2 dataName = ['Data/Seismic/rawData/test', num2str(dataNum), '.xls']; disp('Staring to get data..........'); ...
clear all; close all; clc [X_tr, Y_tr, y_tr] = LoadBatch('Traindata80.mat'); % data = A.data; % data = data(1:10,:)'; X_tr = uint8(X_tr); % y_tr = categorical(y_tr); n = size(X_tr,2); I = reshape(X_tr, 32,32,3,n); figure(1) montage(I(:,:,:,1:3), 'Size', [1,3]) I2 = flipdim(I ,2); figure(2) montage(I...
function [X,Y] = BoxMuller(N) Var1 = rand(1,N); Var2 = rand(1,N); X=(-2*log(Var1)).^(1/2).* cos(2*pi*Var2); Y=(-2*log(Var1)).^(1/2).* sin(2*pi*Var2); end
clc % Clear command window history clear % Clear workspace memory close all % Close all figure frames n = -50:1:240; Ts = 0.1; y = ( ( mod( floor( n), 7 / Ts) < 5 / Ts) .* ( mod( floor( n), 7 / Ts) >= 3 / Ts)) * 4; close all; figure(), plot( n, y); axis([-50,240,-1,5]); % FSE Coefficients % f = @(k)...
%% Markov process model of Fault-Tolerant Switching Mechanism %% clear all clear all; close all; clc; %% n = 3; % fsw{1}(1,:) = [1]; % fsw{1}(2,:) = [1]; % % fsw{2}(1,:) = [2 2]; % fsw{2}(2,:) = [3 3]; % % fsw{3}(1,:) = [1 1 2]; % fsw{3}(2,:) = [3 3 3]; % % [~, length_fsw] = size(fsw); fsw{1} = [1 1 2]; fsw{2} =...
function U_nk = obtain_U(Ux,Uy,N,K) %obtain_U takes as inputs Ux and Uy for every Nth vehicle and Kth state %and obtains the 2-norm so that it can be constrained as a euclidean ball in %cvx. Ux and Uy are the acceleration in a 2-D coordinate system. U_nk = cvx(zeros(N,K));%use "cvx" to be solver-friendly for i = 1:N ...
function a=input_matrix(str, n) disp(strcat('Enter matrix: ', str)); a=[]; for i=1:n disp(strcat('Enter values for row no.', num2str(i))); for j=1:n a(i, j)=input(''); end end end
function [simpleGamma, measInt, measCie, lvlSet] = calibDisplay_pldaps(p, mode) % function [simpleGamma, measInt, measCie, lvlSet] = calibDisplay_pldaps(p, mode) % [p] = currently running PLDAPS structure % [mode]: 0 = grey[k] only, no color measurements (Spectral Power Distribution[SPD]); % [1 2 3 4] == [R ...
function image_pick = XuPickFramesRadiog(image) image_pick=image; image_z_ave = squeeze(mean(mean(image,1),2)); z_incorrect = find(image_z_ave<50); image_pick(:,:,z_incorrect)=[];
% BRRIEF: % Template for explicit invariant set computation. You MUST NOT change % the output. % INPUT: % Q, R: State and input weighting matrix, dimension (3,3) % OUTPUT: % A_x, b_x: Describes polytopic X_LQR = {x| A_x * x <= b_x} function [A_x, b_x] = compute_X_LQR(Q, R) % get basic controller parameters...
function et_loop(input) gain = input; doloop('orn_inputs_depr', gain, @ET) end
clc clearvars rng('shuffle') addpath('./model/') all_n = [10, 20, 30, 40, 50]; all_m = [10, 20, 30, 40, 50]; N = 10; kfold = 5; N_test = 1000; radius = 1; run_count = 100; epsilon = [1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1]; param(1:run_count) = struct('W',[],'H',[],'h',[],'C',[],'d',[], ... ...
% set atten, lock and FSW scan, big piece, dev 30, 20180714, 10:11 PM %% 20180915, top dev 61, optical M2 (the other NB), red cfs = [1.972e9, 2.108e9, 2.674e9]; fswconfig = struct('bw', 10e3, 'span', 20e6, 'sweeptime',1); attens = getAttensFromPowers(linspace(0.5e-5,10e-5, 20), 30e-6, 10); attens = round(a...
function adj = meshAdjacencyMatrix(faces, varargin) %MESHADJACENCYMATRIX Compute adjacency matrix of a mesh from set of faces. % % ADJMAT = meshAdjacencyMatrix(FACES) % Returns a sparse NV-by-NV matrix (NV being the largest vertex index) % containing vertex adjacency of the mesh represented by FACES. % FA...
%global volume_ratio; %global c_f0; %global c_d0; %global delta_h_p; global volume_ratio; global c_d0; global delta_h_p; global c_f0; %global c_d0; %volume_ratio=0.5; %c_f0=1.71; %c_d0=600; %c_f0=.1; van_coe=73.07/100; %T=293; %niu=2; A=2; %R=8.3144621; %r=R; %global c_d0; %global c_f0; %global volume_ratio; %o_p_ener...
function F = indirect_fsolver(X, Chaser, Target, Nav, t0, fixed_x0, Opt_sol) X0 = [fixed_x0; X(1:4)]; tf_rel = X(5); slack = X(6); options = odeset('RelTol',1e-12,'AbsTol',1e-12); odes = @(tau, X) indirect_odes(tau, X, tf_rel, Chaser); [tau,Y] = ode113(odes, [0 1], X0, options); Yf = Y(end,:)'; PSI = in...
%vannes vannes=tango_get_db_property('anneau','vanne_secteur'); for i=1:48; state= tango_command_inout2(vannes{i},'State'); fprintf('vannes %d = %s\n',i,state) end