text stringlengths 8 6.12M |
|---|
function [q,errbnd] = vadapt(f,tinterval,MININTERVALCOUNT,NODES,WT,EWT,ATOL,RTOL,NW,MAXINTERVALCOUNT)
q=zeros(6,1);
errbnd=zeros(6,1);
coder.varsize('x');
coder.varsize('x_matrix', [15 MAXINTERVALCOUNT]);
x_matrix=zeros(15,10);
x=zeros(1,150);
... |
function [ points_distance ] = be_points2dist(points, center)
%BE_POINTS2DIST converts point coordinates to distance from center
points_distance = zeros(length(points),length(points{1}));
% loop for each segment
for i = 1:length(points)
points_diff = points{i}-repmat(center,length(points{1}),1)... |
function [bestfit, bestphi] = COCC_framework(fname, func_num, Alg, Cht, runs, delta)
% parameters definition
global initial_flag
initial_flag = 0;
global Gen
Gen = 0;
Max_FEs = 3e6;
popsize = 100;
e = 1e-4;
if func_num == 10
dim = 900;
else
dim = 1000;
end
[lb, ub] = GetBounds(func_num);
% load groups_fit... |
function ok = test()
rho = 2*pi/5; % rotation angle, radians
Ori = [pi/5, pi/6, pi/7];
angles1 = rotateframe(Ori,'x',rho);
angles2 = rotateframe(Ori,[1,0,0],rho);
ok = areequal(angles1,angles2,1e-10,'abs');
|
% Fonction cible pour Lorenz X
% ****************************
disp('Fonction cible');
% DO condition sur paramètre sigma r et b
%% 1 - Paramètres
%% 1.1 - Condition initiale
if ~exist('CI','var')
CI = [0.1 0 0];
drapCI = 0;
else
if sum(CI ~= [0.1 0 0]) > 0
drapCI = 1;
else
drapCI = 0;... |
function dirEntry = getDirectoryEntry(obj, pathval, varargin)
% GETDIRECTORYENTRY Gets the directory metadata about a file or directory
%
% Example:
% myDirEntry = dlClient.getDirectoryEntry('/path/to/myMatFile.mat')
% or
% myDirEntry = dlClient.getDirectoryEntry('/path/to/myMatFile.mat',UGRType)
%
% Copyright 201... |
clear;
imp = importdata('../../data/gold/taps_euclid.csv',',',1);
names = imp.textdata(2:end,1);
all_data = [grp2idx(names) imp.data];
% rearrange
pr = all_data(:,3:3:15);
rp = all_data(:,5:3:14);
pp = all_data(:,17:2:23);
rr = all_data(:,18:2:24);
all_data = [all_data(:,1:2), pr, rp, pp, rr];
pins = unique(all_data(... |
%Problem 2
clc
clear
close all
%% Control
number_of_path_point = 200; %increase if you find trouble creating all path
range_sensor = 18; %range to detect points
%read map from pgm file
%map is 100x100 matrix (100x100 pixels)
f = imread( 'sim_map', 'pgm' );
%count number of obstacle points
num_obs =... |
% get the transformation that maps the tee into a standard position
% with [0,0] at the centre of the head and with the tee stem
% in the positive direction
function [tr,tc,theta] = findteetransform(headset)
% get rotation
dir = headset(1,1:2) - headset(1,3:4);
theta = atan2(dir(2),dir(1)) + pi/2;
R = [ [ ... |
function obj = fano(varargin)
%@fano/fano Constructor function for FANO object
% OBJ = fano(VARARGIN)
Args = struct('RedoLevels',0,'SaveLevels',0, ...
'Auto',0,'CellName','');
[Args,varargin] = getOptArgs(varargin,Args, ...
'flags',{'Auto'}, ...
'shortcuts',{'redo',{'RedoLevels',1};'save',{'SaveLevels',... |
function [freqVals,psdST,psdBL,baseCorrectedLog10PSD] = getPSD(highRMSElectrodes,folderLFP,goodPos,stPos,blPos,mt)
% 3D Array - (Freq, trialIndex, electrodeInd)
psdST = []; psdBL = []; baseCorrectedLog10PSD = [];
for i = 1:length(highRMSElectrodes)
load(fullfile(folderLFP,['elec' num2str(i)]),'analogDat... |
function bmi=ML_00781035_EX10_1(h,w)
bmi=w/(h^2);
if (18.5<=bmi<=24)
result=[num2str(bmi) ' 屬於標準體重'];
fprintf('%s \n',result)
elseif (bmi>=0 &bmi < 18.5)
result=[num2str(m) '屬於體重過輕'];
fprintf('%s \n',result)
elseif (bmi > 24)
result=[num2str(bmi) '屬於體重過重'];
fprintf('%s \n',result)
else
resul... |
clear;clc;
[val,~,raw] = xlsread('sampleScore');
lines = size(val,1);
items = size(raw,2);
utta =raw(2:size(raw,1),1);
t = val(2:lines,1);
note = val(2:lines,2);
PIT = val(2:lines,3);
DYN = val(2:lines,4);
for i = 1:lines-1
fprintf('%d\t%d\t%d\t%d\n', t(i),note(i),PIT(i),DYN(i));
end |
function outputangle = PlotLines(linez,BWimg)
lines = linez;
i = 0;
%find center of image
center = round(size(BWimg)/2);
centerx = center(1,2);
centery = center(1,1);
centerarea = round((center(1,1))/4);
%exit function if no lines were detected
lenlin = length(lines);
if lenlin == 0
outputangle = 4... |
% Attempts to combine human data from across studies, and compare them
%
% Rakic & Yaklovev, Luttenberg: CCA in development
%
% Tomasch & Aboitiz: fiber density in adults
warning('This uses old function calls and fails to smooth distributions before fitting them.');
warning('Migrate to new fitting functions, and smoot... |
function writemyTxt(txtarrays,txtname,bpath,train,label)
% label = 1 is norm class txt,label = -1 dui ying background
% train is a string, note the train or test txt
fulltxtpath = [bpath txtname '_' train '.txt'];
% if exist(fulltxtpath,'file')
% % append content at end of context
% ... |
function [I,LRi,UDi] = minfilter(I,radius);
%I is the input image
%radius is the additional radius of the window, i.e., 5 means 11 x 11
%if a four value vector is specified for radius, then any rectangular support may be used for max.
%in the order left top right bottom.
I = -I;
GET_COORDS = nargout > 1;
if(length(rad... |
function [ ] = plot_models( gr_points, gr_sigma, b_points, b_sigma,name )
% DISPLAY THE RESULTS
% Load models_and_thresholds.mat and call the function as
% plot_models(models(1).gP, models(1).gS, models(1).bP, models(1).bS, models(1).name)
set(0,'defaultfigurecolor',[1 1 1])
gravity = gr_points;
body = b_points;
numGMR... |
function [ Xk, Dmextr,Dmfiltr,Bmextr,Bmfiltr ] = calcKalmanExtended12(Z, Z0, F, P, Q, R1, R2 )
n = length(Z(1,:));
Xk = zeros(4, n);
Xk(:, 3) = Z0;
Dmextr=zeros(1,n-3);
Dmfiltr=zeros(1,n-3);
Bmextr=zeros(1,n-3);
Bmfiltr=zeros(1,n-3);
for i=4:n
Xk(:,i) = F*Xk... |
% Gradient descent algorithm for linear regression
clear all; close all; clc; clf;
rawdata = load("cirrose.dat", "ascii");
%set the data
% Selects the fifth attribute as input and scale the input data
scaledX = (rawdata(:,5)' - mean(rawdata(:,5)) ) ./ range(rawdata(:,5)');
% Loads the input values into X with a colum... |
clc
clear
addpath('..\Tools\liblinear\');
addpath('..\Tools\')
addpath('.\utility\');
target_path='..\DS2\';
all_target_file=dir(target_path);
target_file_num=length(all_target_file);
%save path
save_path = '.\output\';
if ~exist(save_path)
mkdir(save_path)
end
% conduct the experiment
Rep = 20... |
function OUT=threshold_function(x)
% sigmoid function centered on 1 so it is concave
% OUT=1-2./(1+exp(-1000000*(x-1)));
% OUT=1-2./(1+exp(-1000*(x-1)));
% OUT=1-exp(-100000*(1-x));
OUT=1-exp(-1000*(1-x));
% OUT=1*ones(size(x));
% OUT=1-1./(1+exp(-1000*(x-0.99)));
% OUT=x<1;
% OUT=(1-1./(... |
function [screenIndex, Data] = YouCollectedTheCannonball_TryToMissIt(taskParam, subject, screenIndex, Data, win)
%YOUCOLLECTEDTHECANNONBALL_TRYTOMISSIT This function tells participants that they caught the
% cannonball although they were instructed to miss it.
%
% Input
% screenIndex: indicates current screen... |
%% doSimulationGEM_ensemble
% This script performs an ensemble of the three component global energy
% budget model in the script 'ThreeComponentGEM.m'. Subsequently, the
% obtained outputted time series on temperature T, albedo ALB and
% emissivity EMM are used to estimate the real model equilibrium warming
% and ... |
function cx12=initcx12()
%
% Function initcx0
% ================
%
% This function initializes the constraint matrix for L1 and L2
% ambiguities (cx12);
%
% Sintax
% ======
%
% cx12=initcx12()
%
% Input
% =====
%
% No input.
%
% Output
% ======
%
% cx12 - 62x62 matrix... |
function [S,G] = generate_line(r,N,dim)
d_s = 2*sqrt(2)*r;
G = [(1:N)'*d_s zeros(N,dim-1)];
S = -G; |
function obj = SimulPlaceFields(obj,basedelay,modeltype,VistoDistfactor)
samplingrate = 60;
baselinegain = min(obj.data.es.gain);%mode(obj.data.es.gain);
cbase = find(obj.SubsetVal.contrast == mode(obj.data.es.contrast));
gbase = find(obj.SubsetVal.gain == mode(obj.data.es.gain));
rbase = find(obj.SubsetVal.roomlength... |
function result = is_double(n)
result = isa(n, 'double'); |
clear all
addpath('..')
data = read_debug_data();
particle_point = data{1,4};
particle_dir = data{1,5};
sphere_id = data{4,2}(2);
sphere_span = data{4,3+sphere_id};
sphere_center = (sphere_span(3:2:7) + sphere_span(2:2:6))./2;
sphere_radius = (sphere_span(3:2:7) - sphere_span(2:2:6))./2;
dt = sphere_line_intersect... |
sID=input('Subject''s ID? (Please enter 4 numbers (ex 0999)): ');
%if exist(sprintf('data/tutorialRevLearn_low_s%d_data.mat', sID)) || exist(sprintf('data/tutorialRevLearn_high_s%d_data.mat', sID))
% disp('There is already data, please either enter a new subject number or run Main_Continue')
% return;
%end
whil... |
% toda esta celda pasa a ser obsoleta, teniendo como boundary a rosca.mat
% sigue sirviendo si no se quiere usar la máscara de rosca
clear variables
path_calibracion = 'C:\Users\60069978\Documents\MATLAB\medicion32\';
load([path_calibracion 'intersections.mat']);
% cámara 1
q = 1;
figure(1)
plot(C{q}(:,... |
function [r, c, z] = getDataRanges(oo)
resolution = 0; %#FIXME
ranges = oo.imageInfo.DATASET.IMAGE_SIZE(resolution);
offset = oo.imageInfo.DATASET.OFFSET(resolution);
r = offset(1):ranges(2);
c = offset(2):ranges(1);
zrange = ranges(3);
z = offset(3):zrange;
% THIS IS FOR WEILER DATASET
% r = 1250:1550;
% c = 1250:... |
function b=phione(t,nu,kone,ktwo,lambda,mu,T,tauone,tautwo);
b=T*(1+tauone*lambda)./(lambda-mu).*(1+kone-ktwo+tautwo*lambda)...
.*(exp(lambda*(nu+t))-(t>=0).*exp(lambda*t)).*(t>-nu); |
%% 回测模板
% Version/Date: 0.2 / 2017.10.30
%% Options
clear;close all;clc
Options.InitCash = 1000000;
Options.Benchmark = '000300.SH'; % 设置基准
Options.VolumeRatio = 0.25; % 成交量限制不得超过当日成交量的固定比例
Options.RiskFreeReturn = 0.05; % 无风险收益率
Options.MinCommission = 5; % 最小佣金
Options.Commission = 0.0008; % 佣金
Option... |
%% Examples of Code Usage
% January 20th, 2020
% This code will go through a few examples of how the ODE model was used to
% make figures in the manuscript. All of these functions call the same ODE
% file "GvLi_ODE_function.m", and require the parameter information in
% "parameters.m".
% The functions that can be cal... |
function plotboth(logscale,all,nr_of_GC)
% Plots both the teoretical number of growth modules given by g(l,n) and
% simulations explained in the article Appendix A robustness of results
%
alpha=0.5;%0.68;%0.5
mu=2;
dim=2;
% Theoretical values of growth modules
plot_g_kn(nr_of_GC,mu,alpha,dim,logscale)
hold a... |
% jednoprůchodový heuristický algoritmus hledání shluků
function [ output_args ] = shlukove_hladiny( data, t )
% data = mnozina obrazu
% t = mira podobnosti t > 0
% vrací [ počet hladin rozdělení dat do hladin ]
data_size = size(data);
my(1,:) = data(1,:); % střed prvního shluku
T = zeros(data_size(1),1);
T(1) = 1... |
% this script is no more needed since u have the following useful functions.
% [outcomes, allResp, allResp_HR_LR] = set_outcomes_allResp(alldata, uncommittedResp, allowCorrectResp);
% [~, ~, stimrate, stimtype] = setStimRateType(alldata); % stimtype = [multisens, onlyvis, onlyaud];
%% set some params related to ... |
% Ele Azi Points
% -45 15 24
% -30 15 24
% -15 15 24
% 0 15 24
% 15 15 24
% 30 15 24
% 45 15 24
% 60 30 12
% 75 60 6
% 90 360 1
% l_eq_hrir_S =
%
% elev_v: [187x1 double]
% azim_v: [187x1 double]
% type_s: 'FIR'
% sampling_hz: 4... |
clc
clear
D = .5;
gama =.5;
omega=2*pi*1;
realization = 10;
Fs = 1000; % Sampling frequency
dt = 1/Fs; % Sample time
L = 20000; % Length of signal
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
f = Fs/2*linspac... |
function [LabelBasedAccuracy,LabelBasedPrecision,LabelBasedRecall,LabelBasedFmeasure]=LabelBasedMeasure(test_targets,predict_targets)
% syntax
% [LabelBasedAccuracy,LabelBasedPrecision,LabelBasedRecall,LabelBasedFmeasure]=LabelBasedMeasure(test_targets,predict_targets)
%
% input
% test_targets - L x n... |
function RgFrontNO = MaximumRanking(PopObj,W,K)
% Get the front of each solution by calculating the global rank
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEMO for research purposes. All publications... |
% model Models (model Objects).
%
% Model objects are created by loading a model file written in [IRIS
% modeling language](modellang/Contents). Once a model object exists, you
% can use model functions and standard Matlab functions to write your own
% m-files to perform the desired tasks, such calibrate or estimate t... |
%% Solves qs 7.4 for project
% this function plots the data curve and the cubic spline
function polynomialInterpolation()
% given data points
t = [0; 0.5; 1; 6; 7; 9];
y = [0; 1.6; 2; 2; 1.5; 0];
% determine the polynomial and spline
p = polyfit(t, y, 5);
splineCurve = spline(t, y);
ts = linspace(0, 9, 50);
yp = po... |
% Do batchwise EM-steps until convergence
diffm = 1;
diffsigma2 = 1;
%plotbuffer(pd);
%while (diffsigma2>1e-10) & (diffm>1e-10)
while (diffsigma2>1e-7) & (diffm>1e-8)
emstepb; % A batchwise EM-step
diffm = sum(sum((m-oldm).*(m-oldm)));
diffsigma2 =sum((sigma2-oldsigma2).*(sigma2-oldsigma2));
%plotrefresh(pd);
... |
% Unit test of the IDObjectiveQuadratic objects
%
% Author : Darwin LAU
% Created : 2016
% Description :
classdef IDObjectiveQuadraticTest < IDObjectiveTestBase
properties (MethodSetupParameter)
quad_objective_test = {'MinQuadCableForce', 'MinInteractions', 'QuadOptimallySafe'};
end
... |
%function [y, error_code] = trapecio(parametros, x)
function y = trapecio(parametros, x)
slope_1 = parametros(1);
slope_2 = parametros(2);
slope_3 = parametros(3);
b_1 = parametros(4);
% b_2 = parametros(5);
% b_3 = parametros(6);
% indice_1 = parametros(7);
% indice_2 = param... |
function [freq, gains] = gain_corr_csum(M, O, S1, S2, TS, D, L, H)
%genarate expected times and gain for correlated signals + CUSUM
rg=10:10:400;
gains = zeros(length(rg), 1);
freq = zeros(length(rg), 1);
j = 1;
for i = rg
[c, numalarms] = csum(M, [S1, S2], D, i);
[a, c, gains(j)] = corr_csum(M, O, S1, S2, TS,... |
%k = nr_38_211_sch_dmrs_re_mapping(n_PRB_start, n_PRB_sched, UL_DMRS_config_type, ap)
%
% Returns a vector of RE indices over a specified antenna port on which the DMRS
% modulation symbols are mapped.
% Based on 3GPP 38.211 sec. 7.4.1.1.2.
%
% Arguments:
% n_PRB_start - numner of the first scheduled PRB
% n_PRB_s... |
%% Define Red Pitaya as TCP/IP object
clc
close all
% IP= '192.168.101.108'; % IP of your Red Pitaya...
IP= 'rp-f01b63.local'; % rp-MAC.local MAC are the last 6 characters of your Red Pitaya
port = 5000; % If you are using WiFi then IP is:
RP=tcpip(IP, port,'InputBufferSize',3... |
clear
close all
root = fileparts(fileparts(mfilename('fullpath')));
facility = 'canal';
windowtype = 'gaussian';
ALL.average_segment_length = [400,700,1000]; % [ft]
ALL.cycle = [70,85,100,115]; % seconds
ALL.green_split = [0.5,0.7];
ALL.max_abs_delta = [0,0.2];
ALL.speed = 16;
ALL.numsamples = ... |
clear all;
data2=load('data2.log');
i=data2(:,1)*2.5/(4096*0.005*50);
v=data2(:,2)*2.5/4096;
%filter data (x32)
filt_size=32;
m=1;
for k=1:length(i)/filt_size
i_filt(k) = sum(i(m:m+filt_size-1))/filt_size;
v_filt(k) = sum(v(m:m+filt_size-1))/filt_size;
m = m + filt_size;
end
p_filt = i_filt.*v_filt;
t=1:leng... |
% Parameters:
% points -- num_frames x num_points x num_dims
function points = subtract_mean(points)
num_frames = size(points, 1);
num_points = size(points, 2);
num_dims = size(points, 3);
num_total = num_frames * num_points;
% Subtract mean.
points = reshape(points, [num_total, num_dims]);
mu = mean(p... |
function [theta, J_history] = gradientDescent_vectorized(X, y, theta, alpha, num_iters)
%GRADIENTDESCENT Performs gradient descent to learn theta
% theta = GRADIENTDESENT(X, y, theta, alpha, num_iters) updates theta by
% taking num_iters gradient steps with learning rate alpha
% Initialize some useful values
m = ... |
load('Stat.mat');
u1 = 0;
for u = 1:length(StatFile.qcno_dB)
if (StatFile.Np(u) > 0)
u1 = u1 + 1;
Graph.Np(u1) = StatFile.Np(u);
Graph.qcno_dB(u1) = StatFile.qcno_dB(u);
Graph.DestW(u1) = StatFile.DestW(u)/StatFile.Np(u);
Graph.DestW_Theor(u1) = StatFile.DestW_Theor(u... |
function [estimatedOns estimatedOffs]=runPolyAlignment(audiofile, midifile, meansCovarsMat, voiceType)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% estimatedOns estimatedOffs]=runPolyAlignment(audiofile, midifile)
%
% Description: Main function for runing polyphonic MIDI-audio alignment
... |
function [noteNumber,velocity,flag,shift,deltalen,delta,RunningStatus] = runNote(raw,cursor)
% Only used when Running Status is detected
% Returns note numbers and velocities until the end of the Running status
% also checks for delta times
noteNumber = nan;
velocity = nan;
%type = nan;
%delta = nan;
flag = 0; % if 1 ... |
%% Program to scale up the sfm reco to Tango scale
% Author : Zakaria Laskar
% Date : 02/07/2015
function [scale, T_3DptsPerImage, StdInd] = getScale(MVGSfm_Data, ImageList, camparams, validFilesTango)
clc;
% % % camparams = [1040.47; 1040.63; 634.03700000000003; 365.99900000000002; 0; 0; 0]; %White
disp 'Getti... |
function [T] = datenumTable(T,oDate,nDate)
%% Convert date to Datenum Format
%
% Input
% Table T
% String oDate with name of old date column
% opt. String nDate with name of new date column (otherwise column stays the same)
%
% Output
% Table T
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check number of inputs
if nargin<... |
function [A,B,f1,f2]=createadjmat(size,a,b,p,r)
%Input:
%size: number of nodes in the graph
%a: number of sources. Source nodes would be 1 to a
%b: number of sinks. Sink nodes would be size-b+1 to size
%p: probability of adding an edge. So if p is small, the graph would be
%more sparse
%r: number of trauma
%Output:
%A:... |
water_level_change = -1;
jj=0;
homeDir = "D:\celerisWorkFlow";
stdOutput='Z:\celerisWorkFlow\output\';
frames_dir=[stdOutput];
for ii=1:99
cd(homeDir)
time_mat_name = ['WL_', num2str(water_level_change), '_time_', num2str(jj), '.mat'];
mat_path = [stdOutput, '\', time_mat_name];
load(mat_path)
file... |
function [gmmScores] = gmmUBM_onlyGMM_directD(project)
load([project.paths.processedData '/processed_data_word_level.mat']);
%% mfc raw , mfc feat wrap, mfc+f0,f1,f2,intensit = 43 (raw), same with feat wrap
input_data = mfc;
feat_name = 'mfc';
feat_name = strrep(feat_name ,'_' , '');
%%
gmmScores = zeros(size(D,1),8... |
function [ data_train,labels_train,data_test,labels_test,minID,maxID,newmaxID,newminID ] = separateData( inCells, inData )
%separateData create train/test datasets
n=length(inCells);
labels=zeros(n,size(inCells{1,1},1));
data=inData;
for i=1:n
label=inCells{i,1};
labels(i,:)=label;
... |
function ret=confusion(x,y,n)
ret=zeros(n);
for i=1:length(x)
ret(x(i),y(i))=ret(x(i),y(i))+1;
end
end |
function w = SGD_form2( data, gamma, C ,epoch)
len = length(data(1).line);
w = zeros(1,len-1);
step = 1;
for t = 1:epoch
data = data(randperm(end));
for i = 1:length(data)
x = data(i).line;
x_len = length(x);
x_new = x(1:x_len-1);
cur_gamma = gamma/(1+step);
... |
function mpc = case3_toy
%CASE2 HW2 Power flow data for 3 bus, 2 generator case.
% Please see CASEFORMAT for details on the case file format.
%
% Based on data from Joe H. Chow's book, p. 70.
% MATPOWER
% $Id: case2_HW2.m 2408 10/01/2016 $
%% MATPOWER Case Format : Version 2
mpc.version = '2';
%%----- Po... |
function [archs,strs] = SEL_assert_full_factorial(instruments)
global params
n = length(instruments);
nall = length(params.instrument_list);
archs = zeros(2^n-1,nall);
strs = cell(2^n-1,1);
for d = 1:2^n-1
mask = de2bi(d,n);
instrs = instruments(logical(mask));
str = StringArraytoStringWithSpaces(instrs);
... |
%{
_______________________________________________________
#####################################################
SIMULACION PROYECTO DE GRADO CASOS COVID-19
EMPLEANDO METODO DMD
_____________________________________________________
##############... |
close all
clear
clc
nc = 255;
y = 1:nc;
for i=1:nc
I(i,:) = y;
end
% figure, imshow(I,[]);
imwrite(uint8(I), 'pattern.png', 'png'); |
function channelsFinal = gradientDescent(skel, initialChannels, finalChannels, error,step)
% GRADIENTDESCENT Computes a sequence of channels from an initial position to a final one, using least square function as objective function and gradient descent.
%
% Description:
%
% channelsFinal = gradientDescent(skel, init... |
classdef CloudTableClient < azure.object
% CLOUDTABLECLIENT Class to provide access to the cloud table client
% Creates a table client object for transacting with the Azure table storage.
%
% az = azure.storage.CloudStorageAccount;
% az.loadConfigurationSettings();
% az.connect();
%
% % Create a client ... |
close all
clear all
root=fullfile(mdf,'stn_rotameter\STN_Rotameter\');
cd(root);
addpath(fullfile(mdf,'matlab_scripts\wjn_toolbox'));
addpath(fullfile(mdf,'stn_rotameter\rotameter_scripts'));
pat=patienten;
n=0;
%a=4;
for a=1:length(pat)
if ~isfield(pat{a},'bad') && pat{a}.med;
n=n+1;
filename=pat{a... |
classdef Deltahedging1 <handle
properties(Hidden = false)
freq = [];
total_val = [];
invest_frac = 10000;
num_option_lot = 1; % 持有期权的手数(始终持有这么多)
cash = 0;
vol = [];
imp_vol = [];
est_vol = 0.25;
... |
% This one is based on the TSP single-salesman circuit -- each LGS will
% pick up stars until it can't anymore, and then hand off to the next.
% Trying to fit a full circuit into 1/6th the time and dV budget.
% Needs to run ham_StarkSkymap first.
close all
lgs_count = 1;
lgs_dv = dvcap/6;
lgs_time = 0;
lgs_dvs = dv... |
clear all;
close all;
NX = 50;
NY = 50;
load results.dat
load ecl_rs.dat;
load ecl_p.dat;
load ecl_sw.dat;
load ecl_sg.dat;
p = reshape( results(:,1),NX,NY);
sw = reshape( results(:,2),NX,NY);
sg = reshape( results(:,3),NX,NY);
so = reshape( results(:,4),NX,NY);
Rs = reshape( results(:,5),NX,NY);
ecl_p=reshape( ecl_p'... |
function [HRchoicePerc, vec_rates, up, lo, nSamples, xx, yy, ee, hmodal] = PMF_set_plot(stimrate, allResp_HR_LR, cb, vec_rates, plotPMF, shownumtrs, lineColor, setWilsInt)
% set the x (vec_rates) and y (HRchoicePerc) for plotting the pshychometric function (PMF).
% also set the confidence intervals.
%
% allResp_HR_... |
% original=ScenarioPtr;
% original.load('C:\Users\Felix\code\autoCalibrationProject\beats_scenarios\210E_joined_original.xml');
% new=ScenarioPtr;
% new.load('C:\Users\Felix\code\autoCalibrationProject\beats_scenarios\210E_joined_original.xml');
X=load_210e_setup;
dirname='C:\Users\Felix\code\autoCalibrationProject\pe... |
function EvaluaetNodeCoor( obj, Nh, Nz )
[ Nph, r1, s1 ] = tri_node_coor_func( Nh );
[ Npz, t1 ] = line_node_coor_func( Nz );
Np = Nph * Npz;
r = repmat(r1, 1, Npz);
s = repmat(s1, 1, Npz);
t = repmat(t1', Nph, 1 );
%r = r(:); s = s(:); t = t(:);
obj.Np = Np;
obj.Nph = N... |
function [trans, rot, alinpts] = alignFiducials(inpts, volpts)
%[trans, rot] = alignFiducials(inpts, volpts)
% returns alignment matrix given inpts and volpts as corresponding points
% rot rotates inpts into volpts coordinate frame.
% scaleFac is a vector containing scalings of the x,y,and z axes
% such that inpts*s... |
% % % % % % % % % % % % % % % % % % % % % % %
% MATLAB code for our BSUM algorithm, to reproduce our works on SNMF research.
% Simply run main_compare.m, you will get the comparison result for all state-of-the-art algorithms
%
% References:
% [1] Qingjiang Shi, Haoran Sun, Songtao Lu, Mingyi Hong, and Meisam Razaviy... |
% This is an algorithm for "robot1" that will interact with the simulated
% market environment.
% In this script, robot_1 places a passive order at the best, but never
% places a bid above fundamental value or an ask below fundamental value.
max_potential_quantity_robot1=100;
alive_indicator_robot_j=1;
message_type=1... |
% Cotter's Method Program
% Written by Nathan Knodel on Feb. 15, 2018
% Last updated on Feb. 19, 2018
% Works for evaluation of problems with 3-10 parameters
clear vars
%% Prompt User for Inputs
test = 1;
while test == 1
np = input('Enter the number of parameters being considered: ');
if (np >= 3 && np <= 10)... |
% 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... |
GAMMA_H1=26754; %rad/s/Gauss
dt = 1e-6 ; %us
G=[linspace(0,1,300)';
ones(3000,1);
linspace(1,0,300)';
zeros(50,1);
-linspace(0,1,300)';
-ones(3000,1);
-linspace(1,0,300)';
];
t=[0:length(G)-1]' * 1e-6; % s
plot(t,G)
mom = 4*sum(G.*t) * dt % in G*s
venc = 2*pi/(GAMMA... |
function [N_matrix, Np_matrix, Npp_matrix] = bspline_creator(varargin);
% BSPLINE_CREATOR creates the matrices necessary for a B-spline curve and
% its first and second time derivative.
%
% [N, NP, NPP] = BSPLINE_CREATOR computes and saves to disk the B-spline
% N coefficent matrix and its first and sec... |
function [x, y] = depuncturing (data)
[n, should_be_one] = size (data);
puncturing_mode = 2/3;
m = puncturing_mode * n;
x=zeros(m,1);
y=zeros(m,1);
for i = 1:2:m
x(i+0) = data(3*(i-1)/2+1);
x(i+1) = 0.5;
y(i+0) = data(3*(i-1)/2+2);
y(i+1) = data(3*(i-1)/2+3);
end
... |
function[square, cube] = squareAndCube( x )
%SQUAREANDCUBE Summary of this function goes here
% Detailed explanation goes here
square = x^2;
cube = x^3;
end
|
function [Prob_Z]=MT_Prob_Z_Update(X,P,E,labels,parameters)
% Inputs:
% X - Inputdata, reshaped hyperspectral image treats each pixel as column vector, d by N
% P - Proportion value calculated from the previous iteration M+1 by N;
% E - Endmember matrix calculated from the previous iteration d by M+1;
% ... |
function [Pn] =Qiu_Pn_Ci(beta,Ci)
epsilon=beta(1);
Pn_sat=beta(2);
Rp=beta(3);
Pn=epsilon*Pn_sat.*Ci./(epsilon.*Ci+Pn_sat)-Rp;
end |
function [Ttot,Vtot,T1_,T2_,T3_,T,V1_,V2_,V3_,V,wrong_Ttot1,wrong_Ttot2,wrong_Ttot3] = Energy(mass,velocity1,velocity2,I,position,variables,wrong_vel,Rf_1_0,Rf_2_0,Rf_3_0)
%% ENERGY
% Default values and variables
%----------------------------------------------------------------------
global ... |
%better read
function data = parseCSV(path, settingsInput)
if ~exist('settingsInput', 'var')
settings.skipLastEntry = 1;
elseif isnumeric(settingsInput) % legacy support
settings.skipLastEntry = settingsInput;
else
settings = settingsInput;
end
fid = fopen(path);
fdata = fread(fid,inf,'uint8=>char');
% ... |
% Compute torques, given current inputs, length, drag coefficient, and thrust coefficient.
function tau = torques(inputs, L, b, k,mp,xp,yp,g)
% Inputs are values for ?i
tau = [
L * k * (inputs(2) - inputs(4))+ mp*yp*g;
L * k * (inputs(1) - inputs(3))- mp*xp*g;
b * (inputs(1) - inputs(2) + inputs(3) - inputs(4));... |
function [Pmerg,W]=merging_Rmax_Kim(P_OBS,P_SAT1,P_SAT2)
rho1R=matrixcorr_slow(P_OBS,P_SAT1);
rho2R=matrixcorr_slow(P_OBS,P_SAT2);
rho12=matrixcorr_slow(P_SAT1,P_SAT2);
W=(rho1R-rho12.*rho2R)./(rho2R-rho12.*rho1R+rho1R-rho12.*rho2R);
W(W<0)=0;W(W>1)=1;
% W(find((nansum(P_SAT1)<10)))=0;
% W(find((nansum(P_SAT2)<1... |
function dat = loaddat_ex2_lhg(phnum,slnum,scaninfo,fid);
% this function should read the data for one slice at one frame
% it should include all the coils and all the shots
%
% order of data in file (rev/for, views(spirals), slices, coils)
DEBUG = 0;
if (scaninfo.sliceorder == 0)
slnum2 = round((slnum+1.5)/2) + rem... |
function synth = lpSynthesis(alpha,G,resi,fs,frameLen,hopLen,winName,preemphasise)
%This function performs LP synthesis using the parameters given as inputs
%to the function. Each column of 'alpha' contains the LP coefficients of
%the respective frame, 'G' holds the gain of each frame and 'resi' holds
%the excitati... |
function [modlist,funlist,fun_info]=find_make(typestrlist)
% fun_info is a 1x2 cell. fun_info{1}=>1 result is pointer, 0=>not
% fun_info{2}=>typestr ('r' or 'c' usually)
declare_globals
funname='find';
modlist='';funlist='';
r=[char(10)];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
% GUI runner file
function varargout = recog_me_in(varargin)
% RECOG_ME_IN MATLAB code for recog_me_in.fig
% RECOG_ME_IN, by itself, creates a new RECOG_ME_IN or raises the existing
% singleton*.
%
% H = RECOG_ME_IN returns the handle to a new RECOG_ME_IN or the handle to
% the existing singleton*.
... |
f = @(x)exp(-x)./(1+x)
k = 1:10;
nlist = 2.^k+1;
n = length(nlist);
exact = simpson(f,0,1,10^4/2)
for i = 1:length(nlist)
trapint = trapezoidal(f,0,1,nlist(i));
simpint = simpson(f,0,1,nlist(i)/2);
traperr(i) = trapint - exact;
simperr(i) = simpint - exact;
end
loglog(nlist,abs(traperr),n... |
function spacing = pairSpacing(r1,pos1,r2,pos2)
% function spacing = pairSpacing(r1,pos1,r2,pos2)
% pairSpacing Takes pair of circles, computes spacing/overlap
% r1,r2 (pos real): radius of circle 1 or 2, in px
% pos1,pos2 (1x2 pos real): [x y] coordinates of circle 1 or 2, in px
% spacing (real): pixels between... |
%%
tic
diverg = 0.001;
thetaD = diverg.*rand(1,2e6); % uniform rand. dist over divergence ang.
phiD = (2*pi).*rand(1,2e6); % uniform rand. dist over azmuthal angles
beta = 90.*pi/180; % direction the transmitter is pointing (zenith)
alpha = 90.*pi/180; % direction the transmitter is pointing (azmuth)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.