text stringlengths 8 6.12M |
|---|
clc
% Import file function
importfile
% genderIsoCalc
[maleIsoIndMeansSub,maleIsoIndMeans,femaleIsoIndMeansSub,femaleIsoIndMeans,maleGroupIsoMean,femaleGroupIsoMean] = genderIsoCalc(SubjectID,Gender,Day1,Day2,Day3);
%allData = maleIsoIndMeans
% dayComparator
[day1toDay2] = dayComparator(SubjectID,Day1,Day2);
[day2to... |
function xout = lorenz96en(xin)
% Lorenz 96 model, calculate several members at the same time
% input: <xin> should be a matrix with size Nvar*ensize,
% which Nvar=number of variables, ensize=number of members
% PY Wu, 2020/09/18
global F
[N, ensize]=size(xin);
xout=zeros(N,ensize);
%first the 3 edge cases... |
clear;close;
n=4;
r=[28 21 23 25 5]'/100;
q=[2.5 1.5 5.5 2.6 0]'/100;
p=[1 2 4.5 6.5 0]'/100;
u=[103 198 52 40 100]';
for lemda=linspace(0,1,300)
c=[(1-lemda)*(p-r);lemda];
A1=[(1+p)', 0];
A2=[diag(q(1:n)),zeros(n,1),-ones(n,1)];
A=[A1;A2];
b=[1;zeros(n,1)];
vlb=zeros(n+2,1);
x=lp(c,A,b,vlb... |
% xSimScatter.m
%
% Make a scatter plot of FABBER inference of simulated data
%
% MT Cherukara
% 5 December 2018
%
% Actively used as of 2019-02-13
%
% Changelog:
%
% 2019-03-21 (MTC). Made the results print out in a way that they can be copied
% straight into FabberAverages.xls
%
% 2019-02-13 (MTC). Changed the ... |
function str = fromUpperToCamelCase(upperscore_compound)
% converts upperscore_compound to CamelCase
%
% Not always exactly invertible
%
% Examples:
% fromUpperToCamelCase('ONE') --> 'one'
% fromUpperToCamelCase('ONE_TWO_THREE') --> 'oneTwoThree'
% fromUpperToCamelCase('#$ONE_TWO_THREE') --> 'oneTwo... |
function result = is_int(n)
if is_double(n) && isreal(n) && isempty(find(floor(n) ~= n,1))
result = 1;
else
result = 0;
end |
function [theta,p,err] = TrainAndPlot(feature)
NFData = load('NonFaceData.mat');
FData = load('FaceData.mat');
nn = size(NFData.ii_ims,1);
nf = size(FData.ii_ims,1);
FsF = VecComputeFeature(FData.ii_ims, feature);
FsNF = VecComputeFeature(NFData.ii_ims, feature);
fs = [FsNF;FsF];
ys = [zeros(nn,1);ones(nf,1)];
ws = [... |
classdef PlotOption
enumeration
errorPlot,powerSpectralPlot,accumulativePowerSpectralPlot
end
end |
function h = showskeletons_joints(im, points, pa, msize, torsobox)
if nargin < 4
msize = 4;
end
if nargin < 5
torsobox = [];
end
p_no = numel(pa);
switch p_no
case 26
partcolor = {'g','g','y','r','r','r','r','y','y','y','m','m','m','m','y','b','b','b','b','y','y','y','c','c','c','c'};
case 14
... |
function [accel,gyro] = transformSample(vibrationResponses)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
accelresp = zeros(length(vibrationResponses),4);
gyroresp = zeros(length(vibrationResponses),4);
accelIndex = 1; gyroIndex = 1;
for i = 1:1:length(vibrationResponses)
if ( vi... |
clear HmDeformer tetMeshDeformer triMeshDeformer VHMDeformer ProjHmDeformer ProjHarmonicMap
wait(gpuDevice);
ProjHmDeformer = ProjHmNewton(x, t, cage, sampling, para1); |
function [w3d] = read_vrml(filename)
keynames=char(' Coordinate { point', ' TextureCoordinate { point', 'texCoordIndex', 'coordIndex');
fp = fopen(filename,'r');
if fp == -1
fclose all;
str = sprintf('Cannot open file %s \n',filename);
errordlg(str);
error(str);
... |
function [ ind,x_ind ] = most_correlated( A,r )
%MOST_CORRELATED Summary of this function goes here
% Detailed explanation goes here
m = size(A,1);
n = size(A,2);
x_ind = 0;
for i = 1:n
val = A(:,i)'*r;
if val > x_ind
x_ind = val;
ind = i;
end
end
end
|
function [O, J] = image_snake(a, b, c_x, c_y, image)
% x - rows; y - cols;
input = image;
I=im2double(abs(input));
t = linspace(0, 2*pi, 100);
x0 = c_x; y0 = c_y;
x = b*cos(t) + x0;
y = a*sin(t) + y0;
P=[x(:) y(:)];
Options=struct;
Options.Verbose=false;
Options.Iterations=100;
Options.Wedge=2;
Options.Wline=0;
Opti... |
N = 1024;
y = zeros(1,2047);
ftx = zeros(1,N);
psd2 = zeros(1,N);
trial_num=10000;
for num =1:trial_num
xn = randn(1,N);
y = y+xcorr(xn,'biased')*sum(xn.*xn);
ftx = fft(xn);
psd2 = psd2+ftx.*conj(ftx);
end
y=y/trial_num;
psd2 = psd2/trial_num;
subplot(3,1,1)
stem(y);
fty = fft(y);
psd1 = abs(fty);
subplot(3,... |
function filter_upd=retro_update_local_np(filter_retro,filter_upd,Nhyp_i,p_d,H,R,z,i,gating_threshold,Nx,Nz)
%Local hypotheses update for OOS measurement update. Case
%non-present/present, when the time of birth corresponds to ko
%Author: Angel Garcia-Fernandez
p_s2=filter_retro.p_s2;
for j=1:Nhyp_i %We go through... |
function [y y1]= cal_pose_err(T1, T2)
R1= T1(1:3,1:3);
R2= T2(1:3,1:3);
X1= R1(:,1); X2= R2(:,1);
Y1= R1(:,2); Y2= R2(:,2);
Z1= R1(:,3); Z2= R2(:,3);
exyz= [X1'*X2 Y1'*Y2 Z1'*Z2];
exyz(exyz>1)= 1;
exyz(exyz<-1)= -1;
y(1)= max(abs(acos(exyz)))*180/pi;
q1 = Matrix2Quaternion(R1);
q2 = Matrix2Quaternion(R2);
% y1(... |
function [endpoint, integrand] = cost_gpops(sol)
global CONSTANTS;
bounds = CONSTANTS.bounds;
Q = eye(12);
R = eye(6);
y = sol.state;
mu = sol.control;
endpoint = 0;
integrand = dot(y,y*Q',2)+dot(mu,mu*R',2);
% DerivEndpoint = [zeros(1,length(x0)), zeros(1,length(t0)), ...
% xf'*S, ... |
% Samples:
%%1:
% f=@(x)sign(x-2)*sqrt(abs(x-2));
% [x,eps]=api_41(f,4,3,0.001)
%%2:
% f=@(x)e^(-x/2)*sin(3*x);
% [x,eps]=api_41(f,4,5,0.00000001)
%%3:
% f=@(x)x^3+5*x^2-1;
% [x,eps]=api_41(f,0,1,0.0001)
%%4:
% f=@(x)x^4+2*x^3-2;
% [x,eps]=api_41(f,0,1,0.0001)
%% 5:
% f=@(x)x^3+5*x^2-10;
% [x,eps]=api_41(f,0,... |
function [Xa,Xa_m]=M_update(Xb,HXb,y,R,infl)
% function [Xa,Xa_m]=M_update(Xb,HXb,y,R,infl)
% M_UPDATE Matrix update: Data assimilation of all observations for a given time step.
% Note that this function does not include covariance localization. The update
% equations are taken from Whitaker and Hamill 2002: Eq. 2... |
clear
warning off
addpath('../');
% model path for three iterations
model_path1 = 'model1/';
model_path2 = 'model2/';
model_path3 = 'model3/';
caffe.reset_all()
Solver1 = modelconfig(model_path1);
Solver2 = modelconfig(model_path2);
Solver3 = modelconfig(model_path3);
Solver1 = dataconfig(Solver1);
Solver2 = dataco... |
% This function performs multinomial re-sampling
% Inputs:
% S_bar(t): 4XM
% Outputs:
% S(t): 4XM
function S = multinomial_resample(S_bar)
global M % number of particles
% YOUR IMPLEMENTATION
S=zeros(4,M);
CDF=cumsum(S_bar(4,:));
r=rand(1,M);
for m=1:M
... |
[WP, D] = dumpcheck();
if D(1:2240) == WP
disp("Parameters matched")
else
WP_reshaped = string(reshape(WP,8,[])')
D_reshaped = string(reshape(D,8,[])')
Diff = find(D_reshaped(1:280,:)~=WP_reshaped)
file_num = ceil(Diff/40)
byte_num = mod(Diff, 40)
byte_num(byte_num==0)=40
end |
function print( metodo_reemplazo, criterio_seleccion, criterio_reemplazo, apareo,generation)
switch metodo_reemplazo
case 1
disp '* método de reemplazo : tipo 1';
case 2
disp '* método de reemplazo : tipo 2';
case 3
disp '* método de reemplazo : tipo 3';
end
switch criterio_sel... |
function [D,L] = createTrainDataBase(trainpath)
% A function to create database for train images
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input parameters
% trainpath path for train images
%
% Output
% D Data matrix of all t... |
function visualizeBoundaryLinear(X, y, model)
%VISUALIZEBOUNDARYLINEAR plots a linear decision boundary learned by the
%SVM
% VISUALIZEBOUNDARYLINEAR(X, y, model) plots a linear decision boundary
% learned by the SVM and overlays the data on it
w = model.w;
b = model.b;
xp = linspace(min(X(:,1)), max(X(:,1)), 100... |
function [y] = myconv( x,h )
%this function takes x as a photograph input and h as a filter and returns
%the filtered image using convolution.
%Get the height and the width of the input image.
[m,n] = size(x);
%I change the int to double because we are goint to do arithmetic
%equations.
x=im2double(x);
%create an arr... |
function [Priors,Mu,Sigma] = maximization_step(X, Pk_x, params)
%MAXIMISATION_STEP Compute the maximization step of the EM algorithm
% input------------------------------------------------------------------
% o X : (N x M), a data set with M samples each being of
% o Pk_x : (K, M) a KxM matr... |
% simulation, prediction, CV 500 times, PARS_BM
clear
addpath(genpath('/home/minjay/div_curl'))
p = 2;
B = 500;
savefile = 'pred_err_BM_sim.mat';
load('sim_data_mix.mat')
% load the output of the R code
load('param_kriging_sim.mat')
% initial computation
[h_mat, r, P_cell, Q_cell, A_cell] = init_comp(x, y, z, n, ... |
function f = Generate_Wrap(p_impulse,p_decline,p_disappear,amp_keep,list,t)
% input:
% p_impulse: type: double, percentage of impulse;
% p_decline: type: double, percentage of decline;
% p_disappear: type: double, percentage of disappaer;
% amp_keep: type: double, amplitude relatively;
% list: type: 1*n matrix, the ori... |
function varargout = labeler(varargin)
% LABELER MATLAB code for labeler.fig
% LABELER, by itself, creates a new labeler or raises the existing
% singleton*.
%
% H = LABELER returns the handle to a new labeler or the handle to
% the existing singleton*.
%
% LABELER('CALLBACK',hObject,eventData,... |
% In this experiment, we use balance split. That is, the labeled data
% share a similar imbalance ratio to that of unlabeled data.
% Two example data "wdbc" and "heart" are used. BTW: The running time of
% heart is much less than wdbc.
addpath('libsvm-mat-2.89-3-box constraint');
C1=100;
C2=0.1;
sampleTime=100; % num... |
% Demo to run inference on real dataset
%
% U: contNodeNum * sampSize, real continuous attributes data.
% V: discNodeNum * sampSize, real discrete attributes data.
% X: noisy version of U.
% Y: noisy version of V.
%% Setting
% I. Datasets with default train-test split using MLC++ GenCVFiles (2/3, 1/3 random).
... |
function [Ts, Es] = DetoxKinetics(E0,dE,Km,T0,trng)
Nt = length(trng);
dts = trng(2)-trng(1);
Ts = zeros(1,Nt);
Es = zeros(1,Nt);
%% Simulating the dynamics
nT = 0;
c = 1;
Ts(c) = T0;
Es(c) = E0;
for t = trng(1:length(trng)-1)
c = c+1;
Es(c) = Es(c-1) - dts*dE*Es(c-1);
Ts(c) = Ts(c-1) - d... |
function [eq_x_tai, f, gdata] = readl1b_all(fn);
% function [eq_x_tai, f, gdata] = readl1b_all(fn);
%
% Reads an AIRS level 1b granule file and returns an RTP-like structure of
% observation data. Returns all 2378 channels and 90x135 FOVs.
%
% Input:
% fn = (string) Name of an AIRS l1b granule file, something like... |
%my FFT algorithm for a vector using the Cooley-Tukey approch
function X_k=myFFT(x_n)
j=sqrt(-1);
N=length(x_n); %number of samples
%step 1 binary reversal a_n will be the input to the butterfly
inDe=0:N-1;
inBi=de2bi(inDe,log2(N));
outBi=fliplr(inBi);
outDe=bi2de(outBi)+1;
%create a_n starting array
for i=1:N
a_n... |
% y = theta
% линейные случаи:
% f1: y'' + y = 0
% y1' = y2
% y2' = -y1
% | 0 1| |y1|
% |-1 0| * |y2|
% f2: y'' + vy' + y = 0
% y1' = y2
% y2' = -y1 - vy2
% | 0 1| |y1|
% |-1 -v| * |y2|
% нелинейные случаи:
% f1: y'' + sin(y) = 0
% y1' = y2
% y2' = -sin(y1)
% |0 1| |y1| | 0 |
% |0 0| * |y2| + |-sin... |
function X=buildDesMat(TR, exp_duration, onsets, durations, doASLmod)
% function X = buildDesMat(TR, exp_duration, onsets, durations, doASLmod)
%
% (c) 2010 Luis Hernandez-Garcia @ UM
% report bugs to hernan@umich.edu
%
% this is a function to make design matrices, including the ASL
% modulation if you ... |
function [ OXPLUS,O2PLUS,NOPLUS,N2PLUS,NPLUS,NNO,N2D,INEWT ] = CHEMION( context, ...
JPRINT,ALT,F107,F107A,TE,TI,TN,OXN,O2N,N2N,HEN,USER_NO,N4S,NE,USER_NPLUS,SZAD )
%CHEMION IDC model
% flipiri.for
%
% 2012.00 10/05/11 IRI-2012: bottomside B0 B1 model (SHAMDB0D, SHAB1D),
% 2012.00 10/05/11 bottomside Ni model (i... |
clearvars -except data populationOut
warning off
dataLength=256;
populationSize=10;
numberOfMutations=00;
numberOfSteps=2;
% data=prepareData('SUBJ1');
k=1;
% for numberOfSteps=100:-10:10
% for populationSize=100:-10:10
result(k,:)=mainFunction(numberOfMutations, numberOfSteps, data,dataLength, populationS... |
%SPTENSOR_GT Class for sparse tensors in Genten format.
% See also TENSOR_TOOLBOX
function t = sptensor_gt(varargin)
%SPTENSOR_GT Create a sparse tensor.
%
% X = SPTENSOR_GT(SUBS, VALS, SZ, FUN) uses the rows of SUBS and VALS
% to generate a sparse tensor X of size SZ = [m1 m2 ... mn]. SUBS is
% an p x n array... |
%Universidade Federal de Santa Catarina - UFSC
%Cálculo Numérico - INE5202
%Pivoteamento Parcial de Gauss
%Gustavo Simas da Silva
function g = pivo_Gauss(A,b)
M = horzcat(A,b'); %geracao matriz expandida
n=size(A,1); %tamanho matriz A
ord=[1:n] %vetor de ordenamento
x = [1:n] %vetor solucao
for k=1:n-1
... |
imaqfind % look at available devices
info = imaqhwinfo('winvideo',1);
% brx_num
% camera object
cam = imaq.VideoDevice('winvideo',1);% Device ID has to do with the order they were plugged in!!!!
% Formats and resolutions
cam.VideoFormat = 'YUY2_2592x1944';
cam.ReturnedColorSpace= 'RGB';
cam.ReturnedDataType = 'doubl... |
function proc_sig = proc(x,y)
proc_sig = xcorr(x,y);
end
|
% Source: https://www.mathworks.com/matlabcentral/fileexchange/68981-bat-optimization-algorithm
% author: Abhishek Gupta
% modified by: Adrian Saldanha
% Function test_function is only for visualization of test functions.
% For other optimization tasks, this function is invalid
function [range,dim,fobj,func_min... |
%{
Kevin Shebek
February 26, 2017
This code takes in the cosmic_count data obtained from Read_Images.m and
recalculates the statistics based on those.
Once question is, what constitutes a cosmic ray? This program gets rid of a
pixel where the value is >= some value.
%}
%Updated N values to account for subtracting
%... |
function D = LBCN_epoch_bc(fname,evt,indc,fieldons,twepoch,bc,fieldbc,twbc,prefix)
% Function to epoch the data, either raw signal or TF.
% Inputs:
% fname : name of the file to epoch
% evt : name of the file containing the event information
% indc : index of the categories to look at (default: all)
% fieldon... |
motorDynamics = xlsread('SingleMotorData.xlsx');
motorVoltage = motorDynamics ([3:11],1);%V
motorLift = motorDynamics ([3:11],2);%N
motorCurrent = motorDynamics ([3:11],3);%A
motorProp = motorDynamics ([3:11],4);%Rad/s
motorTorque = motorDynamics ([3:11],5);%N*m % Calculating Kf (Motor force-thrust constant)
c1=polyfit... |
function [ X1, X2, Y1, Y2 ] = discard_fp( X1,X2,Y1,Y2 )
%% Identifies motion vectors that are likeli to be incorrect alignments and discards those points
% Take avg motion vector and discard points whose vector points into
% the other direction
[x_vec,y_vec] = get_avg_movement(X1,X2,Y1,Y2);
count1 = length(X2);
%... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This is the main script for the optimisation unit. In this script, the
%%required variables are initialised, desired functions are called and the
%%optimisation is started and ended.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%Question 1
clc; clear;
R = (1:20);
R2 = (10:16)
S = [2;5;10;11;12;15];
%all of these are normalized by Vc1
dVH = (sqrt(2.*R./(1+R))-1) + sqrt(1./R).*(1-sqrt(2./(1+R))); %Hohmann
%Bi-elliptic transfer
dVBE = (sqrt(2.*R.*S./(1+R.*S))-1) + sqrt(1./(R.*S)).*(sqrt(2./(1+S))-sqrt(2./(1+R.*S))) +(sqrt(2*S./(R+R.*S))... |
function m = update_svm(m)
% Perform SVM learning for a single exemplar model, we assume that
% the exemplar has a set of detections loaded in m.model.svxs and m.model.svbbs
% Durning Learning, we can apply some pre-processing such as PCA or
% dominant gradient projection
%
% Copyright (C) 2011-... |
function [y,b,a]=allpass(x,g,d)
%This is an allpass filter function.
%
%The structure is: [y,b,a] = allpass(x,g,d)
%
%where x = the input signal
% g = the feedforward gain (the feedback gain is the negative of this) (this should be less than 1 for stability)
% d = the delay length
% y = the ou... |
R = 0.0001:0.0001:0.001;
I = 0.8;
V =(I.*R)
noise = rand(1,10)-0.5
Vnoise = V + noise/10000
plot(R,V)
%ylabel("Voltage/V")
%xlabel("Resistance/Ohms")
hold on
plot(R,Vnoise,'+')
hold off |
function info = tag()
info.nametag = 'push_rec_case2';
info.description = 'Even ground with holes. Do 1D planning given positions and size of the holes in the line where it moves.';
% Define how to execute the example
info.run = 'initial;abstraction;simulation;animation';
% Define how to execute the... |
function [ u ] = potential( a, b, x )
u = a * (x .^ 4) + b * (x .^ 2); |
function [ chromosome ] = mutation_bit( chromosome )
%MUTATION_POINT Function is make point mutation in chromosome
n = size(chromosome, 2);
rand_index = randi([1,n]);
if (chromosome(rand_index) == 0)
chromosome(rand_index) = 1;
else
chromosome(rand_index) = 0;
end
end
|
syms x(t) u(t)
Dx= diff(x,t);
D2x = diff(x,t,2);
u(t) = 1; % because we get when t >= 0
% (a)
% (i)
eqn = D2x + 7*Dx + 5*x == 8*u(t);
solve_diff(eqn, x, Dx, 0, 0, '(a)', '(i)');
% (ii)
solve_diff(eqn, x, Dx, 0, 3, '(a)', '(ii)');
% (b)
% (i)
eqn = D2x + 12*Dx + 15*x == 35;
solve_diff(eqn, x, Dx, 0, 0, '(b)... |
%
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPML115
% Project Title: Apriori Algorithm for Association Rule Mining
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
% Cont... |
% [i_notes_out]=mps_tree_get_cond_notes(ST,d_cond,i_note_in,i_level,i_notes_out)
function [i_notes_out]=mps_tree_get_cond_notes(ST,d_cond,cat,i_note_in,i_level,i_notes_out)
if nargin<3
cat=0:1:(length(ST{1}.count)-1);
end
if nargin<3, d_cond=[];end
if nargin<4,
i_level=0;
i_note_in=1;
end
if narg... |
% ADDLIFT primal または dual リフティングステップの追加
%
% LSN = ADDLIFT(LS,ELS) rは、リフティングスキーム LS に基本的なリフティング
% ステップ ELS を追加することにより、新しいリフティングスキーム LSN を
% 出力します。
%
% LSN = ADDLIFT(LS,ELS,'begin') は、指定した基本的なリフティングステップを
% 先頭に追加します。
%
% ELS は、つぎのセル配列 (LSINFO を参照) か、
% {TYPEVAL, COEFS, MAX_DEG}
% または、つぎの構造体 (LIFTFILT を参照)
... |
function dym_matlab2opencv(variable, MatrixName, fileName, flag, varClass)
% varClass: the variable class waiting for write:
% 'i': for int
% 'f': for float
% flag : Write mode
% 'w': for write
% 'a': for append
[rows, cols] = size(variable);
% Beware of Matla... |
%
% Jessica Barends
% KT3800
% 14-05-2018
close all; clear all; clc
%% parameters uit bestand 'art-ven onderzoek'
% nummer 1, arterieel
% apHpl = 7.486; %pH in plasma
% apCO2 = 5.23 * 7.50062; %partial pressure CO2 [from kPa to mmHg]
% apO2 = 10.0* 7.50062; %partial pressure O2 [from kPa to mmHg]
% aT = 37; %tempera... |
% first run Figure11aStaggeredFDTra.m,figure11bStaggeredFD.m,figure11cKspace to get seismic records,
% then run figure11compareSeimogramsVz.m, Figure11CompareSeis_recordVz.m; figure12compareSeimogramsTxx.m,figure12CompareSeis_recordTxx
% to get the figures in figure 11 and figure 12.
% This is only for the convenien... |
ax = axes('XLim',[-1.5 1.5],'YLim',[-1.5 1.5],'ZLim',[-1.5 1.5]);
view(3)
grid on
[x,y,z] = cylinder([.2 0]);
h(1) = surface(x,y,[1:size(x,2);1:size(x,2)],'FaceColor','red');
%h(2) = surface(x,y,-z,'FaceColor','green');
%h(3) = surface(z,x,y,'FaceColor','blue');
%h(4) = surface(-z,x,y,'FaceColor','cyan');
%h(5) = surfa... |
%-------------------------------------------------------------------------------
% holm_p_correction: Apply procedure to correct for multiple comparisons (more
% statistical power compared with Bonferroni procedure) [1]
%
% Syntax: [p_adj]=holm_p_correction(p_values,alpha)
%
% Inputs:
% p_values - vector of p-valu... |
load DCE_MRI.mat;
sx=size(C_t,1);sy=size(C_t,2);sz=size(C_t,3);st=size(C_t,4);
vp=ktrans=kep=converged=zeros(sx,sy,sz);
diff_t=mean(diff(t));
maxit = 1000;
Cp=AIF';
J=zeros(st,3);
integral=dintegral=Ct_k=zeros(st,1);
if(size(t,2)>size(t,1))
t=t';
end
its=0;
fftCp=fft(Cp,64);
printf('Starting calculation...\n');
fflus... |
function calcVoceTheta0Theta1
close all;
marker = ['o';'p';'v';'s';'d';'^';'h';'<';'x';'>';'+';'*'];
color = [[0.90 0.10 0.10];[0.10 0.90 0.10];[0.10 0.10 0.90];...
[0.75 0.25 1.00];[1.00 0.75 0.25];[0.15 0.30 0.70];...
[0.10 0.80 0.30];[0.25 0.75 1.00];[0.66 0.60 0.00];...
... |
figure('Name','lever arm','NumberTitle','off','Units','normalized','Position',[0 0 1 1]);
x = [1 2 3 4 5];
hig = [h1 h2 h3 h4 h5];
w1 = 0.5;
bar(hig,w1,'FaceColor',[0.2 0.2 0.5])
hck = [h1c h2c h3c h4c h5c];
w2 = .25;
hold on
bar(hck,w2,'FaceColor',[0 0.7 0.7])
hold off
grid on
ylabel('Lever Arm(m)')
le... |
function L = minquad(K) % funzionale da minimizzare
%
% L = minquad(K)
%
% Definisco il funzionale L da minimizzare
%
% INPUTS:
% K : incognita
%
% OUTPUTS:
% L : funzione minimi quadrati
%
global x0 tm ym Nass t_0 t_u pnt
SI = @(t,x) [-K(1)*x(1)*x(2); K(1)*x(1)*x(2) - K(2)*x(2)]; % risc... |
clc
clear
%% Reading Text Files
fileID1=fopen('BASELINE_F3.txt','r'); %reading baseline
tline1=fgetl(fileID1);
baseline=cell(0,1);
while ischar(tline1)
baseline{end+1,1}=tline1;
tline1=fgetl(fileID1);
end
fclose(fileID1);
fileID2=fopen('intflistF3.txt','r'); %reading intflist
tline2=fgetl(file... |
clear
example=7;
switch example
case 1
% 实验1
x=0:0.005:1-0.005;
f=90./(1+exp(-100*(x-0.5)));
% M=length(x);%采样点个数
% N=32;%基函数个数
xmax=1;
case 2
% 实验2 尖锐特征
x=0:0.002:1-0.002;
f=100./exp(abs(10*x-5))+(10*x-5).^5/500;
% ... |
function dcm = mth_rotx(alpha)
% MTH_ROTX creates a DCM that performs a reference frame transformation about
% the x-axis by the angle alpha
%
% Input:
% alpha Rotation angle, radians
%
% Return:
% dcm Direction cosine matrix, [3x3]
%
% Kurt Motekew 2014/10/19
%
ca = cos(alpha);
sa = sin(alpha);
dcm... |
%% Geometric spacing ratio's convergence test (Analysis purpose only)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script file perform an analysis on effect of geometric spacing ratio
% on the convergence of the 2D problem. Initially, it solves for the
% uni... |
function tst11()
% x=[4110.,4500.,7400.,9045.; 4750.,5400.,8850.,10900.; 5100.,6100.,10200.,12750.; ...
% 5900.,7300.,12400.,15650.; 6700.,9200.,14500.,18400.];
% y=[1.2,1.18,1.,0.87; 1.4,1.28,1.12,0.88; 1.5,1.47,1.23,0.95; ...
% 1.7,1.66,1.39,1.08; 1.9,1.85,1.5,0.91];
% z=[5000.,5000.,5000.,5000.; 6000.,6000.,600... |
function A = GCC_A(rawdata, numVrec, calsize,correction)
% Coil compression matrix calculation
% Input:
% rawdata (kx,ky,kz,coil)
% numVrec: number of virtual coils
% calsize: size of the calibration region
% correction: whether to perform the alignment
if nargin < 3
calsize = 24;
end
if nargin < 4
correcti... |
% Construct the graph with the maximum possible s-metric, given the degree
% sequence; the s-metric is the sum of products of degrees across all edges
% Source: Li et al "Towards a Theory of Scale-Free Graphs"
% INPUTs: degree sequence: 1xn vector of positive integers
% OUTPUTs: edgelist of the s-max graph, mx3
% Other... |
function [clustInd,clustCent]=Bisecting_kmedoid(data,k)
%Similar to bisecting k-means but instead of using average point as
%centroid use member of the cluster as centroid.
%Written by: Maureen Murage
%Algorithm:
% 1. Start with all data in one cluster
% 2. Bisect the cluster into two clusters
% 3. Bisect each clus... |
function WF=read_cal20_wf
csv_file='/home/ben/Dropbox/projects/IS2_ATBD/Pulse_shape_TEP_cal20/6_CAL_20_PRIM_L1_MODE6_2017130_c_M.csv';
[~, out]=unix(['head -71 ', csv_file,' | tail -1']);
out=strsplit(deblank(out),',');
for k=3:length(out)
WF.p(k-2)=str2num(out{k});
WF.t(k-2)=2.5e-11*(k-2);
end
WF.t=WF.t-sum(... |
clc
close all
clear all
DataLog = xlsread('J:\Research\Data\CalibrationTank\OpticalParticleCounters\DATA\GoodData\TestLog.csv')
% Pretest1 = xlsread('J:\Research\Data\CalibrationTank\Pretest1(FromAmbientToZero)_1-24-18.csv');
% Test1 = xlsread('J:\Research\Data\CalibrationTank\TEST1(LB5)_1-25-18.csv');
% Test2 = xlsre... |
% Compute the total degree, in-degree and out-degree of a graph based on
% the adjacency matrix; should produce weighted degrees, if the input matrix is weighted
% INPUTS: adjacency matrix
% OUTPUTS: degree, indegree and outdegree sequences
% GB, Last Updated: October 2, 2009
function [deg,indeg,outdeg]=computeDegrees... |
% #########################################################################
% TUHH :: Institute for Control Systems :: Control Lab
% #########################################################################
% Experiment CSTD1: Identification and Control of a Torsional Plant
%
% Copyright Herbert Werner and Hamburg... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% _ _ _ %
% | | __ _ _ __ ___ | |__ _-(")- %
% | | / _` | '_ ` _ \| '_ \ `%%%%% %
% | |__| (_| | | | |_| | |_) | _ // \\ %
% |_____\__,_|_| |_| |_|_.__/_| |__ ___ %
% | | / _` | '_ \/ __| %
% ... |
function fPP = pairProduction(E)
% fPP = pairProduction(E)
% returns the value of the energy-dependence of the pair production
% effect (which approximated by ln(E/E_rest)).
%
% E photon energy (in keV)
% fPP value of the Klein-Nishina function (dimensionless)
E_rest = 1.022e3;
fPP = (E > E_rest) .* log(E./E_re... |
%% Opdracht 2
% Druk m.b.v. een while-lus de getallen 15 tot en met 105 af in het Command
% Window. Gebruik hiertoe de variabele genaamd 'teller'.
% Als je een eeuwige lus maakt (een lus die niet stopt) krijg je nul punten
% voor deze opdracht.
teller = 15;
while teller < 105 || true
teller = teller + 1;
end |
function C = cov_sqexp(z,sigma2,tau2,phi)
C = zeros(size(z,1));
for i = 1:size(z,2)
D=pdist(z(:,i));
t=squareform(D);
C = C-(t.^2)./phi(i);
end
C = sigma2*exp(C);
C(C==sigma2) = sigma2+tau2;
end
|
function MyPlot(File,res,t)
N=size(res,1);
for p=1:N
for q=1:N
if res(p,q)==0
res(p,q)=9999;
end
end
end
index = find(res==min(min(res)),1);
i=ceil(index/N);
j=rem(index,N);
for n=1:size(File,1)
[P,tA] = LoadData(File(n,:));
Px = P(1,:);Py=P(2,:);
if j==0
... |
%{
sdp_id: int # unique id for spike detection parameter set.
-----
threshold: float # thresold for spike detection
%}
classdef SpikeDetectionParam < dj.Lookup
properties
contents = {
0, 0.5
1, 0.9
2, 2.0
}
end
end |
% Obtain non-uniform samples from uniformly sampled data
%Input
% uX : p * len
% mlen: (original) sample length of each trial (sample window size)
% slen: length of resample data
%Output
% mX: p * slen * n_trials
% mT: slen * n_trials
function [mX, mT] = SampleNonUnif(uX, mlen, slen, smode, more_trials)
n_trials =... |
% Q:- 3 (a)
w=[-100:100]*pi/100 ;
H=0.19*ones(size(w))./(1.81-1.8*cos(w));
magnitude=abs(H);
phase=angle(H)*180/pi;
subplot(2,1,1);
plot(w/pi, magnitude);
subplot(2,1,2);
plot(w/pi ,phase);
% Q:- 3 (b)
[h1,n1] = stepseq(-20,-20,20);
[h2,n2] = stepseq(20,-20,20);
[h3,n3] = sigadd(h1,n1,-h2,n2);
n = n3;
h = sinc(0.2*... |
function [h] = tls_find_h(tau, K)
%TLS_FIND_H Finds the annihilating filter given a signal tau, by TLS.
% For a given tau[m] = sum_{k=0}^{K-1} a_k t_k^m, find the filter
% coefficients, h[m], that when convolved with tau[m] produce zero
% output. The method used to find this filter is the Total Least Squares
% ... |
function hist= hist_8directions(image)
hist=zeros(1,8);
nb=0;
edge1=edge(image);
width=size(image,1);
height=size(image,2);
for x=1:width
for y=1:height
if(edge1(x,y))
for i=0:7
myX=x+xC2(i);
myY=y+yC2(i);
if((myX>=1)&&(myX<=width)&&(myY>=1)&&(myY... |
function [ Angle ] = Truncated_Normal( theta, delta_t, sigma )
Sig = sigma * sqrt(delta_t);
pd=makedist('Normal','mu',theta,'sigma',Sig);
t=truncate(pd,theta-pi,theta+pi);
Angle=random(t,1,1);
end
|
% Funcion encargada de cargar los archivos de datos
function [ind,coord,aristas,costos,delays] = carga(nodosFileName,aristasFileName)
%cargo los archivos
n=int32 (load (nodosFileName));
if size(n)(2)!=3
error ("Archivo de nodos debe tener 3 columnas");
endif
a=int32 (load (aristasFileName));
if... |
function [m_CTHomog,m_SigmaHomog,hvar_newMacro,vectVHElem_new] = f_RMap_MEBcna(...
m_IDefMacroReg,hvar_oldMacro,...
e_DatMatSetMacro,condBif,e_VGMacro,vectVHElem_old,kinf)
%Se recupera variables micro
xx = e_DatMatSetMacro.xx;
u = hvar_oldMacro.u;
omegaMicro = e... |
function [] = generatePascalImageAnnotations()
%GENERATEIMAGEANNOTATIONS Summary of this function goes here
% Detailed explanation goes here
% Declaring global variables
globals;
% Add to path the directory containing helper functions released by PASCAL
% VOC people
addpath(fullfile(pascalDir,'VOCcode'));
% Class ... |
% function [GtCorrsRefImgStorer] = GTImgFinder(refImgNm,featureFunc,nomalizeFunc,heightMatter)
% dirOutput = '/Volumes/Macintosh_HD_2/Word Spotting Dataset/Dataset_CESR/Grouped_Images_3/Binary_4/';
% refImag{1,1} = refImgNm;
% disp(refImgNm);
% GtCorrsRefImgStorer = cell(length(refImag),3);
% for refCnt = 1:1:length(re... |
%% Transmission.m
% Performs one transmission of the experiment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Setup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Turn of warnings on obsolte functions
warning('off','comm:obsolete:rcosine');
warn... |
%%
close all;
clear;
clc;
%% sample CRM from model 1
alpha = 1000.0;
sigma = 0.2;
c = 2.0;
tau = 3.0;
T = 1e-10;
W = Model1rnd(alpha, sigma, c, tau, T);
fprintf(1, 'W has %d atoms\n', length(W));
%% sample partitions
n_list = [10^4, 10^5, 10^6, 10^7, 10^8, 10^9, 10^10];
for i = 1:length(n_list)
csize{i} = csizern... |
%plot priors with marginal historgram
subplot(2,2,1)
h = histogram(theta_chain(iter_start:k,1));
hold on
xgrid = min(theta_chain(iter_start:k,1))*.75:.01:max(theta_chain(iter_start:k,1))*1.25;
yval = exp(super_tau0_logprior(xgrid));
norm_y = yval/max(yval);
plot(xgrid,yval/norm_y * max(h.Values))
hold off
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.