text stringlengths 8 6.12M |
|---|
% pop_writeeepavr - Write ANT EEP .avr file
%
% Usage:
% >> com = pop_writeeepavr(EEG); % pop-up window mode
% >> com = pop_writeeepavr(EEG, 'key1', value1, 'key2', value2, ...
% 'keyn', valuen);
%
% Inputs:
% EEG - EEGLAB EEG structure
%
% Optional inputs:
% 'filename' ... |
function [ date ] = GetDate( name )
% Read the entire image to memory
im = name;
% Get only hour section from the image
im = im(1:7,end-183:end-105,:);
t = graythresh(im);
im = im2bw(im,t);
% Array of digit locations
digits = [
1, 7;
9,15;
17,23;
25,31;
40,46;
49,55;
65,71;
73,79
... |
function out1 = hess_grf_ceq_heel1420(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL1420
% OUT1 = HESS_GRF_CEQ_HEEL1420(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:33:45
out1 = 0.0;
|
function [ResultStruct, ResultStructBW]=Threshold_Image_MaskXF(CDataSetInfo, Param)
%%%Doc Starts%%%
%-Description:
%This method modifies the image and mask by applying an image intensity
%threshold and 2D binary mask erosion. After applying the image intensity
%threshold it uses the MatLab 'imfill' function to r... |
% /*
% * UTMXYToLatLon
% *
% * Converts x and y coordinates in the Universal Transverse Mercator
% * projection to a latitude/longitude pair.
% *
% * Inputs:
% * x - The easting of the point, in meters.
% * y - The northing of the point, in meters.
% * zone - The UTM zone in which the point lies.
% * southhemi - True i... |
function butterfly(p,w)
for j=1:length(p)
plot(p{j}(w,:))
hold on
pause(0.01)
title(j)
end
end |
function varargout = thermGUI(varargin)
% THERMGUI MATLAB code for thermGUI.fig
% THERMGUI, by itself, creates a new THERMGUI or raises the existing
% singleton*.
%
% H = THERMGUI returns the handle to a new THERMGUI or the handle to
% the existing singleton*.
%
% THERMGUI('CALLBACK',hObject,e... |
function out1 = six_J2(q1,q2,q3,q4,q5,q6)
%SIX_J2
% OUT1 = SIX_J2(Q1,Q2,Q3,Q4,Q5,Q6)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 22-Jun-2020 12:50:38
t2 = q1+q2;
t3 = cos(t2);
t4 = sin(t2);
t5 = q3+q4+t2;
t6 = cos(t5);
t7 = q5+t5;
t8 = sin(t5);
t21 = t3.*4.38012e-1;
t22 = t4.*4.... |
% Sample the meta-modeling DBN containing following five input models:
% 1. The postprandial model
% 2. The exocytosis model
% 3. The signaling model
% 4. The GLP1R model
% 5. The metabolism model
SCRIPTS_PATH=pwd(); % Change this line if not running from scripts path
OUTPUT_PATH= SCRIPTS_PATH+"/Output/accuracy_precis... |
function output = vuRowMajorColumnMajorSwitch(input)
% vuRowMajorColumnMajorSwitch exchanges the rows and columns in the input, in order to
% adhere to row major or column major storage.
% Currently, handles input matrices, meta_image structure, and
% transformation structures.
%
% SYNTAX:
% output = vuRowMajor... |
function optimization(track, car)
error = 10;
if all(car.position+error >= track.obstacles.mids(car.current,:)') == 1 ...
&& all(car.position-error <= track.obstacles.mids(car.current,:)') == 1
if car.current < track.length
car.current = car.current + 1;
else
... |
function writeMetaImage(data, varargin)
% writeMetaImage writes data in the MetaImage (MHD+RAW) format.
%
% writeMetaImage(data, filename)
% or
% writeMetaImage(data, filename, meta)
% or
% writeMetaImage(data, filename, meta, forceMetaProperties)
% or
% writeMetaImage(data, filename, sp)
% or
% writeMetaImage... |
%load /home/Stephen/Desktop/Data/Seg/BSR/dn_ucb_pb0
%load ../bd_st0
psz = 31;
algo_id = 1;
ssz = 0;
for id=1:200;
id
for gid = 0:1;
switch gid
case 0
sub_im = pb{id}((ssz+1):end-ssz,(ssz+1):end-ssz);
case 1
sub_im = gts_pb{id}((ssz+1):end-ssz,(ssz+1):end-ssz);
end
mat_x2 = im2col(sub_im,[psz psz]);
for Did =... |
function [qp] = QuatMult(q, p)
qo = q(1);
po = p(1);
qv = q(2:4);
pv = p(2:4);
qpo = (qo * po) - (qv' * pv);
qpv = (po * qv) + (qo * pv) + (cross(qv, pv));
qp = [qpo; qpv(1); qpv(2); qpv(3)]; |
function Refactor()
filename = 'data.txt';
d = 3000;
Prior = PlotPrior(filename, d);
Theory = PlotTheory();
Post = PlotPosterior(filename, Prior, Theory, d);
PlotPosterior(filename, Post, Theory, d);
LogPanel(filename);
end
function [depth,gamma,phi,rho,caliper] = ImportWellLog(filenam... |
function [nlp] = updateInitCondition(nlp, init_params)
for i = 1:length(nlp.Phase)
fields = fieldnames(init_params(i).states);
for j = 1:numel(fields)
if ~any(ismember(nlp.Phase(i).OptVarTable.Properties.VariableNames, fields{j}))
continue;
end
fo... |
function [ipring] = nest2ring(nside, ipnest)
% nest2ring(nside, ipnest)
% Convert pixels in a nested scheme into a ring scheme
%
% Inputs:
% nside: Pixel resolution, power of 2 less than 30
% ipnest: Pixel values in nest
%
% Output:
% Pixel values in ring
if size(ipnest, 1) > size(ipnest, 2)
ipnest = ipnest';
end
... |
function hbwt_CE_mod = CE_mod(hbwt,M,ang)
a=1:M;
% a=sin(1.7*a.^2.5);
% C_zero = (2*CE)/fs;
% C_zero = 0.5;
bend = abs(ang)*0.009;
%lin = 1-(C_zero*ang + (C_zero.^2)*bend);
vec = ((bend*(a.^2)+ang*a));
if ang<0
vec = vec + (1-vec(end));
elseif ang>0
vec = vec + (1-vec(1));
% else
% vec = ones(size(a... |
function [point_candidate, x1, y1, track_out] = new_candidate_data(point_candidate, x1, y1, xc, yc,track_out)
for i = 1:length(x1)
x = point_candidate{i,1};
y = point_candidate{i,2};
[a,b] = find(x == xc & y == yc);
if length(a) > 0
x(a(1)) = [];
y(a(1)) = [];
point_candidate{i,1... |
function Data=replayFilter( Data)
%replayFilter Run an EFK filter using the readings logged during an actual
%flight.
% Data is a structure containing the filter settings and the flight data.
nt = numel(Data.Time);
have_x=1;
if ~any(strcmpi(fieldnames(Data),'x'))
have_x=0;
Data.X=zer... |
function img = extendFOV( img, geom )
if ~geom.helicalScan && length( geom.detSize ) == 2 && length( geom.reconSize ) == 3
k = round( ( geom.reconSize(3) - geom.detSize( 2 ) * geom.detSpacing( 2 ) / 2 / geom.reconSpacing(3) ) / 2);
k = max(k , 0);
img = extendVoi( img, k );
end
end |
function resError = plotSteadyState1960(log_inp, param,num_grid,AL,AM,AS)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% This function is just calculating the residual errors of wages, no loop.
%%%% For replicating BS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%%%% computes linear fit to ss from ss(trange0)
% alpha is slope of linear fit
% ypred is linear fit across full support of ss
% b is y-intercept
% r is correlation in log-log space of ss with linear fit
function [alpha, ypred, b, r] = get_powerlaw(ss, trange0)
allrange = 1:numel(ss);
logss = log(abs(ss(:)))... |
function [sd2] = confidenceToVar(ci, alpha)
if nargin < 2
alpha = 0.05;
end
n = size(ci, 1);
t = tinv(1 - alpha/2, n-1);
sd = (ci(:, 2) - ci(:, 1)) / (2*t);
sd2 = sd.^2;
end
|
clear all
[x,y]=solve('x^2+y^2=10','2*x+3*y=0','x','y') |
function C = AMIGO_structByTag(A,tag)
%AMIGO_structByTag(inputs,tag) returns a similar structure of A with the fields, where the tag appears.
% if tag is a cellstr containing multiple tags, it returns the union of the
% fields that contain at least one of those flags.
if ~isstruct(A)
C = [];
disp('A is not a... |
function [filters,subrange,sv,wave] = multiBFI(snipfiles,ctfiles,nspikes,nnoise,channels,snipindx,spindx,h)
% tout{clustnum,filenum} = Times of spikes of cell # clustnum, in the file spikefiles{filenum}
% indexout: same as tout except it's the index # of the snippet rather than the time
% First figure out how many snip... |
function Corner = HarrisTop(I, sigma, k, threshold, keypointNum, localRadius, margin, NMS)
%Matrix for computing vertical gradient dy
%-----------------------------------------
%prewitt
%-----------------------------------------
%[ 1 1 1
% 0 0 0
% -1 -1 -1 ]
%-----------------------------------------
dy... |
function obj=spikePostProcessing(obj,tStartEnd)
% Run post-processing steps on spike data. Calculate post-spike fields, and spike neuron identification reliability
% obj=spikePostProcessingNSK(obj,tStart,tEnd)
% Method recieves : gridSorter object
% tStartEnd - [1 x 2] the start and end of a desired s... |
function [Results, Internal] = uq_importance_sampling(LimitStateFcn, SourceInput, InstrumentalInput, Options)
% UQ_IMPORTANCE_SAMPLING conducts an importance sampling analysis based on
% an instrumental density and a limit state function
%
% See also: UQ_SR_IMPORTANCE_SAMPLING
% Now, select the instrumental input, for... |
function [dissRhs] = GetDissRhs(glob)
dissRhs = zeros(glob.nvars, glob.nx+2*glob.nguard, glob.ny+2*glob.nguard);
end |
function x =l2denoise(b ,mu)
laplacian = zeros(size(b));
laplacian(1, 1) = 4;
laplacian(1,2) = -1;
laplacian(2,1) = -1;
laplacian(1,end) = -1;
laplacian(end,1) = -1;
x = ifft2(fft2(b)./(mu*fft2(laplacian) + ones(size(b,1))));
end |
function [z,w] = findmaxe(thl,thu,n,ae,ai,sigma,cee,cie,cei,cii,taue,taui,T,alpha,beta,nu);
options=optimset('Display','off','GradObj','on','LargeScale','off');%,'TolX',1e-3);
[z,w]=fminbnd(@findme,thl,thu,options);
% function y=findme(t);
function [y,G]=findme(t);
y=-rtccomaxe(t,n,ae,ai,sigma,cee,cie,cei,... |
t = pi*(0:0.0001:2);
x = exp(-t/20).*cos(t);
y = exp(-t/20).*sin(t);
z = t;
plot3(x, y, z) |
% noisy XOR example
% - two classes, two domains
% - testing data rotated by test_rot_angle degrees w.r.t. training data
% - nonlinearly separable with domain shift in the original feature space
% - linearly separable in the R-space with a sufficient quantity of
% unlabeled examples used in the R-transform
clear all... |
function [reward,ns,signal]=transition(cs,action)
reward=0;
signal=0;
r=cs(1);
c=cs(2);
switch action
case 1
c=c+1; % move right
case 2
c=c-1; %move left
case 3
r=r-1; % move up
case 4
r=r+1; %move down
end
ns=[r,c];
if isequal([r,c],[21,21]) % reached goal stat... |
%plot in arbitrary x scale
% fxs should be a monotonic function
% inv_fxs is inverse function of fxs
% if label_num is a vector, interpret it as the labels(ticks).
% if y is empty ([]), do not draw the plot, but return the x position, ticks position, tick values
function [H, x_tick, x_tick_val] = xscale_plot(x,y,fxs,i... |
function vol_new = brant_thres_clustersize(vol_3d, cs_thr)
[vol_tmp, num_c] = bwlabeln(vol_3d, 18); % default is 18
vol_nums = 1:num_c;
vol_ind = arrayfun(@(x) vol_tmp == x, vol_nums, 'UniformOutput', false);
cs_size = cellfun(@(x) sum(x(:)), vol_ind);
cs_bad = cs_size < cs_thr;
if any(cs_bad)
bad_nums = vol_n... |
clear;
addpath('binPolyLib', 'decoders');
p = 4801;
wBlock = 31;
m = 2;
L = 2;
tTrials = 160:2:190;
n = L * m * p;
k = L * (m - 1) * p;
w = (m + 1) * wBlock;
nCodes = 10;
nMessagesPerCode = 10;
decodingFailures = zeros(1, length(tTrials));
for i = 1:nCodes
fprintf('Testing code %d\n', i);
[H, Q] = generateT... |
function r = mrdivide(a, b)
% / Slash or right matrix divide.
% (Quaternion overloading of standard Matlab function.)
%
% This function is implemented only for the case in which the
% second parameter is a scalar. In this case, the result is as
% given by the ./ function. The reason for implementing this
% function... |
% Wind Visualization
% Load wind data
load wind x y z u v w
% Compute speed
spd = sqrt(u.*u + v.*v + w.*w);
figure
% Create isosurface patch
p = patch(isosurface(x, y, z, spd, 40));
isonormals(x, y, z, spd, p)
set(p, 'FaceColor', 'red', 'EdgeColor', 'none')
% Create isosurface end-caps
p2 = patch(iso... |
function [sia_nn,E,error]=sia_training_loss(sia_nn, networkOutput,sampleOutput,numberOfSample)
%%%%%%%%%%%%%%% residual%%%%%%%%%%%%%%%%%%%
probs=exp_score(networkOutput);
loss1 =loss_function1(sampleOutput,probs,numberOfSample);
error = probs-sampleOutput;%the error between the real and network
... |
%% A demo of Bayesian Robust CP Factorization
% Author: Qibin Zhao 2013
close all;
randn('state',1); rand('state',1); %#ok<RAND>
%% Generate a low-rank tensor
% Dimensions
DIM = [30,30,30];
R = 5; % ture rank for generating the tensor data
DataType = 2;
Z = cell(length(DIM),1);
if DataType ==1
for m=1:len... |
function database = build_database_src(rt_data_dir,suffix)
fprintf('dir the database');
subfolders = dir(rt_data_dir);
database = [];
database.imnum = 0;
database.cname = {};
database.label = [];
database.path = [];
database.nclass = 0... |
function ptp = quat2euler(q0123,iplot,t,BodyName)
%%ptp = quat2euler(q0123)
%input is a Nx4 vector with quaternions.
%output is a Nx3 vector of 3-2-1 euler angles
if nargin < 4
BodyName = '';
end
q0 = q0123(:,1);
q1 = q0123(:,2);
q2 = q0123(:,3);
q3 = q0123(:,4);
ptp(:,1) = (atan2(2.*(q0.*q1 + q2.*q3),1-2.*(q1.^... |
function test_nn_XOR ()
epsilon = 1e-4;
% NN weights or one possible configuration of OR
th1 = [ -10 20 20; % A|B
30 -20 -20]; % not(A*B)
th2 = [ 30 -20 -20; % not(A xor B)
-30 20 20 ]; % A xor B
% OR truth-table
X = [0 0;
0 1;
1 0;
1 1 ];
... |
function [T,globalPos] = velocityMethod(shiftCell)
%Properties of FBG Sensors
Lam_a = 1535*10^-9; %Meters
Lam_b = 1531*10^-9; %Meters
Lam_c = 1539*10^-9; %Meters
Lam = [1535, 1531, 1539]*10^-9;
P_e = 0.22;
%Specfications determined by calibration
r_a = 356*10^-6; %Meters
r_b = 312*10^-6; %Meters
r_c = 266*10^-6;... |
function TrainSupervisedClassifier_Callback(hObject, eventdata, handles)
% This function trains a convolutional neural network to classify calls. To
% use this function, prepare call files by giving calls categories.
% Rejected Calls are ignored. This function produces training images from
% 15 to 75 KHz, and with wid... |
clear
close all
dir = '/home/abari/Desktop/tagloc/';
txtty = '4';
rxtty = '2';
unix(strcat(['sudo python ',dir,'ttyexec.py pts/',txtty,' "tx ',dir,'OFDM_fakecfo 2 13e3"']))
pause(1.5);
unix(strcat(['sudo python ',dir,'ttyexec.py pts/',rxtty,' "rx ',dir,'rxdata/ 150000000"']))
pause(40);
file0 = strcat(dir,'rxdata/_0... |
function create_all_songs
%$Revision: 1.2 $ $Author: mmccann $ $Date: 2004/05/09 23:27:37 $
% create_all_songs - Creates a list of all songs.
global Gdir Gnum_scans Gall_waves
S = load(sprintf('%s/song_struct.mat',Gdir));
song_struct = S.song_struct;
num_bundles = length(song_struct);
cur_song = 1;
bun_str(1).first =... |
function testVariables = Sample_function_one_dimensional()
%Windtunnel_one_dimensional Summary of this class goes here
% Detailed explanation goes here
%These are the obligatory variables
v.sampleFunction = @(x)(cos(3*x) - x.^2/9 + x/6);
v.nYawInput = 1;
v.xMin = -3;
v.xMax = 3;
v.xMinrad = deg2rad(v.xMin);
v.xMax... |
% example script to look at one engine configuration
% as defined in tf_init
tf_ex1 % initialise the engine parameters
tfan % calculate the engine perfomance
tfatsls % calculate sea level static thrust
tfsummary % show cycle parameters and performance
help tf_ex1 |
function [recon_strategy, opt_struct]=get_recon_strategy(data_buffer,opt_struct,d_struct,data_in,data_work,data_out,meminfo)
% recon strategy settings
% possible recon strategys
% for a series of acquistions load the whole or load most reasonable small
% part.(1 volume,1slice,1ray)
% filter always operates per volume o... |
function [av_diff] = vector_diff(av_X1, av_X2)
v_sqdiff = (av_X2 - av_X1).^2;
av_diff = sqrt((v_sqdiff));
end
|
function [sol,error,costos] = doolittle(A,b)
% sol es vector solución
% error es el error final
% A matriz del sistema
% b vector del sistema
costos = 0;
[n, m]=size(A);
L=zeros(n);
U=zeros(n);
L(1,1)=1;
U(1,1)=A(1,1);
costos = costos + 5;
for i=2:n
... |
function Close()
global d3dtimer D3dUICtrlHandles D3dIsOpen
if (~isempty(D3dUICtrlHandles))
if (isvalid(D3dUICtrlHandles.hObject))
delete(D3dUICtrlHandles.hObject);
end
end
D3d.Viewer.Close();
D3d.Messaging.DeleteTimer();
D3dUICtrlHandles = [];
d3dtimer = [];
clear mex
D3dIsOpen = false;
end
|
function disconnect(varargin)
%DISCONNECT
%
%this function disconnects the current matlab environment from a phoenix
%source. If the connection does not exist, nothing is done. The
%parameters must match the exact name that was used to create the
%phoenix source, so serial@COM1 will not terminate serial@COM1:mica2dot... |
% Jacob Krol
% Collatz Intermediate Value Plotter
clc
c = input('Starting Value:');
pos=1;
while(c(pos) > 1)
if(mod(c(pos),2)==0)
c = [c c(pos)/2];
else
c = [c 3*c(pos)+1];
end
pos = pos + 1;
end
plot(1:pos,c) |
%{
->simf.RFParams
->stimulus.Movie
---
%}
classdef RFRaw < dj.Computed
properties
keySource = (simf.RFParams & simf.RFFilters) * stimulus.Movie
end
methods(Access=protected)
function makeTuples(self, key)
[x_sz, y_sz, binsize] = fetch1(simf.RFParams & key,'x_size','y_siz... |
% plot 2D magnitude of vector field
function wlb_plot_streamlines(u, v)
figure('name','Field stream lines'); clf;
streamslice(u', v')
%axis equal tight
end |
% edit those for path handling
lead path
niicopies='/Users/NetStim/Documents/HCP1000_2/copied_nii';
root='/Users/NetStim/Library/Group Containers/G69SCX94XU.duck/Library/Application Support/duck/Volumes/HCP1200/hcp-openaccess';
storagepath='/Users/NetStim/Documents/HCP1000_2/'; % folder to which the matrix will be writ... |
classdef CandyJar < props.HasProps
% ---- CandyJar.m -------------------------------------------------------
% classdef CandyJar < PROPS.HASPROPS
% %CANDYJAR Object to describe the contents of a candy jar
%
% properties (Hidden, SetAccess = immutable)
% %PROPERTIES Define three props for CandyJar:
% % Can... |
function [ kinematicInfo ] = angles2snakeVC( angles, snakeData, miscData )
%angles2snakeVC Takes in a set of joint angles and kinematic data about the
%snake and spits out the snake in the Virtual Chassis.
%
% [ kinematicInfo ] = angles2snakeVC( angles, snakeData, miscData )
%
% Output:
% kinematicInfo - a stru... |
function [alpha,ecc] = alphaFcn(C,normalVector,indenterType)
% Discretization for numerical integration
numSteps = 720;%0.5*60;
angleVec = linspace(0,180-180/numSteps,numSteps);
hSave = hIntegralVlassak(0,C,normalVector,angleVec,0);
[~,mIdx] = max(hSave);
% Determine the major axis of the ellipse.
hSaveOld = [hSa... |
function [ av ] = rot_av ( rot )
% given a rotation matrix, compute a quaternion
% of the angle-vector variety using eigenvector analysis
% there is probably a more efficient way to do this, based
% on the algorithm here:
% http://skal.planet-d.net/demo/matrixfaq.htm
% which converts a 4x4 rotation matrix to a quatern... |
% Assignment-1.2 Random Number Generation, Linear Congruential Method (LCM).
format short;
n = input('Enter the Value of N = ');
a = input('Enter the Value of A = ');
c = input('Enter the Value of C = ');
m = input('Enter the Value of M = ');
x0 = input('Enter the Value of X0 = ');
r = zeros(n:0);
x = ... |
function results = RBES_get_measuremements(parameter,slot_list)
%(Measurement (All-weather ?aw) (Horizontal-Spatial-Resolution ?hsr) (Instrument ?instr) (launch-date ?ld) (lifetime ?lt)
% (Parameter ?param) (sensitivity-in-low-troposphere-PBL ?tro) (sensitivity-in-upper-stratosphere ?str) (Spectral-sampling ?ss)
%... |
% % 0. generate "x"
% % this section will be commented out during testing
% folder_name = 'data/';
% setN = 3;
% objectI0 = 1;
% objectI1 = 10;
%
% for i = 1:setN
%
% % load big image
% fn = sprintf ( '%sset%d_big_im.png', ...
% folder_name, i );
% b_im = imread ( fn );
%
%
% ... |
function [w, ix_eff, W, AX] = rmlr_learning(label, X, Nfeat, varargin)
% Learning parameters of regularized multinomial logistic regression model.
%
% The estimation algorthm is derived from variational Bayesian method with
% Laplace approximation in W-stap (SLR-Laplace).
% Note that the label vectors must be consisti... |
%% Ronen and Gilad 15.02.18
% Training network to find people in images!
% This is without labels.
clear; clc;
%% Choose labels and label Names:
labels = 1:14;
labelsName = {'person'};
%% loading train CSV, and test CSV:
[trainTable,testTable, FrameData, imgPerm] = PreTrainingdata(labels);
%% Load net:
% currently load... |
% Kp = 0.1, Kd = 0.001, I_max = 5A, Iz = 14e-6
% Output Y
clc
close all
% load angle data from test
run('data.m')
% prepare input output matrices
size(y)
u = [ones(250,1)*180; ones(250,1)*90; ones(249,1)*180];
% Create data model from input output data
data_model = iddata(y,u,0.002);
% Estimate 2-pole transfer func... |
d1 = csvread('device-0.csv');
d2 = csvread('device-1.csv');
%%
%Interpolate d2's values onto d1's values
%get the sample points of d1 that we want d2's value's to be interpolated
%onto
d1_points = d1(:,1);
%get the sample points of d2
d2_points = d2(:,1);
%get the corresponding values of d2
d2_values = d2(:,2);
%... |
function r = rankrange(rank)
%RANKRANGE Summary of this function goes here
% Detailed explanation goes here
r = [1:rank(1) rank(1) + (rank(2):-1:1)];
end
|
nvar = 10;
ncalc = 20000;
nexe = 50;
bench = 10 * nvar + nvar * (((-1/3)^2) - 10 * cos(2*pi*(-1/3)));
result = (-1/3) * ones(1,nvar);
s = 0;
r = 0;
f = 0;
for i = 1:nexe
[a,b,c,d] = Flavio(ncalc,nvar);
r = r + sum(abs(a-result));
s = s + abs(bench-b);
f = f + sum(a);
display([b, sum(abs(round(a)))... |
%% README and TODO
% This constants file serves the half car model.
%% Global constants
qcm.g0 = g0;
qcm.rho0 = rho0;
qcm.V = V;
qcm.Alat = Alat;
qcm.Along = Along;
clearvars V g0 rho0 Alat Along
%% Lengths and heights
qcm.cg = 0.51; % [-] if cg > 0.5 -> toward rear
qcm.Lc = 1.53; % [m]
qcm.... |
function C = class_segment(Xsabs,Xsang,N,S,fs)
%
% Objetive: this function implements the wheezing detection algorithm
% defined in reference "A constrained tonal semi-supervised
% Non-negative Matrix Factorization to classify presence/absence
% of wheezing in respiratory sound... |
function focusWindowSizePopup_Callback(hObject, eventdata, handles)
dropdown_items = cellstr(get(hObject,'String'));
focus_seconds = regexp(dropdown_items{get(hObject,'Value')},'([\d*.])*','match');
focus_seconds = str2double(focus_seconds{1});
handles.data.settings.focus_window_size = focus_seconds;
handles.data.saveS... |
classdef NdgVertLimiter3d < NdgVertLimiter
%NDGVERTLIMITER3D 此处显示有关此类的摘要
% 此处显示详细说明
properties
BoundaryEdge
BottomBoundaryEdge
SurfaceBoundaryEdge
Nv2d
Nvc2d
end
properties
% Inverse Vandmonde matrix corresponding to the first order, is use... |
function beta2flow03(betafile, varfile, TR,Ttag,pid,Ttrans, inv_alpha, isSubtracted , is3D)
% function beta2flow03(betafile, varfile, TR,Ttag,pid,Ttrans, inv_alpha, isSubtracted, is3D)
%
% Takes the parameter estimates of a GLM for ASL data and turns them into
% perfusion values.
%
% version 02 also computes the vari... |
function [] = Engage_Delay()
global H
global XStimParams
global TDT
global FN
global C_
global M_
global GUI
%Engage_Delay
%*******************************************************************************
% Delay
%*******************************************************************************
% NOTE: ... |
function [X_out, discrepancy_norm,err,err1,err2] = RRR(Y,X_init,X_true,param)
% Given an estimation of the image's power spectrum, the RRR aims to find
% the underlying image under the assumption that the image has nonzero
% values only in the upper-left corner and the values of the image are
% within [-1,1].
% The al... |
function Lum = RGB2Lum(ImgIn, Gamut, MPEG)
%ReinhardTMO_Global - compute the luminance of an HDR image.
%
% Syntax: Lum = RGB2Lum(ImgIn, Gamut, MPEG)
%
% Inputs:
% -ImgIn: input image
% -Gamut: gamut of the RGB values
% -MPEG: use the MPEG approximate matrix
%
% Outputs:
% -Lum: output luma or lu... |
classdef fZ2 < Z2
% Fermionic charges.
%
% See also AbstractCharge
methods
function style = braidingstyle(~)
style = BraidingStyle.Fermionic;
end
function [charges, vertices] = cumprod(a)
charges = fZ2(mod(cumsum(a), 2));
vertices... |
function out = event_category_equals(events, categories)
%Makes a cevent variable with only some of the instances in the input cevent
% USAGE:
% event_category_equals(EVENTS, CATEGORIES)
% Finds all the events in EVENTS that have their categories equal to
% one of the numbers in CATEGORIES (which could ... |
function [patterns_train, labels_train, patterns_test, labels_test] = load_dataset_conll(datapath)
% loads training data
load(fullfile(datapath,'coNLL_train.mat'));
num_words = size(X,1);
Xtrain = [ones(num_words,1) X]; %saves features
ytrain = y; %saves labels
%saves start and end of sentence ... |
clear all
close all
clc
load('./matriz-dissimilaridades-dataset-10pct.mat')
A = csvread('dataset-amostrado-10pct-sem-cabecalho.csv');
media_dissimilaridades = mean(D);
M = [media_dissimilaridades' A(:,1)];
M2 = sortrows(M,[1]);
figure; imagesc(D); colorbar
title('Matriz de Dissimilaridades', 'FontS... |
function X = uptrbk(A,B)
[N,N] = size(A);
X = zeros(N,1);
C=zeros(1,N+1);
Aug = [A B];
for p=1:N-1
[Y,j] = max(abs(Aug(p:N,p)));
C = Aug(p,:);
Aug(p,:) = Aug(j+p-1,:);
Aug(j+p-1,:) = C;
if Aug(p,p)==0
'A was singular. No unique solution'
break
end
for k=p+1:N
m = Aug(k,p)/Aug... |
% defining relevant parameters
T= 1;
T1=1/4;
N=10;
a=-T1;
b=T1;
t1=-0.5:0.001:0.5;
% defining relevant expressions
syms t;
xt = 1/4 - abs(t); % triangle wave
% function call to fourierCoeff which returns array of fourier coefficients
F = fourierCoeff(N,T,t,xt,a,b);
%function call to partialfouriersum which returns ... |
function spike_count = spike_count_in_win(spikes, time_win)
% function SPIKE_COUNT = spike_count_in_win(SPIKES, TIME_WIN)
%
% Returns SPIKE_COUNT in in a given TIME_WIN. Spike count is average
% over all channels and all trials in SPIKES
%
% SPIKES: a N_CHANNELS * N_TRIALS * N_SPIKES matrix of spike times,
% padded... |
%% h = HEXSCATTER( x, y, ... )
% Gordon Bean, February 2014
% A scatter-plot substitute - generate a density plot using hexagonal
% patches.
%
% Syntax
% hexscatter(xdata, ydata)
% hexscatter(xdata, ydata, 'Name', Value, ...)
% h = hexscatter(...)
%
% Description
% hexscatter(xdata, ydata) creates a density plot of the... |
function max_grade=grade_test(mph,grade,lb,ub)
%
% This function finds the maximum grade at which
% the vehicle can maintain a constant speed.
% If mph and grade are defined the script
% will only interate once to determine if the vehicle
% can attain the grade at the specified speed or not and will either return
% ... |
function C = cellfunR(fun,C,varargin)
% Recursive version of cellfuncell
if cellDepth(C) < 2
C = cellfuncell(fun,C,varargin{:});
else
C = cellfuncell(@(cl)cellfunR(fun,cl,varargin{:}),C);
end
end |
% Lec 7.3 : MATLAB ode45 Algorithm
function dy = firstODEfun(t,y);
dy = -2*t*y;
end |
function out = spikecorr(ts1,ts2,fs,varargin)
%SPIKECORR Get spike train correlation between two sets of spikes
%
% out = cpl.spikecorr(ts1,ts2,fs,'NAME',value,...)
%
% --------
% INPUTS
% --------
% ts1 : Spike timestamp series 1 (sample index of peaks)
%
% ts2 : Spike timestamp series ... |
SLICE=1415;
fid = H5F.open('scan_taper_U3_67.out.h5');
tic
SLICES=zeros(301,301,2944);
INT=zeros(1,2944);
for II=1:1:2944
dset_id1 = H5D.open(fid,['/slice0',num2str(II,'%.5d'),'/field-imag']);
dset_id2 = H5D.open(fid,['/slice0',num2str(II,'%.5d'),'/field-real']);
REAL = reshape(H5D.read(dset_id2)... |
myHexValues = {};
files = dir('*.jpeg');
% modify image data in for loop to exclude those top/bot black pixels
%Identifies where black bars stop, and passes on the number of pixels from
%top/bot that next operation must exclude
blackBarsTop = [];
blackBarsLeft = [];
%Incase of no black bars, we cannot take mode of no... |
function bsp = BSPut(S0,K,r,sig,T);
% Calculamos el valor de una opción Put según la fórmula de Black-Scholes
% S0: Precio del valor
% K: Strike
% sigma: Volatilidad
% r: Tasa libre de riesgo
% T: Tiempo hasta el vencimiento
echo off;
stau=sqrt(T);
d1=(log(S0./(K.*exp(-r.*T))))./(sig.*stau)+0.5*sig.*stau;
d... |
function [Bary,nodeCoord] = LagrangeNodes2D(degree)
%The nodeCoord is the set of coordinates for the nodes on the unit
%triangle starting at the top left and ending at the bottom right going down each column.
%Bary = [Lagrange basis function, corresponding shift]
%L1 = x
%L2 = y
%L3 = 1 - x - y
%clear all
%degree =... |
# control points given as
# [x1,y1;x2,y2;...] or [x1,y1,z1;x2,y2,z2;...]
# param_values given as
# [t1, t2,...]
# returns [b1,b2;b3,b4;...] (or [b1,b2,b3; b4,b5,b6;...])
function B = bezier(control_points, param_values)
n = size(param_values)(2);
B = zeros(n, size(control_points)(2));
for i = 1:n
S = d... |
function allSlices = rotateAndDipUsingSavedData(object, theta, phi)
R = loadRotationAndSumMatrices(theta, phi);
allSlices = R*object(:);
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.