text stringlengths 8 6.12M |
|---|
% Returns a quaternion
function obj = DQCircleProduct(aHat, bHat)
obj = Quaternion;
obj = QuatDotProduct(aHat.realpart, bHat.realpart) + QuatDotProduct(aHat.dualpart, bHat.dualpart);
%obj = Dualquaternion(QuatDotProduct(aHat.realpart, bHat.realpart), QuatDotProduct(aHat.dualpart, bHat.dualpart))
... |
function tst_perm01()
mm=[39,74,14,85; 12,9,28,1; 27,20,53,7];
mm(1,:)
%size(mm,1)
%size(mm,2)
%[1:size(mm,1)]
%repmat([1,2,3],1,4)
repmat([1:size(mm,1)],1,size(mm,2))
mmm=find(all(diff(sort(nchoosek(repmat([1:size(mm,1)],1,size(mm,2)),size(mm,1)),2),1,2),2));
xx=nchoosek(mm(:)',size(mm,1));
xxx=xx(mmm,:);
[mmm]... |
function [ r_3D_ef, lat, long ] = cart2efix( r_3D_sf, th0 )
%CART2EFIX Rotates space-fixed system to earth-fixed system
%
rad2deg = @(x) (x*180)/pi;
R3 = @ (x) [cos(x),sin(x),0;-sin(x),cos(x),0;0,0,1];
r_3D_ef(1).r_vec = zeros(3,length(th0));
r_3D_ef(2).r_vec = zeros(3,length(th0));
r_3D_ef(3).r_vec = zeros(3,length(... |
function [labels]=myregion_merging(image,init_labels,opt)
labels = init_labels ;
%
% Calculate region stats
% Stats are: region id, size, mean, standard deviation (one region per row)
%
sz_mn_sd = [] ;
for c=1:max(max(init_labels));
sz_mn_sd(c,1) = c ;
[sz_mn_sd(c,2),sz_mn_sd(c,3),sz_mn_sd(c,4),sz_mn_sd(c,5)] =... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% test_aniso_contour_completion.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
path(path, 'data/');
name = 'curves_b';
M = load_image(name);
M = rescale(M);
n = size(M,1);
m = size(M,2);
epsilon = 0;
%% compute struct... |
function [Q, R] = Householder(A)
% A = matricea sistemului
% Q = matricea ortogonala
% R = matricea superior triunghiulara
% Algoritmul este cel din curs/laborator/disponibil pe site-ul de curs
[m n] = size(A);
Q = eye(m);
for p = 1 : min(m - 1, n)
sigma = -norm(A(p : m, p));
if A(p, p) < 0
sigma = -... |
% laser edits MB 10-23-18
VirMEn_Def;
vr.DAQ_BOARD = 'Dev1';
try
daqhwinfo
DAQ_MODE = 'legacy'
catch
DAQ_MODE = 'session'
end
% 5000 -> 7000 2/3/2015 HRK
vr.AO_SR = 1000; % 7000->1000 5/19/2015 HRK now I don't use sound from this ao
vr.finalPathname = VIRMEN_DATA_DIR;
vr.pathname = VIRMEN_DATA_DIR;
daq_f... |
%% %%%%%%%%%%%%%%%%%%%%%%%%%
%%% KEYBOARD INTERNAL %%%
%%% MEASUREMENTS %%%
%%%%%%%%%%%%%%%%%%%%%%%%%
%{
World Coordinate System Origin (O) is fixed where keyboard's keys are
connected to the plastic command board.
Z-axis grows through keys LENght.
... |
function homework4()
% Sean Burke
% Econometics 2
% Homework 4
% load FTSE100 data
format shortG;
alphaSig = .05;
adjClose = xlsread('spdaily.xlsx','G:G');
returns = flipud(diff(log(flipud(adjClose))));
% Use MLE to get thetaHat parameters
thetaHat = f... |
function [ output_args ] = untitled3( input_args )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
close all;
%Leemos nuestra imagen con el proceso necesario para manipularla
ImOr=double(rgb2gray(imread('rm_rodilla.jpg')))/255;
%Creamos nuestras dos matrices para detectar bordes en el ... |
function [dat,key,state]=EMGlevelOR(varargin);
% simple EEG electrode quality check for cap fitting
%
% []=capFitting(varargin)
%
%Options:
% updateInterval- [int] how often to redraw the electrode quality display in seconds (.5)
% capFile - [str] file to use to get electrode positions from ('1010')
% override... |
function ans = hypotenuse(a,b)
sqrt(a.^2+b.^2);
end |
function callbackChangeDSMButton(obj, eventdata,handles)
% CALLBACKCHANGESDMBUTTON
%
% DESCRIPTION:
%
%
% SYNTAX:
%
%
% INPUTS:
%
%
% OUTPUTS:
%
%
% COMMENTS:
%
%
%@
% Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
%
% Permission is hereby granted, free of charge, to any person obtainin... |
function string = tag2str(i)
%TAG2STR4 like int2str, but format integer (from 0 to 9999) with a constant length of 4
%
% Prepared by Benoit Spinewine
if i<10
string = ['000' int2str(i)];
elseif i<100
string = ['00' int2str(i)];
elseif i<1000
string = ['0' int2str(i)];
else
string = int2str(i);
end; |
function[DataOut,biterror]= OFDMRX()
% function biterror = OFDMRX(B,N,Tu,FS,fc,M,MAX_SN,Data_par)
%The function used to demodulate the OFDM-signal created by the OFDMTX.m
load OFDMspace.mat;
load MAX_SN.mat;
Fs_sound=[];
% B = B; %Bandwidth
% N = N; %Number of carriers
% Tu = Tu; %Symbol length
% FS=FS; %Sampling freq
... |
function res = dwdx(x)
global gamma sigma;
res = -sigma*gamma*x/(1+norm(x)^2)^(sigma+1);
end
|
function sim = compute_meanERRT_v1(sim)
for sn = 1:length(sim)
for i = 1:length(sim(sn).dR)
if sim(sn).h(i) == 1
sim(sn).z(i,1) = sim(sn).z1_0 + sim(sn).z1_dR * sim(sn).dR(i) + sim(sn).z1_dI * sim(sn).dI(i);
sim(sn).bias(i,1) = sim(sn).x1_0 + sim(sn).x1_dR * sim(sn).... |
function ee_kin = forward_kin(l1,l2,theta1,theta2)
%FORWARD_KIN
% EE_KIN = FORWARD_KIN(L1,L2,THETA1,THETA2)
% This function was generated by the Symbolic Math Toolbox version 7.1.
% 10-Jan-2017 14:06:37
t2 = theta1+theta2;
ee_kin = [l2.*cos(t2)+l1.*cos(theta1);l2.*sin(t2)+l1.*sin(theta1);0.0];
|
function fig = showPCAreconstruction(D,k,npc)
%SHOWPCARECONSTRUCTION Make bar graph of channelwise error from PCA reconstruction
%
% fig = kal.showPCAreconstruction(D,k,npc);
%
% Inputs
% D - Table
% k - Index into table row
% npc - (default is all PCs) | scalar (number of PCs to use in
% recons... |
%ILDTest: the GUI for ILD tests
%*******************************************************************************
% The Graphical User Interface
%*******************************************************************************
XStimParams.reset_flag = 0;
F.pos_incr = 20;
F.tot_ht = 0;
F.int_ht = 20;
%Figure... |
function [ data ] = getDataNoTiles( obj, varargin )
%GETDATANOTILES Retrieves image data when the input is not tiled
% This method retrieves the image data (or a subset of it) in the case of
% images that do not contain multiple tiles. The user can specify subset
% of the images by specifying the dimension and th... |
clc
clear all
%%code for
%%answer 2 part a HW 5
%%rewriting the equations derived in the last question
%%every row has one alpha value
alpha1 = -30;
alpha2 = -90;
alpha3 = 0;
alpha4 = -90;
alpha5 = 0;
%%link lengths
l1 = 1.5;
l2 = 1;
l3 = 0.5;
%%configuration q
theta1 = 150;
theta2 = 45;
thet... |
function [bin,xx,qcf]=en_sub2d_scan(sb,delta0)
len=length(sb);
[qcf,binq,qctr]=quant4image_sb(sb,delta0); %qctr %qctr=0 corresponds to "quantEVEN.m"
if binq(1)>0
if qctr==1
sn=zeros(1,len);
cf0=abs(qcf);
lensn=0;
for ia=1:len
if qcf(ia)>0
lensn=lensn+1;
s... |
function vec_out = ind2vec(index,N)
vec_out = zeros([1,N]);
vec_out(index) = 1;
end |
function [D_store,V] = GaussianBasis_Coef_Cons(S,u,b,Decay,sigma)
% S : signal of size (nx,ny,nz,n)
% u : sample gradient directions
% b : b values
%%%
%%%%%%%% parameters %%%%%%%%%%%%%%%%%%%
if(nargin<5)
sigma=[0.0015 0.0008];
end
% CondNumber=1e7;
%%%%%%%%%%%%%%%%%%%%%%%%%
%%
t = 70*1e-3;
b=b(:);
q = (1/(2*pi))... |
function area = surface_area(FV)
if ~isstruct(FV) || ~isfield(FV,'vertices') || ~isfield(FV,'faces')
error('Not enough fields.');
end
vertexA = FV.vertices(FV.faces(:,1),:);
vertexB = FV.vertices(FV.faces(:,2),:);
vertexC = FV.vertices(FV.faces(:,3),:);
A = vertexA-vertexB;
B = vertexA-vertexC;
C = vertexB-verte... |
function [output] = jianchaciku(input,ecdict)
%JIANCHACIKU 此处显示有关此函数的摘要
% 此处显示详细说明
% 存在返回1,不存在返回0
%ab= size(ecdict);
%a=ab(1);
tic
output=0;
index_zhi=[609,61087,106941,180326,219518,249145,280802,309134,340219,368341,374464,383813,413191,461437,482821,504440,569425,572814,606756,683491,724273,737193,7490... |
function D = compute_nodal_distances( xyz )
% Computes Euclidean distance between all sets of points;
%
% INPUT:
% xyz = 3 x n matrix of points in xyz space
% OUTPUT:
% D = n x n upper triangular matrix of distances between each point;
% D(i,j) indicates distance between node i and j.
n=size(xyz,2);
D=nan(n);
... |
function TDT=TDT_buffers(TDT)
% generic setup for stimulus play specifications for TDT Sys II
% permits nearly any combination of of play/record channel setups
% and an unlimited number of buffers in the play sequence
% with variable combinations of buffer lengths for each channel
% input (a structure):
% TDT.nPlayCha... |
% testVideo LED
% 2019-06-06 AndyP
V = VideoReader('528818-2019-06-18-1.avi');
nF = length(x0);
ix = interp1(time0,frame0,timeOut0,'nearest');
V1 = VideoWriter('newfile.avi','Grayscale AVI');
V1.FrameRate = 48;
open(V1);
for iF=1:nF
F = figure(1); clf;
vid = V.readFrame;
vid = squeeze(vid(:,:,1));
im... |
function results = modelfittingRawIm(modelhandle, betamnToUse, imToUse)
%% Guerilla model fitting
res = 90; % I think?
R = 1;
S = 0.5;
X = (1+res)/2;
Y = (1+res)/2;
D = res/4*sqrt(0.5);
G = 10;
Ns = [.05 .1 .3 .5];
Cs = [.4 .7 .9 .95];
seeds = [];
for p=1:length(Ns)
... |
clear all
close all
root=fullfile(mdf,'stn_rotameter\STN_Rotameter\');
cd(root);
addpath(fullfile(mdf,'matlab_scripts\wjn_toolbox'));
addpath(fullfile(mdf,'stn_rotameter\rotameter_scripts'));
pat=patienten;
fhz=[40 90];
conds='onset';
type='brown';
outname='gamma_brown';
gfiles=ffind('gamma_brown_burst_r*ON*.mat')... |
load_gallery_path = sprintf('%s\\lfw_man5pt_closeset_gallery_%d0k.mat', path, test_iter);
load(load_gallery_path);
gallery = features;
gallery_path = image_path;
load_probe_path = sprintf('%s\\lfw_man5pt_closeset_probe_%d0k.mat', path, test_iter);
load(load_probe_path)
probe = features;
probe_path = image_path;
galle... |
function times = randtest(n,varargin)
nv = length(varargin);
if (nv > 1)
error('too many variables arguments in randtest');
end;
optargs = {100};
if (nv > 0)
optargs = varargin;
end
[printerval] = optargs{:};
if (n < 100), error('n must be >= 100'),end;
times = [0 0];
... |
function [gma] = predict_gm_area(brwt, bvol, collation, area_type)
%function [gma] = predict_gm_area(brwt, bvol)
%
% Predict grey matter volume, based on Rilling & Insel (1999a, 1999b)
%
% Fig 2 (Rilling & Insel, 1999a) reported grey matter area
% for the outer surface, not the true surface area.
% Multiply the area (p... |
function[eigvals] = ammc_jac(u,dx,nev,shft)
% axisymmetric motion by mean curvature
% u_t = u_{xx}/(1 + u_x^2) - 1/u, 0 < x < 10
% with boundary conditions
% u(t, 0) = u(t, 10) = 1
% This purpose of this function is to compute eigenvalues of the Jacobian.
%
% Inputs:
% u: solution vector at some time t,
% dx: ... |
function ax = iePlot(neuron, varargin)
% IEPLOT
%
% Description:
% Renders 2D projection of neuron along with ConvPre, ConvPost and
% RibbonPost synapses marked in red, orange and green, respectively
%
% Syntax:
% ax = iePlot(neuron, varargin)
%
% Input:
% neuron ... |
%% 3.1 Edge Detection
%% a. Load Image
Pc = imread('macritchie.jpg');
% Change Image to grayscale
P = rgb2gray(Pc);
whos P
%% Display the Image
figure;
imshow(P);
title('Original image P in grayscale');
%% b. Create 3x3 horizontal and vertical Sobel masks
sobel_horizontal_mask = [-1 -2 -1; 0 0 0; 1 2 1];
sobel_vertica... |
function [Subject] = run_FSL_Nets(FSLNets_Path , L1precision_Path , PWling_Path , work_dir , group_maps , ts_dir , TR , varnorm , method , RegVal , Fr2z , NetWebFolder , DO_GLM , DesignMatrix , ContrastMatrix)
%%% add
% the following paths according to input setup paths
addpath(FSLNets_Path); % wherever ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Common constants for wav2midi.m and all related functions.
%
% Date: 2.4.2013
% Author: Jan Bednarik
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
close all; clear all; clc;
% PART 2
A = [0.99 0;
0 0.99];
B = [0.001 0
0 0.001];
C = [0.5 0.5;
1 -1];
D = [0 0;
0 0];
ts = 0.05;
t = 0:ts:10;
u = [heaviside(t); heaviside(t)];
sys = ss(A,B,C,D,ts);
[y,tt,xx]=lsim(sys,u,t);
subplot(2,1,1)
plot(tt,y(:,1))
title('Open Loop Step Response')
ylabel('Am... |
%
% Copyright (c) 2018, Yunlong Wang
% All rights reserved. Please read the "license.txt" for license terms.
%
% This code is part of PC-TC(v0.1)
%
% Contact Info: yunlong.wang.stud@outlook.com
%
function POIs = formatPOIsWithStayPoints(data_original,stayPoints,data_with_clusters,IDX)
%% format POIs
max... |
function check_dist(X)
[N, ~] = size(X);
X = sort(X);
X = zscore(X); % normalize
Y = zeros(N, 1);
for i = 1:N
p = (i-0.5)/N;
Y(i) = norminv(p);
end
figure;
plot(X, Y);
end |
function y = inactivation_time_Fun(init_coeffs,x)
y=init_coeffs(1)+init_coeffs(2)*exp(-(init_coeffs(3)-x).^2/init_coeffs(4)^2); |
%image post-processing
filepath = '~/Dropbox (MIT)/2.168 Project/Data/turing_ss';
mat = matfile(filepath);
ysize = size(mat,'y');
threshold = 3.5; %a separation of the bimodal distribution of the entire dataset (component 1)
%see for example:
%figure; histogram(mat.y(1:ysize(1),1:ysize(2),1:ysize(3),ysize(4),1)
feature... |
function verifyFeatures( X_actual, X_generated )
diff = abs(X_actual - X_generated);
sumErrors = sum(diff);
meanErrors = mean(diff);
stdErrors = std(diff);
end
|
function A = set(A, varargin)
%
% Set transformMatrix properties and return the updated object.
%
% A = set(A, ...)
%
% This funtion accepts an transformMatrix object, A, and a variable list of
% property name/value pairs and returns the modified object.
% Valid properties are:
% 'transform', 'transpose'
%
... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs, code etc. ... |
function fluxOutput = aggradeForNtimesteps(obj, N)
% Aggrades the current active channel for N time steps
% obj : the avulsion model object
% N : the number of time steps
% fluxOutput : a vector representing the flux leaving the channel [m^2/hr]
%% initialize local parameters
hasAvulsed = false... |
function simple_fitness_val = submit_to_condor_session_synchronous(session_object, worker_task, worker_args, job_tags, options)
[session_object,new_task_dir] = submit_to_condor_session(session_object, worker_task, worker_args, job_tags, options);
pause(10);
new_jobcomplete_file_path=path_join(new_task_dir,'job_com... |
%**************************************************************************
etan01;
%
potential;
%potentialZB;
%**************************************************************************
Hmatrix;
%
reshapeHo;
%
Vmatrix;
%
reshapeV;
%
Htot01;
%
%overintegral;
% ***************************... |
function ybar = myfilter(x,c)
ybar=x;
n=size(c,1);
for j=1:n
y=ybar;
delta=c(j);
ybar(1) = (1+delta)*y(1)/2 +(1-delta)*y(2)/2;
for i=2:length(ybar)-1
ybar(i) = (1-delta)*y(i-1)/2 + delta*y(i) + (1-delta)*y(i+1)/2;
end
ybar(end) = (1+delta)*y(end)/2+(1... |
function [ER, RT] = compute_contERRT_abs_v2(r_vals, dI, XX)
% unpack XX
cA_0 = XX(1);
cA_R = XX(2);
cA_I = XX(3);
cZ_0 = XX(4);
cZ_R = XX(5);
cZ_I = XX(6);
cX_0 = XX(7);
cX_R = XX(8);
cX_I = XX(9);
T0 = XX(10);
A = cA_0 + cA_R * r_vals + cA_I * dI;
z = cZ_0 + cZ_R * abs(r_vals) + cZ_I * abs(dI);
b = cX_... |
addpath(genpath('../sc_common'));
addpath(genpath('../matlab_utils'));
addpath(genpath('../sc_amra'));
clear;
close all;
fsHz = 80000;
%%
% sDmr = ReadDataIQ('signals/sDmr19200.bin', 'int32');
% fsDmrHz = 19200;
% [p, q] = rat(max(fsHz, fsDmrHz) / min(fsHz, fsDmrHz));
% sDmrRsmpl = resample(sDmr, p, q);
% WriteDataIQ... |
function [varargout] = InitializeInstr(obj)
% Initialize instrument
%
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
TYP = lower(obj.drivertype);
ErrMsg = '';
switch TYP
case {'agle82xx','agle8200','agl e82xx','agl e82... |
function PrecursorFlag=EvalPrecursorFlagStepper(figh, P, Prefix)
% EvalPrecursorFlagstepper - compute noise seed series from PrecursorFlagStepper GUI
% panel
% PrecursorFlag=EvalPrecursorFlagStepper(figh, P) checks PrecursorFlag-stepper specs
% in struct P (returned by GUIval ): startPrecursorFlag, stepPrecursorFla... |
% clear;
r = 20;
n = 1001;
m = 1000;
Nobs = 100;
X = zeros(n, m, Nobs);
O = zeros(n, m, Nobs);
E_ori = zeros(n, m, Nobs);
T_ori = zeros(r, r, Nobs);
Uc_ori = rand(n, r);
Ur_ori = rand(m, r);
randn('state',1212412414424234324);
rand('state',1212412414424234324);
% Uc_orig = randn(n,r);
% Ur_orig = randn(r,m);
for... |
%% Setup selecting UI
% Select a .csv file to load
[setupFile, setupPath] = uigetfile(".csv",'MultiSelect', 'off');
% If canceled, return
if (setupFile == 0)
return;
end
% Find a complete file path
setupFilePath = fullfile(setupPath, setupFile);
% Read the setup table from the file
setupTable = readtable(setupF... |
function [location,coeffs] = parsePred(stationId)
% Function to parse location and harmonic coefficients from the
% Webcritech website
% http://webcritech.jrc.ec.europa.eu/SeaLevelsDb/Home/TideGaugeDetails
% /stationId. Depends on parseCoeffs and
% parseLoc
% Created on 06/23/2017 by Benjamin Huang
% Constru... |
%ABSTRACT:
% Inline-replacement for left-assignment.
%SYNTAX
% result = illa(leftVar,leftIndex,rightSide)
%EXAMPLES
% illa(1:10,2:3,nan)
% illa(rand(100),{1:100,1:10},nan)
% illa(rand(100),{1:100,1:10},@(previousValues)f(previousValues))
% illa({1,2,3},2,{7}); %note that illa subindexes via () into leftVar, not v... |
%Determining mass fractions without
%this part was removed to allow it to be run much faster without picking
%data set each time
prompt = {'How many data sets to be analyzed? (number only)'};
numsetsSTR = inputdlg(prompt,'Input',1);
numsets = str2double(numsetsSTR);
numsets = 9;
%this part was removed to... |
function PythonList = makeList(x)
for i= 1: length(x)
A{i}=x{i}';
B{i}=py.list(A{i});
end;
%B= arrayfun(@(x) py.list(x), A, 'un',0)
%A= arrayfun(@{x} x.', firstipsisite)
PythonList= py.list(B);
end
|
function [Radar] = Reading_HYDRA_W_data(pname, stDate, enDate, fname)
%%% Reading W-band radar LVL1 data version 3.5
%%% [Radar] = Reading_HYDRA_W_data(pname, stDate, enDate, fname)
%%% pname - path to the data files
%%% stDate and enDate are starting and end dates of the event in the
%%% Matlab datenum format
%%% fn... |
% plot data
[~, uniqueInd] = unique(t_rmse);
ax = [];
h3_1 = figure;
upperBound = 4;
if size(ratioRMSE_plot, 2) < upperBound
upperBound = size(ratioRMSE_plot, 2);
end
for ii = 1:upperBound
ax(ii) = subplot(2, 2, ii); hold on
bar(t_rmse(uniqueInd), ratioRMSE_plot(uniqueInd, ii));
shading flat
titl... |
sublist = {'LH','HK','NM','EN'};
nsub = numel(sublist);
for sub = 1:nsub
subId = sublist{sub};
fileName = sprintf('./%s/%s_mData_CI.mat',subId,subId);
load(fileName)
pData(sub) = mData_CI;
end
CI_D.s = [];
CI_D.n = [];
CI_D.a = [];
CI_glm.s = [];
CI_glm.n = [];
CI_glm.a = [];
CI_nT.s = [];
CI_nT.n ... |
disp('Question 2 is running ...');
%% global variables or settings
A = [1 -1.1 -0.0975 0.019 1.0825 -0.904];
B = [1 0.5];
sys = tf(B,A,1);
% sys = zpk(B,A,1);
pzmap(sys)
% model = arima('Constant',0,'AR',{1.1,0.0975,-0.019,-1.0825,0.904},'MA',{0.5},'Variance',1);
%% A
[h,w] = freqz(B,A,'whole',2001);
figure
plot(w/pi,... |
function displaySlice(V, rarity)
% displays slices of the 3D image in matrix form
% starting from slice #start, and skipping all
% but every (rarity)th image.
[~,~,numImages] = size(V);
% print matrix of images
n = floor (sqrt(numImages / rarity));
figure,
for i = 1:n
for j = 1:n
imgIndex = ((i-1)*n+j);
... |
function simlos=ATQT1Colosforwardmodeling(t,coslip,slip,int_pairs,rake1,rake2)
%t is the combined time
%t1 is the AT time
%t2 is the AT1 time
%slip is the simulated spatio-temporal slip
%nwidth is the row number
%nline is the collumn number
load matdir/faultgeos
paches=faultgeos.fault1;
n=length(paches);
... |
function displayFlow(Jtraining, Jtest, Fscore)
trainingSize = size(Jtraining, 2);
subplot (2, 1, 1)
hold on;
plot(1:trainingSize, Jtraining, 'color', 'r')
plot(1:trainingSize, Jtest, 'color', 'k')
xlabel("training set size");
ylabel("J min");
hold off;
subplot (2, 1, 2)
plot(1:trainingSize, Fscore, ... |
function makeTone(Fs,toneFreq,nSeconds,outFile)
nSeconds = nSeconds/8;
y = sin(linspace(0, nSeconds*toneFreq*2*pi, round(nSeconds*Fs)));
y = (y+1);
y = y*500/2;
final = repmat([y zeros(1,4000)],1,4);
% sound(final,Fs);
min(final)
max(final)
length(final)
wavwrite(final, Fs, ... |
function p = delayModel(p,stims,weights_before)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code for making a Self Organising Feature Map grid (SOFM)
%
% Rosie Cowell (Dec 2011)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Represent ... |
classdef PointBinder < props.HasProps
%POINTBINDER Bind data to nodes of a Steno3D Point
% For usage details, see the %%%ref[binders help](steno3d.core.binders).
%
% %%%properties
%
% See the point %%%ref[EXAMPLES](steno3d.examples.core.point)
%
% %%%seealso steno3d.core.binders, steno3d.core.DataArray, steno3d... |
function tbl = getTec(date, loc)
arguments
date (1,1) datetime {mustBeAfter(date, 2013)}
loc (1,1) string {mustBeMember(loc, ["arc", "arv", "chu", "cor", ...
"edm", "fsi", "fsm", "gjo", "kug", "mcm", "rab", "ran", "rep", ...
"sac"])}
end
yr = year(date);
doy = d... |
function [] = graficarEscalon(modelo,titulo)
%Respuesta escalar
step(modelo)
title("Respuesta escalar del modelo "+titulo)
grid on
xlabel('Tiempo[s]')
ylabel('Volumen')
figure()
end
|
function roads_geo_out = get_lat_lon_from_boston(shapeData)
% shape lesen
roads = shapeData;
roads_geo_out = shapeData; % leere Datenstruktur für Ausgabe anlegen
% NAD83 Projektionsinfo laden von geographische Koordinaten nach NAD83 [sf]
info = geotiffinfo('boston.tif');
%Über alle Strassensegmente
for i=1 : length(... |
function saveAnnotSheetTxt(gui,trial,mouse,session,tr)
fid = trial.io.annot.fid;
tmin = trial.io.annot.tmin;
tmax = trial.io.annot.tmax;
if(isempty(fid)|strcmpi(fid(end-10:end),'blank.annot')|~strcmpi(fid(end-5:end),'.annot')) %need to create a new file
suggestedName = ['mouse' num2str(mouse) '_' sessio... |
function xr=deasysolve2(f,p,l,i,s,c,offset)
xl=offset;
if (diff(f(p,[offset,offset+1],l,i,s,c))<0)
xr=xl;
return;
end
len=1;
xr=offset+len;
dfxr=diff(f(p,[xr,xr+1],l,i,s,c));
while(dfxr>0)
xl=offset+len;
len=bitshift(len,1);
xr=offset+len;
dfxr=diff(f(p,[xr,xr+1],l,i,s,c));
end
%pause(5)
while(... |
function [ring,radelemIndex,cavitiesIndex,energy]=atradon(ring1,varargin)
%ATRADON switches RF and radiation on
%
% [RING2,RADINDEX,CAVINDEX,ENERGY] = ATRADON(RING,CAVIPASS,BENDPASS,QUADPASS)
% Changes passmethods to get RF cavity acceleration and radiation
% damping. ATRADON also sets the "Energy" field on the ... |
% [y, fs] = audioread('uraman.mp3');
%% mySine: function description
function [outputs] = mySine(duration, freq)
fs = 16000;
time = (0:duration*fs-1)/fs;
m = (freq(2) - freq(1))/((duration*fs-1)/fs);
phi = (freq(1) * time + 0.5 * m * (time.*time) );
y = sin(2*pi*phi);
% plot( time/fs, y)
outputs = y;
% sound(... |
function [rrr1,rrr2,ttt1,ttt2,nnn,nnk,NN]=compdisks(bb,aazb,N)
ii=getii(bb);
[bb]=ordervec(bb,ii);
[aazb]=ordervec(aazb,ii);
if not(checkgeom(bb,aazb))
disp('geometrijski podatki ne ustrezajo, diski se prekrivajo.');
return;
endif
NN=makeNN(bb,aazb,N);
#bb,aazb,VV,NN
rrr1=[];
rrr2=[];
ttt1=[];
ttt2=[];
... |
function[mAP] =LBSE(kkk,fs,EVA,I_tr,I_query,I_re,L_tr,L_query,L_re)
%
I_tr=I_tr';
L_tr=L_tr';
Y=L_tr;
len = fs;
[c,n] = size(Y);
[doI,~] = size(I_tr);
lamda =1e-4;
alpha=0.1;
beta =20;
gamma=1;
W=rand(len,c)-0.5;
B=sign(rand(len,n)-0.5);
Z=rand(len,n)-0.5;
dl=10;
S=L_tr'*L_tr>0;
S=2*S-1;
P_temp=pinv(I_tr*I_... |
% RANDOMIZE ORDER OF STIMULI
% Go through markov chain for all trials
for i=1:params.n_trials
if mod(i,params.n_trials_session) == 1
yield = randperm(2);
type = randperm(2);
% Initialize first trial bandits
data.bandit_left(i,:) = [yield(1),type(1)];
data.ban... |
% estHypergeometric.m
% Description: This code is for SWIFT: Sparse Withdrawal of Inliers in
% a First Trial.
%
% Ref:
% Jaberi, Maryam, Marianna Pensky, and Hassan Foroosh. "SWIFT: Sparse
% Withdrawal of Inliers in a First Trial." Proceedings of the IEEE Conference
% on Computer Vision and Pattern Recognitio... |
function [dimReduct] = dimReductProcessing(dimReductSelect, data)
switch dimReductSelect.name
case 'None'
dimReduct = NoTransform;
% case 'ksPCA'
% dimReduct = KSPCATransform;
%
% if isfield(dimReductSelect, 'degre... |
% Compare refaced data with ground truth. Calculate L1 and L2 norm. Plot
% convergence of training across epochs. Create summary images.
dataset = 4;
dirCycleGAN = '/home/davab27/GAN_MRI/CycleGAN3';
dirIXI = '/flush/davab27/IXI';
epochsList = 20:20:200;
nEpochs = length(epochsList);
switch dataset
case 1
... |
function [as,ai,b,smec_SS187,depth_SS187ft]=rhodtSS187
set(0,'defaultLineLineWidth',3)
set(0,'DefaultAxesFontSize',15);
%rho=a+b*dt
[~,~,~,~,~,shalerho1]=selectsandshale('177114129700_Orig+Edit+RckPhys.las',20,5,90,25,3300,12830);
[~,~,~,~,~,shalerho2]=selectsandshale('177114129700_Orig+Edit+RckPhys.las',21,5,90,3,1292... |
clear
imager = imread('house.tif');
imager = double(imager);
[r,c] = size(imager);
%%%%%% Un-gamma %%%%
image_g = 255*(imager/255).^(2.2);
imshow(uint8(image_g))
Bayer_2 = [1 2;3 0]
Bayer_4 = [Bayer_2*4 + 1 Bayer_2*4 + 2;Bayer_2*4 + 3 Bayer_2*4]
Bayer_8 = [Bayer_4*4 + 1 Bayer_4*4 + 2;Bayer_4*4 + 3 Bayer_... |
function ComputeSaveFData(all_ftypes, f_sfn)
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
W = 19;
H = 19;
fmat = VecAllFeatures(all_ftypes,W,H);
save(f_sfn, 'fmat', 'all_ftypes', 'W', 'H');
end
|
% Save_AvgAnnOutput - Saves average annual array data for each run to files.
% Called by: VC_Shell
% Calls: Save_File
% V02 - 01/10/2014 VC
% ©MathEcology, LLC 2014 - Colleen R. Burgess
%--------------------------------------------------------------------------
global AvgYCases AvgYCasesv AvgYDeaths AvgYDeathsv AvgYAn... |
curr_dir = '/Users/skryazhi/epistasis_theory/data/Chassagnole_etal';
runId = '2020-05-23';
Glu = 'Low'; % 'Low' 'Med' or 'Inf';
IFINIT = false; % initialize models or load previously initialized?
% Should always re-initialized if something changes in the definition of
% any model
ModuleList = {'FULL', 'UGPP', 'GPP',... |
data = readtable('IV 06302011.xlsx');
discount = table2array(data(:,12));
strike = str2double(table2array(data(4:13,3)));
cap_vol = str2double(table2array(data(4:13,4)))/100;
cap_data = cell(10,1);
for i = 1:10
n = i*4;
this_cap = zeros(n,6);
this_cap(:,3) = 0.25;
this_cap(:,6) = strike(i);
f... |
function res = loss_function(X, y, w, mu)
dim = size(y);
m = dim(1);
h = 1.0./(1.0 + exp(-X*w));
res = - y'*log(h) - (1 - y)'*log(1 - h);
res = res./m + mu*(w'*w)./2;
end |
function ans = fib(n)
if n == 1 || n == 2
1;
else
fib(n-1) + fib(n-2);
end
end |
function w = get_weights(res,K,crit,thres)
[nt,nm,nr] = size(res);
res = reshape(sum(res,1),nm,nr);
switch crit
case "AKAIKE"
a = nt*log(res/nt);
b = 2*(K+1); b(K>nt/40)=b.*(nt./(nt-K-2));
AIC = a+b;
ed = exp(-(AIC - min(AIC))/2);
w = (1./sum(ed,1)).*ed;
case ... |
%%for self energy & inhomogenous potential
function [dosmap,rev,dosmat]=spec_seinhom_sp(a,mu,delta,alpha,gamma,vc,dim,smoothpot,mumax,peakpos,sigma,period)
% a=1;
vzlist=linspace(0,2.048,401);
% vzlist=0:0.001:0.95;
% nv=20;
enlist=linspace(-.21,.21,1001);
dosmap=cell(1,length(vzlist));
dosmat=zeros(length(vzlist),leng... |
matID = fopen('matrices.dat', 'w');
resID = fopen('matrices.solution.dat','w');
k = 16;
x = round(2*rand(3,3,k));
res = eye(3);
for i = 1:k
res = res * x(:,:,i);
end
for i = 1:k
for j = 1:3
fprintf(matID,'%d,%d,%d;',x(j,:,i));
end
fprintf(matID,'\n');
end
for j = 1:3
fprintf(resID,'%d,%d... |
% Based on: Sales-Pardo et al, "Extracting the hierarchical organization of complex systems", PNAS, Sep 25, 2007; vol.104; no.39
% Supplementary material: http://www.pnas.org/content/suppl/2008/02/27/0703740104.DC1/07-03740SItext.pdf
% INPUTs: N: number of nodes; L: number of hierarchy levels; [G1,G2,..,GL]: number of... |
function replace_text_so1
% Replace text in program files
dirS = param_so1.directories([], 1,1);
% Remember to escape special characters: _, \
% These are regex's
oldTextV = {'DataWt\_asM'};
newTextV = {'DataWt\_tsM'};
baseDir = dirS.progDir;
fileMaskIn = '*.m';
inclSubDirs = true;
noConfirm = 'x';
% Exclude this fi... |
function generateOutputMessage(flag, generations, options)
if flag == 1
fprintf('Fitness of best individual achieved a minimal threshold of %d after %d generations.\n',options.Threshold,generations)
elseif flag == 2
fprintf('Best fitness did not improve after %d generations, running over %d generations.\n',options.S... |
%{
vis2p.StatAreaData (computed) #
-> vis2p.StatsSitesParams
mouse_id : smallint unsigned #
exp_date : date #
scan_idx : smallint unsigned #
trace_opt : smallint unsigned #
movie_type : varchar(10) # the type of movie shown
stim_idx ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.