text stringlengths 8 6.12M |
|---|
im = imread('saha.jpg');
r = im(:,:, 1);
g = im(:,:, 2);
b = im(:,:, 3);
bwr = abs(double(r) - 255) <= 80;
bwg = abs(double(g) - 0) <= 80;
bwb = abs(double(b) - 0) <= 80;
bw = bwr .* bwg .* bwb;
bw2 = cat(3, bw,bw,bw);
sz = true(size(bw2));
konum = regionprops(sz, bw2, 'WeightedCentroid'); % Agirlik merkezi aliniyor... |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2021 by California Institute of Technology. ALL RIGHTS RESERVED. %
% United States Government sponsorship acknowledged. Any commercial use %
% must be negotiated with the Office of Technology Transfer at the %
... |
function [runs,missing]=getconvergencescanresults(dirpath,makeplots)
% For a simple convergence scan in Sfincs,
% this loads the results stored in the subdirectories named 00/, 01/,... in "dirpath"
% Plotting is made if makeplots=1.
[runs,missing]=getresults(dirpath);
if not(isempty(missing))
missing_runs={missin... |
%RAYLEIGH3 optical depth
%tau = bodhaine(wl,pr)
% wl in nm; weak parameters set for Davos
%Ref: B.Bodhaine et al. J.Atm. and Ocean. Tech., 16, 1854-1861 (1999)
% 14 4 2007 julian: Compare with nicolet.m, and results are over range
% 300-900 within +-0.001 in optical depth
function tr=bodhaine(wl,pr)
... |
% Description: MatLab program to get phase diagram data from USPEX output (varcomp).
% Author : Maxim Rakitin, maksim.rakitin@stonybrook.edu
% Date : 2013-12-30
% Last update: 2014-02-17 - fixed problem when the list of ID's starts not
% from 1, but any other number.
% $Rev: 943 $
%... |
function [v,N] = tangentBehaviour(f,action,vecField,z0,L,m)
%In this method we solve the equation and compute the tangentiality
%conditions for the solutions obtained with the various schemes. The
%output value N is just the number of time instants considered.
T = 5; %Final time
M = length(z... |
function [net,x1,x2,upred,vpred,uobs,vobs,rmsError] = runCrossVal(X,Y,X0,Y0,meanY,sdY,epochs,l2Reg,L1,L2,partition)
x1 = [];
x2 = [];
upred = [];
vpred = [];
uobs = [];
vobs = [];
for k = 1:partition.NumTestSets
[net,utestk,vtestk] = trainAndPredict(X,Y,meanY,sdY,epochs,l2Reg,L1,L2,partition,k);
upred = [upr... |
function [taylor,holberg,kindelan,mittet,liu] = deriv1_staggered_coeffs(L,grerr)
% DERIV1_STAGGERED_COEFFS Compute staggered-grid finite-difference coefficients
% [taylor,holberg,mittet,liu] = DERIV1_STAGGERED_COEFFS(L,grerr) returns
% finite-difference coefficients that approximate the first-order
% derivative ... |
clc;
VF = v';
I = ii;
dt = 0.0002;
a1 = find(VF>3.5);
b1 = zeros(1,length(a1));
b1(1,1) = a1(1,1);
j = 1;
for i = 1:(length(a1)-1)
if a1(1,i+1) > a1(1,i)+5
j = j+1;
b1(1,j) = a1(1,i);
j = j+1;
b1(1,j) = a1(1,i+1);
end
end
j = j+1;
b1(1,j) = a1(1,length(a1));
... |
function [GroupA] = cumulativeSum_Train(GroupA);
%{
This function calculates the cumulative sum in amplitude (pA) and in
percent from my train data. Step in determining the relative readily
releasable pool.
This function is used in the following script:
Analyze_Trains_Godfrey.m
%}
% for calculating the cumulative su... |
function [output] = parse_many(filenames, secs_interval)
%% Function input
% filenames: array of cut csv filenames to parse
% secs_interval: The interval of time of data captures
%% Function output
% output: Matrix where first column is time and subsequent columns
% represent the data poin... |
%-------------------------------------------------------------------------%
%
% File: RBF_PUM_diffmat_gauss(data,ep)
%
% Goal: script that computes the differentiation matrices for the Gaussian
% kernel
%
% Inputs: data: the collocation points
% ep: the shape parameter
%
% Calls on... |
%Set the to be loaded vars as global
global img_str;
%Load in the Constants
load('const.mat');
|
function find_exp_min_max(base_dir,varargin)
tic;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Setup variables and parse command line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
i_p = inputParser;
i_p.addRequired('base_dir',@(x)exist(x,'dir') == ... |
%17-45
m = input("mass of trailer gate in Mg: ");
a = input("acceleration of truck in m/ss: ");
C = input("distance from point c to CG: ");
A = input("distance from point a to CG: ");
syms T cY cX
sumX = m * a == cosd(15) * T * + cX;
sumY = m + T * sind(15) - cY == 0;
sumM = m*9.81*C*cosd(45) +m*a*C*sind(45) - T*cos... |
%% input data
user12final = removevars(user12finalfile,{'VarName1'});
gt = user12final(:,{'groundtruth'});
array = table2array(gt);
gt_new = cellstr(array);
gt_class_labels = grp2idx(gt_new);
user12final = removevars(user12final,{'groundtruth'});
user12final = table2array(user12final);
user12final = transpose(user12fin... |
close all; clear all; clc;
% problem 1 - shooting problem for quantum oscillator
% Pxx -[1*x^2 - e]P = 0 solve for 5 eigenvalue/functions
tol = 10^(-4); % tolerance for all convergence
col = ['r', 'b', 'g', 'c', 'm']; % colors for all 5 eigenvalues/functions
xspan = [-4:0.1:4]; % span for x from -4 to 4
eig_start ... |
In de onderstaande code wordt een stuk uit de
variabele 'tekst' geselecteerd. Deze geselecteerde tekst wordt
in de variabele 'selectie' gestopt en bevat de tekst: 'hoera'.
======= Code =======
tekst = 'hieperdepiephoera';
selectie = tekst(end-4:end);
======= Code ======= |
fc_tools.utils.cleaning()
N=300;
[bvp,info]=fc_vfemp1.examples.elasticity.setBVPElasticity2D_ex01(N,2);
fprintf('*** Solving 2D Elasticity B.V.P. problem\n');
U=bvp.solve('split',true);
E=FEM.errors(bvp.Th,U,info.solex);
fprintf('*** Relative Errors\n');
fprintf(' -> Norm Inf: %.4e\n',E(1));
fprintf(' -> Norm L2... |
function success = uq_PCE_test_constant(level)
% pass = UQ_PCE_TEST_CONSTANT(LEVEL): Non-regression test to assert that
% the constant type dimensions are respected throughout PCE evaluation.
%
% Tested PCE computation methods:
% 1) OLS
% 2) LARS
% 3) Quadrature
% 4) OMP
%
% The test also intends to enforce consisten... |
clear
clc
close all
t=-5:0.2:2;
t0=3;
y=-unitstep(t+t0);
figure(1)
stem(t,y,'color', [255 0 0]/255,'Linewidth',2)
axis([-5 2 -2 1])
xlabel('n')
ylabel('f[n]') |
clear;
H = load('cppH.txt');
A = zeros(66,66);
A(1:6,1:end) = H(1:66,1:end)';
A(1+6:6+6,1:end) = H(1+(66*1):66+(66*1),1:end)';
A(1+6+6:6+6+6,1:end) = H(1+(66*2):66+(66*2),1:end)';
A(1+6+6+6:6+6+6+6,1:end) = H(1+(66*3):66+(66*3),1:end)';
for j = 0:11-1
A(1+j*6:6*(j+1),1:end) = H(1+(66*j):66+(66*j),1:end)';
end
B... |
function [q, v, u, T, V, B, phi] = ball_collision(alpha, r, r_s, m)
% dynamics of a ball of radius r and mass m that can interact with a static
% ball of radius r_s
% zero friction means that the ball will not rotate, so the angle of the
% ball will not be modeled
g = 9.81;
syms qx qy;
syms dqx dqy;
assume([qx qy dq... |
clear
close all
for u = 28
name_wake = sprintf('ucd%03d_wake_g',u);
name_deep = sprintf('ucd%03d_deep_g',u);
if u~= 4 && u~= 16
load(name_wake);
load(name_deep);
%加载完数据
data_wake = eval(name_wake); %字符串转换为变量名
data_deep = eval(name_deep);
... |
function [indicies] = blockselection3()
% This is a script to randomly select blocks in the 2-dimensional 4x8
% subsurface to update in an MCMC algorithm
% Each individual block is 2x2
n = round((rand*10)+0.5);
n = (n*12)-11;
sim = rand;
if sim <= 0.5
n = n + 3;
end
i = zeros(1,120);
i(n) = 1;
i(n+1) = 1;
i(... |
% <header>
% <name>
% poistats
% </name>
%
% <objective>
% Find optimal path between 2 specified points using Replica Exchange Monte Carlo algorithm
% </objective>
%
% <input>
% instem, outdir, seedstem, samplestem,
% ncontrolpoints, initsigma,
% nsamplepoints, maskstem
% </input>
%
% ... |
load census
t = cdate-1790;
y = pop;
hold off
A = [t.^3 t.^2 t ones(length(t),1)];
[Qa,Ra] = qr(A);
xa = Ra\(Qa'*y);
plot(t,y,'.',t,A*xa)
title('Cubic OLS Problem for U.S. Population Using QR Factorization')
xlabel('Time (Years), beginning in 1790')
ylabel('Population Size')
legend('Actual','Predicted')
figure;
Ab ... |
% SetInfo_Mcspace
% uses .eq HRIRs, therefore make sure earphone filters are also selected
XStimParams.ephone_flag = 0;
set(H.ephoneuseit,'Value',0);
XStimParams.space_flag = 1;
XStimParams.ildalone_flag = 0;
XStimParams.itdalone_flag = 0;
XStimParams.ABLalone_flag = 0;
if get(H.mcSpace_DynamicRangepb,'valu... |
function runCPsort(source,~)
% ask the user which trials and conditions to use for CP analysis
gui = guidata(source);
m = gui.data.info.mouse;
sess = gui.data.info.session;
use = gui.allPopulated(:,1)==m & gui.allPopulated(:,2)==str2double(strrep(sess,'session',''));
trList = gui.allPopulated(use,3);
bhv... |
function [width,area,sn, comx,comy,comvelx,comvely] = ...
estcomspeed(t,xms,yms,xns,yns,xls,xrs,yls,yrs)
% function [width,area,sn, comx,comy,comvelx,comvely] = ...
% estcomspeed(t,xms,yms,xns,yns,xls,xrs,yls,yrs)
% Estimates the position and velocity of the center of mass, given the four
% sets of points that d... |
function res = reaction2sparse(s, arrow)
if nargin < 2
arrow = '=';
end
tmp = regexp(s, sprintf('\\s*%s\\s*', arrow), 'split');
left = regexp(tmp{1}, '\s*\+\s*', 'split');
right = regexp(tmp{2}, '\s*\+\s*', 'split');
res = {};
d = regexp(left, '\s*(\d+ )?(C\d+)\s*', 'tokens');
for i = 1:length(d)
d{i}{1} = d{... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symmetry Based Analysis of Facial Expressions Partially Occluded Due to Head Motions
% Version : 1.0
% Date : 01.2.2017
% Author : Mehdi Ghayoumi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [M,time,freq,PR,P,R] = plot_spectrogram_16electrodes(epochs,baselines,varargin)
inputs = parse_my_inputs(epochs,baselines,varargin{:});
M = [];
time = epochs.time;
freq = epochs.freq;
global verbose
if verbose && inputs.plotting
fprintf('Spectrogram Plotting in Process...\n')
end
if strcmp(inputs.ch... |
[y,Fs] = audioread('studio_female.wav');
info = audioinfo('studio_female.wav');
t = 0:(1/Fs):(info.Duration);
t = t(1:end-1);
%subplot(3,1,1);
%plot(t,y);
soKhung=ceil(info.Duration/0.02);
E=zeros(soKhung,1);
%chia khung tin hieu
khung=zeros(soKhung,320);
n=1;
for m=1:soKhung
i=1;
while (i... |
% SCOPO FUNZIONE: Prepara il file audio per l'individuazione degli endpoints
% e crea una matrice con solo l'evento sonoro corrente ritagliato grazie ai
% risultati forniti dalla funzione di individuazione degli endpoints.
%
% PARAMETRI INPUT:
% - signal: segnale originale acquisito.
% ... |
function varargout = notes_up_down(varargin)
% NOTES_UP_DOWN MATLAB code for notes_up_down.fig
% NOTES_UP_DOWN, by itself, creates a new NOTES_UP_DOWN or raises the existing
% singleton*.
%
% H = NOTES_UP_DOWN returns the handle to a new NOTES_UP_DOWN or the handle to
% the existing singleton*.
%
% ... |
function self=MECHDTConnection(robotName,ipAddress,tcpPort)
self.MECH_send = @MECH_send;
connect = controller(ipAddress,tcpPort,'matlab');
funct = registerfunction(connect,'MECHDataParser','*/MECHdata');
channelidx = addcommandchannel(connect,'commands');
start(connect);
scrdstid = 1;
controlschem = 2;
function funct ... |
function [ s ] = random_angles()
costheta = 1.0 - 2.0*rand();
sintheta = sqrt(1.0 - costheta*costheta);
psi = 2.0*pi*rand();
cospsi = cos(psi);
if (psi < pi)
sinpsi = sqrt(1.0 - cospsi*cospsi);
else
sinpsi = -sqrt(1.0 - cospsi*cospsi);
end
s(1) = sintheta*c... |
% A propeller version from phd thesis of Kevin
% airfoil: Clark Y
%prop(1)
theta_0 = deg2rad(65);
u = 100;
v_i = fsolve(@(x) prop(x,theta_0,u),1,optimset('Display','iter','Algorithm','Levenberg-marquardt'))
[~, X_b,~,~,~,~,~]= prop(v_i,theta_0,u)
%%
table_propeller_config = readtable('propeller_config.csv');
u = 100;
... |
function [V,o] = generateActivation(X,N,S,head,sigma)
% V=GENERATEACTIVATION(X,N,S,HEAD,SIGMA)
% simulate activation patterns of seed points in X, sized by N, scaled by
% S, using the head model head and noise standard deviation sigma
%
% X: nSeeds x 3 matrix of seed positions
% N: nSeeds x 1 vector of numbe... |
function [ score ] = momentumStart( bars, pricetype)
%MOMENTUMSTART 封装tgt中的同名函数
% bars Bars类型数据
% pricetype str, 'close'(defualt), 'high', 'low' 等
% 判断趋势起点,分数越高越是升势起点,反之降势起点
%% default value
if nargin<2
pricetype = 'vwap';
end
%% main
eval( [ 'price = bars.' pricetype ';']);
score = tgt.momen... |
% fill up proc structure with appropriate ROI information
function proc = ConstructProc(data, handles, isproc)
rX = handles.rX;
rY = handles.rY;
rXc = handles.rXc;
rYc = handles.rYc;
for jf = 1:length(handles.files)
for j = isproc
switch j
case 1
proc(jf).pupil.ROI = handles.ROI... |
function [out] = getStimLFP(es, p, stimTimes, dT)
if nargin<4
dT = 1; % 1 sec before and after the stimulus
end
sampleRate = 30000;
% if nargin<4
% var = 6; % 6 for contrast in vs stimuli
% end
numStim = length(p.pfiledurs);
numReps = p.nrepeats;
for iStim = 1:numStim
for iRep = 1:numReps
startT = ... |
% Get_Point_Cluster
% Get Point sets which each point (p0) in this set meets
% the condition with other points (px) that Euclidean_distance(p0,px)<distance
%
% Input: A
% point vector that has the coordinates of all the points
% Input: distance
% Output: point_cluster
function point_cluster=Get_Point_Cluster(A... |
function[m i j] = min2(A);
%MIN2 - returns the minimum and the row and col index of a 2d matrix
[m1 i1] = min(A);
[m j] = min(m1);
i = i1(j); |
function [mpc, success] = set_up_opf(mpc)
%%
[PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, VA, ...
BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
[F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
... |
De naam van een script mag NIET beginnen met een
willekeurig symbool. |
global bciroot;
%expt = 'own_experiments/motor_imagery/anthesia';
bciroot = {'/Users/louk/Data/Raw' '~/Data/Raw' '/media/LoukStorage/Raw'};
expt = 'long_movements/';
dtype = 'raw_bdf';
fileregexp='.*\.bdf';
subjects= {'yvonne' 'jeroen' 'alex' 'hans' 'linsey' 'marjolein' 'fatma' 'jason' 'betul' 'rik'}; % subj{
... |
a = 5;
x = 0:0.5:a;
y = 0:0.5:a;
E_L = 0.521405*a;
ps = [0.1 0.3];
v = unifrnd(1,2);
init_x = makedist('Uniform','lower',0,'upper',a);
f_init_x = pdf(init_x, x);
init_y = makedist('Uniform','lower',0,'upper',a);
f_init_y = pdf(init_y, y);
f_init = f_init_x.*f_init_y;
f_tp = unifrnd(0,100);
E_ftp = mean(f_tp);
f_t... |
function [t]=translation_matrix(x,y,z)
t=zeros(3,1);
t(1,1)=x;
t(2,1)=y;
t(3,1)=z;
|
% Digital Communication Lab 7 MPC estimation
% VUB BRUFACE
% Yu Liu, Bohan Zhang, Xianjun Mao
%
%% Parameters
clear all
addpath('functions/');
addpath('misc/');
% ------------ basics --------------- %
flags.N_line = 10; % how many points in a line
flags.N_bins = 501; % the number of bins
flags.N_pts = 128; % the numb... |
%*** 24/12/2018*********************************************%
%*** ALHASAN ALKHATIB B140100255****************************%
%*** Ses kayitlari ile Parkinson hastaligi tespiti**********%
%*** Main.m dosyasi*****************************************%
%***********************************************************%
Dat... |
% Morlet wavelets for all signals in brainstorm_db
clear;clc;
ProjectName = 'sheng'; %%%%%
brainstorm_db = '/dataslow/sheng/Project of Sheng/brainstorm_db/sheng/data';
Result_Location = ['Results/sheng/Mat_Time_Frequency/'];
Rhythms = {'total','induced', 'evoked'}; % % 'evoked' 'ivectorlow' 'ivectorhigh' 'isingle10'... |
function [ r ] = T_L( x, y )
r = max(0, x+y-1);
end
|
function tot_T = generate_fixed_tot_T(cities,edges,dt)
% This function is meant to be the interface between the network and the disease simulation.
k = cities(:,1); % degree
N = cities(:,2); % Total population
I = cities(:,3); % Infected
S = N - I; % Total p
k_mean = mean(k);
% Timefactor
tf = dt/24;
% Transport ... |
function [x_out,v_out,a_out,index_out]=aceleracion_constante(x_in,v_in,a_in,x0,v0,a0,j,xmax,vmax,amax,t,index_in)
i=index_in+1;
x_out=x_in;
v_out=v_in;
a_out=a_in;
if a0>0
while 1
a_out(1,i)=a0;
v_out(1,i)=a0*t(1,i-index_in)+v0;
x_out(1,i)=a0*(t(1,i-index_in)^2)*0.5+v0*t(1,i-index_in)+x0;
... |
function [adw]=fsc_ff_bp(args,input,label)
%% 前向传播
x1=input;
for i1=1:length(args.layer)-2
c0=zeros(1,size(args.Weight{i1}.r_i,1));
[x2{i1},in2{i1},f2{i1},z2{i1},c2{i1},o2{i1},y2{i1}]=LSTM_step_ff_fast(x1,c0,args.Weight{i1});
x1=y2{i1};
end
predict=LSTM_output_ff(args.outputL... |
function sp = get_shield_params(expt_name)
% Put everything in meters. or degrees.
switch expt_name
case 'Custom'
fb_h = 0.7366;
fov = 20;
win_d = 0.31;
dk_off = [-1.1, 1.5964];
el_off = [0., 1.1750];
az_off = [0., 0.];
min_el = 50;
n_rx = 5;
... |
function [lobemat]=lobe_cmp(cmpmat)
lobemat=zeros(24,24);
labelnum=zeros(1,83);
labelnum(1:14)=1; labelnum(15:20)=2; labelnum(21:24)=3; labelnum(25:33)=4;
labelnum(34:41)=[5:1:12];
labelnum(42:55)=13; labelnum(56:61)=14; labelnum(62:65)=15; labelnum(66:74)=16;
labelnum(75:83)=[17:1:25];
% 1: RF
% 2: RP
... |
function [statistics] = evaluation(examples, targets, net)
%cross validation and the avg statistics for all the folds
statistics = struct('conf_matrix',[],'avg_classification_rate',[],'avg_recall_rates',[],'avg_precision_rate',[],'avg_fold_falpha_measure',[],'avg_class_falpha_measure',[]);
random_examples = e... |
do_save = true;
savefld = fileparts(mfilename('fullpath'));
if ~isempty(savefld); savefld = fullfile(savefld,'figs'); end;
%% Figure showing overview of all colormaps
n0 = 8;
n1 = 32;
n2 = 33;
cmap_settings = {...
'blackwhite' , n1, '';
'purple' , n1, '';
'hot' , n1, '';
'hotcold... |
% Input:
% data a row vector. The sampled positions according to some
% distribution.
% alpha a scalar. The concentration parameter of the DP.
% actN a scalar. The number of the maximum of activated atoms.
% maxIter a scalar. The maximum number of gibbs itera... |
classdef UAV
properties (SetAccess = private)
active;
% When it was launched
launchingTime;
% Probability to avoid the collision with an UAV
fearness;
estimatedPosition;
previousEstimatedPosition;
estim... |
function [pilih_sel,titik,d]=rayline(x1,z1,x2,z2)
% pilih_sel = subscript sel yang dilewati garis (kolom 1 x, kolom 2 z)
% titik = titik yang dilalui garis pada setiap sel
% d = jarak ray pada setiap sel slowness
% x1, z1 = koordinat titik awal garis
% x2, z2 = koordinat titik akhir garis
%
% CATATAN : |x1-x2| d... |
function [ap,analysisParams]=exstraightAPind(x,fs,f0,optionalParams)
% Aperiodicity index extraction for STRAIGHT
% [ap,analysisParams]=exstraightAPind(x,fs,f0,optionalParams)
% Input parameters
% x : input signal. if it is multi channel, only the first channel is used
% fs : sampling frequency (Hz)
% f0... |
function [fitresult_511,fitresult_base] = fit_expANDgaussian_2(energy)
%FIT_EXPANDGAUSSIAN Summary of this function goes here
% Detailed explanation goes here
FIGURE_ON = 0;
xbin = 0:10:2000;
n = hist(energy,xbin);
%%
idx_511mask = xbin < 800 & xbin > 200;
idx = idx_511mask;
x = xbin(idx);
y = n(idx);
[xData, y... |
function [AbsA, Absb] = AbsScaleConstraint (I, Luma)
[h,w,~] = size(I);
N = h * w;
% find brightest pixel(s).
BrightestPos = find(Luma > 0.99); %0.999: 65pos; 0.99: 4355pos.
% Num_brightest = size(BrightestPos, 1);
Absb = zeros(N, 1);
Absb(BrightestPos(:)) = 1;
AbsA = sparse(1:... |
function D = idivergence(X, C, V, W)
% IDIVERGENCE Calculate point to cluster centroid distances by I
% divergence.
% Copyright 2008 Wei Tang (wtang@cs.utexas.edu)
% $Id: idivergence.m,v 1.2 2008/04/19 01:20:47 wtang Exp $
if (size(W,1) ~= size(X,1)) || (size(W,2) ~= size(X,2)) ...
|| (size(C,1) ~= size(X,1)) || (s... |
function varargout = SIGNAL_PROCESSING_OPTIONS(varargin)
% SIGNAL_PROCESSING_OPTIONS MATLAB code for SIGNAL_PROCESSING_OPTIONS.fig
% SIGNAL_PROCESSING_OPTIONS, by itself, creates a new SIGNAL_PROCESSING_OPTIONS or raises the existing
% singleton*.
%
% H = SIGNAL_PROCESSING_OPTIONS returns the handle to a... |
%%%This version of BART takes one 't' as the trigger from the scanner to
%%%start. Also, you can leave the trigger on because after the task has
%%%started, the task will only be sensitive to 'b' and 'y'. This version
%%%of the task uses Roger Woods' KbQueue functions.
%%% Modified by Veena Narayan
%% setting up s... |
%Ejercicio 2
%dtft de una funcion
w=0:pi/200:pi;
[x,a]=impulso(-1,-5,5);
[y,b]=impulso(0,-5,5);
[z,c]=impulso(1,-5,5);
[v,d]=impulso(2,-5,5);
[k,e]=impulso(3,-5,5);
X = 5*x + 4*y + 3*z + 2*v + k
Y = dtft(X,a,w)
subplot 333 ; plot(w/pi, abs(Y)); title('magnitud Y');
subplot 334 ; plot(w/pi, angle(Y));... |
function p = parameters()
p.epsilon = 0.0001; % regularization
p.K = 4; % number of desired clusters
p.n_iter = 3; % number of iterations
%p.core_set_indices = [1,2,3,4,5,6]; % Core set of speakers
p.core_set_indices = [1,2,3,4];
p.gesture_indices = [1,2,3,4,5];
p.receiver_indices = [1,2,3,4,5];
p.C... |
function handles = match_category_id_selecter_callback(handles)
% This function handles plotting the correct category/categoryID
% pulse/track onto the GUI axes
% handles=guidata(handles.output);
% Get data
pulse = handles.pulse;
cells = pulse.cells;
% embryo_struct = handles.embryo_struct;
% fits = handles.pulse.fit... |
function draw_topology(id, parent, coor, basestationID)
% parent = 0:49; parent(1) = 1;
% id = 1:50;
clf;
hold on
set(gca, 'Color', [0 0 0]);
for i = 1:length(id);
node_id = id(i);
parent_id = parent(i);
if (node_id == parent_id)
continue;
end
if (basestationID == node_id... |
function [final_image,params] = image_stitcher2(tilepath)
save_folder = [tilepath '/Stitched'];
fov_um = 1000;
if exist(save_folder,'dir')
rmdir(save_folder, 's');
end
%Get the file location and names
stimList = dir(tilepath);
stimList = stimList(~ismember({stimList.name},{'.','..'}));
num_tiles = numel(stimList... |
function retval = testData (m_test, theta1, theta2, output_layer, letter)
# We will be given the letter as a parameter
# First we read the data
fprintf("Started Testing Data ...");
X_cv = zeros(m_test, 32*32); # Create a matrix in which you will store the data
y_cv = zeros(m_test, 1);
k = 1;
... |
node=11;
n_frame=100000;
exact_R=zeros(60*length(node),1);
size_L_write=zeros(60*length(node ),1) ;
d_write=zeros(60*length(node ),1);
node_write=zeros(60*length(node ),1);
sum_d=0;
for node_index=1:length(node)
for L=1:6
for D=L+1:L*node(node_index)+2
if D>L
sum_d=sum... |
% Join train and test annotations
pathBase = '../data/annotations/default';
pathTrain = [pathBase,'/train.json.mat'];
pathTest = [pathBase,'/test.json.mat'];
% Output file
jsonPath = [pathBase,'/joined_train_test.mat'];
% Load
ANNOT = load(pathTrain);
ANNOT_test = load(pathTest);
ANNOT = ANNOT.ANNOT;
ANNOT_test = A... |
function spectogramMax = get_spectogram_max(hObject, handels)
spectogramMax = str2double(get(handels.SpectogramMax,'String'));
contents = cellstr(get(handels.spectogramScalePopup,'String'));
scale = contents{get(handels.spectogramScalePopup,'Value')};
if ( isnan(spectogramMax) | spectogramMax ... |
function [ ids ] = localSearchRT( data, w )
% Solves tracking problem using frame-wise local search through all the
% permutations
%
% Inputs:
% data - struct that can be read from data.mat or generated with
% reduceDataFPS
% w = [xy; scale; velocity; hog] is a vector (4x1) of boosting weights
%
% Outputs:
% ... |
function varargout = vvisim(varargin)
% VVISIM M-file for vvisim.fig
% VVISIM, by itself, creates a new VVISIM or raises the existing
% singleton*.
%
% H = VVISIM returns the handle to a new VVISIM or the handle to
% the existing singleton*.
%
% VVISIM('CALLBACK',hObject,eventData,handles,...) ... |
function write_to_excel = compile_mission_analysis_results(results)
m = length(results);
n = length(results{1}.all_avg_rev_times);
write_to_excel = zeros(m,n);
for i = 1:m
line = results{i}.all_avg_rev_times;% [params | results]
% put 12345 as incidence for SSO
if line(4)>90 && line(4) < 100
line(4... |
% speechSpectrograms(ads,segmentDuration,frameDuration,hopDuration,numBands)
% computes speech spectrograms for the files in the datastore ads.
% segmentDuration is the total duration of the speech clips (in seconds),
% frameDuration the duration of each spectrogram frame, hopDuration the
% time shift between each spec... |
% this script makes a blank recall .mat file of the correct length
% (by reading in the recall file) before we score it.
close all;clear;subs={'1','2','3','4','5','6','7','8','9','10',...
'11','12','13','14','15','16','17','18','19','20'};
[base,root]=load_root();gs=0;tngs=9;recl=zeros(length(subs),tngs);
ph4=... |
function [m_coefs_types, sem_coefs_types] = plot_off_diag_PV(cfg_in, off_diag_coefs, types)
% Plot Population Vector analysis
cfg_def = [];
cfg_def.fs = 12;
cfg_def.ax = []; % handle to axes to plot in, e.g. ax = subplot(221)
cfg_def.dy = 0.1;
cfg = ProcessConfig(cfg_def, cfg_in);
if ~isem... |
function [ m_const , c_const , plot_data ] = ...
Line_of_best_fit_info( x_data_set, y_data_set )
%Gives the parameters of thhe line of best fit and the data it would
%generate from the x_data set
%I - the x and y data
%O - The const that make up y = mx + c and the data if thhe line where to
%pass in x
%% G... |
function spectraparse(patient,freq_bins,spectra,conditions)
% function spectraparse(patient,freq_bins,spectra,conditions)
% this function is to parse through frequency spectra in different channels
% for different conditions
% spectra should be in the form spectra(bins, channels, conditions)
% conditions should be a te... |
clear all;
close all;
%% Input data
N = 20; % number of cells
k=0;
timesteps = 0.1*2.^(-1*[0 1 2 3 4 5 6]);
dt = 0.1; % time step
tend = 10; % total simulation time
for method = 1:1:3
for dt=timesteps
if dt ==0.1
fmt = 'b-'; % linecolor for plot of final solution
elseif dt == 0.05
... |
% Macky McWhirter
% Homework 5
% CIC Cascade coefficients
b = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
a = 1;
b2 = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
a2 = 1;
% CIC before cascade
% Pole-Zero
figure()
zplane(b,a);
% Freq Response
figure()
title('Freq Response')
freqz(b,a)
% Coeffic... |
function s = scale( m )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
s = ones(1,m)*0.7;
end
|
function y = contc3(x)
y = 0;
if x == 4 || x == 5 || x == 6 || x == 7
y = 1;
else
y = 0;
end
return |
function Plot_Selected_Averages(~, ~, cmin, cmax)
%%%%%%%%%%
% Plot trial averages for selected ROIs
%%%%%%%%%
global imgobj
global sobj
%%
if ~isfield(imgobj, 'dFF_s_ave')
errordlg(' Get Trial Averages!!')
end
%%
cmin = str2double(get(cmin, 'string'));
cmax = str2double(get(cmax, 'string'));
datap = size(imgo... |
%% eine woche frueher als 2018/10/16
%% INIT
clear all;
close all;
clc
imaqreset
%% Data Aquisition (i)
colorDevice = imaq.VideoDevice('kinect',1);
depthDevice = imaq.VideoDevice('kinect',2);
step(colorDevice);
step(depthDevice);
colorImage = step(colorDevice);
depthImage = step(depthDevice);
% Bild ... |
%gradient descent script
%load('assignmentImageReconstructionBrain.mat');
while (~converged )
[prior,prior_penalty] = prior_calculator(Current_Iterative_Image,prior_type,gamma);
likelihood = ifft2(mask.*fft2(Current_Iterative_Image) - mask.*kSpaceData);
Checker_Current = Current_Iterative_Image ... |
load('T85C_F5.0.mat')
for i = 1:8765
Tcav = ics_envelopecassette1.cavityheatbalance1.CavityHeatCapacity.T(i);
if G_DN(i) < 0
G_DN(i) = 0;
end
chi(i) = (temp_flowport_a(i)-Tcav)/(G_DN(i));
if chi(i) > 1
chi(i) = 1;
elseif chi(i) < 0
chi(i) = 0;
end
end
ExvsChi = []... |
function [highscores] = Leaderboard()
% Retrieve all scores from file
% Retrieve highscore data from file if file exists
if exist('leaderboard.txt') == 2
leaderboard = tdfread('leaderboard.txt','tab');
else
highscores = {};
return
end
% Parse highscores
[a, ~] = size(leaderboard.Name);
A = cell(a, 2);
for i = 1:a
... |
function draw_basic(npoly)
%Code adapted for use in Octave by Benny Smith and Dan Harris (Harris Lab, Brown Univ.)
%Original code from:
%Amin Jalilzadeh Razin (2021).
%Interactive graph in matlab
%(https://www.mathworks.com/matlabcentral/fileexchange/91565-interactive-graph-in-matlab)
%MATLAB Central ... |
function [ Vstall ] = VstallCalc(WoverS,Speed,Alt,Beta,...
deltaClmax,n)
[rho,SoundSpeed] = stdatmo(Alt,0,'US');
V = Speed;
q = 0.5*rho*V.^2;
Mach = V/SoundSpeed;
Cl = (WoverS)*(n*Beta/q);
[~,ClMax] = DragPolarC5A(Cl,Mach);
ClMax = ClMax + deltaClmax;
Vstall = sqrt(2*n*Beta/(ClMax*rho)*(WoverS))*1.2;
end
|
function [vrt] = invite_marking(OBS_VRT,vrt,wpt,idx_wpt)
% vertex marking
vrt((OBS_VRT+1)*(wpt(idx_wpt,3)-1)+wpt(idx_wpt,4),6) = 1;
if wpt(idx_wpt,4) == 1
vrt((OBS_VRT+1)*(wpt(idx_wpt,3)-1)+OBS_VRT+1,6) = 1;
end
% bilding marking
if (wpt(idx_wpt,3) ~= wpt(idx_wpt-1,3)) && (wpt(idx_wpt-1,3) ~= 0)
for... |
function [ output ] = myDFT( x_n )
N=length(x_n);
output=zeros(size(x_n));
for K=0:1:N-1
x_k=0;
for n=0:1:N-1
x_k=x_k+x_n(n+1)*exp(-2*i*pi*n*K/n);
end
output(K+1)=x_k
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.