text stringlengths 8 6.12M |
|---|
function [varargout] = lcmvBeamformFilt(fwd,C,sourceGrouping)
%function [filtOut filtOut2] = lcmvBeamform(fwd,C,sourceGrouping)
%
%fwd = nElec x (3*nSources) matrix of free orienation forward model
%C = data covariance matrix to find the sources of.
%sourceGrouping = nSourcesFull X nExtendedSources
% ... |
clear
close all
cd /Users/jj/GoogleDrive/Course/GPUProgramming/proj2/TimingMatrixMult
t_cpu = load('CPU/time.txt');
t_naiveGPU_block64 = load('naiveGPU/block64/time.txt');
t_naiveGPU_block32 = load('naiveGPU/block32/time.txt');
t_tile32GPU = load('tiledGPU/tile32/time.txt');
t_tile64GPU = load('tiledGPU/tile64/time.txt... |
DEPTH = 4096;
WIDTH = 12;
n = 0:(DEPTH-1) ;
yn = sin(2*pi/DEPTH*n) ;
yn = round((yn+1)*(power(2,WIDTH)/2-1));
plot(n,yn);
fid = fopen('sin_rom_xilinx.coe','wt');
fprintf(fid,'memory_initialization_radix = 10;\nmemory_initialization_vector = ');
for i = 1 : 4096
if mod(i-1,16) == 0
fprintf(fid,'\n'... |
function log = cora_filtered_oscillator_16(saveFig,savePath,filename, diff, show, timeStep, tTerms, zOrder, pOrder, strategy)
HA = filtered_oscillator_16_ha();
options.enclosureEnables = [3 5];
options.guardIntersect = 'polytope';
Zdelta = [0.05;0.1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0];
% options
Zcenter = [0.25;0;0;0;0;... |
function [inedges,outedges] = readEdges(addressEdges,U)
disp(U);
a = zeros(U,U);
fileID = fopen(addressEdges,'r');
while (true)
[u,cnt] = fscanf(fileID , '%d' , 1);
if (cnt == 0)
break;
end
% if (userCountMap.isKey(u) == 1)
% ... |
function R = R123(phi,theta,psi)
%R = R123(phi,theta,psi) or R = R123(ptp) where prp is a 3x1 vector
%compute R such that v(inertial) = R v(body)
%In Mark Costello's notation R would be TIB
%IF YOU WANT TO DO THIS WITH QUATERNIONS LOOK FOR RQUAT
if length(phi) == 3
arg = phi;
phi = arg(1);
theta = arg(2);
psi ... |
%% Example script to show how awesome this codebase is.
% addpath('..\..\DicomUtilitiesMatlab');
addpath(genpath('.\HierarchyStructure'));
addpath(genpath('.\ModalityStructure'));
addpath('jsonlab');
tic
databaseMode = false;
%% load the files we need
disp('Loading CT, RTSTRUCT, DOSE and PLAN')
if databaseMode
pati... |
function [ppibeta]= PPI_batch(ID, type)
allseeds={[27,38], [34,47], [34], [38]};
allseednames={2738,3447,34,38};
if type=='TPA';
condvectors={[1,1,2,2,1,-1,3,1,-1],[1,1,1],[2,1,0.5,3,1,0.5]};
condvectorsnames={'Full_speechwordvnonword','speechwordvbase','speechnonwordvbase',};
elseif type=='TFL';
condvect... |
% скрипт методом авторегрессионного анализа находит значения
% параметров (амплитуда, задержка) многолучевого сигнала
function [amp, tay] = finder(mas, range_tay, range_amp, amp0, start_l, end_l)
Pow = zeros(1,length(range_tay));
t = 0;
while t<length(range_tay)
t = t + 1;
mas_filt = f... |
clear all; close all; clc;
%% 1
X1 = randn(50,2) + 1;
X2 = randn(51,2) - 1;
Y1 = ones(50);
Y2 = -ones(51);
X = [4,-4];
Y = [-4,4];
figure ;
hold on;
plot(X1(: ,1) , X1(: ,2) , 'ro');
plot(X2(: ,1) , X2(: ,2) , 'bo');
line(X,Y, 'color','black');
hold off;
%% 2
load iris.mat
%%
% Train the LS-SVM classifier using pol... |
TotalVNFs = 20; %VNFs的种类数
%带宽范围最小值,单位Mbps
MinBW = 1;
MaxBW = 10;
%最大容忍延时范围最小值,单位:ms
MinDelay = 50;
MaxDelay = 100;
%服务链长度范围
MinSfcLen = 3;
MaxSfcLen = 5;
%CPU需求,单位:MIPS
MinResources = 1;
MaxResources = 10;
%service request的个数
N = 20;
idx = 1;
lam = 5; %泊松分布的参数:平均单位时间内到达的请求个数
% x = 0:1:30; %到达的次数
% p = pois... |
clc
clear
global epsilon;
ep = 0.01;
eps = linspace(0.1,1,5);
figure(1);
for ep=eps
op = odeset('reltol',1e-7,'abstol',1e-9);
epsilon=ep;
[t,y] = ode45('avg_sin',[0,100],0.01,op);
plot(t,y,'DisplayName','eps='+string(ep));
hold on;
avg = mean(y.*sin(t+y));
davg = ep*avg;
f = @(t,x) [-2*x... |
function [p_F_a]=ancillary_data_modelling(ancillary_data,ancillary_data_type,A_date_par_filename,model_function_type,varargin)
%This function is distributed under the terms of the GNU General Public License 2.0 or
%any later version. See http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
%for the text ... |
function createfigure(Y1, Y2, Y3, Y4, Y5, Y6)
%CREATEFIGURE(Y1, Y2, Y3, Y4, Y5, Y6)
% Y1: y 数据的向量
% Y2: y 数据的向量
% Y3: y 数据的向量
% Y4: y 数据的向量
% Y5: y 数据的向量
% Y6: y 数据的向量
% 由 MATLAB 于 14-Jan-2021 22:51:40 自动生成
% 创建 figure
figure1 = figure;
% 创建 subplot
subplot1 = subplot(3,1,1,'Parent',figur... |
function compile_mex()
cwd=commonFns.extractDirPath(mfilename('fullpath'));
mexCmds=cell(0,1);
mexCmds{end+1}=sprintf('mex -O %s+helpers/mexComputeEllipseOverlap.cpp -outdir %s+helpers/',cwd,cwd);
for i=1:length(mexCmds)
fprintf('Executing %s\n',mexCmds{i});
eval(mexCmds{i});
end
|
% Fitting of experimental data
close all; clear; clc %#ok<*NOPTS>
%% Brandes et al. 2008 "Aggregate Terminal Velocity/Temperature Relations"
load('TvsD-Brandes.csv')
Texp = TvsD_Brandes(:, 1);
Dexp = TvsD_Brandes(:, 2);
clearvars TvsD_Brandes
% Fitting by means of an exponential function
fun = fittype( @(D0, D1, exp,... |
function c3d2Opensim(varargin)
% c3d2OpenSim() read c3d data, process, export to OpenSim format
%
% Generates .trc (marker) and .mot (force).
% Output - a .trc file containing marker positions
% - a .mot file containing forces, COP and moment
%
%
% [rotation, filterProp, body, keepMkrs] = c3d2Ope... |
function net = NN_training(x, y, k, code, iter, par_vec)
rand('seed',0) %initialization of the random number generators
randn('seed',0) %for reproducibility of net initial conditions
%list of training methods:
%traingd: standard gradient descent backpropagation algorithm
%traingdm: backpropagation algorithm with mom... |
addpath(genpath('/Users/apple/Dropbox/AcuteTBI_seg'));
addpath(genpath('/home/hemingy/Dropbox/AcuteTBI_seg'));
'/Volumes/med-kayvan-lab/Datasets/mTBI/ForAnnotation/'
/home/hemingy/Data
|
classdef TPA_BehaviorAnalysis
%TPA_BehaviorAnalysis - Analysis tools per ROI
% Extract data for all ROIs and do some feature analysis
%
%-----------------------------------------------------
% Ver Date Who What
%-----------------------------------------------------
% 26... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% See http://en.wikipedia.org/wiki/Modified_discrete_cosine_transform %
% for more information on MDCT and windowing functions %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear all;
close all;
%Tim... |
% This script ensures folders match that of the database.
names = {};
for i=1:10
names{end+1} = 'string';
end
disp(names)
folders = containers.Map;
for i = 1:100
AM = dir('C:\Users\aaronj\Desktop\Trials\MM\Managers\');
end
values(folders);
rad = input('Enter the radius: ','s');
|
function [] = pssharpenedges()
%PSSHARPENEDGES Run the Sharpen Edges filter.
%
% Example:
% pssharpenedges()
%
% See also PSADDNOISE, PSAVERAGE, PSBLUR, PSBLURMORE, PSBOXBLUR,
% PSCUSTOM, PSDUSTANDSCRATCHES, PSGAUSSIANBLUR, PSHIGHPASS, PSLENSBLUR,
% PSMAXIMUM, PSMEDIAN, PSMINIMUM, PSMOTIONBLUR, PSOFFSET, P... |
function localizationStd = localizationProjection
[ROIDataFilename, ROIDataPathname] = ...
uigetfile('*.ROIData', 'MatFile data:','MultiSelect', 'off');
if ~(isnumeric(ROIDataFilename)&&ROIDataFilename==0) %check the user has not pressed cancel
loadname = [ROIDataPathname ROIDataFilename];
ROID... |
%function result = constraint_Chemistry_AB(params, params_i, delta_t)
%
% Constraint on chemical reactions for a solution containing
% a simple buffer, A + B <-> AB with rates
% forward reaction rate = params.Kon * A * B
% reverse reaction rate = params.Koff * AB
%
% Solution composition... |
%% WARP_Init.m
% Initializes all WARP parameters
disp('Initalizing the WARP platform ...');
%Load some global definitions (packet types, etc.)
warplab_defines
% Create Socket handles and intialize nodes
[socketHandles, packetNum] = warplab_initialize(2);
% Separate the socket handles for easier acces s
... |
% Prim's minimal spanning tree algorithm
% Prim's alg idea:
% start at any node, find closest neighbor and mark edges
% for all remaining nodes, find closest to previous cluster, mark edge
% continue until no nodes remain
% INPUTS: graph defined by adjacency matrix
% OUTPUTS: matrix specifying minimum spanning tree ... |
function primtall = isPrime( x )
primtall = true;
if x > 1
for i=2:sqrt(x)
if mod(x,i)==0
primtall = false;
return;
else
primtall = true;
return;
end
end
else
primtall = false;
end
end
|
function y = kuleVolum(radius)
radius = input('Sett inn radius:')
y = 4/3*radius^3*pi;
end
|
function [xi,yi,zi] = griddata(x,y,z,xi,yi,method)
%不规则数据的曲面插值
%ZI=griddata(x,y,z,XI,YI)
% 这里x,y,z均为向量(不必单调)表示数据.
% XI,YI为网格数据矩阵.griddata采用三角形线性插值.
%ZI=griddata(x,y,z,XI,YI,'cubic') 采用三角形三次插值
%例题 如果数据残缺不全(x,y,z)
% | 0 1 2 3 4
%-----|------------------------
% 2 | * * 80 82 84
... |
function [CH, RT] = getkeywait(P)
% GETKEYWAIT - get a key within a time limit
% CH = GETKEYWAIT(P) waits for a keypress for a maximum of P seconds. P
% should be a positive number. CH is a double representing the key
% pressed key as an ascii number, including backspace (8), space (32),
% enter (13), etc.... |
(OpeningBalance,AmortisationRatePerYear,StartDate)=>
let
//Uncomment for debugging purposes
//OpeningBalance = 500000,
//AmortisationRatePerYear = 0.2,
//StartDate = #date(2019,1,1),
NumberOfMonths = (1 / AmortisationRatePerYear) * 12,
IndexList = {1..NumberOfMonths},
ConvertToTable = Tab... |
% Reads multiple folders recorded on same/different days and produces
% matrix with all sessions and folders recorded
%
% Revision history:
%
% primate 1.0 - July 15, 2015. Introducing individual session analysis. Combine
% single day recordings into one daily log file.
% primate 1.2 - March 8, 2016. Data format is no... |
function [ result ] = UsedInRow( a , row , i )
for col = 1:9
if a(row,col)==i
result = true;
return;
end
end
result = false;
return;
end
|
function p = cca_cdff(x,v1,v2)
% CDF computes the cumulative 'F' distribution
p = 0;
t = (v1 <= 0 | v2 <= 0 | isnan(x) | isnan(v1) | isnan(v2));
p(t) = NaN;
s = (x==Inf) & ~t;
if any(s)
p(s) = 1;
t = t | s;
end
% Compute P when X > 0.
k = find(x > 0 & ~t & isfinite(v1) & isfinite(v2));
if any(k)... |
for i =1:1:1000
[T,Y]=ode45(@(t,y)[y(2),(i*(1-y(1)*y(1))*y(2)-y(1))]', [0 6000],[1 1]);
MU=i*ones(length(T),1);
plot3(T,MU,Y(:,1));
if (i==1)
hold on
end;
end;
hold off
xlabel('t')
ylabel('mu')
zlabel('y')
%for i =1:200:1000
% [T,Y]=ode23s(@(t,y)[y(2),(i*(1-y(1)*y(1))*y(2)-y(1))]', [0 ... |
load Examples\Example5_EEG.mat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%data file corresponds to EEG signal without artifacts (preprocessed)
%and filtered in the interest frequency band (eg: 4- 30 Hz)
dmax=200; %Maximun point in duration state
ncomp=10; %PCA component
nstates=0... |
function residuals = residual_error(H, homoCoord1, homoCoord2)
transformedPoints = homoCoord1 * H;
lambda_t = transformedPoints(:,3);
lambda_2 = homoCoord2(:,3);
cartDistX = transformedPoints(:,1) ./ lambda_t - homoCoord2(:,1) ./ lambda_2;
cartDistY = transformedPoints(:,2) ./ lambda_t - ... |
clear;
p_folder = '/Users/ryanlab/Desktop/AliT/Scripts/saliency_analysis/output/corr_data/';
p_file = 'participant_';
%output = {'p_num','trial_num','age_group','num_fixations'};
for participant_num = 1:15
myparticipant = load(strcat(p_folder,p_file,num2str(participant_num)));
myparticipant = myparticipant.m... |
classdef FiniteFieldMultiPoly
properties
field;
zero;
one;
variables;
end
methods
function obj = FiniteFieldMultiPoly(F,n)
obj.field = F;
variables = n;
obj.zero = {[F.zero, zeros(1,n)]};
obj.one = {[F.one, zeros(1,n... |
function strBest = bestMusic(cellVar)
strBest = cellVar{end};
end |
%% Implemented by Pouya Ghaemmaghami -- p.ghaemmaghami@unitn.it
%%
clc;
clear all;
Music_Genres_mat.GTZAN_Genres = {'Rock' 'Blues' 'Jazz' 'Metal' 'Pop' 'Disco' 'Hiphop' 'Reggae' 'Country' 'Classical'}';
Music_Genres_mat.DEAP_Genres = {'Pop/Disco/Dance/Techno' 'Rock/Metal'}';
Music_Genres_mat.Pouya = [1,2,1,2,... |
function coords = calculate_coordinates(S,minlistlength)
hits=0;
coords=[];
for ind1=1:length(S)
if length(S{ind1})>minlistlength % checks whether each list contains a number of pixels that is reasonable large
% this helps filter out single pixel "defects" with large illu... |
%% --------
% QC_01_07_TimeVsMagCombPlot(MeasCat)
% Time Vs Magnitude plot - Comb Plot
% Input: MeasCat - Measured catalogue
function QC_01_07_TimeVsMagCombPlot(MeasCat)
close all
if ~isnumeric(MeasCat)
error('Load catagoue in the correct format (see readme for description)')
end
%% definition of variables
... |
function [ Y ] = ktnormalize( Y,nrm,nnproj )
if nargin==1
nrm=[];nnproj=[];
elseif nargin==2
nnproj=[];
end
if isempty(nrm)
nrm=2;
end
if isempty(nnproj)
nnproj=true;
end
if strcmpi(class(Y),'ktensor')
I=size(Y);
N=numel(I);
J=length(Y.lambda);
switch nrm
case 0
for ... |
load( 'roiforBrain.mat', '-mat');
level = graythresh(pixels);
bw = imbinarize(img, level);
subplot(131), imshow(bw), title('thresholding by graythresh');
level1 = 0.4;
bw1 = imbinarize(img, level1);
subplot(132), imshow(bw1), title('thresholding 0.4');
level2 = 0.7;
bw2 = imbinarize(img, level2);
subplot(133), imsho... |
function Hs=fsmooth(H,width,fftlen)
% FSMOOTH octave ore third octave smoothing of transferfunction H.
% Hs=FSMOOTH(H,width,fftlen)
% H --> transfer function to be smoothed
% width --> 'third' or 'octave'
% fftlen--> number of computed frequency samples
if min(size(H))>1 error('H must be a vector'); e... |
addpath('../libsvm-3.14-nobias/matlab');
maxNumCompThreads(1);
load mnistbinary;
trainy = yTrain;
trainX = sparse(xTrain)';
testy = yTest;
testX = sparse(xTest)';
%[trainy trainX] = libsvmread('../data/ijcnn1.train');
%[testy, testX] = libsvmread('../data/ijcnn1.t');
%% train/test rbf kernel SVM
ncluster = 100;
gamma =... |
function [Trans, TREE] = getTransMatrix( robotState )
%GETTRANSMATRIX この関数の概要をここに記述
% 詳細説明をここに記述
[ th1, th2, th3, th4, th5, th6, xb, yb, thb, lb, hb ] = pickUpData( robotState );
d0 = 0.1544*1000;
d1 = -0.1181*1000;
d2 = 0.2900*1000;
d3_offset = -0.0070*1000;
d3 = 0.1233*1000;
d4 =0.0741*1000;
d5 = 0.0741*1000;
d6 =... |
clc;
close all;
clear variables; %clear classes;
rand('state',0); % rand('state',sum(100*clock));
dbstop if error;
%% 1) load Tango VIO data
% choose dataset path
datasetPath = '../data';
datasetList = dir(datasetPath);
datasetList(1:2) = [];
% load unique WiFi RSSID Map
load([datasetPath '/uniqueWiFiAPsBSSID.mat'... |
function new_pulse_model = add_2_pulse_model(pulse_model,new_pulses)
%update a pulse model with additional data
%new_pulse_model = add_2_pulse_model(pulse_model,new_pulses)
%USAGE
%
%provide sample of pulses
%return pulse model & std etc and Lik of individual pulses given the model
%fit_pulse_model estimates only the... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute Spatial Uncertainty estimation of saliency maps as proposed
% in "UNSUPERVISED UNCERTAINTY ANALYSIS FOR VIDEO SALIENCY DETECTION"
% presented at Asilomar 2015, Montery, California.
% Written by Tariq Alshawi, PhD student, Ge... |
clear all; close all hidden; clc; %#ok<CLALL>
path = '../CommonExperiment';
p = genpath(path);
addpath(p); %add path to commonly used functions
addpath('Stim_Dev')
subj = input('Please subject ID:', 's');
fig_num=99;
USB_ch=1;
FS_tag = 3;
[f1RZ,PS.RP,FS]=load_play_circuit(FS_tag,fig_num,USB_ch);
%% Stim & Experimen... |
function alpha = alfaSGlogvini(Y,filtersetname,epsW)
% alfaSGlogvini gets reference values for log prior alpha parameters
%
% input arguments:
% Y Multi-spectral image
% filtersetname 'none' or 'fohv' or 'fo'
% epsW a very low value to avoid division by zero
%
% output ar... |
function[objective_function]=f(CL,V)
T_obs = [0, 1, 2, 4, 8, 12, 16, 20, 24];
C_obs = [15, 12.3, 10.1, 6.7, 3.0, 1.4, 0.6, 0.4, 0.1];
objective_function = WSS(CL, V, T_obs, C_obs)
end
|
%生成表格的代码
cangwei=xlsread('C:\Users\a\Desktop\历史数据摆放.xlsx',1,'A2:H96');
leng=[ones(1,45)*9,ones(1,50)*12];
Leng=cangwei(:,2)';
R=cangwei(:,3)';
T=cangwei(:,4)';
Amount=cangwei(:,6)';
maxamount=cangwei(:,5)';
Number=cangwei(:,1)';
zhonglei=cangwei(:,8)';
Data=[Leng;R;T;Amount;maxamount;Number;zhonglei];%Leng是仓位... |
%% Import data from text file.
clear all
filename = '~/github/econ_courses/econ241b/assts/asst4/prob_set4.csv';
raw = readtable(filename);
% NOTE: this is the same data as for asst 3; I did not save the Stata
% edits made for assignment 4.
%% set up data
% keep just public wages and drop the pubwage column
wage = r... |
%-----------------------------------------------------------------------------------------
% running_mean.m
%
% smooths an incoming time series with a 9 point running mean
%
% levi silvers june 2017
%--------------------------------------------------------------... |
## -*- Mode: octave -*-
M.elasticity = 0.1;
M.ask = 10;
M.cost = 0.5;
M.baseline = 0.1;
function x = Demand(price, M)
x = M.ask - M.elasticity .* price;
end
function u = Util(p, M)
u = (p - M.cost) .* (Demand(p, M) + M.baseline);
end
function p_opt = OptimalPrice(M)
p_opt = 0.5 * ((M.ask + M.baseline) / M.ela... |
figure
temp=freq{1};
cfg=[];
cfg.layout='/home/lspyrou/Documents/ls_brain/global/biosemi128.lay';
cfg.parameter='powspctrm';
cfg.figurename=' ';
f1=2;
f2=9;
si=10;
temp.powspctrm=repmat(Fp{f1,si}{2}(:,1),1,15);
subplot(5,2,1),title('\lambda=0')
ft_topoplotTFR(cfg,temp)
temp.powspctrm=repmat(Fp{f2,si}{2}(:,1),1,15);
sub... |
function IOwVTKH(Sys, Mesh, filename)
% write vtk file for mesh plot
tic;
fid = fopen(['FEpost/',filename, '.vtk'], 'w');
fprintf(fid, '# vtk DataFile Version 2.0\nUnstructured Grid\n');
fprintf(fid, 'ASCII\nDATASET UNSTRUCTURED_GRID\n');
fprintf(fid, 'POINTS %d double\n', Mesh.NNODE);
for i=1:Mesh.NNODE
fpri... |
%{
% clear; close all
mouse = 'fni16'; %'fni17';
imagingFolder = '151028'; %'151015';
mdfFileNumber = [1,2];
%%
% close all
% best is to set the 2 vars below to 0 so u get times of events for all trials; later decide which ones to set to nan.
rmvTrsStimRateChanged = 0; % if 1, early-go-tone trials w stimRate categ di... |
% script to analyse stimuli for 964 or 965 cells
% need to fill in many (%%%change%%%) variables below
cue = 'ITA2';
cellID = '965FA';
stim_dir = ['e:\kip\temp\' cue '\'];
sflag = 0; %save flag
% initial params:
Fs = 30000;
cF = round(1000*exp(([12:40]/12)*log(2)))';
n_cF = length(cF);
% calc E... |
power_ant = zeros(11,1);
for i = 2:12
if i>=10
filename = strcat('C:\Users\xyzhang\Desktop\chenghong\base_station\x3d\bs_simulation.pg.t001_',num2str(i),'.r001.p2m');
else
filename = strcat('C:\Users\xyzhang\Desktop\chenghong\base_station\x3d\bs_simulation.pg.t001_0',num2str(i),'.r001.p2m');
end
... |
function [NoiseAmp, NoiseSlope] = ...
EstimateNoiseSpectrum(in, opt, plotflag, hax, SubsetLength)
% Estimate noise spectrum as S = (NoiseAmp) * (freq)^(NoiseSlope)
% Do this by fitting a line in
% (freq < low-frequency cutoff).
% Optionally, use frequency information in
% (freq > high ... |
function [X,J,Z,S]=HexSimPoly(X,J,Z)
% This code is used to quickly record the 3 data
% values for filaments (plus end location Z(1,i),Z(2,i) and the angle of
% the filament Z(3,i)) to later be read into ImageJ for quick plotting and
% analyzing. It also includes a noise concept of filament polymerization.
% 01/26/14
%... |
function createfigure(X1, Y1, S1, C1)
%CREATEFIGURE(X1,Y1,S1,C1)
% X1: scatter x
% Y1: scatter y
% S1: scatter s
% C1: scatter c
% Auto-generated by MATLAB on 27-Oct-2012 16:02:46
% Create figure
figure1 = figure;
% Create axes
axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
xlim(a... |
clc;
clear;
close all;
x=[1 1 1];
y=dft1(x,50);
subplot(2,1,1);
stem(abs(y));
subplot(2,1,2);
stem(angle(y));
|
function [] = plottingCircles(termStorage,fourierCoefficentList,numNodes,numHarmonics)
for i = 1:size(fourierCoefficentList,2)
plotCircle(0,0,fourierCoefficentList(i));
end
end |
function [cIX,gIX,numK,IX_regtype,corr_max] = AllRegsRegression(hfig,isRegIndividualCells,isRegCurrentCells)
if ~exist('isRegIndividualCells','var'),
isRegIndividualCells = 1;
end
if ~exist('isRegCurrentCells','var')
isRegCurrentCells = 1;
end
% get functional data
if isRegIndividualCells,
if ~isRegCurrentC... |
function [T1,R1,T2,R2]=TR_aus_E(E)
% Stelle sicher, dass U und V Rotationsmatrizen sind
[U,S,V]=svd(E);
if det(U) < 0
U = U*diag([1 1 -1]);
end
if det(V) < 0
V = V*diag([1 1 -1]);
end
% Der Vektor T liegt im Nullraum von E', ebenso liegt U(:,3) im Nullraum
% von E'. Da die Translation nur bis auf Skalierung gesch... |
close all, clear all
load('baseline')
keys = {'Bilinear Similarity', 'Cross-correlation', 'Cosine Similarity' ...
'Minkowsky metric, p=1' ...
'Minkowsky metric, p=2'};
results = {bi, cc, cos, mink1, mink2};
rank = 1:14;
figure
hold on
grid on
grid minor
for i = 1:length(results)
plot(rank, results{i}.sc... |
function dtx_v37_BufferedRx()
initParameters;
% Designated Receiver Parameter Structure
%prm = init_v35();
% aip: IP Address for USRP attached to this machine as a 3-Digit uint8
% (as of 2/19/15, valid values for N210's in Lab are 102, 103, or 202)
aip = getipa();
% c8f: Count of the Number of 802.11b Frames Sent... |
function plot_mode( params, X, U )
% INPUT:
% :params: parameter of NLS with nonlinear potential (see info.txt)
% :X: grid
% :U: values on grid
% figure
hold on
umax = max(U(:, 1));
umin = min(U(:, 1));
%line([-2*pi:pi:2*pi; -2*pi:pi:2*pi],...
% [repmat(-2*abs(umin), 1, 5); repmat(2*abs(umax), 1, 5)... |
function[camara, src] = setup_camara(threshold, id)
% id vale 1, 2, etc
imaqreset
camara = videoinput('gige', id);
src = getselectedsource(camara);
set(src, 'CameraMode', 'CenterOfGravity');
set(src, 'ReverseY', 'True');
set(src, 'ExposureTime', 300);
set(src, 'EnableDC2'... |
function utotal = tracker(uin,v0,a0,N,Am,Bm,Cm)
uref = uin(1:end-1);
vp = [v0 zeros(1,N)];
ap = [a0 zeros(1,N)];
vshow = [v0 zeros(1,N)];
for i=1:N
vshow(i+1)=(1-(Bm))*vshow(i)-(Cm)*vshow(i)^2-(Am)+uin(i);
end
% Prediction using data-driven sparse regression based model
for j=1:N
vp(j+1)=0.9383*vp(j... |
function [Width] = calcWidth(D , a)
Width = (2 .* D) + a;
end
|
%% Rand
function [R_v] = Num_1_Wirbelstroemung_GUI_Rand_Trafo(R)
[Nx,Ny] = size(R);
nx = Nx-2;
ny = Ny-2;
R_v = zeros(nx*ny,1);
R_v(1,1) = R(1,2)+R(2,1);
R_v(ny,1) = R(ny+1,1)+R(ny+2,2);
R_v((nx-1)*ny+1,1) = R(1,nx+1)+R(2,nx+2);
R_v(nx*ny,1) = R(ny+1,nx+2)+R(ny+2,nx+1);
for m = 2:1:(nx-1)*ny
if m < ny
R_v(... |
function result=SelectSensitiveSubc(Txant,Rxant,RawCSI,silentEndPoint)
% Seclect Sensitive Subcarricers from 30 subcarriers
%
% Txant: Tx antenna
% Rxant: Rx antenna
% RawCSI: csi data file
% silentEndPoint:static CSI measured during static time
% Author: LBJ
count_channel=1;
stepLength=5;
for num=1:length(RawCSI)
c... |
function [ output_args ] = Rigid()
%RIGID Summary of this function goes here
% Detailed explanation goes here
% inertia tensor, diagonal matrix since we can set body axes to principal
% axes
IA = 4; IB = 4; IC = 8;
I_body = eye(3);
I_body(1,1) = IA;
I_body(2,2) = IB;
I_vody(3,3) = IC;
I_body_inv = inv(I_body)
% sta... |
function crop_img = face_crop(face_img, face_rectangle, x_n, y_n, scale)
% bounding box position and size
face_x = face_rectangle(1);
face_y = face_rectangle(2);
face_width = face_rectangle(3);
face_height = face_rectangle(4);
center_x = ceil(face_x + face_width/2);
center_y = ceil... |
% pltvbar.m ---------------------------------------------------
% This script demonstrates the use of vbar and ebar to plot
% vertical bar plots and error bar plots respectively.
% Some other things to note about pltvbar are:
% - The first vbar in the argument list plots two functions on a single
% trace (green) with... |
% Crea la matrice di estensione ai bordi di una immagine
%
% E = matrix_extend( D, EXT, M, N )
%
% D = dimensione delle estensioni ai bordi
% (vettore di 4 interi, [left down right up])
% EXT = stringa di 4 elementi per il tipo di estensione ad ogni bordo
% 'e' = estensione pari
% 'o' = estensione dispari... |
m=0.511*(10**6);
h=1973;
fact=(2*m)/(h**2);
e=3.795;
a=3;
E=12;
function dx=f(x,r)
e=3.795;
a=3;
dx(1)=x(2)
%dx(2)=fact*(((e*e*exp(-r/a))/r)+E)*x(1);
dx(2)=(0.27*E-(3.762/r)*exp(-r/a))*x(1);
endfunction
r=linspace(0.01,2,1000)
x=lsode("f",[0.01;1],r);
|
% Clear Command and Workspace Window
clc;clear;
% Player 1 Inputs code
i=0;
while i >= 0 % Allows infinite entries until an acceptable code is given
Player1Code= input('Enter 5 digit Code: ', 's');
% Change to Array
Digits_1= Player1Code - '0';
if length(Digits_1)~= 5
fprintf('Invalid number of ... |
clear all
close all
% Take user input for half-lives from file
fileName = input('Name of file containin half-lifes: ', 's');
readFile = fopen(fileName, 'r');
halfLifesXY = fscanf(readFile, '%f %f', [2, inf]);
fclose(readFile);
% The time array for years 1-50
time = 1:50;
% Counter for file names
counter = 1;
for hl=... |
function [result]=FindClusterMembers( data,nOfc )
[center,U,objFcn] = fcm(data,nOfc);
maxU = max(U);
index1 = find(U(1, :) == maxU)
index2 = find(U(2, :) == maxU)
if nOfc>=3
index3 = find(U(3, :) == maxU)
end
if nOfc>=4
index4 = find(U(4, :) == maxU);
end
i... |
function [Zmatrix, MOLCOORS] = RotInertia(coords, format, num_optFlags, molRot)
global ORG_STRUC
STDMOL = ORG_STRUC.STDMOL;
MOLCOORS = coords;
[a,b] = PrincipleAxis(coords); %find the principle roation axis
%b(1,1) =0 for linear chain molecules, thus two rotational variables
if abs(b(1,1)) < 0.0001
Ref = b(2,2)... |
function sgmga_weight_test ( dim_num, importance, level_weight, ...
level_max_min, level_max_max, rule, growth, np, p, tol )
%****************************************************************************80
%
%% SGMGA_WEIGHT_TEST checks the sum of the quadrature weights.
%
% Licensing:
%
% This code is distributed... |
function [tDense,tSparse] = hw4p8()
% timings for calculating x in the truss problem
% vectors for timings
tDense = zeros(1,10);
tSparse = zeros(1,10);
count = 1;
for k = 100:10:200
% calculate dimensions of the matrix: dimension = 8 * (k-1) + 13
d = 8 * (k-1) + 13;
% a = sin(pi/4)
alpha = sqrt(2)/2;... |
% cardiac cycle determination
function [pkloc, mbpfn, A, W,icaweights,icasphere] = cardperiod(input1,acqfrq,ECG_ind)
tic;
fprintf('Determining cardiac period ...\n');
input1.data = input1.data(setdiff(1:end, ECG_ind),:); %Shouold be changed for more than 31 channels
[A,W,icaweights,icasphere ] = ICA(i... |
% Clear workspace
clc;
% ========= SET LOGFILES =========
subjectID = input('Participant number: ');
DateTime = datestr(now,'yyyymmdd-HHMM');
if ~exist('Logfiles', 'dir')
mkdir('Logfiles');
end
%There will be two data files with different names:
resultname = fullfile('Logfiles', strcat('Sub',num2str(subjectID)... |
% Usage: C = CCT(I)
%
%The census transform (CT) is an image operator that associates to each
%pixel of a grayscale image a binary string, encoding whether the pixel has
%smaller intensity than each of its neighbours, one for each bit.
%
% Takes as input an image <I>, if I is a rgb image, transform I into a
% greyscal... |
function MATRIX_NUMBER_INFECTED = simplifiedSpreadingModel2(numHosts,numSteps,...
infectionStep,freezeStep,criteria,...
coreCriteria,randomSeed1,randomSeed2,outputPrefix, ...
num_neighbors, num_neighbors_keep, activeedgeProb)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Last Updated: 09/0... |
function [ Theta1, Theta2 ] = recoverThetas(Thetas, input_layer_size, hidden_layer_size, num_labels)
Theta1 = reshape(Thetas(1:hidden_layer_size * (input_layer_size + 1)), hidden_layer_size, (input_layer_size + 1));
Theta2 = reshape(Thetas(1 + (hidden_layer_size * (input_layer_size + 1)):end), num_labels, hidden_la... |
function [f,qm,im,info1,info2,info3,info4,info5,info6,ind]=fidread2(pfilename,seq,slc,frm,acqno)
% Usage ... [f,qm,im,info1,info2,info3,info4,info5,info6]=fidread(pfilename,seq,slice,frame,acquisition)
%
% Slice 1 Frame 0 is baseline (example, expect more)
% Note: there is frame 0 but not slice 0!
%
% For sf3d - slc... |
function [imu, avp, gps] = trjtxtfile(fname, imu, avp, gps)
% Create & load PSINS text-format TRJ file.
%
% Prototype: [imu, avp, gps] = trjtxtfile(fname, imu, avp, gps)
% Inputs: fname - file name for write
% imu - =[gyro,acc,t],
% avp - =[att,vn,pos,t],
% gps - =[vn,pos,t],
% Outputs: imu, av... |
function img_original = filtra_cor(path_img_original, cor)
%{
* Este script recebe um caminho de imagem, realiza a leitura
e seleciona um filtro de cor a escolha do usuário.
Input
:path_img_original: string - caminho para a imagem a ser transformada
:cor: string - R, G ou B, cor escolhida, as outras serã... |
function dispimg(im,range)
if nargin < 2
range(1) = min(0,min(im(:)));
range(2) = max(im(:));
end
imshow(im, [range(1), range(2)]);
end |
function filter_upd=PoissonMBMtarget_update_Gibbs(filter_pred,z,H,R,p_d,k,gating_threshold,intensity_clutter,Nhyp_max)
%Same file as the standard PMBM update file (PoissonMBMtarget_update.m) but using Gibbs sampling instead of Murty.
%Author: Angel F. Garcia-Fernandez
[Nz,Nx]=size(H);
Nprev_tracks=length(filter_pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.