text stringlengths 8 6.12M |
|---|
%% Golden Section Search
function [a, b, time, iter] = golden_search(f, a, b, epsilon, max_iter)
% golden ratio tau
tau = (-1 + sqrt(5)) / 2;
% for plot initial point
l_init = a:0.01:b;
plot_index = 1;
% generate N which satisfes the final interval withins epsilon
for i=1:max_iter
% when reach to end... |
clear; set(0,'defaultaxesfontsize',20); format long
%%% p1c.m behaviour of the double well potential with noise
tau=0.01; T=5e4; t=[0:tau:T];% set up integration constants
x0=3; eps=0.08; Sigma=sqrt(2*eps);% set the SDE coefficients
N=length(t); x=zeros(1,N); x(1)=x0; % set initial conditions
sd=0;rng(sd);% choose ran... |
function docNode=addOutputLevel_FEB_v1p2(docNode,FEB_struct)
disp('Adding Output level')
febio_spec = docNode.getDocumentElement;
ElementAddNode = docNode.createElement('Output');
febio_spec.appendChild(ElementAddNode);
OUTPUTNode = docNode.getElementsByTagName('Output').item(0);
%% Adding plotfile field
... |
% This function takes no arguments and runs MD-IDC for a variable number of
% graph sizes. MD-IDC is run until it is successful. At the end of
% computation, a graph is generated for accuracy statistics.
% Important: In order to get the desired results for MW-IDC and MD-IDC you may
% need to change the update bound, t... |
function imghists = create_histograms(centroids,featuretype)
% load the right dataset
switch featuretype
case 'test'
switch centroids.colorspace
case 'opp'
load('stl10_matlab/test_opponent.mat');
[num_train_images, ~] = si... |
clear
load data
[N,M]=size(R_train);
k=5;
% set the init type
inittype=2;
% perform ppmf given the initial value for variational parameters
if inittype==2;
init.Lambda1=rand(k,N);
init.Nu1=rand(k,N);
init.Lambda2=rand(k,M);
init.Nu2=rand(k,M);
[mu1,Sigma1,mu2,Sigma2,tau,Lambda1,Nu1,Lambda2,Nu2,... |
%% Function to calculate the inverse of a lower triangular 4x4 matrix
function [matrixInverse] = chol_LowTMatrix4x4Inv(A)
determinant = A(1,1)*A(2,2)*A(3,3)*A(4,4);
adj(1,1) = A(2,2)*A(3,3)*A(4,4);
adj(2,1) = -A(2,1)*A(3,3)*A(4,4);
adj(2,2) = A(1,1)*A(3,3)*A(4,4);
adj(3,1) = A(2,1)*A(3,2)*A(4,4)- A(2,2)*A(3,1)*A(... |
function [ Demodulated ] = demodulatorOFDM(dataSerial,Param)
sizeOfFFT = Param.N;
numOfSym = Param.numOfSym;
overSampling = Param.OV;
cp = Param.CP;
CarrierIndexes = Param.CarrierIndexes;
Demodulated.dataSerial = reshape(dataSerial, overSampling*(sizeOfFFT+cp),numOfSym).';
% 1. Remove cyclic prefix
if (cp~=... |
function [ Epre ] = se3_raw_trajectory_dist( p1,p2 )
%%for any two trajectories on se(3)x se(3)x se(3)..x se(3), this function
%%will align them and compute the best distance between them.
h1 = Combine_joint_seq_H(p1);
h2 = Combine_joint_seq_H(p2);
K = length(p1);
Epre = distance_tsrvf_se3(h1,h2);
end |
function [p,k]=approximate_pi(delta)
p=0;
k=-1;
while 1
k = k+1;
p=p+sqrt(12)*(-3)^(-k)/(2*k+1);
if abs(p-pi)<=delta
break
end
end |
function notch_filter_layer(layer_obj,varargin)
p = inputParser;
addRequired(p,'layer_obj',@(obj) isa(obj,'layer_cl'));
addParameter(p,'load_bar_comp',[]);
addParameter(p,'block_len',get_block_len(10,'cpu'),@(x) x>0);
parse(p,layer_obj,varargin{:});
for ifreq=1:numel(layer_obj.Frequencies)
layer_obj.Transceive... |
function mag = find_magnitude(Gmag, curr_r, curr_c)
diff_r = curr_r - floor(curr_r);
diff_c = curr_c - floor(curr_c);
if diff_r < 0.01 && diff_c < 0.01
mag = Gmag(floor(curr_r), floor(curr_c));
elseif diff_r >= 0.01
mag = Gmag(floor(curr_r), floor(curr_c))*(1-diff_r) + Gmag(ceil(curr_r),... |
clear all
close all
% initialize
rosshutdown % to 'close' any previous sessions
rosinit('172.16.144.132'); % initialize Matlab ROS node
tbot = turtlebot % the data structure that allows access to the turtlebot and its sensors
% these are the variables that are used to define the robot velocity
lin_vel... |
%%%%%%%%%%%%%%%% FIND SNAKE %%%%%%%%%%%%%%%%
% Finds the nuclei boundaries using a snake algorithm. This program requires
% code found in sdemo (Prince and Xu). The snake algorithm is initialized with
% the convex hulls outputted by findConvexHull.m
function snake = findSnake(N, picture, minRegionSize, imageAdjust... |
classdef ImogenManager < handle
% This is the primary management class for the Imogen code. It handles storage of all of the
% un-typed variables and stores the other, specific managers. After being initialized, this object
% is passed throughout the code as the source for dynamically accessed data. This is a singleto... |
classdef Test_O15ResolveBuilder < matlab.unittest.TestCase
%% TEST_O15RESOLVEBUILDER
% Usage: >> results = run(mlraichle_unittest.Test_O15ResolveBuilder)
% >> result = run(mlraichle_unittest.Test_O15ResolveBuilder, 'test_dt')
% See also: file:///Applications/Developer/MATLAB_R2014b.app/help/matlab... |
function ret = SetDevice
ret = 28;
end |
function extend(start, extension, symmetry)
A = [extension, symmetry];
b = [start];
x = A\b;
alpha = abs(x(1))
|
function [errx,erry,errz]=flsa(iters)
sigma=0.5;
alpha=0.05;
n=2;
I=eye(n);
A=[10 100; 0 10];
B=[10 9.99; 0 10];
C=[10 0; 0 10];
U=[1 0; 0 0.2];
x=zeros(n,iters);
x(:,1)=rand(n,1);
%x(:,1)=rand(n,1);
x(:,1)=x(:,1)/norm(x(:,1));
y=zeros(n,iters);
y(:,1)=ones(n,1);
y(:,1)=x(:,1);
z=zeros(n,iters);
z(:,1)=ones(n,1);
z(... |
function [ flag ] = Equal( lh,rh )
% Judge if two floating number is equal, eg abs(lh-rh)<0.00001
%
if(abs(lh-rh)<0.05)
flag=1;
else
flag=0;
end
end
|
clc;
clear;
p1=input('请输入一个整数:');
e1=input('请输入一个整数:');
p=dec2bin(p1,8); %10进制数转成8位二进制数
e=dec2bin(e1,8);
a=zeros(9,8);
a(1,:)=double(dec2bin(1,8))-'0';
p_m=zeros(8,8); %初始化矩阵 存放 p及0x01 ox02 0x04 0x08 0x10 0x20 0x30 0x40 0x80 分别乘以p的计算值
p_m(1,:)=double(p)-'0';
e_first=zeros(1,8);
e_first=dou... |
function MLTLPrepare(data, param, debug)
% MLTLPrepare(data, param, debug)
%
% Perform initialization tasks before each call to MLTL.
%
% NOTE: all signals are specified in the frequency (DFT) domain,
% which is indicated with a _hat suffix.
%
% data.y_hat: Measured signal.
% data.h_hat: ... |
function [ij] = zerophase(f, n_subpixel, t_mag, t_angle)
%--------------------------------------------------------------------------
%
% Copyright (c) 2013 Jeffrey Byrne
%
%--------------------------------------------------------------------------
%% Inputs
if ~exist('t_angle','var')
t_angle = pi/8;
end
if ~exist('t... |
%%%% Equi-affine flow
init_curve;
while(error > epsilon)
N = GetNormal(P);
kappa = GetCurvature(P);
%P(:, 1:end-1) = P(:,1:end-1) + dt * repmat(kappa.^(1/3),2,1).* N;
P = P + dt * repmat(kappa,2,1).^(1/3) .* N;
count = count + 1;
plot(P(1,:), P(2,:));
axis(resize);
axis equal;
... |
function model = fnc_jointCoord_CalcaneusR (model,DoF_Types)
% Bone Mesh Female Toolkit
% Licensed under the zlib license. See LICENSE for more details.
RFt1MA = model(26).vertices_global(model(26).LandmarkIndices(1),:);
RFt5MA = model(34).vertices_global(model(34).LandmarkIndices(1),:);
% Talocalcaneal Positive X a... |
function [ Nonce, Intial_Vector, Data_Payload, Section_value, Key_Vector, Header_TB ] = ccm_initialization(Header_length, Data_length)
%---Create Nonce----------------------------------------
Nonce = randi([0 1], 1, 100);
%----Create Flag--------------------------------------
Flag_Initial_Vector(1:8) = 0;
%----Creare... |
function [Fp, Fi] = tt(F)
warning('tt is deprecated, use triangle_triangle_adjacency instead.');
[Fp, Fi] = triangle_triangle_adjacency(F);
end
|
function [partition_coefficients_AB, Coa_j_AB, Caq_j_AB, Cstar_j, Coa_AB,...
Caq_AB, Coa, q_alpha_water, fit_exit_flag, error_out]=VBS_equilibration_withLLEpartition_KGv2(...
guess_C_OAalpha_ugPm3,guess_C_OAbeta_ugPm3,guess_partition_coefficients, ...
C_OM_ugPm3, Cstar_dry, activity_coefficient_AB, q_alp... |
function [x,E,n] = nnewt(f,df,x,tol1,tol2,MaxIt)
% f = @(x) x.^11 - 27 * x.^5 + 3;
% df = @(x) 11*x.^10 - 135*x.^4;
% x = 0.9;
% tol1 = 1e-4;
% tol2 = 1e-4;
% MaxIt = 100;
n = 0;
F = f(x);
D = df(x);
if D == 0
error('hemos encontrado un cero de la derivada')
end
while abs(F) > tol1 && abs(F/D) > tol2 && n < M... |
function ppr_io_save_results(cr, lastUsed, X)
global data;
global OutputFile;
global OutputFileMat;
global TrainingResults;
classifier = TrainingResults;
%-------------------------------------------
% Saving prediction results
%-------------------------------------------
if ~isempty(OutputFileMat)
aHeader{1} ... |
function [W,A] = pa_aweight(F)
% [W,A] = PA_AWEIGHT(F)
%
% A-weighting function for sound levels at frequency F
%
%
% (c) 24 May 2011 Marc van Wanrooij
A = getaweight(F);
A1000 = getaweight(1000);
W = 20.*log10(A./A1000);
function A = getaweight(F)
%% Formula: http://en.wikipedia.org/wiki/DB(A)
A =... |
function example;
clear;
clc;
close all;
%dyramic,mode=1
%I=load_images('..\sourceimages\ArchSequence\',1);
%I=load_images('..\sourceimages\ForrestSequence\',1);
I=load_images('..\sourceimages\campus\',1);
%static,mode=0
%I=load_images('..\sourceimages\memorial\',1);
%I=load_images('..\sourceimages\Be... |
%% Image Morphing
im1 = ones([50, 50, 3]);
im2 = zeros([50, 50, 3]);
im1_pts = [1, 1; 1, 50; 50, 1; 50, 50; 25, 25];
im2_pts = [1, 1; 1, 50; 50, 1; 50, 50; 20, 20];
morphed_ims = morph_tri(im1, im2, im1_pts, im2_pts, .3, .3);
if size(morphed_ims, 1) ~= 1
fprintf('Only outputs one image.\n');
end
morphed_im = morph... |
function varargout= SYNBAD_Simulate(inputs)
if(ischar(inputs))
inputstemp=inputs;
inputs=[];
eval(sprintf(inputstemp));
end
u = inputs.model.u_values;
if size(u,2)>size(u,1)
u=u';
end
vy = inputs.simulate.var_circuit;
n_real = inputs.model.n_real_var;
n_int = inputs.model.n_... |
% MODI - Projekt 2 - Zadanie 36
% Autor: Jakub Sikora
% Skrypt wykonuje zadanie 1, podpunkt b
% Przejdz do folderu data
folder = pwd();
cd('../')
cd('../')
cd('data')
% Zaladuj plik z danymi
load danestat36.txt
% Powrot do folderu scripts
cd(folder)
% Sortowanie danych
[val, in] = sort(danestat36);
danestat36 = da... |
clear
v1=zeros(1,10);
v1(3)=1;
v1(2)=1;
v2=ones(1,10);
v2(1) = 0;
v2(2) =0;
X = [-5 -4 -3 -2 -1 0 1 2 3 4];
X2 = [0 1 2 3 4 5 6 7 8 9];
subplot(2,2,1)
stem(X,v1);
title('Vector1 (All zeros except 2 elements)')
subplot(2,2,3)
stem(X,v2);
title('Vector1 (All ones except 2 first elements)')
subplot(2,2,2)
stem... |
clc;
clearvars;
syms v1 v2 vx vfeed vout1 vout2 vout vd vd1 vd2
syms r1 r2 r3 r4 r5 r6 r7 a0 wp positive
syms s
%Numerador:
%num_s_2
num_s_2 =a0^2*r1*r6^2*v2*wp^2 - a0^2*r2*r6^2*v1*wp^2 + a0^2*r1*r7^2*v2*wp^2 + a0^2*r2*r6^2*v2*wp^2 - a0^2*r2*r7^2*v1*wp^2 + a0^2*r2*r7^2*v2*wp^2 + 2*a0^2*r1*r5*r6*v2*wp^2 - 2*a0^2*r2... |
function dydt = ncr_naive_v3(t,y)
kon = 1;
koff = 1;
kc = 1;
%%%%%%%% Define system of ODEs
% reactant key:
% species 1: AI (caged activator)
% species 2: A (free activator)
% species 3: CA (Cas13:Activator)
% species 4: CAAI (Cas13:Activator:Caged activator)
... |
function [P1,P2,P3] = actuator_positions(u)
L1 = u.L1;
L2 = u.L2;
l1 = u.l1;
l2 = u.l2;
P = u.P;
f = u.f;
theta_list = u.theta;
phi_list = u.phi;
H_list = u.H;
% front, left, right
P1 = zeros(1,length(theta_list));
P2 = zeros(1,length(theta_list));
P3 = zeros(1,length(theta_list));
for i = 1:length(theta_list)
... |
function [smaller,larger]=partitionObjectsBySize(objects,aabb)
% Partition list of objects into those smaller or larger than the octant
% size at this level. Aabb is the for the current octant.
% Check if object will fit into a deeper octant.
octant_size=aabbSize(aabb)/2;
smaller={};
larger={};
nobjs=length(objects);... |
function [fh,clX1,clY1,clX2,clY2] = figureSpectrum3D(dataCell,varargin)
%绘制频谱
% 此处显示详细说明
%LineStyle = 'none';
pp = varargin;
input_args = {};
rang = 1:13;
clX1 = [];
clY1 = [];
isShadow = true;
while length(pp)>=2
prop =pp{1};
val=pp{2};
pp=pp(3:end);
sw... |
% Implement blur as a seperable block transform
N = 16;
blur_A = return_blur_A_matrix(N);
% Apply blur matrix to the image
im = im2double(imread('lenna_gray.jpg'));
block_processor_linear = @(block_in, A) A * block_in * A';
blur_lenna = block_splitter_image(im, N, block_processor_linear, blur_A);
figure, imsh... |
function saveasgsf(filename,data,numstepsx,numstepsy,startx,endx,starty,endy,label,unit,time,varargin)
%saveasgsf Save NxM matrix from SPM/AFM Scan in Gwyddion Simple Field file
%format.
% Save data (NxM matrix) for Gwyddion (SPM (scanning probe microscopy)
% data visualization and analysis)
% More information ab... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Created: 13-Apr-2014 14:38:46
% Computer: GLNX86
% Matlab: 7.9
% Author: NK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function shp=getStructShape(strct)
shp=recursiveNames(strct);
% ljkigu
% [paths]=allpaths(shp,{[]})
end
%
% function [paths]=allpaths(shp,paths)
% for ss=1:nume... |
% guiPlanck Graphical user interface for Planck objects
%
% created May 12, 2014 by Tommy Ao (Sandia National Laboratories)
% modified July 8, 2014 by Tommy Ao
%
function varargout=guiPlanck(varargin)
% determine if GUI already exists
h=findall(0,'Type','figure','Tag','guiPlanck');
if ishandle(h)
figure(h);
re... |
classdef OptimalGriddingKernel < GriddingKernel
properties
kernel_width;
overgrid_factor;
norm_val;
nIter;
interp_values;
interp_dist;
end
methods
% Constructor
function obj = OptimalGriddingKernel(kern_width, imageSize, overgridFactor, lut_size, iter, verbose)
% Call super constructor to build ... |
function showSubClassesBleep()
% showSubClassesBleep draws all the classes currently implemented, that are
% related to the Bleep class
getSubclasses('Bleep','source')
title('Subclasses of "Bleep" implemented') |
function [alpha error] = get_forward(I_prob_o, T_prob_o, O_prob_o, oblist, states)
error = 0;
alpha = [];
Nst=length(states);
lob=length(oblist);
if( Nst <= 0 )
error = 1;
disp('error in hidden states');
return;
end
if( lob <= 0 )
error = 1;
disp('error in hidden states');
return;
end
[d1 d2 ... |
function SC_VocCollector(varargin)
% COMPUTE AND SAVE THE VOCALIZATIONS FOR A SET OF RECORDINGS
P = parsePairs(varargin);
checkField(P,'VocJitter',0.002);
checkField(P,'FWindow',0.001);
checkField(P);
P.Selected = {...
{'mouse9',66},...
{'mouse9',49},...
{'mouse9',50},...
{'mouse9',41},...
{'mouse9',17},...... |
% HW06 Q1c Hermite Interpolation with Newtone Basis------------------------------------------------------
clc;
clear;
n=2; % total of n+1 interpolation points
% (x,y,y')= (0,1,0), (2,0,1), (3,2,-1)
x=[0 2 3];
y=[1 0 2];
q=[1 0 0 0 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0;
0 1 0 0 0 0;
2 0 0 0 0 0;
0 -1 0... |
% Use skipsize (number of skipped lines for each exposure)
% and each group of 14 corresponds to one concentration
function CV_Graph(inputCV, conc, exposures, gs);
%skipsize = 14;
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%x=conc;
%figure;
%bar(x,y,'histc');
% a = length(expos... |
function [offsets,distances] = InitRand(A,B,w)
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
tsz=size(A);%size of original image
ssz=size(B);%size of image were we will take patches from
offsets = cat(3,...
randi([1+w,ssz(1)-w],tsz(1:2)),...
randi([1+w,ssz(2)-w],tsz(1:2))...... |
%% INPUTS:
% Preal: Real spectral Fourier coefficients
% Pim: Imaginary spectral Fourier coefficients
% OUTPUTS:
% reconstructed_image: Images hypercube
% reconstructed_spectra: Fourier spectra hypercube
function [reconstructed_image,reconstructed_spectra]=ReconstructionHypercubes_split(Preal,Pim)
%% Spectr... |
function [f,varargout]=EqAndDerivsTester(chypers,times,clickTimes,clickSigns,mu,Vsm,VVsm,entryToReturnRow,varargin)
%Wrapper validating EqAndDerivs
%Konstantinos Panagiotis Panousis
%Gatsby Computational Neuroscience Unit
%University College London
%5 June 2015
%Input:
% chypers: the hyperparameters of the model (ca... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty:... |
function d = dz_dp(w,p,z,param)
%MANDIST.DZ_DP Derivative of weighted input with respect to input
% Copyright 2012-2015 The MathWorks, Inc.
Q = size(p,2);
d = cell(1,Q);
for q=1:Q
z1 = bsxfun(@minus,p(:,q)',w);
d{q} = sign(z1);
end
end
|
%if rand<0.5
% ensert to empty way
ew=find(weae);
ew1=ew(randi(length(ew))); % way to inset
eggsp(1,ew1)=true;
orv=[orv ew1];
move=false;
%else
% just_move;
%end |
function [segmentation] = CRFInference(config, unaryPotentials, mask, pairwiseFeatures, weights)
% CRFInference Obtain the segmentation by minimizing the overall energy of
% the CRF.
% [segmentation] = CRFInference(config, unaryPotentials, mask, pairwiseFeatures, weights)
% OUTPUT: segmentation: binary segmentati... |
function [ELPS,x,y] = genEllipse(rect_h,rect_w,square_shape)
if(~exist('square_shape','var'))
square_shape=0;
end
if(square_shape)
M = max(rect_w,rect_h);
N = M;
else
N = rect_w;
M = rect_h;
end
[x,y]=meshgrid(-(N/2)+1/2:(N/2)-1/2,-(M/2)+1/2:(M/2)-1/2);
ELPS = (x.*x)/(rect_w*rect_w) + (y... |
%% INFOS
clear all
% subtyping
num_net = [2 5 6 7];
name_net = {'lim','dmn','cen','san'};
nb_clus = 4;
name_clus = {'subt1','subt2','subt3','subt4'};
type_norm = 0; % 0 = no norm, 1 = ga correction, 2 = norm on subjects, 3 = norm on voxels
regress_conf = 1; % 1 = yes, 0 = no
% association
num_var = [8 9 10]; % num v... |
function e = mittag_leffler(alpha, beta, z, rho)
% MITTAG_LEFFLER Generalized Mittag-Leffler function.
% E = mittag_leffler(alpha, beta, z) evaluates the Mittag-Leffler
% function for each element of z with parameters alpha and beta, where
% alpha, beta are real scalars and alpha > 0.
%
% E = mittag_leffler(al... |
%Input: Column vector
%Description: Estimates point of symmetry through a series of algorithms.
%This program more than not infallible! Algorithms are described as they
%occur below.
%Output: Number (the row number of the estimated point of symmetry).
function y=Symmetry_Distance_Loss(x)
format long... |
function [resp,blankResp,unitStat,times,blankTimes,respRange] = formatSpikeFileToResp(pathname,filename)
load(fullfile(pathname,filename));
if exist('modality','var')
if strcmp(modality,'2p')
% for now the file contains the data formatted as needed.
else
... |
%--------------------------------------------------------------------------
%
% scriptCumFit:
% The script performs a cumulative fit of lifetime data and an
% evaluation of the fit based on a BIC/AIC state analysis and a 'Goodnes
% of Fit Statistics' analysis.
%
% Syntax:
% scriptCumFit
%
% Inputs:
% Th... |
function [PowSpectrum,NorFreq] = Classic_ImpPeriodogramSmooth( SignalIn,SignalLength,WindowSize,WindowType,UnitType )
%FileName: Classic_ImpPeriodogramSmooth.m
%Description: 用平滑法改进的周期图法
if size(SignalIn,2)>1 %输入信号列数大于1报错
error(message('Error! Invaild Input Signal Demension @ Function:"Classic_ImpPeriodogramSmooth... |
classdef FaceVariable
% FaceVariable class
properties
domain
xvalue
yvalue
zvalue
end
methods
function fv = FaceVariable(meshVar, facevalX, facevalY, facevalZ)
if nargin>0
fv.domain = meshVar;
fv.xvalue = facevalX;
... |
function surv_data_to_logbook_db(surv_data_obj,dbconn,filename,varargin)
p = inputParser;
addRequired(p,'surv_data_obj',@(x) isa(x,'survey_data_cl'));
addRequired(p,'dbconn',@(x) isa(x,'sqlite'));
addRequired(p,'filename',@ischar);
addParameter(p,'StartTime',0,@isnumeric);
addParameter(p,'EndTime',1,@isnumeric);
pars... |
%MAKE WINDOW 1500, MAKE LEVEL 500 to see the contrast
%{
In slice 128, there seems to be lesion and the shape of the lesion mask
appears to be correct, however the location of the lesion mask appears
incorrect.
%fixed now
%slice 127-129
%Patient 22
%}
%currentFolder='D:/DATA/SPINE_LESIONS_GENERATED_DATA_SET_o... |
function [A,b,c,info] = presolve(A,b,c,lbounds,ubounds)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Presolve Input Data.
% .
% Usage: [A,b,c,info] = presolve(A,b,c,lbounds,ubounds)
% Problem: min c'x, s.t. Ax=b, lbounds<=x<=ubounds.
% Input: Data... |
function SIGMA = h2o_sigma(T)
% H2O_SIGMA Surface tension of H2O in N/m
% H2O_SIGMA(T) Returns the surface tension of H2O at a given
% temperature. Based on the correlation given in the
% ASME STEAM TABLES - SIXTH EDITION
% Application range from the triple point (0.01°C) to
% the critical point (Tc=647.15K; 3... |
function matlab_example_callback()
import com.tinkerforge.IPConnection;
import com.tinkerforge.BrickletEnergyMonitor;
HOST = 'localhost';
PORT = 4223;
UID = 'XYZ'; % Change XYZ to the UID of your Energy Monitor Bricklet
ipcon = IPConnection(); % Create IP connection
em = handle(BrickletEne... |
function pos = updateFxn_selfGenerating(ptr)
% pos = pds.mouse.updateFxn(p)
%
% TEST: Don't pass in full pldaps structure, only need pointer from p.trial.mouse.windowPtr
% -- Setup function handle as:
% fxn = @pds.mouse.updateFxn(p.trial.mouse.windowPtr);
%
% ~~~~~~~~~~
% YES! (And shti)
% Discovered majo... |
function [im1, im2, varargout] = autoposition(im1, im2)
%AUTOPOSITION automatically registers two images.
% [image1 image2] = AUTOPOSITION(image1, image2) will register image1 to
% image2. Image2 must be smaller in both dimensions than image2. Image1
% is cropped to image2's size, and image2 may be cropped if ... |
function Image_Upsampled = upsample (Image)
width = 176;
height = 144;
%Create a filter
avg_filter = [0.5, 0.5];
%Average elements
row_average = filter(double(avg_filter), 1, double(Image));
%Copy the average values
I_row_upsample= zeros(height, width/2);
I_row_upsample(2:2:height-1, :) = row_average(2:1:heig... |
% ISA chart with absolute magnitudes.
sldata;
chart;
chart_abs=chart;
chart_abs(:,2)=chart_abs(:,2)*T1;
chart_abs(:,3)=chart_abs(:,3)*p1;
chart_abs(:,4)=chart_abs(:,4)*rho1; |
function imLabel( labels, position, S, pvPairs )
% Improved method for labeling figure axes.
%
% USAGE
% imLabel( labels, position, [S], [pvPairs] )
%
% INPUTS
% labels - cell array of strings, labels for display
% position - 'left', 'right', 'bottom', or 'top'
% S - [] rotation for to... |
function month(pop,init,growth)
s = init;
n = 0;
while s<pop
s = s + init*growth*(growth+1)^n;
n = n+1;
end
disp(['system population:' num2str(s)...
' ,month: ' num2str(n)]);
end
|
function [FIT] = mmpp2_fit_count_approx(a, bt1, bt2, binf, m3t2, ...
t1, t2)
% Fits a second-order Marked MMPP.
% a: arrival rate
% bt1: IDC at scale t1
% bt2: IDC at scale t2
% binf: IDC for t->inf
% m3t2: third central moment
% t1: first time scale
% t2: second time scale
%method_d0d1 = 'exact';
options = struc... |
function [FilteredData] = BondFilter(OriginalData,GiltType)
%/ main loop
FilteringIndex = zeros(size(OriginalData,1),1);
for i = 1:size(OriginalData,1)
end
end |
function [fun,dfun]=funcion_gompertz(x,y)
K=0.44;
A=118.62;
fun=K.*y.*(log(A./y));
dfun=K.*(log(A./y)-1);
end |
function LUT(obraz, przekodowanie)
%HELPFUNC Summary of this function goes here
% Detailed explanation goes here
ImgIntlut = intlut(obraz, przekodowanie);
subplot(2,2,1:2);
plot(przekodowanie);
title("Przekodowanie");
subplot(2,2,3);
imshow(obraz);
title("Originalny obraz");
subplot(2,... |
function y = makesquare(x)
% Copyright (c) 2009, The MathWorks, Inc.
%
% Creates a magic matrix
y = magic(x);
|
% Script LTFAT
clear; close all; clc;
nip_init();
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preproceso / simulacion %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Numero de dipolos a considerar
Nd = 4000; % 1000, 2000, 4000, 8000
% Cargar datos(lead field, mesh del cerebro etc...
load(strcat('data/montreal',num2str(Nd),'_full3shell.mat'))
cf... |
clear; clc;
TR = 2; % [ms]
SRT_all = 0:10:200;
flip_angle_all = [12,15,18,21];
for iFA = 1:length(flip_angle_all)
for iSRT=1:length(SRT_all)
flip_angle = flip_angle_all(iFA);
% TR = kSpace_info.Portocol.alTR(2)/1000;
T1 = [225,335].';
nor = 30;
M0 = 1;
clea... |
function [lfs, mask_ero] = sharp(tfs,mask,vox,ker_rad,tsvd)
%SHARP Background field removal
% [LSF,MASK_ERO] = SHARP(TFS,MASK,VOX,KER_RAD,TSVD)
%
% LFS : local field shift after background removal
% MASK_ERO : eroded mask after convolution
% TFS : input total field shift
% MASK : bin... |
clear all; close all; clc;
%% Include
addpath(genpath('../support/'));
settings;
%% Simulated AR(p) process
rep = 100; % repetitions for accuracy measurement
T = 8000; % time series length
p = 1; % lag order
r = 0.5; % noise type
%% Settings
nVals = [5,10,15,20,30,50,100];
NOISE_TYPE = NOISE_SWING;
%NOIS... |
function z = pulso(x)
for i=1:length(x)
if(x(i)~=0)
x(i)=0;
else
x(i) = 1;
end
end
z=x;
end |
% (C) Copyright 2020 CPP visual motion localizer developpers
function [nbBlocks, nbRepet, nbEventsBlock, maxTargBlock] = getDesignInput(cfg)
nbRepet = cfg.design.nbRepetitions;
nbEventsBlock = cfg.design.nbEventsPerBlock;
maxTargBlock = cfg.target.maxNbPerBlock;
nbBlocks = length(cfg.design.names) * nb... |
function F = MotionFunctions
F.MyHomography = @MyHomography;
F.MyOpticalFlow = @MyOpticalFlow;
F.SaveHomographyData = @SaveHomographyData;
F.SaveOpticalFlowData = @SaveOpticalFlowData;
F.CameraSpeed = @CameraSpeed;
F.CameraMotionClass = @CameraMotionClass;
end
% %%%%%%%%%%%%%%%%%%%%... |
function [ out ] = sprescurve( res,percent, interv )
%SPRESCURVE Summary of this function goes here
% Detailed explanation goes here
out=zeros(1,interv+1);
out(percent+1)=res;
for i=2:interv+1
if out(i)==0
out(i)=out(i-1);
end
end
end
|
% Please write your name and student number below
%
% Name: Koen Dercksen, Thijs Nieuwdorp
% Student number: 4215966, 4210654
% This main function trains the weights on a training set, and then uses this trained network to classify the test set
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [f_a_3, E_W, W_... |
addpath('../common');
n = 10;
s = 0.6;
threshold = 1.0e-9;
A = full(sprand(n,n,s));
while det(A) == 0
A = full(sprand(n,n,s));
end
B = rand(n,1);
X = A \ B;
[T1, B1, Movie, S] = gaussianElimination(A, B);
X1 = solve(T1,B1);
disp(all((X - X1) < threshold));
movie(Movie);
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2014 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:/... |
% Kelvin Zhang, Arvind Ganesh, February 2011.
% Questions? zhangzdfaint@gmail.com, abalasu2@illinois.edu
%
% Copyright: Perception and Decision Laboratory, University of Illinois, Urbana-Champaign
% Microsoft Research Asia, Beijing
%
% Reference: TILT: Transform Invariant Low-rank Textures
% Zh... |
function dS = aircraft_dynamics(S, u)
global W;
global Surface_area;
global mu_g;
global rE;
global mE;
% Wind parameters
global Vw;
global chiw;
alpha = u(1);
mu = u(2);
x = S(1); y = S(2); h = S(3);
V = S(4);gamma = S(5);chi= S(6);
g = mu_g*mE/((rE... |
% Script to load data from zip.train, filter it into datasets with only one
% and three or three and five, and compare the performance of plain
% decision trees (cross-validated) and bagged ensembles (OOB error)
zip_train = readmatrix('zip_train.csv');
zip_test = readmatrix('zip_test.csv');
% fprintf('Working on the ... |
clear all;
clc;
img = imread('brainAct4.jpg');
KTrue = 4;
height = length(img(:,1,1));
width = length(img(1,:,1));
redThre = 100;
greenThre = 50;
blueThre = 50;
actN = 0;
for i = 1:height
for j = 1:width
if(img(i,j,1) > redThre && img(i,j,2) < greenThre && img(i,j,3) < blueThre)
a... |
classdef EnemyEdge < Enemy
properties
vxInit_ = 0.5;
vx_ = 0.5;
end
methods
function obj = EnemyEdge(map,initPos,imdata,num)
obj@Enemy(map,initPos,imdata,num);
end
function move(obj)
if obj.map_.checkEdge(obj.xpos_,obj.ypos_,obj.vx_)
obj.vx_ = -obj.vx_;
... |
clc
clear
a = [-10 20 -5;-11 4 -5];
sgn_a = sgn(a)
disp(sgn_a); |
function h=stan_dot_error_plot(X,Y,CI,C,varargin)
% takes collected stats, plots and performs hypothesis tests
%
%
%
if nargin<3 | isempty(C)
C=ones(size(Y));
end
colors='';
markersize=20;
symbols={'o','x','s','d','*','+','p','h'};
nparams=length(varargin);
line_alpha=.5;
squarewidth=1;
squareheight=.2;
if mod(npa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.