text stringlengths 8 6.12M |
|---|
function value = r8_ceiling ( x )
%*****************************************************************************80
%
%% R8_CEILING rounds an R8 "up" (towards +oo) to the next integer.
%
% Example:
%
% X Value
%
% -1.1 -1
% -1.0 -1
% -0.9 0
% -0.1 0
% 0.0 0
% 0.1 ... |
classdef (Sealed = true) expParam < qes.qHandle
% Experimental paramter
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
val % value of the experimental parameter
% value offset, the real value is offset+val
... |
% clear;
function [optParams, obj] = fitModel(M, rightVec, defaultParams, EAAfreq, outfile, paramsUsage, lambda)
naa = 20;
nc = (size(M, 2) - naa)/(naa * naa);
assert(round(nc) == nc, 'could not figure out the number of contacts');
np = size(M, 2);
exclCols = find(paramsUsage == 0); % excluded columns
optParams = def... |
% clear all;
% clc;
%% gallery
% fid = fopen('./TIFS_SI-2014_protocols/still_gallery.txt');
% line = fgetl(fid);
% fid_out = fopen('lfw_openset_gallery.txt', 'wt');
%
% while ischar(line)
% temp = regexp(line, '/', 'split');
% if length(temp) == 3
% line = fgetl(fid);
% continue;
% end
% ... |
classdef nconv2d < ndg_lib.phys.phys2d
%NCONV2D two dimensional nonlinear convection problem.
% Detailed explanation goes here
properties(Constant)
Nfield = 1 % 变量个数
end
properties
ftime % 计算终止时间
dt % 计算时间步长
end
%% 私有函数
methods(Access=prot... |
function vars = hh_2010_data(validate_data, visualize_data)
%
if ~exist('validate_data', 'var'), validate_data = true; end;
if ~exist('visualize_data', 'var'), visualize_data = false; end;
HH_2010_dirpath = fileparts(which(mfilename));
HH_2010_dirname = guru_fileparts(HH_2010_dirpath, 'name');
HH_... |
function net_hesaplama(cevap_anahtari,ogrenci_kagidi)
cevap_anahtari=imread(cevap_anahtari);
ogrenci_kagidi=imread(ogrenci_kagidi);
maske1=cevap_anahtari<100; %100 değerinin altındaki pikseller sıfırlanıyor
maske2=ogrenci_kagidi<100;
[etiket, toplam_soru_sayisi] ... |
clear;
clc;
close all;
A11 = zeros(20, 16);
A12 = zeros(20, 16);
A21 = zeros(20, 16);
A22 = zeros(20, 16);
A11(1, :) = [0, 12, 0, 24, 0, 151, 0, 9, 0, 53, 0, 18, 0, 202, 0, 36];
A12(1, :) = [176, 239, 352, 431, 392, 409, 351, 359, 307, 329, 207, 281, 399, 457, 247, 261];
A21(1, :) = [99, 130, 198, 260, 215, 282, 48, ... |
classdef CLASS_CR_INTERFACE_Refine < handle
properties
% Inputs
RefinementConfig=[];
end
properties (SetAccess = protected, GetAccess = public)
% Outputs
DiffractionPattern=[];
DiffractionPattern1D=[];
PatternCenter=[];
Shift=[0 0];
end
... |
function [theta, gtheta] = thetaConstrain(theta, gtheta)
% THETACONSTRAIN Prevent kernel parameters from getting too big or small.
minTheta = 1e-6;
maxTheta = 1/minTheta;
if any(theta <= minTheta)
theta(find(theta<=minTheta)) = minTheta;
if nargin > 1
%gtheta(find(theta<=minTheta)) = 0;
end
end
if any(th... |
y_f = 10;
m = 1;
p = 0.1;
tspan = [0, 30];
y_0 = [0; 00];
optimize(y_f, m, p, tspan, y_0);
% запишем уравнение движения в виде системы
% y_1 = y
% y_1' = y_2
% y_2' = u/m - p*y_2/m = k_1/m(y_1 - y_f) + k_2/m*y_2 - p*y_2/m =
% = y_1*k_1/m + y_2*(k_2 - p)/m - k_1*y_f/m
% получаем
% y_1' = y_2
% y_2' = y_1*k_1/m + y... |
function FS_PreMotor_trace_comp(Cal, Alp)
figure();
hold on;
for iii = 1:size(Cal,2);
counter = 1;
shift = 10;
calcium = Cal{iii};
for cell =1:size(calcium,2); %[16 23 25 41 4 10 11 14 15 19 26 36 37 48 49];% [16 25 33 36 37 41 56 59]%1:size(calcium,2); %[16 25 33 36 37 41 56 59] %[6 14 15 17 19 35 38 53]
G = calc... |
clear all; close all; clc;
line_widht = 2;
%% Input
data = load('../data/data_real_backward_gate.lvm');
u = data(:, 2); % Set Point
u_pid = data(:, 4); % Acción de control PID
y_backward = data(:, 6); % Backward
tu = data(:, 1);
tye = data(:, 1);
tyb = data(:, 1);
figure; hold on;
plot(tu, u, '--r', 'LineWidth', lin... |
%-----------------------------------------------------------------------
% Job saved on 01-Aug-2014 20:39:27 by cfg_util (rev $Rev: 5797 $)
% spm SPM - SPM12b (5889)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
matlabbatch{1}.spm.util.defs.comp{1}.dartel.flowf... |
pkg load symbolic
function [vec_aprox, iter] = gradiente_conjugado(str_funcion, variables, vector, tol, regla_bk)
% Funcion que implementa el metodo de gradiente conjugado
% :param str_funcion: string con la funcion que se debe evaluar
% :param variables: lista con las variables de la ecuacion
% :param vec... |
function [snr] = compute_snr(cloud, mse)
s = mean(sum(cloud.Location .^ 2, 2) .^ 0.5);
snr = 10.0 * log(s / mse);
end
|
function pattern = DotPattern(scaledValue)
%DotPattern returns a specific pattern equivalent to a pixel value ranking
% input: a pixel ranking/scale from 0 to 9
% output: a pattern to be applied/generated
switch scaledValue
case 0
pattern = [0 0 0; 0 0 0; 0 0 0];
case 1
pattern = [0 1 0; 0 0 0; 0 0 0];
case... |
classdef EngineGuidAlt < EngineGuidRate
properties (Access = protected)
% New state scalars
t0;
prevalt;
end
methods (Access = protected)
function [val, ter, sgn] = event(self, t, sc, pl)
% Call superclass method
[val, ter, sgn] = event@EngineAero(self, t, sc, pl);
if ~self.bank && self.count == 1... |
clear all, % close all
clc
load subbands_AlGaN_401.mat % 401 kpoints
%load subbands_InGaN_201.mat
%
Q=1.6022e-019; % elementary charge, C
h=6.63e-34; % Plank constant, J*s
hbar=h/(2*pi); % reduced Plank constant, J*s
M0=9.10938188E-31; % electron mass, kg
%
num_kvectors = length(k... |
function dist = DTW(t,r)
% Dynamic time warping (DTW) is a typical optimization problem
% Its essence is a method to measure the similarity of two time series with different lengths
n = size(t,1);
m = size(r,1);
% Frame matching distance matrix
d = zeros(n,m);
for i = 1:n
for j = 1:m
d(i,j) = sum((t(i,:)-r(... |
function [ decision ] = face_check_cnn( img, shape, global_params, cnns )
%FACE_CHECK_CNN Summary of this function goes here
% Detailed explanation goes here
%%
if(size(img,3) == 3)
img = rgb2gray(img);
end
% first need to determine the view
centres = cat(1, cnns.centres);
dists = centres*pi/180 - repmat(global... |
% Théorie Qualitative des Systèmes Dynamiques
% *******************************************
% Travaux Dirigés : séance 1 (partie 2/2)
% ---------------------------------------
% Prenez comme valeurs de paramètres sigma = 10, rho = 28, beta = 8/3.
% A nouveau, représentez l’évolution du système dynamique pour des cond... |
addpath('./MatlabTools/')
addpath('../')
states = nlightbulb_problem.mdp.states;
nr_states=size(states,1)-1;
S=states(1:nr_states,:);
nr_arms = size(states(1,:),2)/2;
valid_states = [1:nr_states]';
s_vstates = size(valid_states);
n_vstates = s_vstates(1);
%% Fill in the VOC1
Q_star=nlightbulb_problem.mdp.Q_star;
pi_... |
function letter=readLetterV2(Bloco,holes)
load NewTemplates %%Carrega os templates
Bloco=imresize(Bloco,[42 24]); %%Normaliza a imagem
% figure
% imshow(Bloco);
comp=zeros(length(NewTemplates),2);
for n=1:length(NewTemplates)
sem=corr2(NewTemplates{1,n},Bloco); %Correlaçao da imagem com os templates
comp(n,1)=n... |
% Prepare to sample a signal for two seconds,
% at a rate of 100 samples per second.
close all;
clear all;
clc;
Fs = 100; % Sampling rate
t = [0:2*Fs+1]'/Fs; % Time points for sampling
x = sin(2*pi*t) % Create the signal, a sum of sinusoids. ... |
function addDataToWatchSurface(h, moteID, data)
%addDataToWatchSurface(h, moteID, data)
%
%This function takes the handle of a plot window and an array of data and adds the data to the plot.
%This is a surface plot, which is presumed to be the plot of multiple motes and a single point in time.
%The data parameter shoul... |
%
% Plot a mesh specified in an SMF file
%
% -----------------------------------------------------
% Richard Zhang (c) 2016
%
function plot_smf(F, X)
trimesh(F, X(:,1), X(:,2), X(:,3), 'EdgeColor', [0.3 0.3 0.3], ...
'FaceColor', [0.8 0.8 0.8], ...
... |
%% --------
% QC_01_06_TimeHistogram(MeasCat)
% Time Histogram
% Input: MeasCat - Measured catalogue
function QC_01_06_TimeHistogram(MeasCat, varargin)
close all
if ~isnumeric(MeasCat)
error('Load catagoue in the correct format (see readme for description)')
end
PlotLimits = cell2mat(varargin);
%% definitio... |
classdef rotation_matrix_from_quat_test < matlab.unittest.TestCase
methods (Test)
function identity(testCase)
testCase.verifyEqual(rotation_matrix_from_quat([1; 0; 0; 0]), eye(3));
end
function test(testCase)
t = 0.1;
mz = [cos(t), -sin(t), 0;
... |
function makeLDAclassifier(filename)
global P300classifier
load(filename);
samplefreq=64;
triallength=800;
NrOfChannels=size(y,1)-3;
%% Downsample to 64 Hz
tmp=y;
clear y;
for ii=1:size(tmp,1)
kk=2;
for jj=1:4:size(tmp,2)-3
meantmp=tmp(ii,jj:jj+3)';
y(ii,kk)=mean(meantmp);
kk=kk+1;
... |
load('toyHorse1.mat');
load('toyHorse2.mat');
Ri = calculR(I1,15);
Rj = calculR(I2,15);
Rfi = post_processing(Ri,100);
Rfj = post_processing(Rj,100);
figure();
subplot(2,3,1);
imagesc(I1);
subplot(2,3,2);
imagesc(Ri);
subplot(2,3,3);
imagesc(Rfi);
subplot(2,3,4);
imagesc(I2);
subplot(2,3,5);
imagesc(Rj);
subplot(2,3... |
clear; close all; clc
input_layout_size = 9;
% 9ます + pass
output_layout_size = 10;
fprintf('try by small number of training\n')
load('smallx.txt');
smallx = smallx';
load('smally.txt');
smally = smally';
[J, grad1, grad2] = costFunction(rand(15, 10) + 2, rand(9, 16) + 1, smallx, smally, 0);
J;
grad1;
grad2;
fprintf... |
function showBinnigErrorMap( spectrum, BinSizes, Phis, Thetas, w )
% show error map of spectrum binning for different thickness of materials
n = 64;
BinSizes = BinSizes(:);
Phis = Phis(:);
Thetas = Thetas(:);
photonsPerEnergyBin = spectrum.photonsPerEnergyBinOriginal * spectrum.DQE;
[phis, thetas,... |
function sen_coor=sen_adjust(D,micr_N,F,v,sen_N)
%D=4;主透镜直径
%micr_N=200;微透镜个数
%lens_d=D/micr_N;微透镜直径
%sen_N=20;每个微透镜后的像素个数
%sen_d=lens_d/sen_N;微透镜直径
%F=16; 焦距
%v=16; 微透镜位置
lens_d=D/micr_N;%微透镜直径
sen_N_total=micr_N*sen_N;%总的传感器个数
sen_d=lens_d/sen_N;%传感器直径
lens_v=F/D*lens_d;%微透镜与传感器距离
sen_v=lens_v+v;%传感器位置
y_edge=zero... |
clear all
close all
files = dir('results/figs');
files = files(3:end);
for i = 1:length(files)
name = sprintf('%s//%s',files(i).folder,files(i).name);
fig = openfig(name);
newname = split(files(i).name,'.');
newname = newname{1};
saveas(gcf,sprintf('results/figs/%s.eps',newname),'epsc');
close a... |
function Out = extractVariables_MD( SMD_mix )
%%
CMI = @(X,Y) (X-Y)./(X+Y);
goodT = @(X) find(~cellfun(@isempty,X));
bin = 0.01;
filtWidth = 0.05;
pre = 0.2;
post = 1.8;
%%
ct = 0;
for i = 1:numel(SMD_mix)
% try
clear C1 C2 R1C1 R2C1 R1C2 R2C2 spikeRateR1C1 spikeRateR2C1 spikeRateR1C2 spikeRateR2C2... |
function [A, B, varargout] = sxrepmat(A, B, varargin)
%SXREPMAT Resizes dimensions of arrays to match one another by singleton
%expansion.
% [A, B, ...] = SXREPMAT( A, B, ... ) replicates A, B, and all other
% inputted arrays along their singleton dimensions so that they match in
% size.
assert(nargin >= nargout... |
function [res] = Euler(initVal, h)
%Eular method
f = @(x, y)(2*x/(3*y*y)); %f(x,y)
res = zeros(11,1);
res(1) = initVal;
i = 2;
for x = 0:h:(1-h)
res(i) = res(i-1) + h*f(x,res(i-1));
i = i + 1;
end |
function [matches] = KeypointMatching(descriptor1, descriptor2)
[kIdx, desc1Count] = size(descriptor1);
[kIdx, desc2Count] = size(descriptor2);
matches = [];
iMatches = [];
jMatches = [];
% Find matches for descriptor 1
for i = 1 : desc1Count
... |
classdef Engine2<handle
%Performs the actucal stepping of the model though time and provides
% helper functions for viewing the model and extracting model data
properties
field; %The field in which the cell exist
fieldView; %Draws a GUI view of the model
modelSta... |
O = 561; % Number of coefficients in a vector
M = 2; % Number of mixtures
Q = 6; % Number of states
% num of sequences - per person
% length of each vector - per sequence
% initial guess of parameters
prior = normalise(rand(Q,1));
transmat = mk_stochastic(rand(Q,Q));
cov_type = 'full';
[... |
% Move the frequency 0 to the center
% i.e. from [0 1 2 3] to [-2 -1 0 1]
% S is len*p*p matrix
[S_np, fq_np] = fftFreq2seqFreq(S, freq)
N = length(freq);
df = freq(2)-freq(1);
fq_np = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ];
S_np = fftshift(S,1);
|
function red_data = compute_reduced_data(m,d)
for i=1:size(d.AII1,2)
red_data.ANII1{i} = d.RB1'*d.AII1{i}*d.RB1;
red_data.ANGI1{i} = d.RBG1'*d.AGI1{i}*d.RB1;
red_data.ANIG1{i} = d.RB1'*d.AIG1{i}*d.RBG1;
red_data.ANGG1{i} = d.RBG1'*d.AGG1{i}*d.RBG1;
end
for i=1:size(d.AII2,2)
red_data.ANII2{i} = ... |
% joinLimit, outputAudiosLength, mdbAddress, datasetFolder --> params.mat;
mlist = dir(fullfile(mdbAddress , '!*'));
if( exist(datasetFolder,'dir') )
rmdir(datasetFolder,'s')
end
totalSpeech = 0; %seconds
totalNonspeech = 0; %seconds
mkdir(datasetFolder,'audio files');
outputFolder = fullfile(datasetFolder,'audi... |
function lines = CS5320_Hough_lines(im,H,thresh)
% CS5320_Hough_lines - produce mask with lines
% On input:
% im (mxn array): gray level image
% H (rxt array): Hough accumulator (from CS5320_Hough)
% thresh (int): minumum number of votes for line
% On output:
% lines (mxn array): lines mask (gray... |
datadir='../test_data'; % directory where the data files reside
dataset={'veranda'};
datachar='abcdefghijklmnopqrstuvwxyz';
Rows=64; % all images are 64x64
Cols=64;
n=length(dataset)*length(datachar); % total number of images
p=Rows*Cols; % number of pixels
TX=zeros(p,n); % images arranged in columns of X
k... |
function s = cripto_shamir_zippel(cpubl, mu)
%cripto_shamir_zippel - Description
%
% Syntax: s = cripto_shamir_zippel(cpubl, mu)
%
% Funcion que permite criptoanalizar una mochila trampa conocido
% el modulo de trabajo
%
% Entradas: cpubl: mochila trampa
% mu: modulo de trabajo
%
% Salida: la mochila supercr... |
clear variables;
N = 10000;
% y = LancerDeSixFace(N);
% [h, xout] = hist(y, 1:6);
% bar(xout, h);
%jeu A
p = 0;
for k = 1:N
y = LancerDeSixFace(4);
[h, xout] = hist(y, 1:6);
if h(6) > 0
p = p + 1;
end
end
probA_exp = p / N
probA_theo = 1 - ( (5/6)^4 )
%jeuB
p = 0;
for k = 1:N... |
function I2=rgv_hsv(I)
I1=double(I);
R=I1(:,:,1);G=I1(:,:,2);B=I1(:,:,3);
[m,n]=size(R);
H=zeros(m,n);S=zeros(m,n);V=zeros(m,n);
xiao = min(min(R, G), B );
da = max(max( R, G), B );
V = da;
delta=da - xiao+1;
if da~=0
S = delta ./da;
else
S=0;
end
for i=1:m
for j=1:n
if( R(i,j) == da(i,j) )
... |
% wrapper for ccnl_create_spherical_mask.m
% These lines are for sanity checking the conversion - change numbers to
% cor
[V, Y] = ccnl_extract_clusters(optCon_expt(), 6, 'RPE', 0.001, '+', 0.05, 20, 3);
%Y(35,60,31)
r = 10/1.5; % radius (divide by voxel size)
[mask, Vmask, Ymask] = load_mask('masks/mask.nii'); % l... |
function [modes] = get_segment_mode(image, labels)
modes = zeros(rgn_cnt,3);
for m = 1:rgn_cnt
dim = size(find(labels == m), 1);
hist = zeros(dim,3);
k = 1;
for i = 1:imH
for j = 1:imW
if (labels(i,j) == m)
hist(k,:)... |
function obstacle(h, distance)
sensorsCurrentValues = [0;0;0;0;0;0;0;0];
calibrated=[3500,5;3900,5;3700,5;3900,5;3900,5;4000,5;4000,5;4000,5];
c=bar(sensorsCurrentValues);
while(1)
sensorsReadings = kProximity(h);
sensorsReadings2 = kProximity(h);
for i=1:1:8
mn=calibrated(i,:);
m... |
PFsimul = @PAL_CumulativeNormal;
trueParams = [0 2 0.5 0.01];
alphas = linspace(0,180,4000);
prior = PAL_pdfNormal(alphas,0,400); %Gaussian
%%
%Termination rule
stopcriterion = 'trials';
stoprule = 20;
%Function to be fitted during procedure
PFfit = @PAL_CumulativeNormal; %Shape to be assumed
beta = ... |
function [predW, trainErrorClass, trainErrorMSE, testErrorClass, testErrorMSE] = linearRegression(featuresTrain, QualityTrain, featuresTest, QualityTest)
%% TRAINING
predW = pinv(featuresTrain)*QualityTrain; %weights
predQual = round(featuresTrain*predW); %predicted quality
errorVec = predQual... |
% Create parpool of desired size
poolobj = gcp('nocreate');
if isempty(poolobj)
poolobj = parpool(min(length(names),8));
else
if poolobj.NumWorkers > length(names)
delete(gcp('nocreate'));
poolobj = parpool(min(length(names),8));
end
end
uArena{length(names)} = {};
simT{length(names)} ... |
%s1='IMG_000';
s1='IMG_00';
for filen = 10:72
str = int2str(filen);
s3 = strcat(s1,str);
filename= strcat(s3,'.tif');
m=imread(filename);
mkdir('C:\data\',str)
imgDir = strcat('C:\data\',str);
%1st one all
c1=m(315:1995,5:1145);
writefile = fullfile( imgDir, '1.png');
... |
function [flag] = symmetry_check(p_x,p_y, x, y)
flag=1;
n=length(p_x);
for i = 1:n
if (abs(p_x(i) - x(n-i+1))>0.00001)
flag =0;
break
end
if (abs(p_y(i) - y(n-i+1))>0.00001)
flag =0;
break
end
end
end |
function names = formatstrForTable(names)
%If a table is exported with feature names as variables names, the names may not be MATLAB compliant. Use this function to ensure a valid MATLAB table is created.
% Alternatively, just export the names separately, or pivot the table into a long/vertical data shape.
%
%Repla... |
%generate classes from training data and tesing it against the test data
%read test videos
path='C:\Users\Rohit Singh\OneDrive\MSCS\Fall 2018\CS6640 Image Processing\Assignments\A7\';
video1=VideoReader(strcat(path,'Videos\bus1.avi')); %training data
video2=VideoReader(strcat(path,'Videos\bus2.avi')); %training dat... |
function [X, YXVec, dbStd] = fmse(this, time, varargin)
% fmse Forecast mean square error matrices.
%
% Syntax
% =======
%
% [F,List,D] = fmse(M,NPer,...)
% [F,List,D] = fmse(M,Range,...)
%
% Input arguments
% ================
%
% * `M` [ model ] - Model object for which the forecast MSE matrices w... |
function [result] = GetGaussNoiseImage(sizeX, sizeY, std)
result = randn(sizeX, sizeY);
result = result * 255/std;
result = uint8(result);
end |
F = 50;
t = 0:0.001:0.2; %declat t
t1=0:0.01:0.2; %modific pasul de variatie a variabilei t la 0.01
t2=0:0.0002:0.2; %modific pasul de variatie a variabilei t la 0.0002
s = 2*sin(2*pi*F*t); %declar semnalul sinusoidal s
s1= 2*sin(2*pi*F*t1); %declar semnalul sinusoidal s
s2= 2*sin(2*pi*F*t2); %declar semnalul si... |
function [EP,BETA,R,J,COVB,MSE] = nonlinear_ls_obj(P,DCM)
% System identifcation by nonlinear least squares
%
% [EP,BETA,R,J,COVB,MSE] = nonlinear_ls_obj(P,DCM)
%
% AS
global DD
DD = DCM;
DD.SP = P;
P = spm_vec(P);
V = spm_vec(DCM.M.pC);
ip = find(V);
cm = zeros(length(V),length(ip));
% make and sto... |
function [stitched_image] = conc( shift_final, image1, image2)
% this function concatenate the two image using the shift_final output from
% the stitch2 function
Y = size(image2,2);
X = size(image1,1);
cons = shift_final(1,2);
% removing the coloums that is repeated in image2
for k = 1:size(image2,2)
if (k > con... |
clear
% Maximum mesh size (logscale)
pmax=15;
% Mesh size
h=1. ./ (2.^(1:pmax));
% Allocation of the error vector
error = zeros(size(h));
for p=1:pmax;
% Get back the discrete problem datas
[xh, Lh, fh] = a03ex04getBVP(p);
% Solve the problem
uh = Lh \ fh;
% Compute the exact solution
uexh = 1+4*xh.^2-3*x... |
# On a sample of 500 individuals, there was found that 200 of them are male, 100 of them go jogging and 50 are male who go jogging.
# How much this last figure differs from the value corresponding to the case at which the gender and jogging are statistically independent?
#
data = load("jogging.dat")
gender_sums = sum... |
classdef BookPriceEventData < event.EventData
properties
old_price;
new_price;
end
methods
function obj = BookPriceEventData(old_price, new_price)
obj.old_price = old_price;
obj.new_price = new_price;
end
end
end |
% batopt: BAT optimization function
% [best_bat, fmin_bat, best_hist_bat] = batopt(n,d,func_name,
% Num_iterations)
% Enter parameters: [n,d,func_name, Num_iterations]
% Function should compute and generate the optimum value as the output [best_bat, fmin_bat, best_hist_bat]
function [x_bat, f_bat, best_hist_bat] = bat... |
function [y,d]=shape(a,b,deg,j,xquad)
y=zeros(length(xquad),1);
d=zeros(length(xquad),1);
x=a+(0:deg)/deg*(b-a);
xj=x(j);
x(j)=[];
i=1;
for xp=xquad
y(i)=prod(xp-x)/prod(xj-x);
dd=0;
for s=1:deg
z=x;
z(s)=[];
dd=dd+prod(xp-z);
end
d(i)=dd/prod(xj-x);
i=i... |
function varargout = Asg1(varargin)
% ASG1 MATLAB code for Asg1.fig
% ASG1, by itself, creates a new ASG1 or raises the existing
% singleton*.
%
% H = ASG1 returns the handle to a new ASG1 or the handle to
% the existing singleton*.
%
% ASG1('CALLBACK',hObject,eventData,handles,...) calls the l... |
%Nhom 1
%53
%Pham Ba Tung
%B15DCDT221
I=[4 6;2 7];
%ma tran luong tu hoa
Q=[3 7;2 9];
n=size(I,1);
for i=1:n
for j=1:n
u=i-1;
v=j-1;
if (u==0)
au=sqrt(1/n);
else
au=sqrt(2/n);
end;
if (v==0)
av=sqrt(1/n);
else
av=sqrt(2/n);
end;
F(i... |
% model of distance
mu_X = 2.5; % mu_G = 9
a = 2; % \rho = 0.6
sigma_X = 0.6; % sigma_G^2 = 1.8
gamma_th = 1;
f_egc = @(x_1,x_2) exp(a*x_1+x_2)+exp(x_1+a*x_2)-sqrt(2*gamma_th);
figure(1);
h = ezplot(f_egc,[-5,5,-5,5]);
C = get(h,'contourMatrix');
x_1 = C(1,2:end);
x_2 = C(2,2:end);
% upper bound
k = (a.*exp(a.*x... |
function [MA]=convcond(grangercon)
clear MA
Aver=grangercon.grangerspctrm;
% Aver=grangercon;
% Aver=granger22.grangerspctrm;
for i=1:size(Aver,2)
aver=Aver(:,i);
%Matav=[0 aver(2) aver(4); aver(1) 0 aver(6); aver(3) aver(5) 0];
% Matav=[0 aver(1) aver(2); aver(3) 0 aver(4); aver(5) ave... |
classdef clusterMachine < AClassifier
% FSM
properties(SetAccess=protected)
k = [0 0];
dataFormatName = []; % which data to use?
dataFormatDof = [];
dataFormatQuad = [];
dataFormatClusterParam = [];
distTol = 0.8;
trainingData = []; % trainin... |
function E = EdgeLinking(Mag_low, Mag_high)
% this function uses the recursive method to link the edges from strong to
% weak
set(0,'recursionlimit',2000);
[row, col] = size(Mag_low);
E = zeros(row, col);
while(~all(~Mag_high(:))) % check if still exist strong edges
for rr = 2:row-1
for cc = 2:col-1
... |
num_frames = size(solutions(1).structure, 3);
num_points = size(solutions(1).structure, 2);
num_sequences = size(solutions, 1);
num_noises = size(solutions, 2);
num_solvers = size(solutions, 3);
shape_errors = zeros(num_frames, num_sequences, num_noises, num_solvers);
for i = 1:num_sequences
S = scenes(i).points;
... |
function varargout = StimGUI(varargin)
% STIMGUI MATLAB code for StimGUI.fig
% STIMGUI, by itself, creates a new STIMGUI or raises the existing
% singleton*.
%
% H = STIMGUI returns the handle to a new STIMGUI or the handle to
% the existing singleton*.
%
% STIMGUI('CALLBACK',hObject,eventData,... |
%% cov_rules_basic
% computes parameter set of a species from the parameter set of the group using the basic rules
%%
function pSpec = cov_rules_basic(p, specNm)
% created 2015/08/24 by Goncalo Marques
%% Syntax
% pSpec = <../cov_rules_basic.m *cov_rules_basic*> (p, specNm)
%% Description
% Computes the parameter se... |
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/AMIGO_ranking_obs.m 770 2013-08-06 09:41:45Z attila $
function [results]=AMIGO_ranking_obs(inputs,results,privstruct);
% AMIGO_ranking_obs: Computes ranking of unknowns for observables
%
%******************************************************************************
% AMIG... |
function [global_scores, backtracking] = gesture_scores_dtw2(observed, model, parameters)
% function [global_scores, backtracking] = gesture_scores_dtw(observed, model, parameters)
%
% model is a motion sequence used as training data, and corresponding
% to a specific gesture, and with
% normalized number of fr... |
% Compute the average first
numTest = 7;
numRot = 4;
sliceIdx = [9 12 15 18 21];
numSlice = length( sliceIdx );
%% first get the average images
disp('Compute the average images for FBP and PWLS reconstruction.');
img_fbp_soft_avg = 0;
img_fbp_sharp_avg = 0;
img_pwls_avg_1 = 0;
img_pwls_avg_2 = 0;
img_pwls_avg_3 ... |
% this function will scan the candidate value results for invalid conditions
% (i.e. high SOC less than low SOC, ...) and remove those candidate values
% and responses from the data set
global vinf
% condition one cs_hi_soc <= cs_lo_soc
if vinf.control_strategy.dv.active(1)&vinf.control_strategy.dv.active(2)
bad... |
classdef LearningBasedWB < handle
%LEARNINGBASEDWB More sophisticated learning-based automatic white balance algorithm
%
% As cv.GrayworldWB, this algorithm works by applying different gains to
% the input image channels, but their computation is a bit more involved
% compared to the simple gray-wo... |
clearvars, clc, close all;
folder = '/home/hoa/ownCloud/Github_ADL/Field_Experiments/Scripts/Results/2017-11-27/';
% folder = '/home/hoa/ownCloud/Github_ADL/Field_Experiments/Scripts/Results/';
mat_file_list = dir([folder,'Ex2_sigma*.mat']);
for k = 1:length(mat_file_list)
mat_file = mat_file_list(k).name;
mat_... |
function [flag] = state_in_value_region( state )
global range_label;
global range_rate_label;
global v_label;
global mytable_num;
range_num = find_num(state(1),range_label);
range_rate_num = find_num(state(2),range_rate_label);
v_num = find_num(state(3),v_label);
if isequal(range_num,[]) || isequal(range_rate_num,[])... |
function compareAODVolumes(obj,key1,key2) %#ok<*INUSD>
% uparrow/downarrow : move slices
% leftarrow/rightarrow : adjust AOD depth
% pageup/pagedown : adjust ScanImage depth
% r : set rectangle possition
% z : zoom in/out
% w/s/a/d : adjust zoom window locatio... |
function [txt, header] = al_feedback(Data, taskParam, subject, condition, whichBlock, nTrials)
%AL_FEEDBACK This function displays feedback at the end of a block
%
% Input
% Data: structure containing data of subject
% taskParam: structure containing task parameters
% subject: structure containing ... |
function res = repeatp( proc, stat, n )
% REPEATP(proc, stat, n) generates realizations
% of a process, and calculates a statistic on each of
% them.
% proc -- the process to use
% stat -- the statistic to use
% n -- the number of realizations
% Copyright (c) 1996 by D. Kaplan, All Rights Reserved
if ~isstr(proc)
er... |
%% -------------- sIRLS-p (0 <= p <= 1) algorithm -------------------- %
%% ----- This is the code associated with the paper:
% ----- "Iterative Reweighted Algorithms for Matrix Rank Minimization"
% ----- Karthik Mohan (karna@uw.edu) and Maryam Fazel (mfazel@uw.edu).
% -------------- LAST UPDATE: 8/28/2012 ----------... |
Tf=[0:0.01:1];
Ta=0.8*Tf;
T0=0.5;
T1=0.6;
T=blending(Tf,Ta,T0,T1);
plot(Tf,Tf,Tf,Ta,Tf,T);
legend('Tf','Ta','T') |
classdef sa
%TSM Summary of this class goes here
% Detailed explanation goes here
properties
end
%% static tools
methods (Access = 'public', Static = true, Hidden = false)
[ indFinal, indAbsDiscInter,indAbsContInter,indRelDiscInter,indRelContInter] = EvalY( Y, riskFreeRa... |
% Trace data comes in the following format:
%trace_date trace_x_n trace_y_n
%trace_headlines trace_x_u trace_y_u
%trace_x trace_y
%Date of simulation-trace_date
%Header information on simulation-trace_headlines
%Time label-trace_x_n
%Units of time-... |
% Planned to show nice electron bunch with real dimensions in the paper
clear all;
%% Read in the image
image_folder = '\\cns\projects\HPLexp\Electrons\Experimental data\2016\LWFA\Lanex calibration\2016-05-10 Lanex calibration\DataI';
image_filename = 'Lanex_2016-05-11_00h-20m-00s_21018_original.png';
e_bunch = imread... |
function [Mnz,Mii,f] = autoGen_dynamics_ds(qf1,qf2,ql1,ql2,dqf1,dqf2,dql1,dql2,u1,u2,uHip,g,l,d,r,c,m,I,Ifoot,x0,one)
%AUTOGEN_DYNAMICS_DS
% [MNZ,MII,F] = AUTOGEN_DYNAMICS_DS(QF1,QF2,QL1,QL2,DQF1,DQF2,DQL1,DQL2,U1,U2,UHIP,G,L,D,R,C,M,I,IFOOT,X0,ONE)
% This function was generated by the Symbolic Math Toolbox vers... |
function out1 = hess_grf_ceq_heel910(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL910
% OUT1 = HESS_GRF_CEQ_HEEL910(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:38:52
out1 = 0.0;
|
function [CssExtra]=ASET_ExtrapCssRouse(V,Css,C_back,P,S,j,Cut_back)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function extrapolate the coarse Concetration using the Rouse Distribution.
% See Rouse (1937). RoD
% by Dominguez Ruben, L. FICH-UNL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%Ravdeep Pasricha , Ekta Gujral, Vagelis Papalexakis 2018
%Computer Science and Engineering, University of California, Riverside
function rerror = relativeError(Xoriginal, Xcomputed)
a = norm(Xoriginal-Xcomputed);
b = norm(Xoriginal);
rerror = a/b;
end |
ccc
n=21;m=41;la=-1;
du=@(t,u) la*u;
th=linspace(-1,1,n);
uh=linspace(-1,1,m);
u=@(C,t) C.*exp(la*t);
[Th,Uh]=DirectionField(th,uh,du);
hold on
axis([-1 1 -1 1]);
U=u(Uh,Th);
plot(th,U,'LineWidth',2);
|
% Calculate the change rate of area to determine whether the stopping
% condition is satisfied
function residual_change_rate = Calculate_change_rate(pre_phi,phi,varepsilon,eta)
pre_inter_Hphi = Heaviside(-varepsilon - pre_phi, eta);
pre_mid_Hphi = Heaviside(varepsilon^2 - pre_phi.^2, eta);
pre_outer_Hphi = Heavi... |
function [ t_spike_mask ] = create_spike_times_mask( t, spike_times )
% CREATE_SPIKE_TIMES_MASK creates a time axis where 200 ms around
% spike times are marked as nan;
%
% INPUTs:
% t = [1 x n-timepoints] time axis
% spike_times = [1 x n-spikes] vector containing the time points where all
% spi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.