text stringlengths 8 6.12M |
|---|
% TPU.m - Software implementation of TPU according to 3GPP TS 45.010
%
% Copyright (C) 2013 Integrated System Laboratory ETHZ (SharperEDGE Team)
%
% This program is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation,... |
function Lw = build_inter_class_LaplacianMatrix(G, X, Y)
% Build the inter-class lap matrix by considering the label information:
% -------- default Wij = Gij (the edges) and Wij=0 if (Y(i)!=Y(j))
% X - [n,1] the instances
% Y - [n,1] the labels
% author: Zheng Wang @Tsinghua 2018.04.01
for i = 1 : size(G... |
function [S,count,Visited,flag_find,Queue]=SelectNonVisited_to_S(S,T,CurP,n0,Visited, flag_find, xTarget,yTarget,Queue,queue)
n=length(T);
count = 0;
for k=1:n
if Visited(T(k).x, T(k).y) == 1
continue;
end
count = count+1;
S(count+n0).x=T(k).x;
S(count+n0).y=T(k).y;
S(count+n0).father_x=... |
function [ OutputSignal ] = FastFourierTransform( InputSignal )
N=131072;
index= bitrevorder([1:N]);
Inputrev=zeros(N,1);
temp=zeros(N,1);
for i=1:N
Inputrev(i)=InputSignal(index(i));
end
for i = 1:17
n=2^i;
k=1;
while(k<N)
for p=0:n/2-1
a=Inputrev(k+p);
b=Inputrev(k+p... |
function cmm_write_header(fid, type, size)
cmm_write_type(fid, type);
cmm_write_dim(fid, size);
end |
function [activepixels4] = var_threshold(fcell, bg_std)
avg_std = std(fcell, [], 3);
im = avg_std.*(avg_std > 1.5*bg_std);
activepixels4 = find(im ~= 0);
|
%
% object=Domain(time,boundary,tolerance)
%
classdef Domain
properties (SetAccess=protected)
Time
Boundary
Tolerance
Subdomains
FrequencyCenter
FrequencyChirp
TimeLeft
end
methods (Hidden=true)
function object=Domain(varargin) ... |
% temp2=squeeze(data.filtered_lfp(:,spectro.channeltoanalyse,9));
temp2=data.filtered_lfp(:,spectro.channeltoanalyse);
%%
N=size(temp2,1);
t = ( 0:(N-1) )* (1/params.Fs); % times
f = ( (0:(N-1))/N) * (params.Fs); % frequencies
freqs = [1:100];
factor = 5/(2*pi);
scale = factor * params.Fs./ freqs;
wave='morl';
freq... |
function dicom2volume(dicom2volume_exe,dicom_dir,output_file)
mkdir(fileparts(output_file));
[status, result] = dos([dicom2volume_exe,' ',dicom_dir,' ',output_file],'-echo');
if status~=0
error(result)
end
|
% ASTROTIK by Francesco Santilli
% R2BP (Restricted Two Bodies Problem)
%
% Usage: plot_orbits(orbits)
% plot_orbits(orbits,f012)
% plot_orbits(orbits,[],mode)
% plot_orbits(orbits,[],[],colors)
% plot_orbits(orbits,[],[],[],names)
% plot_orbits(orbits,[],[],[],[],ha)
% ... |
function find_blobs_in_image('rice.jpg',xml_file_nameall,xml_file_nameremoved)
% This file is part of the Blob detection Toolbox - Copyright (C) 2009
% by Mohammad Jahangiri and Imperial College London.
% An image processing module that can extract blobs in an image. It
% consists of three main steps, including i)Tob... |
function [PA residual] = RieszPrefilter(A, config)
% RIESZPREFILTER process a 3D image with high pass and low pass filters
%
% [PA residual] = RieszPrefilter(A, config)
% filter the 3D image A with the lowpass and highpass prefilters specified
% by the RieszConfig object config.
% Returns a 3D low frequency image PA, a... |
load 'LinearEx_Out10x10grid/LinearEx_DataRead_Out10x10grid.mat';
DiffYXXY = CdataYX-CdataXY;
width = 4;
height = 2;
figure('Units', 'inches', ...
'Position', [0 0 width height],...
'PaperPositionMode','auto');
hold on;
cmap = colormap(flipud(gray));
hImage = imagesc(Bv,Av,DiffYXXY);
hPnt1 = plot(Bv(27),Av(31),'ko'... |
% some libraries to include
%
addpath('/Applications/spm12/'); % SPM itself
addpath('/Applications/spm12/config/'); % SPM itself
%addpath(genpath('/Users/momchil/Dropbox/Research/libs/CanlabCore/')) % neat fMRI tools from https://github.com/canlab/CanlabCore
addpath('/Users/momchil/Dropbox/Research/libs/ccnl-fmri/') %... |
setup;
setup_mail;
%% loading data
clear
load('data/wine.mat');
Y = y;
clear y;
%% minmax normalization
[sX, Xfw, Xbw] = minmaxNorm(X);
[sY, Yfw, Ybw] = minmaxNorm(Y);
%%
system('ulimit -t unlimited');
name = ['wine-', 'crossval-', datetimestr];
fprintf('\n[wine]\n------\n');
I = 0;
I = I + 1;
models{I} = str... |
% triangle and square:
C=false(7,7);
% triangle
C(1,2)=true;
C(1,3)=true;
C(2,3)=true;
% square:
C(4,5)=true;
C(4,7)=true;
C(5,6)=true;
C(6,7)=true;
% coordinaties to show:
r=[0 1 2 2 3 3 2
0 1 0 2 2 3 3];
% make C symmetricle:
for c1=1:7-1
for c2=c1+1:7
C(c2,c1)=C(c1,c2)... |
goteborgLat = 57.71; %57.70723
azimut = 150;
elevation = 25;
efficiency = 0.15;
area = 30;
%EXAMPLE PLOT FROM Au3 doc
%plotDay(5 ,1 , 55.6, 20, 180, 0.15, 30);
figure(1);
subplot(1, 2, 1)
plotDay(1, 15, goteborgLat, elevation, azimut, efficiency, area)
axis([4 16 0 3000])
subplot(1,2,2)
plotDay(6, 15, got... |
% physical screen parameters in cm
screenWidthInCm = 28;
screenDistInCm = 50;
widthScreen = 1024;
heightScreen = 768; |
cd E:\rawbadger\badger_mri\alex\nii
vein = load_untouch_nii('vein_in_epi.nii.gz');
fmri = load_untouch_nii('bp_reg_topup_mc_retino_rest.nii.gz');
vein_inds = find(vein.img>0);
res_fmri = reshape(fmri.img,[numel(fmri.img(:,:,:,1)),size(fmri.img,4)]);
corrs = voxcorr(fmri.img(:,:,:,20:end-20),squeeze(mean(re... |
classdef Movie < handle
% This is an abstract class that represents various formats of image stacks
% (movies) recorded from CCD cameras. Format-specific classes inherit from
% this class, creating a standard interface regardless of file format.
% All access is read-only and the file must exist as long as data access i... |
clear all;
[~, labels] = getMNISTdata(); % gets images and labels
labels = labels(1:50);
imds = imageDatastore('netImages', 'Labels', categorical(labels));
[imdsTrain,imdsValidation] = splitEachLabel(imds,0.7,'randomized');
numTrain = numel(imdsTrain);
numValid = numel(imdsValidation);
net = alexnet;
layers... |
varst7=[];
for xx=dataPointNum*k+(i-1)*mon_num+1:dataPointNum*k+(i-1)*mon_num+mon_num
varst2=zeros(1,dimVar);
varst2(xx)=1;
varst2((j-1)*k+i)=1; %for b(i,k)
varst7=[varst7;varst2];
end
|
function cp = cp_circle(ts)
% CP Trajectory (Circle)
% acceleration/deceleration time
dt = ts * 4;
% CP trajectory
radius = 0.11 / 2;
center = [0.254 - radius; 0];
omega = 2 * pi / (ts * 800);
phi = cal_eta(0, 2 * pi, omega, dt, ts);
crcl = repmat(center, 1, length(phi)) + radius * [cos(phi); sin(phi)];
c... |
%% Convert the trajectories and write binary file
function [] = write_traj(x, y, ts_list, t_1, filename)
dat_x = x';
dat_y = y';
dat_ts = zeros(size(dat_x));
for part = 1:size(dat_ts, 1)
dat_ts(part, :) = ts_list';
end
dat_t1 = t_1;
write_trajbin(filename, dat_x, dat_y, dat_ts, dat_t1);
disp(['Finish writing to '... |
function Joblist = load_joblist(File_Path, File_Name)
%LOAD_JOBLIST lädt die Jobliste von einem xls-File
% JOBLIST = LOAD_JOBLIST(FILE_PATH, FILE_NAME) lädt aus dem durch FILE_PATH
% und FILE_NAME (ohne Datei-Endung) angegebenen xls-File die JOBLIST, die die
% für eine Simulationsreihe abzuarbeitenden Param... |
%***************************************************************************
%***
%*** Program to find the MLEs using the Newton-Raphson algorithm
%***
%***************************************************************************
clear all;
clc;
state = 123;
randn('state', state);
% Part (a): Simulate the model... |
function [yhat,what,H] = nbnn(X, y, Z, n_nbrs, X_kdtree)
%--------------------------------------------------------------------------
%
% Copyright (c) 2013 Jeffrey Byrne <jebyrne@cis.upenn.edu>
%
%--------------------------------------------------------------------------
%% Exact nearest neighbor
if ~exist(X_kdtree,'... |
function b=polcut(bb,k)
% usage: function b=polcut(b,k)
%
% Cuts the last part (from order k) of the polynomium b, ie
% performs the operation:
%
% b <- [ q^{k}*b ]
% Programmed 1994 by Niels K. Poulsen
% Department of Mathematical Modelling,
% Technical University of Denmark
b=bb(k+1:end);
|
function term_mat = zpk2term(z,p,k,T)
%
% Utility Function: ZPK2TERM
%
% The purpose of this function is to convert zero/pole/gain format into
% the term matrix format used by the environments
% Author: Craig Borghesani
% Date: 9/5/94
% Copyright (c) 1999, Prentice-Hall
narg_vals = nargin;
if narg_vals==4... |
function job_fmincon2(varargin)
% 2 new parameters!
ratname = varargin{1};
ntrials = str2double(varargin{2});
offset = str2double(varargin{3});
x1 = str2double(varargin{4});
x2 = str2double(varargin{5});
x3 = str2double(varargin{6});
x4 = str2double(varargin{7});
x5 = str2double(varargin{8});
x6 = str2double(vararg... |
% Convert derivatives of roll, pitch, yaw to omega.
function thetadot = omega2thetadot(omega, angles)
phi = angles(1);
theta = angles(2);
%psi = angles(3);
W = [
1, 0, -sin(theta)
0, cos(phi), cos(theta)*sin(phi)
0, -sin(phi), cos(theta)*cos(phi)
];
thetadot = inv(W) * om... |
function [dist] = emdDist(vWeightDist1, vWeightDist2, vWeightDistValues)
%
% Computes the EMD distance between the two weight distributions.
%
% If using this code, please kindly cite the following paper:
% J. Chan, X. Nguyen, W. Liu, C. Leckie, J. Bailey, K. Ramamohanarao and J. Pei.
% "Structure-aware Distance Measu... |
% Learn a Naive Bayes classifier on the digit dataset, evaluate its
% performance on training and test sets, then visualize the mean and variance
% for each class.
load mnist_train;
load mnist_test;
% Add your code here (it should be less than 10 lines)
|
% one round of Gibbs sampling in Gibbs iPM3F
%
% Written by Minjie Xu (chokkyvista06@gmail.com)
function [Z,V,theta,invlambda,zcidx,newK,etime,fval] = mcmc(Z, V, theta, invlambda, alphav, sigmav, T, Su, Sv, C, ell, rho, varsigma, ijn, poisstrunc, algtype, loopi, wors)
[N,K] = size(Z);
[M,tK] = size(V);
if K ~= tK
... |
function childrens = cross( parent1, parent2 )
%CROSS Summary of this function goes here
% Detailed explanation goes here
% Get crossover point
child1 = zeros(size(parent1));
child2 = zeros(size(parent2));
point = randi([2, length(parent1) - 1]);
% Preserve first point genes
ch... |
%SAVENAME=strcat('initial',SAVENAME)
if SAVE_DATA_FILE==1
save(SAVENAME,'alphas_ejected','alphas_momentum','time_scale','vpll_output','Xpos_gc_output','Zpos_gc_output','phipos_output','alphas_pos_x','alphas_pos_z','alphas_pos_phi',...
'v_X','v_Z','v_phi','alphas_vpll','alphas_mm','alphas_psi','alphas_Ekin','alphas... |
% Nesterov accelerated gradient(NAG)
x_tmp=x_old-gamma*v0(1); y_tmp=y_old-gamma*v0(2);
v0(1)=gamma*v0(1)+learning_rate*Jx(x_tmp,y_tmp);
v0(2)=gamma*v0(2)+learning_rate*Jy(x_tmp,y_tmp);
x_new=x_old-v0(1);
y_new=y_old-v0(2); |
% aaa = load('alpha_coeff_h1.mat');
% aaa=cell2mat(struct2cell(aaa));
%
% bbb = load('alpha_coeff_h1_lambda_500.mat');
% bbb=cell2mat(struct2cell(bbb));
%
% [a1,a2] = recover_angular(aaa)
% [b1,b2] = recover_angular(bbb)
PathRoot='part_data/';
files_list=dir(fullfile(PathRoot));
files_num = size(files_lis... |
function [ labels ] = classify_knn( model, sprt_test, varargin )
labels = knnclass(sprt_test.X,model);
end |
function [ afValues, afTimes ] = GetOccupancyFromALookUpTable( tSignal )
% starting from the current data a randomic pattern for the Occupancy
% for the next requested hours
%
afValues = [];
afTimes = [];
MAX_VALUE_FOR_THE_OCCUPANCY = 6;
LUNCHTIME_VALUE_FOR_THE_OCCUPANCY = 1;
%
try %
%
iNum... |
function [kRCP kRCPC]=k_Reconfirmation_propertyQ(clv,x,K,str,tol)
% k_RECONFIRMATION_PROPERTYQ checks whether an imputation x satisfies the RCP.
%
%
% Usage: [kRCP kRCPC]=clv.k_Reconfirmation_propertyQ(x,K,str,tol)
%
% Define variables:
% output: Fields
% kRCPQ -- Returns 1 (true) whenever the k-RCP is satisfied,... |
function [Img_raw,Img_raw2] =ImagePreprocess(Img_raw_nonfilter,size ,delta,Optdelta)
G = fspecial('gaussian', size ,delta); % Gaussian filter
Img_raw = imfilter(Img_raw_nonfilter, G, 'conv');
Imgmax = max(max(Img_raw)); % ... |
%% SETUP
clc;
clear;
clf;
close all;
%% Example Usage of Satellite.updateFromTLE()
tle_file = 'ESA_PROBA1.tle';
sat = Satellite('ESA PROBA1');
sat.updateFromTLE(tle_file);
%% Display (Polar Plot)
sat.printInfo();
sat.orbit.plotOrbit(true);
title(sprintf('%s Orbit',sat.name));
|
function [a0,slope,a_interp,delta]=FeT_expansion(Ti)
% calculate Temperature dependance of the lattice parameters ol Alplha Fe
% from the results, published at:
% Basinski, Z. S., Hume-Rothery, W. & Sutton, A. L.
% The Lattice Expansion of Iron.
% Proc. R. Soc. Lond. Ser. Math. Phys. Sci. 229, 459 (1955).
sourc... |
function linearODESSEpotentP2X4pool(T,I)
global k1 k2 k3 k4 k5 k6 kd ku L1 L2 L3 L4 L5 L6 H1 H2 H3 H4 g1 g2 E1 E2 delta epsilon mu A J V n1 n2 n3 v1 v2 v3 r1 r2 r3 w1 w2 w3 s1 s2 s3 rho1 rho2 rho3 Acell p0 err Q;
%#codegen
generatorMatrixpotentP2X4pool();
Nt=length(T);
for i=1:Nt
p0=p0*expm(Q*T(i));
err=e... |
%对一个复合函数y做傅立叶变换和逆变换
Fs = 128; % 采样频率
T = 1/Fs; % 采样间隔
L = 256; % 采样个数
t = (0:L-1)*T; % 采样时间
y=5 + 7*cos(2*pi*15*t - 30*pi/180) + 3*cos(2*pi*40*t - 90*pi/180);
N = 2^nextpow2(L); %采样点数,采样点数越大,分辨的频率越精确,N>=L,超出的部分信号补为0
Y = fft(y,N)/N*2; %除以N乘以2才是真实幅值,N越大,幅值精度越高
%Y是一组复数,复数的角度代表该频率分量的相位偏移、复数的幅值表示该频率分量的幅值
f = Fs/N*(0:1:N-... |
load('TFOE052813all.mat')
RvGeneIDs = geneIDs(9063:13061);
RvTFoeData = tfoeData(9063:13061,:);
save RvTFOE05283data RvGeneIDs RvTFoeData sampleIDs
initCobraToolbox
BIGtf_05_2013_Rv2621 = BIGtf_05_2013;
BIGtf_05_2013_Rv2621(x) = {'Rv2621'};
save mtbPROMmodelInputs BIGtf_05_2013_Rv2621 -append
MetGens = in... |
function [ image3D ] = loadRaw( fileName, nx, ny, nz, format)
%loadRaw load 3-D binary matrix into matlab with specified format
% Input Arguments
% - fileName : a string, file name with '.raw'
% - nx : an integer, number of pixel in x-direction
% - ny : an integer, number of pixel in y-... |
clear;
clc;
format compact;
close all;
ilevel = 0.005;
rin = 40000;
dgain = 5.5;
iref = 0.03;
vplus = 10;
vneg = -10;
vplusCurrent = 0;
rload = 200;
beta = 100;
vt = 0.026;
vbe = 0.7;
% Calculate Differential Amplifier Values
for ic = 0.00001:0.000001:1
ib = ic / beta;
rpi = vt / ib;
io = 2 * ic;
... |
function H = setup_Pplot(P,Pcorr,Ccorr,rg,N,Wmg,Wgm,time_axis,N_t)
H = cell(1,4);
figure(N); clf; set(gcf,'DoubleBuffer','on');
subplot(2,2,1);
H{1} = imagesc(P); colormap(jet);
xlabel('stimulus'); ylabel('MC'); title('P'); axis square;
subplot(2,2,2);
H{2} = imagesc(Ccorr); colorm... |
function [loglikelihood]=proposal(optimizedParameters,RJMCMCType,modelProblem,shouldDisplay,algorithm,valArray,N,K,K1,proposalType,centeringLocation,centeringLocationOnBoundary,eigenVectorMatrix,eigenValueMatrix,gradientVector,HessianMatrix,numberOfVariables,priorRange,modelUpdateWeight,modelWeightWithinModel,modelNumT... |
function GD = GD_Function(PF, truePF)
q = 2; %the parameter of GD
%STEP 1. Obtain the maximum and minimum values of the Pareto front
m1 = size(PF, 1);
m = size(truePF, 1);
maxVals = max(truePF);
minVals = min(truePF);
%STEP 2. Get the normalized front
normalizedPF = (PF - repmat(minVals, m1, 1)) ./ repmat(maxVals - m... |
% SolenoidAxAy.m
% Purpose:
% 1) Use ideal solenoid to test the functions of TPSA.
% 2) Show you the usage of TPSA package.
%-------------------------------------------------------------------------------
% Author:
% Chang, Ho-Ping (also known as Peace Chang)
% National Synchrotron Radiation Research Center
% 101 H... |
clc
clear all
main;
figure( 'Name', 'Rate-Distortion Performance' );
title( 'Rate-Distortion Performance' );
xlabel( 'bit/pixel' );
ylabel( 'PSNR' );
axis( [0 20 10 50] );
image_RGB = double( imread( 'data/images/sail.tif' ) );
[ height width dimension ] = size( image_RGB );
image_YCbCr = ictRGB2YCbCr( image_RGB );... |
%%IFFT in column of matrix
function s=iftx(fs);
s=fftshift(ifft(fftshift(fs)));
|
%%%% process the EEG retinotopic mapping
% quadrant starts in the bottom left, and is rotated by startangles
clear all ; close all ;
% so stimuli are the following:
trigs{1} = {'S 11','S 12','S 13','S 14'} ;
trigs{2} = {'S 21','S 22','S 23','S 24'} ;
trigs{3} = {'S 31','S 32','S 33','S 34'} ;
trigs{4} = {'S 4... |
%%From the dataset convert all the atributes into a binary '0' and '1'.
dataframe = readtable("student-mat.csv")
%Convert school GP - 0; MS = 1
newschool = ConvertGP(dataframe.school)
newschool = array2table(newschool)
dataframe = [dataframe newschool];
%Convert sex Male -0; Female -1
newsex = Convertsex(dataframe.s... |
instrreset
clear
recieved_array = 0;
data_array = 0;
recieved = ' ';
S = serial('COM4','baud',115200) %device
fopen(S);
instrr
fprintf('waiting for "RAWDATA" keyword')
count =0;
f = waitbar(0,'Please press sample button');
while(1)
count = count + 1;
if(isvalid(S) && S.BytesAvailable) %Recieve only if availab... |
function [optPerct,stepReward,regret] = thompsonSamplingnew(nA,T,sigma,a,b)
if(nargin<1) % number of arms
nA = 10;
end
if(nargin<2) % time period
T = 2000;
end
if(nargin<3) % standard deviation of distribution each arm
sigma = 1.0;
end
if(nargin<4) % interval of the mean of each arms
a=0;b=1;
end
% in... |
%% D2DDConv UDF
% Purpose: Converts angles to values between 0 and 1024
% Inputs:position- NxN matrix in degrees
% Outputs:digposition NxN matrix in 16bit form 0-1024
function [digposition] = D2DDConv(position)
if length(position) == 1
digposition = [];
end
if length(position) == 5
digposition = [0 0 0 0 0 ];
... |
function v = myCordicRotate0(theta, u, niters)
% Circular and Rotation mode
x = real(u); y = imag(u);
for iter=0:niters-1
angle = atan(2^(-iter));
if (theta > 0)
new_x = x - y*(2^(-iter));
new_y = y + x*(2^(-iter));
theta = theta - angle;
else
... |
function [EqD,Eq] = Observer(T,q,qdDD)
% Observer Hyperparameters
ld = 250;
% Static Variables
persistent Eq_prev EqD_prev w_prev wD_prev
n = length(q);
if isempty(Eq_prev)
Eq_prev = zeros(n,1);
end
if isempty(EqD_prev)
EqD_prev = zeros(n,1);
end
if isempty(w_prev)
w_prev = zeros(n,1);
end... |
% Simple Hill Climbing
% for the Rosenbrock function
% By Kyriakos Tsourapas
% You may contact me through the Mathworks site
% University of Essex 2002
% The string used was divided as follows:
% 1 bit for the sign
% 2 bits for the integer part
% 10 bits for the decimal part
% 1 bit for the sign of the 2nd variable
% ... |
function [ basis_weights ] = find_discrete_basis_weights( num_basis, s, func_target, plot_bool )
% Function accepts a target function to be approximated by a sum of
% basis functions
% returns a vector of basis weights
f_target = func_target;
n = num_basis;
%res = size(s,2);
%X = z... |
clear
% get the bounds
[ x0 lower upper] = manhattan_optimization_bounds();
% precompute payoffs
evaluate_manhattan_dp(x0, 1);
% set up the problem
Problem.f = @(x) evaluate_manhattan_dp([1 exp(x')]);
x0 = log(x0(2:length(x0)));
lower = log(lower(2:length(lower)));
upper = log(upper(2:length(upper)));
opts.maxevals ... |
%% Prepare the models
% Load the model
load('../finalNodulatedPlant.mat');
model = finalNodulatedPlant;
% Make a nodule-free model
model2 = changeRxnBounds(model, 'Root_TEC_AMMONIUM', 1000000, 'u');
model2 = changeObjective(model2, 'PlantBiomass');
model2 = addExchangeRxn(model2, {'BiomassPlant[c]'}, 0, 1000000);
nod... |
function tidyfonts(sz)
if nargin<1
sz=16;
end
hf = gcf;
%set(hf,'fontsize',13);
ha = get(hf,'children');
for i=1:length(ha)
hp = get(ha(i),'children');
hx = get(ha(i),'xlabel');
hy = get(ha(i),'ylabel');
hz = get(ha(i),'zlabel');
ht = get(ha(i),'title');
set(... |
function [K,tempo] = saveIterations(theta,thetaP,J,bestResponse,tempo,arquivo,diretorio)
X=150;
Y=60;
nome = arquivo(1:end-5);
FONTSIZE = 18;
legendS = {'K','Ti','Td'};
legendP = {'K','Ki','Kd'};
iterations = figure('Color',[1 1 1],'name',arquivo,'NumberTitle','off','visible','on');
K = 0:1:length(J)-1;
if length... |
function AutoTops_TransformAndRollOut(inimg,outdir,modality,manual_lbl)
% Segments and unfolds a 3D hippocampal image that has already been resampled to cropped coronal oblique.
%
% Inputs:
% inimg: input single .nii.gz file. Must be in space-MNI152.
% outdir: output directory.
% modality: ['HCP1200-T2', 'HCP1200-T1'... |
% TNM034 - ADVANCED IMAGE PROCESSING
% Isabell Jansson isaja187
% Ronja Grosz rongr946
% Christoffer Engelbrektsson chren574
% Jens Jakobsson jenja698
% 2015-12-11
%------------------------------------
function id = LPQmatch(im)
% MATCH
% Match image with the database ... |
function [redraw, rekey, undoable] = EvalOverlap
% [redraw, rekey, undoable] = EvalOverlap
%
% INPUTS
%
% OUTPUTS
%
% NONE
% TO USE WITH MCLUST, put this in the MClust/ClusterOptions folder
%
% ADR 2008
%
% Status: PROMOTED (Release version)
% See documentation for copyright (owned by original authors) and warranties... |
function p = computeProb(X, mu, sigma2)
p = 1;
for i = 1 : length(X)
p = p * (2*pi)^(-0.5) * exp(-(p(i) - mu(i))^2 / (2*sigma2));
end
end
|
function plotDistortion(obj, full_angle, varargin)
% INPUT
% obj: OpticalSystem object
% full_angle: full field angle
% OPTIONAL INPUT
% lambda: 1-D vector, wavelength
d_line = util.get_fraunhofer_line('d');
lambda = d_line;
if length(varargin) >= 1
lambda = varargin{1};
OpticalSystem.check1D... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Autor: Prof. Alexandre Zaghetto %
% E-mail: zaghetto@image.unb.br %
% Disciplina: Sinais e Sistemas %
% Departamento: Ciência da Computação %
% Universiade de Brasília %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
%%%%%%%... |
function SANS = harvestSANSPanelResult(SANS, filename_gam, filename_sig, nelem_a, ...
panel_a, panel_w, param)
%% gamma
SANS.gamma = importSANSPanelGam(filename_gam,4,3+2*nelem_a);
error_L2 = norm(SANS.gamma(2:2:end-2) - SANS.gamma(3:2:end-1));
if error_L2 < 10*eps
SANS.gamma = [SANS.gamma(1:2:end-1); SANS.ga... |
function errs = Brown_Conrady_Opt( a, realPoints, imPoints, scalar )
%BROWN_CONRADY_OPT Radial and tangential distortion optimization
% a(1:7) = a1...a5, xp, yp
% output is a metric of "how" grid like it is for each item in the points
% cell arrays.
% If scalar is true (default false), the mean of all errs is t... |
function [PLV] = get_nestedness(signal, highcomp, fs)
% CALCULATE NESTEDNESS
% input: signal = signal from one channel
% highcomp = frequency band for higher components: [3 8] [8-15] [15-30]
% fs = sampling frequency
% output: PLV = nestedness: PLV value between the low co... |
function [x,fval,exitflag,output,grad]=fminlbfgs(funfcn,x_init,optim)
%FMINLBFGS finds a local minimum of a function of several variables.
% This optimizer is developed for image registration methods with large
% amounts of unknown variables.
%
% Optimization methods supported:
% - Quasi Newton Broyden–Flet... |
function advancingAngleOfThroats = throatAdvancingAngle (minthroatAdvancingAngle ,...
maxthroatAdvancingAngle , delta , etha)
%%
% Thsi function detremines throat advancing angle by the use of distribution
% function called Weibull
%%
global n_t
x = rand(n_t,1);
advancingAngleOfThroats = weibull(deg2rad... |
function isFace = isFace( img )
% Decides if a given image is a human face
% INPUT:
% img - a grayscale image, size 120 x 100
% OUTPUT:
% isFace - should be true if the image is a human face, false if not.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ... |
function mask_stats=compute_stats_from_axonlist(axonlist,PixelSize,img)
mask_stats.axon_diam_mean=mean(cat(1,axonlist.axonEquivDiameter));
mask_stats.axon_diam_median=median(cat(1,axonlist.axonEquivDiameter));
mask_stats.axon_diam_std=std(cat(1,axonlist.axonEquivDiameter));
mask_stats.myelin_diam_mean=mean(cat(1,axon... |
%% startup
clear all; close all; clc;
%run('my_prefs');
path0=cd;
data_dir = '/Users/jonasfunke/Documents/';
scrsz = get(0,'ScreenSize'); % screen size
addpath('/Users/jonasfunke/Documents/MATLAB_old/TOOLBOX_GENERAL')
addpath('/Users/jonasfunke/Documents/MATLAB_old/TOOLBOX_MOVIE')
addpath('/Users/jonasfunke/Documen... |
function trial_data = getNormEMG(trial_data,params)
%
%
emgNorm = normalize(trial_data.emg,'range');
trial_data.emgNorm = emgNorm;
end |
clc;
clear;
close all;
M8=csvread('MInitialTotalMatrixTrunc8ACD.csv');
[U,S,V]=svd(M8);
SD=diag(S);
SF8=SD/sum(SD);
figure(8)
plot(SF8,'LineWidth',2)
set(gca,'fontsize',14)
M7=csvread('MInitialTotalMatrixTrunc4FEV.csv');
[U,S,V]=svd(M7);
SD=diag(S);
SF7=SD/sum(SD);
figure(7)
plot(SF7,'LineWidth',2)
set(gca,'fontsize... |
% Figure 3.1 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%script to generate Fig. 3.1
%% fig3_01.m Example 3.4
% Frequency response
clf;
k=1;
num=1; % form numerator
den=[1 k]; % form denominator
sys=tf(num,den); ... |
bg = find(abs(omega)<1e-2);
fg = setdiff(1:r, bg);
omega_fg = omega(fg); % foreground
Phi_fg = Phi(:,fg); % DMD foreground modes
omega_bg = omega(bg); % background
Phi_bg = Phi(:,bg); % DMD background mode |
%% Perceptron 1: Regresion Logistica
clear all
close all
clc
%% Cargar Datos
load LogReg2.txt;
data = LogReg2;
G0 = data(data(:,3)==0,1:2)% Grupo cero
G1 = data(data(:,3)==1,1:2)% Grupo uno
%% Grafica de los Datos
% figure(1)
% plot(G0(:,1),G0(:,2),'bo',G1(:,1),G1(:,2),'rx')
% title('Datos')
%% Regresion Logistica
X = ... |
function fig_comparePCs(imitations,nimitation,stimulus_imitation,soundOn, par)
% visualize the stimulus and query spectrograms with the estimated
% pitch curves overlayed
%
% INPUT
% imitations - structure containing the audio from the imitations of one
% participant
% nimitation - imitation number
% st... |
%Operating platform
%Recorded for 2 seconds
recObj = audiorecorder(8000,8,1);
disp('Start speaking.')
recordblocking(recObj, 2);
disp('End of Recording.');
% Playback of recorded data
play(recObj);
% Get the recording data
myRecording = getaudiodata(recObj);
% Draw the recording data waveform
plot(myRecording);
% Sav... |
function imP = CS4640_power_spectrum(im,centered)
% CS4640_power_spectrum - power spectrum of FT of image
% On input:
% im (MxN double array): input image
% centered (Boolean): if 1 centered, else not
% On output:
% imP (MxN double array): power spectrum
% Call:
% imP = CS4640_power_spectrum(im,1);
... |
%% showMaximumPlaneRadius
%Shows maximum Plane radius of the robot
function maximumReachAndVolume = getMaximumReachAndVolume(robot)
maximumReachAndVolume = zeros(3, 1); %3 rows in order: XYRadius, XZRadius, Volume
XYPointCloud = robot.getPlanePointCloud('XY');
XZPointCloud = robot.getPlanePointCloud('X... |
function closeSaveState(obj)
% Put the interim save matrix into the big one
if ~isempty(obj.tdx2)
obj.stateSaveFull(:,obj.tdxSmall(1:(obj.tdx2-1))) = obj.stateSaveSmall(:,1:(obj.tdx2-1));
obj.covSaveFull(:,obj.tdxSmall(1:(obj.tdx2-1))) = obj.covSaveSmall(:,1:(obj.tdx2-1));
obj.epochsFull(obj.tdxSmall(... |
function vw=toon_initRM(prfModel, ROIs,cothresh, dt, scan)
% function toon_initRM(pRFmodel, ROIs, dt, scan)
% Initializes an hiddenGray view and loads pRF model and ROIs if available
%
% Inputs
% pRFmodel : name of pRF model to load
% cothresh : variance explained threshold for retiniotopic model;
% d... |
% %%%%%%%%%%%%%%%% CONFIGURATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%opencl_include_dir = '/usr/include';
%opencl_lib_dir = '/usr/lib';
opencl_include_dir = 'C:\Program Files (x86)\AMD APP SDK\3.0\include';
opencl_lib_dir = 'C:\Program Files (x86)\AMD APP SDK\3.0\lib\x86_64';
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
...done
function [ MGD ] = modified_group_delay( windows,STFT,NFFT )
rho=0.7;
gamma=0.2;
frame_num = size(windows, 1);
frame_length = size(windows, 2);
delay_vector = 1:1:frame_length;
delay_matrix = repmat(delay_vector, frame_num, 1);
delay_frames = windows .* delay_matrix;
x_... |
function [omega_axis_new_units]=calc_omega_in_units(object,units)
omega_rad_fs=object;
switch units
case 'rad/fs'
omega_axis_new_units=omega_rad_fs;
case 'meV'
% calculate hbar over e
hbar_e=1.0545718e-34/1.60217662e-19;
omega_axis_new_units=1000*hbar_e*omega_rad_fs*1e15;
cas... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
clear all;
%disp('************ Problem 5.2(d) Naive Bayes Start*******************')
%disp('Problem 5.2(d)')
[train_data, train_label] = preprocessing_ttt('hw1ttt_train.data');
[valid_data, valid_label] = preprocessing_ttt('hw1ttt_valid.data');
[test_data, test_label] = preprocessing_ttt('hw1ttt_test.data');
[test_acc... |
function [stor,ind] = build_stor_structure_(obj,CutID)
% build structure to store sequence of cuts corresponding to given energy
%
binding = obj.equal_cuts_map(CutID);
ind = [binding{:}];
cuts_fitpar = select_fitpar(obj.fitpar,ind);
stor = EnCutBlock(obj.cuts_list(ind),obj.fits_list(ind),cuts_fitpar);
file_list = ... |
classdef (Hidden, Sealed) CoarseSetAffinityEnergy < amg.api.HasOptions
%COARSESET A coarse aggregate set of a fine-level graph that combines
%the affinity and energy ratio approaches.
% This abstract class is the main data structure used during
% aggregation stages. It is the same as CoarseSetAffini... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.