text
stringlengths
8
6.12M
clear all close all clc rho=0.05 ny=2 % nummber of y terms nu=2 % nummber of u terms ne=0 % nummber of e terms n=ny+nu+ne x=3 M= factorial(n+x)/(factorial(n)*factorial(x)) mu=0; sigma=0.2; ...
ourKeyPressed=0; while ~ourKeyPressed % if already down, wait for release [ pressed, firstPress]=KbQueueCheck(bbx); if pressed if firstPress(KbName('1!')) ourKeyPressed=1; break end end [keyIsPressedDial,secsDial, keyCodeDial, deltaSecsDial] = KbCheck(dial)...
%original image x = imread('rice.png'); imshow(x) title('Raw Image') %color map figure imshow(x) colormap jet title('Jet color map') %background estimation (non uniform illumination) bg = imopen(x,strel('disk',10)); figure imshow(bg) colormap jet title Background %background removal (flatten backgr...
classdef ENUM_RTInfo_Task < Simulink.IntEnumType %UNTITLED 此处显示有关此类的摘要 % 此处显示详细说明 enumeration NothingHappened_task (0), Enter_ManualMode (101), Enter_AutoMode (102), Enter_AutoMode_Init (103), Enter_AutoMode_GroundStandBy (104), Enter_AutoMode_GroundSta...
%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&% %&% %&% %&% Εργασία Δημητριάδη Σωκράτη Α.Μ.:359 %&% %&% %&% %&% Τ.08 - ΘΕΜΑΤΑ ΨΗΦΙΑΚΗΣ ΕΠΕΞΕΡΓΑΣΙΑΣ ΕΙΚΟΝΑΣ %&% %&% ΣΥΜΠΙΕΣΗ ΚΑΙ...
function ClusterFunc_SplitSpikesByPolygon(self) % PreCut Clusters - ClusterFunction_SplitSpikesByConvexHull % % Adds ability to Creates a new cluster from those within the convex hull, leaves the rest MCC = self.getAssociatedCutter(); MCC.StoreUndo('Limit Spikes by Convex hull'); [xg,yg] = DrawPolygonOnAxes(MCC, fa...
function [ window ] = getWindow(frame, center, windowsize) x = center(1); y = center(2); hx = windowsize(1) /2; hy = windowsize(2) /2; [height, width, c] = size(frame); window = int16([max(1, y - hy), max(1, x - hx), min(height, y + hy), min(width, x + hx)]); end
function [E_PMM] = PMM_inc_coef_precise(La, b_x1, b_x2, alpha_ref, beta_ref,... N_basis_x, N_basis_y, N_intervals_x, N_intervals_y, Nx, Ny, nx, ny) n_points_int = 100; ksi1 = linspace(-1,1,n_points_int); ksi2 = linspace(-1,1,n_points_int); Nmax_x = max(N_basis_x); %maximum number of Gegenbauer polynomial on al...
function corelation = CCA(eegSig, refSig) % Perform CCA corelation to EEG signal and reference signal % % corelation = CCA(2D_eegSig, 2D_refSig); % return corelation (scalar) of the input EEG signal (channel * time) % and reference signal (channel * time), these two signal may have % different...
function setTransDecel(transDecel) % setTransDecel - Sets the robot's translational deceleration. % ======================================================================== % % setTransDecel(transDecel) % % Description: % This function sets the translational deceleration with the value % transDecel. % % Input...
function [transid,transcord,D] = genename2cds(genename) %genename='ABCE1'; %genename='A4GALT'; if strcmp(upper(genename),'APEX') genename='APEX1'; elseif strcmp(upper(genename),'CKN1') genename='ERCC8'; elseif strcmp(upper(genename),'DNCH1') genename='DYNC1H1'; elseif strcmp(upper(genename),'HCNP') ...
% check_jacobian_taylor_series % checks that the taylor series, using the jacobian included, really works % Copyright (c) 2019, Alexander D. Kaiser % All rights reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are m...
clear; %Sound of ] MelMin = 100; MelMax = 1500; AudioSampleRate = 48000; LengthSum = 2.4; TimeSum = 3; CoefLen2Time = TimeSum/LengthSum; NumPointSum = round(TimeSum*AudioSampleRate); GapWidth = 0.01; FreqMin = 700*exp(MelMin/1127-1); NumPadPoint = ceil (1/FreqMin * AudioSampleRate); NumSeg = ...
%trircorrect.m Baseline correction script Acorr = zeros(size(A(:,1))); for i = 1:length(t); p = polyfit(cm1,A(:,i),2); Acorr(:,i) = A(:,i)-(p(1)*cm1.^2+p(2)*cm1+p(3)); end
function [focus] = autoFocus() % autoFocus - If the driver can set the focus on the camera, or not. % ======================================================================== % % [focus] = autoFocus() % % Description: % This function returns bools if the current PTZ-camera allows to set % focus. % % Output:...
function [R] = get_ISI_low_high(R) % this is a bloody complicated piece of code! fprintf('\t Getting separate ISI distributions and CV^2 of ISI for high and low firing states separately...\n'); minimum_spikes = 5; % 3? 5? for CV2_ISI estimation pop_ind = 1; % dump fields N = R.N; dt = R.reduced.dt; spike_hist = R.re...
%% setthispar. function och lokala var... param = get(gcbo,'tag'); value = get(gcbo,'string'); eval([param '=' num2str(value) ';']);
function [P,R,F] = prf(A,B) P = precision(A,B); R = recall(A,B); F = fscore(P,R); end function P = precision(A, B) P = length(intersect(A,B))/length(B); end function R = recall(A, B) R = length(intersect(A,B))/length(A); end function F = fscore(P, R) F = 2 * P * R / (P + R); end
function [R] = affininity(X,Y,sigm) [num_train,~]=size(X); R = zeros(num_train,num_train); p_idx=find(Y(:)==1); n_idx=setdiff([1:num_train],p_idx); W = ones(num_train,num_train); W(p_idx,n_idx)=0; W(n_idx,p_idx)=0; tempA = repmat(sum(X.^2,2),1,num_train); tempB = tempA'; tempC =...
function pagesBooklet = bookPages(pagesContent) %bookPages % this function takes as input the number of pages of content you have % for the booklet and returns the number of pages (a multiple of 4) % in the smallest booklet that can accomodate your content. % % USAGE: % pagesBooklet = bookPages(pagesCont...
function preComputeTrainMfcc(list) %% PRECOMPUTEALLMFCC global baseline obsMat list = filterList(list, 'train_.*_.*'); %% Iterate over training list and generate features for i = 1:length(list) wavName = list{i}; fprintf('preComputeAllMfcc %d of %d\n', i, length(list)); if baseline obsMat.(wavName) = al...
function [aggregationInfo]=load_AggregationInfo(confFile) [type,configurationFiles]=init_ConfigurationVar(confFile); commonDataInfo=load_AggregationDataSetting(configurationFiles.commonInfoFile); geometryDataInfo=load_AggregationDataSetting(configurationFiles.geometryInfoFile); mathDataInfo=load_AggregationDataS...
clear; type compact; %a % mins = input('please input mins\n');% number of mins % show=(['hours :' num2str(fix(mins/60)) ' mins :' num2str(rem(mins,60))]); % disp(show); %b seconds = input('please input seconds\n');% number of seconds show=(['hours :' num2str(fix(fix(seconds/60)/60)) ' mins :' num2str(fix...
%% clear all clc %% 数据载入及处理 load station58 chargingdata=station58(:,5:8); Pmax=120; maxchargingrate=40; for i=1:28 stop=datenum(2018,2,i+1,00,00,00); start=datenum(2018,2,i,00,00,00); L=chargingdata(:,3)>=start & chargingdata(:,4)<=stop; tm=chargingdata(L,:); daydata{i}=tm; end dura=datenum...
addpath('..'); addpath('../../utils'); number_of_samples = 1000; Bxy_vec = [1e-8:0.02:0.5]; Byx_vec = [1e-8:0.02:0.5]; PointTotal = length(Bxy_vec)*length(Byx_vec); Cmodes = zeros(PointTotal,2); fprintf('There are %i points total.\n',PointTotal); PointCount = 1; for Bxystep = 1:1:length(Bxy_vec), for Byxstep =...
[x_d x_f]=meshgrid(y_d,y_f); figure;surface(y_d,y_f,nSEC,'LineStyle','none'); [nSEC_opt posi]=min(nSEC'); y_d_opt=y_d(posi); y_f_opt=y_f(posi);
function [surfaces] = hideOuterSurface(surfaces) surfaces.bottom.s.FaceAlpha = 0.0; surfaces.top.s.FaceAlpha = 0.0; surfaces.left.s.FaceAlpha = 0.0; surfaces.right.s.FaceAlpha = 0.0; end
#!/usr/bin/octave -qf if (nargin!=4) printf("Usage: pca+mixgaussian-eva.m <trdata> <trlabels> <tedata> <telabels>\n") exit(1); end; arg_list=argv(); trdata=arg_list{1}; trlabs=arg_list{2}; tedata=arg_list{3}; telabs=arg_list{4}; load(trdata); load(trlabs); load(tedata); load(telabs); % % HERE YOUR CODE % alphas=[1...
function refactor_fcn_name(fcnname, newfcnname, topdir, domove) % refactor the name of a function, changing all references to the function % name in the path and moving the function file to the new named file % % Syntax % % refactor_fcn_name(fcnname, newfcnname) % refactor_fcn_name(fcnname, newfcnname, topdir) ...
x = [100 10 1 0.1 0.01 0.001]; y = [973.145 973.145 754.913 196.514 26.366 2.912]; beta1 = [1000 1 1 1]; %parameter guess [beta_est,r,J,COVB,mse] = nlinfit(log(x),y,@sigmoidfun, beta1, options); x_graph = logspace(-4,4,1000); y_graph = sigmafun(beta_est, x_graph); semilogx(x,y,'*'); hold on semilogy(x_graph,y_graph); x...
function result = PatternXY(x,y,Pattern) %x,y번째 조합의 이미지를 꺼내오자 temp = cell2mat(Pattern(x,y)); [sizex sizey] = size(temp); for i = 1:sizex for j = 1:sizey result(i,j) = 1-temp(j,10-i); end end name = strcat('REMiner Pattern (',int2str(x),',',int2str(y),').bmp'); char(name) imwrite(result, n...
%%%%%% Define input parameters % define when the forecast was run, used for both CFS and NAM year_run = '2016'; month_run = '08'; day_run = '04'; hour_run = '00'; % define the forecast time, should be ~noon of the measurement day year_forecast = '2016'; month_forecast = '07'; day_forecast = '15'; hour_forecast = '18'; ...
clc clear dx=0.02; a=2; b=1; V0=-160E6; [Enew(1)]=secant_d_well_solve(0.81*V0,0.825*V0,V0,-5*a,5*a,0.9*a,a,b,dx); V0=-240E6; [Enew(2)]=secant_d_well_solve(0.85*V0,0.87*V0,V0,-5*a,5*a,0.9*a,a,b,dx); V0=-320E6; [Enew(3)]=secant_d_well_solve(0.89*V0,0.91*V0,V0,-5*a,5*a,0.9*a,a,b,dx); V0=-360E6; [Enew(4)]=secant_d_wel...
fprintf(' \n'); fprintf('*** Running Batch-learning\n'); for j = 1 : Run_times tic er = normrnd(0,st,1,N_iter)'; x = rand(N_iter,d); y = x*z_sample + er; B = inv(N*lamda*eye(d)+x'*x); final_solution = (B*x'*y)'; objective_computation; end Computing_Data; % file_name = [filena...
%% setup IRI2016 using Fortran compiler system('cmake --version') cwd = fileparts(mfilename('fullpath')); srcdir = [cwd, filesep,'..',filesep,'src']; builddir = [cwd, filesep,'..',filesep,'build']; tail = [' -S ', srcdir, ' -B ', builddir]; if ispc ccmd = ['cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFO...
function [outcome, cp, distMean]=outcomegen(numOutcomes,sigma,mean,Haz,safe,valrange) % pick some % how long should the block of trials be? % standard deviation of the generative dist... % probability of a change-point on any given trial % except that we set hazard rate equal to zero for "safe" trials after a change-...
%% Project #3 MOM % Authors: Dayo Lawal and Blake Levy clc;clear;clf; tic Qo = [1]; % q-point Quadrature for G = 1:length(Qo) qo = Qo(G); qs = 1; constants tol = 1e-11; % Tolerance for GMRES M = 160; % Number of elements N = M+1; % Number of nodes r = 4*lamb0/2/pi; % radius of circle clo...
function [cost,gradient] = cost_function_nn(x,weights,biases,depth,spectCompare) %input = x; %layer = max(0,weights{1}*input)+biases{1}; %for j=2:depth-1; % layer = max(0,weights{j}*layer)+biases{j}; %end [layer, Jacobian] = NN(weights,biases,x); %layer = weights{depth}*layer+biases{depth}; %Jacobian = ...
% unsupervised analysis of metabolon data %% load the metabolomics data from file breastnorm.xlsx breast = readtable('breast.csv'); sampleName = {'P1' 'P2' 'P3' 'P4' 'P5'... 'B1' 'B2' 'B3' 'B4' 'B5'... 'L1' 'L2' 'L3' 'L4' 'L5'}; %% heatmap breastmat=table2array(breast(10:end,15:end)); % Windows PCs and other ...
%function [] = run_fmriGP(filenames, savefilename, datafolder, savefolder, numberofsplits, maskfile) % % must install libraries: % gpml-matlab (used v3.2-2013-01-15) http://www.gaussianprocess.org/gpml/code/ % NIFTI matlab (used NIFTI_20130306) included % close all %test nargin= 0; if(nargin<1) da...
function [tabout,indices] = clean_qualtrics_data(filein) % The Function takes in the input as the '.csv' file exported from the % UPENN-Qualtrics online survey services. % % The function has the following data: % tabout = Output of the form Table. % indices = Indices where the ID's read a 'NaN' of the form array. ...
i=0:0.001:100 D=21; P=40; w0=2*pi/P; duty=21/40*100;%factorul de umplere al semnalului figure(1) xq=0.5*square(w0*i,duty)+0.5;%semnalul dreptunghiular initial %Afisarea semnalului dreptunghiular D=21; P=40; w0=2*pi/P; duty=21/40*100;%factorul de umplere al semnalului figure(1) plot(i,xq),hold on xlabel(...
function parsave(fname, vars_opt, errs, fobjs, etimes, postdim, K, l, alphav, C, rho, varsigma, dobuffer) varname = {'vars_opt', 'errs', 'fobjs', 'etimes', 'postdim', 'K', 'l', 'alphav', 'C', 'rho', 'varsigma'}; if exist(fname, 'file') save(fname, varname{:}, '-append'); else save(fname, varname{:}); end if do...
% calculateFontSize Calculate font size as a fraction display height % % This function calculates font size (in pixels) as a fraction of the % display height. % value=calculateFontSize(fraction); % default input is 0.01 % In general, font sizes should be 1-2% of the display height. Smaller % sizes are difficult to ...
p=24; d=2; Gamma(:,1)=[0.5,0.5,0.5,0.5,zeros(1,p-4)]'; Gamma(:,2)=[0.5,-0.5,0.5,-0.5,zeros(1,p-4)]'; beta=Gamma; for i=1:p-1 for j=1:p-1 psig(i,j)=0.5^abs(i-j); end end setpaths; spsig = sqrtm(psig); myCluster = parcluster(); parpool(myCluster); for n=[60 120] time=zeros(100,2); t...
syms kc TD s kp = 2; kd = -2; kc = 2.1981; thetap = 1; thetad = 2; tp = 5; ti = 5; td = 8; TD = 0.3500; gp = kp*exp(-thetap*s)/(tp*s + 1); gd = kd*exp(-thetad*s)/(td*s + 1); gc = kc*(TD*s+1)*(ti*s+1)/((ti*s)*(0.1*TD*s+1)); w = [0.1:0.005:10]; s = 1i*w; gcl = (kc*kp*exp(-(thetap).*s).*(TD.*s + 1)./((ti.*s).*(0.1*TD.*s+...
function [ node, dist ] = findClosestNode( node, otherNodes, globalCoMList, ... scale ) %FINDCLOSESTNODE From a list of nodes, find node with minimum euclidean %distance to a given node. % INPUT node: (Mapped) global segment ID of a node. % otherNodes: List of nodes as (mapped) global segment IDs. % globa...
%%%%%%%%%%%%%%%%%% % lab 3, recuperator modeling % 2021, PVRT %%%%%%%%%%%%%%%%%% clc, clear, close all; [A, B, C, D] = get_vitko_code_f(); TEMP_INSIDE = 22; TEMP_OUTSIDE = B - A; temp_diff = TEMP_INSIDE - TEMP_OUTSIDE; EL_PRICE = 0.13; WORK_COST = 5000; RECUP_PRICE = 2500; initial_investment = WORK_COST + RECUP_PRICE...
function [ flg_in, tar_el,mi_range, ma_range ] = fun_judge_in_range(arr_range, tar_el ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here mi_range = min(arr_range); ma_range = max(arr_range); flg_in = tar_el>= mi_range && tar_el <=ma_range; % mod : 12-Sep-2014 16:40:19 %
function tmp home; close all; %% Generative model % cd('E:\MATLAB'); pa_datadir; % load AVpar2 % figure(1) % subplot(241) % A = Vision(1).SupSac(:,23); % E = Vision(1).SupSac(:,24); % for ii = 1:4 % a = Audiovisual(ii).SupSac(:,23); % A = [A;a]; % % e = Audiovisual(ii).SupSac(:,24); % ...
%ejercicio1 clc;clear all; syms a t; A=[0 0 -2; 0 1 0; 1 0 -3]; pol_car= det(A-a*eye(3)); auto_val=solve(pol_car) V=[1 auto_val(1) auto_val(1)^2; 1 auto_val(2) auto_val(2)^2;1 auto_val(3) auto_val(3)^2] V_inv= inv(V) e=[exp(auto_val(1)*t);exp(auto_val(2)*t);exp(auto_val(3)*t)]; fun=V_inv*e e_At=fun(1)*eye(3)+fun(2)*A+f...
function [ time, Data ] = plotTimeGraphs( timeData, output_mode ) %PLOT Summary of this function goes here % Detailed explanation goes here FONTSIZE = 18; time = (timeData.timeResponse(:,4) - timeData.timeResponse(1,4))/1000; % dtSum = cumsum(timeData.timeResponse(:,4)); % % time = (dtSum- dtSum(1))/1000; ...
function [negative_labels] = fn_ch_lab_negate(labels) % Add '-' string to beginning of channel labels to remove them using ft_selectdata % INPUTS: % labels [cell array] - string labels of channels % OUTPUTS: % negative_labels [cell array] - channel labels with '-' appended to front if isempty(labels) negative_...
clc; clear; close all pkg load image function Y = binaria(X) Y = zeros(size(X)); ind_blanco = (X >= 0.5); ind_negro = (X < 0.5); Y(ind_blanco) = 1; Y(ind_negro) = 0; endfunction A = imread('files/imagen9.jpg'); subplot(1,2,1) imshow(A) title('Imagen Original') A = imresize(A, 0.5); A = b...
% CellLabel is the same size as "Data", and it can be cell array or a numeric array. function Fig = Pej_Heatmap(Data, RowNames, ColumnNames, ColorRagne, ColorBarLabel, CellLabel) NaNcolor = [1 1 1]*.5; % missing points N = size(Data,1); P = size(Data,2); if nargin<2 || isempty(RowNames) RowNames = []; end if narg...
function g_x = h_c_partial_x_X_UV(V,Vidx,theta,tau2,Cov_Noise_Inv,X,i,x,x_indep_mu,x_indep_Cov_X_V,cost_type,varPra,var_X,var_Cov_Inv_y_M) % v - a random sample from domain % i - considered alternative % x - derivative of h_i_n(v,x) with respect to x %%% compute mu and cov_X_V out of this function % M = size...
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Extract Segmented Data from tGau-BP-HMM Results %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; close all; clc; load('./mat/proc-data.mat') %% %%%%%%%%%%%%%%%%%%%%%%%%%%%% % Load Results from tGau-BP-HMM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load('./results...
%% DIGITAL IMAGE PROCESSING - Aristotle University of Thessaloniki % Assignment 2 - Summer Semester 2020/2021 % Kavelidis Frantzis Dimitrios - AEM 9351 - kavelids@ece.auth.gr - ECE AUTH % Description: % The topics of this assignment are: % Implementation of SIFT (Scale Invarient Feature Extraction) DETECTOR % 1...
function err=err1(n) i=1; xsamp=[]; while i<=n u0 = unifrnd(0,1); u1 = exprnd(1); tmp= exp(-1/u1+2-log(u1)); if tmp/exp(1.0)>u0 xsamp(i)=u1; i=i+1; end end err=xsamp';
bayes(dataset1,dataset1,[0,1]')
clc; clear; close all; %% 3.17 % a) w = 5; % wind speed in [kts] f0 = 3; % carrier frequency [GHz] r = 394*w^(-1.55)*f0^(-1.21); If = (r+1)*((lambda*fp*b)/(2*pi))^(2*n)*((1*3*5)/(2^n)*factorial(n)*factorial(2*n));
function model = os_rank_elm_pairwise_lh_eig_train(X_train, Y_train, Q_train, X_vali, Y_vali, Q_vali, option) %% input option nHiddenNeurons = option.NumberofHiddenNeurons; ActivationFunction = option.ActivationFunction; metric_type = option.metric_type; N0 = option.N0; Block ...
clear all close all tstart = tic; C=zeros(1,10); Y=zeros(1,10); R=zeros(1,10); %syntax [accr,asuma,arcr,atcr,arat]=opticalflow('marathon.mp4',1,10) hvfr = vision.VideoFileReader('abnorm1.mp4', 'ImageColorSpace', 'Intensity','VideoOutputDataType', 'uint16'); hidtc = vision.ImageDataTypeConverter; ...
classdef ParallelSimulation % PARALLELSIMULATION % Revised: 3-20-2019 % Copyright 2018 The MathWorks, Inc. properties % REVISIT: in the async case, the random seeds may not help as the % execution on each worker is not deterministic, e.g. worker 1 may % finish simulation 1 before worker 2 ...
% Project Title : Watermarking Images In Wavelet Domain Using MATLAB % Author : Deval Dixit % University : Carleton University % Course : Multiresolution and Signal Decomposition % Load Cover/Host Image I=imread('lena.png'); % Resize cover image I=imresize(I,[512 512]); % Convert to gray I=rgb2gray(I); I=im2doub...
function [X,T] = one_cos(A,w,phi,dur) %Using the duration and sample size a relation can be made to find %the sample times. These values are then put into a cosine %function with the other inputs. This gives us our time values and %x values. T = (1:1:20).*(dur/20); ...
function [ new_W, new_cholLD, new_invW, new_V, linlosses, step_size_bound_grad, iterlog ]= ... prox1_stepk(k, cfg, W, cholLD, invW, V, linlosses, triplets_trn_Q, ... triplets_trn_diff_mat, iterlog) % [ new_W, new_cholLD, new_invW, new_V, linlosses, step_size_bound, myRcond]= ... % grad_stepk_sparse(k, cfg,...
function [ fg_ls, fg_index ] = cal_fg_sm2( fg_seed_init_all, alpha ) theta = 10; spnum = length(fg_seed_init_all{1,1}); sup_lab = colorspace('Lab<-', fg_seed_init_all{1,2});%转换到Lab空间 spnum*3 dep_matrix1 = fg_seed_init_all{1,3} * ones(1,spnum); %spnum*spnum 的矩阵,每一列都是fg_seed_init_all{1,3} 深度信息 dep_matrix2 = ones(spnum...
function P5(im,x) A=imread(im); %imshow(A); s=size(A) if x(4)>=s(1) x(4)=s(1); end if x(3)>=s(2) x(3)=s(2); end s=size(s) ic=256-A; if s(2)==3 if(x(1)<=x(3) || x(2)<=x(4)) A(x(2):x(4),x(1):x(3),1)=ic(x(2):x(4),x(1):x(3),1); A(x(2):x(4),x(1):x(3),2)=ic(x(2):x(4),x(1):x(3),2...
7clear all close all hidden clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Set some constants: OutDir = '/Users/josmond/Results/Quantum_Accounting'; Name = 'QuAcc'; DoseRate = 550; % Dose rate of Linac in ...
function rec_recall_trial(trial) global exp; % Record info on memory test % else exp.RECALLdata.time_oldnew(trial) = exp.t_oldnew; % Stimulus presentation time exp.RECALLdata.ACC_oldnew(trial) = exp.ACC_oldnew; if ~isempty(exp.key_oldnew) exp.RECALLdata.key_oldnew(trial) ...
%% experimental flies -- before stripe fix fly(1).tr1 = '/Volumes/flyplacememory/TJ/VR_Maze_Experiment_Data/temperaturePreference/2013-07-15/20131507220956_stimulusTest'; fly(1).tr2 = '/Volumes/flyplacememory/TJ/VR_Maze_Experiment_Data/temperaturePreference/2013-07-15/20131507223423_stimulusTest'; fly(2).tr1 = '/Volu...
%% Mstep function [means,covs,priors]=Mstep(Y,gamma_z) K=size(gamma_z,2); N_k=sum(gamma_z); D=size(Y,2); N=size(Y,1); means=zeros(K,D); tempcov=zeros(D,D,N); covs=zeros(D,D,K); for k=1:K means(k,:)=1/N_k(k).*sum([gamma_z(:,k).*Y(:,1) gamma_z(:,k).*Y(:,2)]); X_demaned = Y - repmat(means(k,:),N,1); ...
function [R] = solver_steady_res(Tf, f, dx, dy, q) [nx, ny] = size(Tf); nx = nx + 1; ny = ny + 2; [A, b] = calc_Ab(nx, ny, dx, dy, f, q); Tf = reshape(Tf, (nx-1)*(ny-2), 1); R = A*Tf - b; end
function recordText(answer) % Record text to recording script. Compare recordInputsText. % I don't know which is best here: %imlook4d_current_handles = evalin('base','imlook4d_current_handles'); imlook4d_current_handles = guidata(gcf); % Bail out if not record mode try if (imlook4d_current_...
function [I1] = TrapComp(h,data) %TrapComp calculate integral using trapezoidal integration len = length(data); c = ones(1,len); c = c*2; c(1) = 1; c(len) = 1; I1 = sum(c.*data)*h/2; end
clc; clear all close all format compact mn= 3; %Matrix degree Summing=24; %Sum row and col Pc=0.5; %Crossover Pm=0.8; %Mutation %Generation_num=2000; N=4; % Number of chromosom LengthCh=mn*mn; %Length of chromosom %% %Initial Population Ch=Initial_Population(N,1,15,LengthCh); i=1; while(1) ...
%converting image to gray scale image gray_image = rgb2gray(imread("image.jpg")); %size of image [R C] = size(gray_image); %creating a black image to store the result binary_image = zeros(R,C); for i = 1: 1 : R for j = 1 : 1 : C if (gray_image(i,j) > 128) %threshold condition binary_image(...
%REGSFP Plotting script for discrete-time regulator simulation. % This is a MATLAB script that creates graphs for the discrete % regulator simulation REGSF. Selection of the material displayed % is menu driven. % T. Flint 7/92 % Modified by R.J. Vaccaro 10/93,11/98,11/15 %_____________________...
clear all; close all; x0=4; i=0; f=@(x) x^2-2; fprime=@(x) 2*x; tolerance=10^(-7); epsilon=10^(-14); maxiterations=30; fsol=false; for i=1 : maxiterations y=f(x0); yprime=fprime(x0); if(abs(yprime)<epsilon) fprintf("Warning: denominator is too small\n"); break; end x1=x0-y/yprime; c(i)=x1; i=i+1; if(abs(x1-x0)/abs(x1)...
function res = Wprint(N) if mod(N,4) ~= 0 printf('N is not valid (%i)\n', N); res = 0; else Wbase = exp(-j*2*pi/N); fp = fopen('./outputArray.txt','w'); %original arrays for stepsize = 0 : 3 W0 = zeros(1,N); for k = 1 : N W0(k) = Wbase^(stepsize * (k-...
% An analysis of nodal reaction forces, nodal deformations, element % internal forces, and element internal stresses for a truss of a certain % configuration is required. This analysis must use the direct stiffness % method. A plot of maximum stress vs loaded mass is also desired, as is a % deformed shape plot for ...
syms a b c t1 t2 t3 t4 ry = [cos(b),0,sin(b);0,1,0;-sin(b),0,cos(b)]; rz = [cos(a),-sin(a),0;sin(a),cos(a),0;0,0,1]; rz2 = [cos(c),-sin(c),0;sin(c),cos(c),0;0,0,1]; rot_op = rz2*ry*rz; e1 = subs(rot_op*[1;0;0],[c,a],[pi/4,t1]); e2 = subs(rot_op*[1;0;0],[c,a],[3*pi/4,t2]); e3 = subs(rot_op*[1;0;0],[c,a],[7*pi...
%% SelectedEye % % Defines the selected eye. % %% classdef SelectedEye < EnumClass properties (Constant = true) %% LEFT % Left Eye % % selected_eye.LEFT (0) % LEFT = 0; %% %% RIGHT % Right Eye % % select...
function err = checkOptions(options) %NNET.CHECKPOINT.CHECKOPTIONS Checks that checkpoint training options are % valid % % err = checkOptions(options) takes a structure with these fields: % % checkpoint.CheckpointFile, file name and/or path for checkpoint saves. % checkpoint.CheckpointDelay, minimum delay between s...
function answer=timeprocess(X) X(:,1)=X(:,1)-X(1,1); answer=X; end
function [ answer ] = makeAbsoluteSliceNumber( answer, imlook4d_slice, numberOfSlices ) % Makes absolute slice numbers from relative slice numbers % Used int SCRIPTS Copy_ROI, Threshold_ROI % % Handle range to end or rel range to zero % if strcmp(answer{2},'end') answer{2}=num2str(number...
## Copyright (C) 2021 Robertson ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is dist...
function [fitresult, gof, xData, yData] = createFitRightSensor(x, yRight) %CREATEFIT(X,YRIGHT) % Create a fit. % % Data for 'RightADCfit' fit: % X Input : x % Y Output: yRight % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FIT...
%%FIR_FILTER_DESIGN Generates the FIR filter coefficients, or impulse % response, to meet given design specifications % % Author: ECE486 Spring 2015 Lab Group 2 % Author: Jacob Allenwood, Travis Russell, Jeremiah Simonsen % Date: 04/10/15 % % This script is used to design an M coefficient FIR filter using the % window...
function classplot3(X,i,j,k) hold off; clf; y=X(:,1); scatter3(X(y==0,i), X(y==0,j), X(y==0,k), 'blue', 'o'); hold on; scatter3(X(y==1,i), X(y==1,j), X(y==1,k), 'red', '+');
% Filter function for LowpassFilter function filteredData = filter (obj, data) % Data is assumed to be transformed. % Sample frequency hard-coded for now fs = 22050; % Calculate which parts of data to set to zero and create filtering mask delta_f = fs / length(data); n = floor(obj.CutOffF...
% test errors and correction functions close all clear all addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions'); addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/')); addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/')); % load lattice load ESR...
%% Birth Certificate % ===================================== % % DATE OF BIRTH: 2021.03.13 % NAME OF FILE: CLTest % FILE OF PATH: /History % FUNC: % 验证上级文件夹CL变换与CLT逆变换函数。 % ===================================== % addpath('../') %% 读取图片 AImg = imread('1.png'); %% CL正变换,CL逆变换 E = CLT(AImg); RA = CLTInv(E);...
% patch2img compose image from columned image patches by averaging (almost same to col2im) % % [image, value, weight] = patch2img(X, [pn pm], [in im] ) % % %Output parameter: % image: composed image % value: sum of pixel value for each pixel % weight: number of patches for each pixel % %Input parameters: % ...
function [ adjust_factor ] = adjustment( old_draw,proposal,setup ) %This function adjusts the MH acceptance probability for the fact that some proposal processes for parameters are transformed so that the parameters are restricted adjust_factor=0; %in logs if setup.proposal==1 && ((setup.length_log+setup.length_logi...
%% Add files to path path(path, '../l1magic/Optimization'); path(path, '../l1magic/Measurements'); path(path, '../l1magic/Data'); path(path, '../l1magic/Notes/Figs'); % signal length N = 512; % number of spikes in the signal T = 20; % number of observations to make K = 120; % random spike signal x = zeros(N,1); q = r...
function varargout = newpage1(varargin) % NEWPAGE1 MATLAB code for newpage1.fig % NEWPAGE1, by itself, creates a new NEWPAGE1 or raises the existing % singleton*. % % H = NEWPAGE1 returns the handle to a new NEWPAGE1 or the handle to % the existing singleton*. % % NEWPAGE1('CALLBACK',hObject,ev...
ceptralBands = 13; %sprectrogram female subplot(3,2,1); plotSpectrogram('female.wav'); title('Female spectrogram') %spectrogram music subplot(3,2,2); plotCeptogram('female.wav',ceptralBands) title('Female ceptogram'); subplot(3,2,3) plotSpectrogram('male.wav'); title('Male spectrogram'); subplot(3,2,4) plotCeptog...
function [] = visualizeRieszFilters(config) % VISUALIZERIESZFILTERS view the Riesz filters % % visualizeRieszFilters(config, viewType) view the Riesz filters for the % configuration object config. % % ------------------------------------------------------------------------- % % AUTHOR: % Nicolas Chenouard, nicola...