text
stringlengths
8
6.12M
function vout = upsample_r(vin,n) % upsample by fast linear interpolation, first dimension taken as time % axis % note: MATLAB upsample just insert zeros % Copyright 2017 Yulin Wu, University of Science and Technology of China % mail4ywu@gmail.com/mail4ywu@icloud.com if n == 1 vout = vin; ...
% This program computes the value of linear performance functions between gene expression % profiles grouped in clusters % % Clustering solutions were computed through stability analysis % % Clustering performance functions: Hav (average homogeneity), Sav (average % separation) and GOTOav (average gene ontology ...
%% RBES_search_thread.m clear java % global db_pack_EOS %% RBES Init RBES_Init_Params_EOS;% create params structure [r,params] = RBES_Init_WithRules(params);% Init RBES with params % save rbes_eos.mat; % load rbes_eos.mat; % %% Init database and plot db_pack = get_db_pack('db_pack_EOS.mat'); % db_pack_EOS = java.util...
function feature_array=singleNum_feature_extraction(image) %该程序可以提取一张图片中数字的特征,返回的特征数据为1*100的矩阵 %image为待提取特征的图片名 src_image=imread(image); src_image=rgb2gray(src_image); [src_width,src_height]=size(src_image); %将手写板保存下来的图片中显示坐标轴的部分截除掉 num_image=src_image(1:src_width-4,5:src_height,:); %图像灰度值非0即255 num_width=size...
function zi = griddata_extend(x,y,z,xi,yi) %function zi = griddata_extend(x,y,z,xi,yi) % % a wrapper to griddata which appends the point list to add points in the % corners. This is done so that the borders of the output are not nan. newxy(:,1) = [min(xi(:));min(yi(:))]; newxy(:,2) = [max(xi(:));min(yi(:))]; newxy(:,...
T3= (A*B)*C T3 = 24 14 20 11 >> T4= A*(B*C) T4 = 24 14 20 11 %Verdadeiro
%% dict_hrFromLr_tests %% sz = 3; dorep = 1; rng = linspace( 0, 1, sz ); [x,y] = ndgrid( rng, rng ); D = [ x(:), ones(numel(x),1), cos(pi.*x(:)), sin(pi.*x(:)) ]'; %% include rotations of each element rxi = cell2mat( xfmToIdx( squareSymmetry(), [sz sz], 0 )); rxi = rxi'; nRxi = size(rxi,1); nD = size(D, 1); Dbig...
% evaluate measurement point in LUMOS % % Author: Frederic Rudawski % Date: 16.05.2020, last edited: 14.02.2021 function point = point_evaluation(P,surfaces,sky,ground,lambda,nord_angle,TR,pnt,luminaires,DF) % initialitze return value point = []; % point normal %p.normal = [cosd(p.elevation)*cosd(p.azimuth+90) cosd(p....
function [n] = two_norm(dWi,dWo) % % Calculates the Euclidian length of the total weight vector, % i.e. the 2-norm. % % Input: % dWi : Matrix with input-to-hidden gradient % dWo : Matrix with hidden-to-outputs gradient % Output: % n : 2-norm of total gradient n = sqrt( sum(s...
function setFigureForPrinting(h) width=3.5; height=3.5; %set(gcf,'InvertHardcopy','on'); set(h,'PaperUnits', 'inches'); papersize = get(h, 'PaperSize'); left = (papersize(1)- width)/2; bottom = (papersize(2)- height)/2; myfiguresize = [left, bottom, width, height]; set(h,'PaperPosition',...
%% Part A clear all;close all; clc; % Parameters f0 = 5*10^6; fs = 100*10^6; c = 1540; % Wavelength lamda = c/f0; % Axial Resolution deltaX = 0.5*(c/f0); % Reading RF-line data and determining length load US_Lab_SectionA_RF_Data; MLength = length(rf_line_A); % Relationship deltaT = 1/(2*fs); t = deltaT ...
%% MasterControlUpdatedEventData % EventData class for handling master control updates. classdef MasterControlUpdated < event.EventData properties Enabled logical; end methods function this = MasterControlUpdated(enabled) arguments enabled logical; ...
function [ number spk_stream ] = util_find_spikestream( D ) %UTIL_FIND_SPIKESTREAM Find SPIKE STREAM in the MCS datafile % Return the number and corresponding names of SPIKE STREAMs % Input: % D: Datastrm object % Output: % number: Number of Spike streams % spk_stream: Cell a...
function out = get_freq_from_db(db, r, opt) ensure_opt EEG = recoverEEG(db, r, 'local', 'interp'); % TEMP FIX - remove empty events tp = {EEG.urevent.type}; empt = cellfun(@isempty, tp); EEG.urevent(empt) = []; tp = {EEG.event.type}; empt = cellfun(@isempty, tp); EEG.event(empt) = []; freq = get_freq(EEG, opt); % c...
function[a] = sigmoid(h) %SIGMOID takes vector h and transforms it into a sigmoid in range (0,1) a = 1 ./ (1 + exp(-h)); end
% % Copyright 2016 MathWorks, Inc % function results = mapcarriertocountusingds(input) tbl = input{1}; intermKeys = tbl.UniqueCarrier; [intermKeys, ~, idx] = unique(intermKeys); intermValues = num2cell(accumarray(idx, ones(size(idx)))); results = cellfun( @(x,y) {x,y} , intermKeys, intermValues,'Uni...
num = [0 0 0 108 48667] den = [0 480 14840 181560 22580] %cálculo de polos y ceros zeros = roots (num) polos = roots (den) %polos = pole(funciontrans) %mismo cálculo que la fila anterior funciontrans = tf(num,den) %función de transferencia zpk(funciontrans) %continuouns-time transfer function damp(funciontrans) %cont...
[J meta] = readMetaImage('headRealistic.mhd'); origin = -(meta.DimSize-1)/2 .* meta.ElementSpacing; figure; imagesc(I'), colormap gray; axis image; factors = [2 2]; meta.DimSize = size(J) .* factors; meta.ElementSpacing = meta.ElementSpacing ./ factors; I = imresize(J, meta.DimSize,'nearest'); fprintf('Painting ti...
function area = area_trapecio(mem) areas=zeros(3,1); if mem(1) != mem(2) %área del triángulo base por altura sobre 2 areas(1)=(mem(2)-mem(1))/2; endif if mem(2) != mem(3) %área del triángulo base por altura sobre 2 areas(2)=mem(3)-mem(2); endif if mem(3) != mem(4) ...
figure; clear;clc; q_array=[30,60,40];%指定起止位置 t_array=[0,2,4];%指定起止时间 v_array=[20,30,20];%指定起止速度 a_array=[2,4,2];%指定起止加速度 t=t_array(1);q=q_array(1);v=v_array(1);a=a_array(1);%初始状态 for i=1:1:length(q_array)-1 %每一段规划的时间 T=t_array(i+1)-t_array(i); a0=q_array(i); a1=v_array(i); a2=a_array(i)/2; a3...
clc clear A = [2 -5 3; -1 8 5; 4 -1 7; -1 3 2]; b = [3, 5, -2, 4]'; % QR-factorization on augumented system A, b R = HouseholderQR([A, b]) R = R(1:3,:) % Ta bort sista raden xr = R(:,1:3)\R(:,4) R = [R; 1, 2, 6, 5] % Ny data läggs till R = QRUpdateRow(R) % Uppdatera R, bara...
% He Feng % EE 440 Final Project % Emboss Effect function K = Emboss(f0) % Determine the input image size. image_size = size(f0); dimension = numel(image_size); % If it is a color image, change it to a RGB image. if dimension == 3 f0 = rgb2gray(f0); end % Add multiplicative noise with variance 0.01...
% Run gradient descent: % Compute theta theta = gradientDescent(X, y, theta, alpha, iterations); % Print theta to screen % Display gradient descent's result fprintf('Theta computed from gradient descent:\n%f,\n%f',theta(1),theta(2)) % Plot the linear fit hold on; % keep previous plot visible plot(X(:,2), X*theta, '-'...
function [consistent, kappa] = checkLassoSignConsistency(Sigma, w) % Sigma is a covariance matrix, w is a dx1 weight vector % Let J be the relevant variables, Jc be the irrelevant % The data generator is sign consistent iff % ||(S_{J^c,J})*(S_{J,J}^-1)*sign(W_J)||_inf <= 1 rel = find(abs(w) > 0); irrel = find(w...
function uq_print_uq_default_input( module, varargin) % UQ_PRINT_UQ_DEFAULT_INPUT prints out information about an input object %% Parameters Options.MaxStrLength = 20; Options.Ndigits = 3; Options.ColMaxWidth = 30; %% Consistency checks if ~strcmp(module.Type, 'uq_default_input') error('uq_print_uq_default_input ...
function [xhat_new,P_new] = kalman_filter(A,C,R,Q,P,xhat,y) %KALMAN_FILTER Summary of this function goes here % Detailed explanation goes here x_step = A*xhat; P_step = A*P*A'+Q; Kk = P_step*C'*inv(C*P_step*C' + R); xhat_new = x_step + Kk*(y - C*x_step); m = size(Kk*C,1); P_new = (eye(m) ...
close all clc clear all num_files = size(dir('../workspace/real flights/'),1); for i = 3 : num_files workspace = dir('../workspace/real flights/'); filename = ['../workspace/real flights/' workspace(i).name]; load(filename); figure; printing_workspace(area, obstPoints, minimumPath...
clear all; close all; clc % here's part from class % load data ... % do wavelets .. % take svd ... data = [5+ 2*randn(32*32, 80), .1*randn(32*32, 80)]; [u,s,v] = svd(data,0); % *** so replace above with the real cat and dog data *** % set up xdog=v(1:80,2:4); xcat=v(81:160,2:4); xtrain=[xdog(1:50,:);xcat(1:50,:)...
function prob = ProbLink(Rs,Rc,Ri,link) % link = [sen com] prob = double(0.0); s = Rs(link(1)); ii = Ri(link(1),link(2)); c = Rc(link(2)); prob = s*ii*c; return
function git( varargin) % Wrapper function for calling git command. % First, set default path for git. On Windows, we assume git is % installed under CYGWIN. On UNIX, we assume git is in the path. if ispc gitcom = 'c:/cygwin/bin/git'; else gitcom = 'git'; end buf = char(zeros(1,1000)); n = length(gitcom) + ...
f = @(x) 100 * (x(2) - x(1)^2)^2 + (1 - x(1))^2; g1 = @(x) -400 * (x(2) - x(1)^2) * x(1) - 2 * (1 - x(1)); g2 = @(x) 200 * (x(2) - x(1)^2); x0 = [0, 0]; eps = 10 ^ (-5); min = newton(f, g1, g2, x0, eps) function result = newton(f, g1, g2, x0, eps) result = x0; grad = @(x)[g1(x), g2(x)]; h11 = @(x) 1200 * x(1)^2 ...
% % Usage: Z =mexCalcXY(X,Y); % % Name: mexCalcXY % % Description: Compute Z=XY using the BLAS library used by SPAMS. % % Inputs: X: double m x n matrix % Y: double n x p matrix % % Output: Z: double m x p matrix % % Author: Julien Mairal, 2009
% % J.T. Ouwerling <j.t.ouwerling@student.rug.nl>, University of Groningen % Date created: June 10, 2015 % % This file is the imperative program which is connects the dic % parts together. It has several sections, which are clearly indicated % in the code. % % 1. Instruction messages and configuration input ...
% This is the example starting on Slide 4 of lecture 27 n = 4; % number of states T = 3; % final time increment % costs % u 1 2 3 4 states gxu = [ Inf, 2, 6, Inf; % 1 Inf, Inf, 3, 8; % 2 Inf, 1, Inf, 4; % 3 Inf, Inf, Inf, 0 ]; % 4 % final co...
clear all; load Ho11.mat; load delEc.mat; load n.mat; D=Ho11+delEC; clear H11 delEC; %D=sparse(D); [Cmn,E]=eigs(D,5,2.8); %save EigenVector.mat Cmn; %save EigenEnergy.mat E; E=real(diag(E)); [E,index]=sort(E); E index save index.mat index;
function info = readJSON(fname) fid = fopen(fname); raw = fread(fid,inf); str = char(raw'); fclose(fid); info = jsondecode(str); end
function handle = face2DVisualise(vals, patches) % FACEPATCHVISUALISE For updateing a face representation of 3-D data. global PATCHINFO PATCHINFO.moveMode = 0; numMark = size(vals, 2)/3; valsx = vals(1, 1:numMark); valsy = vals(1, numMark+1:2*numMark); valsz = vals(1, 2*numMark+1:3*numMark); PATCHINFO.points = [val...
% Defines the minimum and maximum lateral limits (i.e., the overtaking window and the critical zone). % Initialise data %% sampling interval task.s=linspace(0,task.E.horizon,task.N)'; %[m] relative distance vector task.ds=task.s(2)-task.s(1); %[m] samp...
classdef List < handle properties (Constant) DELIMITER = '`'; SUFFIX_PATTERN = '\w+'; LIST_PATTERN = [ ... '!list\(\s*(', ... parser.List.DELIMITER, ... parser.List.SUFFIX_PATTERN, ... ')\s*\)', ... ]; WRAP = 75; end ...
function dist = calculateDistance( A, B ) dist = sqrt((A.x - B.x)^2 + (A.y - B.y)^2); end
function thr = calthreshold(coefs,str) meants = mean(coefs); medts = median(coefs); switch str case 'global_mean' thr = mean(meants); case 'global_sdmed' thr = std(medts); case 'local_mean' thr = mean(meants(end-20:end));%+std(meants(end-20:end)); case 'local_med' thr = s...
function H = irpHough(B, r) % H = irpHough(B, r) % Berechnet einen 2d Hough-Raum 'H' für Kreise mit Radius 'r' mit Hilfe % eines binarisierten Bildes 'B'. % % Parameter: % 'B' Binarisiertes Bild % 'r' Radius der Kreise % % Rückgabewerte: % 'H' 2d Hough-Raum [numrow, numco...
function ret = wrap_boundary_with_edgetaper(img, wrapped_size, psf_size, taper_kernel_sigma) img2 = wrap_boundary_liu(img, wrapped_size); taper_kernel_size = max(psf_size)*2+1; if ~exist('taper_kernel_sigma', 'var') taper_kernel_sigma = taper_kernel_size / 6; end taper_kern...
function [ini]=genera_ini (p,ndata,dmax,nite,nstatesmax) ruta0=cd; rutapro='P:\BrainDynamicsLab\Software\HSMM\Software HSMM\hsmm31Mar2020'; cd(rutapro) for kstate=2:nstatesmax for j=1:nite ini{kstate}(j,:)=util.unirndseq(ndata-p,kstate,dmax); end end cd(ruta0) end
% simulate random data with power-law eigenspectra and evaluate % cross-validated PCA analysis function suppfig_simdata(matroot) load(fullfile(matroot,'simSpectrum.mat')); %% close all; default_figure([1 1 6 2]); %% xh = .65; yh = .65; clf; i=0; cm = colormap('winter'); cm = cm(1:12:end,:); i=i+1; hs{i}=my_subplot(1,...
% Load data path2data = '~/research/data/processed/webcritech/'; load([path2data 'webcritechHar.mat']); load([path2data 'webcritechStationLoc.mat']); load([path2data 'webcritechSumHar.mat']); % Remove 0 component har2 = har(:,:,2:4); % Sum constants for k=length(ids) sumHar(k,1:70) = sqrt(har2(k,:,2).^2+har2(k,:...
%% operation registers Opr_Mode = hex2dec('3D'); AccMag_mode = bin2dec('0100'); Config_mode = bin2dec('0000'); NDOF_mode = bin2dec('1100'); unit_sel = hex2dec('3B'); %% data registers LSB_Ax_r = hex2dec('08'); MSB_Ax_r = hex2dec('09'); LSB_Ay_r = hex2dec('0A'); MSB_Ay_r = hex2dec('0B'); LSB_Az_r = hex2dec('0C'); M...
%%Read the data into a 3D array Raw = dlmread(['Raw0.txt'],';'); Raw = reshape(Raw',22,6,size(Raw,1)/6); Raw = permute(Raw,[2,1,3]); %Raw(1,:,:) = Raw(1,:,:) - 40; Filtered = dlmread(['Filtered0.txt'],';'); Filtered = reshape(Filtered',22,6,size(Filtered,1)/6); Filtered = permute(Filtered,[2,1,3]); Predicted = dlmr...
classdef Location < matlab.mixin.Copyable %LOCATION - ECEF Location properties ecef = [0 0 0]; %ECEF X,Y,Z (m) spheroid=wgs84Ellipsoid('meters'); %Default to wgs84 end methods function obj=Location(lat,lon,alt) % Location Co...
function [ RRMSE_Original, RRMSE_Achieved,Current_Iterative_Image,objective_array ] =myMainScript(alpha,gamma,prior_type) load('../data/assignmentImageReconstructionPhantom'); %initialization %added kSpaceData = imageKspaceData; mask = imageKspaceMask; % InputImage = kSpaceData; Current_Iterative_Image = ifft2(...
function [yPredicted,yTrainPredicted,output,classifier] = apply_classifier_gau(training,testing,varargin) %TEST_CLASSIFIER extract features that will be used later by the %classifier % YPREDICTED = TEST_CLASSIFIER(TRAINING,TESTING). training and testing % are structures where the temporal features(training.featur...
function [BL,BM,BS] = getBL(i,growth_raw_mat,BLprev,BMprev,BSprev) BLgrowth_raw = growth_raw_mat(1,i); BMgrowth_raw = growth_raw_mat(2,i); BSgrowth_raw = growth_raw_mat(3,i); BLGrowth = BLgrowth_raw^10; % Raise to the power of 10 b/c this is yearly, and we are dealing w 10-year gap BM...
%{ Jacob Leonard ITP 168 - Fall 2015 jaleonar@usc.edu Revision History Date Changes Programmer ------------------------------------------------- 10/7/2015 Original Jacob Leonard %} A = importdata('matrix.txt',','); rows = size(A,1); columns = size(A,2); B = zeros(1,rows*columns...
for i = 1:4 [pc, d, ntrial] = getPerf(trialInfo(i).correct,trialInfo(i).response,trialInfo(i).targettype); fprintf('pc: %2.2f dprime: %2.2f ntrial: %1.0f \n', pc, d, ntrial) end
%clear; %close all; clc; clearvars -except 'Robot_A_inc_trajectories' 'Robot_B_inc_trajectories' 'Robot_A_inc_cov' 'Robot_B_inc_cov'; scenario = 'mr_centralized_laser'; rsults_folder = 'no_lc_no_mr'; path_to_results = ['..' filesep 'mrbsp_scenarios' filesep 'scenarios' filesep scenario filesep... 'results' filesep...
function al_predictionSpot(taskParam) %AL_PREDICTIONSPOT This function prints the prediction spot % % Input % taskParam: structure containing task parameters % % Output % ~ % Compute coordinates of prediction spot xPredS = ((taskParam.circle.rotationRad-5) * sin(taskParam.circle.rotAngle)); yPredS = (...
function print_mat(A) for i = 1:size(A, 1) for j = 1:size(A,2) fprintf('%f,', A(i,j)); end fprintf('\n'); end end
%% Loading close all; clc; load('201401020600_WLS200S-17_data_.mat'); ts_VAD = data.ts; az_c_VAD = data.az_c; az_c_VAD = az_c_VAD + 180; rs_VAD = data.rs; el_VAD = data.el; rg_VAD = data.rg; x_VAD = data.x; y_VAD = data.y; z_VAD = data.z; cnr_VAD = data.cnr; %% Step 1 % Write Data to one double struct data_VAD = [t...
function producebufop() Ei=35 % scattering plane has to be a-b plane (redefine lattice directions if necessary) % (h,2h,l) scattering zone lowerA3=-80;upperA3=100; Qord1=[0.5;+1.0;0]; % first entry is (m,0,0), second is (0,0,1) % Qord1=[0.5;0;0]; u=1; ki=sqrt(Ei/2.072);kf=sqrt(Ei/2.072); % deff=sqrt(1/((1/7....
% Generate heart rate variability timeine from QRS time locations % Author: George Tanev % Input: % - qrs_time: timeline of detected QRS locations % - f_resample: resampling frequency to have a uniform time between HRV % samples % - fs: sampling frequency of ECG signal % Output: % - HRV: computed from difference o...
clear ephonefname = 'e:\spezio\matlab\scripts\tdt\Xstim\HRTFfilts\901etbks.imp'; Fs = 30000; % Initialize Application and get AP2 and XBUS locks if(S232('S2init', 0, 'INIT_PRIMARY', 1000) == 0) disp('Cannot initialize a secondary process') return; end if(S232('APlock', 100, 0) == 0) disp('Cannot acqu...
function [vd, ve] = cinematica_inversa(v, w) vd = (2*v+0.35*w)/2; %vd=(2v+Lw)/2 ve = (2*v-0.35w)/2; %ve=(2v-Lw)/2 end
function main() close all; % Initialize variables p=8; N=3; min_value = -3.5; max_value = 3.5; load('source.mat') x_length = length(x); R = zeros(p,p); r = zeros(p,1); % Calculate array R and vector r for i=1:p sum_r=0; for n=p+1:x_length sum_r = sum_r + x(n)*x(n-i); end r(i) = sum_r * 1/(x_le...
% % lagrangeInterpolation(points, debug=false) % % By: Christopher Smith % % Usage: f = lagrangeInterpolation([0, 1; 2,3; 4,5]) % % Description: % % Generates a polynomial fit for the input points % using the Lagrange Interpolation method. % % Arguments: % % points: A n x 2 matrix of x,y pairs (x...
tradetime = zeros(1); hurst_yield = zeros(1); object_money = zeros(1); object_yield = zeros(1); for i = 1:lastcol tradetime(i) = max(buy{1,i},sell{1,i}); hurst_yield(i) = (money(i)-10000)/10000; object_money(i) = 10000/in1(1)*in1(find(time == tradetime(i))); object_yield(i) = (object_money(i)-10000)/100...
clear; close all; DIR = './'; FILENAME = 'vaiueo2d.wav'; [y,fs1] = audioread([DIR FILENAME]); sound(y,fs1); %% new EPD % [staPT, endPT] = EPD(y,fs1,1) staPT = 2361; endPT = 16181 y1=y(staPT:endPT); time6=(endPT-staPT)/fs1; audiowrite('./clip.wav',y1,fs1); fs = 16000; y = resample(y1,fs,fs1); framelen = 0.092; % se...
% Given appropriate temperature gradients in wda, estimate volume avg Kt, Jq % [wda] = process_wda_estimate(chi, chi_wda) % % Inputs: % chi : nominally chi structure to process chi. % Alternatively can provide 1 sec averaged T to estimate just the ... % mean sorted gradient % ...
t = [0:0.01:0.98]; y1 = sin(2*pi*4*t) y2 = cos(2*pi*4*t) plot(t, y1) hold on; plot(t, y2, 'r') xlabel('sine') ylabel('cosine') legend('sin', 'cos') title('plot example') print -dpng 'testPlot.png'
%IN PROGRESS % Initial data loading from % Feature selection and classification for EMG data % Sam Michalka 6/30/2020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%% File name setting %%...
%read in images %I and I2 were taken by me I = imread("myimgA.jpg"); I2 = imread("myimgB.jpg"); I3 = imread("snow1.jpg"); I4 = imread("venice1.jpg"); %apply img4 function to images. img4 function explained below. sep = img4(I); sep2 = img4(I2); sep3 = img4(I3); sep4 = img4(I4); %show images before and after function ...
% s function setup( band ) % Make sure SMURF_EPICS_ROOT is pointed at the demo for all following % matlab commands; otherwise someone doing software testing could screw up % testing with the blade connected to the cryostat. setenv('SMURF_EPICS_ROOT','demo_epics'); if( ~exist('band', 'var' ) ) band...
% Map bits following 128-QAM constellation function [ data_map ] = QAM128( data ) f=1; data_map = zeros(1, length(data)/7); %64 IV for v=1:7:length(data)-6 if f<=length(data)/7 if data(v)==0 && data(v+1)==0 && data(v+2)==0 && data(v+3)==0 if data(v+4)==1 && data(v+5)==0 && data(v+6)==0 ...
function im1 = enc_edgy(im,val) [row,col]=size(im); for i = 1:1:row for j = 1:1:col temp = im((i),(j)); im((i),(j)) = pix_mod(temp,val(i,j)); end end im1 = im; end
clear % Make the data. Fs = 500; % Example sampling frequency. T = 1000; % Example duration of data. N = T*Fs; % Total number of data point. % Noise data. d1 = randn(N,1); d2 = randn(N,1); d3 = randn(N,1); d4 = rand...
%% this code calculates SINtheta %% Definition % % alpha = [ 0 -5 5 -10 10 ] % Port Vector p = [ x y ] % % Drag = [P*sin(thet) P*sin(thet) P*sin(thet) P*sin(thet) P*sin(thet) ]...
function dd = day_diff(month1,day1,month2,day2) if(sumDay(month1,day1)==-1 || sumDay(month2,day2)==-1) dd=-1; else dd = abs(sumDay(month1,day1)-sumDay(month2,day2)); end end function sum=sumDay(month,day) if(day-round(day)~=0) sum=-1; return; end t=size(month); ...
function [im] = gen_gam_image(num_rows, num_cols, center_set, hsize_gauss) if mod(hsize_gauss,2) == 0 hsize_gauss = hsize_gauss + 1; end sigma = hsize_gauss/(1.96*1.5); h_gauss = fspecial('gauss', hsize_gauss, sigma); h_gauss = bsxfun(@rdivide, h_gauss, max(h_gauss(:))); % center_set = (N,2) center matrix (c_cen...
W = zeros(2,1000); for i = 1:1000 W(1,i) = normrnd(0,1); W(2,i) = normrnd(0,1); end figure(1) plot(W(1,:),W(2,:),'.') axis('equal') R_x = [2 -1.2 -1.2 1]; [eigV eigs] = eig(R_x); X_hat = eigs.^(1/2)*W; figure(2) plot(X_hat(1,:),X_hat(2,:),'.') axis('equal') X_i = eigV * X_hat; figure...
function Cx(varargin) % Global variables [~, ~, ~, S0, opts] = util.pre(varargin{:}); % Analysis variables stdv = opts.std; NS = opts.samples; every = opts.stepevery; Ms = opts.mach; Kns = opts.knudsen; % Random inputs inputs = [uq.RandomGaussian(1, stdv, true) , ... % for CL uq.RandomGaussian(1,...
function connected = checkConnectivity(coords, lat, composition) % USPEX 8.2.7 % checks if the cluster is connected (threshold - good_bonds) global ORG_STRUC N = size(coords,1); vect = zeros(1,3); R_val = zeros(1,length(ORG_STRUC.atomType)); for i = 1 : length(ORG_STRUC.atomType) s = covalentRadius(ORG_STRUC.atomT...
function [boutonrevised, bouton] = mainwithtiffboutonthresholding(varargin); %Set All Global Parameters global CellThresholdParameter; global CellconnectivitySize; global CellSizeLengthParameter; global CellSizeDistance; global CellNumberofImages; global GaussianFilterRadius; global ConnectivitySize; global Acceptanc...
%% Read the on/off status of a pump (by simple name) % % level = ppGetPumpOnOff(pointTag) % % Returns: % level Value read from OPC as double % % Examples: % level = ppGetPumpSpeed("bmt.cuft"); function value = ppGetPumpSpeed(pointTag, recordCount) arguments pointTag string recordCo...
function y = horzcat(varargin) % Horizontal concatenation for sym arrays. % C = HORZCAT(A, B, ...) horizontally concatenates the sym arrays A, % B, ... . For matrices, all inputs must have the same number of rows. For % N-D arrays, all inputs must have the same sizes except in the second % ...
function ipl = micron2ipl(xyz, source) % MICRON2IPL % % Syntax: % ipl = micron2ipl(xyz, source) % % Inputs: % xyz Locations (N x 3) % source Volume name or abbreviation % % Output: % ipl ipl depth of each location (in %) % % S...
% Curve Fit Each FRF to Find System Parameters and then Compare Fitted % Function to Raw Data. function rot_q7() %% PRIOR KNOWNS: Jdisk = 0.0031; % [kgm^2] Mean of Disk Inertia Determined in Lab 1 k1 = mean([3.69 2.81]); % [Nm/rad] Mean First Spring Stiffness Determined in Lab 1 c1 = mean([0.0619 0.0477...
function [amplat, avgamplat] = lk_findwndw(reliability,cfg) clear lat amplat for iTI = 1:floor(cfg.trialnumber/cfg.trialincr) iTI for ireg = 1:size(cfg.regs,2) for isub = 1:size(cfg.file.subs,1) %These are the arrays of peak locations and peak amplitudes that are nea...
%plots pupil beta time course (using pupil area, not pupil area change) %featuring correlations with surprise @ each time point, input from R %produces Fig 4E %input plin, betas, stes, adj_p (q) into Table S3 clear;close all;[base,root]=load_root(); plotdefs2;set(0,'DefaultFigureWindowStyle','normal');set(0,'DefaultAx...
function [ div ] = divergence( u,v ) %DIVERGENCE Summary of this function goes here % Detailed explanation goes here div = zeros(size(u,1),size(u,2)); for i = 2:size(u,1)-1 for j = 2:size(v,1)-1 div(i,j)=(u(i,j)-u(i,j-1)+u(i-1,j)-u(i-1,j-1)+v(i,j)-v(i-1,j)+v(i,j-1)-v(i-1,j-1))/2; end end end
function img_Contours = DrawContoursAroundSegments(img, klabels) dx = [-1, -1, 0, 1, 1, 1, 0, -1]; dy = [0, -1, -1, -1, 0, 1, 1, 1]; [m_height, m_width, m_channel] = size(img); img_Contours = uint8(zeros(m_height, m_width)); mainindex = 0; cind = 0; for j = 1: m_height for k = 1: m_width np = 0; f...
function [] = wavelengthSweep(fn,wavelength, exposure , vid, num_meas, COMmono, xps, framesPerTrigger) %WAVELENGTHSWEEP Summary of this function goes here % fn filename string path to .h5 fil.e % WAVELENGTH double wavelength of exposure [nm] % EXPOSURE double exposure time for this wavelength [sec] % PSG array...
classdef Scale < dagnn.ElementWise properties size hasBias = true end methods function outputs = forward(obj, inputs, params) args = horzcat(inputs, params) ; outputs{1} = bsxfun(@times, args{1}, args{2}) ; if obj.hasBias outputs{1} = bsxfun(@plus, outputs{1}, args{3}) ; ...
clear clc close all % dy(t) = a*y(t) + b*y(t-\tau) % stability analysis: Lambert function, Chebyshev collocation, % Monte Carlo, and Polynomial chaos tau = 1; alist = -2:.2:1; blist = -4:0.5:3; al = length(alist); bl = length(blist); rho = zeros(al, bl); chebeg = zeros(al, bl); N = 100; ij = 0; k = 0; for ia = 1:al ...
function txtObj = addTypeToAxes(ax,T,params,txtLoc) %ADDTYPETOAXES Add label to axes indicating 'Solenoid (only)', 'ICMS (only)', or 'Solenoid+ICMS' in a principled way % % txtObj = utils.addTypeToAxes(ax,T,params); % txtObj = utils.addTypeToAxes(ax,T,params,txtLoc); % % Inputs % ax - Axes handle to add to % ...
for n = 1:12 figure freqz(DirAC_struct.decorFilt(:,n)); end
function [cJ2J,cJ1Jp1,cJ2Jp1,cJ2Jp2] = generate_D_coupling_old(maxJ) cJ2J=zeros([maxJ+1 2*maxJ+1 2*maxJ+1]); % <J,M,K|2,0,0|J,M,K> cJ1Jp1=zeros([maxJ 2*maxJ+1 2*maxJ+1]); % <J,M,K|1,0,0|J+1,M,K> cJ2Jp1=zeros([maxJ 2*maxJ+1 2*maxJ+1]); % <J,M,K|2,0,0|J+1,M,K> cJ2Jp2=zeros([maxJ-1 2*maxJ+1 2*maxJ+1]); % <J,M,K|2,0,...
% prepare audio and plots %source: %http://stackoverflow.com/questions/6681063/programming-in-matlab-how-to-process-in-real-time its=25; % Number of time blocks in each signal Fs = 16*1024; % sampling frequency in Hz T = 0.5; % length of one time block in sec t = (0:(1/Fs):...
%% leung's algo to remolve person I0 = (imread('test_im31.jpg')); I1 = rgb2gray(I0); Win_size = 9; % window size, odd integer such as 5,9,11... Element = [0 0 0; 1 1 0; 0 1 0]; % the element for dilation % change all 0 pixels to 1 [r,c] = find(I1 == 0); [m,n] = size(r); for i = 1 : m ...
function out = Process_Slide_2_Tx_by_Day(DashBoard,end_Time, Decision, Reason, Class, Pending, fontsize) start_Time = '12/31/2019 00:00'; TimeCreatedSinceDeploy = datenum(DashBoard.TS_Created) - datenum(start_Time); Departure_UTC_SinceDeploy = datenum(DashBoard.Departure_UTC) - datenum(s...
% Bai 6: a. x(n) = -2u(n + 1) - 3?(2-n) clc; b = [-2 0 3 3]; a = [1 1 0 0]; [delta,n1] = impseq(0,0,9); xb1 = filter(b,a,delta); [u,n2] = stepseq(0,0,9); xb2 = (((n2-3).*((1/4).^(n2-2))).*cos((pi/2)*(n2-1))).*u; error = max(abs(xb1-xb2)); Hf_1 = figure; set(Hf_1,'NumberTitle','off','Name','B6.a'); [Hz,Hp,Hl] = zplan...
classdef NeuralNetwork < handle & NetworkLayer properties feadim; numunits; weights; %feadim*numunits biases; %numunits*1 l2_C = 1e-4; init_weight = 1e-2; dweights; dbiases; end metho...