text stringlengths 8 6.12M |
|---|
% backtracking to find sufficient step size alpha to use in inexact
% line search where we achieve a sufficient decrease in f at minimal cost
% INPUT
% alpha - initial step size
% x - the multi-dimensional point we're currently at
% p - the direction/dimension we wanna take a step in
% f — our function
% G - the gr... |
% CB05_AllRxns.m
% generated from CB05_AllRxns.txt
% # of species = 53
% # of reactions = 156
% For more information, please see CB05 Final Report (Yarwood et al.)
% or CAMx User's Guide, Appendix C.
% NOTE: CB05 species "O" renamed "O3P"
%
% 20150618 MM First build.
% 20160131 GMW Checked against documenta... |
clc
clear all
close all
N = 1024 ;
T = 1 %sample time
e= randn([N,1]) ;
%%
periodog = periodogram(e) ;
omega = [] ;
for i = 1:(N/2+1)
omega(i,1) = 2*pi*(i-1)/N ;
end
figure(1)
loglog(omega, periodog)
%%
P = tf(1,[1 -0.9 0.5]) ;
k = [0:1:N-1];
ts = T/N ;
kts = k*ts ;
for i = 1:(N)
omega(i,1) = 2*pi*(i-1)/N ... |
function [appInteg]= myIntegWithFuncHandle(func,limVec,n)
%Function file: myIntegWithFuncHandle.m
%
%Purpose:
% Calculate approximate integral of function specified in func
% between the lower/upper limits specified in limVec using n
% rectangles
%
%Record of revisions (Date | Programmer | Change):
% 2/8/16 | ... |
% draw_mql Renders an MQL creatrure
%
% Input:
% Most arguments are angles which are descretized into num_angles and thus
% ar represented by an integer between 1 and num_angles. The number of
% possible angles, num_angles, must be odd, and the unique central index
% corresponds to the bisector (e.g.... |
function d = dg_means2(x,y)
% DG_MEANS2 - Distancia intergrupos = distancia media ponderada entre las medias de los 2 grupos
% Se puede utilizar tambien como distancia de un punto a un grupo.
%
% d = dg_means2(x,y)
%
% x = conjunto de patrones del grupo 1 (por columnas)
% y = conjunto de p... |
function [weights, classes] = lgTrain(X, labels, lambda = 0, maxIters = 400)
%lgTrain Train a set of one-vs-many classifiers
% [weights classes] = lgTrain(X, labels, lambda, maxIters)
% Train a set of one-vs-many classifiers using logistic regression
% X a matrix of data points, expressed as a row vectors
%... |
%function demoHolmes
import brml.*
[b a w g]=assign(1:4); % Variable order is arbitary
t=1; f=2; % define states, starting from 1.
var(b).name='b'; var(b).domain={'t','f'};
var(a).name='a';var(a).domain={'t','f'};
var(w).name='w';var(w).domain={'t','f'};
var(g).name='g';var(g).domain={'t','f'};
pot{b}=array(b);
pot{b... |
function [ax] = fn_min_white_space(orig)
% Minimize the white space on a figure
% INPUTS:
% orig [figure axis] - origianl figure axis
% OUTPUTS:
% ax [figure axis] - adjusted figure axis
ax = orig;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width ... |
%% Blinn-Phong MRDF Plots
% (Similar to Blinn_Phong_Plotter, but with different slightly different
% functions)
%
% Here I and V are taken to be the same, so the dot(N,I) = dot(N,V) in the
% Blinn-Phong BRDF. In the following set-up, N is still [0;1] but I = V
% range for theta from 0 to pi.
N = [0;1]; % Fixed norma... |
function Colors = load_colors()
colors = {'sucrose',[1 0.65 0.1];
'maltodextrin',[.9 0.3 .9];
'water',[0.00 0.75 0.75];
'total',[0.3 0.1 0.8];
'exc',[0 113/255 188/255];
'inh',[240/255 0 50/255];
'NAc',[0.5 0.1 0.8];
'VP',[0.3 0.7 0.1];
'block1',[143 158 173]/255; ... |
clear all;
%load('mat/agg_ridge_CV_us=1_glm=9_theory.mat');
%load('mat/agg_ridge_CV_us=1_glm=9_subsample=1_theory.mat');
%load('mat/agg_ridge_CV_us=1_glm=9_model=EMPA_theory_subsample=0_project=1.mat');
%load('mat/agg_ridge_CV_us=1_glm=1_model=EMPA_theory_subsample=0_project=1.mat');
%load('mat/agg_ridge_CV_us=1_glm... |
function GPSReceiverHandle=openGPS(portNumber,BaudRate)
% OPENGPS Opens up a port in order to read NMEA sentences from GPS
% Receiver
%
% Usage:
% openGPS() will automatically scans and opens port which sends NMEA sentences
% openGPS(portNumber, BaudRate): opens a port defined with
% portNumber,BaudRate p... |
function example(mode)
% handle input
if (nargin<1) || isempty(mode)
mode='A';
end
% data points
tic;
x=[0 0.5 1];
switch mode
case 'A'
y=[0 0.5 0.9];
dy=repmat(0.1,size(y));
case 'B'
y=[0 0.5 0.2];
dy=[0.1 0.1 1];
case 'C'
y=[0 0.5 0.2];
dy=[0.1 0.1 0.5... |
clear;
load('e1_two_stage_2602_fai.5.mat');
load('e2_two_stage_2602_fai.5.mat');
%load('con_e1_two_stage_2502_fai.5.mat');
%load('con_e2_two_stage_2502_fai.5.mat');
f_f=.1:.1:.9;
area=0.1:.1:.4;
m1=0.1:.1:.9;
fai=0.5;
parameter_initialization_two_stage;
c_d0=35;%600;
c_f0=.1;
o_p_power=.5*van_coe*(c_d0-c_f0);%/10^5;
... |
function header=ECAT_writeHeaderInt4(header, byteN, value);
%
% Writes a int*4 number to the Nth byte (byteN) in ECAT header/subHeader.
%
% function ECAT_writeHeaderReal( subHeader, byteN);
%
% Inputs:
%
% header - subHeader/mainHeader in uint8 matrix 512*1 or 1024*1
% byteN - byte ... |
%%
% This is an example of how to create a mesh plot from a function in MATLAB®.
%
% Read about the <http://www.mathworks.com/help/matlab/ref/ezmesh.html |ezmesh|> function in the MATLAB documentation.
%
% For more examples, go to <http://www.mathworks.com/discovery/gallery.html MATLAB Plot Gallery>
%
% Copyright... |
clc; clear variables; close all;
N = 1e6; % number of channel tap
ncluster = 5:40; % number of cluster (number of user = 2K)
NN = 256; % number of information bit
N1 = NN;
N2 = NN;
NNN = 10000; % number of Monte Carlo
Pt = 30; %Transmit Power in dBm
pt = (10^-3)*db2pow(Pt); %Transmit Power (li... |
function [datamat,idx]=get_datamat(data,field)
[idx,~]=find_field_idx(data,(deblank(field)));
datamat=get_subdatamat(data,[],[],'field',field);
end |
function [processed_source, W, E] = PCA(source, toNormalize)
%% PCA
if nargin < 2
toNormalize = true;
end
N = size(source, 2);
% Centering
processed_source = source - (mean(source')')*ones(1, N);
% figure;
% equal_plot(processed_source);
% title('Centered mixed signal', 'FontSize', 20);
% Variance normalization
i... |
function segIds = getSegmentIdsOfNodes(param, coords, nhood)
% GETSEGMENTIDS
% Gets the global segment IDs for each of the points
% specified in coords.
%
% IMPORTANT
% In contrast to getSkelSegmentIDs, this function is
% ready to be used with the pipeline repository!
%
% par... |
function send_mail(recipients, subject, mail_message, attachments)
% send_mail sends a mail message through Gmail
% function send_mail(subject, recipients, mail_message, attachments)
% input arguments:
% subject: A string - subject of the mail
% recipents: A cell array of strings - Email addresses of recipients
% ... |
% Written by Jeremy Gam (jgam@mit.edu)
% This is used to analyze FCS files for miRNA sensor data by binning,
% fitting model to the data to get M and Km, and plotting if necessary
%% Clear items
clear all
close all
clc
addpath('path/to/other/m-files')
%% Define parameters
FCS_dir = 'path/to/FCS/files'; %Dir with o... |
function [pass,maxerr] = test(opt)
% Check that various argument combinations work
V0 = 1:100;
V0 = V0(:);
ph = pi/4;
V = V0.*exp(1i*ph);
Vout1 = correctphase(V);
Vout2 = correctphase(V,ph);
Vout3 = correctphase(V,ph,false);
thr = 1e-10;
pass(1) = all(abs(Vout1 - V0) < thr);
pass(2) = all(abs(Vout2 - V0) < thr);
pa... |
% MLLTFNC.M
% For name of ASCII file of test pulse
% Called by mlllm.m
if mllsfnv == 1 ;
set(mlluitfn,'Visible','on') ;
mlltfntxt = get(mlluitfn,'String') ;
else ;
set(mlluitfn,'Visible','off') ;
end ;
|
function [limitingAudio] = AudioLimiting(inputAudio, threshold)
[M, N] = size(inputAudio);
limitingAudio = zeros(M, N, 'double');
for i = 1 : M
if inputAudio(i) > threshold
limitingAudio(i) = threshold;
elseif inputAudio(i) < -threshold
limitingAudio(i) = -threshold;
else
limitingAu... |
function sliderChangingFcn_polarHeatmap(~,event,data,heatObj1,heatObj2,final_table)
% Update heatmap and title with new selection of data
value = round(event.Value);
heatObjA = histogram2Polar(data(final_table.Type=="pure",value,1), data(final_table.Type=="pure",value,2), 0.1, ...
... |
function plotCellTraces(dF,Fs,thresh,color)
%plot entire dF traces of all cells above a specified threshold. Intended
%mostly for spot analysis
if nargin < 4 || isempty(color)
color = [ 0.4660 0.6740 0.1880];
end
if nargin < 3 || isempty(thresh)
thresh = .5;
end
if nargin < 2 || isempty(Fs)
Fs = 1.48... |
% a =66.38;
% b=37.85;
% c=ols2(a,b);
% mean(a);
% std(a);
% c=zeros
% conn = database('data','root','66196619','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/data');
% symbols = [518880,159905,510900,159901,159903,510500,511010,159902,159915];
% curs = exec(conn,
% curs = fetch(curs);
% data = curs.Data;
clear;... |
function [expr_dat,dist_i]=get_mrna_percell(mask,img_mrna)
stats_n = [];
stats_n = regionprops(mask,'PixelIdxList','Centroid'); % how many cells are there on the image
stats_area = regionprops(test_img,'Area'); %
tmp_dat = [];
end
|
function magnifier(mask, FPS)
% MAGNIFIER - GUI demonstration of a real time magnifier
% MAGNIFIER(mask, FPS) displays a default cartoon image and a magnifier whose
% window shape is specified by mask. The value of mask can be one of the
% following:
% 'circle' - unsmoothed circular window
% 'aacircle' - smoot... |
function networkOutput = GetNetworkOutput(supWeightsVector,inputUnits,beta,threshold,k)
% computation of local field
tmpSum = 0;
for jUnit = 1:k
tmpSum = tmpSum + supWeightsVector(jUnit)*inputUnits(jUnit);
end
b1 = tmpSum - threshold;
% Output of the simple perceptron
O1 = tanh(beta*b1);
networ... |
function qa_memory_general(varargin)
% (help text goes here)
%% Initialize:
%turn off code analyzer warnings that we don't care about:
%#ok<*FXUP>
verbose = 'rastertrial';
%initialize variables:
path = cd; %assume current directory by default
files = [];
channel = [];
sortcode = [];
fh = [];
%avoi... |
%% Clean environment
close all;
clear;
clc;
%% Two-process/Borbely model
% As described in in Skeldon AC, Dijk D-J, Derks G. Mathematical Models for Sleep-Wake Dynamics:
% Comparison of the Two-Process Model and a Mutual Inhibition Neuronal Model.
% Available from: http://dx.plos.org/10.1371/journal.pone.0103877
% ... |
function code = term_coding(id)
% id is a vector, indicating which slots of alleles are being put on
% recurrence
% mapped to a single numeric value, for easy lookup
code = 0;
for i = 1:length(id)
code = code + 2^(id(i)-1);
end
end |
function [v,ij,k,i,j] = min2d(A)
%--------------------------------------------------------------------------
%
% Copyright (c) 2009-2011 Jeffrey Byrne
% $Id: min2d.m 79 2012-07-27 14:30:30Z jebyrne $
%
%--------------------------------------------------------------------------
[v, k] = min(A(:)); % 2010a fixed this b... |
% Counts n00, n01, n10, n11. This code was used to generate the MEX file
% which is much faster. It is called from fGeneralizedMarkovtest.m
%
% USAGE:
% [n00, n01, n10, n11] = fCountHits(I,states)
%
% INPUTS:
% I - Hit-sequence, I, column vector
% states - Number of lags against which we wan... |
function Y = vllab_nn_L1_loss(X, Z, dzdy)
% -------------------------------------------------------------------------
% Description:
% L1 (Charbonnier) loss function
% forward : Y = vllab_nn_L1_loss(X, Z)
% backward: Y = vllab_nn_L1_loss(X, Z, dzdy)
%
% Input:
% - X : predicted data
% ... |
function exptInstructions
global bigMultiplier smallMultiplier medMultiplier
global softTimeoutDuration
instructStr1 = 'The rest of this experiment is similar to the trials you have just completed. On each trial, you should move your eyes to the DIAMOND shape as quickly and directly as possible.';
instructStr2 = ['... |
function emb_train_loop(hmm_dir, vars)
avg_prob = emb_training(hmm_dir, hmm_dir, vars);
% plot result
delt_prob = Inf;
n_max_iter = 30;
emb_stop_thresh = 0.03;
figure;
set(gca, 'XLim', [0, n_max_iter]);
hold on; plot(avg_prob, 'r-s');
while delt_prob > emb_stop_thresh
frm_prob ... |
genenum = 11;
trial = 100;
for i = 1:trial
Str = sprintf('Simulation_%d.fas',i);
file = fopen(Str,'r');
while(~feof(file))
count = count + 1;
temp = fgetl(file);
[temp3,temp2] = strtok(temp,',');
temp4 = strfind(temp,'_GBL');
if temp4
pr... |
Step_size = [1/6 1/8 1/10 1/12 1/15 1/17 1/20];
Error_velocity = [63.2463, 57.9821, 49.8227, 44.7326, 41.4134, 39.7150, ...
37.2217];
Error_pressure = [3.6204, 4.4499, 3.7357, 3.5708, 4.1540, 4.6418, ...
5.2330];
figure
plot(Step_size,Error_velocity,'-.or')
xlabel('Step size')
ylabel('H_0 Error Velocity')
title... |
% function [] = surfaceRender(pointcloud, M, Mean, img)
% project every point on the surface to the main view (camera plane) as reconstructed from sfm,
% and use the projected coordinates to find RGB (texture) colour of the related points.
% Inputs:
% - pointcloud: reconstructed point clould
% - M: transformation matr... |
function varargout = orgSpatStat(varargin)
% ORGSPATSTAT MATLAB code for orgSpatStat.fig
% ORGSPATSTAT, by itself, creates a new ORGSPATSTAT or raises the existing
% singleton*.
%
% H = ORGSPATSTAT returns the handle to a new ORGSPATSTAT or the handle to
% the existing singleton*.
%
% ORGSPATST... |
#############################################################################################################
# Part of the Bayesian Spectrum Analysis (BSA) package in Octave, by Emma
# Granqvist & Richard J. Morris, June 2011
# This code is only proof-of-principle, it is released freely and without any warranty
# For ... |
f1 = figure;
semilogx(data(:,1),data(:,2));
f2 = figure;
semilogx(data(:,1),data(:,3)); |
function [history,x,fval,algoptions] = algorithm_simulannealbnd(algo,algoset,probstruct)
algoptions.MaxFunEvals = probstruct.MaxFunEvals;
algoptions.TolFun = probstruct.TolFun;
switch algoset
case {1,'base'}; algoset = 'base'; % Use defaults
otherwise
error(['Unknown algorithm setting ''' algoset ''' ... |
function z=fill_in_nan(z,t)
if nargin==1
t=1;
end
for tx=1:t
[ni,nj]=find(isnan(z));
for nx=1:numel(ni)
z(ni(nx),nj(nx))=avgnear(z,ni(nx),nj(nx));
end
end
function y=avgnear(z,ni,nj)
[rows,cols]=size(z);
sump=0;
nump=0;
for x = [-1 0 1]
for y= [-1 0 1]
newx=ni+x;
newy=nj+y;
if... |
function [v, tv, handle] = dimredPlotSquaredDistances(Y, plotName, ax, plotWidth)
% DIMREDPLOTSQUAREDDISTANCES Helper function for plotting interpoint distances.
% FORMAT
% DESC is a helper function for plotting inter-point distances as a
% histogram alongside the theoretical curves.
% ARG plotName : the name of the ... |
%Regularization Test
%Zhe Chen
clear;
close all;
clc;
addpath('./CodeReport/code/')
%------------------------------------------------
%parameters
h=2;
a=0.656;
mg=1.27e-15*9.8;
% dx=h/8;
dx_all=h.*(2.^(-5:-1));
M=1;
L=512;
L_ic=12*h;%32sigma
kT=(h-a)*1e-6*mg;
T=kT/1.38064852e-23
omega=16;
S=6*a^3*omega
Amp=M/L_ic;
%!!!... |
clear all; close all;
data = load('dataset2.mat');
X = data.x;
Y = data.y;
figure;
scatter3(X(:,1),X(:,2),X(:,3)) |
clear all ; close all;
subs = {'alex','dina','genevieve','jeremie','russell','tegan','valerie'};
sets = {'retino_allstim*01*set','retino_allstim*02*set','retino_gamma*01*set','retino_gamma*02*set','retino_movie*set','retino_rest*set'};
fmris = {'bp_clean_retino_allstims_01.nii.gz','bp_clean_retino_allstims_02.nii... |
function [time] = RGP(n,T)
V = 1:n; %V=[1..n]
E=eye(n)*2; %E->adjacency-matrix with diagonal=2
time=0;%initial time
T1=0;%false
T2=0;%false
if T==1 %T1
while T1==0
if time~=nchoosek(length(V),2)%num of edegs not full graph
col=ceil(length(V)*rand(1));%random column n... |
clear
M = 20;
N = 2*M;
n = 2*N;
K = 1;
% kpar = linspace(0,pi-pi/6,K);
kpar = linspace(0,pi-pi/6,K);
LAMBDA = zeros(K,n);
t = 1;
dw = sign(linspace(-M,M,N))';
% dw = 2*sign(linspace(-M,M,N))'-1;
% dw(1) = dw(1)+1;
% dw(end) = dw(end)-1;
%% armchair
dw1 = dw; dw1(M+1)=0;
dw_1 = dw; dw_1(M)=0;
r = 0;
V0 = -[0 ... |
function neuron_V_plot(R, pop_ind, sample_ind, seg, varargin)
% axes_matrix(1) = subplot(6, 8, 1:7 );hold on;
% Dump fields
dt = R.dt;
step_tot = R.step_tot;
% Input check and default values
seg_size = 4*10^4; % 2*10^4 for 2-pop, segmentation size for each plot
if nargin < 4
seg = 1;
end
text_fontsize = 12;
fo... |
function [COUNTSn] = suavgausiano(COUNTS,w);
%This function implements the gaussian smooth for an histogram an then it
%can be used to find the thershold. It uses the COUNTS variable that is
%returned by the imhist funcion an w is the size of the window that you
%want to use. It has to be a odd number. if not, the fun... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty:... |
%findClosestCentroids([0 1; 5 5; -1 8], [7 6; -2 2])
%
%X = magic(8);
%X = X(:, 2:4);
%centroids = magic(4);
%centroids = centroids(:,2:4);
%findClosestCentroids(X, centroids)
%computeCentroids([0 1; 5 5; -1 8], [2 1 2]', 2)
%format long
%[U, S] = pca(sin([0 1; 2 3; 4 5]))
%format long
%projectData(sin([0 1 2; 3 4 5... |
datadir = '/Users/michielk/oxdata/P01/EM/Myrf_01/SET-B/B-NT-S10-2f_ROI_00/old';
dataset = 'B-NT-S10-2f_ROI_00ds7';
dpf = '_probs';
infile = [dataset, dpf];
infield = '/volume/predictions';
outfile = [dataset, dpf, 'foo'];
outfield = '/probs_eed_foo';
vol_idxs=0;
T=1;
dt=1;
rho=1;
%%
addpath('/Users/michielk/workspace/... |
function edit_bezier(varargin)
if nargin==2
v=varargin{2};
e=varargin{1};
p=get(gca,'CurrentPoint');
ud=get(gca,'UserData');
% ButtonDown event
if strcmpi(e,'down')
if ~strcmpi(ud.mode,'normal')
% something wrong! fix it and return!
ud.mode='norm... |
function [theta, P, xi, thetas] = relsd(y, u, n_a, n_b, n_c, d, rho)
% Recursive extended least square
% CARMA model: A(q^{-1}) y(k) = B(q^{-1}) u(k) + C(q^{-1}) \xi(k)
% "extended" data: $\hat{x}(k) = (-y(k-1),\dots,-y_{k-n_a},u(k),\dots,u(k-n_b),\dots,\xi(k-1),\dots,\xi(k-n_c))$
num_p = n_a + n_... |
function dydt= ODEs(t,y,p,xa,ba,A,sumal,A1,sumalGABA,ncell,ns,vsP0,vsB,vmB,Cl_o,vvip,t1)
dydt=zeros(ns*ncell,1);
%these equations and parameters come from the supporting material of the
%Vasalou Herzog and Henson Paper
i=1:ncell;
Ca=y((i-1)*ns+1); %cytosolic calcium concentration
Ca_store = y((i-1)*ns+2); %c... |
function output = gradient_adaptive_huber(x_loop, imageNoisy, alpha, gamma)
y1_in = x_loop-circshift(x_loop,1,1);
y1_out = zeros(size(y1_in));
y1_out(abs(y1_in)<=gamma) = y1_in(abs(y1_in)<=gamma);
y1_out(abs(y1_in)>gamma) = gamma*sign(y1_in(abs(y1_in)>gamma));
y2_in = x_loop-circshift(x_loop,-1,1);
y2_out = zeros(siz... |
function [ACMat, Instants] = FastCorrelate(Matrix1, Matrix2, ShiftedBy)
if nargin() < 3
ShiftedBy = 0;
end
nr1 = size(Matrix1, 1);
nc1 = size(Matrix1, 2);
nr2 = size(Matrix2, 1);
nc2 = size(Matrix2, 2);
if nr1 ~= nr2 && nr1 ~= 1 && nr2 ~= 1
ME = MException('VerifyInput:InvalidInput', ...
'The Number ... |
clc;clear all;close all
addpathFolderStructureHaltere()
run('config_file.m')
%%
% loadName = 'figure2_deformMesh';
% saveName = 'figure2_deformMesh';
loadName = 'figure2_deformLines';
saveName = 'figure2_deformLines';
% renew_data_load = true
renew_data_load = false
if renew_data_load
FEA(1).name = 'Haltere_Cra... |
function [residual, g1, g2, g3] = impact_zlb_mf_dynamic(y, x, params, steady_state, it_)
%
% Status : Computes dynamic model for Dynare
%
% Inputs :
% y [#dynamic variables by 1] double vector of endogenous variables in the order stored
% in M_.lead_lag_incid... |
function output=circleFit(X, method)
if method == 1
x = X(1,:)
y = X(2,:)
A = [2*x; 2*y; ones(1, size(X, 2))]
%dim = size(A)
b = x.^2+y.^2
theta = A'\b'
a = theta(1)
b = theta(2)
r = sqrt(theta(3)+a^2+b^2)
output = [a b r]'
end
if method == 2
center0 = mean(X, 2);% Initial guess of the center
center ... |
function write_bot_to_bot_xml(layer_obj)
% input parser
p = inputParser;
addRequired(p,'layer_obj',@(obj) isa(obj,'layer_cl'));
parse(p,layer_obj);
if isempty(layer_obj)
return
end
% get current bottom class version
bot_fmt_ver = bottom_cl.Fmt_Version;
% get filenames
[path_xml,~,bot_file_str] = layer_obj.creat... |
function result=maxfig(fig_hndl, maxtype)
%MAXIMIZES a matlab figure window
%
%Uses api_maxfig.dll or api_maxfig_R14SP2.dll
% (c) 2005 Mihai Moldovan M.Moldovan@mfi.ku.dk
if computer == 'PCWIN'
v=version;
if v(1)=='7'
if v(end)=='2'
sp=2;
else
sp=1;
end ... |
close all;
dataset_format = 'datasets/own_dataset/canon_images_stable/005.png';
img = double(imread(sprintf(dataset_format,1)));
figure, imshow(uint8(img));
patch = img(115:150, 201:250, :);
u1r = zeros(1,6);
u1g = zeros(1,6);
u1b = zeros(1,6);
for disp = 1:10
[mu,var,I] = get_mu_s(patch,disp,2);
u1 = (mu+va... |
%% ========================================================================
% main program (example1-1)
% RDO for mathematical functions
% save history for every iterations
% output data title
% - Exact : resultE
% - Direct approach : resultD
% - Singular Step GPCE : resultS
% - Multipoint approximation : re... |
classdef myObject
properties
x {mustBeNumeric}
y {mustBeNumeric}
angle {mustBeNumeric}
distance {mustBeNumeric}
end
end |
function [smoothed_vit error] = smooth_viterbi1pair(oblist, viterbi, posterior, posteriorIBD1, map)
smoothed_vit = int8([]);
error = 0;
[nmarkers, c] = size(map);
if( nmarkers <= 0 || c ~= 1 )
error = 1;
disp('error in marker list');
return;
end
[r, c] = size(viterbi);
if( r <= 0 || r ~= nmarkers || c ~=... |
function [coh] = coh4Para(Cy,Cz,dy,dz,U,f)
% check vertical coeff
if numel(Cy)>4; error('C must be a vector with max 4 columns or rows');end
if numel(Cy)==1,
Cy = [Cy(:)',0,1,0];
elseif numel(Cy)==2,
Cy = [Cy(:)',1,0];
elseif num... |
function ax=comp(imgs,slice,coil)
%images is cell array of test images, first is the gold standard
%assume image is 2D
%row one: abs of all images including gs
%row two: diff of all images with gold standard
%columns are different coils
%show images space and difference
%scales all images to the same color scale
%% s... |
%{
This program implements and solves a decision tree for maximimizing
market share using results of Yes/No surveys.
Surveys are conducted over 3 phases; after every phase of surveys,
a decision is made whether to market the product, continue to the next phase
or terminate the product.
A layout of the decision tree... |
setup ;
imdb = load('textonsdb.mat') ;
imdb.images.data = im2single(imdb.images.data) ;
train_index = find(mod(0:length(imdb.images.id)-1,2) < 1) ;
val_index = setdiff(1:length(imdb.images.id),train_index) ;
imdb.images.set(1,val_index)=2;
net=load('textures_jitter.mat');
results_train = train_net(net,imdb.images.dat... |
% Declare all variable global
global c n_ant_x n_ant_y delta_x delta_y f_carrier bandwidth chirp_duration
global n_samps delta_f range_max
% Physical constants
c = 299792458; % speed of light, in m/s
% Antenna array parameters
n_ant_x = 128;
n_ant_y = 128;
delta_x = 0.012; % units are meters
delta_y... |
% Authors - Basaran, Baumberger, Dietsch, Wert
function euclidean_dist_vect = calculateEucDistBwTrainingMatrixAndTestVector(M,X_test)
% Return a vector of the computed euclidean distance b/w the features
% matrix and the tested features vector
%
% Arguments:
% - M, the features matrix
% - X_test, the tested features... |
%----------------------------------------------------------------
% 程序: MM_PhaseRetrieval_DFT.m
% 作者: 郑品军
% 时间: 2020-04-01
% 说明: Majorization-Minimization base phase retrieval algorithm (DFT measurement)
% Revision History: 版本 / 归档日期 / 修改人 / 修改内容
% V1.0 / 2020-04-01 / 郑品军 / 创建程序
%---------------------------------------... |
% LIMIT Limit object to a region of interest
%
% This method defines a density region of interest in a Sesame object,
% limiting the range used in calculations and visualization.
%
% Usage:
% >> object=limit(object,[lower upper]); % specify Grid range
% >> object=limit(object,'all');
%
% Calling this m... |
%Rescale the image
for n = 1:1
filename = sprintf('%01d.jpg', n);
if ~exist(filename, 'file') %If image exists read it
continue; % Skip to bottom of loop.
end
filename %Show image number being read at the time
A = imread(filename);
scale = .5 %Rescale to 1... |
function x = DecodeChromosome(chromosome, variableRange)
nGenes = size(chromosome,2);
nHalf = fix(nGenes/2);
x(1) = 0.0;
for j = 1:nHalf
x(1) = x(1) + chromosome(j)*2^(-j);
end
x(1) = -variableRange + 2*variableRange*x(1)/(1-2^(-nHalf));
x(2) = 0.0;
for j = 1:nHalf
x(2... |
function [out] = coronastructmaker()
%coronastructmaker makes a struct with all the corona data that it can
%gather
% Downloads the NYT database of coronavirus cases. Then organizes the
% data into a large struct, with information for each county located in
% separate entries. Written by Kyle Magness for ENG... |
%training_folder_path: path of the training folder
%spam_id: the filename identifier of a spam message file
%freq_threshold: if a word appears less times than this threshold, it is
%removed from the vocabulary
%header_lines: the number of lines contained in the header
function [spam_vocabulary, ham_vocabulary, complete... |
% This program is the test of Saturated Vapor Pressure
clc
clear
var_name = 'v';
% var_name = 'phit';
% var_name = 'zonal_wind';
% var_name = 'meridional_wind';
it = 2;
iPatch = 2;
nc_file = '..\run\mcv_output.nc';
dx = ncreadatt(nc_file,'/','dx');
Fill_Value = ncreadatt(nc_file,var_name,'_FillValue'... |
function features = normalize_conseqopt_features(features)
% normalize features across library elements
% features is [1,N] cell.
% features{i} is [L,d]
N = length(features);
for i = 1:N
f = features{i};
f = bsxfun(@minus,f,mean(f,1));
features{i} = f;
end
end |
%有融合的拼接
function [newim,difr,difc]=imstick(colimgb,colimga,estH,dif1r,dif1c,direction)
%cHA拼接到cHB
%注意数字图像中x方向为行下标,
%direction:1 为从左往右拓展图像; 2 为从右往左拓展图像
colimga=double(colimga);
colimgb=double(colimgb);
[arow acol dim]=size(colimga);
[brow bcol dim]=size(colimgb);
avertex=[1,1,arow,arow;1,acol,1,acol;1,1,1,1];... |
function output = plot3axisWAng(self,plotobj,plogangobj)
output=figure;
legendlist=[];
ax1=subplot(4,1,1);
ax2=subplot(4,1,2);
ax3=subplot(4,1,3);
ax4=subplot(4,1,4);
output.UserData=[ax1,ax2,ax3,ax4];
for i=plotobj
if length(i.t)<1
continue
end
s... |
function [f, df] = grad_logPref(x, loghyp, X, fmap, iKG, ridge)
sig = exp(loghyp(1));
w = exp(loghyp(2:end));
W = diag(w.^-2);
K = exp(-.5 * maha(X',X', W)) ;
K = K + eye(size(K)) * ridge;
k = exp(-.5 * maha(x(:)', X', W));
iK = eye(size(K))/(K);
fmap_star = k * iK * fmap;
var_star = 1 - k * iKG *k' + 2*sig^2;
z =... |
%-----------------------------
% Save data for CVPA
%-----------------------------
dlmwrite('features.dat', final_features, 'delimiter', '\t', 'precision', '%.6f');
|
function [ safetyLog ] = lineBasedClearance( input_args )
%Compute clearance of road patch using mincut nodes and line equation
% Detailed explanation goes here
close all; clear;
%% ==================== Part 1: Vehicle info ====================
wheelbase = 1.78;
vehicle_width = 1.58;
track = 1.3;
%% ===============... |
function [num measure numfc forecast T]=read_meas_structure(filename)
[Ndleitung measure forecast base] = network_data(filename);
if ~isempty(measure.Pk)
T=size(measure.Pk,2)-1;
else
T=size(measure.Vk,2)-1;
end
num.Pk=measure.Pk(:,1);
num.Qk=measure.Qk(:,1);
num.Vk... |
%analisys data taken by msdft
N = 256;
delay = 8; %im not 100 sure that it is, but is enough
fft_mag = 60.2417;
fft_ang = 48.5;
re1 = re_part1.data();
im1 = im_part1.data();
re2 = re_part2.data();
im2 = im_part2.data();
data1 = re1+1j*im1;
data2 = re2+1j*im2;
mag1 = 20*log10(abs(data1));
mag2 = 20*l... |
function [n_targets, targets_x, targets_y, targets_z] = generate_scene_sphere()
% Returns the x, y and z co-ordinates and reflectivity of the targets in the scene.
% The co-ordinates are in metres, and the target is a sphere.
% The antenna array is assumed to lie in the XY plane, at z=0, centred
% around the z axis.
t... |
function [ points ] = rk4_flatPlate( u1,u2,u3,u4,u5,Pr,maxIterations )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%maxIterations=100000;
h=.1;
hh=h/2;
% u1=0;
% u2=0;
% u3=0..3107835;
% u4=1;
% u5=.2;
% Pr=5;
points=zeros(maxIterations,6);
%set intial conditions
q1=u1;... |
clear;
clc;
report_filename = 'test_result.txt';
test_path = which(mfilename);
path_parts = strsplit(test_path, '/');
test_dir = strjoin(path_parts(1 : end - 1), '/');
cd(test_dir);
n_examples = size(dir('examples/'), 1) - 2;
n_tc = 2;
cnames = {'given', 'selected'};
res = cell(n_examples, 1);
warning('off', 'all');... |
function a = laser_lock_cavity_san_180717(det,CAL,side,san,data_dark)
%fm is setpoint detuning from cavity
% updated for new VNA code
% Not tested yet, san blue out of EOM WL range
% WTJ, 20180717
global INSTR
a = [];
dflist=[];
c = 299792458; %speed of light, in m/s
detTol = 200e6; %the detuning toler... |
% function to implement the measurement model
function obs = f_h2(x)
% Input:
% x = [xc xcd zc zcd p1 p2 w].'
load avar % r1,r2, L, and T
% unpack
xc = x(1); zc = x(3); p1 = x(5); p2 = x(6);
% observation 2
obs = L*(xc+r2*cos(p2))/(zc+r2*sin(p2)); |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% generate zonal mean plot data for IAGOS GW study
%
%Corwin Wright, c.wright@bath.ac.uk, 2020/JUN/02
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.