text stringlengths 8 6.12M |
|---|
% RES = CBD(ACTUAL, EXPECTED)
%
% Capped Binomial Deviance for binary classification/prediction
%
% ACTUAL - acctual value
% PREDICTED - predicted value
% RES - resulting Capped Binomial Deviance, if error occurrs it's set to -1
%
% Sources:
% 1. http://www.kaggle.com/c/ChessRatings2/details/Evaluation
% 2. http://www.... |
load('f6.mat');
for o = 1:2
for h = 1:2
for ph = 1:2
id = find_multiple_strings_in_cell(DATA.Properties.VariableNames, {pstr{ph} ostr{o}, half{h}});
d(:, h,ph,o)=table2array(DATA(:,id));
end
end
end
[tbl, rm] = simple_mixed_anova(d,[], {'Half', 'Phase', ... |
function surf = intersect_rect( rect1, rect2 )
%surf = intersect_rect( rect1, rect2 )
% Compute the intersection of 2 rectangles.
% Isabelle Guyon -- isabelle@clopinet.com -- February 2012
x1=rect1(1);
y1=rect1(2);
w1=rect1(3);
h1=rect1(4);
x2=rect2(1);
y2=rect2(2);
w2=rect2(3);
h2=rect2(4);
x=max(x1, x2);
y=max(y1... |
%1. algorithme de l'érosion ultime
clear all;
S= [ 0 1 0 ;
1 1 1 ;
0 1 0 ];
img=imread('BE06I01.bmp');
imgbin=zeros(296,534);
for i=1:296
for j=1:534
if img(i,j,1)<127
imgbin(i,j)=0;
else
imgbin(i,j)=1;
end
end
end
imgErod = doub... |
function [T, p, corrp, COPE] = univariate_edge_test(netmats, designMatrix, contrasts, standardise)
%UNIVARIATE_EDGE_TEST permutation test for group-level stats on networks
%
% [T, P, CORRP] = UNIVARIATE_EDGE_TEST(NETMATS, DESIGN, CONTRAST) performs
% univariate testing for significance on each edge of a network ... |
classdef multimodel < handle
properties
matrixmodel
n
iall
iemis
itrans
iin
idur
end
methods
function self = multimodel(matrixmodel,n,iall,iemis,itrans,iin,idur)
if exist('matrixmodel','var'), self.matrixmodel=matrixmod... |
function mass_get_freq_asym(db)
ensure_opt;
db_len = length(db);
all_asym = cell(db_len, 1);
for r = 1:db_len
out = get_freq_from_db(db, r);
all_asym{r} = out.asym;
end
lens = cellfun(@length, all_asym);
if length(unique(lens)) > 1
error(['Files are of different lengths. ',...
'This is not implemented... |
function onto_ogive
% create ogive describing ontogenetic migration of adult blue rockfish
% based on Rick Starr's rocky reef & PISCO kelp forest data
% for use with fitting models to PISCO data
% Load in PISCO data
load('SMYS_Pt_Lobos_data_sorted.mat')
% compile into a single histogram, focusing on post-2007 data
S... |
% Lecture 2.3 - Round-off errors and iterative methods
% Calculate sqrt(2) using Heron Algorithm
% It's an iterative method wherein we assume the result first and then keep
% on performing iterations to come to actual result
x = 0.5; % Assuming the answer of our computation
atol = 1.0e-5; % Setting... |
% p = points to reflect
% line = 2 endpoints on reflection axis (2D)
function refp = reflectOverLine(p, line)
dline = diff(line);
dline = dline / norm(dline);
refp = bsxfun(@minus,p, line(1,:));
w = sum(bsxfun(@times, refp, dline),2);
refp = bsxfun(@plus, 2*line(1,:), -p + 2*w*dline);
end |
% fuel_cell_h2_in.m ADVISOR 2003 input file created: 23-May-2003 14:15:38
global vinf
vinf.name='fuel_cell_h2_in';
vinf.drivetrain.name='fuel_cell';
vinf.fuel_converter.name='FC_ANL50H2';
vinf.fuel_converter.ver='fcell';
vinf.fuel_converter.type='net';
vinf.motor_controller.name='MC_AC75';
vinf.energy_storage.name... |
function configMoteD(paramArr,moteID)
% configMoteD(paramArr,moteID)
% Allows for command line configuration of motes, using global Defaults.
%
% paramArr array of parameters to set into the fields
% a value of -1 means keep the global default, which
% is stored in APPS.MAGDIRECTBOT
% [report... |
function Assembly()
close all;
%% Initialisation
%% If not using the real robot, comment this section out & all 'MoveUR3'calls
%Initialisation for real-world use -- rosinit('192.168.0.50')
% ur_move_joint_client = rossvcclient('/ur_move');
% ur_move_joint_msg = rosmessage(ur_move_joint_client);
% ur_move_joint... |
function [washer] = getRedWasher(snapShot, properties)
c2 = 1;
true = 0;
for c1 = 1:numel(properties)
radius = sqrt(properties(c1).Area / pi);
halfRadius = radius / 2;
% Obtains Average Red value of current Washer
color1 = sum(sum(snapShot(floor(properties(c1).Centroid(2) - ... |
%hvsavepars - issue 1.1 (02/02/09) - HVLab HRV Toolbox
%-----------------------------------------------------
%[] = hvsavepars(parfile);
% Save parameter values in global parameter structure 'HV' to a
% parameter file
%
% parfile = string containing pathname of the parameter file that
% contains t... |
% Copyright 2014
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writin... |
function [mito_listMETS, cyto_listMETS] = findCompartmentMETS(list_METS)
% find list items in the mitochondria
mito_listMETS =[];
cyto_listMETS = [];
for i=1:size(list_METS,1)
t = strfind(list_METS(i), '_mt'); %look for mito identifier
if ~isempty(cell2mat(t))
mit... |
clear; clc; close all;
% center frequency
centerFrequency = 2.4e9;
% number of distance samples
nSamples = 1e2;
% AP-user distance
directDistance = 12;
% vertical distance from the IRS to the AP-user path
verticalDistance = 2;
% projection of AP-IRS distance to the AP-user path
horizontalDistance = linspace(0, directD... |
classdef rization < handle
% Abstract class for parametrization
% y = fun(x)
% dy(x)/dx = dfun(x)
properties (SetAccess=protected)
name
end
%% properties %%
%% methods %%
methods (Abstract=true)
[y, dydx] = x2y(obj, x)
[x, dxdy] = y2x(obj, y) % the inverse mapping
e... |
clc
clear all
close all
file1=input('Enter input filename : ','s');
img=imread(file1);
[r,c,d]=size(img);
f=zeros(256,1);
for i=1:r
for j=1:c
f(img(i,j,1)+1)=f(img(i,j,1)+1)+1;
end
end
pro=r*c;
f=f/pro;
subplot(1,3,1);
imshow(img);
subplot(1,3,2);
imhist(img(:,:,1));
ylim([0 5e4]);
subplot(1,3,3);
bar(0... |
function ref_arch = SCHED_get_ref_arch()
ref_arch.arch = RBES_get_parameter('SCHED_ref_arch');
ref_arch.data_continuity = 1;
ref_arch.discounted_value = 1;
end
|
function gantry2_edit_orig(varargin)
if nargin < 1
DIRlist(1,1).path_in = uigetdir('C:\','SELECT INPUT DIRECTORY');
if DIRlist(1,1).path_in == 0
% clc
disp('ERROR: at least 1 input directory path is neccessary!')
clear all;
return;
end
pause(1)
DIRlist(1,1).path_out ... |
function [ SCHUPR,SCHUHT ] = SCHUMN( context,J,Z,ZO2,COLUMN,SCHUPR,SCHUHT )
%SCHUMN production of o(1d)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% SUBROUTINE SCHUMN(J,Z,ZO2,COLUMN,SCHUPR,SCHUHT)
%......... production of o(1d) by schumann-runge bands
%......... The fluxes are from To... |
% Import svm library
importDependencies();
% Define class labels
class_labels = { 'airplanes'; 'barrel'; 'bonsai'; 'brontosaurus'; 'camera';
'ceiling_fan'; 'anchor'; 'binocular'; 'brain'; 'butterfly';
'car_side'; 'cellphone'};
% Load data sets
[trainingSet,trainingLabels,testSet,testLabels] = ...
sa... |
function MSE = fractionalblockmatching(previous_pic, current_pic)
global fig_no;
%Set-up dimension of the image
blocksize = 16;
%Now write your own block matcher
max_motion = 8;
[rows, cols, channels] = size(double(previous_pic));
% Let us make up the location of all the pixels in the image
X = ones(rows, 1... |
function weights=sesweights(n,alpha1)
weights=ones(n,1);
if isnan(alpha1)==0 % weighted with simple exponential smoothing
weights(1,1)=alpha1;
for i=2:n
weights(i,1)=weights(i-1)*(1-alpha1);
end
weights=weights(end:-1:1);
end
|
% +COLLECT
%
% Files
% CellArrayList - List implemented with a CellArray
% List - Typesafe list of handle objects
% MapSet - Implementation of Set using containers.Map
% Set - Interface defining a Set
|
function [R,E,k,alpha,G]=durbin(xf,N,p,wtype)
% function [R,E,k,alpha,G]=durbin(xf,N,p,wtype)
%
% compute window based on wtype; wtype=1 for Hamming window, wtype=0 for
% Rectangular window
%
% compute R(0:p) from windowed xf
%
% solve Durbin recursion fo E,k,alpha in 8 easy steps
% step 1--E(0)=R(0)
% step... |
% EXERCISE1: basic training and testing of a classifier
% setup MATLAB and the paths
setup ;
paths = localPaths() ;
% error('missing trainLinearSVM');
% --------------------------------------------------------------------
% Stage A: Data Preparation
% --------------------------------------------------------------------... |
% Script for pre-generating channel specific model
% (C) Copyright 2019 The Huang Lab
%
% All rights reserved Weldon School of Biomedical Engineering
% Purdue University
% West Lafayette, Indiana
% ... |
function H = rgbhist_mask(I, mask, nBins, Nind)
% mask is a binary mask image
% I is RGB image
% Adapted from RGB color histogram code by Mopuri K Reddy, SERC, IISc, Bengalur, INDIA.
%% RGBHIST: color Histogram of an RGB image.
%
% nBins : number of bins per EACH color => histogram is 'nBins^3' long.
% Nind : N... |
%% 数据部分
x=0:0.1:2*pi; %X
y=sin(x); %Y
lw=0.1/2; % 线宽
%% 方案1
lx=diff(x);
ly=diff(y);
lr=sqrt(lx.^2+ly.^2);
lx=lx./lr;
ly=ly./lr;
X=x([2:end,end:-1:2])+lw*[ly,-ly(end:-1:1)];
Y=y([2:end,end:-1:2])+lw*[-lx,lx(end:-1:1)];
fill(X,Y,'-r','EdgeColor','none','FaceAlpha',0.5)
%% 方案2
LinAlpha=0.25;
ColorValue=[1,0,0]... |
close all;
clear;clc;
sampleNum = 1000;
theta = 2*pi*rand(1,sampleNum);
r = rand(1,sampleNum).^0.5;
x = 5*r.*cos(theta);
y = 1*r.*sin(theta);
shift_theta = pi/6;
newx = x.*cos(shift_theta)-y.*sin(shift_theta);
newy = x.*sin(shift_theta)+y.*cos(shift_theta);
%% Plot
plotwidth = 1;
plotmargin = (1-plotwidth)/2;
f1 = f... |
% -------------------------------------------------------------------------
% jitter_hybrid.m
% Simulate a digital LQR control system with release jitter
% Xiaotian Dai, University of York, 2017
% -------------------------------------------------------------------------
%global g_period
% simulation parameters
x_orde... |
function CellsGTstats(aImarisApplicationID)
% ImarisXT: produces goodness of spots segmentation statistics.
%
% DESCRIPTION
%
% ImarisXT: Takes as input a segmentation of an object and its manually sellected
% ground truth to produce statistics informing about the goodness of
% segmentation.
%
%
% <Cust... |
function K = nmodeK_1(I1,L1,d1,g,m1,omega1,theta1)
%NMODEK_1
% K = NMODEK_1(I1,L1,D1,G,M1,OMEGA1,THETA1)
% This function was generated by the Symbolic Math Toolbox version 8.1.
% 11-Dec-2018 19:16:12
K = [d1.*conj(g).*conj(m1)];
|
% increasing neurons and stimuli in all image datasets
function suppfig_incrNeuStim(dataroot,matroot)
load(fullfile(dataroot,'dbstims.mat'));
%%
close all;
pos_inches = [1 3 7.5 9];
HF = default_figure(pos_inches);
%%
clf;
titlestr = {'Natural images','Spatially whitened images','8D images', ...
'4D images', 'S... |
function varargout = GUI(varargin)
% GUI MATLAB code for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
set(0,'defaultAxesFontSize',14,'defaultTextInterpreter','latex');
rng(260196,'twister');
set(0,'DefaultAxesColorOrder',[0 0 0]);
Pre = load('IRFMedbqPre');
Post = load('IRFMedbqPost');
Full = load('IRFMedbqFull');
Bernanke = load('IRFMedbqBern');
figure;
plot(Post.IRFMED_bq(:,6,3),'LineWidth',1.5)
hold on
plot(Pre.IR... |
%% Name - Sheel Nidhan
% Date - 11th September, 2019
% Plots for the eigenvalues results for prf_spod_re5e4_frinf paper
dirout = '/home/sheel/Dropbox/research/sheel_papers/prf_spod_re5e4_frinf/template/figures_2.0/';
% dirout = 'C:\Users\snidh\Dropbox\research\sheel_papers\prf_spod_re5e4_frinf\template\figures_2.0\'... |
function f_InicArchDat(in,m_SetElem,e_DatSet,e_VG)
nSet = e_VG.nSet;
fileCompleto = e_VG.fileCompleto;
%% Archivo que indica que paso del esquema del newton que no convergió.
nomArch = [fileCompleto,'.pasNoConv'];
%Se borra para que cuando no converja se cree el archivo y indique que no conve... |
clear all
close all
clc
addpath(genpath('./libs'))
addpath(genpath('../data'))
openR;
evalR('install.packages("glasso")')
evalR('library("glasso",lib.loc="C:/Users/matineh/Dropbox/projects/glasso-model-feature-select/libs/")')
% evalR('library("glasso")')
measurementType = 'fa';
subjectType = 'hs';
HS = readTbiPd... |
%% fn_drawpoly
%% Syntax
% hl = fn_drawpoly(poly,varargin)
%% Description
% shortcut for line(poly(:,1),poly(:,2),varargin{:})
%% Source
% Thomas Deneux
%
% Copyright 2006-2012
%
|
clear; clc;
%% use Andrej Karpathy's tinyshakespeare dataset
url = 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt';
training_portion = 0.9;
data = urlread(url);
[chars, ~, char_to_ix] = unique(data);
cd(fileparts(which(mfilename)));
addpath ../../tools/tensorIO_matlab/
... |
function [SignalMask CellBoundaryMask] = getCellMaskAndBoundary2(frame,local_region)
%
% Created by Isabel Llorente-Garcia, June 2012.
% If you use this code please acknowledge Isabel Llorente-Garcia in your
% publications.
%
% Same as function getCellMaskAndBoundary.m but using a local region to find the thresholding ... |
function [Zsfldd, Zsfrdd, Zsrldd, Zsrrdd] = coupling(rollfdd, rollrdd, pitchdd, Zsdd, fcm)
Zsfldd = Zsdd + fcm.Lcf*pitchdd + (fcm.Lcw/2)*rollfdd;
Zsfrdd = Zsdd + fcm.Lcf*pitchdd - (fcm.Lcw/2)*rollfdd;
Zsrldd = Zsdd - fcm.Lcr*pitchdd + (fcm.Lcw/2)*rollrdd;
Zsrrdd = Zsdd - fcm.Lcr*pitchdd - (fcm.Lcw/... |
%---------------------------------------------------------
% Low-pass FIR digital differentiator (LPFIRDD) design -
% via constrained quadratic programming (QP) -
% [Copt,c]=lpfirdd(N,alpha,beta,r,idraw) -
% By Dr Yangquan Chen 019-07-1999 -
% Email=<yqchen@ieee.or... |
load test
coef = myplc(x,15)
transpose(a) |
%Solving PDE with staggered leapfrog method
xmin = 0;
xmax = 60;
dx = 0.2;
tmax = 20;
dt = 0.002;
A = 10;
v = 2;
d = 1.5;
x0 = 10;
%Discretise both space and time
xVals = xmin:dx:xmax;
tVals = 0:dt:tmax;
%Create matrix to store values of function u(x,t)
u = zeros(length(xVals),length(tVals));
%P... |
function [data] = get_keithly175()
%GET_KEITHLY175 Gets the reading from Keithly 175 over GPIB
%% Instrument Connection
% Find a GPIB object.
obj1 = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 2, 'Tag', '');
% Create the GPIB object if it does not exist
% otherwise use the object that was found.
if ... |
function p = addField(varargin)
%p = addField(varargin)
%
% p = addField(packet, ( (label, size, <value> ) | (field struct, <value>) )* )
%
%This function adds a field to the beginning of the data field.
%The data field is then reduced in size by the size of the new field.
%If there is no data field, this function do... |
function conexos = conexos(distancias,medida)
resFila = {[1]};
cant = 1;
for i=1:99
if distancias(i) < medida
resFila(cant) = {[cell2mat(resFila(cant)),i+1]};
else
cant = cant+1;
resFila(cant) = {[i+1]};
end
end
if cant > 1 && distancias(100) < m... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 4.5: Operaciones aritméticas, lógicas y morfológicas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4.4.2 Operaciones Lógicas
%%%%%%%%%%%%%%%%%%... |
function demo_timevp_extract_pairs(demo_id)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MODULE 5: Extract event pairs
% This component extract pairs of events according to some temporal definition.
% E.g. the parent was displaying the toy then the infant looked at the toy within 2 se... |
function outpath=rigid_affine(fixed,moving,do_warp,do_avg,is_rigid,outpath)
ANTS='/Applications/SegmentationSoftware/ANTS/';
if ~iscell(fixed)
fixed={fixed};
end
if ~iscell(moving)
moving={moving};
end
if ~exist('is_rigid','var')
is_rigid=1;
end
if is_rigid==1
rigid=' --rigid-affine true ';
else
... |
function print_color_smarter(fid, PRN)
% function print_color(fid, PRN)
% called by google earth code
% it would be nice if someone made this less stupid. KL
% blue green red, whereas matlab uses red green blue
% no one bothered to provide a link for htis - maybe this will help
% http://msdn.microsoft.com/en-us/library... |
% A standard model for foveal detection of spatial contrast
% Paper: A standard model for foveal detection of spatial contrast
% AB Watson, AJ Ahumada Journal of Vision 5 (9), 6, 2005
% Model Structure
% Stimuli-Contrast-CSF-Oblique effect-Spatial Aperture-Channel-Minkowski pooling
% Input and output
% input to ... |
function data=reg2ordinal(data);
[m,n]=size(data);
minv=min(data(:,n));
maxv=max(data(:,n));
interval=(maxv-minv)/5;
data=sortrows(data,n);
for i =1:m;
dival=round((data(i,n)-minv)/interval);
data(i,n)=dival+1;
end
|
function [S2sc_optim_L, S2sc_optim_R, normUpArm_L, normUpArm_R] = getS2scDrop(trc,offset3D,window) %,S2sc_estim)
% finds offset between shoulder marker on acromion and shoulder joint
% center that minimizes CHANGE in norm distance between shoulder and elbow
% joint centers. Units in METERS.
% if "3Doffset" = 0, assum... |
%% Initialization
clear all;
close all;
clc;
[n,t,rawdata] = xlsread('Thesis_Data_0403.csv'); % This converts the CSV file into a matlab file.
load order.mat
rawdata = [rawdata,FL_163_DO];
% This throws in the order of the survey for analysis at the end.
% Rawdata needs to be processed through the ... |
function [ medium ] = makeRandomMedium( param, rateEMCL, nEMCL, rateIMCL )
%MAKERANDOMMEDIUM: 割合,サイズを指定して複数条件のMEDIUMを生成する関数
% 音速
v_muscle = 1580;%筋肉の音速[m/s]
v_fat = 1450;%脂肪の音速[m/s]
% 密度
den_muscle = 1040;%筋肉の密度[kg/m3]
den_fat = 920;%脂肪の密度[kg/m3]
%mediumの初期化
Nx= param.grid.Nx;
Ny= param.grid.Ny;
dx = param.grid.dx;
dy ... |
clear;
clc;
%%%%%%%%%%%%%%%%%%%%%%%% Exploratory statistics - numerical measures
disp('Measures of location');
GlassIdentificationDataSet = readtable('C:\84_assignment_2\data\GlassIdentificationDataSet.xlsx');
disp(GlassIdentificationDataSet);
Max = max(GlassIdentificationDataSet{:,3:4});
disp('Max');
disp(... |
%SetBackoffTime函数功能:根据退避次数生成退避时间
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ret = setBackoffTime(D)
n = D; %生成退避时间的上限值
int_n=round(n);
t = randperm(int_n)-1 ; %-1 ... |
function t = mst(mpc),
[F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
opt = mpoption('OUT_ALL', 0, 'VERBOSE', 0);
mpc_tree = mpc;
r = runpf(mpc_tree, opt);
if r.success ~= 1,... |
function q = extractq(v)
%from the input vector v = [q1,w1,q2,w2,...,qN,wN] it gives as an
%output just the q components : q = [q1,q2,...,qN]
N = length(v(:,1))/6; %Number of connected pendulums
m = length(v(1,:));
q = zeros(3*N,m);
for i = 1:N
q(3*i-2:3*i,:) = v(6*i-5:6*i-3,:);
en... |
function rbm = buildRBM( n_in,n_hidden,active)
%创建RBM,并初始化参数
rbm.w=0.1*randn(n_hidden,n_in);
rbm.b=zeros(n_in,1);
rbm.c=zeros(n_hidden,1);
rbm.active=active;
end
|
%% ------------------------------------------------------------------------%
% EE 569 Homework #3
% Date: Nov. 1, 2015
% Name: Faiyadh Shahid
% ID: 4054-4699-70
% Email: fshahid@usc.edu
%------------------------------------------------------------------------%
function [outPosition, out] = getPosOfCapture(pixelDensity,... |
% Script TFA_Analysis_BatData.m
% Author: D.R.Ohm
%
% Loads Bat data (or any other data) and generates TFA gram
% using a STFT.
%
%**************************************************************************
clear all; close all
[filename,pathname] = uigetfile('*.mat','Select data to load')
pathplusfile = [... |
function y = KL(rho, x)
% KL(rho, x) is the Kullback-Leibler divergence between a Bernoulli random
% variable with mean rho and a Bernoulli random variable with mean x
%
% KL-divergence is a standard function for measuring how different two
% distributions are.
% assert(isscalar(rho), 'rho must be a scalar.... |
% figure for random search
close all
clc
func = @(x) exp(-1*(x(1)).^2).*cos(pi*(x(1)))-pi/2.*exp(-2*(x(2)).^2).*sin(2*pi*x(2))+sin(2*pi*x(3));
bounds = [-10 10;-10 10;0 1];
N_list = 100:500:10000;
F = zeros(1,length(N_list));
for kk = 1:50
for jj = 1:length(N_list)
N = N_list(jj);
x_val = random... |
function [X,Y]=DrawSpline(n, k, P, NodeVector)
% B样条的绘图函数
% 已知n+1个控制顶点P(i), k次B样条,P是2*(n+1)矩阵存控制顶点坐标, 节点向量NodeVector
plot(P(1, 1:n+1), P(2, 1:n+1),...
'o','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',6)... |
function indx = r8col_sort_heap_index_a ( m, n, a )
%*****************************************************************************80
%
%% R8COL_SORT_HEAP_INDEX_A does an indexed heap ascending sort of an R8COL.
%
% Discussion:
%
% The sorting is not actually carried out. Rather an index array is
% created whic... |
function [ sample_index, num_each_track,sample_label,gt_sample_label]=track_sample(labels,sample_num)
label = labels(:,2);
classes = unique(label);
sample_index = [];
num_each_track = [];
for i = 1:1:length(classes)
track_index = find(label== classes(i));
if length(track_index) <= sample_num
sample_inde... |
function [cls, correct] = lda(obj, group_field, perc_training)
% LDA -- Perform basic linear descriminant analysis.
%
% cls = dsp2.analysis.lda.lda( coh, 'outcomes', .75 ); performs LDA by
% using 75% of data in `coh` as training data, and the remaining 25% as
% sample data to classify the 'outcomes' in ... |
function [L,U] = BlockLU(A,r)
% function [L,U] = BlockLU(A,r)
% Block LU without pivoting.
% A is nxn and has an LU factorization.
% L is nxn and unit lower triangular.
% U is nxn and upper triangular.
% r is the block size and n/r = N is an integer.
% A = LU
% GVL4: Algorithm 3.2.3
[n,n] = size(A); L = zero... |
clc;
close all;
clear;
v=videoinput('winvideo',1,'RGB24_640x480');
preview(v);
|
%Frequency domain band pass filter
clc;
clear all;
close all;
a=imread('dewdrop.jpg');
[m n]=size(a);
mask=zeros(m,n);
for i=130:220
for j=200:300
mask(i,j)=1;
end
end
for i=150:190
for j=230:270
mask(i,j)=0;
end
end
b=fftshift(mask);
b=fft2(a);
c=fftshift(mask);
d=b.... |
clear;
%% Variables para modficiar
name= "Ejemplo4.csv";%%%"Ejemplo3.csv"; %"Ejemplo2.csv" "Ejemplo1.csv"
[ALL]=table2array(readtable(name));
of=1; %N° de muestra dónde se comienza a tomar los datos.
fin=length(ALL); %Defecto: length(ALL); N° de muestra dónde deja de tomar los datos.
%El tiempo entre cada muestra es 5... |
clear
close all
addpath ../model
xdk = figure('units','inches','Position',[-24,5,5,4]);
swp0 = -0.3;
out = zeros(240,3);
hh = 0:0.1:23.9;
tmax_max = 1.5e-4; % midday unstressed tmax, results in about 4.3mm/d total T
tmax_oneday = tforc(tmax_max,hh);
kmax = 6e-5;
j = 0;
for swp = 0:-0.5:-1
j = j+1;
i = ... |
function Build_MOC_Input
% function Build_MOC_Input
% This function is used to build MOC input files for the MOC code written
% by Michael Kaplan and Rehan Nawaz with the assistance of Professor
% Anthony Waas
%
% by Michael Kaplan
% create the filespace
filename = 'TEST_0.5_01_AS.moci';
fid = fopen(fil... |
%generate the noisy signal which will be filtered
x= cos(2*pi*12*[0:0.001:1.23]);
x(end) = [];
[b a] = butter(2,[0.6 0.7],'bandpass');
filtered_noise = filter(b,a,randn(1, length(x)*2));
x = (x + 0.5*filtered_noise(500:500+length(x)-1))/length(x)*2;
% This script is available at http://dadorran.wordpress.com sear... |
function [pden] = sw_pden0(salt,temp,depth,latitude)
%This function is simply shorthand for
%sw_pden(salt,temp,sw_pres(depth,lat),sea level pressure)-1000
%
% It gives the resulting potential density anomaly.
pden = sw_pden(salt,temp,sw_pres(depth,latitude),1/9.87*ones(size(depth)))-1000;
end
|
# Wesley van Hoorn -- s4018044
clear all;
close all;
load dataset.mat
# reduced template building
T0 = mean(train_set0);
T1 = mean(train_set1);
# variance
v0 = var(train_set0);
v1 = var(train_set1);
# POI selection
adT = abs(T0 - T1);
idx = find(adT == max(adT));
p0 = T0(idx);
p1 = T1(idx);
# POI 0 univariate n... |
clearvars
close all
clc
% input image files
imageDirectory = '/Users/mike/Documents/UW/Research/Data/TGTCalibration/1831UTC_portcalibration';
outputDirectory = '/Users/mike/Documents/UW/Research/Data/TGTCalibration/PostCalibration_Port';
mkdir(outputDirectory)
calibrationFileName = [outputDirectory '/StereoCalibration... |
function [PSNR] = imreed(OrgImg,ModImg)
%source of code
%http://stackoverflow.com/questions/16264141/power-signal-noise-ratio-psnr-of-colored-jpeg-image/16265510#16265510
I = imread(OrgImg);
Ihat = imread(ModImg);
% Read the dimensions of the image.
[rows, columns ~] = size(I);
% Calculate mean square error ... |
%% Matris tanımlandı ve dosya okuma işlemi yapıldı.
[nota,k,t]=textread('notalar.txt','%s %s %s');
%% Frekans değeri tanımlandı
fs=10000;
%% Duraklama değeri
ds=round(fs/100);
%% Gecikme değeri
gecikme=round(fs/10);
%%
notalar=zeros(1,fs); % Zeros=0 matris
a=zeros(1,length(notalar));% notaların karakterlerini s... |
%% date_allStat
% get date of allStat.mat file
%
function date = date_allStat
% created at 2020/02/11 by Bas Kooijman
%% Syntax
% date = <date_allStat.m *date_allStat*>
%% Description
% Get date of allStat.mat
%
% Output
%
% * date string
%% Remark
% convert to yyyy/mm/dd with datestr(date_allSt... |
%
% Commands executed when RUN button is pushed from cycle setup figure
%
global vinf;
deltaSOC_tol=vinf.cycle.SOCtol/100; %tolerance for zero delta SOC correction, given by user in %
max_zero_delta_iter=vinf.cycle.SOCiter; % maximum number of zero delta soc iterations
if strcmp(vinf.test.run,'on')
eval(vinf.tes... |
i = [5 10 15 20]
for k = 1:1:size(i,2)
j = i(1,k)/10
inVSout('CGAssigner',j)
inVSout('ProportionAssigner',j)
inVSout('PreferLargerDemandAssigner',j)
inVSout('PreferLargeReputationAssigner',j)
inVSout('NoShareAssigner',j)
inVSout('EqualAssigner',j)
end
|
function Roots = fzeros(func, x_start, x_end, step, err)
% func: 函数句柄
% x_start: 起始点
% x_end: 终止点
% step:步长, 默认0.01
% err: 精度默认 1e-7
%
if nargin < 5
err = 1e-7;
end
if nargin < 4
step = 0.01;
end
X = x_start: step: x_end;
Y = func(X); % 计算函数
... |
close all, clc, clear;
%% Analyzes the results
load('data_90_100_Nant_8');
% The smallest wavelength (derived from highest frequency)
lambda_min = data.lambda_min;
% Physical Aperture [m]
Z_set = data.Z_set;
N_z = numel(Z_set);
N_sim = data.N_sim;
% Plot all values in one plot
vt_vars = zeros(N_sim, N_z);
est_3dB_b... |
function [ threshold ] = threshold_cal( dc, dv, evl_num )
%UNTITLED1 Summary of this function goes here
% Detailed explanation goes here
% clc
% clear all
% dc = 3;
% dv =4;
% evl_num = 1000;
threshold = 0.0;
for ii=1:1:10000
threshold = threshold + 0.001;
[mu, mv] = evl(threshold, dc, dv, evl_num);
i... |
% filterImplementations.m
% Dan Hirlinger
% 2/22/21
% Several ways to apply a filter to an audio signal
% Input
% [x,Fs] = audioread('AcGtr.wav');
Fs = 48000;
x = randn(Fs,1) * 0.2; % white noise
% Filter
N = length(x);
y = zeros(N,1);
% Using difference equation
% for n = 1:N
% if n > 1
% % y(n,1) =... |
function [AA,CC,Ts,To,ks,err_of_BDOSD_A,err_of_BDOSD_C,invTs,invTo] = bdosd(A,C,tol)
%BDOSD Block Diagonal Observable Structural Decomposition
%
% [At,Ct,Ts,To,ks] = bdosd(A,C)
%
% transforms an observable pair (A,C) into the block diagonal
% observable structural decomposition form.
%
% Inpu... |
function [yaw] = yawFromMagnetometer(magnetometer, roll, pitch)
% Normalize magnetometer
mbase = magnetometer / norm(magnetometer);
% Perform tilt compensation
comp_x = mbase(1) * cosd(pitch) ...
+ mbase(2) * sind(roll) * sind(pitch) ...
+ mbase(3) * cosd(roll) * sind(pitch);
... |
function fatlines(thick)
if nargin<1
thick=2;
end
dlha = get(gca,'children');
set(dlha(:),'LineWidth',thick);
set(gca,'LineWidth',thick);
set(gca,'color','none');
|
function [ keypoints, I, time_per_keypoint ] = detect_keypoints_in_image (self, image_set, image_number, light_number, I, keypoint_detector)
% [ keypoints, I ] = DETECT_KEYPOINTS_IN_IMAGE (self, image_set, image_number, light_number, I, keypoint_detector)
%
% Detects keypoints in the specified image, with ... |
classdef BookHedger < BookMonitor
% BookHedger 首先是一个Monitor
% 在Monitor的基础上,有柜台,有Hedge的规则.
% hedgers 是HedgerAssetElement的序列,每个element包含hedge标的和hedge规则。
properties
counter_ = [];
hedgers_@HedgeAssetElementArray;
end
methods
function [obj] = BookHedger(book)
... |
function [Ez, H_rho, H_phi] = getDielectricCylinderFieldUnderPlaneWave(radius, ...
cylinder, ...
background, ...
sensor_location, ...
... |
function d = loadData(fileName, n)
fid = fopen(fileName)
bit32mask = [16^6 16^4 16^2 1];
magicNumber = bit32mask * fread(fid, 4);
numOfImages = bit32mask * fread(fid, 4)
rows = bit32mask * fread(fid, 4);
cols = bit32mask * fread(fid, 4);
blockSize = rows*cols;
imagesToRead = min(n, numOfImages);
d = z... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.