text stringlengths 8 6.12M |
|---|
function [processedData] = readData( obj,numBins,doPrint )
% Reads data from SRS SR430
if doPrint
fprintf( 'Importing data...\n' )
end
% Get Interface
g = obj.Interface;
if g.InputBufferSize ~= numBins*2
% Set correct buffer size
fclose(g);
% Buffer size must match exactly the number... |
tol = 0.5;
% Number of time steps;
N = 100;
% Define prior
x_0 = [0 0 10 0 0]';
n = length(x_0);
P_0 = diag([1 1 1 1*pi/180 1*pi/180].^2);
% Covariance
sigV = 1;
sigOmega = 1*pi/180;
G = [zeros(2,2); 1 0; 0 0; 0 1];
Q = G*diag([sigV^2 sigOmega^2])*G';
% Motion model
motionModel = @coordinatedTurnMoti... |
%% 1. load files
clear all
cd 'C:\Users\Rebecca Mease\Documents\GitHub\MUA_analysis\AnalysisForManuscript';
VPL_file_list %define all the files here
% get data; make sure to deal with different sampling frequencies!!!
filestr = '\TriggeredAnalysis.mat'
STRS={'CFA_cortex','control_Gi','control_Gq'}
S={};
S{1}{1}=load... |
function eul = dcm2eul(C);
%---------------------------------------------------
% function eul = dcm2eul(C)
%
% dcm2eul computes the euler angles (in radians)
% given the direction cosine matrix C. The
% directin cosine matrix is the one that takes a
% vector at time t=k to t+dt.
%
% ... |
function [ error_opt, error_const, error_RF_compensated, ...
error_T1_effective, error_SNR ] ...
= error_plot(index, true_parameter_value, fig_string, ...
noise_values, berkeley_colors, ...
parameters_of_interest_est_opt, ...
parameters_of_interest_est_const, ...
parameters_of_in... |
vdd = 5;
batAmpHr = 0.250; % amp*hr
onTime = 6; % hours
cktCurrent = 0.015;
cktVoltage = vdd;
LEDcurrent = 0.2;
onRatio = 1/12; % 5sec/min
LEDvoltage = 3;
LEDcurDraw = onRatio*LEDcurrent/onTime; % amp/hr
cktCurDraw = cktCurrent/onTime;
totalCurDraw = cktCurDraw + LEDcurDraw
batCurDraw = batAmpHr/onTime % amp/hr
... |
%% Load the dataset
loaded = load(fullfile(files_path, 'preprocessed_data', 'ofc_learning_choosing_dataset_ephys.mat'));
ephys_data = loaded.ratdatas;
clear loaded
%% Check the model fits exist
% Re-run them if they do not
if ~exist(fullfile(files_path, 'postprocessed_data', 'behavioral_model_fits.mat'), 'file')
%... |
%%
% 哈工大数值分析2020年秋研究生,上机实验
% 第四部分 | 龙贝格积分法/Romberg Integral
% 时间: 2020/10/29
% 学生: 20S008082 齐晓放
% ----------------------------------------------------------
% 1、【龙贝格积分法计算以下积分的近似值】
%%
% 定义被积函数原型及精度要求
syms f x;
delta = 7*10^(-6);
T = zeros(8);
% 求解定积分1
f = x^3;
a = 6; b = 100;m = 1;
% f = 4/(1+x^2);
% a = 0; b = 1;m ... |
%% Average and plot RDFs and CNs
clear
close all
load('E1V_nm_rdf_data')
plot_rdf_cn_error_area(bin_pos(1,:), all_rdf_so, 'Sulfur - oxygen in water', 5, 1, [0.04,0.36,0.56], 'RDF')
plot_rdf_cn_error_area(bin_pos(1,:), all_rdf_ss, 'Sulfur - sulfur', 1.7, 2, [0.04,0.36,0.56], 'RDF')
plot_rdf_cn_error_area(bin_pos(1,:)... |
%function [W] = PLA ()
X=[3 3 1
4 3 1
1 1 1
0 0 1];
Y=[1;1;-1;-1];
W=X(1,:)'; %初始权重 X第一行转置
a=1; %学习率
E= Y+2; %判断是否预测正确
irate=0;
A = 0*Y'; %对偶矩阵
%for i=1:10
while ((sum(E)>0) && (irate<1000))
W=A.*Y'*X;%对偶 计算权值
U=X*W'; %~求和
E= 1*((U.*Y)<=0);%是否正确 >0正确 置〇;小于等于零错误,置一
% L=a*((Y.*E)'*X)';%更新权重梯度... |
function w = ionWeight(ion, isotopeTable, chargeState)
%calculates the weight of an ion, based on the provided ion table
%
% w = ionWeight(ion, isotopeTable);
% w = ionWeight(ion, isotopeTable, chargeState);
%
% INPUTS
% ion: the definition of the ion as a table with ion.element and ion.isotope.
% Both are categorical
... |
function [t, X, acc, xref] = preprocessLQR(PosData, Qx, Qphi)
%% models
m = 0.109;
l = 0.25;
I = 1/3*m*l^2;
g = 9.80;
A2 = [0 1 0 0;
0 0 0 0
0 0 0 1
0 0 m*g*l/(I + m*l^2) 0];
B2 = [0
1
0
m*l/(I+m*l^2)];
Q = [Qx,0,Qphi,0];
R = 1;
Klqr = designLQR(A2, B2, diag(Q), R);
Klqr = round(Klqr, 2);
%% smo... |
clear
close all
%f = '/home/abari/Desktop/tagloc/OFDM_fakecfo_';
f = '/home/abari/Desktop/tagloc/rxdata/_';
num_files = 3;
num_samps = 15e7;
fakecfo = [-30,-33.984063745,-37.96812749];
load Parameters.mat
for i=1:num_files
a=read_complex_binary2(strcat(f,int2str(i-1),'.dat'),num_samps,0);
a = (a.') .* exp((... |
function task_type = check_task_type(data_name)
task_type = 'mc';
if strcmp(data_name, 'bibtex') || strcmp(data_name, 'corel5k') || strcmp(data_name, 'yeast') ...
|| strcmp(data_name, 'scene')
task_type = 'mlc';
elseif strcmp(data_name, 'scm1d') || strcmp(data_name, 'rf2')
task... |
function co_result = get_contrastresult(filename)
% chronux parameters
params.tapers = [5,9]; params.Fs = 1000; params.err = [2, 0.05]; params.trialave = 1;
%Scott Kernel
%%%%%%%%%%%%kernal propeties%%%%%%%%%%%%%%%
kernel_width_eval_s = 0.15;
sdf_freq_hz = 3700;
exp_growth_ms = 2;
exp_decay_ms = 12;
exp_growth_s = ex... |
% MATLAB script: advect_3.m
% Demonstration of implicit differencing for 1-d advection equation
% applied to a passive tracer with localizd distribution.
% Change Nx to examine dependence of amplitude and phase errors on
% number of grid intervals.
% Boundary points have q = 0 in this version
clear all
close all
S ... |
clc;
clear all;
Original = imread('Bird24b.bmp');
%Original = imread('TTGL.jpg');
I = rgb2gray(Original);
N = 256;
count = Nbins(N,I);
%count = Nbins2(N,I);
[JJ,binloc] =imhist(I,N);
figure;imhist(I,N); |
%% applyLR: A function to apply oneVsAll logistic regression
function [correct, ratio] = applyLR(getCurves, X_train, y_train, X_val, y_val, nr_tags, lambdas, iterations, graph)
printf('\n');
printf('---------------------------\n');
printf('Applying Logistic Regresion\n');
printf('---------------------------\n');
... |
smote_en = false;
hype_opt = true;
feats_all = false;
rt_fall = false;
k = 1;
%% example
% load(fullfile(pwd,'\csi_tool_matlab\Activity\feature_mats\features_final\lab2_smote.mat'));
% feature_mat=feature_mat_smote1; %178
% bestc=16384 ; bestg = .08
%%
% bestc=16384 ; bestg = .08
% featu... |
syms x f;
xx=input('请输入插值节点 as [x1,x2...]\n');
ff=input('请输入插值节点处对应的函数值 as [f1,f2...]\n');
m=input('请输入要求的插值次数m=');
n=length(xx);
for i=1:(m+1)
syms fai x;
fai=x^(i-1);
for j=1:n
x=xx(j);
H(i,j)=eval(fai);
end
end
A=ff*(H)'*inv(H*(H)');
syms x; f=0;
for i=1:(m+1)
f=f+A(i)*x^(i-1);
e... |
%% Ejercicio teoria Regulador PID metodo frecuencial
clear all; close all; clc;
s = tf('s');
g = 20/(s*(0.1*s+1)^2*(0.05*s+1))
figure('Name', 'Bode sin reg')
margin(g)
Kp = 0.281;
Td = 0.254;
Ti = 8*Td;
g_r = Kp*(1+1/(Ti*s)+Td*s);
figure('Name', 'Bode con PID, Mf = 60, Mg = 9 dB')
margin(g*g_r)
|
function [ output_args ] = imagePlots( tr,te )
%imagePlots - all sorts of plots for Jocelyn
gridPlot(tr,te,'prob')
scoresScatter(tr,te)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%... |
function D = allDists(x,y,varargin)
% allDists: compute pairwise squared eucildean distances
% between each two column vectors in matrices x and y.
% If varargin is given and is an integer, then split y into
% matrices of max size (varargin, size(y,1)) - to avoid
% memory problems with large data amounts (we still as... |
% function [gbest,gbestval,fitcount]= PSO_func(fhd,Dimension,Particle_Number,Max_Gen,VRmin,VRmax,varargin)
function [gbest,gbestval,fitcount,beschi,media]= PSO_func(fhd,Dimension,Particle_Number,Max_Gen,VRmin,VRmax)
%[gbest,gbestval,fitcount]= PSO_func('f8',3500,200000,30,30,-5.12,5.12)
rand('state',sum(100*clock));
me... |
%% This script looks for black and white images and displays them
% These are the images for whom a color histogram cannot be computed and
% hence must be removed from the training dataset.
baseDir = '../../data/images/';
list = dir(strcat(baseDir,'*.jpg'));
for i= 1:length(list)
I = imread(strcat(baseDir,list... |
function [ hist ] = histR( image )
%UNTITLED5 此处显示有关此函数的摘要 输出图像R通道的直方图数据
% 此处显示详细说明
% 将图像的R通道的直方图矩阵输出
R = image(:,:,1);
hist = imhist(R);
end
|
clear
% Solving Systems of Algebraic Equations Symbolically
syms x y
[x y] = solve(16*x^3+16*x*y^2-16.7*x+2*y ==0,16*y^3+16*y*x^2-16.7*y+2*x ==0)
x = x(5);
y = y(5);
eqn1 = 48*x^2+16*y^2-16.7;
eqn23 = 32*y*x+2;
eqn4 = 48*y^2+16*x^2-16.7;
eqn = [eqn1 eqn23;eqn23 eqn4]
eqn = double(eqn)
eig(eqn)
|
function [] = plotTimeSeries(vars,colors,titles,selection,acc,filtFlag,plotsPath)
% Plot Force
if isempty(acc)
figure('Name',selection,'NumberTitle','off','Visible','off')
set(gcf, 'DefaultAxesFontSize', 16)
t = tiledlayout(5,1);
if strcmp(filtFlag,'filt')
... |
function out=getdispname(varargin)
if nargin==0
out=str2num(get(gco,'DisplayName'));
else
out=str2num(cell2mat(get(varargin{1},'DisplayName')));
end
end |
function fitness_average = MY_OPTIMIZER(FUN, DIM, ftarget, maxfunevals)
% MY_OPTIMIZER(FUN, DIM, ftarget, maxfunevals)
% samples new points uniformly randomly in [-5,5]^DIM
% and evaluates them on FUN until ftarget of maxfunevals
% is reached, or until 1e8 * DIM fevals are conducted.
INPUT_NODES = 10 * rand(1, DIM) - ... |
function mdfToTif(mfile, tifName, framenums, channelsSaved, ImgDescription)
% Reads mdf file in matlab (using MCSX library), and uses imwrite to write
% it to tif.
%
% INPUTS:
% mfile: mdf openned in matlab using MCSX library.
% framenums: frame numbers of the MDF file that will be written as tif.
%%
if ~exis... |
% valid_rook.m will be called by t1_move_piece
% for a rook present on the board, check all valid moves
% global ouput is the output from valid rook, 0 - invalid move, 1 - valid
% the output communicates with the GUI to display an error message or to
% carry through with the movement operation
% move isn't valid i... |
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
% Giacomo Mazzamuto (LENS)
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% * Redistributions of source ... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXX sus_output_mf XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Susanti
% Date : Aug 1 2014
% Function : Check whether Actual and predicted have the same MF output
% Syntax : sus_output_mf(net, data_target, current_count)
%
% algo-
%
% XXXXXXXXXXXXXXXXXXXXXXX... |
clear;
close all;
fclose all;
clc;
year=input('Enter the year: ');
if(mod(year,4)==0)
month=[31,29,31,30,31,30,31,31,30,31,30,31];
else
month=[31,28,31,30,31,30,31,31,30,31,30,31];
end
for i=1:1 %%% loop for month from 1 to 12
for j=28:month(i)
Y=(sin(rand(5)));
X=(cos(rand(5)));
ist... |
function [firstMomentx, firstMomenty, secondMomentx, secondMomenty, autoApertureWidthx, autoApertureWidthy] = moments(x, y,BeamProfile,varargin)
%% First and Second Moment Calculator
% Ian Thomson - 29/06/2017
% Calculates values in pixel space. Apply pixel scaling to get values in
% appropriate units.
% Calculations ... |
%% s_vaAbsorptions
%
% Testing if people can see the difference between two cases:
% 1) A straight line
% 2) Two straight lines barOffset pixels apart
%
% Vernier acuity in human shows the positional acuity is around 6 sec of
% arc. Here, we are analyzing stimulus, optics, and eye movements and
% basing... |
function loop_cache_example(opts)
%=============SETUP CACHE==================
use_cache = kv_get('use_cache',opts,1);
cache_root_dir = [kv_get('experiment_dir',opts,1) filesep 'cache'];
if(use_cache)
cache_file = [cache_root_dir filesep 'cache' filesep mfilename '.mat'];
if(exist(cache_file,'file'))
load(cache... |
function compareBB_CORA_MHyPro(mhStrat,cStrat, timeHorizon, saveFig, fname, savePath, diff)
% Comparison for bouncing ball benchmark
% SETTINGS:
% MHyPro
settings.timeStep = mhStrat.timeStep;
settings.clustering = mhStrat.clustering;
aggr = mhStrat.aggr;
setRepr = mhStrat.setRepr;
% CORA
timeStepC = cStrat.timeStep... |
sinal = load("sinal_campo.mat");
Fs = inv(max(sinal.t)/length(sinal.t)); % Sampling frequency
T = 1/Fs; % Sample time
L = length(sinal.t); % Length of signal
t = (0:L-1)*T; % Time vector
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(sinal.ext,NFFT)/L;
f... |
function [Ha, Sa, Hb, Sb, Ce, He, Se, qubits, rate] = BB84(size, Erate)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
Ha = random01(size, 0.5);
Sa = random01(size, 0.5);
Hb = random01(size, 0.5);
%send
qubits = send(Sa, Ha);
%eve
Ce = random01(size, Erate);
He = random01(size, 0.5);
[S... |
clc;
clear all;
close all;
%Creating a Hexagon
% fig = [-1 -.5 .5 1 .5 -.5 -1;0 .866 .866 0 -.866 -.866 0];
fig = [-2 -1 1 2 1 -1 -2;0 1.732 1.732 0 -1.732 -1.732 0];
%Plottinig the shape
figure(1)
plot(fig(1,1:end),fig(2,1:end),'rx-');
axis([-4 10 -4 10])
%Translation
%Creating [I t] for equation p'=[I t]p
%Assig... |
names = dir('avol*.img');
h = read_hdr('avol0002.hdr');
avg1 = 0;
% active scans
for count=8:39
names(count).name
d=read_img_data(h, names(count).name);
avg1=avg1+d;
end
avg1 = avg1/31;
avg2=0;
for count=2:7
names(count).name
d=read_img_data(h, names(count).name);
avg2=avg2+d;
end
for count=... |
classdef NdgGaussQuadNonhydrostaticSolver2d < NdgNonhydrostaticSolver2d & ...
NdgGaussQuadWeakFormSolver
%NDGGAUSSQUADNONHYDROSTATICSOLVER 此处显示有关此类的摘要
% 此处显示详细说明
properties
end
methods
function obj = NdgGaussQuadNonhydrostaticSolver2d( physClass, meshUnion )
... |
function [np,xp,xp0,vp,rp,Fp,rhop,rho0p,sigp,pp,mp,vol_dil,MP_tag]=initpar(npe,dx,icon,x,Ne,...
nrg,x_at_center,radius_inner,radius_outer,vin,rhoin,identifier)
np=0;
wt=1./npe;
pvol=prod(dx./npe);
for i=1:Ne;
ii=icon(:,i);
for kr=1:nrg;
r_inner = radius_inner(kr,:);
r_ou... |
function [x_final] = gradient_const(x,G,step)
grad = G(x);
x_final = x-step*grad;
end |
function cancelRequest(src,~)
% Get UI data
figHand = get(src,'parent');
h.requestor = findobj(figHand,'tag','requestorField');
h.request_table = findobj(figHand,'tag','requestTable');
m.request_table = get(h.request_table,'Data');
s = get(h.requestor,'string');
v = get(h.requestor,'value');
m.requestor = s{v};
%... |
%{
Generar 3 Matrices de 4x4. La primera deber ser de Unos, la Segunda
debera contener todos elementos impares y la Tercera sera de todos
elementos pares.
Almacenar la Suma de todas las Anteriores en otra Matriz.
Mostrar la ultima matriz por consola y las caracteristicas
de todas
%}
clear all %l... |
function [D2]=filtersop(D)
S=size(D)
for i=1:S(1)
for j=1:S(2)
for k=1:S(3)
D2(i,j,k,:)=medfilt1(D(i,j,k,:),3);
end
end
end
|
function record_objects_blue(message)
global obj_loc
obj_loc(2,:)=[message.getX() message.getY() message.getZ()]*100;
end |
function [y dat]=readsp3(file_name)
%
% Function readsp3
%
% Reads sp3 file and put all 15 min information into variable y
%
% Sintaxe:
% y=readsp3(file_name)
%
% INPUT: file_name -> sp3 file name (string)
% OUTPUT: y -> structure with fields x, y, z and t
% x satnds for X coordin... |
function result = linearContrast(image, yMin, yMax)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
vectImage = reshape(image, [], 1);
xMin = min(vectImage);
xMax = max(vectImage);
vectResult = (vectImage - xMin) / (xMax - xMin) * (yMax - yMin) / 255 + yMin / 255;
... |
function x = infoDistInt(x, kappa, b, m)
% Jackie Xing & Xin Wang 2011
if m == kappa + 1
x = (-( (x.^(-kappa-1)) ...
.* (log(b^kappa)+log((gamma(m)/gamma(kappa)))) ...
+ (x.^(-kappa-1)) ...
.* ((kappa-m)*psi(0,m)- kappa*log(x) + m*(x-b)./x ))...
*b^kappa* (gamma(m)/(gamma(kappa)*gamma(m-... |
function [y_predict,clf_names,clf_time] = MyClassifiers ...
(X_train,Y_train,X_test,Y_test,clf_select)
% requires an Machine Learning license)
allnames = {'Decision Tree','Linear Discriminant Analysis',...
'Quadratic Discriminant Analysis','Nearest Neighbors','Naive Bayes'...
,'Support Vecto... |
function theta = stp_gblm(s_pre,s_post,varargin)% 1- loading the spiking activity
dt = 0.001; % binsize (don't change it)
L = length(s_pre);
isi = diff(find(s_pre>0)*dt); % interspike intervals
% defaults
delay=[100 100]/(dt*1000);
nfilt = [5 5];
NumLambda = 20;
numCV = 8;
toleranceValue=.1;
if (~isempty(varargin... |
classdef hdf5_datatypes
% This convenience class defines the HDF5 types used in the
% ISMRMRD HDF5 file
% The names, types, layout and offsets consistent with that generated
% by the C API. See the note at the bottom of the file for how to
% do this.
properties
T_float;
... |
function output=HEQ(img,X,Y,Sx,Sy,t,th)
% [rows,cols]=size(img);
output=img;
histeqimg=histeq(img(X:X+Sx,Y:Y+Sy));
[row1,col1]= size(histeqimg);
histeqimg=uint8(histeqimg);
for i= 1:row1
for j=1:col1
if histeqimg(i,j)==1
histeqimg(i,j)=255;
end
end
end
img(X:X+Sx,Y:Y+Sy)... |
InsulinBolusLunchPart1 = readmatrix("InsulinBolusLunchPat1.csv");
InsulinBolusLunchPart2 = readmatrix("InsulinBolusLunchPat2.csv");
InsulinBolusLunchPart3 = readmatrix("InsulinBolusLunchPat3.csv");
InsulinBolusLunchPart4 = readmatrix("InsulinBolusLunchPat4.csv");
InsulinBolusLunchPart5 = readmatrix("InsulinBolusLunchPa... |
function [calibc_batch] = Data_Augmentation(calibc, batch_size)
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
% batch_size is a number
[scx,scy,Nc]=size(calibc);
slide_x = scx-batch_size+1;
slide_y = scy-batch_size+1;
calibc_batch=zeros(batch_size,batch_size,Nc,slide_x*slide_y);
... |
function X = ada(x, wname, n)
% 初始化参数值
R = 5;
alpha = 0.1;
beta = 0.3;
delta = DELTA(x);
lambda2 = 4 * delta^2 * log(R);
[C, S] = wavedec2(x, n, wname);
% 提取每... |
% function ELEstimate(ctrl,optiFcn,Mexp,finalState)
fontSize = 10;
% legendText = {'Error (Hemi-sphere)','Final state (Hemi-sphere)','Final state (Pyramid)','Seidlhofer et al., 2019','Lorbach et al., 2014, a)','Lorbach et al., 2014, b)'};
legendText = {'Error (Hemisphere)','Optimum (Hemisphere)','Optimum (Pyramid)','M... |
filename = '/home/rafael/Documents/Robotics Documentation/acoustics/data/conf1.csv';
data = csvread(filename, 7, 00);
data = data(:, 1:4);
t = 1:length(data);
figure(1)
plot(t, data);
%%
% the frequency of sampling
Fs = 1 * 10^6;
%the frequency of the pinger
pf = 22 * 10^3;
% the starting point of the input
i= 2.5 * 10... |
function obj = getObj_ML_ARD(X, Y, scoreObj, obj)
if nargin < 3 || (isa(scoreObj, 'double') && isnan(scoreObj))
scoreObj = struct();
end
if nargin < 4
obj = struct();
end
obj = reg.getObj(X, Y, obj);
obj.fitType = 'ML';
if strcmp(obj.llstr, 'gauss')
obj.fitFcn = @ml.... |
function plotMetrics = plot_the_curves(alg_params_notexist, Metrics, alg_params_exist, savedir, Dataset)
totalNum = size(alg_params_notexist,1) + size(alg_params_exist,1);
%% colors
% if totalNum >11 && totalNum <= 22
% method_colors = {
% ... |
clear all;
clc;
% config
test_data_name_idx =2; % 1-MBGC, 2-LFW, 3-HS_Ident
iter =88:4:120;
path = 'Z:\User\wuxiang\Result\DeepFace\DeepFace_set003\DeepFace0.3.18.x';
for n = 1:size(iter, 2)
test_iter = iter(n);
deep_face_test_python;
result_batch(n, :) = result;
end
|
%% init_ss.m 06.11.18 Run this program to run exp, filling in info in box.
% initiating everything...
g_o_m{(phase-1)*ngs+1}.init_time=GetSecs();
qz=clock;g_o_m{(phase-1)*ngs+1}.init_time_r=qz;
PsychDefaultSetup(2);bgColor=[128 128 128];
Screen('Preference','SkipSyncTests',1);%skip sync tests
devices=PsychHID('Devices'... |
actors_data = readtable('TrainingData.csv');
function Actor_data_Graph_PCA(actors_data)
actors_matrix = table2cell(actors_data);
[rows, cols] = size(actors_data);
new_certification = zeros(rows,1);
new_genres = strings(rows,3);
%% Preprocessing data for Age Rating
for i=1:rows
if ... |
% timeOline.m
% find intensity at outline for all timeseries regions
% Inputs:
% img = image for intensity measurement
% outline = outline for each region through time
%
% Outputs:
% aveLine = vector of intensity measurements
%
% Written by Carolyn Pehlke
% Laboratory for Optical and Computational Instrumentation
% Apr... |
function [time, stocks] = simulateTrike(D, initial_angle, xDotDot)
close all;
mass = 85; % kg
time_limit = 30; % seconds
g = 9.8; % m/s^2
I = (1/12) * mass * (2*D)^2;
beta = 0.05;
options = odeset('Events', @events);
[time, stocks] = ode45(@netFlow, [0, time_limit], [initial_angle... |
function j = kRO2(T,M)
%calculates rate of general isomerization reaction RO2 -> HO2 + OH;
%from Browne and Cohen 2012
j = 4.12e8*exp(-7700/T);
end
|
function solution = opt_AV(n,xi,beta,k)
A = S2C_matrix(n,xi);
cvx_begin quiet
variables p(n,1) delta(n,1) x(n,1) r(n,n) z(n,1)
maximize( sum(p.*(1-p),1)-sum(delta,1)-k*sum(z,1) )
subject to
x == beta*(transpose(sum(A.*(x*ones(1,n)))))+delta
z == transpose(sum(A.*((1-p-x)*ones(1,n)),1)+sum(r... |
% this is a convenient function for doing heirarchical cluster analysis
% using a series of matlabs built in functions. makes a pretty plot of the
% results and can also return indices to work up the cluster results
% operational for getting the cluster tree plots; working on fleshing out other outputs
%% inputs:
... |
function [corrs] = get_corrs(evoked, sig, stim_trials, nCells)
% Initialize structure
corrs = struct;
% Raw correlation between cells
corrs.raw = corr(evoked');
% Signal vector correlations;
corrs.sig = corr(sig);
%
% ncovs = {};
% for i = 1:3
% ncovs{i} = cov(evoked(:,stim_trials{i})');
% end
% Noise correlati... |
function [smoothed] = boxcar_for_profiles(x,a,h,join)
%boxcar: smoothes the kink between profiles stiched together
% Only smoothes profile around the kink, leaves the rest unchanged
% Input:
% x,a(x): data points to average - must be line or column vectors!
% h: half-width of averaging window, in points... |
function [res_I, res_E] = LiTrack_imageConverter(handles, hplot)
[I_tc, E_tc]=convertXTCAV('TREX-Sample-2015-04-01-144547.mat');
Extcav=E_tc(2,:);
Ex_tc=E_tc(1,:);
Ixtcav=I_tc(2,:);
Ix_tc=I_tc(1,:);
[I_lt,E_lt]= convertLitrack(handles);
Elitrack=E_lt(2,:);
Ex_lt=E_lt(1,:);
Ilitrack=I_lt(2,:);
Ix_lt=I_lt(1,:);
lenI_t... |
function [Xt, Wt] = MCL_Update(L, Xp, ut, sigma_u, zt, sigma_zt, randomp, dt, Wtmp)
%MCL_UPDATE Update MCL belief distribution for timestep.
%
M = size(Xp, 1);
X = zeros(size(Xp));
W = zeros(M, 1);
for m = 1:M
X(m,:) = motion_update(ut, sigma_u, Xp(m, :), L, dt);
% ... |
function X = inversa(A)
% Calcula la inversa de la matriu quadrada A
% Descomposició matriu A
dA = decomposition(A);
I = eye(size(A)); % matriu identitat
n = size(A,1); % mida matriu
X = zeros(size(A)); % matriu inversa
% Resolució sistema lineal per a la matriu d'identitat
for j = 1:n
b = I(:... |
function [i_pos_gated_0, i_pos_hidden_left_1, i_pos_gated_left_1, i_pos_hidden_right_1, i_pos_gated_right_1, i_pos_hidden_left_2, i_pos_hidden_right_2, pos_joint, t_pos_gated_0, t_pos_hidden_left_1, t_pos_gated_left_1, t_pos_hidden_right_1, t_pos_gated_right_1, t_pos_hidden_left_2, t_pos_hidden_right_2] = gmdbmMeanFie... |
clear;close all
load("//Azlab-fs01/東研究室/個人work/竹内(ひ)/data/kwave/result/2018_09_08_variousFrequency/statistics.mat",'tof_cell')
load("//Azlab-fs01/東研究室/個人work/竹内(ひ)/data/kwave/param/param_2board.mat")
load("//Azlab-fs01/東研究室/個人work/竹内(ひ)/data/kwave/result/2018_09_08_variousFrequency/statistics.mat",'frq')
t_size = 40.e... |
### Skript zu Rückwätssubstitution einer LR zerlegten Matrix A mit rk(A) = n ###
function x = backwars_solve(LR, y)
### Rang der Matrix LR ###
n = length(sum(LR));
### Erstes Element von x elementar berechnen damit die Weiteren
### über eine Schleife bestimmt werde können ###
x(n) = y(n) / LR(n ,n);
... |
function [outVar] = GetDictionaryWithHashAndLocation(absPath,SOLPOSTFIX)
%GETDICTIONARYWITHHASHANDLOCATION This function will get a dictionary with
%all the HashCodes from the base files generated. This dictionary can be
%used to quickly compare files.
%
% THIS FILE DEPENDS ON InitAll.m
%
% ---------------------... |
% ADVISOR data file: CYC_UDDS.m
%
% Data source: epa website
%
% Data confirmation:
%
% Notes:
% Represents the Urban Dynamometer Driving Schedule (UDDS), which is
% equivalent to the first two bags of the Federal Test Procedure (FTP-75).
% In previous versions of ADVISOR, it was called FUDS. It is commonly called ... |
clc;
clear all;
close all;
r = 4;
eps = 10^-2;
inpath = '.\data2\*.png';
dir_im = dir(inpath);
for i =1:length(dir_im)
imName = dir_im(i).name;%
%imName = 'face50_flp.png';
I = imread([inpath(1:end - 5) imName]);
if size(I,3) == 3
I = rgb2gray(I);
end
I = im2double(I);
... |
function lut = build_LUT_frac_round_octave(V, s)
%%
% s should be in the form of p/q, 1<s<2
[p,q] = rat(s);
% first we take one 'division period' to find values that map two values in
% the downsampled version, i.e., duplicate values in xd that would become
% multiparous coordinates
x = 0:floor(s)*(p-1);
xd =... |
%% used to set hyperparameters -- needed for every object!
%% IG: This overloads a method of the spider and adds more options.
if ~exist('hyper') hyper=[]; end
%IG Oct 5, add construction from struct
if isstruct(hyper)
fn=fieldnames(hyper);
for k=1:length(fn)
a.(fn{k})=hyper.(fn{k});
end
retu... |
function [nrhits,coords] = getshots(imgin,thrs)
N=size(imgin);
% N=flipdim(N,2); % convert to [x y] = [column row] format
% chop up the image to subimages no smaller than 60x60 but no larger than
% 100x100.
Nfac1=factor(N(1));
Nfac2=factor(N(2));
cpr1=cumprod(Nfac1);
cpr2=cumprod(Nfac2);
M=[min(cpr1(cpr1>=60... |
clc,clear,close all
addpath('input_img')
%input image
list = {'valley','cameraman','pout'};
[index] = listdlg('ListString',list,'SelectionMode','single');
if index==1
I=im2double(imread('1.jpg'));
end
if index==2
I=im2double(imread('cameraman.tif'));
end
if index==3
I=im2double(imread('pout.tif'));
end
%inp... |
function P2 = MovNoiseBurstDur(P)
% MovNoiseBurstDur - extract BurstDur from moving noise parameters
% P=EvalMovNoiseDurPanel(P) adds a P.BurstDur array to P for MOVN stimulus.
% BurstDur is a [Ncond x 1] array calculated from interaural speeds:
% Dur = (1-BinauralSpeed)*Dur + endITD - startITD
% BurstDur = Du... |
% for j=1:10
% y=0;
% for i=(j-1)*200+1:j*200
% y=y+1;
% n=mvnpdf(F(i,:),mu,Sigma);
% a(j,y)=(sum(n.*w'))';
% end
% end
% for j=1:10
% o(j,:)=size(find(a(j,:)<297));
% end
Lthres=300;
x=1;
z=200;
for j=1:122
if i~=1
x=x+200;
z=z+200;
end
count=0;
... |
function varargout = Work_030514(varargin)
% WORK_030514 MATLAB code for Work_030514.fig
% WORK_030514, by itself, creates a new WORK_030514 or raises the existing
% singleton*.
%
% H = WORK_030514 returns the handle to a new WORK_030514 or the handle to
% the existing singleton*.
%
% WORK_0305... |
function [fval,x,f,A,b,Aeq,beqvrai]= demande( donnees ,epsilon)
if nargin <2
epsilon = 0;
end
%parametre d'optimisation
semaine = 15;
d_t = donnees.demande;
c_m = donnees.cout_materiaux;
c_s = donnees.cout_stockage;
d_a = donnees.duree_assemblage/60;
n_o = donnees.nb_ouvriers;
c_h = donnees.cout_horaire;
n_h = 35;... |
%高斯平滑滤波,边界不处理
%首先构造高斯滤波器
GaussianModelSD=10;
GaussianModelHalfLength=7;
GaussianModel=zeros(2*GaussianModelHalfLength+1);
for i =-GaussianModelHalfLength:GaussianModelHalfLength
for j=-GaussianModelHalfLength:GaussianModelHalfLength
GaussianModel(i+GaussianModelHalfLength+1,j+GaussianModelHalfLength+... |
%Author: Salma Elmalaki
function files = getFiles( path )
files = dir(path);
for k = length(files):-1:1
% remove folders starting with .
fname = files(k).name;
if fname(1) == '.'
files(k) = [ ];
end
end
end
|
function [ecg, qrs]= peakDetection (ecg, fs, DetectionMethod)
%% original made by Tara Chand
% To detect the R-Peak from ECG/PPG dataset
% peak is detect using following methods:
% 1). peakdet : https://www.mathworks.com/matlabcentral/fileexchange/47264-peakdet
% input- ecg- ECG signal, and delta- threshold to... |
function [rMurty,xMurty,pMurty] = hypo_update( bestAssign,rupd,xupd,Pupd,...
r_new,x_new,P_new,valid_idx,idx_out,nCost,threshold)
%Update single target hypothesis according to the assignment
M = length(nCost);
rMurty = cell(M,1);
xMurty = cell(M,1);
pMurty = cell(M,1);
for i = 1:M
[rr,xx,PP] = make_assign(bes... |
%[ZC-zero crossing] feature
function feature = ZC_feature(data_TimeWindow, DeadZone)
data_size = length(data_TimeWindow);
feature = 0;
if data_size == 0
feature = 0;
else
for i=2:data_size
difference = data_TimeWindow(i) - data_TimeWindow(i-1);
multy = data_TimeWindow(i) * data_TimeWindow(i-1);
i... |
classdef L2etf
%L2ETF 专门用于放etf的L2数据
%%
properties(SetAccess = 'public', GetAccess = 'public', Hidden = false)
code;
latest=1; % 最后的一个
end
%% 原始l2行情
% 证券代码 时间 最新价 申卖价5 申卖量5 申卖价4 申卖量4 申卖价3 申卖量3 申卖价2 申卖量2 申卖价1 申卖量1 申买价1 申买量1 申买价2 申买量2 申买价3 申买量3 申买价4 申买量4 申买价5 申买量5
prope... |
bit_rate = 28e9; %bits-per-second
bit_time = 1/bit_rate; % second
samples_per_bit = 64;
sampling_rate = bit_rate * samples_per_bit;
sample_step = bit_time / samples_per_bit;
seqlength = 10000; % length of random sequence bits
tinterp = 0:sample_step:5000*sample_step;
R = 10;
C = 0.00000000001... |
function d = load(filenames,fieldsToLoad)
%LOAD Loads Amdar files by name.
%
%SYNTAX:
% data = Amdar.load(filenames, fieldsToLoad)
% data = Amdar.load(filenames)
%
%INPUT:
% filenames - Cell array of files to be loaded.
% fieldsToLoad - (Optional) Cell array of field names to load.
%
%OUTPUT:
% d - Data struct... |
close all;
% plot contour data
N = '50000';
path = strcat('data/N=',N,'/');
X = importdata(strcat(path,'x.dat'));
Y = importdata(strcat(path,'y.dat'));
sr = importdata(strcat(path,'sr.dat'));
sf = importdata(strcat(path,'sf.dat'));
srf = importdata(strcat(path,'srf.dat'));
sx = importdata(strcat(path,'sx.dat'));
sy = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.