text stringlengths 8 6.12M |
|---|
function [w, u] = l0regprimal(X, y, lambda, p, MaxIt, epn)
% This function computes the Least Squares parameters
% with a penalty on the Lp-norm of the parameters
%
% Method used:
% Primal EM algorithm
%
% Zhenqiu Liu
% Cedars Sinai Medical Center
% 05/31/2014
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
... |
% SAVE_SPECIFICITY saves the specificity for different datasets into one
% file
%
% AUTHOR: Mainak Jas
function save_specificity()
specificity.pascal = find_specificity('pascal');
specificity.clipart = find_specificity('clipart');
load('../../data/specificity_automated.mat', 'specificity_w');
specificity.memorability... |
function Modulator = modulatorFBMC_PPN(ModulationSymbols, Param)
% This polyphase structure does not support oversampling!
%% Parameters
N = Param.N;
Offset = Param.Offset;
D = Param.D;
K = Param.K;
CarrierIndexes = Param.CarrierIndexes;
NrOfSymbols = ceil(length(ModulationSymbols)/D);
NrOfExtModSymbs = mod(D -... |
function q = rotToQuat(R)
% ROTTOQUAT Rotation matrix to unit-norm quaternion.
%
% q = [qx, qy, qz, qw], with qw the real part.
%
% Other m-files required: none
% Subfunctions: none
% MAT-files required: none
%
% Author: Gabriel Moreira
% email: gmoreira (at) isr.tecnico.ulisboa.pt
% Website: https... |
%% Tutorial: Full analysis workflow
% Matlab Colony Analyzer Toolkit
% Gordon Bean, July 2013
% gbean@ucsd.edu
%
% This tutorial provides the basic skeleton for a genetic screen analysis.
%
% The example directories and files are not provided in the toolkit (unlike
% the examples in other tutorials); however, this tuto... |
function [RxnMechanism]=createRxnMechanism(GEM,Flux,addcomp)
%Function to create reaction mechanisms for a GEM, also displays the
%cellular compartment where the reaction occurs
%
%Arguments:
%GEM: model COBRA structure
%Flux: predicted flux distribution (optional), if Flux is provided then the
%direction of t... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function [vx, vy, sumPsi, maxVelocity] = FindVelocities(x, y)
% input: x, y - arrays of x and y coordinates
% output: vx, vy - arrays of velocities in x and y directions.
% sumPsi - sum psi
% maxVelocity - max velocity as vx*vx+vy*vy
N = length(x);
maxVelocity = 0;
sumPsi = 0;
for k = 1... |
clear;
%---------------------------Symulacja bez przeklaman na kanale transmisyjnym-----------------------%
N = 16384; % Ilosc bitow wejsciowych
register_DVB = [1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0]; % Inicjalizacja rejestru dla DVB
register_V34 = [1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, ... |
function T = tsh(sinc_pos, evaluate_at)
% TSH(sinc_pos, evaluate_at) - time shifts matrix
if size(evaluate_at, 2) > 1
evaluate_at = evaluate_at.';
end
T = zeros(length(evaluate_at), length(sinc_pos));
for i = 1:length(sinc_pos)
T(:,i) = evaluate_at-sinc_pos(i);
end |
function [ ] = SendEmail( UserEmail,Password,EmailTo,Subject,Content )
% This function sends an email
setpref('Internet','E_mail',UserEmail);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',UserEmail);
setpref('Internet','SMTP_Password',Password);
props = java.lang.System.getPro... |
function pr = rotate_storm(uvstorm)
% Rotate the initial point (pi)
%pi=[-3,-5];
if uvstorm(1)<0; signs=-1; else; signs=1; end;
[th] = degrees(uvstorm',[0 1]'); % rotate degrees wrt y-coord [0 1]
for ix =
for iy =
pr = rotate_coord(signs*th,[3,5])
|
function distr = dsp__get_distributions( real, shuffled_labels, within )
% determine which trials fall within voltage and std deviation thresholds
within_voltage_range = real.trial_stats.range <= .3;
meaned = real.keep( within_voltage_range );
meaned = meaned.time_freq_mean( [], [0 100] );
within_std_threshold = ds... |
%% 1b)
clear all
omega0 = -2*pi; %first frequency sample
omegaM = 2*pi; %last frequency sample
M = 1000;
k = (0:M)';
omega = omega0 + (omegaM - omega0)*k/M;
x = [-3,2,6,6,4]';
n = [0:length(x)-1]'-1;
X = dtft( x, n, omega )
subplot(311)
stem(n,x)
title('x[n]')
xlabel('n')
ylabel('x[n]')
subplot(312)
plot(omega,abs(X... |
% AM.m suppressed carrier AM with freq and phase offset
pkg load signal
time=1.0; Ts=1/10000; % sampling interval & time
t=Ts:Ts:time; lent=length(t); % define a time vector
fm=20; fc=1000;
co=cos(2*pi*fc*t); % carrier at freq fc
si=sin(2*pi*fc*t);
m1=5/lent*(1:lent)+cos(2*pi*fm*t); % cr... |
function [x, f, counteval, countsuccess] = de_select(x, u, f, counteval, fitfun, varargin)
% DE_SELECT Selection of Differential Evolution
[~, uNP] = size(u);
[~, xNP] = size(x);
countsuccess = 0;
for i = 1 : uNP
fui = feval(fitfun, u(:, i));
counteval = counteval + 1;
if i <= xNP
if fui < f(i)
f(i) = fui;
... |
%%Calculate angles for each trial and then average angles for each probe
%%position --> Done for each subject separately (not combined)
%% specify where the data is
data_path='C:\Users\kirsi\Dropbox\struct_rep_data';
subject_id={'AMC026','AMC029','AMC031','AMC037','AMC038','AMC044'};
for m=1:length(subject_id... |
function iI = iminvert(I)
%
% IMINVERT inverts the grayscaled input image in the range [0 255]
iI = 255 - I; |
function [ a1, a2, m] = solve_2ph_charge_vectors(Qf1,Qf2,n_caps,mode,duty)
%SOLVE_2PH_CHARGE_VECTORS
%In steady state the charge flow in the capacitors of ph1 is equal and
%opposite to the ph2. To solve the system the charge flow of capacitors
%is changed to opposite singe. Incidence matrix are written defining the
%... |
function bNegativeDGxx = getNegativeDGxx(bNegativeB, bNegativeRxx)
% TODO: Merge getNegativeDGxx and getPositiveDGxx into a single function
% Additionally: Smart determination of where the zero field is -- on the
% left or on the right of the array!!!
% Evaluate Delta Gxx for the positive values of B-field
% 1. Estim... |
% FixedMean
% GP mean function with no parameters. Always returns its member 'value'.
% Its value is fixed during the learning phase.
classdef FixedMean < tacopig.meanfn.MeanFunc
% Protected member variables:
properties
value; % The fixed value of the Fixed mean
end
properties (Constant)
... |
% Detection based on Graftieaux at al. 2001
% Identification of vortex
clc;
clear;
nx = 50;
ny = 50;
%% reform2d and LambOseen
[X,Y,u,v] = generate_vortex(nx,ny);
%[vx, vy] = lambOseen;
%% Gamma values
r = 5;
r = round(r);
neighbour = -r:r;
factor = 1;
vx = u'; vy = v';
pm1 = zeros((2*... |
pkg load image
useful_functions; # NB this needs to be included if video_analysis hasn't just been run
BKP_ROOT = '%03d.bkp'; # make directory path match location of bkp files
#{
BKPS = {{10, 263.9, 19.6, 11, 103}, # the number of video i.e. ..h00_r04... padded with zeros to width 2
{11, 252.6, 146.5, 11, -1},... |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%Simulate a mmWave scenario with proactive caching.
%
%Authors: Frizziero - Suman - Dell'Eva
%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [d, newsi, cfreq, ord]=lofilt(d, si, b, a, varargin)
% ** function [d, newsi, cfreq, ord]=lofilt(d, si, b, a, varargin)
% Passes data d through butterworth lowpass filter using double reverse
% filtering routine 'filtfilt'. Double reverse filtering has the advantage
% of zero phase shift of the resulti... |
function [ein, eout, model] = svm_rbf_kernel(x_train, y_train, x_test, y_test, gamma, c)
addpath('libsvm-3.20/windows');
% model = svmtrain(training_label_vector, training_instance_matrix, 'libsvm_options')
% polynomial kernel: (gamma*u'*v + coef0)^degree
libsvm_options = char(strcat(...
{'-s... |
function acceleration = gravity(G, masses, positions, ind)
%GRAVITY Calculate the gravitational a on a particle
%
% Usage:
% force = gravity(masses, positions, index);
%
% Input:
% G: the gravitational constant
% masses: nParticles-dim column vector of masses
% positions: nParticles-by-3... |
W = Ws{2};
m = W.m;
EW = W.filter_vocabulary(2,Inf,Inf);
[p,i] = min([sum(EW.Y) sum(~EW.Y)]);
accs1 = [];
accs2 = [];
accs3 = [];
accs4 = [];
runs = 1;
Ts = cell(runs,1);
STs = cell(runs,1);
entireDataModel = fitcnb(EW.wordCountMatrix(), EW.Y, 'Distribution', 'mn');
d = cell2mat(entireDataModel.DistributionParamete... |
function [training_data,test_data] = extra_credit()
data = load(strcat('/home/dark_knight/UMD/Courses/ENEE439M/Project1/Data/data.mat'));
neutral = data.face(:, :, 1:3:598);
happy = data.face(:, :, 2:3:599);
illum = data.face(:, :, 3:3:600);
state = cat(3, neutral, happy, illum);
numx = 1;
for subject = 1 : 3
for ... |
function [post_samp,dsk] = FindBestk(X,maxk,a,b,alpha,numSteps1,numSteps2,var)
%% Produces plot of d_k^2 versus k to pick "optimal" number of lmks k
%% Inputs
% Required:
% X = sample of two-dimensional curves (all curves should be re-sampled to
% the same number of discretization points if they vary)
% maxk = ma... |
function [cost , numberOfExpandedNodes] = SolveMazeBidirectional(problem, drawMaze, fringe1, fringe2, heuristic1, heuristic2)
if isa(fringe1,'HeuristicFringe')
fringe1.Set(problem,heuristic1);
end
if isa(fringe2,'HeuristicFringe')
if nargin == 5
fringe2.Set(problem,heuri... |
function [EEG, removalInfo] = removeEyeArtifactsLARG(EEG, blinkInfo, ...
icaType, regressBlinkEvents, regressBlinkSignal)
%% Remove eye artifacts from EEG using LARG pipeline
%
% Parameters:
% EEG (input/output) may have ICs added to EEG
% blinkInfo Blink information structure... |
%% Forward DSC model
specific_path = '/home/jhow/Documents/OfficialRents/';
addpath(genpath(specific_path))
cd('/home/jhow/Documents/OfficialRents/Results_v6/PPI')
% DSC takes longer than DMC, so start with 32, then manually feed the best
% parameters to main_DSC_forward_ensemble_parameters.m
num_iterations = 32;
ent... |
function output = XuMean2(input,squeeze_or_not)
if nargin==1
squeeze_or_not=1;
end
if squeeze_or_not==1
output = squeeze(mean(mean(input,2),1));
else
output = mean(mean(input,2),1);
end |
function x = phenotype2genotype( y )
% PHENOTYPE2GENOTYPE Transform phenotype to genotype for jadeeig
% See also GENOTYPE2PHENOTYPE, JADEEIGERR
[phenotype_lb, phenotype_ub] = jadeeig.chromosome.phenotypebounds;
x = (y - phenotype_lb) ./ (phenotype_ub - phenotype_lb);
end
|
function cell2txtfile(filename,T,skipOpt)
fid=fopen(filename,'w');
for q=1:size(T,1);
l=T{q,:};
% if ~ischar(l) %If this isn't a string then assume its a number
% l=num2str(l);
% end
if skipOpt==0 || ~isempty(deblank(l))
fprintf(fid,'%s\r\n',l);
end
... |
function plotDef_Attitude(Setup,Results)
c = Setup.PostOptions.c;
% Real time
t = Results.Time;
% Get defender euler angles
switch Setup.ModelOptions.Defender.Attitude
case 'Euler'
Phi = Results.Defender.States.Att(1,:) * c.rad2deg;
Theta = Results.Defend... |
function x=random_signal(len, n, mn, mx),
% RANDOM_SIGNAL creates a random signal
%
% X=RANDOM_SIGNAL(LEN, N, MN, MX) create a (periodic) random signal X. The
% signal is created by choosing random (uniform distribution) phases and
% amplitudes of the first N Fourier components.
%
% LEN is the length of X
% N... |
% Precompute and package hyperparameter expressions into vector form
function cached = ComputeCachedLikelihoodTerms( kappa, nu, sigsq )
cached = [ ...
0 ...
kappa ...
nu ...
sigsq ...
nu * sigsq ...
-gammaln(nu/2) + (1/2)*log(kappa) + (nu/2)*log(nu*sigsq)];
cached = cast(cached, 'single');
end... |
%%% Visuzlize ERPs %%%
function visualize_ERPs(CFG,ERP_combined)
ERP_exmp = ERP_combined(end);
if CFG.plot_ERPs
for ch_idx = ch_ids
lbls = {ERP_exmp.chanlocs.labels};
CFG.channel_lbl_to_plot = lbls{ch_idx};
CFG.channel_idx_to_plot = ch_idx;%find(contains({ERP.chanlocs.labels},CFG... |
% Input: number of features F
% matrix X of features, with n rows (samples), d columns (features)
% X(i,j) is the j-th feature of the i-th sample
% vector y of scalar values, with n rows (samples), 1 column
% y(i) is the scalar value of the i-th sample
% Output: vector of selected fe... |
clear
% Generarea unei matrice pline B
B=zeros(7);
B(1,1)=1; B(2,2)=2; B(3,7)=4;
B(4,5)=3; B(7,3)=5; B(7,4)=2
% Convertirea sa in matrice rara
A=sparse(B)
% Afisarea informatiilor aferente celor doua matrice
whos A B
% Reprezentarea grafica a distributiei elementelor nenule din A
spy(A)
... |
function [v,w] = funnewton (x)
v = (x*x*x) - x - 1;
w = 3*(x*x) - 1;
endfunction
|
function [answer, handles] = ModelDialog( handles, model_name, prompt, failedDefaultAnswers)
%
% Dialog
%
% Stores input variables in imlook4d instance,
% and global in workspace as fallback.
%
%
% Defaults from local instance if exists, otherwise second alternative
try
eval(['defaultanswer = handles.model.' mo... |
function varargout = drawCube(cube, varargin)
%DRAWCUBE Draw a 3D centered cube, eventually rotated.
%
% drawCube(CUBE)
% Displays a 3D cube on current axis. CUBE is given by:
% [XC YC ZC SIDE THETA PHI PSI]
% where (XC, YC, ZC) is the CUBE center, SIDE is the length of the cube
% main sides, and THETA... |
%% teste gpires
%IMAGINAÇÂO
% right hand movement vs feet movement
% Trials are cut in the interval [0.5–2.5 s] after the onset of the cue.
%% load dos dados e parametros
% Motor Imagery demo
m = load('100Hz/data_set_IVa_al.mat');
m2 = load('100Hz/true_labels_al.mat');
sample_rate = m.nfo.fs;
EEG = m.cnt';
nchan... |
function vector = state_to_vector(state)
% state_to_vector
%
% Build a state vector by recursively moving through the elements of a more
% complex state (matrix, cell array, or struct), saving the numerical
% values along the way in a vector. This is used in odehybrid to convert a
% complex series of states into a ve... |
function [xlist, vxhat,vyhat,dhat]=getmeans(fname)
dat=load(fname);
x=dat(:,3); y=dat(:,4); d=dat(:,5); vx=dat(:,6); vy=dat(:,7)+1.5.*x;
xlist=unique(x); ylist=unique(y);
Nx=length(xlist); Ny=length(ylist);
for i=1:Nx
ind = find(x == xlist(i));
vxhat(:,i) = fft(vx(ind))./Ny;
vyhat(:,i) = fft(vy(ind))./Ny;
dhat... |
function [registres, plots] = update_registres(registres, plots, trames, lon_ref, lat_ref)
% Cette fonction met en relation les registres déjà existants avec les
% possibles nouveaux registres détectés dans les trames
% Décodage des trames dans des registres
[r, id] = bits2registres(trames, lon_ref, l... |
% % Search the elements that are lying within a specified interval.
% % Search the indexes of all elements in x (sorted vector of n elements) that
% % lie within the interval.
% % The algorithm uses binary searches, thus it runs in log(n)
% %
% % INPUT:
% % x: vector of numeric values sorted in ascending order
... |
clear
load W
A = {'TETCB';'TETXB'};A = replace(A);
figure
hold on
S(1) = {'Arizona'};
S(2) = {'California'};
S(3) = {'New Mexico'};
S(4) = {'Texas'};
for i = 1:4
D = W(:,i,A(2))./W(:,i,A(1));
hold on
plot(1960:2009,D)
title('end-use/use')
end
legend(S) |
%Calculates position, velocity, orientation, and steering angle over time
function [xdot, y] = steeringSimEqn(t,x,B,L,Rmax,b,m,path,Iz,C,steerRatio,Vx)
global currentPoint;
Vy = x(1);
omega = x(2);
X = x(3);
Y = x(4);
phi = x(5);
deltaSteer = x(6);
%Determine if the car is... |
clc
for k=1:length(vol)
limbic(k)=Sinal.(vol{k}).rampa.Param(4)
limtric(k)=Sinal.(vol{k}).rampa.Param(5)
maxbic(k)=Sinal.(vol{k}).rampa.Param(6)
maxtric(k)=Sinal.(vol{k}).rampa.Param(7)
end
vol'
bic=[limbic',maxbic']
tric=[limtric',maxtric'] |
function [vertices, faces] = read_facet_model(facet_file)
%% Read a model facet file
% Created by: Lee A. Harrison
% Cretaed on: 1/17/2019
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without... |
clear all;
close all;
clc;
FLAG_ADD_TIME = 0 ;
FLAG_ADD_FREQ = 1 ;
FLAG_ADD_NOISE = 1 ;
flag_shift = 0 ;
shift = 0;
EbN0 = [28:-1:5] ;%4:0.2:12;
freqOffset = 400e3;% 20e3 ; % 10e3;
ppm = 400e-6;%400e-6;%-400e-6; % residual ppm should not be too much
flag_plot = 0 ;
numFrames = 1;
... |
function b1 = mclpmb1(na,dwell,mclprp)
% Function for b1 calc
% Called by mclpclc
% Dwell in us
% ***** Uses inputs mclaac and mclbbc
global mclaac mclbbc mmggamma mmgresol
% Define local constants *****************
const = (mmggamma/2)*(dwell/1000)*2*pi ;
a = (mclaac)' ;
b = (mclbbc)' ;
% Generate coefficien... |
function [ ] = model_fit(T1_experiment, filepath, model, NORM)
% this script takes the data and plots the data based on the input
clear y_fitted params y_TC resnorm
nf = length(T1_experiment);
if strcmp(model, 'biexp') || strcmp(model,'all')
for j = 1:nf
dt = T1_experiment(j).darktimes;
if NORM == ... |
function [synth_img] = create_synth_dataset()
m = 480;
n = 720;
synth_img = zeros(m,n,3);
patch_size = 120;
r_patch = zeros(patch_size,patch_size,3);
r_patch(:,:,1) = ones(patch_size,patch_size);
g_patch = zeros(patch_size,patch_size,3);
g_patch(:,:,2) = ones(patch_size,patch_size);
... |
function wts = inv_propensity(X_Y,A,B)
%{
Author: Yashoteja Prabhu ( yashoteja.prabhu@gmail.com )
%}
%% Returns inverse propensity weights
%% A,B are parameters of the propensity model. Refer to paper for more details.
%% A,B values used for different datasets in paper:
%% Wikipedia-LSHTC: A=0.5, B=0.4
%% A... |
function LAB = rgb2lab_cvip(varargin)
% RGB2LAB_CVIP - Converts Red-Green-Blue Color value to L* a* b* Color value
%
% Syntax :
% ------
% OutputImage = rgb2lab_cvip(InputImage, type)
%
% Input parameters include :
% ------------------------
% 'InputImage' RGB Image
% 'type' output image pref... |
% Example 9.1
% Computes the weighted residual for the model p
% Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%
% fvec=fun(p)
%
%
% p is expected to be a two element vector
% - the first element is transmissivity
% - the second element is the storage coefficie... |
function [s,d] = readsen3(filebase,startchip,endchip,nblocks)
%
% function [s,d] = readsen3(filebase,[startchip,[endchip, [nblocks]]])
%
% for use with C version of tagread2x/tagread3, to read the sensor data from
% DTAG V1.1
%
% Input arguments:
% filebase: base filename (or complete filename if it is only argument)
%... |
function osc_s = default_osc_settings()
% DEFAULT_OSC_SETTINGS - Default OSC settings for the Orchidee OSC
% server.
%
% Usage: osc_s = default_osc_settings()
%
osc_s.ip = '127.0.0.1';
osc_s.sendport = 9999;
osc_s.receiveport = 9998; |
function createCsvFiles( experiment_dir )
%CREATECSVFILES Creates a unique csv files corresponding to the experiment.
% CREATECSVFILES(experiment_dir) Creates the csv files corresponding to
% the experiment.
% experiment_dir must correspond to the experiment directory i.e. it
% must ONLY contain the tim... |
function [sgm_output,coeff_water ]= XuSimuWaterCorrection(sgm_input, en_simu, spec_simu, order_cell)
spec_simu = spec_simu/mean(spec_simu);
mu_water = XuGetAtten('water',1,en_simu);
mu_water_mean = mean(spec_simu.*mu_water);
length_water_max = max(sgm_input(:))/(mu_water_mean/10)*1.5;% in mm
water_thickness = linspa... |
%西塔-90的力矩和浮心
%/*----此处的积分为两部分----*/
%/*----积分区域为右下和右上--*/
%/*----注意积分上下限-------*/
%/*----其余原理和上一个函数一样-*/
function F=the_main3(A,B,H,V_boat,m_mast_z)
X=[];
theat=obtain_theat(H,A,B,V_boat);
i=theat*180/pi+1;
while(i<90)
%fprintf("这是第%f个i",i);
%/*------得到截距C----*/
%/*------吊塔---------*/
... |
function bvl = bvlc(Im)
%this is to find out the BVLC of the image
clc;
B=imresize(Im,[121 134]);
B= rgb2gray(B);
I = im2double(B);
s = size(I);
I = padarray( I, [1 1]);
w=1;
c = 2;
bs=2;
k=0;
sx = 0;
m=0;
for i=2: bs : (s(1))
for j=2: bs : (s(2))
m = m+1;
sx = 0;
... |
clc;
clear all
close all
format compact
V=5;
nColor=1;
Pc=0.9; %Crossover
Pm=0.1; %Mutation
Generation_num=20;
N=2; % Number of chromosom
LengthCh=V; %Length of chromosom
Best=10000;
%%
%Make graph
%G=RandGraph(V);
G=CycleGraph(V);
%G=FullGraph(V);
%%
%Initial Population
Ch=Initial_Populatio... |
function color_rgb = khaki
color_rgb = {'color', [0.94117, 0.90196, 0.54901]};
end |
load phenotype
i=~isnan(TOD);
load expr_b47_b11 data genelist
data_b47=data(:,1:210);
data_b11=data(:,211:end);
data_b47i=data_b47(:,i);
data_b11i=data_b11(:,i);
TODi=TOD(i);
Agei=Age(i);
P1Ii=P1I(i);
pHi=pH(i);
Racei=Race_isWhite(i);
Sexi=Sex_isMale(i);
RINi=RIN(i);
%%
[y,idx]=ismember('PER1',genelist);
figure;... |
%% 数据预处理 - 处理一个文件夹下的所有excel数据,并把所有的结果合并为combine数据
% 此程序是dataProcessForOneExpFile 和 dataProcessCombineDataStructCells的综合
% 处理的结果将在数据文件夹下生成pData.mat文件,此文件包含所有的数据处理结果
clc;
close all;
clear;
currentPath = fileparts(mfilename('fullpath'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%下面是需要设置的参数,... |
fplot('transfusion(RBCA)',[0 0.975]);
legend('ma','mb','mc','y','t');
xlabel('RBCA') |
%% Funkcija za razteg histograma - histstretch:
function vaja1_naloga3c(I)
I_tmp = double(I);
a_min = 0;
a_max = 255;
a_high = max(I_tmp(:));
a_low = min(I_tmp(:));
I_str = a_min + (I_tmp - a_low) * ((a_max - a_min) / (a_high - a_low));
I_str = uint8(I_str);
P_0 = ... |
function [LHSevent,RHSevent,LTOevent,RTOevent] = getEventsFromAngles(trialData,angleData,orientation)
pad = 25; %this is the minimum number of samples two events can be apart
nsamples = trialData.markerData.Length;
[LHSevent,RHSevent,LTOevent,RTOevent]=deal(false(nsamples,1));
%Get angle traces
rdata = angleDa... |
N=[1,4,9,16,25,36,49,64,81,100];
sN=1:1:10;
x=1:1:100;
y=interp1(N,sN,x,'spline');
disp('使用三次多项式插值:');
disp(y); |
% close all
clear all
decision_map_path = '/usr/not-backed-up/1_convlstm/convLSTM_prediction16_ped2/';
% decision_map_path = '/usr/not-backed-up/1_convlstm/Ped2_5framesPrediction_ucsdAvenue_146/';
addpath('../')
%gt
testSeqPath = '/usr/not-backed-up/1_DATABASE/UCSD_Anomaly_Dataset.tar/UCSD_Anomaly_Dataset.v1p2/UCSDped2... |
function [P, spl, options] = spherical_wave_sim(c, U0, phi, N, mono_loc, pos_vec, freq, samp_freq, t_end)
% This function analytically simulates the 3D temporal pressure field for arbitrary number of monopoles.
%
%[Pressure Field, options] = monopole_sim(rho, c, U0, a, n, mono_loc, field, field_points, freq, samp_f... |
function [ PC, eigenvalue, iterEnergy ] = no_penalty( inputData, xOrig, step, nIters, type)
R = inputData.R;
nImgs = inputData.nImgs;
nDimRows = inputData.nDimRows;
nDimCols = inputData.nDimCols;
dims = inputData.dims;
center = inputData.center;
x = xOrig;
iterEnergy = [];
for i = 1:nIters
if (strcmp(typ... |
skipGeneration = false;
skipSimulation = false;
skipPlot = false;
if ~skipGeneration && ~skipSimulation && ~skipPlot
clear; %clear la mémoire
skipGeneration = false;
skipSimulation = false;
skipPlot = false;
end
clc; %clear le texte de la console
if ~skipPlot
clf; %clear la mémoire
end
% --... |
function [ res ] = Amain( class1, class2, prIn)
clear global kr Acell;
global kr Acell;
n(1) = length(class1);
n(2) = length(class2);
pr = prIn;
kr = struct('np',[], 'zn',[], 'sc',[]);
% format long;
for i = 1:n(1)
for j = 1:pr
rz(j, i, 1) = class1(i, j);
end
end
for i = 1:n(2)
for j = 1:pr
... |
function current_update = read_current_update(directory)
filename = sprintf('%s/current_update.txt',directory);
if (~exist(filename,'file'))
current_update = 1;
dlmwrite(filename,current_update,' ');
else
current_update = load(filename);
end
end |
% Script to compute bistatic RCS
function [RCSbe, RCSbh] = bist_rcs(J, obj, k, eta, theta_i, phi_i, rot_EH_i, ang_e1, ang_e2, ang_h1, ang_h2, M_e, M_h)
if isempty(ang_e1) || isempty(ang_e2) || isempty(ang_h1) || isempty(ang_h2) || isempty(M_e) || isempty(M_h)
error('All bistatic parameters must be specified');
... |
k=0.9; % modulation index
f_o=50; % output frequcency(fundamental)
f_c=2e4; % carrier frequency (switching)
The_o=0; % output phase
The_c=0; % carrier phase
m_max=4; % maximum harmonics of carrier
n_max=10; % The number of sidebands
[fA, MagA, PhaseA] = SwitchingFunction(k,f_o,f_c,The_o,The_c,m_max,n_max);
Th... |
function ret = ShorNoise(state, er, pos)
lstate = Encode(state, "shor");
lstate = Evolve(ProductGate(9,er,[pos]),lstate);
lstate = Decode(lstate, "shor");
lstate = Recover(lstate, "shor");
ret = lstate;
endfunction
|
function preset = gps_presets(name)
% Returns preset variables.
%
% Author: A. Conrad Nied (anied@cs.washington.edu)
%
% Changelog:
% 2014-01-02 Automatically generated by gps_init to format GPS by user conrad
switch lower(name)
case {'gpsnum', 'gpsfig', 'menu figure'}
preset = 6750000;
case {'gpsanum'... |
function [digval, tresh, delta] = adconvert(ftype,nos,sfreq,nob,ampmax,ampmin,ffreq,fampl,fphase,foffset);
K = 2^nob;
delta = (ampmax-ampmin)/(K - 1);
tresh = linspace(ampmin, ampmax, K);
if isstr(ftype)
if strcmp(ftype,'sine')
fvals = foffset + fampl*sin(fphase+(2*pi*ffreq/sfreq)*(1:nos));
elseif strcmp(ft... |
%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
% Workbook: C:\Users\vv972\OneDrive\Documents\MATLAB\Excel case study\Excel Automation\Automation_Sample Calender_v0.1.xlsx
% Worksheet: Simple
%
% Auto-generated by MATLAB on 19-Jul-2021 13:12:35
clear all;
%% Taking d... |
% X = foreign currency
% r_x = foreign interest rate
% r_y = domestic interest rate
% d = dividend yield
% v = stochastic volatility process of underlying S
% k = mean reversion speed
% theta = long term mean volatility
% sigma = vol of vol (kurtosis)
% Y = domestic currency
% Z_y_x = forex rate
% sigma_fx = constant v... |
#!/usr/bin/octave -qf
filename = "phase5.txt";
fid = fopen (filename, "w");
i=1;
while (i<=33)
#fputs(fid,randperm(12,2));
#fdisp(fid,i i+1);
a=randperm(12,2);
fprintf(fid,"%d %d\n",a(1),a(2));
end
fclose (fid);
|
pas_acc
interval=x1:pas:x2 |
%% 第三章样条插值
% 参考网站:https://www.cnblogs.com/lingr7/p/9780429.html
% 在[0,pi]生成随机的点
clc,clear;
x = pi*rand(11,1);
x = x';
f = @(x)sin(x);
y = f(x);
%开始构造函数
n=size(x,2);
for k=2:n %计算h(i)
h(k-1)=x(k)-x(k-1);
end
for k=1:(n-2) %计算μ和λ
mu(k)=h(k)/(h(k)+h(k+1));
lambda(k)=1-mu(k);
end
for k... |
function optimal_ntree=optimal_n_RFregression(dataset, k)
%'''cosider normalize here'''
min_rmse=10000;
optimal_ntree=0;
for ntree = 10:10:100
% sample from dataset
sample_data = datasample(dataset, k);
split = round(k * 0.8);
train = sample_data(1:split,:);
test = sample_data(split+1:k,:);
... |
function plotData(X, y)
%PLOTDATA Plots the data points X and y into a new figure
% PLOTDATA(x,y) plots the data points with + for the positive examples
% and o for the negative examples. X is assumed to be a Mx2 matrix.
% Create New Figure
figure; hold on;
% ====================== YOUR CODE HERE ===============... |
function condName = conditions(condID, SESSION)
import btmn.*;
import mperl.file.spec.catfile;
import mperl.join;
% Capitalize first letter of SESSION
session = regexprep(SESSION, '(\<[a-z])', '${upper($1)}');
fName = catfile(root_path, 'data', ['conditions' session '.csv']);
% Read numeric contents
condContent = c... |
function [creaky_input_features, ishi_input_features, KD_input_features] = input_creaky_features(fileName)
% Function to the full feature extraction required to create input feature for the ANN
% creaky voice classification method
%% Load fileName
[x,fs] = audioread(fileName);
%% Extract Kane-Drugman features
[H2H1,... |
function [hEstpdf,hEstpts]=initestpdf(n,mean,cov)
hEstpdf = zeros(n,1);
hEstpts = zeros(n,1);
for i=1:n
range= mean(i,1)-100:.1:mean(i,1)+100;
pdf = exp(- 0.5 * ((range - mean(i,1)) / cov(i,1)) .^ 2) / (cov(i,1) * sqrt(2 * pi));
hEstpdf(i) = plot(range,pdf,'b');
hEstpts(i) = plot(mean(i,1),0,'b+');
end
|
function result = InverseJacobiDN( X, K )
%INVERSEJACOBIDN Inverse of the Jacobi function DN.
% INVERSEJACOBIDN(X,K) is the inverse of Jacobi function DN for
% elements of argument X and modulus K. X and K must all be real and the
% same size or any of them can be scalar.
%
% See also MINVERSEJACOBIDN
% I... |
function [s,t] = fd_plot_stencil(side,V)
% Visualization of the stencil (non-zeros in a row V of a matrix).
%
% [s,t] = fd_plot_stencil(side,V)
%
% Inputs:
% side [h w]
% V h*w by 1 row of a sparse matrix
% Outputs:
% s handle to surf plot
% t handle to text plot
%
% Example:
% Q... |
function [x,y] = firstlast(PFC)
splitcells = regexp(PFC, ';', 'split');
x = [];
y = [];
n = size(PFC,1);
for i = 1:n
x = vertcat(x, splitcells{i,:}(1,1));
y = vertcat(y, splitcells{i,:}(1,end));
end
x = cellfun(@str2num, x);
y = cellfun(@str2num, y);
end |
function [ output_args ] = wrap_to( series , wrap_length )
%WRAP_TO Summary of this function goes here
% Detailed explanation goes here
[~,length]=size(series);
output_args=zeros(length-wrap_length+1,wrap_length);
for i=1:length-wrap_length+1
output_args(i,:)=series(i:i+wrap_length-1);
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.