text stringlengths 8 6.12M |
|---|
function bestNet = ParteA_trainingOnline( vettoreStrati, vettoreFunzioni,pesi,funErr,trainingSet,validationSet,nEpoche,eta,soglia)
%Creazione di una rete neurale
net = createNetwork(vettoreStrati, vettoreFunzioni,pesi);
%Array degli errori per training set e validation set
errT = zeros(1,nEpoche);
... |
% The MATLAB implementation of the optimally safe solvers
% Author : Jonathan EDEN
% Created : 2016
% Description : MATLAB implementation of optimally safe solvers
function [ x_opt, exit_type] = id_os_matlab(A_eq, b_eq, xmin, xmax,alpha,options)
% Find the optimally safe cable tension by solving a li... |
function [inputs,rules]=makeRBN(N,K,p)
% makes an N-K RBN (i.e., assumes K is constant for each of N nodes)
% function [inputs,rules]=makeRBN(N,K,p);
%
% INPUT PARAMETERS
% N: number of nodes
% K: average indegree
% p: probability of 1's in the rules
%
% OUTPUT PARAMETERS:
% inputs: cell aray with N elements... |
% 2.16 horizontal stabilizer simple测试
clearvars
clear global
clc
h = 10;
[~,~,~,rho] = atmosisa(h);
% 直升机
DoubleRotorHelicopter = Helicopter();
DoubleRotorHelicopter.GW = 5500;
DoubleRotorHelicopter.GWF = 5500*9.81;
% 平尾
HorStab = HorizontalStabilizerSimple();
HorStab.a_0 = 3.5;
HorStab.delta = 0.00... |
%% Stereo pair from TL
chdir(fullfile(wltalksRootPath,'FVM'));
%%
ieInit;
%% I chose the crop to center on the pawn
load('rtbBinocular_DOF/rtbBinocular_DOF_Left','oi');
oiLeft = oi;
oiLeft = oiSet(oiLeft,'illuminance',oiCalculateIlluminance(oiLeft));
oiLeft = oiSet(oiLeft,'mean illuminance',10);
ieAddObject(oiLeft... |
%{
pupil.EpochTrial (computed) # trials included in each trace
-> pupil.EpochTrialSet
-> reso.Trial
-----
radius : float # (um) average radius during the trial
delta : float # (um) change in radius during trial
saccade_speed = null : float # (um/s) average saccade speed during trial
%}
classdef EpochTrial < dj... |
function [SNR] = SNR_Calculator(DATA,batchsize)
%UNTITLED2 ¼ÆËã image µÄSNR£¬ mean(S)/std(N)
% batchsize = 20;
I = sos(ifft2c(DATA));
length_1 = size(DATA,1)-batchsize-1;
length_2 = size(DATA,2)-batchsize-1;
N_1 = imcrop(I,[1 1 batchsize batchsize]);
N_2 = imcrop(I,[1 length_2 batchsize batchsize]);
N_3 = imcrop(I,[len... |
function [merged_plane_labels, plane_eq] = plane_fitting(RGB, depth)
dz = depth/1e3;
fx_rgb = 5.1885790117450188e+02; % RGB Intrinsic Parameters (NYU camera parameter)
fy_rgb = 5.1946961112127485e+02;
cx_rgb = 3.25... |
function R = calc_world_file(pixelCoords, refPoints)
M = [pixelCoords ones(length(pixelCoords), 1)];
M
refPoints(:,1)
A1 = linsolve(M, refPoints(:,1));
A2 = linsolve(M, refPoints(:,2));
R = [A1, A2];
R
end |
% compute the generalized dependency with S-T fuzzy rough sets
% Some mistakes are revised by Hong Zhao in 2015-12-15
% 异类样本离的最近的起到的作用非常大。如果有噪声,这种方法并不一定好。
% 2016-4-20考虑树结构。
% tree是树结构,第一列是父结点的编号,第二列是所在层的编号
function r=dependency_s_gs_treeok(data_array,delta,k,tree)
treeParent=tree(:,1)';
% treeLevel=tree(:,2)';
clear tr... |
function imOut = enhance_sigmoidFilter(im, gain, cutoff)
im = im / max(im(:));
im = im*255;
if nargin == 1
gain = 0.2; cutoff = 0.025;
end
% Apply Sigmoid function
if length(size(im)) == 2
imOut = 1./(1 + exp(gain*(cutoff-im)));
maxValue = max(imOut(:));
... |
function colorbar_log10(Ticks)
cb=colorbar;
if nargin>0
set(cb,'Ticks',log10(Ticks));
end
T=get(cb,'Ticks');
for it=1:length(T);TL{it}=sprintf('%3.1f',10.^T(it));end
set(cb,'TickLabels',TL)
|
function [CFG, DATA] = RTM(CFG, DATA, test_idx)
[DATA] = RT_Core(CFG, DATA, test_idx); |
function [T,R]=TR(scene_path)
% Diese Funktion berechnet die moeglichen Werte fuer T und R
% aus der Essentiellen Matrix
% Bilder laden
[I,~] = input_data(scene_path)
%Image1 = imread('im0.png');
IGray1 = rgb_to_gray(I{1});
%Image2 =imread('im1.png');
IGray2 = rgb_to_gray(I{2});
... |
function [ L ] = graph_laplacian( A )
%graph_laplacian Comput scaled sign positive graph laplacian
% compute the scaled sign positive graph laplacian of each graph (call it
% L_i). one obtains this by filling in the diagonal of each adjacency
% matrix by the degree of that vertex, divided by n-1 (this is the
% ... |
function [ table, flds ] = toTable( obj, start_pos, end_pos)
%TOTABLE 每个node写一行,逐行写
% 矩阵输出时间序列,存在TEBase.data, TEBase.headers里
% 原TradeList和EntrustList中单独的域和方法统一到这个
% 可供输出excel用。Ticks,Bars,TradeList里也有同样的函数
% headers的优先级:入参里 > obj.headers > default_headers(主要域都含)
% =====================================================... |
function eegspectr(o,chidx,TT,FF,TTs,fprefix)
%eegspectr(o,chidx,TT,FF,TTs,fmode,foffset,dirname)
% Produce and display spectrograms and overall spectra for an EEG
% experiment data in 'o'. Produces the spectrograms and the spectra
% for all eeg channels listed in index list 'chidx'. 'TT' specifies
% the length of the ... |
% a. Tim DUXDV cua bo loc trung binh truot M diem
% b. Sinh tin hieu sin s[n] lan voi nhieu trang w[n] theo x = s + w
% c. Loc tin hieu x (thu duoc y) va tim M de RMSE(s,y) la nho nhat
clc; clf;
% cau a
M = 9; % bac cua bo loc
N = 200; % do dai cua tin hieu
b = 1/M*ones(1,M); % vecto he so b = [... |
function [RSNR] = getRSNR(original,recovery)
%GETRSNR Calculate reconstruction SNR
RSNR=20*log10(norm(original)/norm(original-recovery));
end
|
function [B] = B_matrix(dNdx,dNdy,dNdz)
% Preparing B matrix [6x24]
B=zeros(6,24);
for i=1:8
% Finding Bi at each node, there are 8 of it
Bi=[dNdx(i) 0 0;
0 dNdy(i) 0;
0 0 dNdz(i);
dNdy(i) dNdx(i) 0;
0 dNdz(i) dNdy(i);
... |
function LifeTimes = findStateLifeTimes (Gamma,T,threshold,is_vpath)
% find the state life times for the state time courses of one state
% Gamma needs to be (time by 1), and the sum of T be equal to size(Gamma,1)
% is_vpath (optional) indicates whether Gamma is viterbi path or a
% probabilistic assignment
if nargin<3,... |
function comp_gauss_coverage( field_type, field_params, mask2D, nsubj_vec, ...
FWHM_vec, do_gauss, saveloc, niters, resadd )
% comp_gauss_coverage computes and saves the coverage on a given mask for
% the original and Gaussianized datasets.
%------------------------------------------------------... |
n = 13;
f = @(x)(1./(1 + 25*x.^2));
xq = linspace(-1, 1, 1000);
y_true = f(xq);
plot(xq, y_true);
hold on
x = linspace(-1,1,n);
y = f(x);
yq = PolyInterp(x,y,xq);
plot(xq, yq);
yq = ChebyshevInterp(f, n, -1, 1, xq);
plot(xq, yq);
hold off
h = legend('$f(x)=\frac{1}{1+25x^2}$','equidistance interpolation','Chebys... |
%-------------------------------------------------------------------------%
% nlink_DAE - Jeremy Turner
%
% Right-hand side function called by ode45 in npend.m to simulate system
% using the symbolically-derived ODEs using the DAE method. Includes
% shaking end.
%
% Input: z - State vector 2nx1 (theta1; ...; thetan; o... |
function state = testU(u,x)
% testU(u,x)
global plotState;
global dT;
u = reshape(u,[2,numel(u)/2]);
A = [ 1 0 dT 0;
0 1 0 dT;
0 0 1 0;
0 0 0 1];
Gd = [dT^2/2 0;
0 dT^2/2;
dT 0;
0 dT];
state = x;
for i = 2:size(u,2)+1
state(:,i) = A*state(:,i-1) + Gd*u(:,i-1);
end
... |
function [] = plot_triangle(p1, p2, p3, clr)
hold on, line([p1(1), p2(1), p3(1), p1(1)]', [p1(2), p2(2), p3(2), p1(2)]', [p1(3), p2(3), p3(3), p1(3)]', 'Color', clr);
end |
%CONVERTTO Converts an array to another data type with optional scaling
%
% dst = cv.convertTo(src)
% dst = cv.convertTo(src, 'OptionName', optionValue, ...)
%
% ## Input
% * __src__ Input matrix.
%
% ## Output
% * __dst__ Output image of the same size as `src`, and the specified type.
%
% ## Options
% * __RType... |
function [mdl_summary, mdl_features, y_test, y_predict]=cpm_cv(x,y,pthresh,kfolds)
% call from predict_behavior
% can provide previously defined models (mdl1,mdl2) as input
% can convert binarized to weighted--see 3 chunks below
% TODO: catch kfold outside
% TODO: save features
% splitting data
nsubs=size(x,2);
nfeat... |
% generate a random number of events for the stimulus on the current trial
% given strength_prop, which corresponds to the proportion of
% hard, medium-hard, medium-easy, and easy trials, respectively.
vis_strength_prop = value(VisStrengthPropHME);
%%
% min and max number of events for the given stimulus dura... |
function raPsd2d(img,res)
%% function raPsd2d(img,res)
%%
%% Computes and plots radially averaged power spectral density (power
%% spectrum) of image IMG with spatial resolution RES.
%%
%% (C) E. Ruzanski, RCG, 2009
%% Process image size information
%%
%% https://www.mathworks.com/matlabcentral/fileexchange/23636-radia... |
function count = CountFromPCAResult()
TPSTV = 0; FPSTV = 0; FNGTV = 0;
BasePath = 'EasySeg';
fnames = dir([BasePath '\ResultFrmPCAPatch\*.jpg']);
numfids = length(fnames); PtchSzM = 32; PtchSzN = 32;
for K = 1:numfids
AbsFNme = [BasePath '\ResultFrmPCAPatch\' fnames(... |
function multiMatPlot(input)
global GLB_INVP;
cutoff = 0.3;
scale_factor = 1;
% Define colors
red = [1 0 0];
green = [0 1 0];
colors = [red; green];
% Plot data
figure;
axis off; hold on;
set(gca,'dataAspectRatio', [1 1 1]);
zlim([scale_factor*cutoff scale_factor]);
az = 0;
el = 90;
view(az,el);
light;
for index = 1... |
function accur = SVMTest(X,y,option,P,K,C,kernelFunction,sigma)
%使用完整的数据集X-y,option=0表示选择一般的精确度标准,option=1表示斜偏类的精确度标准
%p,k表示option=0时p次k折交叉验证
%C,kernelFunction,sigma是SVM中特有的参数和核函数
kinds=unique(y);
kindNum=numel(kinds);
len=size(X,1); %样本数
t=fix(len/K); %平分的每组样本数
valsVec=zeros(t,kindNum);
accur_total=zeros... |
function [sig_long, sig_short,sig_rs] = Pvt(bar, nBar, type)
% Price Volume Trend 价量趋势指标
%
% PVT指标计算公式[1]
% 如果设x=(今日收盘价—昨日收盘价)/昨日收盘价×当日成交量,
% 那么当日PVT指标值则为从第一个交易日起每日X值的累加。
%% 预处理
ClosePrice = bar.close;
Volume = bar.volume;
if ~exist('nBar', 'var'), nBar = 5; end
if ~exist('type', 'var') || isempty(type), type = 1; en... |
function record = pso(num,ger,limit)
% 函数功能:实现粒子群算法,寻优
% 输入:
% num:种群数量
% ger:迭代次数
% limit:设置位置参数限制
% 输出:
% record:每代最优适应度值
d = size(limit,1);
vlimit = [-1, 1]; % 设置速度限制
w = 0.8; % 惯性权重
c1 = 0.5; % 自我学习因子
c2 = 0.5; ... |
function dataPeep(appName)
% dataPeep
% Takes a peek at the data structure for appName, particularly to get a
% feel for the size of the data
%
% Usage: dataPeep
% dataPeep('MAGLIGHT')
global DATA;
if isempty(DATA)
disp('no data to look at');
return;
end
if (nargin < 1)
appNames = ... |
%You can customize and fix initial directory paths
prompt=('Enter train image directory');
dlg_title='Input for directory';
num_lines= 1;
def = {'Drive:\\directory_location'};
TrainDatabasePath = inputdlg(prompt,dlg_title,num_lines,def);
prompt=('Enter train image directory');
dlg_title='Input for directory';
num_lin... |
% Write GERM partition coefficient database to c header file (to be
% accessed by calling getGERMKd("mineral","element",SiO2)
fp = fopen('GERM.h','w');
fprintf(fp,['double getGERMKd(const char mineral[], const char element[], const double SiO2){\n' ...
'\tint index = (int) round(SiO2) - 40;\n'...
... |
v=0.3
E=70e9
data1=load('Js-Abaqus-at-time-1p000.txt')
figure;
offset=-1
level=12
for i=level%:size(data,1)
plot(fliplr(data1(1,2:end)),sqrt(data1(i,2:end).*(E/(1-v^2))),'--b')
hold on
end
data2=load('Js-at-time-1.0.txt')
for i=level+offset%size(data,1)
plot(data2(1,2:end),sqrt(data2(i,2:end).*(E/(1-v^2... |
function [r] = sh2af(A, B, N, theta, phi)
%SH2AF Преобразование спектра в угловую функцию
% Функция вычисляет угловую функцию по заданному спектру до N-й
% гармоники.
% A - косинусные коэффициенты
% B - синусные коэффициенты
% N - количество коэффициентов разложения
% theta - набор углов... |
function [ track_x, track_y ] = validateTrackedPoints( track_x, track_y)
% removes key points that have left the image boundaries
% obviously, having this n
[nkps, nim] = size(track_x);
kp = 1;
% for kp = 1:nkps
while kp <= nkps
for imn = 1:nim
x = track_x(kp,imn);
y = track_y(kp,imn);
... |
% runs t-sne on word vectors to visualize representation similarity
addpath tsne/;
% Load data
load tmp/curParamCache.mat;
repConMat = reshape(wFull(modelParams.repConIndex()),modelParams.DictSize,[]);
vocabString = textread('data/flickrVocab.txt','%s');
% the first 50 words are not used by the model. trim them
vocabSt... |
%% Cleanup
%MODIFY this code to simplify (when generating data, etc.)
clear all; close all; clc;
%% Describe the setup for the forward models
% Bounds of the domain, and number of points in the discretization (last)
x_disc = [-90 90 90];
y_disc = [-45 45 90];
%Specify boundary types and boundary values (x / y const... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于计算conditional sharpe ratio
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function conditionalSharpeR = conditionalSharpe( R,Rf,VaR)
loc = isnan(R) | isnan(Rf);
R (loc) = [];
Rf(loc) = [];
newTR = R;
newTR( n... |
% Download images for a city from StreetView.
addpath('util');
% City information and general configuration options.
config.homedir = '/home/rachine/VisualPlaceRecognition/urban_release';
config.city_id = 'newyork';
% Boundaries file are coordinates of a polygon surrounding the city.
% You can create one manually usin... |
%1D Drift-diffusion solver, by S.Z. 03, 2015
%
%Run the code for a biased PN junction
%mesh=pn_1d(1.5e16,1.5e16,0.6);
%
%Poisson discretized by FEM, continuity Eqs dicretized by Finite Volume
%
function mesh = pn_1d(dop_n,dop_p,bias)
q=1.602e-19;T=300;
Kb=1.3807*1e-23;
vt=Kb*T/q; ... |
function Object=object(path1,path2,path3,delta1,delta2,delta3,flag) %path,delta是2000维
global TE G ts
q1_1=0;q2_1=0;q3_1=0;
tol1_1=0;tol2_1=0;tol3_1=0;
e1_1=0.1;e2_1=0.1;e3_1=0.1;
Tol=[];
tmax=3*TE; %目标函数积分上限为3TE
q1d=1.0;q2d=1.0;q3d=1;
q1op_1=0;dq1op_1=0;
q2op_1=0;dq2op_1=0;
q3op_1=0;dq3op_1=0;
x1_... |
% Normalize EMC(B0,B1,T1,T2,TE)
% The following operation factors out both the baseline amplitude and baseline phase
% leaving the first elements equal to 1.0, while the subsequent ones remain complex
function sim_mat = normalize_4D_EMC(sim_mat)
for B0_idx = 1:size(sim_mat,1)
for B1_idx = 1:size(sim_mat,2)
for T2_idx... |
function u= image_rescale(u,gmin,gmax)
if nargin<2
gmin = 0.;
end
if nargin<3
gmax = 1.;
end
m = min(u(:));
M = max(u(:));
if M>m
u = (gmax-gmin) * (u-m)/(M-m) + gmin;
end
|
function [Bj] = B_coefficient(m,k,c,w,j,Bjp1)
%B_COEFFICIENT Summary of this function goes here
% Detailed explanation goes here
Bj=(k(j)+c(j)*1i*w)./( -m(j+1)*w.^2+(k(j)+k(j+1))+(c(j)+c(j+1))*1i*w -(k(j+1)+c(j+1)*1i*w).*Bjp1);
end
|
function [ c ] = GenColor( i , varargin)
%generate color code for plot based on input 0-1
if nargin==1
c=[cos(pi*i/2).^2 cos(pi*i/2-pi/4).^2 cos(pi*i/2-pi/2).^2];
elseif nargin==2
num= floor(varargin{1}^(1/3))+1;
i1=round(i*num^3);
ir=mod(i1,num);
ig= mod((i1-ir)/num,num);
ib= (i1-ig*... |
function [J, grad] = cost_grad(theta, X, y, lambda)
m = length(y);
grad = zeros(size(theta, 1), 1);
J = 1/(2*m) * sum((X * theta - y) .^ 2) + lambda/(2*m) * sum(theta(2:end).^2);
grad(1) = 1/m * sum(X * theta - y)';
grad(2:end) = 1/m * sum((X * theta - y) .* X(:,2:end))' + lambda/m * theta(2:end);
end... |
function samp_on= find_sampON(din)
% Thus function finds the time points at which the stimulus came on
samp_on = strfind(din',[0 1]);
end |
function [Y] = uq_eval_ExpDesign(current_model, X)
% Y = UQ_EVAL_EXPDESIGN(CURRENT_MODEL): evaluate the experimental desing as
% specified in the CURRENT_MODEL object
%
% Y = UQ_EVAL_EXPDESIGN(CURRENT_MODEL, X): evaluate the experimental desing as
% specified in the CURRENT_MODEL object on the points specified ... |
%% Third Party Dictator Game Script Ver 0.3
clc % Clear workspace
clear all % Clear variables
%% Configure Cogent
config_display(0, 4, [0 0 0], [1 1 1], 'Helvetica', 38, 28, ... |
w = linspace(-10, 10, 500);
F = (1i * w + 1) .^ (-1);
subplot(2, 1, 1);
plot(w, abs(F));
title('Magnitude');
xlabel('\omega');
ylabel('|F(\omega)|');
subplot(2, 1, 2);
plot(w, angle(F));
title('Argument');
xlabel('\omega');
ylabel('arg F(\omega)');
|
function p = AffinePara4Points( srcPoints, dstPoints )
%AFFINEMATRIX4POINTS 此处显示有关此函数的摘要
% 此处显示详细说明
u = srcPoints(:,1);
v = srcPoints(:,2);
N = size(srcPoints,1);
v0 = zeros(N,1);
v1 = ones(N,1);
A = [u v0 v v0 v1 v0;
v0 u v0 v v0 v1];
% p = (A'*A)\A'*(dstPoints(:) - srcPoints(:));
p = A\(dstPoints(:) - srcPoint... |
imaqreset
clear variables
camara1 = videoinput('gige', 1, 'Mono16');
% camara1 = videoinput('gige', 1, 'Mono8');
src1 = getselectedsource(camara1);
% la cámara vieja sólo funciona en 16 bits, pero no acepta que se lo pongas
% en el comando
camara2 = videoinput('gige', 2);
src2 = getselectedsource(camara2);
... |
function [ PSNR ] = PSNR( f, fp )
[R,C] = size(f);
denominator = 0;
fmax = max(max(f));
molecule = fmax * fmax;
for r = 1:R
for c = 1:C
denominator = denominator + (fp(r,c)- f(r,c))*(fp(r,c)- f(r,c));
end
end
denominator = denominator /(R*C);
PSNR = 10 * log1... |
function [violationFreq] = nonviolation_cooling(pwr_case, pv_cap, irrad_time,...
pct_load, workload_power, dc_cap, ...
t_Range, t_OA, alpha, gamma, temp_power_oac, temp_power_wc, ...
options, dcBus, numBuses, pvBus, verbose)
numLoads = 20;
out_bounds = 0;
tsteps = length(irrad_time);
% ... |
function [Vystup] = Narust_oblast(Vstup_obraz, x, y, reg_max)
% Narust_oblas je funkce/algoritmus pro metodu narůstání oblastí.
% Vstup_obraz ... vstupní obraz, na kterém se provede segmentace
% Vystup ... výstupní obraz neboli segmentovaný obraz metodou narůstní
% oblastí
% Nastavení souřadnic:
... |
classdef optimalControlInstance_Sim < optimalControlInverseKKT & optimalControlDirectFmincon
properties
% ioc/doc properties
windowMethod = 'sliding';
windowAdvance = 20; % window slides
windowGap = 20; % inds between spline points
windowLength = 61;
% win... |
% Given rotation på hela matrisen, inte bara uppdatering av en rad
function [A] = givens_QR(A)
[m,n] = size(A);
for j = 1:n
for i = m:-1:(j+1)
[c, s] = givens(A(i-1,j), A(i,j));
A(i-1:i,j:n) = [c, s; -s, c]'*A(i-1:i, j:n);
end
end
end |
function set_popup(component)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Name of the file : set_popup %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description : setup the popup menus of the initialization%
% files and the position choices ... |
function varargout = mask(corrData, maskData, confPct, replaceWith)
%MASK Masks correlation images with the input probability mask.
% This function masks correlation data using a specified probability mask (e.g. gray matter
% segment mask) and sets all spatial and temporal data outside of the mask equal to zero. It... |
function noFricDisk_eom()
%calculates symbolically equations of motion for a rolling disk
syms phi theta psi phid thetad psid phidd thetadd psidd 'real'
syms R m g 'real'
i=[1,0,0]'; j=[0,1,0]'; k=[0,0,1]';
%unit vectors
et=-sin(phi)*i+cos(phi)*j;
ip=cos(phi)*i+sin(phi)*j;
lambda=cos(theta)*k+sin(theta)*ip;
n=cos(... |
function h = recombine(g)
% This function calculates the decay term of g
% the resulting term h excludes boundaries
global den_dampdt
h = -den_dampdt * g(2:end-1, 2:end-1, 2:end-1);
|
function [hol] = buildshape(shape,definition, noise_level)
%BUILDSHAPE build a pointcloud of shape SHAPE, definition DEFINITION, and
%noise level NOISE_LEVEL
shape = lower(shape);
if nargin > 1
d = -1:definition:1;
else
noise_level = 0;
end
switch shape
case 'l'
%% L
[x1,y1,z1] = meshgrid(d... |
% 读取xml文件
fileName = 'RC103_100.xml';
filePath = 'C:\Users\cfinsbear\Documents\DVRPBTW\DVRPBTW\ALNS_Result\';
try
xDoc = xmlread([filePath, fileName]);
catch
error('Failed to read XML file %s', infilename);
end
routeLen = xDoc.getElementsByTagName('RouteLen');
% 路径长度
% 返回的是一个elementList, 即使只有一个节点,也需要routeLen... |
% ------- user data ------------
wlen = 4096;
hopsize = 1024;
lh = 17; % length of the harmonic median filter
lp = 17; % length of the percussive median filter
p = 2;
w1 = hanning(wlen,'periodic');
w2 = w1;
hlh = floor(lh/2) + 1;
th = 2500;
[DAFX_in,FS] = audioread('filename');
L = length(DAFX_in);
DAFX_in = [zeros(wle... |
function [ H ] = Hamiltonian10( K )
%Hamiltonian Given a K value, returns 8x8 matrix for SiC's electrons
a=4.3596; %Lattice spacing used for V calculations
d=norm([1/4 1/4 1/4]*a);
% Vpc_ssa=8.7138;Vpa_ssc=4.4051;Vss=-12.4197;
% Essa=9.6534;Essc=9.3166;
%
% Ess=-12.4197;
% Exx=3.038;Exy=5.9216;
% Esp=(9.49+9.2)/2;
% ... |
function x = f_alpha1( n, q_d, alpha )
%*****************************************************************************80
%
%% f_alpha() generates a 1/F^ALPHA noise sequence.
%
% Discussion:
%
% Thanks to Miro Stoyanov for pointing out that the second half of
% the data returned by the inverse Fourier transform s... |
function Aligned_Image_Data_Cell = align_image_data_cell_by_central_tumour_slice(Image_Data_Cell, matched_Scan_IDs)
% Align all the slice-wise image data so that the central tumour slice is at the same "slice" position across all scans
num_matched_scans = length(matched_Scan_IDs);
non_empty_ROI_matrix = cellfun(@(x) ... |
function [imageSeqBeforeStd, imageSeqAfterStd, imageSeqBefore, imageSeqAfter, numOfFrames] = loadAndConvertImagesC(workingDirectoryBefore, workingDirectoryAfter)
% ************************************************************************************
% load the tiff images of the two given time frames
% convert them ... |
%% Tracking a point in 2D using the LinearDynamicalSystemDist
%#broken
%% Create 'Ground Truth'
stateSize = 4; % Hidden states are 4D, position and velocity
obsSize = 2; % 2D observations
sysMatrix = [1 0 1 0; 0 1 0 1; 0 0 1 0; 0 0 0 1];
obsMatrix = [1 0 0 0; 0 1 0 0];
sysNoise = MvnDist(zeros(stateSize,1),0.1*eye... |
function [ geom ] = loadProjectionGeometryHelicalCT( p, noTurns, pitch )
% Load helical CT system geometry
% inputs:
% p - configuration parameters
% noTurns - number of hilical turns
% pitch - helical pitch ( couch movement per 360 scan / detector height)
% output:
% geom - geometery p... |
% Choose T
global T;
T = 2;
% Input risk aversion/seeking degree
global alphaplus;
alphaplus = 0.95;
global alphaminus;
alphaminus = 0.95;
% Input distortion degree
global deltaplus;
deltaplus = 0.5;
global deltaminus;
deltaminus = 0.5;
% Input loss aversion degree
global lambda
lambda = 1.5;
%ru... |
function centroids = computeCentroids(X, idx, K)
[m n] = size(X);
centroids = zeros(K, n);
logicalidx = [];
for i = 1:K
logicalidx = [logicalidx, [idx==i]];
end
centroids = X' * logicalidx;
num_points = sum(logicalidx, 1);
num_points = repmat(num_points, n, 1);
centroids = centroids ./ num_points;
centroids = c... |
k = 5:20:500;
n = length(k);
alpha = zeros(1,n);
for i = 1:n
disp(k(i))
tic
[alpha(i)] = test3(50, k(i), 1000, 0.5);
toc
end
figure;
hold on;
plot(k, alpha);
plot(k, linspace(0.5, 0.5, n)); |
function [match,m] = check_label(sys,io)
%CHECK_LABEL Check the consistency input or output labels of a system
switch io
case 'i'
list = sys.u;
case 'o'
list = sys.y;
end
p = regexp(list,'\w*(?=(\w*))', 'match');
if(size(p,1)==length(list))
m = p{1,1}{1,1};
match = 1; k... |
% September 2019 function copied verbatim from
% https://github.com/kbatseli/PNLA_MATLAB_OCTAVE
function M=sparseM(polysys,d,varargin)
dorig=getDorig(polysys);
neq= size(polysys,1);
n=size(polysys{1,2},2);
ncoef=zeros(neq,1); % number of nonzero entries of each polynomial
nshifts=zeros(1,neq); % number of rows ... |
function [varargout] = T1(Data, SweepVals,ParamNames,MainParam,MeasurementName,AX,IsPreview)
% plots T1 data
% Copyright 2017 Yulin Wu, USTC
% mail4ywu@gmail.com/mail4ywu@icloud.com
x = [];
y = [];
z = [];
if isempty(Data) || isempty(Data{1}) || isempty(SweepVals) ||...
(iscell(Dat... |
close all
clear all
clc
%%%%%%%%%%%%%%%
%iniciar
%%%%%%%%%%%%
pobladores=40;
xmin=-1;%%%
xmax=2;%%% espacio busqueda(intervalo)
palabra=14;%%% número de bits
gen=10000;
ypadres=zeros(pobladores,1);
xpadres1=round((2^palabra-1)*rand(pobladores,1)); %obtener los primeros padres
xpadres2=round((2^palabra... |
%
% irpDistanceMapTo3D generates 3D points from a distance map.
%
% Usage:
% Points3D = irpDistanceMapTo3D(DistanceMap);
function Points3D = irpDistanceMapTo3D(DistanceMap)
[yres,xres] = size(DistanceMap);
Points3D = zeros(yres,xres,3);
for x=1:xres
Points3D(:,x,1) = x;
end
for y=1:yres
Points3D(y,:,2) = ... |
clc;
clear all;
close all;
clear classes;
%% variables
x = randn(1000,1);
n = length(x);
if exist('Params') == 0, Params.n = n; end
if isfield(Params, 'L') == 0, Params.L = 2; end
if isfield(Params, 'T') == 0, Params.T ... |
function vol=Vidto3dSurface(name,structel,elem,ITER)
dicomOutFinal;
vol=surface3d(outEcoMatrix);
end
|
%Author: Eduardo Alho
%26/09/2016
%Uses ANTS ResampleImage to resample MRI to 0.33 x 0.33 x 0.33 resolution to fit histology
%path= full path of the folder where MRI to be up or downsampled is
%image= name of the image within the folder
%Uses linear (default) interpolation
% ResampleImage imageDimension inputImage outp... |
% Thumbnail print
clear all;
close all;
tsize = 3;
%% Symmetric
Linac = 'Dustin 21eX 91'; % 'V21EX91'; % 'Varian iX 703'; %
Linac_Short = 'eX91DJJ'; % 'eX91'; % 'iX'; %
Energy = '16 MV'; % '16 MV'; %
Energy_Short = '16x'; % '16x'; %
root = 'W:\\Private\\Physics\\21eX91 Validation - DJJ';
beamtype = '1 - Open ... |
function Y = uq_paul_simple2( X, P )
%UQ_PAUL_SIMPLE is a simple coupling algorithm assuming lossless lines
% P is used for the field strength and is a single value
%
%
eps0=8.85418782e-12; % F/m
mu0=1.2566370614e-6; % H/m
l = 1.25;
c = 1/sqrt(eps0*mu0);
d = 0.001;
h = 0.02;
z_o = 50;
z_l = 1000;
f = 9e8;
%E0 = 1;
swi... |
fineData = load('C:\Tornado2.2\FineData.txt');
% sensorData = fineData(:,1:6);
sensorData = fineData(:,19:24);
plotName = {'x','y','z','tx','ty','tz'};
%% plot fineStage sensor data
figure('Name','Fine Stage Sensor');
for i = 1:6
subplot(2,3,i);
% plot(sensorData(:,i));
plot(sensorData(:,i)-mean(sensorDa... |
%% MyMainScript
tic;
%% Your code here
barbara = load('../data/barbara.mat');
barbara = barbara.imageOrig;
% sigma* = 20 rms = 0.1106
% sigma* = 18 rms = 0.1151
% sigma* = 22 rms = 0.1156
barbara_patch = myPatchBasedFiltering(barbara, 12, 20, 9, 25);
rms = rmsd_bilateral(barbara, barbara_patch);
disp('optimum... |
function [wavelet_features] = extract_wavelet_features(raw_features,num_features)
wavelet_coefficients = zeros(size(raw_features));
for i = 1:size(wavelet_coefficients,1)
wavelet_coefficients(i,:) = wavedec(raw_features(i,:),4,'haar');
end
% Lillifors test
ks_values = zeros(size(wavelet_coefficients,2),1)... |
function []=isoimg3(th,zxr,varargin)
% plot iso 3d image, threshold, zxr ration, and images
% isoimg3(th,zxr,varargin)
tn=nargin-2;
m=ceil(sqrt(tn));
n=ceil(tn/m);
for i=1:m*n
subplot(n,m,i)
v=varargin{i};
pat=patch(isosurface(v,th*max(v(:))),'FaceColor','red','EdgeColor','none');
isonorma... |
%% script to extract response timing data - 8-2-2016
%%
% clear workspace
close all; clear all; clc
%% initialize output and meta dir
% set input output working directories - for David's PC right now
Z_ConstantsStimResponse;
% add path for scripts to work with data tanks
addpath('./scripts')
%addpath('./scripts/Je... |
classdef Multigrid3 < handle
properties (SetAccess = public)
vols = {}
end
methods
function this = Multigrid3( size, bbox, numlevels, fieldnames )
%--- checks dim is a power of two
% assert( rem(log2(size),1)==0 );
%--- checks field names is string or str... |
x = 0 : pi/36 : 5*pi;
y = sin(x);
subplot(2,1,1);
plot(x,y)
grid on;
title('wykres sinusa');
xlabel('os x');
ylabel('os y');
axis([0,16,(-2),2]);
szum = zeros(1,181);
for i = 1 : 1 : 181;
szum(1,i) = rand(1);
end;
subplot(2,1,2);
plot(x,y+szum)
grid on;
xlabel('os x');
ylabel('os y');
title('wykres zaszumionego si... |
function Fig = renderBrain(subjid,surf,hemi)
% renderBrain(FS4subjid,surface,hemisphere)
switch nargin
case 2
hemi = '';
case 1
surf = 'pial';
hemi = '';
case 0
help renderBrain
error('not enough input arguments.')
end
if ~exist('read_surf','file')
error('add freesurfer matlab toolbox to path')
... |
function test_predict ()
X = [0 0;
0 1;
1 0;
1 1];
% all these should pass
assert(predict([1 1]', X), [1 1 1 1]');
assert(predict([0 0]', X), [1 1 1 1]');
% fail ... according to some math...
assert(predict([-1 -1]', X), [1 0 0 0]');
assert(predict([-1 0]', X), [1 1 0 0]');
asser... |
function [frrvsfar,x] = roccurve_ubm(class,vaSet1,vaSet2,vaSet3,vaSet4,vaSet5,vaSet6,vaSet7,vaSet8,vaSet9,vaSet10,oT,mT,cT,oI,mI,cI )
%ROCCURVE Summary of this function goes here
% Detailed explanation goes here
i = 1 ;
frrvsfar = zeros(20,2) ;
threshold = 0 ;
y = zeros(10) ;
x = 0 ;
while threshold <= 20
... |
% training Bubble Existance Classifier using SVM - HAND LABEL - only uses 5
% frames
% GETTING Wa and Ba > for XCORR_Algorithm1_LZhang
% RESULT: Wa and Ba
% Parameters: contrast, size, ncc (TODO: how to obtain?)
% using SVM to train a classifier Ea (x) = Wx + b;
% where Ea >= +1 if not a bubble and Ea <= -1 if is a ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.