text stringlengths 8 6.12M |
|---|
function [outcome1,outcome2,pcards,p2cards,dcards,deck,count] = ...
playpair(pcards,p2cards,dcards,deck,count)
% default outcomes until compare with dealer
outcome1 = 0;
outcome2 = 0;
%% Play Hand 1
while 1
dd1 = 1; % Variable if player doubles down on hand 1
% Check if Hand 1 has Blackjack
if (pcards(1) == 1 &... |
function init_channel(instr,idx,value,step,delay)
setter = instr.operate('set',idx);
if strcmp(instr.operate_type,'set')
setter(value);
return;
end
reader = instr.operate('read',idx);
current_value = reader();
abs_step=abs(step);
if current_value>value
while current_value-value>abs_step
c... |
% Runs experiment on datasets and creates big result table
%
% Copyright (c) 2014 Aleksi Kallio
format long g
if ~exist('loadedDataVersion', 'var')
load('datasets.mat')
end
disp(['Using data version: ' loadedDataVersion]);
stats = zeros(nDatas, 11);
swapStats = zeros(nDatas, nIters, 11);
maxentStats = zeros(nD... |
function [gap, w_s, ell_s] = duality_gap( param, maxOracle, model, lambda )
% [gap, w_s, ell_s] = duality_gap( param, maxOracle, model, lambda )
%
% Return the SVM duality gap for the implicit primal-dual pair given by
% model.w and model.ell (w = A*\alpha; ell = b'*\alpha -- alpha is
% implicit). See "Duality Gap... |
% This code belongs to the paper
%
% M. Bačák, J. Hertrich, S. Neumayer and G. Steidl.
% Minimal Lipschitz and ∞-Harmonic Extensions of Vector-Valued Functions on Finite Graphs.
% Information and Inference: A Journal of the IMA, vol 9, pp. 935–959, 2020.
%
% Please cite the paper, if you use this code.
%
% Min... |
%a=double(imread('\image\32images\Nikon_5300D1.tif'))/257; [y,u,v] = color2Y(a);
%a=double(imread('\image\32images\Nikon_5300D2.tif'))/257; [y,u,v] = color2Y(a);
%a=double(imread('\image\32images\Nikon_5300D3.tif'))/257; [y,u,v] = color2Y(a);
%a=double(imread('\image\32images\Nikon_5300D4.tif'))/257; [y,u,v] = color2Y(... |
classdef reshapeLayer < nnet.layer.Layer
properties
OutputSize
end
properties (Learnable)
end
methods
function layer = reshapeLayer(outputSize,name)
layer.Name = name;
% Set layer description
layer.Description = "Reshape layer with output size " + ... |
function out = R_contrast( fparam , img , imgR, imgG, imgB, typeidx )
if ( nargin == 1 )
out.weight = fparam.contrastWeight;
out.numtypes = 1;
out.descriptions{1} = 'Intensity Contrast';
else
out.map = myContrast( img , round(size(img,1) * fparam.contrastwidth) );
end
|
function [ status, message ] = op_Eventfinder2D( data_handle, option, varargin )
%OP_EVENTFINDER2D using neighbouring correlation to find event in XYT data
%--------------------------------------------------------------------------
%=======================================
%options values explanation
%---Batch pr... |
Als BT-er gebruik je bijna altijd de standaard functies
van Matlab en schrijf je bijna nooit een zelfgemaakte functie. |
classdef pl < hop.hop
properties
masks
m1
m2
m3
m
n1
n2
n
end % properties
methods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function self = pl(masks,isrealin)
if nargin < 2
isrealin = false;
en... |
%% --- repeat general analysis but absolute the error values --- %%
%just switches getData() with getData_AbsoluteVersion()
%Also add '_ABSOLUTE' to thisVarStr so files are stored in new directories
%This is NOT for pointingError_Absolute - That's handled in wrapper_pointingError
listVarStrs = { 'ANGerr', ...
... |
%Wysylanie wiadomosci do robota oraz odbieranie
t=tcpip('127.0.0.1',10030); %Laczenie z robotem
fopen(t);
fprintf(t,'CONNECT foo'); %Wyslanie komendy do polaczenia sie z robotem
disp(fscanf(t)); %otrzymanie odpowiedzi o polaczeniu
%pobranie informacji z robota
fprintf(t,'d');
fprintf(t,sprintf('... |
% Computed torque controller for CDPRs using the inverse dynamics resolve
% from the library.
%
% Please cite the following paper when using this algorithm:
% A. B. Alp, and S. K. Agrawal, "Cable Suspended Robots: Design, Planning
% and Control", in Proc. IEEE Int. Conf. Robot. Autom., pp. 4275-4280,
% 2002.
%
% Autho... |
function [x,y,z,Omega]=LCAO_energy_bands3D(N,H,band,energy,shift)
%Lattice spacing is normalized out of K!!
x=linspace(-2,2,N)*pi;
y=linspace(-2,2,N)*pi;
z=linspace(-2,2,N)*pi;
a1 = 1/2*[1,1,0];
a2 = 1/2*[0,1,1];
a3 = 1/2*[1,0,1];
[b1,b2,b3] = getReciprocalLattice(a1,a2,a3);
[Kpoints,~] = buildPrimitiveLattice(b1,b2,b... |
%% generates data for figure S3 and plots the figure
%% calls Extended_KF_k multiple times
%% note that ground truth parameter initialization, k prior mean and measurement noise have to be commented out in Extended_KF_k
beta = 0.5; delta = 0.4;
noise_levels = [0.001 0.002 0.003]; % level of measurement noise
dims_noise... |
function [calib_Rc calib_Tc] = depthcam_handeye(data_n, TCP, Rc, Tc)
% In the simulation, the error of the depth value (z direction) obtained by the depth camera is set to be a random error between -3mm and 3mm,
% and the xy direction is a random error between -1.5mm and 1.5mm (in accordance with the performance o... |
1;
function u = getInput(ht,ht_old)
global ctr=0;
global E=0;
global e_old=0;
global Kp=0.8;
global Ki=0.01;
global Kd=10;
ctr = ctr+1;
e = ht - ht_old;
E = E + e;
if(ctr==1)
e_old = e;
endif
del_e = e - e_old;
u = Kp*e + Ki*E + Kd*del_e;
e_old = e;
endfunction
... |
% runs crossMLS on both dataset 1 and 2, and compares their differences
function [ x_mlsNS1, x_mlsNS2, dev_DM, maxDEV, minDEV ] = runDev_crossMLS( dataset1, dataset2, h )
% PERFORM cross MLS
disp('running x_mls on set1..');
tic
x_mlsNS1 = crossMLS( dataset1, h ); disp('x_mlsNS1 complete.');toc
disp('runni... |
b = 2;
script1; |
function [imageSequenceSmall,imageSequenceLarge] = LoadImSequence(datastr,startFrame,numFrames,factor,downSamplingMethod,doJPEG)
% load image sequence from folder datastr
% downsample, trim and return
if nargin < 6
doJPEG = 0;
end
if nargin < 5
downSamplingMethod = 'bicubic';
end
if nargin < 4
... |
%% Opdracht 3
% Maak de volgende variabelen aan: snelheid = [ 4 5 2 9 2 1]
% Er is een speciale specifieke Matlab functie waarmee je laat zien dat een
% variabele leeg is. Gebruik deze functie hieronder om te illustreren dat
% de bovengenoemde variabele niet leeg is.
snelheid = [ 4 5 2 9 2 1];
isempty(snelheid);
|
function T = PeriodIzt(t, n)
T = t./n;
endfunction |
function coscorr = calc_coscorr(relevant_data)
% Calculating average cosine correlation
%
% Input: relevant_data : node data [NxT]
% Output: coscorr : cosine correlation [NxN]
%
% Original: James Pang, QIMR Berghofer, 2019
%%
N = size(relevant_data, 1);
iterations = size(relevant_data, 2);
coscorr = zeros(N, N... |
function hoscilator
clc;
% clf;
tmax = 30;
% резонанс!
y = simplify(dsolve('D2y + 0 * Dy + 16 * y = 3 * sin(4 * t)', 'y(0)=1', 'Dy(0)=1'))
t = 0 : tmax / 1000 : tmax;
Y = eval(y)
DY = eval(diff(y))
for k = 1 : length(t)
subplot(4, 2, [1, 2])
% plot(t, Y)
... |
function p = predict(X, theta)
#
# p = predict(X, theta, degree) returns the class (0 or 1)
# given the value of X, theta and the model
# in logistic regression
[ m c ] = size(X); # Number of training examples
# Number of classifications to be done
p = zeros(m, 1);
# Get the size of the model used
# Degree = sq... |
% HOPLS (High-order partial least squares regression)
% Predicting tensor Y from tensor X (latent vectors are computed stepwise with deflation) (NIPS2011)
%
% Usage:
% INPUT
% X Multi-way array of independent variables
% Y Multi-way array of dependent variables
% nfactor Number of latent vectors
% n... |
% [newlabels, oldlabels]=randTokens(tokenstring,seedstream)
%
% Takes in a string that contains tokens separated by spaces and returns a
% string that randomizes the order of the tokens.
% For example, the line:
% randTokens('This is a sentence')
%
% could return:
% is This sentence a
%
% The function uses texts... |
function runGame(arkData)
%RUNGAME Runs the Arkanoid game.
% This function controls the moment-by-moment operation of the game by calling commands to move
% the ball, destroy the blocks, and detect collisions.
%
% Syntax:
% runGame(arkData)
%
% INPUTS:
% arkData: The fully constructed Arkanoid game obj... |
classdef Element
properties
albedo; % outer surface albedo
emissivity; % outer surface emissivity
layerThickness; % vector of layer thicknesses (m)
layerThermalCond;% vector of layer thermal conductivities (W m-1 K-1)
layerVolHeat; % vec... |
clear all;
close all;
fontsize = 16;
%1= soil, 2= sand
ths = [0.472; 0.39];
thr = [0.015; 0.02];
alpha = [0.0271; 0.013];
n = [1.77; 12.7];
m = 1-1./n;
ks = [100, 3000]; %cm d-1
names = {'soil', 'sand'};
h = logspace(0, 7, 1000).';
theta = zeros(size(h));
for hh = 1:size(thr,1)
for ii... |
% Implement poisson noise to the image
% read the image
function poisson(image)
%Im =imread('lena.jpg');
Im = rgb2gray(Im);
Im = im2double(Im);
figure(1)
imshow(Im)
sizeIm =size(Im);
Im = Im(:);
b = zeros(size(Im));
indices = find(Im<50);
temp = ones(size(indices));
temp2 = -ones(size(indices));
index2 = (1:length(in... |
%% Fun��o faz a convolu��o de 2 sinais caso o desvio seja 0 e simula um desvio de fase e convolui caso o desvio seja 1;
%devemos passar para esta fun��o:
%S_truth primeiro sinal a ser convoluido
%matriz_sorteio=matriz de sorteio de desvio de fase
%desvio ou nao = 0 ou 1;
% posi��o1=posi��o dos pulsos
% coluna da matriz... |
function [linelist newLineNr] = DivideLineIntoTwo(linelist, lineNr, cutPt)
nline = size(linelist, 2);
nline = nline + 1;
linelist(nline).nr = nline;
linelist(nline).s = cutPt;
linelist(nline).e = linelist(lineNr).e;
linelist(nline).c = (linelist(nline).s + linelist(nline).... |
%%
clc;
clear;
%%
% X0 = sqrt(2);
X0 = -sqrt(2);
%%
% X0 = sqrt(2)+0.1;
% X0 = -sqrt(2)+0.1;
% X0 = -sqrt(2)+1.8;
%%
n = 100;
X = zeros(n,1);
Xk = X0;
for i=1:n;
uk = 1/2;
Xk1 = FuncNonLinDTS(Xk, uk);
X(i) = Xk1;
Xk = Xk1;
end;
%%
figure(1);
plot(1:n,X,'r*-');
% axis equal;
|
function y=LMDexpN(x)
% Negative value exponential
y=exp(-x);
%if infinity happens just go to a high number
%some negative number can change to a high positive number
%generating inf numbers
y(isinf(y))=1000000000; |
function [net,u,v] = trainAndPredict(X,Y,meanY,sdY,epochs,l2Reg,L1,L2,partition,k)
net = feedforwardnet([L1,L2]);
% net = feedforwardnet(L1);
net.trainFcn = 'traingdm';
net.trainParam.epochs = epochs;
net.trainParam.max_fail = epochs;
net.trainParam.showWindow = 0;
net.performParam.regularization = l2Reg;
net.divideFc... |
% Calculate SC-count value which can be used for feature selection
%
% discriminant fucntion : linear function
%
% Copyright (c) 2009, Okito Yamashita, ATR CNS, oyamashi@atr.jp.
clear
close all
%
fprintf('\nThis is a demo how sparse logistic regression can be used to select meaningful features by cross validation...... |
imagePath = 'E:/Calibrations/fwdcam/';
boardsSize = [9 6];
% Create a set of calibration images.
images = imageDatastore(imagePath);
%%
% Detect calibration pattern.
[imagePoints,boardSize] = detectCheckerboardPoints(images.Files);
%%
% Generate world coordinates of the corners of the squares. Square size is
% in mill... |
function cdfplot(X)
% cdfplot(X)
% displays a plot of the Empirical Cumulative Distribution Function
% (CDF) of the input array X in the current figure. The empirical
% CDF y=F(x) is defined as the proportion of X values less than or equal to x.
% If input X is a matrix, then cdfplot(X) parses it to the vector and
... |
%% Description
% The script is one of the final scripts CEE 199.
% This script plots the demeaned shoreline position at different date. The
% shoreline positions are are demeaned by averaged shoreline
% position at each transect
clear all; close all; clc
%% Initialization
% Read CSV files
rawdata = csvread('Transe... |
% This function finds the fundamental matrix using the ransac algorithm to
% filter outliers and the eight point algorithm to find the fundamental
% matrix
%
% Arguments:
% pointsA, pointsB - Two sets 3xN of corresponding homogenous points.
% t - Error threshold
% N - Number of iterations
... |
function plot_clustered_points(points, ptsC, vargin)
%PLOT_CLUSTERED_POINTS plots points with colored labels
colors = linspecer(numel(unique(ptsC)));
% colors_temp = colors;
% colors(6,:) = colors_temp(1,:);
% colors(1,:) = colors_temp(6,:);
% colors(5,:) = colors_temp(2,:);
% colors(4,:) = colors_temp(5,:... |
function ceps=frame2ceps(frame, fs, zeroPaddedFactor, plotOpt)
% frame2hps: Conversion from a frame to harmonic product spectrum, for pitch tracking
%
% Usage:
% out=hps(frame, zeroPaddedFactor, plotOpt)
%
% Example:
% waveFile='soo.wav';
% [y, fs, nbits] = wavread(waveFile);
% startIndex=15000;
% frameSize=round(... |
function [ model ] = createModel(path)
%CREATEMODEL Create model based on images and labels passed to the function
disp('Starting creation of model');
[labelNames, files] = generateLabels(path);
trainingFeatures = generateDescriptor(path, files);
disp('Creating model...');
model = fitcecoc(trainingFeatures, char(label... |
function [ W , metric , iter, asd] = optimise_network_two(W,metric_type,target_value,varargin)
opts = struct ( 'modules',[],'structure', [] ) ;
[ opts ] = parseOpts( opts , varargin );
opts2var
n=size(W,1);
O=ones(n);
H=O-eye(n);
metric=inf;
Winit=W;
l=1;
penalty=inf;
iter=1;
dW=Inf;
max_iter=15000;
%while penalty... |
clc;
clear;
%% Kernel Types
KERNEL_SOBEL_HORIZONTAL = [ -1, -2, -1
0, 0, 0
1, 2, 1];
KERNEL_SOBEL_VERTICAL = [ -1, 0, 1
-2, 0, 2
-1, 0, 1];
KERNEL_GAUSSIAN_BLUR = [ 0, 0, 0, 5, 0, 0, 0
... |
%% Loading the Feature Extraction data in matlab -----------
data = readtable('/home/jairam/Documents/MATLAB/features/featMat.csv');
% Removing phone ID,user ID, and document ID from the data set. Frank et
% al says this should not be used for testing
data = data(:,[3:12,14:34]);
% Removing missing bits of data and ... |
function [y1, y2] = cuadradoCubo(x)
y1 = x ^ 2;
y2 = x ^ 3;
end |
function r = plus(p,q,varargin)
%@kernelcorr/plus Overloaded plus function for KernelCorr objects.
% kc = plus(P,Q) combines joint events objects P and Q and returns the
% KernelCorr object R.
% get name of class
classname = mfilename('class');
% check if first input is the right kind of object
if(~isa(p,classname... |
[Q1,x1,t,cons] = roeFirstFlat(80,80);
[Q2,x2,t,cons] = roeFirstFlat(160,160);
[Q3,x3,t,cons] = roeFirstFlat(320,320);
t = [0 8 16 24 36 48 60 72 80];
for i=1:9
subplot(3,3,i);
plot(x1,Q1(:,t(i)+1),x2,Q2(:,2*t(i)+1),x3,Q3(:,4*t(i)+1));str = sprintf('T = %f',2.5/80*t(i));title(str);legend('N=80','N=160','N=320');
xla... |
function [x,y,z,I] = cube(a,Obj)
%% cube
% Finds the coordinates and moment of inertia of a cube of circumradius a
x = [1;1;1;1;-1;-1;-1;-1]*a/3^(1/2);
y = [1;-1;1;-1;1;-1;1;-1]*a/3^(1/2);
z = [1;1;-1;-1;1;1;-1;-1]*a/3^(1/2);
shape = [x,y,z];
s = norm(shape(1,:)-shape(2,:));
I = Obj.m*s^2/6; |
function p = predict(Theta1, Theta2, X)
%PREDICT Predict the label of an input given a trained neural network
% p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the
% trained weights of a neural network (Theta1, Theta2)
% Useful values
m = size(X, 1);
num_labels = size(Theta2, 1);
% You need ... |
close all
clearvars
clc
syms r;
%rozwiazanie rownania
f=1/3*pi*r^2*sqrt(64-r^2);
f1=diff(f)==0;
fplot(f);
extreme_points = solve(f1);
extreme_values = subs(f, r, extreme_points);
[maxX, maxidx] = max(extreme_points);
%metoda optymalizacyjna
double(maxX)
f=@(r)-1/3*pi*r^2*sqrt(64-r^2);
x_opt=fminbnd(... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Script to simulate the considered current profile shown in Fig. 3 in [1]
% with the numerical method presented in [2]
%
% Model Simplifications and Its Impact on Computational Complexity for an
% Electrochemistry-Based Battery Modeling Too... |
function k = pseries(n,p)
tic()
k=0;
for i=1:n
k=k+(1/(i^p));
end
toc
end
|
% Jan Heimann | 31rst May 2017
function fig = waterfallGraphCSV(paths, distance, graphTitle)
row_offset = 42;
column_offset = 1;
data = csvread(char(paths(1,1)), row_offset, column_offset);
freq = data(:,1);
levels = data(:,2); % Z-Values
dist = distance; % Y-Values
fig = fig... |
function [sspike] = splitspike(spike,range)
%SPLITSPIKE split out of concat spike sorting result, in which spike times are in range[start, end).
sspike=spike;
si = find(spike.time>= range(1) & spike.time< range(2));
% set spike time 0 to the start of range
sspike.time = spike.time(si)-range(1);
sspike.template = spike... |
function fit_savefile(varargin)
% varargin: globtdb,filepath,state
%state represents the way this function has been called
% 0: from current database (deafault)
% 1: from load database - save to another file
globtdb = varargin{1};
filepath = varargin{2};
state = 0;
if (nargin > 2)
state = varargin{3};
end %if
for i... |
function A = createErEdges(A,Z,X,N,param,DEF_INF)
% Create edges in the graph between A-scans (see Equation 3 in LI06). Edges
% are created between each vertex and the vertices DxL pixels down and one
% pixel to the right and DxU pixels down and one to the left. These edges
% act as smoothness constraints where DxL is ... |
function w=Mod2add(x,y) %this function performs binary bitwise addition given two integers
strx = dec2bin(x,10); %converts integer to binary
stry = dec2bin(y,10);
for i = 1:max(length(strx),length(stry))
y(i)=mod(str2double(strx(i))+str2double(stry(i)),2); %adds the bits pairwise
end
z='';
for i = 1:length... |
function [ bestValue, bestMove ] = ABP( b, depth, alpha, beta, isMaxPlayer )
if depth == 0
bestValue = b.Evaluate();
return
end
moves = ValidMoves(b);
if isMaxPlayer
for i = 1:size(moves, 1)
m = moves(i,:);
if m(5) ~= 1, continue, end
b2 ... |
function [models] = ModelGeneratorMASW(type, N, parameters, nb_layer, increasing)
models = struct('thick',zeros(N,nb_layer-1),'Vp',zeros(N,nb_layer),'Vs',zeros(N,nb_layer),'rho',zeros(N,nb_layer));
thick = parameters(1:end-1,1:2); % Thickness
Vp = parameters(:,3:4); % P-Wave velocity
Nu = paramete... |
function instInfo = parseTickerName(tickerName)
instInfo.name = tickerName;
strikePrice = regexpi(tickerName,'\d*','match');
if isempty(strikePrice)
instInfo.type = 'Stock';
return;
end
instInfo.type = 'Option';
instInfo.strike = str2double(strikePrice);
callOrPut = regexpi(tickerName,'(?<=\d+)[CP]','mat... |
function [ LetterSequence ] = GetLetSeq(LetterSamplesFolder, Letter, Pos, Class )
%GETLETSEQ Summary of this function goes here
% This functiona get a letter as an input parameter and looks in the
% filesystem for the sequence description of the letter, convert it to a
% 2 dimentaional array and return it
%
... |
function eltx2 = eltx2_elt(elt)
% function eltx2 = eltx2_elt(elt)
%
% Returns element data structure with the same basis
% functions as defined by elt, but with 2 components for
% each component of elt.
nvars = elt.nvars;
nvarsx2 = 2*nvars;
flist = elt.flist;
flistx2 = flist;
trans_Aphihat = @(T,Aphilist,order)(transx2... |
function [Disc_Loading] = getDiscLoading(Coeff_T,rho,omega,R)
%% - - Initializations - - %%
CT = Coeff_T; %Thrust Coefficient [unitless]
rho = rho; %Density of Air [kg/m^3]
omega = omega; %Angular Velocity [Rad/Sec]
R = R; %Radius [Meters]
%% - - Calculations - - %%
Disc_Loading = CT*rho*(omega*R)^2;
end |
%%
% Test for Lloyd re-centering for Linf norm.
clear all; close all; clc;
rep = ['../results/lloyd-linf/'];
if not(exist(rep))
mkdir(rep);
end
save_eps = 0;
save_png = 1;
%%
library_directory = '../mex';
addpath(library_directory);
matlab_directory = '../matlab/';
addpath(matlab_directory);
meshes_directory ... |
function controls = controller(z,z_ref,theta_error_prev)
x = z(1); y = z(2); theta = z(3);
x_ref = z_ref(1); y_ref = z_ref(2); theta_ref = z_ref(3);
W_e = [x_ref - x; y_ref - y; theta_ref - theta];
rot_mat = [cos(theta) sin(theta) 0;
-sin(theta) cos(thet... |
init
%%
pLMO = LMO.pos(450)
pGMO = GMO.pos(1150)
vLMO = Rdot(LMO,450)
vGMO = Rdot(GMO,1150)
function Nrdot = Rdot(craft, t)
Nrdot = craft.NHDCM(t)*[0;craft.theta_dot*craft.r;0];
end |
function output = multiple2BinaryAtt(data)
%%convert class data to good or bad: good = {unacc, accc}, good = {good, vgood}
n = length(data);
for i = 1:n
if(data(i).class == "good" || data(i).class == "vgood")
output(i).class = 'good';
else
output(i).class = 'bad';
end
end |
for ii = 1:60
fprintf('processing 1st hidstate %d...\n',ii);
fname = sprintf('hidstates1st_sandstone_(24f6wsP10Pb03)_%d',ii);
f1=load(sprintf('%s.mat', fname));
temp = double([f1.hidstate;]);
temp = permute(temp,[3,1,2]);%% caution, changed from [3,2,1] 12/6 2016
temp = reshape(temp,[38025 24]);
for i = 1:24
tem... |
% calculate rate of NO3 + NO3 -> 2NO2 + O2
% Updated 7/14/06 AEP
% Based on JPL Data Evaluation #15
% rate=kNO3self(T,M)
function j=kNO3self(T,M)
j=8.5e-13.*exp(-2450../T);
|
function consensus = scaconsensus(a,kstart,kend,nloop)
%
% This software and its documentation are copyright 2004 by the
% Broad Institute/Massachusetts Institute of Technology. All rights are reserved.
% This software is supplied without any warranty or guaranteed support whatsoever.
% Neither the Broad Institute nor ... |
function [ rollCost ] = dh_plot_continous_IF_roll_cost( iNearby )
%DH_PLOT_CONTINOUS_IF_ROLL_COST 看历史上某连续合约的roll effect
% Detailed explanation goes here
%% 预处理
if ~exist('iNearby', 'var'), iNearby = 1; end
switch iNearby
case{1}
IFcode = 'IF0Y00';
case{2}
IFcode = 'IF0Y01';
case{3}
... |
function mu = softmax(eta)
mu = exp(eta)./sum(exp(eta));
|
classdef (Abstract = true) ImageIO < handle
%IMAGEIO read/write various image formats
% use BioFormats
% use TIFF lib
% use CZI File Specification
% metadata
%% --- Metadata Properties --- %%%
properties (SetAccess = protected)
fileName = ''; % Image filena... |
function [set, icol, irow] = LoadImages(folder, m)
%LOADIMAGES Loads de images conducts resizing.
% It recieves:
% file: the name of the folder containing the images as a parameter
% m: number of images within folder
%
% It returns
% set: a matrix con containing the resized images
... |
function drawone(m, s, col)
curvecolors = 'bgrmbgrm';
p.x = linspace(-2,2);
p.g=0; p.l=0;
p.m = m; p.s = s;
pred = model(p);
%col = curvecolors(1);
%figure(),
axis([-1 1 0 1]); hold on
plot(p.x, pred, [col '-'],'LineWidth',2)
plot(p.m,0.5, [col 'o'],'MarkerSize',15)
set(gca, 'FontSize', 24), grid on
%title('Ideal Ps... |
close all
clear all
clc
%%% Rover Data %%%
% CHASSIS
h1=500; %chassis upper side height
h2=100; %shoulder joint height WRT chassis
h0=h1+h2; %shoulder joint height WRT ground
% ARM
% link lenghts: arm,fore arm, 2nd wrist joint to end effector end (115+150?)
l=[600 377 315];
% joints angles in degree... |
function [mean_sol variance_sol]= LNA_solution(name,tmesh,y0,par,merr,t_discont)
addpath([pwd, '/models','/',name,'/symbolic/' ]);
%% model dependent function created by create('modelname')
global all_equations,
all_equations=str2func([name,'_all_equations']);
all_equations_jacobian_dpar=str2func([name,'_all_equat... |
function net = convertCPUtoGPU(net)
for i=1:numel(net.layers)
l = net.layers{i} ;
if isfield(l, 'filters')
net.layers{i}.filters = gpuArray(l.filters);
end
if isfield(l, 'filtersMomentum')
net.layers{i}.filtersMomentum = gpuArray(l.filtersMomentum);
end
if isfield... |
clear all
clc
% we introduce the parameters for Kan and Zhou (2007)
gamma=3;
theta=0.344;
psi=0.267;
tau=sqrt(theta^2-psi^2);
mu_g=0.00889;
sigma_g=sqrt(mu_g*mu_g/(theta^2-psi^2));
N=25;
EU_opt=theta^2/(2*gamma)*100;
EUg_opt=100*(mu_g-0.5*gamma*sigma_g^2+(1/(2*gamma))*psi^2);
%EUmvg=100*(mu_g-0.5*gamma*sigma_g^2);
z=1;... |
function H = irpHough2(B, O, r, alpha)
% H = irpHough(B, O, r, alpha)
% Berechnet einen 2d Hough-Raum 'H' für Kreise mit Radius 'r' mit Hilfe
% eines binarisierten Bildes 'B'. Zusätzlich wird für jeden Kantenpunkt
% eine Gradientenrichtung durch 'O' angegeben. Diese werden genutzt, um
% nicht einen vollständigen Kreis ... |
function out = Smeasure(Fg,videolength,nrow,ncol,alpha)
m = size(alpha,2);
checking = zeros(m,1);
for t = 1 : m;
checking(t) = ((2*t+1)^3)*0.5;
end
out = Fg;
for t=m+1:videolength-m
for i = m+1 : ncol-m
for j = m+1 : nrow-m
if(Fg(i+(j-1)*nrow,t) ~= 0 )
validity =... |
% Skript parser.m
%
% This script processes the user-selected file and classifies from it
% by keywords WARNING and Error. There are two type of output
% _Warning_<number>.fileFormat and _Error_<number>.fileFormat that contain
% node numbers or element numbers. The Prefix of these file can be set
% using varia... |
function output = VSMS_Dialate( input )
se = strel('square',20);
output = imdilate(input, se);
subplot(3,3,6); imshow(output);
end
|
Fs=100e3;
dt=1/Fs;
f=1e3;
T=1/f;
Np=10;
N=round(Fs*(Np*T));
t=dt*(0:N-1);
s=sin(2*pi*f*t);
S=fft(s);
figure;plot(s);
figure;plot(abs(S));
figure;plot(abs(fft(conj(S)))); |
function z = my_obj_fun_CAISO_deLlano_Paz_levelized(x) %x is an nx1 vector of weights
%rho is the PJM correlation matrix derived from first stages of model
%in this function it is the correlation matrix derived by the determinant
%method
% x will be a row vector of size specified in main function call
%% defi... |
function no_planning_problems=worthless_planning()
load medium_cost_condition
load baseline_mdp
nr_states = numel(baseline_mdp.states);
baseline_mdp.actions=1:4;
baseline_mdp.nextState=medium_cost_condition(1).nextState;
paths = [1 2 6 10; 1 2 6 11; 1 3 7 12; 1 3 7 13; 1 4 8 14; 1 4 8 15; ...
1 5 9 16; 1 5 9 17]... |
function sol = mosek_spiral(nout, P_ABC, basis, slack, INTPNT_ONLY)
use_interval = false;
if nargin < 5
INTPNT_ONLY = false;
end
param = struct();
if INTPNT_ONLY
param.MSK_IPAR_INTPNT_BASIS = 0;
end
param.MSK_IPAR_BI_MAX_ITERATIONS = 100000;
[A_, b_, tmp, tmp] = get_spiral_constraints(nout, P_ABC, basis,... |
function [r,inv,ptr]=de_r0(bin,lenr,ptr)
inv=bin(ptr); ptr=ptr+1;
[cbook,ptr] = deSFcode(bin,37,ptr);
%bnn1=bin(1:7)
%bnn2=bin(8:17)
if cbook==1
c=zeros(1,100*lenr); nc=1; n1s=0;
while n1s<lenr
if bin(ptr)>0
c(nc)=1; n1s=n1s+1;
end
ptr=ptr+1; nc=nc+1;
end
c=c(1:nc-1);
r=Gol... |
function [Xhat] = prox_induced_norm_iterative(V,lambda)
%
% This function computes the proximal operator for the l1 induced norm of
% a matrix that is, the solution to the following optimization problem:
%
% minimize_X |X|_1 + 1/2/lambda * trace[(X-V)'(X-V)]
%
% where |X|_1 = max_i |xi|_1, X = [x1,...,xm] and |xi| = su... |
function [ x, w ] = chebyshev2_compute ( order )
%*****************************************************************************80
%
%% CHEBYSHEV2_COMPUTE computes a Chebyshev type 2 quadrature rule.
%
% Discussion:
%
% The integration interval is [ -1, 1 ].
%
% The weight function is w(x) = sqrt ( 1 - x^2 ).
%
... |
function [R, T, inlier_mask] = ...
localizationRANSAC(query_keypoints, p_W_landmarks, K, params)
% N: number of 2D->3D matches
% query_keypoints should be 2xN
% p_W_landmarks should be 3xN
% inlier_mask should be 1xN, 0 if the match is an outlier, 1 otherwise.
assert(size(query_keypoints, 2) == size(p_W_landmarks, ... |
function [ output_args ] = Setup_Geometry(pos_primary,pos_secondary,pos_ignition)
global L h w xi1 xi2 xp ig_pos dx divs x dt
L = 1.5; % Length of Combustor (in m)
h = 0.1; % Height of Combustor (in m)
w = 0.1; % Width of Combustor (in m)
xi1 = pos_primary; % Location of Primary Injector (in m)
xi2 =... |
function TGEAR = TGEAR(THTL) % Power command v. thtl. relationship
if(THTL<=0.77)
TGEAR = 64.94*THTL;
else
TGEAR = 217.38*THTL-117.38;
end
% Checked for accuracy with the stevens model.
|
function createfigure(X1, Y1, X2, Y2, X3, X4, Y3, Y4)
%CREATEFIGURE(X1, Y1, X2, Y2, X3, X4, Y3, Y4)
% X1: scatter x
% Y1: scatter y
% X2: scatter x
% Y2: scatter y
% X3: scatter x
% X4: scatter x
% Y3: scatter y
% Y4: scatter y
% Auto-generated by MATLAB on 12-Dec-2018 12:29:58
% Create figure
figure... |
function DP=compute_distance_profile(h,lambda,p_factor,d_vals)
if(iscolumn(lambda))
lambda=lambda';
end
if(iscolumn(h));
h=h.';
end
if(iscolumn(d_vals))
d_vals=d_vals';
end
lambda_vals=1./lambda;
D=repmat(d_vals',1,length(lambda_vals));
L=repmat(la... |
mls_h = 0.5;
icp_tol = 1e-3;
for i=1:fn-1
[ ROMI_ref, ROMI_this ] = SR4K_compare2surfaces( SURF{i}, REFs{i+1}, mls_h, icp_tol );
ROMIref{i+1} = ROMI_ref;
ROMIthis{i+1} = ROMI_this;
%% FIND DIFFERENCE
% dev = dDiff(ROMI_ref, ROMI_this, 'standard');
% DIFF{i+1} = dev;6
%% COMBINE SURFACE
surface = co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.