text stringlengths 8 6.12M |
|---|
classdef TestProjection < Prep
% TestProjection tests use of q.proj(...).
methods (Test)
function TestProjection_testDateConversion(testCase)
st = dbstack;
disp(['---------------' st(1).name '---------------']);
package = 'University';
c1 = dj.conn(...
... |
function [PRC_He_1_0,PRC_He_2_1]=PRC_He(n_e,T_i);
global n_e_data_PRC_He;
global T_e_data_PRC_He;
global Table_PRC_He_1_0;
global Table_PRC_He_2_1;
PRC_He_1_0=interp2(n_e_data_PRC_He,T_e_data_PRC_He,Table_PRC_He_1_0,n_e,T_i,'spline');
PRC_He_2_1=interp2(n_e_data_PRC_He,T_e_data_PRC_He,Table_PRC_He_2_... |
% co-odinates x and y are input relative to an arbitray origin that the centroid is defined from
% returns co-ordinates relative to the centroid
function [ xB, yB ] = centroidShift( x, y, centroid )
xB = x - centroid(1);
yB = y - centroid(2);
end
|
function [databaseLUT] = importYawLUT(inputfilename)
addpath('bin')
if exist(inputfilename) ~= 2
error(['File ''' inputfilename ''' not found.'])
end
% Import data
LUT = importLUTfile(inputfilename);
dataMat = sortrows(LUT.Variables,[3 2 1]);
dataMat = dataMat(:,[1 2 3 6:end]); % Remove Pbl and Popt
% Determine ... |
% Computes the speed difference between Matlab's binornd and
% Lightspeed's randbinom.
if ~exist('binornd')
disp('binornd not found. skipping test_randbinom.');
else
p = 0.13;
n = 123;
tim = [];
nsamples = 1e4;
y = zeros(nsamples,1);
tic
for i = 1:nsamples
y(i) = randbinom(p,n);
... |
cmdenl=[hex2dec('7E'),00,10, 01, 00, 00, 00 , 00, 78, 69, 88, 146, 90,-217];
cmdenr=[hex2dec('7E'), 00, 10, 01, 00, 00, 00 , 00, 78, 69, 88, 147, 90,-218];
two_raised_to_eight = power(2,8);
for i=1:10
fwrite(s,cmdenl);
A = fread(s);
count = A(9) + two_raised_to_eight * A(8);
disp(count);
fwrite(... |
function subinfo=getSubInfo()
%getSubInfo.m
prompt={'Subject Number', 'Gender[1=male, 2=female]', 'GMFCS level', 'Birth', 'Dominant hand[1=L, 2=R]', 'Block[1, 2, 3, 4, 5]'};
dlg_title='Subject Information';
num_lines=1;
defautanswer={'01', '1', '1', ' ', '2', ' '};
subinfo=inputdlg(prompt, dlg_title, num_lines, defauta... |
function [ futurespeed ] = GPR1step( pastspeed, Xtrain, Ytrain )
%The trainded GPR model for 1-step-ahaed wind speed prediction
% the past wind speed is vector
% the future is a scalar
hyp.cov=[0;0];
hyp.mean = [0;0;0;0];
covfunc = @covSEiso;
likfunc = @likGauss;
hyp.lik = log(0.1);
meanfunc = {@meanSum, {@mea... |
clear all
clc
%Erwthma 2-(g)
k=1;
for i=7:12
n=2^i;
A=rand(n);
b=rand(n,1);
f = @()lu(A);
time_lu(k,1)=timeit(f,3);
gflopi(k,1)=2*n^2/time_lu(k,1)/10^9;
f = @()A*b;
time_c(k,1)=timeit(f,1);
gflopii(k,1)=2*n^2/time_c(k... |
% gaussian 3X3 sigma 0.3
original = imread('thinker_gray_noised.jpg');
img = im2double(original);
[rows , cols] = size(img);
gamask = fspecial('gaussian',3,0.3);
fimg = zeros(rows+2,cols+2);
fimg(2:rows+1,2:cols+1)=img(:,:);
fimgre = zeros(rows,cols);
for i=1:rows
for j=1:cols
pixel = fimg(i:i+2,j:j+2).*gama... |
function generateFcn(obj)
% pre-generate equations for computing output interval
%
% Syntax:
% generateFcn(obj)
%
% Inputs:
% obj - feedforward object
%
%
% Author: Weiming Xiang
% Written: 02/25/2019
% Last update: 02/25/2019
%------------- BEGIN CODE --------------
fileName = ('layerOutputSet.m');... |
function obj = sideTrackXML(obj,sideTrack)
%sideTrackXML Parsing the XML to the corresponding classes and properties
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyright (c) 2020, Jonas Wurst, Alberto Flores Fernández
% All ri... |
function [ Q, H] = block_arnoldi( A, R, q)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function: Block Arnoldi Process with Re-Orthogonalization
%
% Block Arnoldi Algorithm for (partial) reduction to Hessenberg form
% Determining the orthogonal basis Q of the Krylov subspace
% ... |
function score = logLoss(actual, posterior)
%LOGLOSS Computes the log loss
% score = logLoss(actual, posterior)
%
% actual is a binary vector
% posterior is a vector of posterior probabilities that actual==1
%
% Author: Ben Hamner (ben@benhamner.com)
score = mean(ll(actual, posterior));
|
function PX_SJ = lic_make_emissions_mtx(labels,px_sj)
k = numel(px_sj);
PX_SJ = spdiags(px_sj,0,k,k); |
close all;
clearvars;
commandwindow;
% Setup PTB with some default values
PsychDefaultSetup(2);
% Seed the random number generator.
rng('default')
prompt = {'Subject''s number:', 'group'};
% Skip sync tests for demo purposes only
Screen('Preference', 'SkipSyncTests', 1);
%-----------------------------------------... |
%@(#) crpos2axis.m 1.1 05/07/13 10:29:29
%
%
%function axstr=crpos2axis(crpos,safeg)
%gives name on supercell with cr-pos as input
%if safeg=1, the name is given as 50UO etc,
%if safeg=0, the name is given as U50
%Default safeg=1
function axstr=crpos2axis(crpos,safeg)
if nargin<2, safeg=1;end
ivecstr=['XVUTSRPOM... |
#!/snap/bin/octave.octave-cli
1;
format long;
function [w,t] = metodoDeIntegracao(a,b,N)
w = double(zeros(N, 1));
t = double(zeros(N, 1));
for i = 1:ceil(N/2)
w(i) = i*(b-a)/(2*N);
w(N+1-i) = w(i);
if i == N+1-i
t(i) = (a+b)/2;
else
t(i) = a + i*w(i)/2;
... |
fs=100;%采样频率
wp=1.5; %通带截止频率
ws=4; %阻带截止频率
rp=1; %通带最大衰减
as=80; %阻带最小衰减
%进行巴特沃斯滤波
amplitude = wifi_butterworth(amplitudeB2,fs,wp,ws,rp,as);
%amplitude = amplitudeB2;
%进行PCA降维
[coeff,score,latent] = pca(amplitude);
first_pca = score(:,1);
second_pca = score(:,2);
%中值滤波
%sequ... |
function [Q, Qinv, detQ] = raninvwi(nu,S)
% sampling from an Inverted Wishart distribution
% input: nu ... shape parameter
% S .... scale parameter
n=2*nu+1;
r=size(S,1);
%[C ierror]=chol(S)';
[us t] = schur(S);
Tdiag=max(diag(real(t)),0);
detS = sum(log(Tdiag));
th=diag(Tdiag.^.5);
u=rea... |
function [PR,CR] = flatten_splines(P,C,I,F,S,SW,D)
% FLATTEN_SPLINES Given a set of splines (P,C) defining a non-white vector
% graphics image. "flatten" the curves into a single shape. Input white-filled
% shapes are treated as a negative space.
%
%
% Inputs:
% P #P by 2 list of control point locatio... |
function [ H_EST ] = WiFi_channel_estimation_PS_Linear(tx,rx,sampUtil,no_OFDM_blocks)
H_EST = zeros(sampUtil,4);
for i = 1:no_OFDM_blocks
rx_pilots = [rx(6,i);rx(20,i);rx(34,i);rx(48,i)];
tx_pilots = [tx(6,i);tx(20,i);tx(34,i);tx(48,i)];
H_PILOTS = rx_pilots./tx_pilots;
for... |
function [ ] = scatter_plot( data,i,j,size,pattern )
%SCATTER_ANALYSIS Summary of this function goes here
% Detailed explanation goes here
scatter(data(:,i),data(:,j),size,pattern);
end
|
clear; close all;
% Setup grid
r_max = 2;
z_max = 2;
rs = linspace(-r_max, r_max, 500);
zs = linspace(-z_max, z_max, 500);
rqs = linspace(-r_max, r_max, 50);
zqs = linspace(-z_max, z_max, 50);
[rr, zz] = meshgrid(rs, zs);
[rrq, zzq] = meshgrid(rqs, zqs);
mags = sqrt(rrq.^2 + zzq.^2);
magsnq = sqrt(rr.^2 + zz.^2);
... |
function f=chipDynoLikeStatNoiseGrad(params,data,precs,X,nEffectGenes,R,C);
% CHIPDYNOLIKESTATNOISEGRAD gradient of CHIPDYNOLIKESTATNOISE.
% CHIPDYNO
nGenes=size(data,1);
nTrans=size(X,2);
npts=size(data,2);
beta=params(1);
gamma=params(2);
factor=cos(gamma)^2;
mu=params(3:2+nTrans)';
V=params(3+nTrans:end-nTrans)';... |
function [out]=fcnSensitivityRun_3D(Objfun, BCcoeff, setts, param)
% performes sensitivity corelation check by pairs
% for any function
% Objfun- objective function with one scalar return
% BCcoeff- base case parameter values
% setts -settings e.g. range,step
% param - additional parameters for the Objfun functio... |
function INPUTS = getINPUTS()
% Gets input variables from the stack.
try
% Get stack
INPUTS_STACK=evalin('base', 'INPUTS_STACK');
% Pull from stack
INPUTS = INPUTS_STACK{1};
INPUTS_STACK = { INPUTS_STACK{2:end} };
assignin('base', 'INPUTS_STACK', INPUTS... |
% clc;
% clear all;
% close all;
dirName = 'C:\project\PuzzleDazzle\DB\';
files = dir( fullfile(dirName,'*.jpg') );
files = {files.name}';
ImageCompare =imread('C:\project\PuzzleDazzle\images\unicorn2.jpg');
Imaged = im2double(ImageCompare);
Imageg = rgb2gray(Imaged);
hn1 = imh... |
function PlotScenarios( tGenerator, fJulianDate, aafScenarios, iNumberOfScenarios )
%
try %
%
if( tGenerator.bPrintDebugInformation )
%
fprintf('Entering ScenariosGenerator.PlotScenarios()\n');
%
end;%
%
% manage the cases where the PlotScenarios() is called without
% additional parameters
swit... |
function [action,state] = strategy_rl(G,TR,S1,S2,N,M,plnum,state)
global theta theta_f w
global TR
myS = [S1;S2];
%action = round(rand(size(myS,1),1)*2);
%% ------------ reinforcement learning ---------------
%params
alpha = 0.3;
delta_l = 0.2;
delta_w = 0.008;
... |
function [layers_out_cell,cell_out]=sort_per_survey_data(layers_in,varargin)
output=layers_in.list_layers_survey_data();
if isempty(varargin)
trans_ids=findgroups(output.Voyage,output.SurveyName,output.Snapshot,output.Stratum,output.Type,output.Transect);
else
output_table=struct2table(output);
trans_ids... |
classdef Cone < Solide
properties
Rayon
Hauteur
Inertie
InertieAjust
end
methods
function cone = Cone()
cone = cone@Solide();
cone.Rayon = 0;
cone.Hauteur = 0;
cone.Inertie = [0 0 0 ;0 0 0;0 0 0];
c... |
function XM = midpoints(X);
% USE: XM = midpoints(X);
% X is a one-dimensional N-element vector without NaNs. XM is an N-1
% element one-dimensional vector, containing values at the midpoints
% between consecutive values in X. It is calculated using:
% XM = diff(X)/2 + X(1:end-1)
% Note there are no inpu... |
function [ AllVoxelSpectra, SBetasFirstRun, SBetasRefined,RefinedSpec] = DualRegressionLoop( Resids,f,fmin,SpecCard,SpecResp,pVal, NormFlag,ConvLevel)
% This function runs a dual regression of power spectra.
%
%***** INPUT ******
%
% Residuals - 4D time series data
% fTR - frequency vector, subsam... |
clc;
clear all;
close all;
% Name of developer: Shwetha A.
% Name of the company: Think Soft Research;
% Project Name: exponential;
% Date: Feb 8, 2019
% Time: 1:30PM
X=-2:0.1:2;
% x=input('enter the inputs');
Y=exp(X);
disp('exponent value of y=');
disp(Y);
% subplot(2,1,1);
plot(X,Y);
xlabel('values of x');
yl... |
clear;
m_list = [2,4,5,8,10,12,15,18,20,25,30,40,50];
n_list = m_list;
T = 1000; %trial times
K = 2; %auxiliary sample size
alpha_1 = 0.5;
alpha_2 = 2;
beta = 1; % X~Gamma(alpha_1,beta), Y~Gamma(alpha_2,beta)
for d = 1:length(alpha_2) %degree of the shift between the two population distributions
for i = 1... |
function [ f ] = pendulumF( y )
%pendulumf Pendulum equations.
g = 1;
m = 1;
l = 1;
f(1,1) = y(3,:);
f(2,1) = y(4,:);
f(3,1) = -y(1,:).*y(5,:)/m;
f(4,1) = (-y(2,:).*y(5,:)-g)/m;
f(5,1) = y(1,:).*y(3,:) + y(2,:).*y(4,:);
end
|
function handles = find_hs_to_events( handles )
%FIND_HS_TO_EVENTS Determine the heel strike & toe off events from vicon data
% Detailed explanation goes here
%
%
% Author: Peggy Skelly
% 2017-08-03: create
if ~isfield(handles, 'vicon_data')
disp('No vicon data to compute events.')
return
end
% time
t = hand... |
% This model optimizes a power market and network between a group of interconnected energy systems
% This script requires the following functions to run
% 1. eP_function % Reads the input data and simulates the energy systems
% 2. suppcurve % Modifies supply cruve (and adjusts some increments if needed)
% 3. hydrop... |
function [ O ] = DoublingFactor( p, B1, B2, B3 )
%DoublingFactor Summary of this function goes here
% Detailed explanation goes here
%% Variable Definition
% P - State of the board
% B1 - Agent whose turn it is to double
% B2 - Whether player has the ability to double
% B3 - Whether computer has the ability to dou... |
function a = mc_nca_plot(results,thresh,col,nets,cm,fdr)
if (size(nets,1)>1)
nets = nets';
end
%a = plot_jica_component(results.stats.t(col,:),1,0,0,nets,'',[1:max(nets)]);
%
% a.tvalues = results.stats.t(col,:).*(abs(results.stats.t(col,:))>results.tthresh(thresh));
% a.bvalues = results.stats.b(col,:).*(abs(res... |
figure
XXstart = -1.5;
XXend = 6.25;
YYstart = -9;
YYend = 8.875;
TRASX_S = 1;
TRASY_S = -4;
%STATOR
hubsss = plot(T_coord_ss_sh_trans + TRASX_S,-AX_coord_ss_sh_trans + TRASY_S,'k--','LineWidth',1.5);
hold on
hubsps = plot(T_coord_ps_sh_trans + TRASX_S,-AX_coord_ps_sh_trans + TRASY_S,'k--','LineWidth',1.5);
midsss ... |
% Initialization
a = @(x) (2/(x*pi))*sin(x*pi/2);
b = @(x) 0;
a0 = 0.5;
L = 2;
Number1 = -4;
Number2 = 4;
N = 900;
% end Initialization
f = 0;
x=linspace(Number1,Number2)
for n = 1:1:N
f = f + a(n)*cos((n*pi*x)/L) + b(n)*sin((n*pi*x)/L);
end
f = f + a0;
figure;
plot(x,f);
|
function varargout = Compound_Surf(Surfa,varargin)
%
% Syntax :
% Surfout = Compound_Surf(Surfa);
%
% This function joints surfaces from different SurfFiles.
%
% Input Parameters:
% Surfa : Surfaces files.
% : An atlas surface file is considered as a single surface.
%
% Output Parameters:
% Surf... |
clear;
T = 400; % horizon
cu_w = 5e-10*ones(1,7); % control cost coefficients
cx_w = 5e-1 * [0.0*ones(1,7) 0.0001*ones(1,7) 0.000000 0.00000 0.5]; % running cost coefficients
% desired path to track
t = linspace(0, 2*pi, T+1);
r = 0.06;
xd_x = r * cos(t);
xd_y = r * sin(3*t);
xd_z = ... |
function [S, ierr] = myquad(a, b, tol, fun, nfmax)
%l'algoritmo parte dall'ipotesi che fun'' sia quasi costante
nfmax = nfmax - 3;
h = b-a;
n = 2;
f_a = fun(a);
f_b = fun(b);
ierr = 0;
Iold = (h/2)*(f_a + f_b);
h = h/2;
sum = fun(a + h);
Inew = (h/2)*(f_a + 2*sum + f_b);... |
clear
clc
close all
[spec,spec2,spec3] = readTecmag4d('C:\CommonData\PM5\Water_Aug2017\Water_RCT2Dtrad_1_30Aug2017.tnt');
nEchoes = 128;
nPts = 32;
nOmit = 0;
n2DPts = 21;
data = reshape(spec3,n2DPts,nEchoes,nPts);
data = data(:,:,1:end-nOmit);
dataRe = real(data);
dataIm = imag(data);
%%
% dataRe = re... |
function z = solution1(x,t)
z = exp(-pi^2*t)*sin(pi*x); |
function BS = BSpline(knots,varargin)
%BSPLINE computes the B-spline approximation from a set of coordinates.
% BSPLINE(KNOTS) returns the B-spline interpolation between the reference
% points (knots) whose coordinates are given by the array KNOTS.
% The coordinates of the knots are given vertically, i.e. KNOTS(i,j) gi... |
function [Enew] = secant_d_well_solve(E1, E2, V0, xl, xr, xm, a, b, dx)
% SECANT_D_WELL_SOLVE solve eigen energies and wave equations of a
% double well.
%
% Input argurments:
% Ehi......................Estimated upper bound of energy (eV)
% Elo......................Estimated lower bound of energy (eV)
% V0............... |
function [point_observations] = create_point_observations(camera_observations, num_points)
point_observations = cell(1,num_points);
for i = 1:num_points
point_observations{i} = struct(...
'num_observations', 0,...
'camera_indices', [],...
'feature_indices', [],...
'locations_2d', []... |
% Template for filters
%Function uses switch statement to switch filters
%
function [filt_data filt_images] = switch_filt(str,count,load_Data1)
if count > 0
filt_images{1,count} = [];
filt_type = fspecial('unsharp');
switch str{1}
case 'histeq'
filt_data = adapthisteq(load_Data1);
... |
% NON FUNCTIONAL!!!!
##function [xn, fxn] = coordinateDescent(f, xn, maxIter)
## % Argument error: the amount of arguments of the function does not match
## % with cell length
## f = function_handle(f);
## n = length(xn);
## if (n != 2 && n != 3) || n != nargin(f)
## disp("Argument error");
#... |
clear;clc;
I = imread('Test\lp11.jpg');
figure, imshow(I);
pause(0.5);
%Crop the yellow object in the image
r = I(:,:,1);
g = I(:,:,2);
b = I(:,:,3);
threshold = 100;
y = r > threshold & g > threshold & b < threshold;
figure, imshow(y);
%Obtain the threshold for row and column size
y1 = y;
[m,n] = size(y);
s1=[1,m];
s... |
classdef nmModel
properties
Means;
ClassNames;
end
methods
end
end
|
clear;
clc;
% 1. Define axis
x = [-1:0.1:1];
y = [-1:0.1:1];
[X,Y] = meshgrid(x,y)
% 2. Define obj fn
Z = X.*exp(-X.^2-Y.^2)
% Define constaints
g_1 = X + Y
g_2 = 2*X.^2 + 5*Y
% 3. Plot
figure(1)
mesh(X,Y,Z)
figure (2)
contour(X,Y,Z)
figure (3)
[C,h] = contour(X,Y,Z)
clabel(C,h)
hold on
co... |
clear;
nmos = csvread('../data/experiment1_nmos_1.csv', 1);
nmos_downsample = vertcat(nmos(1:200, :), downsample(nmos(201:400, :), 4));
gm = diff(nmos_downsample(:,2)) ./ diff(nmos_downsample(:,1));
coeff1 = polyfit(log(nmos_downsample(32:60,2)), log(gm(32:60)), 1);
coeff2 = polyfit(log(nmos_downsample(62:250,2)), log... |
%Created on June 2016.
%https://github.com/tayebiarasteh/
%%
function [y,n] = sigfold(x,n)
% Time reversal
% implements y(n) = x(-n)
% -----------------------
% [y,n] = sigfold(x,n)
%
y = fliplr(x); n = -fliplr(n);
|
% This script will reconstruct measurements taken with the AixTOM
% measurement system in a time differential way. All parameters for the
% reconstruction as well as the measurement data can be specified by the
% user at the beginning of the script.
%% Clear relevant variables in the workspace
clear voltages;
c... |
function [mean_price,std_price]=MC_asian_call(S0,K,T,r,sigma,N_MC,Nt,N)
%**************************************************************************
% I modified your class code for barrier option to a european call option
%**************************************************************************
sample_payoff=zero... |
% Compute the freezing index
% SR: Sample rate in hertz
% Original version allowed various FFT sizes - now FFT and window size must
% be equal
% modified from original to accept fft instead of accelerometer data
function res = givenFFT_x_fi(fftArray,SR,stepSize)
NFFT = 256;
locoBand=[0.5 3];
freezeBand=... |
function Ci = HW1_Ci
%HW1_CI
% CI = HW1_CI
% This function was generated by the Symbolic Math Toolbox version 8.3.
% 18-Sep-2019 21:07:47
Ci = reshape([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2.559000000001106,0.0,0.0,0.0,-2.305999999996857,3.994109162245877,0.0,0.0,0.0,-3.468249999998079,4.5400331111595... |
function PlotOriginalRealizations( tCopula )
%
figure( tCopula.iLabel + 1000 )
title('original realizations')
plot( tCopula.aafOriginalSamples );
%
end %
|
function j_disp(fname,txt)
% open log file
fid = fopen(fname,'a');
% write stuff in file
fprintf(fid,[txt,'\n']);
% close file
fclose(fid);
% disp on the command window with two carriage returns
fprintf([txt,'\n']) |
function [h,ch] = CS4640_hist(im)
%
h = zeros(1,256);
ch = h;
[M,N] = size(im);
for r = 1:M
for c = 1:N
index = max(1,floor(im(r,c)));
h(index) = h(index) + 1;
end
end
total = sum(h);
for v = 1:256
ch(v) = sum(h(1:v));
end
ch = ch/total;
|
% convert to txt
clear all
close all
filename = "squares";
load(strcat(filename, ".mat"));
fid = fopen(strcat(filename, ".txt"), "w");
% vertices
fprintf(fid, '%d\n', size(vertices, 1));
fprintf(fid, '%32.16f %32.16f\n', vertices');
% elements
fprintf(fid, '%d\n', length(elements));
for i=1:length(elements)
ne = ... |
function [pdf, cdf, bincenters] = binVarWithHeight(v,vrange,nbin,nz)
% v(1:nz,1:nsamp)
% bin the variable at each height
binedges = linspace(vrange(1),vrange(2),nbin);
for i=1:nbin-1
bincenters(i) = mean(binedges(i:i+1));
end
for iz=1:nz
% xx = histogram(v(iz,:),binedges);
pdf(:,iz) = histcounts(v(iz,:),binedges,... |
function varargout = normalized_setup(varargin)
%NORMALIZED_SETUP
%
% std::ostream & = NORMALIZED_SETUP()
% NORMALIZED_SETUP(std::istream & stream)
%
%
[varargout{1:nargout}] = casadiMEX(38, varargin{:});
end
|
classdef (Hidden, Sealed) ReaderUf < graph.reader.Reader
%UFLOADER Loads graph problem from the UF Collection.
% This interface loads a GRAPH instance from the University of
% Florida Sparse Matrix Collection.
%
% See also: LOADER, GRAPH.
%=========================== PROPERTIES... |
function [irp,upind] = potman_intrepres(pman,deb_fid)
%POTMAN_INTREPRES Internal representation for potential manager
% [IRP,{UPIND}] = EPT.POTMAN_INTREPRES(PMAN)
% Creates internal representation IRP from potential manager
% object PMAN (IRP can be passed to MEX functions).
% Optionally, UPIND returns the index of... |
%% Darstellung der Signale
% 1
k = 20; % 20 Bit-Payload
bits = randi([0 1], k, 1);
% 2 Digitale Modulation
fs= 64;
fc = fs/4;
obj = comm.RectangularQAMModulator('BitInput', true);
bits_enc = obj(bits);
% 3 Amplitudenmodulation - stimmt das??
qam_signal=rectpulse(bits_enc, fs);
% 4
sa_en = modulate(real(qam_signal), ... |
function [R,T] = computeSingleLayer(mu_a,mu_s,d)
if isempty(mu_a)
disp(['ERROR: K is empty.']);
return
end
if isempty(mu_s)
disp(['ERROR: S is empty.']);
return
end
K=sqrt(mu_a.*(mu_a+2.*mu_s));
beta=sqrt(mu_a./(mu_a+2.*mu_s));
R=((1-beta.^2).*(exp(K.*d)-exp(-K.*d)))./((((1+beta).^2).*(exp(K.*d)))-(((1-beta).^... |
function metric = ContrastFocus(obj,Managers )
DEBUG = true;
%CONTRASTDETECTION Summary of this function goes here
% Detailed explanation goes here
stageManager = Managers.Stages;
stageHandle = stageManager.modules{1};
% xlen = obj.resolution(1); % Could have huge speed up with smaller ROI
% ylen = obj.resolution(2)... |
% MODELCOMPARISON_CROSSVALIDATE Cross validates model likelihood by fitting on part of data
% Fits model to (X-1)/Xs of the data and evaluating the model on 1/X of the
% data.
%
% [logLike, params] = ...
% ModelComparison_CrossValidate(data, models, [optionalParameters])
%
% As a default, 1/10 of the dat... |
function [Results]= single_RidgeReg(nodes, syn_param, lambda)
nodenum = numel(nodes);
[ntrain,nfeat] = size(nodes{1}.data);
single_U = zeros(nfeat,nodenum);
for k =1:nodenum
X = nodes{k}.data;
y = nodes{k}.gnd;
w = (X'*X + 2*ntrain*lambda*eye(nfeat))\(X'*y);
single_... |
function [correctRate, missesvector] = diffGroundTruth(outputpath, groundtruthpath)
%%%% compare the correct rate %%%%
if exist(groundtruthpath, 'file') == 2 && exist(outputpath, 'file') == 2
fid1 = fopen(groundtruthpath);
fid2 = fopen(outputpath);
lines = 0;
misses = 0;
missesvector = [];
coun... |
function RCsignif = metricsRC_wu(SC, ci, rcPerm, nPerm)
% function metricsRC_wu, gets called in metricsGlobal_wu
% SC = mean structural connectivity matrix
% ci = set of ca 19 individual connectivity matrices
% rcperm = set of rich-club vectors per permutated matrix: rcDim x noPermMatrices
% nPerm = number of group ... |
function seriallogger(port,speed,fdir)
%
% seriallogger(port,speed,fdir)
% log data from a serial port to a text file
% port is the comm port to log e.g., 'COM1'
% speed is the baud rate to use e.g., 9600
% fdir is the (optional) directory path to put the log file
% If fdir is not given, the file w... |
function [ combination ] = combine_pair( list )
% COMBVEC_OCTAVE
combination = [];
for i=1:length(list)
for j=i+1:length(list)
combination = [combination; [list(i), list(j)]];
end
end
combination = combination';
end
|
function [histogram] = delta_histogram(input_array)
% def calculateDeltaHistograms(image):
% differenceTreshold = 3
% horizontalHistogram, verticalHistogram = [0] * len(image[0]), [0] * len(image)
% for point, row in enumerate(image):
% for i in range(1, len(row)):
% if abs(int(row[i... |
function entries = query(knowledge_instance,varargin)
% QUERY - Multiple query in instrumental knowledge database.
%
% Usage: entries = query(knowledge_instance,filed1,value1,...,filedN,valueN)
% where: valuei = vi
% valuei = 'vi'
% valuei = 'vi1/vi2/.../vik'
% valuei =... |
function obj = SignalObject__windowmean(obj,dim)
if nargin < 2
dim = 2; % NOTE: this isn't default behavior. But because power /
% coherence is stored columnwise, we *usually* want to
% average across columns
end
assert(strcmp(obj.dtype,'cell'),'Signals are not windowed')... |
% Micol Marchetti-Bowick
% CMU School of Computer Science
% Adapted from Ankur Parikh
% Main function that controls simulation of dynamic network
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [network,sampleData] = DynamicNetworkSimulation()
NUM_VERTICES = 10;
INITIAL_NUM_EDGES =... |
import Lie.*
load('relative_pose.mat')
%% Get ground true and estimated pose twist
true_SE3 = {};
VIS_SE3 = {};
VIS_SE3{1}=eye(4);
vodo_SE3 = {};
vodo_SE3{1}=eye(4);
for i = 1:index+1
true_SE3{i} = [gt{i}.R,gt{i}.p;[0,0,0,1]];
if i>1
VIS_SE3{i} = [all_poses.R{i-1},all_poses.p{i-1};[0,0,0,1]... |
k_m = 0.29;
k_e = k_m;
R = 4.7;
m_t = 0.33;
m_k = 0.018;
r = 0.028;
l = 0.111/2;
J = 0.0023;
J_k = 0.000007056;
J_t = 0.00073;
g = 9.8;
Um = 8;
t = 0.5;
t_zvezda = 6.3;
w_0 = t_zvezda/t;
x_1 = m_t*l*r*(m_t*l*r-2*J)-(m_t*l^2+J_t)*(m_t*r^2+2*m_k*r^2+2*J_k+2*J);
a11 = 0;
a12 = 0;
a13 = 1;
a21 = ... |
function x=InseSort4LL(x,Prev,Next,Head)
% 函数功能:Bucket sort的子程序,对双向链表内的元素进行插入排序
% 注意,InseSort4LL并不会改变链表的指向,而是直接调整其input数组的顺序
% 例如,链表中2 -> 8,且x(8)小于x(2):
% 我们不会将链表调整为8 -> 2,而是直接x(8)和x(2)exchange。
j=Next(Head);
while(~isnan(j))
pivot=x(j);
i=j;
while(~isnan(Prev(i)) && (pivot < x(Prev(i))))
x(i)... |
function T0n = SymDGM(sigma,a,d,t,r,q)
global T01 T12 T23 T34 T45 T56
% This function calculates direct geometric model
% T0n - ma tran bien doi thuan nhat cua khau cuoi
% (end-effector) trong he toa do R0
% sigma(j) = 1 if joint j is prismatic
% sigma(j) = 0 if joint j is revolute
% a - the angle between Z(j-1) and Zj... |
dev='archivage/tdbextractor/1'
tango_ping(dev)
tango_command_inout(dev,'GetHost')
attr_name = '//ganymede.synchrotron-soleil.fr:20000/LT1/AEsim/CH.3/current';
tango_command_inout2(dev,'GetArchivingMode',attr_name)
% Rappel: les commandes sont sensible a la casse
tango_command_inout2(dev,'IsArchived',attr_name)
%Pro... |
function [wss] = frq2wss(frq)
%FRQ2BARK Convert Hertz to wss frequency scale
% wss = frq2wss(frq) converts a vector of frequencies (in Hz)
% to the corresponding values on the wss scale.
% Inputs: f vector of frequencies in Hz
%
% Outputs: wss wss values
%REFERENCES
%201O international Conferenc... |
function string=implode(pieces,delimiter)
%IMPLODE Joins strings with delimiter in between.
% IMPLODE(PIECES,DELIMITER) returns a string containing all the
% strings in PIECES joined with the DELIMITER string in between.
%
% Input arguments:
% PIECES - the pieces of string to join (cell array), each... |
function plot_layer(layer,i,t)
% Displays neuron firings in layer i at time t
if ~isempty(layer{i}.firings)
fired = layer{i}.firings(find(layer{i}.firings(:,1)==t),2);
else
fired = [];
end;
subplot(5,5,layer{i}.pos);
cla;
s = ceil(sqrt(layer{i}.rows*layer{i}.columns));
plot(floor((fired-1)./s)+1,mod(fired-1,s)+1,... |
function [flipped_data] = flip_data(unflipped_data)
if size(unflipped_data,1) > 1
flipped_data = unflipped_data;
else
flipped_data = unflipped_data';
end
end |
function SaveMeanSEM(session_dir, subject_name, subj_name, dropbox_dir, SUBJECTS_DIR, copeNames, hemis, ROIs, funcs, funcNames, Conditions, Runs)
% SaveMeanSEM(session_dir, subject_name, subj_name, dropbox_dir, ...
% SUBJECTS_DIR, copeNames, hemis, ROIs, funcs, funcNames, Conditions, Runs)
%
%
% Input arguments:
% ===... |
function [typeI1,typeI2,typeI3,typeI4,typeI5,typeI6,typeI7,typeI8,compress_type_len,recover_start_ub,Predict_error_I,judge_predict,compress_predict,tag_preprocess,finalem,f,Process_bitplane1,Process_bitplane2,Process_bitplane3,Process_bitplane4,Process_bitplane5,Process_bitplane6,Process_bitplane7,Process_bitplane8] = ... |
%Timo Vehvilšinen August 2019
function [data_table] = plot_bl_timeline(pre, post, epoch_length_seconds, epoch_overlap_seconds, ...
show_epochs, baseline_fcn, baseline_mode)
%PLOT_TIMELINE
% This function takes in epochs of pre- & postdrug EEG data for a single
% feature, calculates a baseline from the p... |
%% load & process TD file
pathname = 'C:\Users\kpb8927\data\td-library';
filename = 'Duncan_20190524_CObumpmove_10ms.mat';
load([pathname filesep filename]);
% Smooth spikes, get split TD, get movement onsets, get rid of unsorted units
%Smooth spikes
smoothParams.signals = {'S1_spikes'};
smoothParams.width = 0.05;
sm... |
function [ FootEventCell ] = FEvExtras( FootEventCell, events )
% More Foot Event Cell additions.
FootEventCell{1,3}=[];
FootEventCell{1,4}=[];
FootCount=zeros(events,1);
RCount=0; LCount=0;
for event=1:events
switch FootEventCell{event,2}
case 'RFS'
FootEventCell{event,3}='R';
... |
function [predict,coefs] = kNN(Xtrain,Ytrain,Xtest,K)
%Ytrain = [real(Ytrain), imag(Ytrain)];
ndata = size(Xtrain,1);
for j=1:size(Xtest,1)
s = zeros(ndata,1);
for i=1:ndata
s(i) = norm(Xtrain(i,:)-Xtest(j,:),1);
end
% Sort distances and find Kmax NN
[ssort,indsort] = sort(s);
ssort = s... |
function [ stack ] = imstackload( directory, type, fraction )
%IMSTACKLOAD Returns a 3D images stack of all images in the directory. Only
%works for stacks of images whose largest images is listed first. Does not
%sort directory before loading images.
% version = 1.1.0
% INPUTS:
% directory: the folder of image... |
%% Setup - run this function once to set up data files necessary for simulations
% uses defaults from Aberra et al. 2019
function initializeCellData()
mat_dir = addPaths;
%% Check that nrnmech.dll file exists, if not display a warning message
nrnmech_file = fullfile(mat_dir, '../nrn', 'special');
if ~isfile(nrnmech_f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.