text stringlengths 8 6.12M |
|---|
function dd=mss_asd(m,p)
%this function is from the spotless toolbox
%https://github.com/spot-toolbox/spotless
% function dd=mss_asd(m,p)
%
% INPUTS:
% m - a positive integer
% for a positive integer m and a vector p of different integers
% rows of dd (N-by-m) represent all ways of representing elements... |
function output_struct=apply_classification(layer,varargin)
default_l_min_tot=25;
check_l_min_tot=@(l)(l>=0);
default_h_min_tot=10;
check_h_min_tot=@(l)(l>=0);
default_horz_link_max=55;
check_horz_link_max=@(l)(l>=0&&l<=1000);
default_vert_link_max=5;
check_vert_link_max=@(l)(l>=0&&l<=500);
p = inputParser;
addR... |
function [L,ipt,ID]=RansacLineFit(Inpts, Dth)
NO_otl=zeros(1,1);
for i=1:(size(Inpts,1)-1)
for j=(i+1):size(Inpts,1)
p1=Inpts(i,:); p2=Inpts(j,:);
Dx=p2(1)-p1(1); Dy=p2(2)-p1(2); Dxy=p1(1)*p2(2)-p2(1)*p1(2);
DD=sqrt(Dx^2+Dy^2);
k=0;
for n=1:size(Inpts,1)
dist=abs(Dy*Inpts(n,1)-Dx*Inpts(... |
%%optimal pressure of energy density in I-PRO
clear;
format long;
c_f_ro=35;
c_os=73.45/100;
y0=0.3:.1:.5;
for i_y=1:length(y0)
y=y0(i_y);
parameter_initialization;
fai0=0.5;
c_f0=0.1;
c_d0=c_f_ro./(1-y);
Jw_min=.01*A*c_os*(c_d0-c_f0);
fai=fai0/(fai0+(1-fai0)*(1-y));
mem_area_max=0.5;
step_deltaP=.1;
mem_area0=.01:.0... |
%%% beta plot
%%% written by ysl 06/27/2014
%%% updated by mjh 11/22/2017
%%% updated to sphere by mjh 06/14/2018
% V4 -- Added TPM gray matter mask. MJH
% V5 -- Removed TPM, added LNG, added (mostly fixed) SPA. Combined LIFG. MJH
% SPAfigure -- generating SPA from the betas plotted on the figures.
close all; clc;
tic... |
%trainFile: Train data features and labels
%testFile: Test data features and labels
%HS: Hidden layer size
%SP: sparsity parameter
%LM: weight decay parameter
%I: maximum iteration
%b: weight of sparsity penalty term
%n: number of nodes in graph
%et: number of edges missed due to preselection
function [TrainPC, Trai... |
function [thr, h1] = badacostCalibrateCascade(X0, X1, clf, use_trees)
% Classify all the data with the classifier and check the
% costs traces. We compare positive class trace (label 1) with
% the min cost of the positive classes. We use the formula:
%
% traces(i,:) = -(min_pos_costs - costs(1,:));
%
% Where traces... |
%% STATISTICAL PARAMETERS IN SAND COLUMN EFFLUENT
clear all
close all
clc
%% 1. Load data and labeling
sand=open('eff_sand.mat');
%Remove field from structure
sand=rmfield(sand,'do_sand_eff');
%Call fields in loop
field_sand={'uva254_sand', 'doc_sand', 'benzo_sand', 'carba_sand', 'diclo_sand', 'gaba_sand'};
%Headers
va... |
function indbdry = findBoundary(x)
% indbdry = FINDBOUNDARY(x)
%
% inputs:
% - x: logical 2D array.
%
% outputs:
% - indbdry: Nx2 array with row/column subscripts of
% the boundary values of true regions in x.
%
%
% Olavo Badaro Marques, 18/Feb/2017.
dNaN = double(x);
[nr, nc] = size(... |
function [x,y]=Exchange(x,y)
t=x;
x=y;
y=t;
|
function [E,BR,BZ,Bphi] = B_interpolation(x,types)
global par dim maps time
%find_3D_Bfield Interpolates the 3D grid to find 3D field
% Interpolates in 2D for flux coordinates, which are used to interpolate
% for the 3D field(s).
% Can use a variety of interpolation methods and indexes / slopes -
% struct for 2... |
function weights = checkweights(weights, whichrows, diffs)
[m,n] = size(diffs);
if isempty(whichrows)
whichrows = 1:m;
end
if isempty(weights)
weights = ones(m,n);
return;
elseif numel(weights) == n
weights = repmat(weights(:)',m,1);
return;
elseif all(size(weights(whichrows,:)) == [m,1])
... |
function [weights] = logistic_train(data, labels, epsilon, maxiter)
%
% code to train a logistic regression classifier
%
% INPUTS:
% data = n * (d+1) matrix withn samples and d features, where
% column d+1 is all ones (corresponding to the intercept term)
% labels = n * 1 vector of class labels (taking values 0 or 1)
%... |
function newPopulation = InsertBestIndividual(population, bestIndividual, nCopies)
newPopulation = population;
for i = 1:nCopies
newPopulation(i).Chromosome = bestIndividual;
end
end
|
% clear all; close all; clc;
%% SPAWN GOAL CONFIGURATION AND ROBOT POSITION. RANDOMLY IN THE WORKSPACE.
%Define workspace limits. All in metres.
xrange = [-0.5, 0.5];
yrange = [-0.5, 0.5];
th_range = [0, 2*pi]; %counter clockwise rotation with 0 as x-axis aligned with left-right directions of the plane.
global num... |
function SetCostParameters( tController )
%Build the linear part and the quadratic part of the cost function
C_PA = 1006;
A_RAD = 50;
H_RAD = 8;
alpha = 6;
%
iNumberOfInputs = size(tController.tModel.aafB, 2);
iNumberOfOutputs = size(tController.tModel.aafC, 1);
%
% Allocating space for Linear Cost Matrix
t... |
%%% Modeler
clear all;
close all;
clc;
loc = 'T'; % [ D , S , T ]
switch loc
case 'D'
load('denver_co.mat');
Data_full = Data;
case 'S'
load('saltlakecity_ut.mat');
Data_full = Data;
case 'T'
load('tucson_az.mat');
Data_full = Data;
end
cluster_idx = zeros... |
%This code is available in eval2D.m
% make sure you define n and mode
n=100;
mode=0;
ls=[0.5,0.5]';
t=rand(2,1); %Choose some random starting point.
clf;
plotRobot2D(ls,t);
hold off;
while(1)
desired=ginput(1)'; %Get desired position from user
clf;
plot(desired(1),desired(2),'*');
hold on;
plotRobot2D(ls,t... |
% Ben Lockwood, benlockwood.com
% This code replicates the results in Mirrlees (1971), "An Exploration in
% the Theory of Optimum Income Taxation", ReStud 38(2).
% Thanks to Pan Liu (www.econ.iastate.edu/people/graduate-students/liu-pan) for
% valuable contributions.
clear all;
clc;
% Setup described in Section 8 (Ca... |
%thickness is the size of the padding boarder
function imgout = ICV_padarry(imgin, thickness, mode)%mode defines padding type. 1 padding with zeros.
width = size(imgin,1);
height = size(imgin,2);
%mode 1 pad with zeroes.
if mode == 1
output = zeros(width+2*thickness, height+2*thickness);
for x = 1:wi... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
%
% problem 6 - convolution of x(t) and h(t)
t1=0:.1:2;
t2=2.1:.1:4;
t3=4.1:.1:10;
x1=t1;
x2=4-t2;
x3=zeros(size(t3));
x=[x1 x2 x3];
t=0:.1:10;
h=t.*exp(-t);
y=conv(x,h)*0.1;
plot(0:.1:20,y)... |
%{
* Copyright (C) 2013-2020, The Regents of The University of Michigan.
* All rights reserved.
* This software was developed in the Biped Lab (https://www.biped.solutions/)
* under the direction of Jessy Grizzle, grizzle@umich.edu. This software may
* be available under alternative licensing terms; contact the ... |
function [pass,maxerr] = test(opt)
% Check that bootan() internal loop works
sig = 0.05;
t = linspace(0,5,100);
r = linspace(2,6,100);
P = dd_gauss(r,[4 0.8]);
K = dipolarkernel(t,r);
V = K*P;
parfit = fitparamodel(V,@dd_gauss,r,K);
Vfit = K*dd_gauss(r,parfit) + whitegaussnoise(t,sig);
results = b... |
function [normals, albedo_img] = ...
computeNormals(light_dirs, img_cell, mask)
% Initialization
num_img = size(img_cell, 1);
[height, width] = size(mask);
normals = zeros(height, width, 3);
albedo_img = zeros(height, width);
S_inv = pinv(light_dirs);
% Main work
for i = 1:width
for j = 1:height
% Onl... |
function f_transform = cheby_transform_2d_partialsum(f, N)
%
% Get the chebyshev weights and nodes
%
[x_k, w_k] = fejer_quad1(N);
%
% Create a matrix of all the Chebyshev Polynomials evaluated at the nodes
%
m_vec = 0:N-1;
[X, M] = meshgrid(x_k, m_vec);
T_M = cos( M .* acos... |
function [ extDelFeatureVector ] = findDoubleDeltas( extFeatureVector )
% Find double delta coefficient dd(t) = d(n-t) - d(n+t)/2
% Input : Extended feature vector with delta coefficients
% Output : Dobule delta coefficient vector
%% initialize variables
ddelta = [];
extDelMell = [];
extDelFeatureVector = [];
Nf... |
%% SETUP
clc;
clear;
clf;
close all;
%% Example Usage of orbitFromPeriod() and hohmann()
% Let's say we have a satellite in a circular parking orbit at an altitude
% of 300km, and want it to complete a Hohmann transfer which would increase
% its period to 14 hours.
% Parking Orbit Radius
r_park = 300000+NatConst.Re;
... |
ssh = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'Grid_0001');
lat = ncread('/project/expeditions/eddies_project_data/ssh_data/data/h/dt_ref_global_merged_msla_h_qd_19930106_19930106_20100503.nc', 'NbLatitudes');
lon = ncread('/project... |
function varargout = connect4(varargin)
% Play Connect 4!
%
% If you want to edit the board colors, you may input your own.
%
% Acceptable Input Properties:
% 'BoardColor'
% 'BoardAccentColor'
% 'Player1Color'
% 'Player2Color'
% 'Bounce'
% 'AnimateDrop'
%
% Acceptable ... |
function gca_playsound(lpr_object, frequency)
% left click to set begin point
% right click to set end point
% audio will playback between two points
if nargin < 2
frequency = 2000;
end
ax = gca;
ax.UserData.frequency = frequency;
f = gcf;
if nargin > 0 && ~isempty(lpr_object)
ax.UserData.f... |
function sa=smallest_amount(clv)
% SMALLEST_AMOUNT computes the smallest amount vector.
% This is the smallest amount players can contribute to a coalition.
%
% Usage: sa=smallest_amount(v);
%
%
% Define variables:
% output:
% r -- Smallest amount vector
% input:
% clv -- TuGame class object.
%
% ... |
pkg load image;
function ensure_parent_is_smaller_than_child(pa)
for i = 1:length(pa)
child = i;
parent = pa(child);
assert(parent < child);
end
end
% --------------------
% specify model parameters
% number of mixtures for 6 parts
% See "Structure" section in http://www.ics.uci.edu/~dramanan/papers... |
filename = 'buffer://localhost:1972';
% read the header for the first time to determine number of channels and sampling rate
hdr = ft_read_header(filename, 'cache', true);
count = 0;
prevSample = 0
blocksize = hdr.Fs;
chanindx = 1:hdr.nChans;
while true
% determine number of samples available in buffer
h... |
function initProblemGeneric
% initProblemGeneric - POMDP initialization code for each problem
%
% initProblemGeneric takes a global pomdp struct and copies it to a
% problem struct. It initializes some struct members common to all
% problems and makes sure the transition, observation and reward model
% are in the desir... |
clear;
close;
clc;
format compact
bt_rate=randi(4,1,4);
bt_rate=bt_rate/sum(bt_rate);
for i=1:1000
t=bt_rate(end,:);
mag=(rand(1)*2-1)*0.005;
ind=randi(4,1,1);
t(ind)=t(ind)+mag;
% ind=randi(4,1,1);
% t(ind)=t(ind)-mag;
t=t/sum(t);
bt_rate=[bt_rate;t];
end
plot(bt_rate) |
function TuningCurve_ONOFFPlot(TCon, TCoff)
% A not very elegant way to plot both the laser on and laser off tuning
% curves on a single plot.
%
% Inputs:
% TCon: Tuning curve output from TuningCurve_Compute.m running laser ON
% trials
% TCon: Tuning curve output from TuningCurve_Compute.m running la... |
% fillcoCoefSpline (smooth function based on Roux article)
if (strcmp(srfm,'SPL2')==1)
% % preallocating arrays
%
kappa=ones(dime(1),dime(2),dime(3));
dielx=kappa;
diely=kappa;
dielz=kappa;
irad=maxionR;
w2i=1.0/splineWin^2;
w3i=w2i/splineWin;
dime12=dime(1)*dime(2);
if (bulkIonicStrength > VPMGSMALL)
ionmask... |
function export_gif_adc(gifexportpath,ADCmap,m0map,r2map,tag,ADCMapScale,ADCcmap,m0cmap,r2cmap,aspect,rsquare)
% Exports ADCmaps, M0maps, and r^2 maps to animated gif
[number_of_images,dimx,dimy] = size(ADCmap);
% increase the size of the matrix to make the exported images bigger
numrows = 2*dimx;
numcols = 2*roun... |
function pop = inversion(pop,pi,varargin)
% population/mutation
%
% pop = mutation(pop,pi,last=0)
%
% Applies inversion with a probability of pi to the members of a
% population. The flag last is used to implement a steady state algorithm;
% inversion is applied to the last individual in the population.
%**********... |
% PA_HARDWARE_INIT
%
% Initializes hardware
%
% 1 Initialize Microcontroller
% 2 Initialize TDT: zBUS, RP2_1, RP2_2, RA16
% Perhaps to be implemented: 3 Test led sky, speakers & dig oputputs
% 2013 Marc van Wanrooij
% original: Dick Heeren
% e: marcvanwanrooij@neural-code.com
fprintf('\tInitialize Hardwar... |
%% How to Put Multiple Test Cases in One M-file
% The Quick Start example showed how you can write a simple M-file
% to be a single test case. This example shows you how to put multiple
% test cases in one M-file.
%
% Name your M-file beginning with "test", like
% "testMyFunc". Start by putting the following tw... |
%% Scratch script to generate radial coverage plots
%% Written by Hugh Roarty on March 26, 2010
tic
close all; clear all;
% addpath /home/codaradm/HFR_Progs-2_1_3beta/matlab/general
% addpath /home/codaradm/operational_scripts/totals
% add_subdirectories_to_path('/home/codaradm/HFR_Progs-2_1_3beta/matlab/',{'CVS','pr... |
function files=jdDpxExpHalfDomeRdkRevPhiAnalysis_LK(files)
if nargin==0
files=dpxUIgetFiles;
if isempty(files) || isempty(files{1})
return;
end
end
E={};
for i=1:numel(files)
D=dpxdLoad(files{i});
[D,str,suspect,maxCorr]=clarifyAndCheck(D);
if ... |
% At_w.m
%
% Adjoint for "scrambled Fourier" measurements.
%
% Usage: x = At_w(b, N, OMEGA, P)
%
% b - K vector = [real part; imag part]
%
% N - length of output x
%
% OMEGA - K vector denoting which Fourier coefficients to use
%
% P - Permutation to apply to the input vector. Fourier coeffs of
% x(P) are embedded... |
img=rgb2gray(imread('filters.png'));
threshold=11;
blur(img,threshold,0);
figure;
blur(img,threshold,1);
figure;
blur(img,threshold,2);
|
function dataframe = util_LoadFrameSegment(basename, rank, frameno, meta)
% function dataframe = util_LoadFrameSegment(basename, rank, frameno, metaonly)
% > basename: prefix of files
% > rank: integer of MPI rank whose segment we load
% > frameno: frame number of file to load
% > meta: If identical the to the... |
function pc=Determine_FitParameters(handles,parenthandles)
%
% This function will be called in order to compute the mapping function fit
% parameters that is used to map between the long and short wavelength
% fields. It uses the list of paired points in handles.MappingPoints in
% order to fit the function, and output... |
clc;
clear all;
tic
x = -5:0.001:5;
x_length = length(x);
u = zeros(1,length(x));
a = zeros(x_length);
b = zeros(x_length);
c = zeros(x_length);
o_a = 0.2*ones(1,length(x));
o_b = ones(1,length(x));
o_c = 5*ones(1,length(x));
% aa= 1./(sqrt(2*pi.*o_a));
% bb = exp(-(x-u).^2);
%
% cc =(2*o_a);
a =... |
%switchspm: Run different version of SPM
%This tiny script prompts the dialog which SPM version you want to run.
%Prerequisites
%1. Each version of SPM is supporsed to be located under spm_path.
%2. Please copy spm_rmpath.m from SPM5 or later and put it into SPM99 and
% SPM2 direcotry. Otherwise, Path removal won't w... |
function X = embed(N,D,distr,param)
% Embed symbols in a vector space.
%
% USAGE: X = embed(N,D,distr,param)
%
% INPUTS:
% N - number of symbols
% D - number of dimensions
% distr - string specifying the distribution on the vector space:
% 'spikeslab_ga... |
function mhidx=ModHoller(th,w_vec)
% MODHOLLER computes a modified Holler index from the set of winning coalitions.
% This avoids the violation of local monotonicity (Holler, 2018).
%
% Usage: mhidx=ModHoller(th,w_vec)
% Define variables:
% output:
% hidx -- Modified Holler index.
%
% input:
% th -- Thr... |
clc
clear all
close all
% This is the main file which runs the diferential equation defined in the
% other m file in our case its name is "dxdt".
% Options can be set as shown in the code and other options can be explored
% by typing "help odeset" in the command window.
% There are many solvers of ODE, I ha... |
function model_prms = model_params()
L_lower_leg = 0.4; % m
L_upper_leg = 0.4; % m
L_torso = 0.4; % m
% distance from proximal joint
Lcom_torso = L_torso*0.25;
Lcom_lower_leg = L_lower_leg*0.2;
Lcom_upper_leg = L_upper_leg*0.2;
% for plotting
M_lower_leg = 2;%3.2... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Master file for GMA estimation of bivariate system
% data simulated from DGP based on one Gaussian basis function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
close all;
clc;
tic
addpath('lib');
%we will use 2 obs
size_obs=2;... |
function ssimp ()
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% Coded by: Fernando Gonzalez-Herrera - CIMAT Zacatecas
% Carlos Lara-Alvarez - CIMAT Zacatecas
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
clc;
close all;
% % % % % % % % %... |
% misc and cleaning
clear all;close all;
%% locations
addpath(genpath('C:\Users\Kamphausen\sciebo\ZnSe\Matlab script'))
%%
structure = string('TLM'); % choose 'TLM' or 'Area'
format=string('*.xls'); % choose '*.xls' or '*.txt'
Evaluate(structure,format,'fitrangelin',0.1); |
function class_label = assign_label(a_probability,b_probability)
for i = 1:length(a_probability)
if(a_probability(i) >= b_probability(i))
class_label(i,1) = 1;
else
class_label(i,1) = -1;
end
end
end |
function J = quadrature3d(f, x, y, z, t, w)
% Integrates f over the 3D region bounded by the functions x, y(x), z(x,y)
% using a standard quadrature rule for the [-1, 1] interval.
n=length(t); n2=n*n; n3=n2*n;
xi=(x(2)+x(1))/2;
dx=(x(2)-x(1))/2;
xi=xi+dx*t;
lim=y(xi);
yj=(lim(2,:)+lim(1,:))/2;
dy=(lim(2,:)-lim(1,:))/2... |
%--------------------------------------------------------------------------
function bginput(strg)
% BGINPUT - This function gets the background pixels from user input
% BGINPUT(STRG) - strg - Smart Refine or Smart Rectangle
% Authors - Mohit Gupta, Krishnan Ramnath
% Affiliation - Robotics Institute, CMU, Pittsburg... |
function simulator_mach_vos_recalculator()
Avg_VoG = 10;
VoS_Raw = 340;
angle = 50;
test_sin = sind(angle);
Mach_corr = 1 + 0.5*((Avg_VoG*sind(angle))/VoS_Raw)^2;
test = 3;
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% TestGit
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
%disabe axis
axis off;
%draw a blue rectange the size of the window
pos = get(gcf, 'Position'); %// gives x left, y bottom,... |
%Q4.3
close all;
clear all;
cv_cover = imread('../data/cv_cover.jpg');
cv_desk = imread('../data/cv_desk.png');
[locs1, locs2] = matchPics(cv_cover, cv_desk);
% Compute H
[H2to1] = computeH(locs1, locs2);
% [H2to1] = computeH_norm(locs1, locs2);
% [H2to1,inliers] = computeH_ransac(locs1, locs2);
% Generate random poin... |
function [Gc,Kp,Ti,Td,bta,H]=rziegler(vars)
K=vars(1); L=vars(2); T=vars(3); N=vars(4); a=K*L/T; Kp=1.2/a;
Ti=2*L; Td=L/2; Kc=vars(5); Tc=vars(6); kappa=Kc*K; tau=L/T; H=[];
if (kappa > 2.25 && kappa<15) || (tau>0.16 && tau<0.57)
bta=(15-kappa)/(15+kappa);
elseif (kappa<2.25 && kappa>1.5) || (tau<0.96 && tau>... |
image = imread("image.jpg");
figure; imshow(image); axis image;
title("Original Image");
%Color histograms
redDistribution = image(:, :, 1);
greenDistribution = image(:, :, 2);
blueDistribution = image(:, :, 3);
[red, x] = imhist(redDistribution);
[green, x] = imhist(greenDistribution);
[blue, x] = imhist(blueDistr... |
%
% FH_run.m
%
% Interface to solve the FitzHugh-Nagumo equations and plot:
% subplot1 Voltage response and recovery response (over time)
% subplot2) V versus R
%
% Tamara Hayes, BME-OHSU 03/07 (modified from: Pat Roberts, 01/07)
%
clear all;
%--- Set parameters for Fitzhugh-Nagumo equations ------------... |
%%
clear all
% load('/home/kkarbasi/dmount/data/david_neurons_mat/B082107/B082107_1340_List.smr.mat')
% load('/home/kkarbasi/dmount/data/david_neurons_mat/B082207/B082207_1505_List.smr.mat') % % only two events, bs
% load('/home/kkarbasi/dmount/data/david_neurons_mat/B110807/B110807_1632_List.smr.mat')% % only two eve... |
function wt = cluster_ISODATA_classification(z,X)
% disp('classification');
global r Nc;
wt = zeros(1,r);%每一样本的类别
tempD = zeros(1,Nc); %暂时记录每个样本到Nc个聚类中心的距离
for i = 1:r
for j = 1:Nc
tempD(j) = sqrt(sum((X(i,:)-z(j,:)).^2));
end
[~,idxC] = min(tempD);%minD:最小距离;idxC:minD对应的聚类中心
wt(i) = idxC;... |
function plot_co_main_cell_fig(dir_param_file_name,population_param_file_name)
% plot imporatnat statistics for cross-overs analysis
load(dir_param_file_name)
load(population_param_file_name)
%% structs' parameters
files = dir(cell_co_solo_initial_analysis_struct_folder);
behavior_struct_names = {files.name};
... |
% To understand error in multi-step methods
% using e^(0.1) computation
% We will use this script to understand how
% Scripts and functions are written in MATLAB projects
%______________________________________________________
%% Problem Step
a=0.1;
N=a/h;
%% Computing using the Multi-step exp method
trueVal = exp(a)... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Script to calculate pH indicated by pH paper quanitatively from
% photographs using the difference between the green and blue channel
%
% Will prompt user for three inputs, first the file path, than the imcrop
% tool will pop up requesting a... |
function m_mCodmat = myfunc_ConstCode(m_vTrnY, m_strCode)
m_nC = length(unique(m_vTrnY));
switch upper(m_strCode)
% all pairwise comparison
case 'APS'
m_mind = nchoosek(1:m_nC, 2);
m_nN = size(m_mind, 1);
m_mCodmat = N... |
%% Demo: Propagation and Rate Modeling
% In this demo, we will illustrate how to perform simple path loss and rate
% models estimates in MATLAB. In doing this demo, you will learn to:
%
% * Estimate the rate from a path loss using a free space model, as well as
% parameters such as the transmit power, noise figure,... |
global data % some data and time administration
data=[];
vare=0;
%vare=0.1220;
%------------------------------------------------------------------------
[A,B,k,C]=sysinit(vare); % Determine linear model (ie. get system)
%------------------------------------------------------------------------
% Reference signa... |
function [ theta1Grid, theta2Grid, flag ] = twolink_freeSpace( points,NGrid )
% TWOLINK_FREESPACE generates the two NGridx1 vectors theta1Grid and
% theta2Grid of evenly spaced points along [0 2*pi]. The entire space
% defined by the meshgrid of these two vectors is checked against the
% obstacles defined by the points... |
function [action,state] = strategy_standstill(G,TR,S1,S2,N,M,plnum,state)
if(plnum==1)
myS = S1;
elseif(plnum==2)
myS = S2;
end
action = zeros(size(myS,1),1);
state = 0;
return; |
function [log, worldvec] = ReadLog(path)
logfile = fopen(path, 'r');
celllog = {};
tline = strsplit(fgets(logfile), ';');
Ntiles = str2num(cell2mat(tline(4)));
tline = fgets(logfile);
while ischar(tline)
tline = fgets(logfile);
celllog = [celllog; tline];
end
clear i
fclose(logfile);
Nmoves = size(celllo... |
function isol = automate_gk_solver(R)
% automate_gk_solver Calculates scrambling coefficients gamma & kappa
%=========================================================================
% automate_gk_solver Version 1, Aug 28, 2017
%
% USAGE: isol = calcSPmain(R)
%
% DESCRIPTION:
% Uses values of ... |
%MODELO DE APLICAÇÃO DO TX
classdef powerTXApplication < powerApplication
properties
end
methods(Access=public)
function obj = powerTXApplication()
obj@powerApplication(0);%construindo a estrutura referente à superclasse (ID=0)
end
function [obj,netManager,WPTManager] = i... |
function [ output_args ] = plot_fieldlines(data,varargin)
%PLOT_FIELDLINES(data,[plottype]) Plots the data from read_mgrid
% The PLOT_FIELDLINES routine plots data read by READ_FIELDLINES. There
% are various plotting options.
% Options:
% 'basic': Poincare plot on the first cutplane.
% 'col... |
classdef Input < Layer
properties
repeat
batch_size
step
max_repeat
file_pattern
meanX
train
test
end
methods
function obj = Input(json)
obj@Layer(json);
global plan
obj.r... |
function [p, S] = hoslem(varargin)
%HOSLEM Hosmer-Lemshow goodness-of-fit test
%
% [p, S] = hoslem(ypred, y)
% [p, S] = hoslem(mdl, x, y)
% [p, S] = hoslem(..., ng)
%
% Input variables:
%
% ypred: Logistic regression predictions for each data point; values
% should be between 0 and 1
%
% mdl: Generali... |
function [ fig1, reshaped_ds, Data ] = simulate_lmds(ds_type, target, mod_type, limits, varargin)
plot_data = 1;
% If robot figure, take figure handle
if nargin > 4
fig1 = varargin{1};
alpha = varargin{2};
if length(varargin) > 2
plot_data = 0;
Data = varargin{3};
end
... |
%========================================================================
%
% Estimate investment model and compute QMLE standard errors
%
%========================================================================
function qmle_invest_auto( )
clear all
clc
% Load quarterly data for the US for the per... |
function M= matchT( file, month )
% Matches monthly outside temperature to file time
% Detailed explanation goes here
[x,y]=size(month);
[f,g]=size(file);
for b=1:x
for a =1:f
if (file.Hr(a)==month.Hr(b)) && (file.DD(a)==month.Day(b))
file.T_o(a)=month.T(b);
end
end
end
end
|
function f = ibpmultigpLowerBound2(model)
% IBPMULTIGPLOWERBOUND
% IBPMULTIGP
f = 0;
if strcmp(model.sparsePriorType,'ibp') || strcmp(model.sparsePriorType,'spikes')
EZS2 = model.etadq.*(model.varSdq + model.muSdq.^2);
EZS = model.etadq.*model.muSdq;
else
EZS2 = model.varSdq + model.muSdq.^2;
EZS = m... |
function [ Feats, projection ] = BestFeats(Features, varianceThreshold)
featureSize = size(Features,2);
% Perform Mean Normalization on the Feature Matrix.
% Each pixel can have intensity values from 0 - 255
for i = 1 : featureSize
Features(:,i) = Features(:,i) - mean(Features(:,i));
en... |
% =======================================================================
% Improved adaptive complex diffusion despeckling filter (NCDF)
% =======================================================================
% DESCRIPTION: Filters out speckle noise from a noisy image
%
% INPUTS:
% imgIn - noisy image
% ... |
% Analyze old (2012) co-inoculated red & green Aeromonas data, from Oct.
% 18, 2012 (fish 1-4) and May 23, 2012 (fish 1)
%
% Raghu Parthasarathy
% Oct. 11-13, 2013
late_time_option = true;
t_offset = 7; % approximate time from the start of inoculation, hrs.
fs = sprintf('Using t_offset = %d hrs.', t_offse... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Step 3: 编写簇C的中心点 miuC(cls)
%输入:cls ->簇矩阵,每一行表示这一簇中的一张图片的信息,行数代表该簇的图片数量
%输出:miuC->簇C的中心点,是一个1024维的矩阵代表该簇的中心点
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function miu = miuC(cls)
sumImg = 0;
siz = size(cls);
N = siz(1);
for i = 1:N
sumImg = sumImg + cls(i,:);
end
mi... |
function GPIB
hMainFigure = figure(... % The main GUI figure
'MenuBar','none', ...
'Toolbar','none', ...
'HandleVisibility','callback', ...
'Color', get(0,...
'defaultuicontrolbackgroundcolor'));
... |
function [acf, t] = testRandomSeed(g, maxAcf, seeds, varargin)
%TESTRANDOMSEED test with different random seeds.
% [ACF, SEED] = TESTRANDOMSEED(G, MAXACF, SEEDS, ...) tests cycle ACF for
% each of the elements of a random seed list SEED. If ACF > MAXACF, the
% program breaks and returns the ACF vector (for al... |
clc
clear all;
close all;
I = imread('7original.TIF');
%I2 = rgb2gray(I);
%I1=im2double((imresize(I2,0.25)));
%I1 = f(x,y);
figure,imshow(I);
%figure,imhist(I);
[m,n]=size(I);
for i=2:m-1
for j=2:n-1
w = I(i-1:i+1,j-1:j+1);
m(i,j) = mean(mean(w));
g(i,j) = 0.6*I(i,j);
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% %%%%%%%
%%%%%%% MONO-DIMENSIONAL GINIBRE POINT PROCESS %%%%%%%
%%%%%%% %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [g] = my_lens ( f, x )
%getting size of the input image
R = size(f,1);
C = size(f,2);
%This is how many columns/rows that the intensity slope is measured.
edgeSensitivity = 50;
%This is how much the contrast will be multiplied by
contrastMod = 1.5;
%Obtain grayscale representation.
gimg = rgb2gray(f);
%Co... |
function sac = hafed_microsacc(x,vel,accel,vthresh, athresh, min_duration)
%--------------------------------------------------------------------
% FUNCTION microsacc.m
% (Version 2.0, 30 NOV 03)
%--------------------------------------------------------------------
% PLEASE CITE THIS REFERENCE:
% Engbert, R. &... |
pkg load image
RGB = imread('ic.jpg');
GSC = rgb2gray(RGB);
% Show image
figure('Name', 'Grayscale image')
imshow(GSC)
% Show histogram of pixel values
figure('Name', 'Histogram of pixel values of grayscale image')
imhist(GSC) |
close all
% The following examples show different uses of datetime and DST for
% Golden, Colorado.
lat = 33; % [arc-degrees] latitude
long = -117; % [arc-degrees] longitude
TZ = -8; % [hrs] offset from UTC, during standard time
rot = 0; % [arc-degrees] rotation clockwise from north
% cell array of local date-times du... |
function [row, col] = p10b(X_test, Y_test, net)
% Function p10b trains a neural network using matlab function patternnet
% Inputs X_test - an input training samples size n*d
% Y_test - their true class size n*1
% net - trained network
% Outputs
% err - test error
% CONF - ... |
function [xmat,ymat] = scatterjittered(x,xpos,width);
%scatterjittered: Add ordered jitter to scatterplot
[counts,edges,bin] = histcounts(x,'BinMethod','fd');
offset = width/(max(counts));
if mod(max(counts),2) == 0
ymat = NaN(length(counts),max(counts)+1);
xmat = linspace(xpos-0.5*width,xpos+0.5*width,max(c... |
function [X, Y, Z] = cylinder2P(R, N, r1, r2)
% CYLINDER: A function to draw a N-sided cylinder based on the
% generator curve in the vector R.
%
% Usage: [X, Y, Z] = cylinder(R, N)
%
% Arguments: R - The vector of radii used to define the radius of
% ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.