text stringlengths 8 6.12M |
|---|
%-----------------------------------------------------------------------
% Job script created by scr_job_create, 14-May-2014 12:07
%-----------------------------------------------------------------------
global settings ... |
function state = obs2state(obs, Params)
% input: observation for a single car,
% struct of a car which ususally be the ego_car
% output: state id (1~1458)
% NYX modified 12/01/2017 13:28;
msg = obs2msg(obs, Params);
state = msg2state(msg);
|
function prob = GetLineProb(pmap, pt1, pt2)
% calculate edge angles & lengths
tick = 2;
ang = GetAngle((pt1(1)-pt2(1)),(pt1(2)-pt2(2)));
dx = tick*cosd(ang);
dy = tick*sind(ang);
% Find rectangle(i.e. tick line)'s corner points
pt(1,1) = pt1(1) + ... |
clc;
clear;
delfigs;
prwaitbar off;
prwarning off;
nist_data = prnist(0:9,1:1000)
% NIST EVAL
prmemory(128000000);
clc;
iter = 1; % Number of performance evaluations
num_test = 100; % Number of test objects per class
average = 0;
parametric = {fisherc, ldc,loglc,nmc,nmsc,quadrc,qdc,udc,klldc,pcldc,polyc,subsc... |
function [F, J] = GENELCONTACTFORCEJAC(contactfunc,U,MESH,p0,pars,QuadMats,prev)
Ndof = length(U);
Nqdof = size(QuadMats.Q,1);
uxyn_qp = reshape(QuadMats.Q*U(1:MESH.Nn*MESH.dpn), 3, Nqdof/3)';
if length(p0)==1
p0 = ones(Nqdof/3,1)*p0;
end
[Ptx,Pty,Pn,dtxdux,dtxduy,dtxdun,dtydux,dtyduy,d... |
classdef IPhreeqc
% A wrapper for IPhreeqc package
properties
id
end
methods
function obj = IPhreeqc()
%IPhreeqc Construct an instance of this class without creating
%an IPhreeqc instance; Call CreateIPhreeqc to create an
%instance and initia... |
Fs=1000;i_trial=5; Hd=theta_filter; Hd1=notch;Hd2=notch60hz;
ts = PV{i_trial}.ts;
time = PV{i_trial}.duration;
LFP = PV{i_trial}.lfp;
LFP1 = filtfilt(Hd1.sosMatrix,Hd.ScaleValues, LFP);
LFP1 = filtfilt(Hd2.sosMatrix,Hd1.ScaleValues, LFP1);
LFP1 =DenosieLFP(LFP1);
LFP2 = filtfilt(Hd.s... |
num_dec_polys = 2;
t = msspoly('t', 1);
x = msspoly('x', 2);
q = [t;x];
in_basis_Z = monomial_basis(3, 6, q, msspoly('@a', nchoosek(3 + 6, 3)));
in_basis_Y = monomial_basis(2, 6, x, msspoly('@b', nchoosek(2 + 6, 2)));
c = 8 * x(1)^2 + 1.5 * x(2) ^ 5 + 9;
part_app_t = vector_partial_application(1, 2, in_basis_Z);
Z... |
clear;
clc;
% every time the elevation changes, change the read the gap again??? or
% double check for every elevation if the angle exists
% make matrix of available angles for every height?
% DONT PLOT IF ITS THE GROUND THING AND LIMIT RANGE????
% Set actual width to look for
% Compare turn1 for side on angle with r... |
function [ B ] = MPS_Truncate( A, D_final )
%brute force truncation of an MPS to D_final. Only works if A has fixed
%bond dimension
[N, ~] = size(A);
[D, d] = size(A{1});
if D_final >= D
error('Error. Final bond dimension larger than initial.');
end
B = cell(N, 1);
... |
function minOut = RR_min(Name)
[rr,tm]=ann2rr(Name,'atr');
num = size(rr,1);
time = zeros;
j = 1;
for i = 1:num
if(rr(i)>1000)
time(j) = (rr(i)/5000);
j = j+ 1;
end
end
minOut = min(time);
end |
function pass = uq_Kriging_test_ExpDesigns( level )
% pass = UQ_KRIGING_TEST_EXPDESIGNS(LEVEL): non-regression test for the
% various input scaling options in the Kriging module
%
% Summary:
% Make sure that Kriging works with user defined experimental designs
% regardless of scaling choice
%% initialize test
pass = 1... |
%hw 17 - 104
P = input("force of push in lb: ");
weight = input("weight of roller in lbf: ");
mass = weight / 32.2;
theta = input("angle between roller and ground: ");
radius = input("radius of wheel in ft: ");
Ig = .5 * mass * radius^2;
normal = weight + F*sind(theta);
%sum of forces
syms F a alpha
sumX = P*cos(the... |
function exportSWC(neuron, fname, fpath)
% EXPORTSWC Export neuron in SWC format
assert(isa(neuron, 'sbfsem.core.StructureAPI'), 'Input a Neuron');
if strcmp(fname(end-3:end), '.swc')
fname = [fname, '.swc'];
end
if nargin < 3
fpath = cd;
end
% Create the header
fid = fopen([fpath filesep fname]);
fprin... |
function [nbnoisestack] = MakeNBNoiseStack(Fs,dur,bandlimits)
%MakeNBNoiseStack: Create a NarrowBand Noise Stack
%Fs: Sampling rate (Hz)
%dur: Stimulus duration (ms)
%bandlimits: N X 2 array of bandlimits, LO and HI
dur = dur/1000;
len = dur*Fs;
mag = zeros(len,1);
for bandnum = 1:size(bandlimits,1)
... |
function [] = saveFig2Directory(Dir, hf)
if ~exist('hf','var')
hf = [];
end
n = 1;
Directory = sprintf([Dir '_%03d/'], n); % Finds the subdirectory in which the files will be placed.
while exist(Directory,'dir')
n = n+1;
Directory = sprintf([Dir '_%03d/'], n); % Finds the subdirectory in which the files w... |
classdef BuildUtils
methods(Static=true)
function compileMexes(dir)
% TODO: test.
dir
dirOld = pwd;
cd(dir);
mexFiles = what('*.c');
mexFiles = mexFiles.mex;
for mexFile=mexFiles
mex(mexFile);
end
cd(dirOld);
end
end
end |
function [val] = Newton_compare1(a,b)
%function to find ONE zero of the function in local interval
iter = 0;
if(a < b)
x1 = a;
x2 = b;
elseif a > b
x2 = a;
x1 = b;
elseif a == b
if myfunc(a) == 0
x = [a b];
return;
else
disp("The interval equals 0")
... |
function speakerTestSetup_lds()
global PDR
% PARAMS
PDR.filename = 'speaker_test';
cd(PDR.data_path);
if exist([PDR.filename '.mat'])
delete([PDR.filename '.mat']);
end
PDR.comments = 'Testing Equipment!';
PDR.record = 1;
PDR.isi_buf = 5;
% ORDERED LIST OF SPEAKER LOCATIONS
PDR.npretrials = 1;
PDR.TEST_trial_freq ... |
% This has been used for testing and will run the test geometry and aero in
% the build_wing.m file. I will update and relink when I know Peters code.
clear all
close all
run build_wing.m
run main.m
|
%% TRAINING TEST FILES
% TEST0_TRAINING.m
%% RECONITION TEST FILES
% TEST1-NUMBERS.m
% TEST1-SAPIENZA.m
% TEST2_ANN.m
% TEST3_ML.m |
metaltest2;
eigFD = eig(HessFD);
metaltest3;
eigDFPT = eig(HessDFPT);
metaltest4;
eigACP = eig(HessACP);
error = [eigFD - eigDFPT,eigACP - eigDFPT]
|
% peakNormalization.m
clear;clc;
[sig,Fs] = audioread('AcGtr.wav');
N = length(sig);
dBAmp = -6;
A = 10.^(dBAmp/20);
peak = max(abs(sig));
out = zeros(N,1);
for n = 1:N
out(n,1) = A * sig(n,1) * (1/peak);
end
|
function [subband,ptr]=de_subband_L3(biny,N,ptr)
load H2ext;
lenz=N(1)*N(2);
[n,ptr]=deSFcode(biny,6,ptr); n=n-1;
thd=2^n;
lB=biny(ptr); ptr=ptr+1;
[z1,ptr]=de_zone_sub2(biny,lB,ptr);
len1=length(z1); lenw1=sum(z1); lenk1=len1-lenw1;
if thd>1
[z1k,ptr]=de_z0(biny,lenk1,ptr);
lenkw1=sum(z1k); lenkk1=lenk1-lenkw... |
% SACE Adaptive contrast enhancement based on sigmoidal mapping function.
% J = SACE(I,TILES,OPTION) performs the adaptive contrast enhancement
% based on sigmoidal mapping function to enhance the contrast of a breast
% ultrasound image I, where TILES is a 1x2 vector indicating the number of
% contextual regi... |
function class = class_5_final_9(sig1,t1,t2,t3)
cum = moment_statistics(sig1);
[RD1,CD1,order1]=optics(sig1,10);
if(abs(cum(5))<t1) %threshold 1
if(abs(cum(13))>t2) %threshold 2
class=19;
else
class=25;
end
else
if(abs(cum(4))>t3) %threshold 3
class=1;
elseif(mean(RD1(ord... |
function [q, k] = cuadIK(Td, q0, DOF, IT_B, ET_F, varargin)
% CUADIK() Función que obtiene la cinemática inversa del cuadrúpedo, ya sea
% para las patas traseras (2 DOF) o las patas delanteras (3 DOF). La
% cinemática inversa permite mapear del espacio de tarea al espacio de
% configuración, por lo que se le alimen... |
% %% frequency bands
% ncomps=8;
% cd ~/Documents/ls_brain/methods/Alzheimers/INECO/
% d1='/Documents/bb/data/snr05pow1bp47/EEG/dataset_';
% d2='/Documents/bb/data/snr05pow1bp47/truth/dataset_';
% testbb_final
% cd ~/Desktop
% save('Res05bp47','Result','EV')
%
% cd ~/Documents/ls_brain/methods/Alzheimers/INECO/
% d1='... |
function [card, count, deck] = deal(deck,count)
%% List search to choose a card at random
r = rand(1,1); % Generate U(0,1)
i = 1; % Initialize index
p = deck/sum(deck); % Turn deck-array into probabilities that sum to 1.
while r > p(i) % Discrete inversion algorithm
... |
%======================================================================
%> @brief make uniform quadrilateral mesh object.
%>
%> @param N maximum polynomial order of basis functions
%> @param xlim limitation on x axis
%> @param ylim limitation on x axis
%> @param Mx Second argument
%> @param My Second argument
%> @param... |
function [beta,sigma,SE1,SE]=MMrse(data,bdp)
%
% Computes MM-estimator of regression with Robust standard errors, as in
% Croux, C., Dhaene, G., Hoorelbeke, D. (2003),
% ``Robust Standard Errors for Robust Estimators''
% Starting values of the MM-estimator is fast-S-estimator
% Salibian-Barrera, M... |
% Scripts to generate figures to be used in the report
addpath(genpath('lib'));
%% Example random graphs with various densities
N = 50; % Number of edges
q = 5; % Number of colors
c = 20; % Density
% Erdos-Renyi graph
G = randomGraph(N, c);
x = randsample(q, N, true);
str = spr... |
function [colorCell,colourArray] = ReadColourValues(filename)
%This function reads a list of color names and values from a text file. It
% returns the colorname in a n x 1 cell array where n represents how many
% colors there were in the file, and a 2D array of color values of size
% r x 3 where each row contains t... |
% J17_UDDSa.M
% This script builds the speed/time trace that a vehicle must follow in the
% UDDS section of the SAE J1711 draft dated Sep-18-98.
clear cyc_mph vc_key_on;
CYC_UDDS
pause_durs=10*60; % duration of pauses between consecutive cycles
pause_keys=0; % position of key during each pause
%% PREPARE ... |
function ratio = predict(X_val, y_val, W1, b1, W2, b2, conv_param, pool_param)
a = conv_relu_pool_forward(X_val, W1, b1, conv_param, pool_param);
scores = affine_forward(a, W2, b2);
[~, pred] = max(scores);
ratio = mean(pred-1 == y_val');
end
% function ratio = predict(scores, y)
% [~, pred] =... |
cla, close all;
clearvars;
filePath = fullfile(fileparts(which('PathPlanningExample')),'data','exampleMaps.mat');
load(filePath);
map = robotics.BinaryOccupancyGrid(simpleMap, 2);
robotRadius = 0.2;
mapInflated = copy(map);
inflate(mapInflated,robotRadius);
show(mapInflated);
hold on;
prm = robotics.PRM;
prm.Map = map... |
%% Takes in single path time, path steps, startposition and endposition
function [ points ] = quinticTrajectoryPoints( totalTime, totalSteps, startPosition, endPosition )
x = 1;
y = 2;
z = 3;
constantValuesX = quinticPoly(startPosition(x), endPosition(x), 0, totalTime, 0, 0, 0, 0);
consta... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 1/27/2020
function frequency = HisCount(img,m,n)
frequency=zeros(1,256);
for i=1:m
for j=1:n
frequency(1,img(i,j)+1)=frequency(1,img(i,j)+1)+1;
end
end
end |
function BaiTap12()
[trainImages, trainLabels] = loadData('train-images.idx3-ubyte', 'train-labels.idx1-ubyte');
trainFeatures = ExtractLBPFeaturesOfImages(trainImages);
Mdl = fitcknn(trainFeatures',trainLabels);
[testImages, testLabels] = loadData('t10k-images.idx3-ubyte','t10k-labels.idx1... |
function cmap = clab_rainbow(n, attr, dbg)
% -------------------------------------------------------------------------
% Default inputs
if nargin<3 || isempty(dbg)
dbg = 0; % Whether to output information and figures
end
if nargin<2 || isempty(attr)
attr = 'greenmid'; % Colormap type option
end
if nargin<1 || ... |
function result = MajorityVote(model)
%MAJORTYVOTE Summary of this function goes here
% Detailed explanation goes here
Ntask = model.Ntask;
Nwork = model.Nwork;
Ndom = model.Ndom;
NeibTask = model.NeibTask;
NeibWork = model.NeibWork;
LabelTask = model.LabelTask;
LabelWork = model.LabelWork;
LabelDomain =model.Label... |
function simulate_acrobot()
% load the URDF
r = RigidBodyManipulator('acrobot.urdf');
% setup and solve the optimization problem
x0 = zeros(4,1); % initial state
xf = [pi;0;0;0]; % final state
tf0 = 4; % the initial trajector length
N = 21; % number of knot points
prog = DircolTrajector... |
%% Parte2
%clear
%clc %comentar para la parte 3 (comentar tambien para la 1)
load('vowels.mat')
p=15;
AR_a=lpc(vowel_a,p);
AR_e=lpc(vowel_e,p);
AR_i=lpc(vowel_i,p);
AR_o=lpc(vowel_o,p);
AR_u=lpc(vowel_u,p);
figure
freqz(1,AR_a,1000)
title('filtro AR vocal a')
figure
freqz(1,AR_e,1000)
title('filtro AR vocal e')
figure... |
%%Scripts to plot dispersion curves from different regions.
island = load('dispcurves/island.mat');
mainland = load('dispcurves/mainland.mat');
northern = load('dispcurves/northern.mat');
filename = 'pics/is_main_disp';
figure(33)
clf
hold on
h1 = plot(island.dispcurve.periods,island.dispcurve.phv,'r-o');
h2 = plot(m... |
function result=HampelFilter(csidata)
hampelResult = hampel(csidata);
result=hampelResult;
end |
function DispersionFile(DISOUT)
format long g
IANALTYPE = 1;
DISIMPACT = 0.000001;
NDIS = 100;
NPARAMS = 12;
Params = {'XBODYIC(1)','XBODYIC(2)','XBODYIC(3)','XBODYIC(4)','XBODYIC(5)','XBODYIC(6)','XBODYIC(7)','XBODYIC(8)','XBODYIC(9)','XBODYIC(10)','XBODYIC(11)','XBODYIC(12)'};
limits = [1,1,1,3,0.01,0.01,10,2,2,1... |
function [implied] = getImpliedLogsBS(MU,SIGMA,w_l,w_m,w_s)
num_grid = getNumIndividual();
[grid,gammaL,gammaM,gammaS] = getGrid(MU,SIGMA,num_grid);
[~,workchoice_L,workchoice_M,workchoice_S,~] = getHrlyIncome(grid,w_l,w_m,w_s);
impliedLl = sum(workchoice_L);
impliedLm = sum(workchoice_M)... |
function neighborsCell = identifyNeighborsAuto(inputImages, inputSignals, varargin)
% This code automatically sorts through to find all obj neighbors within a certain distance of the target (boundary to boundary). The output is a cell array with vectors of the neighbor indices to each obj.
% Biafra Ahanonu
% started... |
function [cyc, Dsmp, Nsmp] = testPhaseLock(Nmf)
if nargin < 1
Nmf = 5;
end
mfA = [85.8, 27, 171.6, 432.4, 343.2, 34.1, 21.5, 54.1, 108.1, 17, 136.2, 216.2, 42.9, 272.4, 68.1]';
clc
pth = 'C:\AMFR\data\16-104';
Fs = 24414.0625*4/20;
mf = mfA(Nmf);
% fn = filen(pth, '*43*01A*.sgn');
% fnms = ful... |
function n = plus(k,m)
% kronMatrix +
%
% returns the sum of two kronMatrix objects.
%
% n = k + m will result in a kronMatrix object if
% k.a == m.a or k.b == m.b
%
% otherwise, this function will return an explicitly
% formed matrix, i.e. kron(k) + kron(m)
%
if (isa(k, 'kronMatrix'))
if... |
clear all;
n = 3000;
% Open csv file and split into arrays
input = csvread('RFM_Data.csv',1,0);
% Initialize arrays
ID = zeros(n,1);
R = zeros(n,1);
F = zeros(n,1);
M = abs(zeros(n,1));
class = zeros(n,1);
ID = input(:,1);
R = input(:,2);
F = input(:,3);
M = round(abs(input(:,4)));
R10 = prctile... |
% 1. model fitting
% set the job_opt.option_optimizing_model as 0 in the
% 'batch_model_cog_regressor_gen_v5_indi_complex' line 49
for sub = 1:1:24
batch_model_cog_regressor_gen_v5_indi_complex(sub, 0, 0, 10)
end
% 2. Generating regressors
% set the job_opt.option_optimizing_model as 1 in the
% 'batch_model_cog_r... |
classdef SWEElevationLimiter1d
%SWEELEVATIONLIMITER1D Summary of this class goes here
% Detailed explanation goes here
methods
function [ fphys ] = apply(obj, phys, fphys)
for m = 1:phys.Nmesh % update new elevation
fphys{m}(:,:,4) = fphys{m}(:,:,1) + fphy... |
function Xf = final_point(t0,tf,x0,xf)
qp_max = [1, 1, 2, 2*pi, 2*pi, 2*pi]';
dt = tf-t0;
q0 = x0(1:6,1);
qf = xf(1:6,1);
gr = (1 + sqrt(5))/2 - 1; % golden ratio
Xf = [];
for n = 0:10
dq = gr^n * (qf - q0);
v_mean = dq / dt;
ind = find( abs(v_mean) > qp_max );
if ( isempty( ind ) )
Xf... |
function [classifiers, classifiersWeights] = adaBoostTrain(X, Y, nbIter)
[n, p] = size(X);
dataWeights = ones(n, 1) / n;
pos = find(Y == 1);
neg = find(Y == -1);
dataWeights(pos,1) = 1 ./ length(pos);
dataWeights(neg,1) = 1 ./ length(neg);
classifiers = [];
classifiersWeights = [];
for i... |
% =========================================================================
% Function: DesignCode
%
% Parameters: driverMass (kg), suspensionFeelType, steeringTurnsToLock
% (turns), jumpHeight (m), terrainType
%
% Outputs: None
%
% DesignCode is the main "design" function which calls all other
% script... |
function timeSequence = osdByVol(y, fs, itera, plotOpt)
%osdByVol: Onset detection by volume
% Usage: timeSequence = osdByVol(wave, fs, itera)
% Hong-Ru Lee 20080820, Roger Jang 20080907
if nargin<1, selfdemo; return; end
if nargin<2, fs=11025; end
if nargin<3, itera=0.68; end
if nargin<4, plotOpt=1; end
wave=y;
wav... |
% clear,clc
%
% xmaxc=0.2:0.1:0.8;
% zmaxc=[0.01 0.05 0.1];
%
% al0=@()
%
% for i=1:length(zmaxc)
% A=zmaxc(i).*(xmaxc).^(-2);
% B=2.*xmaxc;
% D=1-2.*xmaxc;
% E=zmaxc(i)./(1-(xmazc).^2);
%
% alpha1=integral(@(xmaxc,theta)(1-2*xmaxc)*(A*B+A*(cos(theta)-1)^2),0)
%
% end
% ... |
Een for-lus kun je gebruiken als je bijvoorbeeld de index
van een vector bij een element van een vector moet optellen. |
function varargout = setres(varargin)
% SETRES MATLAB code for setres.fig
% SETRES, by itself, creates a new SETRES or raises the existing
% singleton*.
%
% H = SETRES returns the handle to a new SETRES or the handle to
% the existing singleton*.
%
% SETRES('CALLBACK',hObject,eventData,handles,... |
function [c] = APGLASSOup(b,A,para,lambda)
% Object: c = argmin (1/2)\|y-Dx\|_2^2+lambda\|x\|_1+\mu\|x_I\|_2^2
% s.t. x_T >0
% input arguments:
% b ------- D'*y transformed object vector
% A ------- D'*D transformed dictionary
% para ------ Lambda: Sparsity Level
% ... |
obj = View()
% chapter2.2 page17
obj = View()
obj.text
% chapter2.3.4 page23
|
clear all
close all
clc
restoredefaultpath
addpath(genpath(pwd))
% grab colors for plotting
h = plot(randn(7));
for i = 1:7; colors(i,:) = h(i).Color; end;
close all
% --- Experiment Setup ----------------------------------
% load data
fname = 'data/model_ensembles.mat';
load(fname);
% warm-up period
Fwarm = 0.5;
N... |
fn = 'TSSOP20';
folder = '/usr/brlcad/bin/';
delete([fn '.g']);
fid = fopen([fn '.mged'], 'w');
%% chip body
H = [-3.3 -2.25 0.475, -3.3 2.25 0.475, 3.3 2.25 0.475, 3.3 -2.25 0.475];
H = [H, H + [0.1 0.1 -0.475, 0.1 -0.1 -0.475, -0.1 -0.1 -0.475, -0.1 0.1 -0.475]] * 0.393700;
fprintf(fid, 'in body1s.s arb8 %g %g %g... |
function [snipsct,header] = MultiLoadIndexCTMF(spfiles,ctfiles,channels,indxsel,fullmultiindx)
% MultiLoadIndexSnippetsMF: concatenates indexed snippets from sequential files for multiple channels
% indx is a cell array with one vector/file, where the vector specifies the chosen
%multiindx is a cell array with a nchan... |
%HTP Hard Thresholding Pursuit
% HTP(y,A,s) runs the Hard Thresholding Pursuit started with x0=0
% Usage: [x,S,NormRes,NbIter] = htp(y,A,s,x0,MaxNbIter,TolRes)
% y: column vector, A: matrix, s: integer, x0: initial vector (optional, default=0),
% MaxNbIter: number of iterations not to be exceeded (optional, default=50... |
% PKPolarPtStability.m by Daniel Borrero 4/27/2012
% -------------------------------------------------
% Calculates the eigenvalues and eigenvectors of
% the stability matrix for the Porter-Knobloch system in
% for a generic point given in the 4D Cartesian representation
% (X1,x2,y1,Y2) for a given array of param... |
%% Finds the Postive and Negative clusters
% Here we determine which regions to flip the sign of. We do this by:
% First: Binarizing our data
load('Age_Data.mat'); %variable Age_Data
Bin_Age=cell(636,1);
BAge=zeros(257,636);
for i=1:636
yy=Age_Data{i};
Bin_Age{i}=Isingify2(length(yy(:,1)),498,... |
clear
clc
A = csvread('regresion_logistica.csv',1,0);
X = A(:,1:2);
Y = A(:,3);
impresionN(X,Y);
[m,n] = size(X);
X = MapeoDelFeature(X(:,1), X(:,2));
lambda = 1;
theta = zeros(size(X, 2), 1);
[J, grad] = CostoLogReg(theta, X, Y, lambda);
theta = zeros(size(X, 2), 1);
lambda = 0;
opciones = optimset('GradObj', 'on'... |
function [qd]=solar(S,delta,lat,hs)
% This function caculate solar radiation on the top of the troposphere
% S = corrected solar constant
% delta = declination
% lat = latitude
% hs = hour angle in a day
% h = hour angle in an hour
% coszen = cos(zenieth angle)
% qh = solar radiation of particular time
% qd = total sol... |
classdef spectrumAnalyzer < qes.hwdriver.sync.instrument
% spectrumAnalyzer source driver, basic.
% basic properties and functions of a spectrumAnalyzer source
% currently only support Keysight Technologies, N9030B
% Copyright 2016 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gma... |
classdef CC_OneStock
%UNTITLED3 Summary of this class goes here
% Detailed explanation goes here
properties
Index % 1,2,3,4,.... form the CStock.mat/csv
Name % stock number like '000123.SZ'
CName % Chinese Name like '????'
StartDate % digital number
EndD... |
function[z_align] = align1(z1,z2,num)
C1 = sum(z1(1,:).*z2(1,:) + z1(2,:).*z2(2,:))/num;
C2 = sum(z1(2,:).*z2(1,:) - z1(1,:).*z2(2,:))/num;
theta = atan2(C2,C1);
M = [cos(theta), -sin(theta);sin(theta),cos(theta)];
z_align = M*z2 ;
end |
function predicted = simulatedRSS723S3(data)
% The following is for comparing simulated RSS in 23-30
values = [-60.86
-66.8
-61.7
-66.9];
time = [30, 130];
predicted = zeros(size(data.SignalStrength));
predicted(:) = NaN;
for i=1:s... |
function [part] = make_xval_partition(n, n_folds)
%PART is a 1 X N vector,
% where PART(i) is a number in (1...N_FOLDS) indicating the fold assignment
% of the i'th data point.
% call upon a split in the original data using the part-splitted set of
% indices, e.g.
%trainingset_X = X(find(part == 2),:);
%trainingset_Y ... |
function LEN = getLEN(PAYLOAD)
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here % auch correct
LEN = 0;
fields = fieldnames(PAYLOAD);
size = numel(fields);
for i=1:size
field = fields{i};
PART = PAYLOAD.(field);
fields2 = fieldnames(PART);
size2 = numel(fields2);
for ... |
function CDataSetInfo= ThresholdDataSet(CDataSetInfo, Param, Mode)
ImageData=CDataSetInfo.ROIImageInfo.MaskData;
BWData=CDataSetInfo.ROIBWInfo.MaskData;
TempBW=zeros(size(BWData), 'uint8');
TempIndex=[];
%For compatibility
if isfield(Param, 'Threshold')
TempIndex=find(ImageData < Param.Threshold);
end... |
function [SSC] = TTR_Direct_HOLD(R,T,c,Default,max_c)
% This code is partially ported C++ code in Bajgrowicz and Scaillet(2012).
% http://www.sciencedirect.com/science/article/pii/S0304405X1200116X
% Also refer STW(1999) for more details
% http://onlinelibrary.wiley.com/doi/10.1111/0022-1082.00163/abstract
% This ... |
% t1 = 1/100:1/100:1;
% t2 = 1/200:1/200:1;
% q1 = sin(2*pi*t1)*0.5;
% q2 = sin(2*pi*t2)*0.5;
%
% qt = [q1 zeros(1,100)];
% final = repmat(qt,1,441);
% target = repmat(q2,1,441);
% plot(q2)
% % sound(final,44100);
% sound(target,44100);
%
% hold off
Y = zeros([35200,10]);
Y(:,1:10) = y_formantAdapted(1:... |
function image_feats = get_tiny_images(image_paths)
% image_paths is an N x 1 cell array of strings where each string is an
n = length(image_paths);
image_feats = zeros(n, 256);
for i = 1:n
image = imread(image_paths{i});
% Get the smaller of the size dimensions
% and create scale on that... |
function [scr,const]=constColor(scr,const)
% ----------------------------------------------------------------------
% [scr,const]=constColor(scr,const)
% ----------------------------------------------------------------------
% Goal of the function :
% Compute color with or without gamma linearisation
% ----------------... |
function [centreline_spline_cell_phyiscal,corresponding_end_pts] = ...
Selected_airway_to_spline( ...
seg_image, dis_image, manual_points, raw_image, raw_sturct)
%This function converts the selected airway and all other proir infromation
%realted to the input of the function - Cubic_resampling_and_arclength... |
function poly = add2poly(poly,layer,data)
% Formats data and appends to a poly struct
if nargin > 2
L = length(poly);
poly(L+1).layer = layer;
poly(L+1).datatype = 0;
poly(L+1).n = length(data(1,:));
poly(L+1).x = data(1,:);
poly(L+1).y = data(2,:);
poly(L+1) = pcheck(poly(L+1)); % c... |
%% TEAM: UN-UF-GERS-JEA
% Cooperation: Universidad Nacional de Colombia, University of Florida, GERS USA and JEA
%% TEAM MEMBERS:
% Pedro Garcia, pjgarciag@unal.edu.co, PhD Student at UN
% Diego Rodriguez, diego.rodriguez@gers.com.co, International Studies Manager at GERS USA and PhD Student at UN
% David Alvarez, dl... |
classdef Pool < handle
%POOL Summary of this class goes here
% Detailed explanation goes here
properties(Constant,Access=private)
pool = ether.parallel.Pool();
logger = ether.log4m.Logger.getLogger('ether.parallel.Pool');
end
properties(Access=private)
enabled = true;
end
methods(Static)
function di... |
%%%%%% Test Script For Matrix Factorisation : This script factor a matrix A
%%%%%%% of size N*N into a product of two matrices U.V of size N*k and k*N
% Constant
N = 10; % Size of the matrix
% Initialization
A = rand(N);
stringA = 'matrix A';
StringU = 'matrix U';
StringV = 'matrix V';
StringEstimate = '... |
function IridiumSBDStatusPlots(sysvector)
% Display the power plots
fig1 = figure();
fig1.Name = 'Iridium SatCom Plots';
isbd(1) = subplot(2,3,1);
hold on;
stairs(sysvector('iridiumsbd_status_0.failed_sbd_sessions').Time, sysvector('iridiumsbd_status_0.failed_sbd_sessions').Data);
stairs(sysvector('iridiumsbd_status_... |
%% ADC Lab Assignment #11
%% Task 1
T0 = 0.1;
Fs = 10000;
Fc = 300;
Kf = 1000*pi;
Ts = 1/Fs;
t = -T0/2:Ts:T0/2;
m = 0.5*cos(20*pi*t);
mi = Kf*cumsum(m)/Fs;
s_fm = cos(2*pi*Fc*t + mi);
figure,
subplot(211), plot(t,m), title('Message Signal')
subplot(212), plot(t,s_fm), title('Frequency Modulated Signal')
%% Task 2... |
% example program to show the usage of huffman encoding and decoding
% functions
clc
clear all
close all
path(path,'encoder') % make the encoder-functions visible to matlab
path(path,'decoder') % make the encoder-functions visible to matlab
path(path,'analysis') % make the encoder-func... |
function [n_pop, n_snap, t, traj_array] = load_MCseqs(m, filepath, filename)
% This function reads in data from the file 'filename' found in the
% directory 'filepath'. 'filename' could be one of a number of files
% producted by the Population Dynamics code. The is a file for the whole
% protein (MC_seqs.dat) and files... |
function y = dphi3 (x,tj)
% x = x/tj;
% y = 14*x - 34*3*x.^2 + 52*4*x.^3 - 24*5*x.^4;
y = 7*2*(x/tj)/tj - 34 *3*(x/tj).^2/tj + 52*4*(x/tj).^3/tj - 24*5*(x/tj).^4/tj;
end |
plot(a1(:,1)*1E9,a1(:,2),'r');
hold on;
plot(a1(:,1)*1E9,a1(:,3),'b');
hold on;
xlabel('tiempo (ns)');
ylabel('Amplitud (V)');
xlim([-40 120]);
grid on;
grid minor;
%delay = 42
figure();
plot(b1(:,1)*1E9,b1(:,2),'r');
hold on;
plot(b1(:,1)*1E9,b1(:,3),'b');
hold on;
xlabel('tiempo (ns)');
ylabel('Amplitud (V)');
xli... |
function val = get(P, prop_name)
%
% GET Get psf properties from specified object and return
% the value.
%
% val = get(P, prop_name);
%
% Valid choices for prop_name are:
% 'image' and 'center'
%
% J. Nagy 5/1/01
switch prop_name
case 'image'
val = P.image;
case 'center'
val = P.center;
otherwise
... |
clear all;
clc;
%% probe
fid = fopen('./TIFS_SI-2014_protocols/closedset_probe_3143.txt');
fid_out = fopen('lfw_closeset_probe_list_linux.txt', 'wt');
line = fgetl(fid);
while ischar(line)
temp = regexp(line, '_', 'split');
name = temp{1};
for i = 2:length(temp) - 1
name = sprintf('%s_%s', name, t... |
% metadata
animIDs = {'RW2','RW3','RZ2','RZ3'};
genotypes = {'WT','WT','Df1','Df1'};
projDir = '~/Projects/rn_Schizophrenia_Project/';
expDirs = strcat(animIDs,'_');
expDirs = strcat(expDirs,genotypes);
expDirs = strcat(expDirs,'_Experiment/');
dataDirs = strcat(projDir,strcat(expDirs,strcat(animIDs,'_direct/')));
base... |
function y = fftx(x)
n = max(size(x));
omega = exp(-2*1i*pi/n);
if(mod(n,2)==0)
k = (0:(n/2-1))';
w = omega.^k;
%Special case management
if(x(1:2:n-1)==x(2:2:n))
u = fftx(x(1:2:n-1));
v = w.*u;
else
%Recursive step
... |
function [] = visualizeKpMaps(dataStruct,kps,partNames,sc)
% VISUALIZEKPMAPS Plots the keypoint heatmaps
% close all;
% Declaring global variables
globals;
% If there are only three inputs, set the plot title to 0
if(nargin<4)
sc = 0;
end
% Obtain the bounding box and class label information from dataStruct
bb... |
function [x,y,par,cov] = mcenterstars(image,x,y,r,method)
%MCENTERSTARS Calculates the center of star-like objects on an image.
% [X,Y] = MCENTERSTARS(IMAGE,X,Y,R) fits individual 2d gaussians at each
% specified location given by the list of coordinates (X,Y) and returns
% the center of the gaussian (X,Y). R is... |
function sub = load_E1_v2(fname)
% fname = 'allHorizonData_v1.csv';
% also includes gID data for repeated games
%% read data from spreadsheet
fid = fopen(fname);
hdr = textscan(fid,...
'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s', ...
1, 'delimiter', ',');
data = texts... |
function [ out ] = plot_pic( pic, fig,tit)
%PLOT_PIC Summary of this function goes here
% Detailed explanation goes here
figure(fig)
subplot(1,1,1); imagesc(pic); colormap(gray);
title(tit);
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.