text stringlengths 8 6.12M |
|---|
function varargout = icatb_mem_ica(sesInfo)
%% Calculate memory required for computing ICA.
%
precisionType = 'single';
%% Input parameters
voxels = 70000;
% Time points
time_points = 300;
% Number of subjects
numOfSub = 100;
% Number of sessions
numOfSess = 1;
% Data reduction steps
numDataReductionSteps = 2;
% Data... |
% Script for compiling all C files in this directory
%
% (c) Cedric Vonesch, 2007.02.13
mex DownSampleDim.c
mex UpSampleDim.c
mex FilterSep.c |
function f = localf(coords, U, ep)
% Function localJ computes the energy functional J over a single finite
% element triangle with vertices located at 'coords', using linear Lagrange
% basis elements.
G = [1,1,1;coords']\[0,0;1,0;0,1]; % Jacobian for integral transformation
T = det([1,1,1;coords'])/2; % Area of triang... |
clear
clc
a=imread('cameraman.tif');
b=edge(a,'sobel');
c=edge(a,'prewitt');
d=edge(a,'roberts');
e=edge(a,'canny');
subplot(2,3,1),imshow(a);
subplot(2,3,2),imshow(b),title('sobel');
subplot(2,3,3),imshow(c),title('prewitt');
subplot(2,3,4),imshow(d),title('roberts');
subplot(2,3,5),imshow(e),title('canny')... |
function plot_timeseries(this_network,solution)
%PLOT_TIMESERIES Plot a log-log dynamical timeseries, with
%species' abundances over time colored according to their guilds. The
%figure this function generates corresponds to the panels in Fig.
%S1.
%This function works for both multiplex
%networks (with rewards) and ... |
classdef small_loop
% Small loop antenna
% Created by: Lee A. Harrison
% On: 8/1/2018
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of... |
function BASELINE_STATS=stan_ephys_stats_baseline(EPHYS_DATA)
%
% stability analysis--baseline data
% first take all of the data from control
[options,dirs]=stan_preflight;
% collapse data into plot-able vectors
BASELINE_STATS.rms_corr={};
BASELINE_STATS.rms_mu={};
BASELINE_STATS.rms_var={};
BASELINE_STATS.spikes_co... |
%% ground truth values of each marker in world frame
p1_gnd = [10.563 2.483];
p2_gnd = [0 14.5];
p3_gnd = [-11.655 8.741];
p4_gnd = [0 -14.5];
p_gnd = [p1_gnd; p2_gnd; p3_gnd; p4_gnd];
alpha1 = acos((p2_gnd-p1_gnd)*(p4_gnd-p1_gnd)'/(norm(p2_gnd-p1_gnd)*norm(p4_gnd-p1_gnd)))*180/pi
alpha2 = acos((p3_gnd-p2_gnd)*(p1_gnd... |
%% ======================= Part 2: Plotting =======================
data = load('ex1data1.txt');
X = data(:, 1); y = data(:, 2);
m = length(y); % number of training examples
%% =================== Part 3: Cost and Gradient descent ===================
X = [ones(m, 1), data(:,1)]; % Add a column of ones to x
theta = ze... |
function [v] = Xd(t)
global R deltaR f phi
r = (R + deltaR*sin(20*pi*f*(t + phi)));
%r = R;
v = [ r.*cos(2*pi*f*(t + phi))
r.*sin(2*pi*f*(t + phi)) ];
%v = [t.*0 - 0.9848;t.*0 - 0.1736];
end |
%% Lithium Niobate (LiNbO_3)
% This equation is from Jundt, 15 October 1997
f = @(T) (T-24.5)/(T+570.82);
a1 = 5.35583;
a2 = 0.100473;
a3 = 0.20692;
a4 = 100;
a5 = 11.34927;
a6 = 1.5334e-2;
b1 = 4.629e-7;
b2 = 3.862e-8;
b3 = -0.89e-8;
b4 = 2.657e-5;
% this is accurate between T = [20,250] deg C, and lambda = [.4,5] ... |
indir = FP_PROC_FILE_DIR;
outdir = FP_PROC_GRAPH_DIR;
% Read annotated file for the subjects in this pipeline from disk
% Annotated file should contain time stamps for each relevant event (e.g.
% nose poke, light/dark transition, etc.)
annotatedfiledata = readcell(FP_ANNOTATED_FILENAME);
MDIR_DIRECTORY_NAME = outdir;... |
classdef sharedHHMM < handle
properties
% Two level heirarchal hidden markov model.
Qdim % number of high level states
Q % transition probabilities at highest level
Qpi0 % initial high level state distribution
dim % size of low level state space
A % A{i} is the tr... |
function s = CondPlot2D(x, y, data, varargin)
%This function plots the parameter space, and color codes the system to
%show where in parameter space the condition is met.
%
%The inputs x and y should be vectors containing the coordinates of
%each scatter plot point. They should be the same leng... |
%% 5.2 part a & b
clear all; clc; close all
% generate and plot bartlett windows of varying length N
N = [11 31 51];
figure
for nn = 1:length(N)
subplot(length(N),1,nn)
stem(-floor(N(nn)/2):floor(N(nn)/2),bartlett(N(nn)))
xlabel('n')
ylabel('w_B[n]')
title(sprintf('bartlett (N = %d)',N(nn)))
end
%... |
function HotBirdProp=burnup_slider_callback(~,~,hfig)
HotBirdProp=get(hfig,'userdata');
cn=HotBirdProp.cn;
slider_value = get(HotBirdProp.handles.burnup_slider,'Value');
if (slider_value > 0.4999 && slider_value <= HotBirdProp.cs.s(cn).Nburnup+0.4999)
HotBirdProp.cs.s(cn).point_nr=int16(slider_value);
if... |
function [ x,y ] = normalization( x,y )
% FInding the Center of Mass
com_x = sum(x)/size(x,1);
com_y = sum(y)/size(y,1);
% Shifting the Center of mass to origin and shifting
% all points according to Center of Mass
for i=1:size(x,1)
x(i,1) = x(i,1) - com_x;
y(i,1) = y(i,1) - com_y;
end
com_x = 0;
com_y =... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Lab 1: Image rectification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1. Applying image transformations
% ToDo: create the function "apply_H" that gets as input a homography and
% an image and returns ... |
%TRPLOT Draw a coordinate frame
%
% TRPLOT(T, OPTIONS) draws a 3D coordinate frame represented by the homogeneous
% transform T (4x4).
%
% H = TRPLOT(T, OPTIONS) as above but returns a handle.
%
% TRPLOT(H, T) moves the coordinate frame described by the handle H to
% the pose T (4x4).
%
% TRPLOT(R, OPTIONS) as above b... |
function [cumVisualPattern] = getVisualInput()
% this function generate cumulative input patterns for multiple objects
global p w;
visInput = nan(w.nItems, p.eyeRange);
%% generate visual input for every item
for i = 1 : w.nItems
visualCDF = normcdf((-p.eyeRad:p.eyeRad+1) - .5, w.vS.targPos(i),w.vS.sd(i));
% a... |
% INPUTS:
% ______Field_Name_________________________________Description_____________________________type____________
% | V | list of points in R^3, sampled from the surface | double |V| x 3 |
% | E | list of edges that connect pair of vetrices from V ... |
function X = so_fft2(x, No, scale)
% Computes and oversampled and scaled FFT2 with the scale factors
% precomputed from nufft_init
%
% in:
% x[:][:] - input image
% No[2] - overscale size
% scale[:] - scale parameters precomputed by nufft_init
%
% out:
% X[:] - FFT2 coefficients
% apply scaling f... |
%function map=asywei2map(weifile,distfile,mapfile)
%
% Creates an ASYWEI-map from input file with weights for each asytyp
%
% Input:
% weifile - Input file with assembly weights for each asytyp
% distfile - Distfile to be used when reading the asytyp map
%
% Output:
% mapfile - Output file with the created ASYWEI-... |
function example_sel2html(fn)
%Convert Dick Benson's example_sel text files to HTML documents
if nargin < 1
fn = 'example_sel.txt';
end
f = textread(fn,'%s','delimiter','\n','whitespace','');
ln = [];
for n = 1:length(f)
[st1,fn1,tk1] = regexp(f{n},'^([^\$]*)');
[st2,fn2,tk2] = regexp(f{n},'\$(... |
%% Import Medicago model
% Import model with the script of Thomas Pfau
model = importMedicago();
% Set all bounds to 1000000 and -1000000
for n = 1:length(model.lb)
if model.lb(n) <= -1000;
model.lb(n) = -1000000;
end
if model.ub(n) >= 1000;
model.ub(n) = 1000000;
end
en... |
% Vytvoři dva nezávislé náhodné signály x1 a x2
% konečné délky d=20 vzorků.
% Z diferenčních rovnic vypočte výstupní odezvu čtyř diskretnich
% systémů pro oba náhodné vstupní signály a jejich součet :
% 1. y[n]=3/4*x[n]-1/4*y[n-1] a počáteční podmínka y[0]=0.
% 2. y[n]=3*x[n]-4.
% 3. y[n]=x[n]^2.
% 4. y[n]=2*x[n]-1/... |
%% 限定不满意度,最后考虑效率
clear
global PD car L o fai2 N M Yt
l = 0.1;
E1 = -120^0.88;
E2 = 2.25*360^0.88;
o = l*E2;
fai2 = -o/120^0.88+2.25;
PD = importdata('排污矩阵.txt');
load car
L = length(car);
%% 得到一个局部最优的不满意度
init_y = inf;
for i = 1:5
options = optimoptions('ga','PopulationSize',600,'MaxGenerations',100);
[x,y,~,... |
function [rdt_eff nt_last_eff]=a_bdf_nt(ntold,rdt,rdtold);
% uold=[previous pre-previous]
% rdt=[current last] reciprocal timestep
if rdt > 0 && rdtold <= 0
% solution at the previous timestep is known
% O(dt)
rdt_eff=rdt;
nt_last_eff=ntold(1,:);
elseif rdt > 0 && rdtold > 0
% solut... |
close all
figure('name', 'ex3')
Hf1=tf([1],[1 0]);
Hf2=tf([1],[1 2]);
Hr=1;
Hw0=feedback(series(Hf1,series(Hf2,Hr)),1);
Hp10=-feedback(series(Hf1,Hf2),Hr);
Hp20=-feedback(Hf2,series(Hr,Hf1));
t=0:0.1:12;
yw=step(Hw0,t);
yp1=step(Hp10,t);
yp2=step(Hp20,t);
yt=yw+yp1+yp2;
plot(t,yt) |
disp(['===============> Getting parameters, mex-c code, and training images']);
mkdir('working'); % working directory to store .mat files.
mkdir('output'); % directory that contains output from the code.
%% parameters for the outer square bounding box
category = '1';
supressionModeInEStep = 'MatchingPursuit'; % mat... |
% http://www.eeprogrammer.com/tutorials/Matlab/discriminant_analyses.html
a = 5*[randn(500,1)+5, randn(500,1)+5];
b = 5*[randn(500,1)+5, randn(500,1)-5];
c = 5*[randn(500,1)-5, randn(500,1)+5];
d = 5*[randn(500,1)-5, randn(500,1)-5];
e = 5*[randn(500,1), randn(500,1)];
Group_X = [a;b;c];
Group_Y = [d;e];
All_data = [... |
function y = HaarReconStep(x, len, normalization)
% y = HaarReconStep(x, len, normalization) does one step of a Haar wavelet
% reconstruction on the first len elements of x, with normalization either
% 'max' or 'L2'.
if strcmp(normalization, 'L2')
factor = sqrt(2)/2;
else
factor = 1;
end;
y = x;
y(1:2:len-1) = (... |
%% Test 1: Testing ordering of multiple nonlinear with price
display '********************** Test 1 *************************'
endog = false;
for tst = 0:1
m = SimMarket();
m.demand = RCDemand;
m.demand.settings.ces = true;
m.demand.config.compiled = false;
m.demand.settings.drawmethod = 'quadrature';
m.demand.confi... |
function dz = backprop(dn,j,z,n,param)
%NETPROD.BACKPROP Propagate derivates from net input back to weighted input
% Copyright 2012-2015 The MathWorks, Inc.
if length(z) == 1
dz = dn;
else
zj = z{j};
if all(zj(:) ~= 0)
dz = bsxfun(@times,dn,bsxfun(@rdivide,n,zj));
else
d = 1;
f... |
function xcorr_slope_sampling(data)
%-------------------------------------------------------------------------
%Author: TROD
%Date modified: 18/02/2020
%
%Description:
%
%find minimum between signal and tail oscilation to use as reference
%-------------------------------------------------------------------------
%SIGN... |
fromJava(toJava(7))
fromJava(toJava(7:10))
fromJava(toJava('hello'))
fromJava(toJava([]))
fromJava(toJava({'hello' 7}))
fromJava(toJava({}))
fromJava(toJava(struct('x',3,'y',4)))
|
function [ prelabels ] = knn_predictor( train_data, train_label, new_data,K)
%normalization
for feature = 1:length(train_data(1,:))
train_data(:,feature) = (train_data(:,feature) - mean(train_data(:,feature)))/var(train_data(:,feature));
end
for feature = 1:length(new_data(1,:))
new_data(:,feature) = (new_data(... |
function table = bez_first_mnzeros(m,num_zeros)
%This functions creates a matrix that holds up to the nth zero of a bessel
%function of the first kind up to the m'th order.
bzero=[];
table=[];
%m=5;
num_zeros=num_zeros+1; %number of zeros I want
x=0:.0001:5*num_zeros; %vector for the Bessel function operat... |
clear;
clc;
warning('off','all');
M=6;
clear theta_minus theta_plus betta XX
global theta_minus theta_plus betta XX
%tF=[0 1 1.0001 8 8.001 20];
%Fext=[0 0 50 50 0 0];
%tF= [0 0.2 0.2001 0.5 0.5001 20];
%Fext=[0 0 10 10 10 10];
tF=[0 100];
Fext=[0 0];
fix=open('fixedpointforfivelink/fixed_p... |
function [y,h] = decdc(x,df,n)
%
% [y,h] = decdc(x,df,[n])
% D.C. accurate decimation by a factor of df. Use this instead
% of decimate(x,df) when d.c. accuracy is important. x may be
% a matrix, in which case each column is decimated separately.
% Optional argument n specifies the decimation filter... |
function fct_plot_f_under_trace(model,grid_trace_index)
% For each trace, 10 measures on each sides are modified to go smoothly to
% zero on boundaries of the trace. The "usefuel points" are the number of
% measures that are not modified. Then, the spectrum along this trace is
% computed and weighted by the number of "... |
function comic_strip_cutting(folder_in,folder_out)
mkdir(folder_out)
allpageList = dir(folder_in);
for ii=1:length(allpageList)-2
page = allpageList(ii+2);
page_path = fullfile(page.folder,page.name);
page_cutting(page_path,folder_out,0);
disp(cat(2,'Page ',num2str(ii),' sur ',num2str(length(allpageList... |
% Andrew Brown Homework 5 Problem 3
clc
clear
close all
% Epidemic Part 5: Practicing plotting with fzero and functions while
% finding the maximum number of people ifected in an epidemic
%Initial Values
a=10; %the contact rate: the average # of people a person comes in contact with.
b=1.25; %the amount of time in d... |
function [Y0q,X1q] = py1enc_q_mse(X,r)
[Y0,X1] = py1enc(X);
Y0q = quantise(Y0,r);
r = round(r/sqrt(1.1963));
X1q = quantise(X1,r);
% Y0q = quantise(Y0,r);
% r = round(r/sqrt(2.25));
% X1q = quantise(X1,r); |
%% Determin the external cash shock size
n = 40;
fre = 14/365;
aver = n/10;
para = [0, 0.01216];
dt = 1/365;
timer = exprnd(fre);
m = 1e6;
cash_sample = zeros(m, n);
for i=1:m
cash = ones(1, n);
for l=1:183
timer = timer - dt;
while timer<0
% number of... |
%% Writing Returned Values to .csv
%Writing Returned Values to .csv
filename = '~/Desktop/Theo_K./Central Intel Code/Supply_Output.csv';
c0 = {'Product (SKU)','Time-Step','Location (1)', 'Location (2)'};
% c = {{'Product (SKU)','Time-Step','Location','Amount Held-Over'};
% {'Product (SKU)','Time-Step','Location','A... |
%% 孔管扫频扫频
function pressure = innerOrificTankFrequencyResponse(varargin)
pp = varargin;
responseType = 'n';%响应类型:m M序列 n:理想冲击,r,高斯随机信号
%% 数据路径
param.isOpening = 0;%管道闭口%rpm = 300;outDensity = 1.9167;multFre=[10,20,30];%环境25度绝热压缩到0.2MPaG的温度对应密度
param.rpm = 420;
param.outDensity = 1.5608;
param.acousticVelocity = 345;%声... |
function [CDi] = InducedDrag(gamma, geo, panel)
%Calculate far field induced drag
%The following code is derived from James A. Blackwell, Numerical Method to
%Calculate the Induced Drag or Optimum Loading for Arbitrary Non-Planar
%Aircraft, NASA SP-405, May 1976
%Determine the normal force coefficient for each... |
function [output] = perform_MASS_measurement()
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
output = rand(0, 100);
end
|
% creates an A note using function from 3.1
A_ = [44100, 2, 44];
[A,N] = lab1_3_1(A_(1), A_(2), A_(3));
sound(A,A_(1));
|
function [point, valid] = LS_triangulateCircles(centers, radii, threshold)
point = [0, 0];
enought_dofs = centers;
dm = distanceMatrix(centers, radii);
to_eliminate = [];
for i=1:size(centers, 1)
for j=(i+1):size(centers, 1)
% these two circles are too similar
... |
clc;
close all;
clearvars;
k=input('Enter the value of bits of your information block:');
K=3;
u_tmp=randi(2,1,k)-1; %only when P(X=1)=P(X=0)=0.5
u=[u_tmp zeros(1,K-1)]; % u is our information block
disp('YOUR INFORMATION BLOCK :');
disp(u);
ENCODER_OUTPUT=zeros(1,2*(k+K-1)); %a vector which have variable s... |
function [fTP,phi] = getTP(formula, args, k)
global W Wtotal Z bigM;
if length(args) ~= 2
disp('Missing argument');
asset(length(args)==2);
end
% number of agents
N = length(W);
% time horizon
h = size(W{1},2)-1;
[fTP, z] = getLTL(args{1},k);
phi = getZ(formula,h,1);
phi = phi(k);
fTP = [fTP, sum(z) >= arg... |
function t=transformare(a)
i=1;t=zeros(0);
while a
t=[mod(a,10) t];
a=floor(a/10);
i++;
endwhile
endfunction
|
function [binary_image_G]=binary_image_gaussian(binary_image,sigma)
image_8bit=binary_image*255; % convert image to double
image_8bit_gaussian=imgaussfilt3(image_8bit,sigma); % gnerate gaussian filtered image with sigma of 2
binary_image_G=image_8bit_gaussian>0; % convert back to binary |
function spikePlot(fname)
%function spikePlot(filename)
%
% Takes as input a filename string, then plots the spike image
%
% Currenly setup to work for the Uprobe
%fname = '/Users/masmith/Desktop/Wi131008_s119au1_dirmem_0001.nev';
file = {fname};
uprobechan = 257:2:287;
global WaveformInfo;
global FileInfo;
colors ... |
%{
% Expriment with N threshold values between a and b
% Configurations:
% * filename, a, b, N (line #14-18)
% * thresholding criteria (line#46)
% Output: one mask per experimental threshold
%}
% Clear history
clc;
clear all;
close all;
% Configurations
filename = 'images/round2.5/one_dl/n2/pixel/Zoomed/1.jpg';
a... |
function [a1,a2] = Subproblems4(p,q1,q2,d1,d2,r,w1,w2)
%欧阳俊源@2020/04/14
%思路:先寻找q,然后用子问题2求解。
%p:初始点
%q1:距离q1点d1距离
%q2:距离q2点d2距离
%r:两轴交点
%w1\w2:先绕w2转,再绕w1转。
q=sphere3itrsect([r';q1';q2'],[norm(p-r),d1,d2]);
[a1,a2]=Subproblems2(p,q,r,w1,w2);
end
|
%运动学建模得到T70
%function Solution=kinematic_model(q)
q=[0 0 0 0 0 0 0 ];
m=6;
n=7;
Tn0=GetTnm(q,m,n)
%Solution=Tnm;
|
function [fullPaths, subNames] = subdirs(directory, subdirs2ignore)
% SUBDIRS(directory, subdirs2ignore)
%
%
% NPMitchell 2020
% Unpack options
% choice: always ignore default hidden directories
if nargin > 1
subdirs2ig = {'.', '..'} ;
for qq = 1:length(subdirs2ignore)
subdirs2ig{length(subdirs2ig)+1} ... |
function [Rx Cy]=fun_CalCentriodSeedfilled3(I)
% h=figure();imagesc(I);colormap(gray);axis('off');
[m n]=size(I);
mask=zeros(m,n);
mask(fix(m/2)+1,fix(n/2)+1)=1;
seedList=zeros(2*(m+n),2);
seedList(1,:)=[fix(m/2)+1,fix(n/2)+1];
corDW=1;
%----------------------------------------------------------... |
close all % Close all open figures
clear % Reset variables
clc % Clear the command window
%LTEV2Vsim('help');
%% LTE Autonomous (3GPP Mode 4) - on a subframe basis
% Autonomous allocation algorithm defined in 3GPP standard
%density = [200, 400, 600, 800];
density = 200;
for i = 1:length(density)
... |
clear all; clc
delete(instrfindall);
s = serial('COM6');
set(s,'BaudRate',9600,'InputBufferSize',10000);
fopen(s);
data = zeros(1,5000);
count = 0; miss = 0;
while (1)
%flushinput(s);
while(s.BytesAvailable)
test = fscanf(s, '%c', 1);
if (test == 'a')
disp('a detected')... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Importance Sampling - Parallel Dynamic Programming (IS-PDP) Toolbox
%
% This toolbox purpose is to solve the curse of dimensionality of multi-reservoir
% impoundment operation, in an example of three-reservoir system (Li-Yuan,A-hai,
%... |
% Save NIFTI dataset. Support both *.nii and *.hdr/*.img file extension.
% If file extension is not provided, *.hdr/*.img will be used as default.
%
% Usage: save_nii(nii, filename, [old_RGB])
%
% nii.hdr - struct with NIFTI header fields (from load_nii.m or make_nii.m)
%
% nii.img - 3D (or 4D) matrix o... |
function score = scoreFeatures(x, y)
THREE = 3;
EIGHT = 8;
score = zeros(size(x, 1), size(x, 2));
% loop over all feature pixels of a digit image
for i=1:size(x,1) % size(x) = 28x28x1x200
for j=1:size(x,2) % size(y) = 1:200
% get indexes of data x splitting by its value of 0, 1
ind_NO = x(... |
function y=Recursive_powering(x,n)
% Computing x^n,where n is integer and n >= 0
% It reduces the running time from ¦È(n) to ¦È(lgn)
if (n == 0) % special case
y=1;
return
elseif (n == 1); % base case
y=x;
return
end
if (mod(n,2) == 0) % if n is even
mid=n/2;
r=Recursive_powering(x,m... |
function [Sol,Sol_Vel,Sol_P,VV,VP,PV,PP,J] = solve_stokes(A,M,rhs,nel_x, nel_y, nel_z)
% Jacobian
J = A;% - M;
% total number of velocity nodes in the mesh
n_velx = (nel_x+1)*nel_y*nel_z;
n_vely = (nel_y+1)*nel_x*nel_z;
n_velz = (nel_z+1)*nel_x*nel_y;
n_vel = n_velx + n_vely + n_velz; % total number of all velocity... |
function [ Counter ] = ccm_create_counter( N, Nonce )
Flag_Counter(1:8) = 0;
%----Creare N vector------------------------------------
N_bin = dec2bin(N, 20); %переход к двоичному числу
for i = 1:20
N(i) = str2num(N_bin(i)); %получение массива N
end
Counter = [Flag_Counter Nonce N];
end
|
function isoct = isoctave()
%Michael Hirsch
% tested with Octave 3.6-4.0 and Matlab R2012a-R2016a
persistent oct;
if isempty(oct)
oct = exist('OCTAVE_VERSION', 'builtin') == 5;
end
isoct=oct; % has to be a separate line/variable for matlab
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function edgePot = computeBoundaryEdgePotentials(boundaries, junction2BoundaryInd, varargin)
% Computes pairwise potentials for the CRF.
%
% Input parameters:
% - boundaries: image boundaries
% - junction2BoundaryInd: mapping between junctio... |
%% hemiSphereCylMesh
% Below is a demonstration of the features of the |hemiSphereCylMesh| function
%%
clear; close all; clc;
%% Plot settings
figColor='w'; figColorDef='white';
fontSize=8;
faceAlpha=1;
lineWidth=1;
markerSize1=10;
%% CONTROL PARAMETERS
S1.sphereRadius=3; %Sphere radius
S1.nRefine=2;... |
% filename = 'H:\21-12-16_MouseExp\211216_002_processed_Layer2_3.mat';
% close all
% load(filename)
% for m = 1:2
% for n = 1:size(movementData.targetPosition,1)
% if abs(movementData.targetPosition(n,m)) > 2
% movementData.targetPosition(n,m) = movementData.targetPosition(n-1,m);
% ... |
function drawDev(rrt_sample_t, tree, index)
hold on
figure(3)
for i=2:size(tree,2)
parent = tree(i).parent ;
currentDev=tree(i).y(index)-getNominalValue(rrt_sample_t, index, tree(i).t);
parrentDev=tree(parent).y(index) - getNominalValue( rrt_sample_t, index, tree(parent).t);
... |
function [pulse , MUDDAT, MUDPIX] = retrieve_pulse_MUD( cam, s, gPhi, scanResolution, lam )
%Called by MUD_main, this function does everything with the
%stage and camera. It takes in the camera object, stage object, and the
%reference phase, and it outputs the pulse, and the spectra/phase/image of
%each picture taken b... |
function bunch_cleaner_scraper
bclean_offset_start = getpv('bcleanPatternOffset');
b = zeros(1,328);
b(298:318) = 1;
setpv('bcleanSetPattern', b);
disp('Setting a wider bunch cleaning pattern for pseudo-scraping');
disp('Turn on bunch cleaner manually to remove bunches')
while 1
sprintf('DCCT = %.1d\n',getdcct... |
function varargout = collocation_interpolators(varargin)
%COLLOCATION_INTERPOLATORS Obtain collocation interpolating matrices.
%
% [{[double]} OUTPUT, [double] OUTPUT] = COLLOCATION_INTERPOLATORS([double] tau)
%
%
%A collocation method poses a polynomial Pi that interpolates exactly through
... |
%% P1.2
DBfile = 'SandiaModuleDatabase_20120925.xlsx';
Module = pvl_sapmmoduledb(169, DBfile);
MS=28; % #module in series
MP=17; % # number of parallel strings
Tamb=weather.DryBulb;
windspeed=weather.WindSpeed;
a=Module.a_wind;
b=Module.b_wind;
deltaT=Module.delT;
E0=1000;
SF=.98;
F1=max(0,polyval(Module.a,AM));... |
function translation = translateGroup(vector)
% translateGroup - given a vector, return a function that
% translates a group according to that vector.
% inputs:
% vector - the vector to translate every particle in the group
% by.
% outputs:
% translation - a function which represents a translation by the
% gi... |
function [t,r,l,B]=myccf(c,lag,flag1,flag2,cor)
% [t,r,l,B]=myccf(c,lag,flag1,flag2,cor) returns the auto-correlation or cross-correlation
% function depending on the signals in the matrix c (c1=c(:,1); c2=c(:,2)).
%
% On entry
% c - signal vector or matrix.
% lag - scalar (positive number).
% flag1 - the ccf a... |
function [rep,opt,UseDefault] = parseAgentInputs(Arguments,OptionsClass,DefaultOptions)
% validate RL agent inputs are representations and valid options
% Copyright 2018 The MathWorks, Inc.
% representation check
rep = Arguments(cellfun(@(x) isa(x,'rl.util.rlAbstractRepresentation'),Arguments));
if isempty(rep)
e... |
clear all; close all;
addpath('utils');
%% Motion interpolation demo
opt.application = 'motion';
opt.dataset = 'temple_3'; % try 'alley_1', 'ambush_5', 'temple_3'
opt.layerNum = 3;
opt.param.FGS1_SIGMA = 0.005;
opt.param.FGS1_LAMDA = 30;
opt.param.FGS2_SIGMA = 0.005;
opt.param.FGS2_LAMDA = 5; % try to adjust to co... |
function [correct_cell,maxspeedF,data] = problem_correct_eastwest(qstar_1D,qeast_1D,qwest_1D,data,cellcenter,iv1)
correct_cell = 0;
v1quad = 1;
vectpsi_east = data.vectpsi_east;
vectpsi_west = data.vectpsi_west;
vectpsi = data.vectpsi;
vectphi_east_Trans = data.vectphi_east_Trans;
vectphi_west_Trans = data.vectphi_w... |
%%
%
%
%
clear variables;
parentDir = '~/git/psychophys/rsvp';
%%
cd(parentDir);
figure(1); clf; hold on;
for iSpacing = 1: 2 % 1 unspaced, 2 spaced
if iSpacing == 1
intensities = [.05 .1 .15 .2 .25];
pCorrect = [.5 .6 .7 .85 1];
pBest.t = .16;
pBest.b = 3.5;
else
p... |
function [tempV,tempR,tempEigVec,tempZ,regionIndex,keyPtLocIndex]=getRegionSysMatInner(nodeIDoutRectCoarse,allMesReg,V,R,eigVec,zt,iMnp)
%
% nodeIDoutRectcoarse = no of nodes X no of regions matrix, with ones
% to represent the key points belonging to a region,
% ... |
function fig = simDACgui()
% (c) jjwikner,MERC
% This should be a file containing the data.
% load DACdatavector DACdatavector
% Further on it will be types (hence fprintf...)
% Typically: set(DACdata,'unit impedance',1e-12) etc.
%%
%% DACdatavector = ...
%% [0.1e-18; ... % Gunit = unit conductance
%% ... |
function param_selec = sequentialSearch(XTrain,YTrain,conf,XValid,YValid)
% Cell array of free parameters
value_range = conf.machine.value_range;
nparams = length(value_range);
params = cell(nparams,1);
lp = zeros(nparams,1);
for ip = 1:nparams
params{ip} = value_range{ip}(1);
lp(ip) = length(value_range{ip});... |
%%Bode,Nyquist and Root Locus
sys=tf([-2 -1],[1 5 3])
figure(1)
pzmap(sys)
grid
fogure(2)
margin(sys)
[Gm,Pm,Wcg,Wcp]=margin(sys)
grid
figure(3)
nyquist(sys)
grid
figure(4)
rlocus(sys)
grid
figure(5)
step(sys)
grid
stepinfo(sys) |
% ns_izh2D.m
clear
close all
clc
global a b c d vpeak I uF vF dt
% CONSTANTS
a = -0.02; b = -1; c = -60; d = 8; vpeak = 30; I = 80;
% a = 0.2; b = 2; c = -56; d = -16; vpeak = 30; I= -108;
D11 = 0.1; D22 = 0.1;
% SETUP
% Grid
xMax = 1;
N = 100;
xG = linspace(0,xMax,N);
... |
%% CONTINUE FROM RAW
% Check if a raw file exist
if exist(par.SAVENAME_RAW,'file') && ~(par.mode==2 && exist([par.SAVENAME_RAW,'prec'],'file'))
load_raw=true; % Set as true, flip to false if parameters do not match
raw=load(par.SAVENAME_RAW);
% First check if the mode is consistent
... |
function p23=p23(h)
sldata;
limitpoints;
slopes;
p2=p1*(T2/T1)^(-g/(m12*R));
p23=p2*exp(-g*(h-h2)/(R*T2)); |
function [localToWorldMatrix] = localToWorld(normVector, planeBasis, centroid)
%LOCALTOWORLD Creates transform from reference space centerd around the
%plane back to the world coordinates.
% X and Y map to the plane basis. Z is the plane normal. Transform is the
% centroid, and then it is converted to accept homogenou... |
function setColorSwitch(csArray)
global trackingParams;
cs1 = sum(bitshift(csArray(1:4),[0 2 4 6]));
cs2 = sum(bitshift(csArray(5:8),[0 2 4 6]));
trackingParams.colorSwitch = [cs1,cs2];
|
function BreakOutTherapy(PAT_STRUCT,vargin)
if isempty(vargin) %want histogram
[RX_vals RX_inds]=PatientStructHelper(PAT_STRUCT,{'RX_vals','explodeNumeric'});
RX_names=PAT_STRUCT{1}.RX_names;
uni_therapies=unique(RX_vals(:,2:20),'rows');
[num_entries junk]=size(RX_vals);
[num_therapies ... |
function [ X, Y ] = generateClusters(centers, counts, labels)
X = [];
Y = [];
D = size(centers, 2);
for index = 1:size(centers, 1)
% Generate random samples
%X_a = random('normal', 0, 1, counts(index), D); % Octave
X_a = normrnd(0, 1, counts(index), D);
X_a = round(X_a * 10);
shift = center... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title: EGR 534 LE 6 Exercise 3
% Filename: Tipton_EGR534_LE3_ex3.m
% Author: Natalie Tipton
% Class: EGR 534
% Date: 10/29/19
% Instructor: Dr. Rhodes
% Description: This script finds and plots the FFT and Power of ECG data
%%%%%%%%%%%%%... |
function [ finalind , finalfitness ] = localsearch( data, ind ,labels, type )
%LOCALSEARCH Summary of this function goes here
% Detailed explanation goes here
minfitness = Fitness(data,ind.clusters',labels,type);
for i = 1 : size(ind.clusters,2)
currentind = ind.clusters;
... |
function Vd = voldif(R,n)
%voldif
% this function takes the radius R and the dimensionality n as input,
% and returns the difference between the volumes of
% the hypercube and hypersphere, Vd
%
% USAGE:
% Vd = voldif(R, n)
%
% INPUT
% - R: Radius (non-negative decimal number)
% - n: D... |
function plotPath(a)
hold off;
%vl, vr in cm/s
vl = 6.5;
vr = 6.5;
d = 5.5; %cm
vl = vl + a;
vr = vr - a;
v = (vl + vr)/2;
w = (vl - vr)/d;
for t=0:0.1:100
x = v/w*cos(w*t) - v/w;
y = v/w*sin(w*t);
plot(x,y,'-r');
hold on;
end
vl = vl + a*0.5;
vr = vr - a*0.5;
v = (vl + vr)/2;
w = (vl - vr)/d;
f... |
function [ntc_id,long_nom,adm,ntc_type] = retrieve_ntc_id(conn,satName)
%%
%Accessing table com_el to find SatName ntc_id
tablename = 'com_el';
%selectquery = ['SELECT ntc_id,sat_name,long_nom,f_active FROM ' tablename ' WHERE ' 'sat_name=' satName];
selectquery = ['SELECT ntc_id,adm,sat_name,long_nom,ntf_rsn,d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.