text stringlengths 8 6.12M |
|---|
%% visualize R, t
figure(1); clf;
% 3D points
plot3(X(:, 1), X(:, 2), zeros(size(X, 1), 1), 'kx');
% cameras
for i=1:numel(imgs)
hold on;
camLoc = Rs_opt(:, :, i)'*(-ts_opt(:, :, i));
plot3(camLoc(1), camLoc(2), camLoc(3), 'rs');
quiver3(camLoc(1), camLoc(2), camLoc(3), Rs_opt(3, 1, i), Rs_opt(3, 2, i),... |
% main.m is where the simulation begins.
% Setting parameters, initiate cells to size dimen, draw the grid in
% gridMode (layer of cell) and run the steps until numSplit.
% splitTimeBounds is the bounds for the uniformly distributed variable
% which determines the time to which a cell will split when it is conceiv... |
function [residual, g1, g2] = NK_RA16_rep_static(y, x, params)
%
% Status : Computes static model for Dynare
%
% Inputs :
% y [M_.endo_nbr by 1] double vector of endogenous variables in declaration order
% x [M_.exo_nbr by 1] double vector of exogenous variables in declaration order
% para... |
% Add parent folder to path
addpath(fileparts(pwd));
% Test sum_marginal against pmarginal (only binary)
success = 1;
for i = 4:10
for j = 1:2:i
for k = 2:2:i
for l = 1:i
if l ~= j && l~=k
if sum(sum((sum_marginal(2, i, [j k l]) ~= pmarginal(i, [j k l]))))>0
... |
function [y, count] = Shooting(x, Eqn, h, y0, yf, dy0_1, dy0_2, Tol)
% ------------------- Description ------------------- %
%
% Shooting method is a tool to estimate the former equation
% by comparing :: delta = Y(y0, yf) - BV = 0
%
% ----------------- Secant call ------------------ %
% returns dy_0 that bes... |
Radi = 100000;% R is the Radius of the desired path,here we set it as 10m.
phi_des_d = V_x_/Radi;
|
function [rPEP, r_predict, names] = correlate_with_other_indices(GHCND_clustered, C, summer_doy, yrs, nyrs, ...
startDate, lag_range, T95prime, makeplots)
%% Interannual skill
CAvg = reshape(mean(C(lag_range >= 15 & lag_range <= 45,:), 1),[length(summer_doy) nyrs]);
CYr = mean(CAvg, 1);
% compare with median T95
T... |
function SSI4 = get_PWS_SSI4(sID, varargin)
% tab = {'PWS_M01', 19;
% 'PWS_F01', 32;
% 'PWS_F02', NaN; % Not done.
% 'PWS_F04', 19;
% 'PWS_F05', 16;
% 'PWS_M02', 43;
% 'PWS_M03', 30;
% 'PWS_M04', 21;
% 'PWS_M05', 33;
% 'PWS_M06', 37;
% 'PWS_F... |
function maskDAPI = DAPImask(aImarisApplication)
% Segmentation of samples boundaries with nuclear stain.
%
% DESCRIPTION
%
% This method calculates a mask defining the boundaries of the sample
% volume by using the5a DAPI signal
%
% SYNOPSIS
%
% maskDAPI = DAPImask(aImarisApplication)
%
% INPUT
%
%... |
function [layers] = forward_propagation(layers)
% layers is a multidimensional structure with .w (weights) members
theta = @(x) 1./(1+exp(-x)); % activation function
num_layers = length(layers); % get the number of layers
for l=2:num_layers ... |
function [t,u]=Revised_ODEeulers(dufun,tspan,u0,h)
t=tspan(1):h:tspan(2);
u=zeros(length(u0),length(t));
u(:,1)=u0(:);
for n=1:(length(t)-1)
u1(:,n+1)=u(:,n)+h.*feval(dufun,t(n),u(:,n));
u(:,n+1)=u(:,n)+h/2.*(feval(dufun,t(n),u(:,n))+feval(dufun,t(n),u1(:,n+1)));
end |
function [ output_args ] = xxxHistoChange(src,event,fig,man)
%xxxHistoChange - change the histology image transparency
% Early return
dpn = guidata(fig.fig);
if isempty(dpn)
return
end
% Determine the src, as this function is set off by either the slider or
% the edit box
type = get(src,'Style');
switch type
... |
function [psyphycell_newforTT] = sigmoidfit_TT_OrdChHyst(cellname,fitt,HystType,spaceType,varargin)
% this function does sigmoidal fitting with consideration of order and
% choice hysteresis
% this function is called by pop_behav_ana_summary_TT.m
%
% author: camillo, september 2004.
% revisions:
% june 2006: sigmoid is... |
%% Set up parallel port
% This assumes that you have downloaded and installed according to the
% instructions the parallel port drivers in my kit:
% http://www.kylemathewson.com/wp-content/uploads/2013/06/ParallelPortKit.zip
% By Dr. Kyle Mathewson - 2012
%% Initialize the inpoutx64 low-level I/O driver
co... |
% --------------------------------------------------------------------------
% This is a k-Nearest Neighbors classifier trained and tested on a MNIST
% dataset that represent handwritten digits in 28x28 greyscale images.
% This model is intended to classify the test data into category based on
% the provided data. ... |
% Read and resize the image for further filters
I = imread('dogGrayRipples.png');
figure;
imshow(I);
I = imresize(I, [256 256]);
[m,n] = size(I);
[X,Y]=meshgrid(1:256,1:256); % it is a meshgrid for circle mask
% Filter the image using the notch filter for every pixel of the image
filter=ones(m,n);
for i=1:m-1
for ... |
function [yhat,xhatfilt,xhatpred,P,Q] = kalman(y,F,G,H,R1,R2,x0,Q0)
K=size(y,1);
xhatpred=zeros(size(x0,1),K);
yhat=zeros(size(R2,1),K);
xhatfilt=zeros(size(x0,1),K);
xhatpred(:,1)=F*x0;
yhat(:,1)=H*xhatpred(:,1);
P=F*Q0*F'+G*R1*G';
L=P*H'*(H*P*H'+R2)^(-1);
xhatfilt(:,1)=xhatpred(:,1)+L*(y(1,:)'-yhat(:,1));
Q=P-L*H*P;
... |
function [U0,V0] = sample_X0_lowrank(d1,d2,r,modeX0,complex,varargin)
% Constructs a random rank-r matrix X0 of dimension (d1 x d2).
% The randomness comes from Gaussian matrices, parametrized such that
% X0 = U0 * V0' where U0 and V0 have r columns.
% ==============================================================... |
function x = sbxReadPMT(path, k, N, pmt, optolevel)
% img = sbxread(fname,k,N,pmt)
% no need to cd!
%
% Reads from frame k to k + (N - 1) in file fname
%
% path - the file path to .sbx file (e.g., 'xx0_000_001')
% k - the index of the first frame to be read. The first index is 0.
% N - the number of consecu... |
clear all; close all;
subjList = ['001';'002';'003';'004';'005';'ssc'; '101';'102';'103';'104';'105';'106';'107';'108';'109';'110';'111';'112']; % ['s2h';'s22'];
for sid = 1:length(subjList)
subj = subjList(sid,:);
load(['../analysis/work/',subj,'_rawPsy.mat']); % [tick_dratio,counts,afcs] = aggregatePsy(subj);... |
clear all; close all; clc
%% Projekt č. 10 10.12.2018
% Název: Identifikace osob podle oční duhovky
%
% Zadání:
% Navrhněte a realizujte algoritmus pro identifikace osob podle oční duhovky
% na dostupné databázi.
% Statisticky vyhodnoťte úspěšnost navrž... |
function [D,S,W,A] = InitialDSWA(X,Y,param)
% Initialize D, A and S.
%
D = rand(param.impixelN,param.K);
D = 2*(D - 0.5);
%A = rand(param.K, param.sampleN);
A = rand(param.K,size(X,2));
A = 2*(A - 0.5);
%%%%
W = rand(size(Y,1),param.K);
W = 2*(W - 0.5);
%%% randomly generate S %%%%%%%
S = ones(size... |
%Circle
clear
circle=ones(500);
for i=-230:230
circle(250+i,[[round(250-sqrt(230^2-i^2)) : round(250-sqrt(200^2-i^2))] [round(250+sqrt(200^2-i^2)) : round(250+sqrt(230^2-i^2))]])=0;
end
imshow(circle)
imwrite(circle,'Circle.jpg');
%Cross
cross=ones(500);
for i=20:470
for j=i:i+30
cross(i,j)=0;
... |
function write_shorts(data, rfpfname)
% function write_shorts(data, rfpfname)
%
% write out a waveform in binary format so that EPIC can read it
% You must run this before it will run on the scanner
% xlatebin -o filename.rho rfpfname
% scale the data from 0 to 2^15 -1
data = (2^15-1)*(data -min(data)) / max(data... |
clear
%last number is the index in the index of the stimulus in the experiment
D = read(dataset,'F16517',16);
D = read(dataset,'L16556',62)
oldstim=0
bin_psth=1
stimparapm = D.stimparam;
dd=00
start_test=stimparapm.condBurstDur;
end_test = stimparapm.condBurstDur+stimparapm.testBurstDur;
delta=stimparapm.delta_T
sta... |
function res = mirrorCirc(data, mode, width)
if strcmp(mode, 'add')
res = [data(:, width+1:-1:2) data data(:, end-1:-1:end-width)];
else
res = data(:, width+1:end-width);
end
|
function [burstt,ord] = alignbursts(burstt0, varargin)
% function [burstt,ord] = alignBursts(burstt0, varargin)
% Align bursts from several channels, assuming that the bursts are coming
% at approximately the same frequency
% ord is the order in the new variable. So if you have another variable
% like burstt0 (say bur... |
function j = kN2O5_decomp(T,M)
%calculate decomposition of N2O5 from JPL evaluation of NO2 + NO3 and Keq
Keq = 2.7e-27.*exp(11000../T);
j = kNO2NO3(T,M)/Keq;
end
|
function [C,p2]=object(m0,xm,ym,xm1,ym1,locx,locy,p01,phy,ampaxy0)
%%%
[p1]=f2_2(m0,xm,ym,xm1,ym1,locx,locy,p01,phy,ampaxy0);
[p2]=f2_8(m0,xm,ym,xm1,ym1,locx,locy,p01,phy,ampaxy0);
oam1=1.36e5*ones(1,81);
oam2=1.48e5*ones(1,81);
ophy1=[-pi repmat([-pi:2*pi/31:pi],1,2) -pi:pi/15:0];
ophy2=fliplr(ophy1);
op1=oam1.*exp(... |
function P2=makestimHP(P)
% MakestimHP - stimulus generator for HP stimGUI
% P=MakestimHP(P), where P is returned by GUIval, generates the stimulus
% specified in P. MakestimHP is typically called by StimGuiAction when
% the user pushes the Check, Play or PlayRec button.
%
% MakestimHP does the following:
%... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% Laboratorijska vaja %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 5. naloga - navpicni ploscni %%%%%
%%%%%%%%% elektrodi %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%dolzina stranice a (v y-smeri) v m:
a=2e-2;
%dolzina stranice b (v x-smeri) v m:
b=... |
% Recording Particle Velocity Example
%
% This example demonstrates how to record the particle velocity using a
% Cartesian or binary sensor mask. It builds on the Homogeneous Propagation
% Medium and Heterogeneous Propagation Medium examples.
%
% author: Bradley Treeby
% date: 1st November 2010
% last update: 3rd Ma... |
classdef WLCPCA < PCA
%WLCPA Summary of this class goes here
% Detailed explanation goes here
end
|
%clear;
matlabUtil = '../share/matlab'; addpath(genpath(matlabUtil));
JCMsuite_init(1);
setup;
JCMsuite_jcmt2jcm(keys, true, true);
results = jcmwave_solve('--solve', './jcmFiles/project.jcmp', keys);
|
function mydatxtick(h, range, time, freq, userRange, opt)
% mydatxtick Set up x-axis for Series object graphs.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
if numel(h)>1
for i = 1 : numel(h)
mydatxtick(h(... |
%% more mode shapes
load('./flat-bot-modes.mat');
label = 'abcdefg';
hfig = figure;
for ii=1:8
hax(ii) = subplot(2,4,ii);
end
hax(4) = subplot(2,4, [4 8]);
hax(6).delete;
resizeImageForPub('portrait');
hfig.Position(4) = 600;
% typical mode shapes
mm = 11;
nn = 4;
linestylemode = {'--', '-', '-.'}; % line style ... |
function run_ddpopo_quest(varargin)
close all;
sca;
%%
addpath('/Users/mertozkan/Documents/MATLAB/PTB');
addpath(genpath('/Users/mertozkan/Documents/MATLAB/DD/DDPOPO'));
dr_dat = '/Users/mertozkan/Documents/MATLAB/DD/DDPOPO/data';
%%
init = input('Initials: ','s');
f_nm = sprintf('DDPOPO_Quest_%s',init);
if strcmp('tes... |
function [F, H, R, y, x0, P0] = build_KF_EPFL_matrices(LblPMU, Lbl0Inj, G, V, I, DeltaPhase)
% Build necessary matrices for the KF-based algorithm proposed in
% M. Pignati, et al. Real-Time State Estimation of the EPFL-Campus Medium-Voltage Grid by Using PMUs.
% The Sixth Conference on Innovative Smart Grid Techno... |
% Valores:
Ubat = 5;
C = 100e-6;
R = 47e3;
theta = 1000;
% Simulacion:
sim integraYdisparaSIM
% Graficas:
figure
subplot(2,1,1)
plot(t,I), grid on
title('I(t)')
xlabel('Time (s)')
ylabel('Current (A)')
subplot(2,1,2)
plot(t,U), grid on
title('U(t)')
xlab... |
% function rec= Solve_l1_problemDR(data,A,At,niter,gamma)
%
% Solve exact reconstruction with Douglas-Rachford algorithm
%
% min ||x||_1 s.t Ax=y
%
%
% input : data : acquired data (a n x p x q array)
% A : a matlab function corresponding to left multiplication by A
% A : a matlab funct... |
function plot(obj,varargin)
% plot(obj)
%
% Plots the intrinsic imaging data aquired with Intrinsic Imager
%
% MF 2012-09
params.sigma = 2; %sigma of the gaussian filter
params.exp = 1; % exponent factor of rescaling
params.reverse = 0; % reverse the axis
params = getParams(params,varargin);
figure
set(gcf,'positi... |
ATM_fnc = @(x) (0.0429 + 45.4628.*x - 62.0548.*x.^2 + 30.6344.*x.^3)/200; % derived in ATM_IR.m
ATR_fnc = @(x) (0.02914286*x+0.02);
% knockout vector - 0 if KO 1 if non-KO
knockouts_reg = zeros(1,8);
knockouts_reg(1,Constants.ATM) = 1;
knockouts_reg(1,Constants.ATR) = 1;
knockouts_reg(1,Constants.CHK1) = 1;
knockouts... |
function v2 = quatrans(v1,q12);
%----------------------------------------------------------------------
% function v2 = quatmult(v1,q1);
%
% Transforms a 3 x 1 vector v1 expressed in coordinate frame 1 to
% a 3 x 1 vector v2 expressed in coordinate frame 2. q12 is the
% quaternion... |
% Tutorial for determining the gain margin of the system
clear all
close all
clc
% System parameters
m = 0.8775; % mass [kg]
c = 2.9123+8; % damping coefficient [Ns/m]
k = 451.39; % stiffness [N/m]
% Controller parameters
Kp = 2000; % proportional gain
Ki = 0; % integral gain
Kd = 0; ... |
function [clusteriness, p, dists] = pairsClusterTest_elliptical(vectors, params)
% [pairsVal, p, dists] = pairsClusterTest(vectors [ params])
%
% Implement the PAIRS clustering test. PAIRS stands for Projection Angle
% Index of Response Similarity.
%
% ALTERATION FROM ORIGINAL CODE - now generates a null distribution t... |
function [x,iter,resvec,flag] = preconjgrad(A,b,maxits,x,tol,P,verbose);
if nargin == 6
verbose = 0;
end
% A plain preconditioned conjugate gradients routine
flag = 0;
n = length(b);
resvec = zeros(maxits+1,1);
flag = 0;
r = b - Amult(A,x);
z = presolve(P,r);
resvec(1) = norm(r);
p = z;
ztr = z'*r;... |
classdef MLM_model < Model
methods
function m = MLM_model(use_pc, supervised)
m.use_pc = use_pc;
if nargin < 2
m.supervised = false;
else
m.supervised = supervised;
end
end
function [ wald_stat, p_val,... |
function fn_axispixel(ha)
% function fn_axispixel([ha])
%---
% set axes size such that there will be an integer ratio between the
% pixels in the image and on the screen display
% Thomas Deneux
% Copyright 2010-2012
% define axes handle, and possibly also image handle
if nargin==0
ho = findobj('type','image');
... |
if hour>=0 && hour<=3
hora=0;
elseif hour>3 && hour<=6
hora=3;
elseif hour>6 && hour<=9
hora=6;
elseif hour>9 && hour<=12
hora=9;
elseif hour>12 && hour<=15
hora=12;
elseif hour>15 && hour<=18
hora=15;
elseif hour>18 && hour<=21
hora=18;
elseif hour>21 && hour<=24
hora=2... |
function [Tonal_testpars,...
Tonal_azi,...
Tonal_ele,...
Tonal_diamond,...
BP_azi,...
BP_ele,...
BP_diamond,...
ILDAlone_azi,...
ILDAlone_ele,...
ILDAlone_diamond,...
ITD_meancurve,...
ITD_diamond,...
ABI_curve,...
ABI_diamond,...
... |
%function [filenames, uni_times] = sort_by_unitimes(filenames,folder)
[filenames,folder] = uigetfile('*.txt','MultiSelect','on');
if strcmp(class(filenames),'double')
return; %debbug exit for real app
end
%set variables
no_uniformity = false;
%convert filenames to cell arra... |
function[y] = latitude(vecteur, CPR)
%% constante
Nz = 15;
lat_ref = 44.806884;
Nb = 17;
%% latitude
Dlat = 360/(4*Nz-CPR);
LAT = bi2de (vecteur,'left-msb');
j = floor(lat_ref/Dlat) + floor(1/2 + ((lat_ref-Dlat*floor(lat_ref/Dlat))/Dlat) - LAT/2^Nb);
y = Dlat*(j+LAT/2^Nb);
end |
function empty = CS4300_containsEmpty(resolvents)
% CS4300_RTP - resolution theorem prover
% On input:
% resolvents: the list of clauses
% On output:
% empty: result of checking if an empty clause exists
% Call: (example from Russell & Norvig, p. 252)
% resolvents(1).clauses = [-1,2,3,4];
% resolvents(... |
% rib_response: explain why cc area increases at a slower rate than grey matter surface area
% here: try to predict aboitiz fiber distributions
% first: look over caminiti, tomasch
% create functions for overlaying actual and predicted, based on brain size
% create functions that relate fiber density, fiber distrib... |
clear all;clc;
basepath = 'E:\Business and friend work\Robert Fromeki\FP files-20221002T150414Z-001\FP files';
cd(basepath)
rmpath('C:\Users\yiyao\Documents\MATLAB\chronux_2_12\spectral_analysis\continuous');
%% path to folder
files = dir(basepath);
for ii = 3:length(files)
cd([basepath,'\',files(ii).n... |
%% 2b) PARAMETRIC BOOTSTRAPPED 95% CONFIDENCE INTERVALS
% CLEAR PREVIOUS EXERCISES
clear
% LOAD TEXT FILE
data = load('atlantic.txt');
% USE PROVIDED FUNCTION FOR ESTIMATION OF BETA AND MU
[beta_mean, mu_mean] = est_gumbel(data);
% FIND LENGTH OF SPECIFIED DATA AND OTHER RELEVANT PARAMETERS FOR QUESTION
n = length(... |
% 8/6/13
% findTrajLoad1D.m
% generate optimal trajectory, assuming only a 1D load
%
% Dependencies: findContConstraints.m, findFixedConstraints.m,
% findDerivativeCoeff.m, findCostMatrix.m, translateLoadConst.m
% findQuadEqConstraints.m, findQuadIneqConstraints.m
%
% inputs:
% r: integer, derivative to minimize ... |
function [result] = wmean(values, weights, dimension)
if nargin < 3
dimension = 1;
end
if size(values, dimension) ~= numel(weights) || dimension > ndims(values)
error('Dimension mismatch');
end;
weights = weights(:);
sizes = size(values);
sizes(dimension) = 1;
result = sum(values .* repmat(shiftdim(weights, dimen... |
% Figure 2 of paper titled: "Disease spread coupled with evolutionary ...
% ... social distancing dynamics can lead to growing oscillations"
%
% Accepted at 60th Conference on Decision and Control (CDC 2021)
% For the pdf of the paper, visit: https://hoseinkh.github.io/files/Disease-spread-coupled-with-evolutionary-so... |
% Domain is the base Dimple domain class
%
% The actual implementation is provided by an underlying Java object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012-2015 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you ma... |
function plot_mat(X1,X2,M,j)
% plot_mat(X1,X2,M,i1,i2)
% in:
% X1, X2 coordinates, cell size 3
% M matrix
% j index triple of the column of M to display
% example: plot_mat(X,XC,P,[5,5,1])
m=size(X1{1});
mm=prod(m);
n=size(X2{2});
nn=prod(n);
if any(size(M)~=[mm,nn])
error('wrong matrix M size')... |
function [beta,vcycle] = get_chaine(has_marqued,phi, beta, CAPACITE, NSUC,X,SUC, ANT_matrix)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
vcycle = zeros(1, size(phi, 2));
sommet_courant = 2 ;
has_marqued
while sommet_courant ~= 1
som_precedt = has_marqued(sommet_courant)
somme... |
function [dfh, dfv] = circ_gradient2(f)
[n,m] = size(f);
dfh = [f(:,1) - f(:,m), f(:,2:m) - f(:,1:m-1)]; % Horizontal
dfv = [f(1,:) - f(n,:); f(2:n,:) - f(1:n-1,:)]; % Vertical
% Copied from circ_gradient
dfh = [f(:,1:m-1) - f(:,2:m), f(:,m) - f(:,1)]; % Horizontal
dfv = [f(1:n-1,:) - f(2:n,:); f(n,:) - f(1,:)]; %... |
function batchConvertClustersToSegmentPoints
% sysparam.tolerance = 0.2;
% sysparam.offset = 0;
% sysparam.offsetDir = 'shift';
% offsetArray1 = [0];
% offsetArray2 = [-0.05];
offsetArray1 = [-0.06:0.01:0.01];
offsetArray2 = [-0.06:0.01:0.01];
% generate paths to th... |
function [ plotters ] = plot_full_sim(wrfout, ts )
% inputs:
% wrfout - path to a wrfout file
% ts - time_step in wrfout
%plots fire cone
[fire_name,save_name,prefix,perim] = fire_choice()
% fire_choice = input_num('which fire? Patch: [0], Camp: [1], Cougar: [3]',1);
cycle = input_num('Which cycle? ',0)
% if fire... |
function tmp_get_anova_counts( mfs, drug, current, paradigm )
if nargin < 1, load master_file_struct; mfs = master_file_struct; end
counts = [0 0 0];
total = 0;
% Get Substruct of Specified Drug
substruct = mfs.session( find( strcmp( {mfs.session.drug}, drug ) ) );
%%% TMP ... |
function y=fInverse(x)
%inverse of the activation function f: Arctanh(x) or identity or
%custom-made according to your chosen f
y=atanh(x);
% y = x; |
d = pixels(1,:);
s_actual = pixels(2,:);
s_calc_e = zeros(1,length(s_actual));
s_calc_p = zeros(1,length(s_actual));
for i=1:length(d)
s_calc_e(i) = 666.2*exp(-0.0065*d(i)) + 114.4*exp(-0.00066*d(i));
s_calc_p(i) = 74300 * d(i)^(-1.058) + 8.074;
end
hold on;
plot(s_actual,d,'x-');
plot(s_calc_e,d,'x-');
plot(... |
function params=read_ATL03_params(filename, pairs)
if ~exist('pairs','var')
pairs=1:3;
end
GT={'1','2','3'};
LR={'l','r'};
% read which TEP to use with which spot (laser beam?? check this)
try
TEP_spots=h5read(filename,'/ancillary_data/tep/tep_valid_spot');
catch
TEP_spots=ones(1,6);
end
% read the... |
function [hasFace,scatteredBBStructs,unifiedBBStructs]= faceDetection(im)
%FACEDETECTION 此处显示有关此函数的摘要
% 此处显示详细说明
m=size(im,1);
n=size(im,2);
narrowerSide=min(m,n);
red=im(:,:,1);
green=im(:,:,2);
blue=im(:,:,3);
borderRatio=1/16;%border的宽度(高度)占整幅图像的宽度(高度)的比例
rowBorder=floor(borderRatio*m);%rowBorder以内的像素不会被... |
#
# study example at slide 53
#
clear;
data = [
41 66 90;
57 56 60;
61 72 79;
69 73 72;
63 52 88;
62 83 80
]
# data scatter - sum of all elements squared
data_scatter = sum(sum(data .* data)) #=> 86092
[Z,Mu,C] = svd(data);
#Z
#Mu
C
Z = Z(:,1:3)
Mu = Mu(1:3,:)
# best mu
mu1 = Mu(1,1) #=> 291.39
# m... |
origin_data_file = fopen('./dataSets/predicting/submission_sample_travelTime.csv') ;
or_data_labels = textscan(origin_data_file, '%s %s %s %s',1,'Delimiter',',' ) ;
od_cells = textscan(origin_data_file, '%q %q %q %q','Delimiter',',');
fclose(origin_data_file);
weather_data_file = fopen('./dataSets/testing_phase1/weat... |
function [area, number] = area_number(c, v, len)
number = zeros(len, 1);
area = zeros(len, 1);
for i = 1:len
ind = c{i}';
area(i) = polyarea( v(ind, 1), v(ind, 2) );
number(i) = size(c{i}, 2);
end
end
|
addpath Track/
addpath Car/
addpath utilities/ |
% This is only for the PixelLabelData created using ImageLabeller.
% The ImageLabeller generated gTruth variable in the workspace
labelImg = imread(string(gTruth.LabelData{:,:}));
[h,w] = size(labelImg);
rgbImageVis = zeros(h, w, 3,'uint8');
for i = 1:h
for j = 1:w
id = 1;
... |
clc
clear all
im = double(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week5/noisy.jpg'));
im2 = double(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week5/stan.jpg'));
im_med1 = medfilt2(im);
im_med2 = medfilt2(im_med1);
figure
subplot(2,2,1),imshow(uint8(im));
subplot(2,2,2),imshow(uint... |
function y = RY(x,SNRdB)
% y=awgn_noise(x,SNR) adds AWGN noise vector to signal 'x' to generate a
% resulting signal vector y of specified SNR in dB
L=length(x);
SNR = 10^(SNRdB/10); % SNR coneversion from SNRdB
Esym=sum(abs(x).^2)/(L); % Calculate actual ... |
%-----------------------------------------------------------
%
% M-file: pump_cool.m
% Revision history:
% Created: 1998 by Kristina Johansson
% Modified: 991206
% 000512
% 000815
%------------------------------------------------------------
function f=pump_cool(u,Tcool,g,dpipefc,Lpipefc,etapump,T... |
function [logtheta_all nl] = learn_mtgp( logtheta_all, deriv_range, data )
%LEARN_MTGP Learns hyperparameters of mtgp model using minimize
%
% INPUT:
% - logtheta_all : All initial hyper-parameter values
% - deriv_range : Indices of hyper-parameters to optimize for
% - data : cell data in the order
% ... |
function [noOfImage,imageSet, mface, eigen_faces, weights_mat] = face_trainer()
%%% Image training and finding eigenfaces
imagelist = dir('image_set');
noOfFile = length(imagelist);
noOfImage = noOfFile - 2;
imagelist = imagelist(3:noOfFile);
disp(noOfImage);
imageSet = cell(1, noOfImage*2);... |
function [ out ] = u_fixedBC(x,t,L,D,A,B)
%1D Concentration, as a function of x,t, L (length of gel), D (diffusion
%coefficient, A (left side boundary concentration), B (right side boundary
%concentration)
% Detailed explanation goes here
syms n
lambda_n=(n*pi/L)^2;
sum_n=A/(2*pi*n)*exp(-lambda_n*D*t)*sin(n*pi/L*x);
... |
clc;
clear;
close all;
for i = 1 : 10
imageName = strcat(num2str(i), '.pgm');
I = imread(imageName);
subplot(2, 5, i);
imshow(I);
end
|
function pop=sorting(pop)
% sort the pop according to the crowding distance
[~,index]=sort([pop.cdis],'descend');
pop=pop(index);
% sort the pop according to the ranking value
[~,index]=sort([pop.rank]);
pop=pop(index);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ... |
# -*- octave -*-
function plot_title(plotFileName, dataFileName)
cmd = ["pstext -JX6i/3i -R0/1/0/1 -N -D0/.1i "];
fid = popen([cmd " -O >> " plotFileName], "w");
dd=dataFileName(end-19:end-7);
qrg_kHz= sscanf(dataFileName(9:end-28), "%06d", [1 1])/1000;
fprintf(fid, "0.5 1.0 18 0 0 CB %.1f kHz %s\n",
qrg... |
function movie = maskMovie_fn(movie, maskBounds)
% movie = maskMovie(movie, maskBounds)
%
% Trim off the edges of a movie. This is desirable after motion correction.
%
% The input movie may be either a 3D array containing the movie data, or
% the path to a single .tif file. The output movie will always be a 3D
... |
figure(1); clf;
im1 = imread('newyork/image1.png');
im2 = imread('newyork/image2.png');
corespondes = csvread('newyork.txt');
px1 = corespondes(1, :);
py1 = corespondes(2, :);
px2 = corespondes(3, :);
py2 = corespondes(4, :);
displaymatches(im1, px1, py1, im2, px2, py2, inf);
H = estimate_homography(px1, py1, px2, p... |
% script to run experiments
fix(clock)
txGain_all = [10,15,20,25,30,35];
numPayload_all = [500,1004,1500,2004];
% numRuns = size(txGain_all,2);
%numRuns = size(numPayload_all,2);
numRuns=1;
%initialize arrays of data
packetArray_all = cell(1,numRuns);
packet_number_all = zeros(1,numRuns);
packets_sent_all = zeros(... |
clear all;
close all;
Dataset_ALL_augmentations2;
Dataset_ALL_augmentations3;
Dataset_ALL_augmentations4;
clear all;
close all;
|
close all;
clear;
%%
files = dir('/home/mikkel/workspace/rovi2/rovi2/tests/pose_estimation/data_objects/*.csv');
fullpaths = fullfile({files.folder}, {files.name});
n = length(fullpaths);
real_is_valid_all = [];
time_all = [];
for i=1:n
i=5
[pathstr,name,ext] = fileparts(string(fullpaths(1,i)));
%%
da... |
%梯度向量場的繪製
%先以gradient()計算梯度,再以quiver()繪出圖形
clear;clc;clf
x=[-2:0.2:2];
y=[-2:0.2:0.2];
[xx,yy]=meshgrid(x,y)
zz=sin(xx).*cos(yy);
figure(1)
surf(xx,yy,zz)
xlabel('x-axis');ylabel('y-axis')
[u,v]=gradient(zz);%一舉陣zz計算出每一個資料點的梯度
%並把x方向的梯度設給矩陣u,把y方向的梯度設給矩陣v
figure(2)
quiver(xx,yy,u,v) %在座標軸為xx和yy的點上繪出一個箭頭
%箭頭的大小方向由矩陣u和矩... |
classdef systemController
properties
m
b
k
K
Kr
limit
Ts
end
methods
function self = systemController(p)
% specify gains
self.m = p.m;
self.b = p.b;
self.k = p.k;
self.K= p.K;
self.Kr =... |
[filename, filepath] = uigetfile('\\zubjects.cortexlab.net\Subjects\');
new_filename = [filename(1:end-4), '_inverted.mj2'];
vr = VideoReader(fullfile(filepath,filename));
nv = VideoWriter(fullfile(filepath,new_filename), 'Motion JPEG 2000');
open(nv);
for iFrame = 1:vr.duration*vr.FrameRate
frame = imcomplement(... |
%% Reproduces Figure 6d-f in Bonnen et al. 2019
% Demonstrates how motion direction estimation changes with viewing
% distance in the proposed 3D model
%
clear; close all;
% load model predictions
inits = {['decoding_opt_czuba_xz_velocity_speed_5_ecc_5vd_20_N_236'],...
['decoding_opt_czuba_xz_velocity_speed_5_ec... |
function [ cfo ] = estimate_cfo(rx_sym1,rx_sym2,fs)
cfo = -(fs/(2*pi*length(rx_sym1)))*angle(sum(conj(rx_sym2).*rx_sym1));
end |
README for tinyos-1.x/contrib/ucbRobo/tools/matlab Directory
Author/Contact: Phoebus Chen (http://www.eecs.berkeley.edu/~phoebusc/)
Description:
************
This directory contains the MATLAB tools for applications meant to be
run on the 330 Cory Testbed. The goal of the testbed is to monitor
and better understand... |
function H = solveHomo(match1,match2)
n = length(match1);
A = zeros(2*n,9);
A(:,1:3) = kron([match1 ones(n,1)], [1;0]);
A(:,4:6) = kron([match1 ones(n,1)], [0;1]);
x1 = match1(:,1)';
y1 = match1(:,2)';
x2 = match2(:,1)';
y2 = match2(:,2)';
A(1:2:2*n,7) = -x2.*x1;
A(2:2:2*n,7) = ... |
function phcllpvptrhs(varargin);
% phcllpvptrhs( [...] );
% LPV PTRHS
h = timeplot({'ILPV_PTRHS'}, ...
'LPV PTRHS', ...
'PTRHS', ...
{'ILPV\_PTRHS'}, ...
varargin{:} );
|
function [norm_mat, mR, rR] = normalize( mat, minRow, rangeRow )
if nargin <2
minRow = min(mat);
rangeRow = max(mat) - min(mat);
end
norm_mat = bsxfun(@minus, mat, minRow); % 0 - max
rangeRow(~rangeRow) = 1; %Replace all 0s with 1s (to prevent /0)
norm_mat = bsxfun(... |
function T = compute_hufftree(p)
% compute_hufftree - build a huffman tree
%
% T = compute_hufftree(p);
%
% p(i) is the probability of having token i.
%
% Copyright (c) 2008 Gabriel Peyre
m = length(p);
% build initial trees
T = {};
for i=1:m
T{i} = i;
end
% build Huffman tree
while len... |
function [ERSP,ITC,powbase,times_out,freqs_out]=...
EEG_TimeFreq(DataSet,phase_in,Condition,subject,freqs_in,cycles,...
varargin)
% DataSet is the RawDataSet of current phase
% Can sepcify if contrasting two conditions or not
% if turn off contrasting, ERSP and ITC returned will be a structure array
% that corr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.