text stringlengths 8 6.12M |
|---|
function [imth,imtmax] = dolomite_microcracks_segmentation2d(ims,ndir,s1,s2)
%% dolomite_microcracks_segmentation2d - microcracks segmentation using
%% linear structuring element
%
% REFERENCE:
% B. Obara,
% Identification of transcrystalline microcrack... |
function fig2png(path,doclose,fname)
if ~exist('fname') % having included single file in this function, fix it later when necessary
tmp = dir([path '/*.fig']);
fname = {tmp.name};
end
for ifi = 1:numel(fname)
% set(0, 'CurrentFigure', 1);
% clf reset
[~, tmp] = fileparts(fname{ifi})
eval(sprintf('open %s.fig... |
function imgb = bump(img)
[imax, jmax] = size(img);
imgb = zeros(imax, jmax);
for i=1:imax
for j=1:jmax
if img(i, j) > 0
imgb(i, j) = 1;
end
end
end
|
syear = input ('Enter the year','s');
startmonth = input('Enter the start month','s');
endmonth = input ('Enter the end month','s');
npt=0;
matlabday=zeros(0,0);
year2000=zeros(0,0);
waterday=zeros(0,0);
erf=zeros(0,0);
xcen=zeros(0,0);
xsig=zeros(0,0);
ycen=zeros(0,0);
ybkg=zeros(0,0);
pcen=zeros(0,0);
ptot=zeros(0... |
function Hd = fir_low(Fs, Fc)
%FIR_LOW Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.2 and the Signal Processing Toolbox 7.4.
% Generated on: 21-Dec-2018 02:40:15
% FIR Window Lowpass filter designed using the FIR1 function.
% All frequency values are in Hz.
N = 16; % Orde... |
classdef Ridge_RG < handle
properties
beta
end
methods
function obj = train(obj, matrix_covariate, vector_response, cross_validation)
%Ridge regression equation. Will be used as an anonymous function
%%%%%%%Argum... |
function [varargout] = MultiSlider (varargin)
% MultiSlider Create multi slider control.
% MultiSlider, by itself, creates a new multi slider control in the
% current figure, and returns its handle.
%
% MultiSlider(H, 'Results') returns an array of floats that represent
% the ordered grip positions... |
function [] = writeData(dataArray)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% print out data first for debugging purposes
end
|
%%Create a pAnalyzed that has pAnalyzed from all subfolders
%for 5-minuters
path = 'C:\Users\Harry\Desktop\DataSun\2016_06_08'; %SET THIS MANUALLY (more down the page)
roundFolders = dir([path,'\Round*']);
pCombined = [];
for i = 1:size(roundFolders)
subPath = [path,'\',roundFolders(i).name];
trialFold... |
%imagesc(data)
% EVENTUALLY anotherplotting function using imagesc instead. I think it's
% faster and allows fo rmore customization |
% MATLAB GRAPHICS PRIMITIVES EXAMPLES By Deniz Savas, February 2016
% Example MATLAB script using a few plotting primitives.
% Using the graphics primities provided such as line drawing and shape
% filling primitives you can draw any shape or picture you like.
%
close % close any existing figures.
% Define our... |
function dirbackup(s1, s2, runmode)
% function dirbackup(a, b, mode)
%
% Creates a backup of folder 'a' in folder 'b' or updates the current
% backup in folder 'b'. The function deletes files and folders from
% directory 'b' if they are not present in directory 'a'. It also compares
% each file with the same name... |
function testpro1
%Statystyka stosowana - test dla proporcji - model 1, czyli N(m,sigma), sigma znane
%kwantyle rozkladu N(0,1)
kwantyle=[
% prawdopod. kwantyl N(0,1)
0.900 1.282
0.905 1.311
0.910 1.341
0.915 1.373
0.920 1.406
0.925 1... |
function f = blur(image, width)
[row, col, layer] = size(image);
temp = zeros(row + 2, col + 2);
temp(2:row + 1, 2:col + 1) = image(:, :, 4);
result = zeros(row, col);
se1 = strel('disk', 2);
for i = 1:width
temp = imerode(temp, se1);
result = result + temp(2:row + 1, 2:col + 1);
end
result = result / width;
... |
% 3D wing lifting line method
clc;clear all;close all;
N=20; % number of pannels in each half wing
Lam=degtorad(0); % sweep angle, backward swept, positive
dih=degtorad(0); % dihedral angle defined at the c/4
aoa=degtorad(5)/cos(Lam); % angle of attack
tr=4; ... |
function net=add_conv(net, dim, lrs, stride, pad, nnz)
type = 'single';
weight = init_weight('xavierimproved',dim(1),dim(2),dim(3),dim(4), type);
net.layers{end+1} = struct(...
'type', 'conv', ...
'weights', {{weight, zeros(1, dim(4), type)}}, ...
'learningRate', lrs, ...
's... |
function vertexLM_on_HS = prepare_landmarks_on_hemisphere(dim, vertexHS)
% Places landmarks on the hemisphere following the layout below. the larger dim, the larger the square form by the 4 landmarks.
%
% B +----------+ C
% | |
% | |
% | |
% | |
% A +----------+ D
% ... |
function h = my_LyapFun2D( nFig, lyapunov, mapping, limits)
%PLOTLYAPFUN Summary of this function goes here
% Detailed explanation goes here
if iscell(nFig)
figure(nFig{1}); hold all;
%set(gcf(), 'CurrentHandle', nFig{2})
axes(nFig{2});
else
figure(nFig); hold all;
end
axisOld = axis();
if nargin <= ... |
function [ cur_info,remain_info] = route_devided( all_info_data )
%UNTITLED2 此处显示有关此函数的摘要
% 此处显示详细说明
global vehicle;
global center_position;
if isempty(vehicle)||isempty(center_position)||isempty(all_info_data)
return;
end
demand_count = size(all_info_data,1);
add_head_col= (1:demand_count)';
add_end_col = linspa... |
function test_suite = test_graphPeripheralVertices
%TEST_GRAPHPERIPHERALVERTICES One-line description here, please.
%
% output = test_graphPeripheralVertices(input)
%
% Example
% test_graphPeripheralVertices
%
% See also
%
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
... |
function [allMeans, allGradientUp, allGradientLeft] = ...
GaussianizeImageSet(s_path, imIndex, cellSize, movementSize, contrast, ...
outputSize)
% for each image that matches s_path and imIndex as in
% load([s_path, '/',imList(imIndex(i)).name]);
%
% run GaussianizeImage (which returns 1D means... |
function plotAreaUnderACurve(handles, integrationLimits, coefficients, plot1_xAxis, plot1_yAxis)
% Get the handle to the axes
axes(handles.integrationPlotAxes)
% Find the roots of the polynomial
fx = coefficients(end:-1:1);
rootsFx = roots(fx);
realRootsFx = [];
for idx = 1:length(rootsFx)
if isreal(roo... |
function [A,Q,C,R,Q0,Y0]=LGSSMEM_intial(rand)
% if rand==1 generate random initial parameters, else we use parametes from
% the assignment.
if rand == 1
k = 4;
d = 5;
A = randn(k,k);
Q = iwishrnd(eye(k),k);
C = randn(d,k);
R = iwishrnd(eye(d),d);
Y0 = randn(k,1);
Q0 = iwishrnd(eye(k),k);... |
function [ output_frame ] = get_audio_frameV3( W_in, W_out, W_hidden, input, beta_1,beta_2 )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
X_in = [input 1]'; %le concateno un 1 debido al modelo
h = W_in*X_in;
out_first_layer = tanh(h*beta_1);
... |
function psd = medusaPsdRunStream(psd)
% function psd = medusaPsdRunStream(psd)
%
% This is part of the Medusa software suite.
% Pascal Stang, Copyright 2006-2012, All rights reserved.
%
% $LICENSE$
global sock
global MEDUSA
% setup output fid
fid = MEDUSA.FID;
medusaPsdValidate(psd, 'streaming');
f... |
function [ x, err, iter, flag ] = SOR_trial2(A, x, b, w, max_it, tol)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This function computes the solution vector using SOR, if the relaxation
%value of w=1, then this function solves using the Gauss-Seidel method, the
%inputs consist of the f... |
% Step3.2 SVD the W'Triples(W\theta)W
[v ,~ ,~] = svd(Triples_theta);
eta = W * v;
% Step4 Reconstruct and Scale:
% Step4.1 construct Z:
Z = zeros(1,k);
for l = 1:Docs
l
for t = 1:k
cl = trainX(l,:)';
clcletaeta = (cl .* cl)' * (eta(:,t) .* eta(:,t));
cletaeta = cl' * (eta(:,t) .* eta... |
clear
clc
tic
times = 1000000;
group = 20;
data = csvread('function1.csv');
x0 = data(:,1)';
y0 = data(:,2)';
gene = zeros(group*2,64);
len0 = zeros(1,times);
datal = zeros(group,times);
for i = 1:group
gene(i,1:63) = make_gene();
y = get_plot(1,gene(i,1:63),x0);
gene(i,64) = get_fit(y,y0);
e... |
function f = flops_sample(p,n)
% FLOPS_SAMPLE Flops for sample(p,n)
% Flopcount based on systematic sampling.
% old algorithm:
% The flopcount for sample is the same as the value returned by sample,
% so the expected flops is E[x].
% Note that the result is typically not an integer.
if nargin == 1
n = 1... |
clear yd xd xt yt input xyt
indx_end = 1;
for j=1:1:length(z)
n = z(j);
s = 0;
for k = 1:1:numObj
ydist = ydd(n,k);
xdist = xdd(n,k);
xtrue = xtrue_opposite(k);
ytrue = ytrue_opposite(k);
if ydist~=0 && xdist~=0 && xdist>17 && xdist<290 && ydist>15 && ydist<497
... |
X = rand(100, 1000);
Y = rand(100, 1000);
euclid_dist = euclid(X, Y);
X = rand(100, 10000);
Y = rand(100, 1000);
euclid_dist = euclid(X, Y); |
bg=zeros(14,6);
for i=1:14
if i<10
num=strcat('0',num2str(i));
else
num=num2str(i);
end
if i==8
continue;
else
for j=1:2
switch j
case 1
string=sprintf('%s-QSEO1-CoP-CoM.mat',num);
case 2
... |
clear all ; close all
subs = {'alex','dina','genevieve','jeremie','karl','russell','sukhman','valerie','tegan'} ;
% component labels
categories = {'bcg','center','eyes','rim'... %
'motor_left','motor_center','motor_right',... %
'frontal_left','frontal_center','frontal_right',... % 7
... |
%% How to Run Tests in Specific Directories
% To run all the test cases in a specific directory, give the name of the
% directory as an argument to |runtests|.
%
% For example
runtests example_subfunction_tests
%%
% To run tests in multiple directories, give each directory name as a separate
% argument to |... |
function [output] = my_demosaic2(input, sigma)
output = zeros([size(input),3]);
[row,col] = size(output(:,:,1));
% 마스크 생성
maskR = kron(ones([row/2, col/2]), [1 0; 0 0]);
maskG = kron(ones([row/2, col/2]), [0 1; 1 0]);
maskB = kron(ones([row/2, col/2]), [0 0; 0 1]);
%마스크를 통해 R,... |
function [xo yo vvo] = pcolorize(xi, yi, vvi)
dimx = find(size(xi) ~= 1);
dimy = find(size(yi) ~= 1);
xo = xi(1:end-1) + 0.5*diff(xi);
xo = cat(dimx, xo(1) - (xo(2)-xo(1)), xo );
xo = cat(dimx, xo , xo(end) + (xo(end)-xo(end-1)));
yo = yi(1:end-1) + 0.5*diff(yi);
yo = cat(dimy, yo(1) - (yo(2)-y... |
function [xag, etc] = funLS_TV_AADMM_B(A, b, wTV, par)
% =========================================================================
% =============== Write Help Text Here ====================================
% =============== Help Text Ends ==========================================
% ===============================... |
cd('E:\Backup\PET'); |
function y = Ackley(x,y)
sum1 = 0;
sum2 = 0;
sum1 = x.^2+y.^2;
sum2 = cos((2*pi)*x)+cos((2*pi)*y);
y = 20 + exp(1)-20*exp(-0.2*sqrt(1/2*sum1))-exp(1/2*sum2);
end |
clear all
close all
clc
hold on
dt=1;
finaltime=1000; %Total time in days
%% Graphing
range = 0.02;
axis([-range range -range range -1e-6 1e-6]);
title('Orbits');
xlabel('displacement x AU');
ylabel('displacement y AU');
whitebg('black');
view(-20, 20);
grid on
%% Variables
global sunm G %Global constants so they ca... |
function [] = setup_motor()
%% Notes
% This script preps the motor for the Simulink block.
% 7/1/2016 -- Created
% 7/9/2016 -- Converted into function, prepping file for future creation of
% control files, building is now done solely on Simulink
%% Begin Motor Data Import
% Get list of modules used b... |
function [t1 pd] = t1_calc(img1,img2)
[x,y,z]=size(img1);
fa=[4,18];
TR=7.6;
fa_r=fa*pi/180;
%create vectors
x1=img1*fa_r(1);
x2=img2*fa_r(2);
y1=img1/fa_r(1);
y2=img2/fa_r(2);
%do the math
t1=(y1-y2)./(x1-x2);
t1=-t1*2*TR;
pd=(y1.*x2-y2.*x1)./(x2-x1);
%reject rubbish
t1(t1<0 | t1>1e4)=NaN;
end
|
%**************************************************************************
%
% PicoScope 5242B Class
%
% Requires API in './api/' directory and installation of the PicoScope
% SDK in the default folder C:\Program Files\Pic
%
%
% Scott Schoen Jr | Georgia Tech | 20190116
%
%****************************... |
function syncSettings = pldapsDatapixxSync(p)
% function syncSettings = pldapsDatapixxSync(p)
%
% This script is meant to help test & apply reasonable parameters controlling built-in
% Datapixx-to-PTB timing & sync operations.
%
% [p] Optional input of a running PLDAPS session object. If empty, will open a fresh
% ... |
clearvars;
clc;
close all;
I = imread('dom.png');
figure;
subplot(1,4,1);
imshow(I);title('ori');
subplot(1,4,2);
eI = edge(I, 'log');
imshow(eI);title('log');
subplot(1,4,3);
eI = edge(I, 'canny');
imshow(eI);title('canny');
subplot(1,4,4);
eI = edge(I, 'sobel');
imshow(eI);title('sobel');
figure;
subplot(1,4,1);
... |
% ----------------------------------------------------------------- %
% Matlab Programs included the Appendix B in the book: %
% Xin-She Yang, Engineering Optimization: An Introduction %
% with Metaheuristic Applications %
% Published by John Wiley & Son... |
% cd /home/czt/workspace/crowdsourcing_VD;
% outputpath = '/home/czt/research/data/output/';
% readData;
%
% load([outputpath, '1020.mat']);
%
% uploadDataLimited = uploadDataRaw( find( uploadDataRaw(:,1) < 1e7 ), 1);
% [ uploadDataCDF, uploadData_X ] = ksdensity( uploadDataLimited, 'support', [0, 1e7], 'npoints', 1000... |
function x=selectvect(N,pos)
%returns an N length vector of all zeros except for a one at pos
x=zeros(N,1);
x(pos)=1; |
%clear the work space and close all open figure windows
clear; clear all; close all;
hres = 256; vres = 256;
name = ['C:\Users\Alex\Pictures\Image25.png'];
%fin = fopen(name,'rb');
Q_step = 5;
I = imread(name);
I_Quantized = Q_step*round(I/Q_step);
E=entropy(I_Quantized);
entropy1 = calcEntropy(I);
entrop... |
%=========================================================================
%
% Sampling properties of the nonparametric kernel regression
% estimator
%
%=========================================================================
clear all;
clc;
RandStream.setDefaultStream( RandStream('mt19937ar','seed',123) );
... |
function R = setup_exp_order(n, category_params, varargin)
%%%Set up order of class, sigma, and orientation for entire scheme%%%
nStimuli = 1;
cue_validity = .8;
priors = [.5; 1];
assignopts(who, varargin);
nPriors = size(priors, 2);
R = [];
prop_neutral_trials = 1/6;
for k = 1:n.blocks
R.category_type = catego... |
function main()
%main: The main function driving/calling the game methods.
%Clears and closes any open data/figures
clear; clc; close all; format shortG; format compact;
% Establish Global Variables
global boardSize qShip iShip lShip tShip;
%Max Board Size (NxN)
boardSize = 10;
%Quantity ... |
datadir = '/Users/tyler/Desktop/TOSEND_Genpurp_DELM_15Aug/1/';
datafile = 'dataRe.dat';
paramsfile = 'acqu.par';
params.acqTime = readpar_Kea(strcat(datadir,paramsfile),'acqTime');
params.bandwidth = readpar_Kea(strcat(datadir,paramsfile),'bandwidth');
params.nScans = readpar_Kea(strcat(datadir,paramsfile),'nrScans');... |
function Word_identification
Screen('CloseAll');
path_way=pwd;
refresh_rate=120;%refresh rate of the computer
load seq_identification.mat;%load valence and orders of the image to be presented
info_subject=inputdlg({'NO.','name','gender','age','sequence number(1 or 2) ','time£¨frame£©'},'Set parameters',1,{'1',... |
function [ B ] = MCMCSimulation( FL, init )
% MCMCSimulation
% **********************************************************
% (c) Zuzana Mucka, Cuncil for Budget Responsibility, 2014
% Last edited: Oct 7, 2014
%
% Aim : Calculate (conditional) distribution of the fiscal limit b* at a
% specifi... |
function f = fileFunction(path, mfile)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if nargin < 2
[path, mfile] = fileparts(path);
else
[~, mfile] = fileparts(mfile);
end
f = @call;
function varargout = call(varargin)
addpath(path);
try
f = str2func(['@' mfile]... |
addpath('/Users/jinstone/Desktop/stmsetup/thesis/sw/sinc_filter/');
addpath('/Users/jinstone/Desktop/stmsetup/thesis/sw/subsample/');
samp = 3E6;
gold = 0.5 * ( 1 + sqrt(5) )
len = 100E-6;
t1=[0:1/samp:len];
t2=[0:1/(100E6):len];
A=1;
freq = (samp/2)/(1.6*gold) %140kHz
Wn = 1; %(samp/2)/(2*pi);
%Sine
y=A*sin(2*pi*fr... |
% Function to generate a general Markov Chain Gillespie simulation
function output = dsppMCQ(params)
% Assumptions and modification
% - works with a specified Q matrix
% - performs SSA
% Obtain input parameters - no. molecules, iterations, rate extrema and
% molecular ICs, start of equilibrium in terms of N
... |
% Compare filtfilt vs. HPF=signal-movingAverage
% Moving average filter coeff
a = 1;
b = [1/4 1/4 1/4 1/4];
% Compute the 4-hour moving average of the data, and plot both the original data and the filtered data.
% Zero-phase HPF
Fs = 96; % Hz % Sampling Frequency
Fpass = 4; % 2*Fpass(Hz)/sampling f(Hz) in normalized... |
%% Analyze Facs
clear all
close all
clc
home_name = pwd;
dir_name = 'C:\Users\ys151\Desktop\WorkingZone\Gal\LowOdGrowth_7_APR_2014\';
cd(dir_name);
filename = 'LowOdGrowth_7_APR_2014'
load(filename)
cd(home_name);
%%
fsc_ind = 2;
ssc_ind = 5;
yfp_ind = 3;
rfp_ind = 6;
bfp_ind = 8;
time_ind = 1... |
classdef FTController_quadcopter < CONTROLLER_CLASS
% クアッドコプター用階層型線形化を使った入力算出
properties
self
result
param
Q
end
methods
function obj = FTController_quadcopter(self,param)
obj.self = self;
obj.param = param;
ob... |
function [] = corrected_p_plot(wNIC_file, wNIC_groups_file, fiber_name, fignum, measurements, color_map, number_of_permutations)
if ~exist('wNIC_file', 'var')
[~,wNIC_file,~] = name_select('fa', 'groups');
end
if ~exist('wNIC_groups_file', 'var')
[~,~,wNIC_groups_file] = name_select('fa', 'groups');
end
if ... |
function [T,I,Y]=perfusionResponseanmarP2X4inact2(y0,ton,toff,Ttot)
ode=modelODEanmarP2X4inact2(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:14));
I=getTotalCurrentanmarP2X4inact2(Y);
end |
% hog detector test bench
% Created by Xikang Zhang, 09/13/2013
function testBenchHogDetector
clear all;close all;clc;
addpath(genpath('.\xml_io_tools'));
run('C:\zxk\Research\zz_vlfeat-0.9.16\toolbox\vl_setup');
addpath(genpath('C:\zxk\Research\zz_libsvm-3.11\matlab'));
addpath('C:\zxk\Research\monkey\monkey_cppPrj... |
function []=capturenow
try close figure 1;end;
vid=videoinput('winvideo',1,'YUY2_640x480');
while (1==1)
choice=menu('capturar foto',...
'inicializa la camara',...
'captura la foto',...
'guardar foto',...
'salir');
if (choice ==1)
inicame... |
function xint = defintx(t, x, dt, tlims, tmaxgap, idim)
% xint = DEFINTX(t, x, dt, tlims, tmaxgap, idim)
%
% inputs
% - t:
% - x:
% - dt:
% - tlims:
% - tmaxgap (optional):
% - idim (optional):
%
% outputs
% - xint:
%
% Calculate the integral of x (function of t) between th... |
% MTLTM.M
% for Relaxation Effects on profile
% Called by mmpmain
% Set up for menu position and offset ********************************
mmgmincr = mmgmincr + 1 ;
mmlnmxyoff = mmgmxyoff*mmgmincr ;
mmlnmxypos = mmgmxypos + mmlnmxyoff ;
figure('Position',mmlnmxypos) ; % New menu window
%clear % Clear old variables (t... |
%% Find camera
im_info = imaqhwinfo;
cameraID = im_info.InstalledAdaptors;
vid = videoinput(cameraID{1}); %change {1} according to LiveTrack position in the array
%% set parameters
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb');
% vid.FrameRate =30;
vid.FrameGrabInterval = 1; % distance bet... |
function [intSpec, actualdf] = integrateSpec(pwspec, df, lsumrot)
% [intSpec] = INTEGRATESPEC(pwspec, df, lsumrot)
%
% inputs:
% - pwspec: structure with (at least) 2 fields -- freq
% (frequency vector) and psd (power spectral density).
% - df: Nx2 matrix with N bandwidths to integrate the... |
function estidist = estimate_distance_env(base,test,testdist,Fs,thre)
if ~exist('Fs','var')
Fs = 96000;
end
[base_upperenv, base_lowerenv] = envelope(base,300);
[test_upperenv, test_lowerenv] = envelope(test,300);
[Rmm, lags] = xcorr(base_upperenv, test_upperenv, 'coeff');
[~,b] =... |
clear all; close all; clc
%% Read in and process initial mass and time data
prompt = 'Enter Date (YYMMDD): '; % prompt user for time data
mousePrompt = 'Enter Mouse Number (##): ';
file = input(prompt, 's');
mouseNumber = input(mousePrompt, 's');
weight = csvread(strcat(file, '_', mouseNumber, 'LOADCELL.CSV'));
... |
function initPose = loadInitialPose()
%% ICs for the vehicle pose
x0 = 5; % [m] initial x-coordinate of the vehicle CoM
y0 = 5; % [m] initial y-coordinate of the vehicle CoM
theta0 = 0; % [rad] initial vehicle attitude
initPose = [x0,y0,theta0]';
end
|
clear all ; close all ;
subs = {'alex','dina','genevieve','jeremie','karl','russell','valerie','tegan'} ;
freqranges = {[48,60],[45,60],[60,80],[50,70],[50,70],[50,70],[56,70],[55,70]} ;
lowcomps = {[15,25],[35,30,18],[25,17],[35,20,7],[16,15],[14,33],[25,13,35],[37,14,33]} ;
highcomps = {[26,25,21],[44,37],[39,... |
% Lectura y preporcesamiento de la Imagen %
img = imread('photo (2).jpg');
figure; imshow(img); %Mostrando la imagen original
img = rgb2gray(img);
[n, m ,t] = size(img);
img=im2bw(img,graythresh(img));
img = imdilate(img, strel('disk',3));
img = edge(img,'canny');
% figure; imshow(img); %Mostando la imagen proces... |
% dj.internal.ExternalTable - The table tracking externally stored objects.
% Declare as dj.internal.ExternalTable(connection, store, schema)
classdef ExternalTable < dj.Relvar
properties (Hidden, Constant)
BACKWARD_SUPPORT_DJPY012 = true
end
properties
store
spec
cache_fol... |
function WordText_app(app,actx_word_p,text_p,style_p,enters_p,color_p)
%VB Macro
%Selection.TypeText Text:="Test!"
%in Matlab
%set(word.Selection,'Text','test');
%this also works
%word.Selection.TypeText('This is a test');
if(enters_p(1))
actx_word_p.Selection.TypeParagraph; %enter
en... |
function G=calc_rev_corr(rawdata,varargin)
%% Inputs
%
% rawdata the output of package_pbups_data/or scrach code. If rawdata contains a
% field probR, the function assumes that that is a model
% prediction and generates the rev_corr in a weighted
% fashion. E.g... |
% read the 'tiny' instance
[P,K] = readAMPLdatpedm('dat/tiny_gph.dat');
% realize it using SDP
[x,ret] = sdprealize(K,P);
% show the realization
showrealization(x);
% realize it using DDP
[y,ret] = ddprealize(K,P);
% realize it using iterative DDP (5 iterations)
[z,ret] = iterddp(K,P,5);
% show all realizations at once... |
function [ u_1, varargout ] = intHeatRKC2( u_0, F_0, f, FE, RKC, op, BC)
%INTHEATRKC2 is the numerical integrator of one time step by the second
%order DAMPED and explicit RUNGE KUTTA CHEBYSHEV method of the heat
%problem:
%
% find u : \Omega x ]0,T] --> R s.t.
%
% du/dt - grad( \mu div(u) ) = f(x,t), ... |
% Copyright (c) 2017 Zi Wang
% Copyright (c) 2014, J.M. Hernandez-Lobato, M.W. Hoffman, Z. Ghahramani
% This function is partially adapted from the code for the paper
% Hernández-Lobato J. M., Hoffman M. W. and Ghahramani Z.
% Predictive Entropy Search for Efficient Global Optimization of Black-box
% Functions, In NIPS... |
function [ result ] = playGame( mode, players )
%playGame: The driving function that manages all the gameplay.
% playGame ( mode, players ) drives every portion of the gameplay. It
% provides the calls for board generation depending on input mode, and
% prepares the requisite data types. It then drives the turn-b... |
function [ EigenVecs , EigenVals , MeanVal ] = RPCA( B , Factors )
%RPCA Summary of the function
% Generalised PCA by RD on April 5, 2013
% INPUTS:
% A : [N by M] Matrix containing values 'double'
% where N: dimension of features (for image it's the number of pixels etc...)
%... |
function [I, Area] = colordetect( RGB )
Size = 20;
Cb_value = 113;
Cr_value = 150;
range = 13;
YCbCr = rgb2ycbcr(RGB);
Cb = YCbCr(:,:,2);
Cr = YCbCr(:,:,3);
h = size(RGB, 1);
w = size(RGB, 2);
I = repmat(RGB, 1);
for r = 1:h
for c = 1:w
if Cb(r,c) > (Cb_value+range) || Cb(r,c) < (Cb_value-range) || Cr(r,c) ... |
close all
ex =1;
% Data
alpha = NaN;
switch ex
case 1
psi1 = pi/2; %
lambda = 15; % generalized slenderness > 0
nu = 1; % stiffness ratio [-1..1]
omega = 10; % = F*L^2/EI load factor
kappa1 = 0; % = M*L/EI end moment
case 2
psi1 = pi/3;... |
function [MaskParameters] = MaskCreateOpenCross(MaskParameters)
% - Create the pinhole mask text code for input into the MCNP
A = zeros(MaskParameters.MaskSequenceLength); % mask matrix
G = zeros(MaskParameters.MaskSequenceLength); % reconstruction matrix
% Find center pinhole - set to 0 - open
A(c... |
function [] = modPlot(f, x0, x1, y0, y1, n)
%Generates a complex plot.
x=linspace(x0, x1, n);
y=linspace(y0, y1, n);
[re, im]=meshgrid(x, y);
s=re+1i*im;
z=real(log(f(s)));
surf(x,y,z,'EdgeColor','none','LineStyle','none');
colormap(jet(256));
xlabel('Re(z)');
ylabel('Im(z)');
shading interp;
end
|
clear all; clc
%% Initialize symbolic variables
% Create symbolic variables for the angles, angular velocities, limb lengths
% and CoG locations.
% 1) Angles
% 2) Angular velocities
% 3) Limb lengths
% 4) Centers of gravity of limbs
syms gamma1 alpha2 beta2 gamma2 gamma3 gamma4 real;
syms gamma1dot alpha2dot beta2... |
function [xp] = mathematicalmodelukf(x,theta)
xp(1) = theta(1)*(x(2)-x(1));
xp(2) = x(1)*(theta(2)-x(3))-x(2);
xp(3) = x(1)*x(2)-theta(3)*x(3);
end |
% Matlab program
function B = principal_component_analysis2(X, k)
% Input: X, p*n data matrix, p 個 features 以及 n 個 samples
% k, 要降到的維度, k 為正整數, k<=p
% Output: B: k*n data matrix, k 個 features 以及 n 個 samples
[~, n] = size(X); % p 個 features 以及 n 個 samples
mu = sum(X, 2)/n; ... |
function [examples_trn, examples_tst, labels_trn, labels_tst,files_trn,files_tst, cfg_params, Woriginal] = load_and_split_dataset(cfg_params)
% function [examples_trn, examples_tst, labels_trn, labels_tst,files_trn,files_tst, cfg_params, Woriginal] = load_and_split_dataset(cfg_params)
% examples_trn, examples_tst, labe... |
% This make.m is used under Windows
mex -O -largeArrayDims -c matrix_op.cpp
mex -O -largeArrayDims -c conjugate.cpp
mex -O -largeArrayDims -c cover_tree.cpp
mex -O -largeArrayDims -c libomp.cpp
mex -O -largeArrayDims -c myblas.cpp
mex -O -largeArrayDims -c omputils.cpp
mex -O -largeArrayDims -c mexvertificatio... |
clear all;
A = load('derdata.mat');
x1 = A.X;
y1 = A.Y;
dy1 = diff(y1(:))./diff(x1(:)); % since Der yields dy1 and dx1 of different sizes
dx1 = x1(1:length(x1)-1);
dy2 = diff(dy1(:))./diff(dx1(:));
dx2 = dx1(1:length(dx1)-1);
figure;
subplot(1,2,1)
plot(x1,y1,dx1,dy1,dx2,dy2)
legend('Y','Y''(X)','Y''''(X)')
subplo... |
% for a given parameter set, this script does the calculation and save results in folder
% input parameters:
% circlePara
% output results:
% fosList.dat in exefolder/data/rstidstr
sstv_id
cd(exeFolder);
if ~exist('data')
mkdir('data')
else
disp('data folder exists');
end
if ~exist('fosList.dat')
tempfile = fop... |
function alignment_main(im, path, only_tr_sc)
clc;
%
load([path '/intermediate_results/local_filters.mat']);
load([path '/intermediate_results/global_fiducials.mat']);
addpath('./utils/');
image_size = size(im);
%
disp('Finding probablities based on local detector output ....');
... |
function [tempOUT] = f2c(tempsIN,unit)
%F2C Converts from Farhenheit to Celsius, or vice-versa
% Detailed explanation goes here
tempOUT = (tempsIN - 32) * 5/9;
if unit == 'C' || unit == 'c'
tempOUT = (tempsIN * 9/5) + 32
end
if unit == 'F' || unit == 'f'
tempOUT = (tempsIN - 32) * 5/9
end
end
|
function bci_Initialize( in_signal_dims, out_signal_dims )
% Filter initialize demo
%
% Perform configuration for the bci_Process script.
% BCI2000 filter interface for Matlab
% juergen.mellinger@uni-tuebingen.de, 2005
% $BEGIN_BCI2000_LICENSE$
%
% This file is part of BCI2000, a platform for real-time bio-signal res... |
function res = Euler2(Max)
%Max=100;
cnt=0;
list=[1;2];
for i=3:Max
list(i)=list(i-1)+list(i-2)
if mod(list(i), 2)==0
cnt=cnt+list(i)
end
if list(i-2)>=Max
break
end
end
res=cnt+2; |
% function to estimate K value for an unbroken clip
%
% created by Jordan Boyle
% If using, please cite:
% S. Berri, J.H. Boyle, M. Tassieri, I.A. Hope, and Np. Cohen,
% Forward locomotion of the nematode C. elegans is achieved
% through modulation of a single gait,
% HFSP J. 3 (2009), pp. 186193.
%%%%%%%%%%%%%%%%%%%%... |
function points_project = project_points(K,R,t,points_3d)
points_project = K*[R t]*[points_3d;ones(1,size(points_3d,2))];
points_project = points_project(1:2,:)./points_project(3,:) + rand(2,1)*2-1;
end |
clc;
clear;
x = SingleSymbolTerm('x');
y = SingleSymbolTerm('y');
z = SingleSymbolTerm('z');
e11 = x + y;
e22 = x - 2.*y;
m1 = Expression2d(2,2);
m2 = Expression2d(2,2);
m1(1, 1) = 2;
m1(2, 2) = 0.5;
m2(1, 1) = e11;
m2(2, 2) = e22;
m1
m2
m3 = m1 * m2
m4 = m3 + m2
m5 = m1 - m4
m6 = m1 * (m1 - m2) + m1 * m3
m7 = 3 .* m6
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.