text stringlengths 8 6.12M |
|---|
function sobel_detector(im_name, threshold)
im = imread(im_name);
im = double(im)/255.0;
mask_horizontal = fspecial('sobel');
mask_vertical = mask_horizontal';
im_edges_horizontal = imadjust(abs(conv2(im, mask_horizontal, 'same')) /4);
im_edges_vertical = imadjust(abs(conv2(im, mask_vertical, 's... |
function quadplot3(center,theta,inputs)
%% 绘制一个四旋翼
% center 质心
% theta 转角
% input 电机输出量
size1 = [0.5,0.05,0.05];
size2 = [0.05,0.5,0.05];
start1 = [-0.25,-0.025,-0.025];
start2 = [-0.025,-0.25,-0.025];
%两个机架
boxplot3(center,theta,'r',size1,start1);
boxplot3(center,theta,'r',size2,start2);
%四个电机
boxplot3(cent... |
clear all; close all;
% create problem data
randn('state',0);
N = 100;
% create an increasing input signal
xtrue = zeros(N,1);
xtrue(1:40) = 0.1;
xtrue(50) = 2;
xtrue(70:80) = 0.15;
xtrue(80) = 1;
xtrue = cumsum(xtrue);
% pass the increasing input through a moving-average filter
% and add Gaussian noise
h = [1 -0... |
clear all ; close all ;
cd c:/shared/asl2 ; ls
subjs = {
'nifti_gina_asl_dicom'
'nifti_vincent_asl_dicom'
'nifti_russell2_asl_dicom'
'nifti_julie_asl_dicom'
'nifti_jeremie_asl_dicom'
'nifti_alex_asl_dicom'
'nifti_genevieve_asl_dicom'
'nifti_mingham_asl_dicom'
} ;
... |
% PROGRAM Get_spikes.
% Gets spikes from all files in Files.txt.
% Saves spikes and spike times.
%Note: drta trumps commented out statements
handles.par.w_pre=12; %number of pre-event data points stored
handles.par.w_post=12; %number of post-event data points stored
% ... |
function [ ZeroCrossingVec ] = ZeroCrossingRate(samples, blockSize, hopSize )
%This function calculates the Zero Crossing Rate for each block and returns
%a row vector.
L = length(samples);
n = 1;
ZeroCrossingVec = [];
index = [];
oneBy2K = 1/(2*blockSize); %Constant, scalar
for n=1:hopSize:L-blockSize
currentBlo... |
function basic_stim_serial()
%% Installation instruction for Psychtoolbox
% bash
% sudo apt-get install octave
% sudo apt-get install liboctave-dev
% sudo apt-get install octave-psychtoolbox-3
% sudo octave --no-gui
%% Installing instrument crontol package
% octave
% pkg install -forge instrument-control
% ... |
% ***************************Disclaimer**************************************
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% or FITNESS FOR A PARTICULAR PURPOSE. Feel free to use this code for academic
% purposes.... |
function [XC,lags,ISI] = pa_spk_corfun(Spike,varargin)
% [XC,LAG,ISI] = PA_SPK_CORFUN(SPIKE)
%
% Correlation function.
%
% Obtain the autocorrelation function XC and the inter-spike-intervals ISI
% of structure SPIKE as obtained through PA_SPK_READSRC.
%
% PA_SPK_CORFUN(...,'PARAM1',val1,'PARAM2',val2) specifie... |
function effectiveZ=XuGetEffectiveZFromJsonc(s_jsonc)
para_material=XuReadJsonc(s_jsonc);
total_z=0;
for idx=1:round(length(para_material.ChemicalFomula)/2)
element_name=char(para_material.ChemicalFomula(2*idx-1));
element_count=cell2mat(para_material.ChemicalFomula(2*idx));
z=XuGetZFromName(element_name)... |
function [exp_factor, scale] = get_expansion2D(tform, before_px_size, after_px_size)
scale = 1/sqrt(det(tform.T));
exp_factor = round(scale * after_px_size/before_px_size,1);
end |
function model = fnc_jointCoord_Sacrum (model,DoF_Types,ROOT_axes)
% Bone Mesh Female Toolkit
% Licensed under the zlib license. See LICENSE for more details.
RPASIS = model(2).vertices_global(model(2).LandmarkIndices(1),:);
RPPSIS = model(2).vertices_global(model(2).LandmarkIndices(2),:);
LPASIS = model(3).vertices_... |
function coloredCampanile(sides,angles,colors)
view(3);
z = 0;
ind = 1;
helper(sides,angles,colors,z,ind)
end
function helper(side,angle,color,z,ind)
if side<1
axis equal;
xlabel('x-axis');
ylabel('y-axis');
zlabel('z-axis');
title('My Campanile');
else
point1 = [-(side./2),side./2;-(side./2),-(side./... |
function [RI,t]=residence_index(tag,cues,R)
%
% [RI,t]=residence_index(tag,cues,R)
% Estimate the residence index (RI) of a tagged whale.
% The RI follows the definition in Johnson et al. Proc
% Royal Soc. 2008, namely, the amount of time that the
% animal is within a sphere of radius R meters di... |
function CoordsToNII(coords, vals, max_dist, ref_file, out_file)
if (length(vals) == 1)
vals = vals*ones(size(coords,1),1);
end
ref = load_nii(ref_file);
ref_dim = ref.hdr.dime.dim(2:4);
Smat = [ref.hdr.hist.srow_x; ref.hdr.hist.srow_y; ref.hdr.hist.srow_z];
if (Smat(1,1) < 0)
Smat(1,1) = abs(Smat(1,1));
... |
% Post-correlation beamformed power
close all;
clearvars;
addpath ../kernel/
addpath ../patterns/
scan_table; % Found in kernel directory
% AGBT16B_400_11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
session = AGBT16B_400_12;
% Calibrator
scan_nums = 25:31;
% Project directory
proj_str = session.session_name;
save_... |
function [ ave_recall, recall, thresholds] = compute_ave_recall_of_bbox( bbox_pred, bbox_gt )
% compute_ave_recall_of_bbox: given a set of predicted bounding boxes and and a set
% of ground truth bounding boxes it computes the recall for multiple IoU
% thresholds between 0.0 and 1.0 as well as the average recall (whi... |
function [list] = read_svmTrain(nombreArchivo)
fprintf("Lectura del archivo %s.txt\n",nombreArchivo);
load(['','config_SVM.mat']);
string = []
cadenas = [];
list = javaObject('java.util.ArrayList')
filename = [nombreArchivo '.txt'];
fp = fopen(filename, 'r');
for j = 1:Config.nRegistrosTrain
line = ... |
function [E_n,E_w]=convertMatrix_toEdgePairs(W)
% Function to take sparse matrix representations of the
% edge energies and convert it to a form acceptable by the mexGraphCut function
% W -> is a symmetric matrix with the edge weights (diagnoal should be 0 , otherwise problems!)
% (double)
% IMP: E_n and E_w are ... |
clc
clear
%Runge Kutta methods
x0=input('x0=');
y0=input('y0=');
h=input('h=');
fx=x0*y0+y0^2;
k1=h*fx;
k2=h*(((x0+h/2)*(y0+k1/2))+(y0+k1/2)^2);
k3=h*(((x0+h/2)*(y0+k2/2))+(y0+k2/2)^2);
k4=h*((x0+h)*(y0+k3)+(y0+k3)^2);
dely=1/6*(k1+2*k2+2*k3+k4);
fprintf('dely=%0.4f\n',dely);
y1=y0+dely;
fprintf('y1=%0.4f... |
function circle = enclosingCircle(pts)
%ENCLOSINGCIRCLE Find the minimum circle enclosing a set of points.
%
% CIRCLE = enclosingCircle(POINTS);
% computes the circle CIRCLE=[xc yc r] which encloses all the points POINTS
% given as a N-by-2 array.
%
%
% Rewritten from a file from
% Yazan Ahed... |
function [AoA_angular,AoD_angular] = recover_angular_32(alpha_coeff)
%RECOVER_ANGULAR 此处显示有关此函数的摘要
% 此处显示详细说明
% alpha_coeff = load('matlab.mat');
% alpha_coeff=cell2mat(struct2cell(alpha_coeff));
% channel_matrix = load('channel_matrix.mat');
% channel_matrix=cell2mat(struct2cell(channel_matrix));
% alpha_... |
function h = plot_dataset(D)
% function plot_dataset(D)
%
% Creates a figure and plots the dataset in D
h = figure;
a = axes;
set(a,'XLim',[-100,100]);
set(a,'YLim',[-100,100]);
set(a,'XTick',[-100:50:100]);
set(a,'YTick',[-100:50:100]);
set(a,'XGrid','on');
set(a,'YGrid','on');
hold on;
n = size(D,1);
for i=1:... |
clc;
clear;
close all;
% Load the plant
load ohm100_10kHz.mat;
G1 = ohm100_10kHz;
% Sampling period
Ts = G1.Ts;
A = G1.A; B = G1.B; C = [0 1];
ref = 5; % 5V steady state voltage
% Steady state values computation
val_ss = [A-eye(2) B; C 0]\[0;0;1]*ref;
xs = val_ss(1:2);
us = val_ss(3);
%% Simulation
% Time vector
... |
%% Function Average Quaternions
% Jason Pile
% 1/15/2013
% This method of finding an average quaternion based on a set of given
% quaternions is based on the paper "Averaging Quaternions" by Yang Cheng,
% Landis Markley, John Crassidis, and Yaakov Oshman.
% This function implements the unweighted version of the avera... |
function spear2rad
%SPEAR2RAD example lattice definition file with CAVITY and CLASSICAL radiation
% Created 11/21/99
% Simplified SPEAR-II lattice
% no BPMs, no correctors
global FAMLIST THERING GLOBVAL
GLOBVAL.E0 = 3e9; % Design Energy [eV]
GLOBVAL.LatticeFile = 'spear2rad';
FAMLIST = cell(0);
disp('... |
function [ret] = X3(X1,X4)
ret=(14-(X1-X4))/3; |
classdef MatWsDrone < handle
% MatWsDrone: Matlab Websocket gateway to Ar.Drone
%
% drone = MatWsDrone()
% drone = MatWsDrone('ws://127.0.0.1:8025/t/ardrone')
%
% Methods:
% drone.connect() - opens the websocket
% drone.close() - closes the websocket
% drone.takeoff() - m... |
%% Make up data
nData = 200;
a = ones(2,nData);
a(1,:) = a(1,:)*300;
a(2,:) = a(2,:)*100;
a = normrnd(a, 20);
tau = ones(2,nData);
tau(1,:) = tau(1,:)*1.8;
tau(2,:) = tau(2,:)*.7;
tau = normrnd(tau, .05);
%% Calculate average lifetime for each curve (ie, before averaging components
% across curves.)
avgTau = avgLifet... |
function [] = arduinomove(theta,dist)
if (theta<7 && theta>-7)
fwrite(src, 'f');
pause(dist*1/x);
fwrite(src, 's');
end
if (theta>7 && theta>180)
fwrite(src,'r');
pause(0.5);
fwrite(src,'f');
pause(dist*1/x1);
fwrite(src,'s');
end
if theta>-180 && theta<-7
fwrite(src,'... |
clear VOCopts
warning('off','all')
% get current directory with forward slashes
addpath('../lib/sift')
addpath('./functions/')
addpath('./features/')
% add weka path
if strncmp(computer,'PC',2)
javaaddpath('C:\Program Files\Weka-3-7\weka.jar');
run('../lib\vlfeat-0.9.18\toolbox\vl_setup')
elseif... |
% Copyright 2018, by the California Institute of Technology. ALL RIGHTS
% RESERVED. United States Government Sponsorship acknowledged. Any
% commercial use must be negotiated with the Office of Technology Transfer
% at the California Institute of Technology.
% -----------------------------------------------------------... |
% Test file read
% File: c:\M-files\shortcut_updates\readtxt_TwinT.m
% 2/15/07
%
clc;clear;
ns=1e-9;
[time,v1,v3]=textread('c:\Spiceapps\datfiles\xformer_tran.txt','%f %f %f');
%
h=plot(time/ns,v1,'k',time/ns,v3,'r');
set(h,'LineWidth',2);
axis([0 200 -5 15]);
grid on
xlabel('Time (ns)');
ylabel('Volts');... |
function [Trs,tau,offsets,rescalings,period,refT]=reshapeData(time,traces,tau)
%format multiple trial data
tinit=time(:,1);
[~,inds]=sort(tinit,'descend');
traces=traces(inds,:);
time=time(inds,:);
refT=time(1,:);
% trial 1 is a reference -- events can't be outside the time length of this trial
period = diff(ti... |
% This software is distributed under the MIT License (MIT): see copyright.txt
%javaaddpath('D:\data\magweg\MatLab\mongo-java-driver-3.0.2.jar')
% https://oss.sonatype.org/content/repositories/releases/org/mongodb/mongodb-driver/3.0.2/
% downloaded 20jul2015
javaaddpath('D:/data/matlab/matlab_mongodb/mongo-java-drive... |
function [output_dec_state output_del] = ibd_decode_identity(identity, ob)
ct_total = 0;
t = cputime;
oblist = ob + 1;
[output_dec_state, output_del] = get_viterbi_locus_log(identity, oblist);
ct_total = ct_total + cputime - t
end
|
clear
clc
fid=fopen('ACdata.txt','r');
trash=fscanf(fid,'%*s',23);
for i=1:6
for j=1:7
data(i,j)={fscanf(fid,'%s',1)};
end
end
fclose(fid);
for i =1:6
structure(i).name=cell2mat((data(i,1:2)));
structure(i).number_of_engines=str2num(cell2mat(data(i,3)));
structure(i).engine_type=char(data(i,... |
function [X_fin,Y_fin] = spread_sin(Goal,SD)
if mod(Goal,SD)==0
Y_fin = SD;
X_fin = Goal/SD;
else
Y_fin = mod(Goal,SD);
X_fin = floor(Goal/SD)+1;
end |
h = [1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]';
for n= 1:500
initialcond = randi([0;1],1,23);
test = Scrambler(h,initialcond);
test2 = Descrambler(test,initialcond);
end |
% CSI700: Adams-Bashford Method
% J Schott
% 11 April 2011
function [r, gerr,lerr] = adams(f, df, y_zero, h, tmin, tmax)
syms t y;
prevExact = y_zero;
yhat = y_zero;
k = 1;
localerror = 0;
globalerror = 0;
for tCurr=tmin:h:tmax
% use runge-kutte for first 3
if ( k < 4 )
k... |
function ConfirmReinforcements(~,~, game, player)
if get(game.txtH, 'UserData') ~= 0
uiwait(msgbox('Please use all troops'))
return
end
total = 0;
for i = 1:numel(game.board)
occupant = get(game.board(i).Patch, 'UserData');
if occupant(1) == player
set(game.board(i).Patch, 'ButtonDownFcn', [])... |
function [ geometry index ] = permute_coords( geometry1, geometry2 )
%PERMUTE_COORDS Permute ions in a geometry to match another geometry.
% [geometry,index] = PERMUTE_COORDS(geometry1,geometry2) returns a
% geometry that is the same as geometry1 except that the order of the
% ions has been permuted to match geom... |
function [xrGeneral,sizeGeneral,msgGeneral,xrBierge,sendOrder,A,B,C ,errorBierge,loopBierge,msgBierge,xrNewton ,FiNewton,f_dev,errorNewton,loopNewton,msgNewton,xrFixedPoint, itrFixedPoint ,gx,xrBisection,itrBisection, xrFalsePosition, itrFalsePosition,xrSecent,FiSecent ,errorSecent,loopSecent,deltaSecent,msgSecent,msg... |
clear ; close all; clc
hidden_layer_size_1 = 30; % 25 hidden units
hidden_layer_size_2 = 25;
%% =========== Part 1: Loading and Visualizing Data =============
fprintf('Loading and Visualizing Data ...\n')
load('trainData.mat');
X=zscore(X);
m=size(X,1);
input_layer_size = size(X,2);
%num_labels=max... |
clc
syms s t
h(s)=(s+1)/(s^2+2*s+2);
x(t)=exp(-t);
x(s)=laplace(x(t));
y(s)=x(s)*h(s)
y(t)=ilaplace(y(s)) |
function slider_showpair(IM1,IM2,method)
%Slider GUI
hFig = figure;
hAx = axes('Parent',hFig);
startSlice = 1;
[~,~,stopSlice] = size(IM2);
%Slider control
uicontrol('Parent',hFig, 'Style','slider', 'Value',startSlice, 'Min',startSlice,...
'Max',stopSlice, 'SliderStep', [1 10]./(stopSlice-startSlice), ...
... |
function [ allData ] = genVariables( numInd )
%% set up variables
allData.t = zeros(1,numInd+1); %time vector
allData.q_desired=zeros(7,numInd); %desired joint positions
allData.ftdata = zeros(6,numInd); %F/T sensor data
allData.q_baxter=zeros(14,numInd); %measured joint positions
allData... |
clear all, close all
rew = @(x, y) exp(-.5*(x.^2/.4^2 + y.^2/.4^2));
rew = @(x, y) -(20 + x.^2 + y.^2 - 10*(cos(2*pi*x) + cos(2*pi*y)));
[X, Y] = meshgrid(-1:.01:1, -1:.01:1);
Z = rew(X, Y);
figure()
contourf(X, Y, Z, 15), colorbar, hold on,
%rew = @(x, y) input(['Reward for [', num2str(x), ',', num2str(y),']?: ']);
... |
clear;
epsilon= normrnd(0,1,110,1);%вспомогательный ряд
a=0.5; b=0.5; w=0.9; p=5; q=1; t=1:100;
Y1=epsilon(1:100); %y = ? , ? ~ N(0,1)
Y2=a*t'+Y1;
Y3=b*sin(w*t')+Y1;
%AP
Y4 = epsilon;% случайная составляющая
for i = 6:length(Y4) % генерация зависимостей
for j=1:p
Y4(i) = a*Y4(i-j) + Y4(i);
end
end
Y... |
while(1)
n = input('numero de armonicos? ');
f = zeros(n,1);
a = zeros(n,1);
f = input('vector columna f ?');
a = input('vector columna a ?');
% for i=1:n
%
% f(i) = input(sprintf('Frecuencia(%d)? ',i));
% a(i) = input(sprintf(' Amplitud(%d)? ',i));
%
% end
Fs = 40000; % Sampling frequ... |
clear;
clc;
Matri = load('E:\Schaffer\60-2result.txt');
[a,b] = size(Matri);
S = transpose(Matri);
S = reshape(S,a*b,1);
% for j=1:4
% d = (j-1)*1000;
% for i=800:870
% S(i+d) = 0.00050;
% end;
% for i=870:900
% S(i+d) = 0.00000;
% end;
% for i=900:1000
% S(i+d) = 0.00000;
... |
clc
clear all
close all
format long
%N = 15; % Рабочее N, для которого строим графики 1 - 6
N_arr=15%3:15;
iterations=[];
L_first_p1 = [];
L_neighb_last = [];
%%%
min_ekstr_it = [];
max_ekstr_it = [];
final_ekstr_it = [];
for N = N_arr % Диагностика зависимости числа итераций от N
% Равномерное распределение точек
n =... |
function varargout = TetrisTool(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TetrisTool_OpeningFcn, ...
'... |
function tracks = updateAssignedTracks(tracks, assignments, centroids, bboxes)
% The |updateAssignedTracks| function updates each assigned track with the
% corresponding detection. It calls the |correct| method of
% |vision.KalmanFilter| to correct the location estimate. Next, it stores
% the new bounding box, and incr... |
syms s;
C1A = 5e-6;
C1B = 5e-6;
C1C = 5e-6;
LATop = 03.40e-9;
LABot = 20.25e-9;
LAMid = 01.30e-9;
LBTop = 03.38e-9;
LBBot = 20.38e-9;
LBMid = 01.30e-9;
LCTop = 03.41e-9;
LCBot = 20.94e-9;
LCMid = 01.30e-9;
LABTop = 18.30e-9;
LABBot = 10.20e-9;
LBCTop = 21.84e-9;
LBCBot = 11.14e-9;
ESLA = 1... |
function varargout = centroidalVoronoi2d(germs, box, varargin)
%CENTROIDALVORONOI2D Create a 2D Centroidal Voronoi Tesselation
%
% [N E F] = centroidalVoronoi2d(GERMS, BOX)
% GERMS are N-by-2 point array, BOX is given as [xmin xmax ymin ymax].
% Algorithm is an iteration of voronoi diagram computations, using at
... |
function [nodes, edges, ages, error] = removeUnconnected(nodes, edges,ages,error) %#codegen
NumOfNodes = size(nodes,2);
i = 1;
while NumOfNodes >= i
if any(edges(i,:)) == 0
edges = [edges(1:i-1,:); edges(i+1:NumOfNodes,:);];
edges = [edges(:,1:i-1) edges(:,i+1:NumOfNodes);];
... |
function [eta, S] = ibpmultigpPruning(Euast, eta_old, S_old)
Q = size(Euast,1);
eta = eta_old;
S = S_old;
for k = Q:-1:2,
Zk = round(eta(:,k));
for l = k-1:-1:1,
Zl = round(eta(:,l));
cr = corrcoef(Euast{k},Euast{l});
cr = cr(1,2);
Sf = all( sign(S(:,k)).*Zk == sign(cr)*sign(S(:,... |
% Compare different windows
clc
clf
close all
clearvars
%% Prototype filter parameter definition
M = 16; % The number of channels
% M = 1024; % The number of channels
m = 1; % The length of each polyphase component
N = 2*m*M-1; % The order of the prototype filter
L = N+1; % The length of the prototype filter
%% Gener... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu % ... |
%First define the system of interest:
n=2; %n specifies the node number (Should always be 2 for now)
%Define name for saving data:
%ID=strcat('example_',datestr(now,30)); %name of file that will be saved.
ID = 'Net9_Exp_Comp_ZoomedIn';
%Define some original parameters that will not be scanned
gamma = 1; %Parame... |
function tau_eq = trade_lib_tariff_equivalent(tau_ini,p,GDP_growth_sc,GDP_ff,lambda)
format long
% Parameters:
flag_ff = 1;
flag_sc = 0;
% Guess:
taug = tau_ini-1.5*p;
% options:
options = optimset('Display','on','TolX',1e-6);
% Solution:
tau_eq = fzero(@fun1,taug,options);
... |
function [stateVarsDot,termEvent, direcEvent] = boat_roll_nd(t, stateVars, flag)
%Roll angle of vanishing stability
phiCritical = 0.88;
%Parameters for Edith Terkol
omegaN = 0.62;
omegaE = 0.527;
omegaBar = omegaE/omegaN;
alpha0 = 0.73;
H = 9.84;
lambda = 221.94;
b1 = 0.0043/omegaN;
b2 = 0.0225;
c2=0.1296/(omega... |
%__________Optimisation d'un manipulateur plan PRR__________
%
% Romain PESSIA, Maxime HOLSTEIN
% ROPAH 2017, enseignant : Stéphane CARO
%
%
% Ce programme a pour but d'optimiser les valeurs des
% caractéristiques du manipulateur plan PRR de façon à
% minimiser sa surface occupée.Il utilise la fonction fmin... |
function [counts,Fre] = rainFreCalculate( inputdata,yuzhi,yrnums )
%用于计算一列数据大于特定数值的个数及占气候背景的频率
% 输入一列数据及阈值,返回频数和频率
M=inputdata;
yz=yuzhi;
yn=yrnums;
counts=length(M(M>yz));
Fre=counts/yrnums*100.0;
end
|
% Load NIFTI dataset header. Support both *.nii and *.hdr/*.img file
% extension. If file extension is not provided, *.hdr/*.img will be
% used as default.
%
% Usage: [hdr, filetype, fileprefix, machine] = load_nii_hdr(filename)
%
% filename - NIFTI file name.
%
% Returned values:
%
% hdr - st... |
function X=LabSynchS
%Function for running 100 simulations for each c in 0.04 to 2 (in increments of 0.02)
%with the purpose of collecting polarization and scaled sized measurements
%for Figure 2.
t=15000; %Maximum time for each simulation
T=100; %Number of runs for each c
%ASYNCHRONOUS... |
clearvars
load('F:\HAT_A_06\ClusterBins_120dB\composite\HAT_A_06_recurs_1clust_typesHR.mat',...
'Tfinal','tIntMat','prunedNodeSetCat','subOrder')
TPWSList = dir('F:\HAT_A_06\HAT_A_06_d1-3_TPWS\HAT_A_06_disk*TPWS1.mat');
binDir = 'F:\HAT_A_06\ClusterBins_120dB';
outDir = 'F:\HAT_A_06\ClusterBins_120dB\forNNet';
me... |
%% Número esperado de copias en selección de torneo
%% Fórmula aproximada
n = 101; % tamaño de población
r = 0:n-1; % ranqueo
M = [2 4 8 16]; % tamaños de torneo
nC = [];
leyenda = {};
for i=1:length(M)
m = M(i);
% Usando la aproximación
nCopias = m.*(r./(n-1)).^(m-1);
nC = [nC;nCopias]... |
function pufnsr1
%Statystyka stosowana - przedzial - 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.440
0.930 1.476
0.... |
setup;
setup_mail;
%% loading data
clear
[X, Y] = dataSample(@f21, 2, 900);
%% minmax normalization
[sX, Xfw, Xbw] = minmaxNorm(X);
[sY, Yfw, Ybw] = minmaxNorm(Y);
%%
system('ulimit -t unlimited');
name = ['f21-', 'crossval-2d-', datetimestr];
fprintf('\n[wine]\n------\n');
I = 0;
I = I + 1;
models{I} = str... |
function bn = DecToBin(dc)
%convert decimal number to binary
int_dc = floor(dc);
frac_dc = dc - int_dc;
n = int_dc;
int_bn = '';
f = frac_dc;
frac_bn = '';
% integer part of dc to binary
while n ~= 0
int_bn = append(int2str(rem(n,2)), int_bn);
n = floor... |
% define figure
f1=figure
ax1=axes('position',[.05 .6 .2 .325]);
ax2=axes('position',[.3 .6 .2 .325]);
ax3=axes('position',[.05 .075 .45 .35]);
ax4=axes('position',[.525 -.20 .475 1.4]);
set(gcf,'Position',[100 100 1400 650])
% define movie
if(movieFLAG)
writerObj = VideoWriter([filename,'_Torus.mp4'],'MPEG-4'... |
% MBLBGFC.M
% Use b2, g2 & f2 for Bloch Equa calc
% Called by mblbm
% First check replot ****************************
if mblreplv == 1 ; % Re-Plot turned on; turn off
set(mbluirepl,'Visible','off') ;
set(mblreplb,'Visible','off') ;
mblreplv = 0 ;
end ;
% Do calcs ***************************************
mblbgfv ... |
clear
cT = 40;
iter = 1;
d = 1;
for i = 1:length(cT)
i
filename = sprintf('revision/tsrvf3/UMD_FR_PCA_%.2d_%.2d.mat',cT(i),iter);
load(filename)
[V,~] = ShootingVectorPCA(Reg_S,mu);
[pc,w,ev] = pca(V');
acc(i) = recog_expt(squareform(pdist(w(:,1:3))),10,10);
end
|
function rectObj = createRectObj(x, y, z, t, width, height)
%rectObj = createRectObj(x, y, z, c, t, width, height, transform)
rectObj = pojos.RectangleData;
rectObj.setX(x);
rectObj.setY(y);
rectObj.setZ(z);
%rectObj.setC(c);
rectObj.setT(t);
rectObj.setWidth(width);
rectObj.setHeight(height);
%rectObj.setTransform(tr... |
% output_multislice = il_multem(system_conf, input_multem) perform TEM simulation
% Scanning transmission electron microscopy (STEM) simulation
% All parameters of the input_multem structure are explained in ilm_dflt_input_multem()
% Copyright 2020 Ivan Lobato <Ivanlh20@gmail.com>
clear; clc;
addpath([fileparts(pwd) f... |
function varargout = SpSpj(varargin)
%example of using buttons to start and stop events created by Paulo Silva
%SPSPJ M-file for SpSpj.fig
% SPSPJ, by itself, creates a new SPSPJ or raises the existing
% singleton*.
%
% H = SPSPJ returns the handle to a new SPSPJ or the handle to
% the existing sing... |
% Outputs:
% NucSpotTotCorr=total number of molecules in spots in the nucleus
% CellSpotTotCorr=total number of molecules in spots in the cytoplasm
% N_nuc_poolCorr=total number of molecules in the pool in the nucleus
% N_cyto_poolCorr=total number of molecules in the pool in the cytoplasm
% Cell_Rad=cell radius
... |
%cam = webcam('Logitech');
original=imread('pictures.png');
original=original(MyParameters.YMIN:MyParameters.YMAX,...
MyParameters.XMIN:MyParameters.XMAX,:);
imtool(original)
image_points=[ 567 505;
521 459;
566 456;
470 459;
371 309;
419 309;
... |
function [indexes,slopes] = interp_index_list_3D(size_map,Xindex_precise,Yindex_precise,Zindex_precise)
%%interp_index_list_2D Gives a list of the indexes of the square to
%%interpolate and the 'local' coordinates
% Use with interpolation function
%% Coordinate in index
% Find X and Z in equidistant grid in index val... |
clear vars; % Limpa variáveis
close all; % Fecha todas as figuras
clc; % Limpa a tela
binaries = ['000'; '001'; '010'; '110'; '101'; '111'];
integers = listBinariesToInteger(binaries)
real = intToReal(integers, -5, 5);
tamPop = 20;
numVar = 2;
numBits = 10;
pop = round(rand(tamPop, numVar * numBits)) |
classdef UBEMStepper2d < handle
properties
% ========================================
% Stepper parameters
% ========================================
% Reference point at "infinity" and computation of potential
xref = -20; % x coordinate of point at infinity (as fraction of c... |
function [ newugs ] = calibratepulser( params )
%CALIBRATEPULSER Pulser auf 1% genau auf Sollwert einstellen
% Iterativ: Puls abfeuern, mit Oszi Ist-Wert messen, Pulser-Einstellung
% nachregeln
global instruments stopbatch
pulser=instruments.pulser;
h=[];
% Auf kleine ... |
function [rec,prec,ap] = VOCevaldet(opts,imdb,cls,draw)
% load test set
fprintf('%s: pr: evaluating detections\n',cls);
val = find(imdb.images.set == 2) ;
pre='conf';
gtids={};
for i=1:numel(val)
j= val(i);
name = imdb.images.filenames{j} ;
gtids{i} =name(1:end-4);
end
gt_from_seg=true ;
... |
function [Data, Tiempo, NData, a] = importar_datos(filename)
a = tdfread(sprintf('Data/cmd%s.txt', filename));
b = a.x0x23_Stellar_Evolution_Library0x3A_Bertelli94_0x3B_B0x2EC0x2E_;
% b = a.x0x23_Stellar_Evolution_Library0x3A_Teramo_0x3B_B0x2EC0x2E_Libr;
Tiempo = b(4:5,:);
tiempo = str2num(Tiempo(1... |
function BF = pa_bayesfactor(samplesPost,samplesPrior,crit)
% Quick and dirty code
%
% BF = PA_BAYESFACTOR(SAMPLESPOST,SAMPLESPRIOR)
%
% Determine Bayes factor for prior and posterior MCMC samples via the
% Savage-Dickey method.
%
% Determine if posterior is significantly different from a critical value
% CRIT... |
function dF
gn=@(ds) ds(2).name;
fprintf('evaluating function %s\n',gn(dbstack));
end |
function break_orig = decide_orig(break_orig,xs,S1_orig,S2_orig)
if xs(1)==1
S = S1_orig;
elseif xs(1)==2
S = S2_orig;
end
switch break_orig
case -1
break_orig = S(xs(2));
case 0
if S(xs(2))==0
break_orig = 0;
elseif (S(xs(2))==1) || (S(xs(2))==2)
break_or... |
%
%
% unit1_burst_creation.m
% S8 PROJECT
%
% Created by Mathias de Cacqueray on 20/03/14.
% Copyright (c) 2014 ProjetS8. All rights reserved.
%
clear all;
close all;
clc;
%Creating burst
for ech=2
if ech==1
Fech=250000;
porteuse=433750*10^3;
Nbechantillon=120;
Ts=Nbechantillo... |
function mbbtest(X,t,alpha)
%MBBTEST Multivariate Bootstrap Bartlett´s Test for the Homogeneity of
%Covariance Matrices.
% The bootstrap is a way of estimating the variability of a statistic
% from a single data set by resampling it independently and with equal
% probabilities (Monte Carlo resampling). Allows th... |
function sol = bme_export()
tfinal = 3000; % Final time for simulation
species = {'sp_0','sp_1','sp_2','sp4','sp5','sp6','sp7','sp8','sp9','sp10','sp11','sp12','sp13','sp14'}; % The list of all species
n = length(species);
% Write out the parameters
% Assign initial conditions
x0 = zeros(n,1);
x0(1) = 13.0; % sp_0
... |
%滞环特性响应曲线
clc;
clear all;
close all;
k=1;
T=10;
dt=0.1;
st=200;
r=1;
lp=fix(st/dt);
a=exp(-dt/T);
b=1-a;
e0=0;
e2=[];
e3=[];
x(1:2)=0;
t=[];
y=[];
h=0.1;
M=1;
for i=1:lp
e=r-x(2);
e1=(e-e0)/dt;
e0=e;
if e>=h
u=M;
else if e>-h
if e1>0
u=-M;
... |
clc;close all;clear;
point1 = [[1,1];[2,0];[2,1];[0,2];[1,3]];
point2 = [[-1,2];[0,0];[-1,0];[-1,-1];[0,-2]];
figure;
scatter(point1(:,1),point1(:,2),'b');
hold on;
scatter(point2(:,1),point2(:,2),'r');
mixed = [point1;-point2];
mixed = [mixed,[ones(5,1);-ones(5,1)]];
W = [1,-1,1];
c =1;
flag = 0;
score = 0;
iter ... |
function [X, y] = preprocess(path_to_dataset, histogram, count_bins)
#cats images
path_to_imgs_cats = strcat(path_to_dataset, 'cats/');
path_to_imgs_cats = strcat(path_to_imgs_cats, '*jpg');
img_files_cats = dir(path_to_imgs_cats);
path_to_dataset_cats = strcat(path_to_dataset, 'cats/');
n = length(img_fi... |
function [errors] = nnlearnlambda(X_train, y_train, X_val, y_val)
[m, n] = size(X_train);
input_layer_size = n;
hidden_layer_size = round(n*1.25); % 25 hidden units
num_labels = 7; % 10 labels, from 1 to 10
max_iter = 1000;
initial_nn_params = calculate_initial_nn_params(input_layer_size, hidden_layer_s... |
function rk4StepSize = LRCrk4StepSize
%LRCRK4STEPSIZE Summary of this function goes here
% Detailed explanation goes here
% Number of steps for rk4stepperSec loop
% rk4StepSize = 30;
rk4StepSize = 3;
end
|
% Heat equation using FEM and BDF
% Partial observation and noise
clear all
%close all
a = 0;
b = 1;
ni = 100;
mu = 1;
alpha = 10;
n = ni - 1;
h = (b-a)/ni;
% Generate the system matrices
[M,A,B,Q,R,H] = matrix_fem(ni,mu,alpha);
% uncontrolled eigenvalues
eo=eigs(A,M,10,'LA');
% Obtaining contro... |
function machine=localhost()
[~,report]=system('ipconfig');
start=strfind(report,'IPv4 Address');
report=report(start:end);
while numel(report)>0
address=sscanf(report,':%d.%d.%d.%d',4);
if isempty(address)
report=report(2:end);
continue
end
break
end
machine=sprintf('%d.',address);
mac... |
function [output, err] = equalizer(sps,samples,taps,initial_tap)
mu=0.005;
reg=zeros(1,taps);
wts=zeros(1,taps);
wts(initial_tap)=1;
m=1;
for n=1:sps:length(samples)-sps
reg=[samples(n) reg(1:taps-1)];
output(n)=reg*wts';
err(m)=0.01;
if n>=20
x_det=sign(real(output(n)))+j*sign(imag(output(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.