text stringlengths 8 6.12M |
|---|
function edge = clipLine(line, box, varargin)
%CLIPLINE Clip a line with a box.
%
% EDGE = clipLine(LINE, BOX);
% LINE is a straight line given as a 4 element row vector: [x0 y0 dx dy],
% with (x0 y0) being a point of the line and (dx dy) a direction vector,
% BOX is the clipping box, given by its extreme... |
% A sanity check for rejection sampling
clc
clear
num_xy_samples =1000;
max_x = 100;
min_x= -100;
max_y = 100;
min_y= -100;
jj=0;
cc=0;
tic;
r_dist = normrnd(15, 2, 1000,1);
max_r = max(r_dist);
min_r = min(r_dist);
max_PDF_r = max(ksdensity(r_dist));
min_PDF_r = min(ksdensity(r_dist));
x_samples = zeros(num_xy_sampl... |
classdef MWswitch_PB < Modules.Source
%MWswitch_PB Summary of this class goes here
% Detailed explanation goes here
% This is to turn the MW switch on and off using PB static lines.
properties
PBline = 4; % Pulse Blaster flag bit (indexed from 1)
ip = 'No Server';... |
function rlCreateEnvTemplate(varargin)
% RLCREATEENVTEMPLATE: Create a template RL environment
%
% RLCREATEENVTEMPLATE(CUSTOMCLASSNAME) creates a template class for RL
% environment and opens the associated CUSTOMCLASSNAME.m file. The
% template class contains a minimum implementation of a cart-pole
% enviro... |
function [bw2, bw] = autoStripe7(dcrop, thres, minsz, maxsz)
% autoStripe7()
% default stripe7 finding protocol
%
% NPMitchell 2020
% Obtain curve in front of stripe 7
datbw = false(size(dcrop)) ;
datbw(dcrop > thres) = true ;
% dilate and erode the binary image acting on the posterior reg
se2 = strel('disk', 2) ;
... |
%SP1= Strategy Player 1; SP2= Strategy Player 2
%Trust versus Trust
%Cooperate=1, Defect=0
function [SP1, SP2]=TrustvTrust(z3,w1,y3,w2,n,SP1,SP2)
if z3(n) >= w1(n)
SP1(n)= 1;
else
SP1(n)= 0;
end
if y3(n) >= w2(n)
SP2(n)= 1;
else
SP2(n)= 0;
end |
function [productBoolRB, productInputLTCounts, productOutputLTCounts] = input_augmentation(boolRB, inputLTCounts, outputLTCounts, augmentationPosition, augmentedInputLTCount)
% This function performs input augmentation for a rule base. It is called
% as follows:
%
% [productBoolRB, productInputLTCounts, produ... |
%%%noisy image SR+denoise
clear all;
img = imread('ted.bmp');
[x,y,c] = size(img);
img_gray = rgb2gray(img);
intImage = integralImage(img_gray);
avgH = integralKernel([1 1 7 7], 1/49);
img1 = integralFilter(intImage, avgH);
img1=uint8(img1);
img1 = imresize(img1, [x,y]);
img2=imnoise(img_gray,'gaussian',0,0.01);
... |
close all;
t = -3:.001:3;
x = 3*(sinc(4.*t)).^2;
c = 3*cos(800e3*pi.*t);
k = 1;
m = 1;
y = (k + m*x).*c;
subplot(1,3,1)
plot(t,y)
title('DSB-TC Time Domain');
Y = fft(y);
subplot(1,3,2)
plot(t,abs(Y))
title('DSB-TC Frequency Domain');
subplot(1,3,3)
plot(t, angle(Y));
title('DSB-TC Phase Respon... |
% Generarea matricelor componente
A1=[1 0 3; 4 -1 2; 8 2 1]
A2=[6 8 3; 4 3 6; 5 9 2]
% Concatenarea matricelor A1 si A2 in vederea formarii unei matrice 3D
A=cat(3,A1,A2) |
function [S,T]=sensifcn(G,Gc,H)
if nargin<=2, H=1; end
S=feedback(1,Gc*G*H); T=1-S; |
function acceleration = IcebergAcceleration( velocityfile, normalfile )
%This function reads in Iceberg Mesh Area data with normal vectors and
%ADCP velocity data, and computes the drift acceleration for the iceberg in the
%mesh.
Normals = importdata(normalfile);
Velocities = importdata(velocityfile);
Areas = Normals... |
cd ..
RunFun(500,1000,'err1')
cd ./kernel2
RunFun(50,1000,'err1')
RunFun(100,1000,'err1')
RunFun(200,1000,'err1')
RunFun(500,1000,'err1')
|
function d = dispFromDepthPx(depth,a,b,c,zD,sPx)
%DISPFROMDEPTHPX Get the disparity [px] from depth [m]
% Inputs:
% depth Depth (z-coord) from the CCD [m]
% a,b,c,zD Calibration parameters
% sPx Camera pixel size [m]
% Outputs:
% d Disparity at the input dep... |
%% Path tracing
basePath = '~/Stanford/SpringQuarter/CS341/specdataimages_gray_512x256_8/';
imageMat = rgb2gray(imread(strcat(basePath,'014809.jpg')));
%imageMat = imcomplement(rgb2gray(im009484));
%imageMat = im014682;
%imageMat = im015834;
%imageMat = im015602;
%imageMat = im015089;
traceMat = imageMat - repmat(... |
% CarLikeVehicleMPrimGenerator : Generates a primitive set for a
% Car-like vehicle. The set guarantees 8-axis simmetry
%
% output_filename : the file to which the results are saved
% car_width : max width of the vehicle
% car_length_front : distance from the back axle to t... |
function cellvar = reshapeInternalCell(MS, phi)
% cellvar = reshapeInternalCell(MS, phi)
% this function reshapes a vetorized cell variable to its domain shape
% matrix based on the mesh structure data; it is assumed that the phi
% does NOT include the ghost cell data as well.
%
% SYNOPSIS:
% cellvar = reshapeInterna... |
%Init
y(1) = 0;
v(1) = 0;
%Parameters of simulation
h = 0.01;
tf = 3;
i = 1;
%
F = 4500;
m = 450;
b = 3750;
g = 9.82;
k = 220e3;
for t = h:h:tf
a(i) = (F/m)-g-(b/m)*(v(i))-(k/m)*(y(i));
v(i+1) = v(i) + h*a(i);
y(i+1) = y(i) + h*v(i);
i = i+1;
end
t = 0:h:tf;
plot(t,y); |
function dq = pos2dq(v)
% POS2DQ Transforms a point position expressed in vector notation into
% its dual quaternion representation.
%
% DQ = POS2DQ(V) transforms the point position, a vector V into a
% dual quaternion DQ. V is either a vector of size 3 (one single
% positio... |
close all
clear all
clc
x=[];
n=-10:25;
k=1:length(n);
[ y , n1 ] = step_seq( -5,-10,25 ); %u(n+5)
[ z , n2 ] = step_seq( 6,-10,25 ); %u(n-6)
[ p , n3 ] = sig_diff( y,n1 , z,n2 ); % u(n+5)-u(n-6)
[ q , n4 ] = imp_seq( 0,-10,25 ); %del(n)
[ s, n5 ] = step_seq( 4,-10,25 ); %u(n-4)
[ t , n6 ] = step... |
function new_im_tgt = transform_image(im_tgt, im_src, mask_tgt, mask_src)
% transform im_tgt using the mean and covariance mattrix of im_src and
% im_tgt. im_src is N1x3 matrix and im_tgt is N2x3 matrix.
%
% Ref: Xuezhong Xiaoand Lizhuang Ma. "Color Transfer in Correlated Color
% Space". VRCIA'06.
%
% Wei Xu
% A... |
%% Indexes exported data directory and iteratively loads files for measurements
% meta.archive.WT_channels_chosen=[]
% meta.archive.KO_channels_chosen=[]
%% sorts filenames into WT or KO
meta.archive.WT_filenames=cell(1);
meta.archive.KO_filenames=cell(1);
meta.archive.dir=pwd;
files=dir;
for idx=1:numel(files)
fil... |
function [U,V] = THUnitConv(UnitChoice, RawData)
%Time History Unit Conversion
[nRow, nCol] = size(RawData);
switch UnitChoice
case 1
for row = 1:nRow
for col = 1:nCol/2
U(row,col) = RawData(row,col*2-1) / 4 * 80 - 40;
V(row,col) = RawData(row,col*2) / 4 *... |
%% track mode shift
CALs = [];
Ts = [];
for ii = 1:50
ii
[CAL,F,v1sig,vx,wlsig] = piezo_scan_fit(sprintf('top_dev60_%dnm_%ddB_%s',1550, 35, datestr(now,30)),instrs,0);
pause(1);
close(gcf);
CALs = [CALs CAL];
Ts(end+1) = now;
end
%%
save(['drift_' datestr(now,30) ],'CALs','Ts... |
function [ res, c0, cmax ] = MSA( class1, class2, pr , vers )
%MSAOLD Summary of this function goes here
% Detailed explanation goes here
% clc;
% vers = 2; % 1 - МСА; 2 - Комб
% ws = load ('classessss_3.mat');
% class1 = ws.class1;
% class2 = ws.class2;
% pr = 2;
% vers = 2;
% ws = load ('classessss.mat');
% class... |
function simplestruct()
a = simple_struct_impl(5) ;
disp(a) ;
end
function [res] = simple_struct_impl(init)
sum.a = init ;
sum.offset = 5 ;
sum.a = sum.a + sum.offset ;
res = sum.a ;
end
|
function [xpf,ypf,hpf,distf,hplusf,hminusf]=computepath(xs,ys,xe,ye,nwp,wp,x,y,h,segment)
if nwp==0
[xpf,ypf,hpf,distf,hplusf,hminusf]=calc_task1( x,y,h,xs,xe,ys,ye,segment(1));
else
wp=[xs ys;wp;xe ye];
for ww=1:nwp+1
[xp{ww},yp{ww},hp{ww},dist{ww},hplus{ww},hminus{ww}]=calc_task1( x,y,h,wp(ww,1),wp(ww+1,1),... |
function JD=G2JD(yy,mm,dd,hh,min,sec)
if mm >2
Y=yy;
M=mm;
else
Y=yy-1;
M=mm+12;
end
D=dd+(hh/24.0+min/1440.0+sec/86400.0);
A=floor(Y/100.0);
B=2-A+floor(A/4);
JD=floor(365.25*(Y+4716.0))+floor(30.6001*(M+1))+D+B-1524.5; |
%% FASE ACQUISIZIONE DATI RELATIVI ALLE PRESTAZIONI
warning('OFF', 'MATLAB:table:ModifiedAndSavedVarnames');
p=[2,4,8,16];
tabella_efficienza = readtable('test_valutazione_prodotto_scalare.xlsx', 'Range', 'B19:G23','ReadRowName', true);
efficienza_img = imread('efficienza.png');
figure(1)
imshow(efficienza_img)
%% AN... |
function varargout = clipPolygonHP(poly, line, varargin)
%CLIPPOLYGONHP Clip a polygon with a half-plane defined by a directed line.
%
% POLY2 = clipPolygonHP(POLY, LINE)
% POLY is a [Nx2] array of points, and LINE is given as [x0 y0 dx dy].
% The result POLY2 is also an array of points, sometimes smaller than
% ... |
%% Harvest control rule, SRFC
% Source:
% PFMC, 2011. Pacific Coast Salmon Plan amendment 16: Classifying stocks, revising status
% determination criteria, establishing annual catch limits and accountability meaasures, and de
% Minimis fishing provisions. Agenda item C.1.b, SAC report 1, Pacific Fishery Managemen... |
function interpolated_surface = interpolateSurface(original_surface)
[a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, a30, a31, a32, a33] = getCoeffecients(original_surface);
interpolated_surface = zeros(2);
interpolated_surface(1,1) = interpolatePixel(0,0,a00, a01, a02, a03, a10, a11, a12, a13, a20, a21... |
% Calculate linear combination of Gaussian functions
function P = multigaussfun(r,r0,fwhm,a)
N = numel(r0);
if numel(fwhm)~=N
error('Number of widths and number of centers must be equal.');
end
if numel(a)~=N
error('Number of amplitudes and number of centers must be equal.');
end
r = r(:);
P = 0;
for k = 1:numel... |
% function [S,R,Q,Lambda_psi] = init(bound,start_pose)
% This function initializes the parameters of the filter.
% Outputs:
% S(0): 3XM
% R: 3X3
% Q: 2X2
% Lambda_psi: 1X1
% start_pose: 3X1
function [S,R,Lambda_psi] = init_Particles(x,y)
%Particles number
M = 750;
%Random par... |
global bound rng l1 l2
l1=1;l2=1;
hh=findobj(gcf,'tag','x1');
xs=str2num(get(hh,'string'));
hh=findobj(gcf,'tag','y1');
ys=str2num(get(hh,'string'));
hh=findobj(gcf,'tag','x2');
xg=str2num(get(hh,'string'));
hh=findobj(gcf,'tag','y2');
yg=str2num(get(hh,'string'));
qs=invkin(xs,ys);
qg=invkin(xg,yg);
... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% Partial fraction expansion of a rational function
%
%
% s^2+3s+1
% X(s)=----------------
% s^3+5s^2+2s-8
A=[1 5 2 -8];
rt=roots(A)
syms s
... |
function SNP_heatmap(mfilepath,namelistpath,chr,classlist,labelnum)
% plot and save the SNP heatmap
%
% For example, SNP_heatmap('/Users/chr4A.phase.fre.vcf.plot','/Users/classlistwheat.txt','chr4A',[6 20 5 29 21],20)
%
% This script is very friendly to those who are not familiar with MATLAB.
%
% mfilepath: The abs... |
function fcsdatGated = applyJCGate_JG(sampleFile, gateFile) %modified by JG for time gating.
% Function to apply a flow cytometry gate to a fcs file. If
% the gate file does not exist yet, runs another function
% (createJCgate_JG) for the user to generate it.
%
% Example:
% fcsdat_gated_by_no_DNA = appl... |
function x = bicycle_kinematic_move(x, u, dt, wheelbase)
%ROBOT_MOVE Summary of this function goes here
% Simulate the moving of a bycicle
% Implements the state transition function kinematics equations
orientation = x(3);
velocity = u(1);
steering_angle = u(2);
distance = velocity * dt;
... |
% activate
function object=activate(object,active)
% manage input
if (nargin<2) || isempty(active)
active=object.Active;
end
valid=1:numel(object.Children);
assert(any(active==valid),'ERROR: invalid child index');
% activate selected child
object.Active=active;
end |
function coefs_opt = inneropt(times, data, pars, lik, proc, ...
in_method, options_in)
% INNEROPT optimizes the coefficients of the basis expansions for the
% representations of the variables or processes in what is called the
% inner optimization loop.
%
% The fitting criterion for bo... |
clear;clc;
% img=imread('E:\C++\Digitaltest\data\DPEX_Data11\rock1.orl.bmp');
% b=size(img);
% RGB = insertShape(img,'circle',[500 500 100],'LineWidth',5);
%
% imshow(RGB);
A={[1 2],[3 4],[5,6]};
B=A(1,2:3);
img=imread('E:\C++\Digitaltest\data\DPEX_Data11\rock1.orl.bmp');
RGB=img;
color=["y" "m" "c" ... |
% Demonstrate the basics of using the regression method for image reconstruction
%
% Description:
% This tutorial shows how do we train and test a regression estimator,
% use dataset generated in t_pipelineBasic.m
%
% This method is described in Golden et al., 2019.
%% Setup training and test dataset
proj... |
%%
directory ='allStim';
workDir = 'C:\Users\Joshua\Desktop\working';
mkdir(workDir);
files = dir(directory);
files=files(3:end);
N=length(files);
Aff = zeros(N,N);
C=zeros(N,1);
Cxy=zeros(N,N);
NCD=zeros(N,N);CD=zeros(N,N);
numsteps = (N^2-N)/2;
h = waitbar(1/numsteps,'Calculating Normalized Compression Distance');
s... |
clear all; clc; close all;
a = (1/10)*ones(10,1);
b = [0.8, 1/9*ones(1,9)]; b = b/sum(b);
%I want ent_b to be HIGHER than ENT_B; This is possible with the following
%formula which is the NEGATIVE of SHANNON entropy.
ent_a = -sum(a.*log2(a));
ent_b = -(sum(b.*log2(b)));
|
function [fitmodels, nfmodels, maxnumpars, nparshat_vec] = destructure_initial_variables (InitialVars)
fitmodels = InitialVars.fitmodels;
nfmodels = InitialVars.nfmodels;
maxnumpars = InitialVars.maxnumpars;
nparshat_vec = InitialVars.nparshat_vec;
end
|
function exerciseHMMsimple
import brml.*
h=1:3; v=4:6;
p_initial=array(h(1),[0.9 0.1 0]);
t=1;
empot=array([v(t) h(t)],[0.7 0.4 0.8; 0.3 0.6 0.2]);
jointpot=multpots([p_initial empot]);
for t=2:3
tranpot=array([h(t) h(t-1)],[ 0.5 0 0; 0.3 0.6 0; 0.2 0.4 1]);
empot=array([v(t) h(t)],[0.7 0.4 0.8; 0.3 0.6 0.2... |
function plotPatch(I,P,pSize,color)
% Plot patch on current figure
% Inputs
% I Image to extract patch from
% P Center of patch
% pSize Patch size
% color Color for marking the patch center
% Compute cut out offsets and coordinates
offsetMin = -floor(pSize/2);
offsetMax = offsetMin + pSize;
cut... |
function str = cell2str(c)
% Convert a cell array of strings into an array of strings.
% CELL2STR pads each string in order to force all strings
% have the same length.
%
% Determine the length of each string in cell array c
nblanks = cellfun(@length, c);
maxn = max(nblanks);
nblanks = maxn-nblanks;
% Create a cell ... |
function mdl = generate_fips_classifier(data, pca_to_keep, dim_subspace, num_learners)
%{
This method generates a subspace-discriminant ensemble
classifier to predict the FIPS code of an observation.
Training data is provided through data. The first column
should be the two-digit FIPS code. The ... |
% Class Description:
% The Satellite class is used to store details of a satellite, generally
% from TLE data.
%
% See reference page for properties and methods.
classdef Satellite < handle
properties
name; % Name
tle_data; % TLE map
orbit; % Orbit object
... |
function Kbar = TF_Kbar(T,g)
I_F = eye(size(T.F,1));
LyaK = Lyapunov_K(g,T);
if max(svd(LyaK.Z * LyaK.PI))>1
disp('Inertia problem');
end
% PP = inv(I_F - LyaK.Z * LyaK.PI) * LyaK.Z;
%
% K_p = T.F' * PP * T.G * inv(I_F + T.G' * PP * T.G);
K1_p = T.F' * inv(I_F - LyaK.Z * T.F * LyaK.PI* T.F') * L... |
function loc = onedriveroot
loc = fullfile(usrroot,'OneDrive - Imperial College London', 'Documents'); |
function [FootEventStruct, FootEventCell] = GetFootEventPipeline( vicon, S, Modify )
%When the MATLAB code fails, use this instead. Make sure to run the
%pipeline given in the warning.
%Gather data from Vicon
% eventDetector=DetectFootEvents();
% eventDetector.FindEvents(vicon, S, 20.0, 'LTOE', 'LANK', 'RTOE', ... |
%% Plot results
close all;
%stats = qextract(res_qtesting);
stats.Method = nominal(categorical(stats.Method,'Ordinal',true));
stats.Scenario = nominal(categorical(stats.Scenario,'Ordinal',true));
stats.breakReason = nominal(categorical(stats.breakReason,'Ordinal',true));
stats = stats(stats.Method ~= 'plain... |
% Class for CORD2R entries
% Defines a rectangular coordinate system using the coordinates of three points.
% Anthony Ricciardi
%
classdef cord2r < entry
% input data
properties
CID
A
B
C
end
properties (Access = private)
R % [3x3] rotatio... |
function [ val ] = calculateB(im_src, im_bg, y, x, i)
%CALCULATEB Summary of this function goes here
% Detailed explanation goes here
src_gradient = im_src(y,x,i) - im_src(y-1,x,i);
target_gradient = im_bg(y,x,i) - im_bg(y-1,x,i);
if abs(src_gradient) > abs(target_gradient)
val = src_gradient;
else
val = ta... |
function x = dh(teta, d, a, alfa)
%DH Matriz de transformação cinemática de Denavit-Hartenberg
% dh(teta, d, a, alfa) cria uma matriz de transformação, sendo
% que teta é o ângulo de rotação em torno do eixo zi, d é a
% distância ao longo do eixo zi, a é a distância ao longo do
% eixo x, e alfa é o ângulo de ... |
%------------------------------------------------2s-p-2s-------------------------------------------%
function [m_p,V_m,I_m] = Test(Iph,n_STC,N_Cell,Vt,Isat,Rs,G,Isc)
%Iph1=0.5065;Iph2=0.0037;Iph3=0.4414;Iph4=0.0037;n_STC=2.6492;N_Cell=2;Vt=0.0278;Isat=3.159e-15;Rs=0.19;G=[940,0,740,0];Isc=[0.5065,0.0037,0.4414,0.0037... |
function wpr = vectowpr(vector, r)
% VECTOWPR converts a direction vector in Cartesian coordinates to WPR
% representation, which is used by certain industrial robots such as FANUC.
%
% Warning: With this solution, r is not calculated. The output of r is
% zero.
% This method converts a vector into W,P,R with a method ... |
function nodesOut = probTreeGen(data2, thresh1, thresh2)
%generate the tree probability data from the raw data and threshold values
data2 = fliplr(data2);
length = size(data2,1);
rounds = [];
outputs = [];
for i = 1:1:(size(data2,2)/(2^length))
rounds(:,:,i) = data2(:,((i-1)*2^3)+1:i*(2^length));
ou... |
% min - Tr X'XU'U U is Ytilde
% U'U1 = 1 - leads to z<>0
% U >= 0
% Reduces to LP,solved by primal-dual
%
% based on kmeansLP_seqActiv
%
function [Y,w,Z,whistory] = kmeansLP_init( X, w,...
neural... %if neural=='neural', use neural plausible primal/dual, othw LP
)
if nargin>=3 && strcmp(neura... |
function [m] = bidirectional_checker(nodes,road_list)
%This functions checks if a given road segment is bidirectional or
%unidirectional.
m=zeros(length(road_list),1);
l=size(nodes,1);
for i=1:l
node1=nodes(i,1);
node2=nodes(i,2);
r=find(node1==nodes(:,2) & node2==nodes(:,1));
if(~isempty(r))
... |
%Warning workspace will be cleared
clc
clear all
close all
mex BruteSearchMex.cpp
fprintf('Mex successifully completed!!!!\n');
N=1000000;%number of reference points
Nq=10;%number of query points
dim=3;%dimension of points
k=3;%number of neighbor
r=.01;%Search radius
p=rand(N,dim);%Note that fu... |
function [output1] = dJp_LeftPelvisRotation(var1,var2)
if coder.target('MATLAB')
[output1] = dJp_LeftPelvisRotation_mex(var1,var2);
else
coder.cinclude('dJp_LeftPelvisRotation_src.h');
output1 = zeros(3, 20);
coder.ceval('dJp_LeftPelvisRotation_src' ...
... |
function [ Warnings ] = CheckHealthFun(Warnings,Buffer,Interval,fs,RealTime...
,EcgStart,RIndex,Index,LongRQuality,NewEnd,Segment,Value,Ecg,Duration,IsAstro,Fail)
% Call this script to identify the warnings
WarningDefinition;
% Search for irregular heart rates
[Warnings] = CheckHeartRate(Warnings, Buffer, Interv... |
function str = num2tex(num, dec)
% str = num2tex(num, dec) returns string created from number in form
% convenient for tex printing.
%
% Input:
% num - number to convert | double
% dec - amount of numbers to show in converted result | positive non-zero
% integer
%
% Output:
% str - resulting number in te... |
function [ depth_out, depth_cut ] = imageCropBorder( depth, settings, flag )
%imageCropBorder Summary of this function goes here
% Detailed explanation goes here
depth_out = depth;
if strcmp(flag, 'original')
depth_out(settings.crop.bottom:end,:) = nan * ones(size(depth(settings.crop.bottom:end,:)))... |
function re_image = siltpCodeingC(image,para)
% Decribe:变种silp编码
%
% 输入参数:
% image: 输入的待处理图像
% para: siltp的左右参数
%
% 输出参数:
% re_image: 进行编码之后的图像结果
[row column byte] = size(image);
re_image = image;
for i = 2:row - 1
for j = 2:column - 1
matrix = image(i-1:i+1,j-1:j+1,1);
... |
function [Y, d] = modifier_NALscale_mixer(X, mod_code, varargin)
%% DESCRIPTION:
%
% Function to query and apply the appropriate decibel (dB) scaling factor
% from the (currently running) algo_NALadaptive function to the
% appropriate elements of the player's mod_mixer.
%
% INPUT:
%
% X: data to scale (potent... |
%-----------------------------------------------------------------------------------------------%
% %
% funktion: eq_DtfDt %
% %
% beskrivning: bestämmer värden på differentialekvationer för temperaturer i bränslenod för %
% givna temperaturer och totalt värme-flöde från noden %
% ... |
function [hfinal] = merge_posterior_figures_fromhandles(f_array,nplots,p)
%%
nfiles = length(f_array);
for j = 1:nfiles
% Your original figures
h(j).fig = f_array(j);
figure_ax = findall(f_array(j),'type','axes');
c = 1;
for i = nplots:-1:1
h(j).ax(i) = ... |
[data_path, code_path] = get_project_paths('ImageJointUnderstanding');
vlf_path = [code_path 'vlfeat/toolbox/vl_setup']; % path to vlfeat
voc_devkit = [data_path 'VOC/2007/devkit']; % path to voc devkit
db_root = [data_path 'VOC/2007/Train_Validate_Dat... |
%a = [1 23 45 6 54 3 2];
%sort(a)
%[b, bi] = sort(a,'descend')
% a(1:2,:);
%
%
% a(1:2,:)
%
% a
%
%
% a(1)
%
%
% a(:,2)
%
% a = [1 23 45 6 54 3 2];
% a = [1 23 45; 6 54 3; 2 6 8];
% a
%
% sort(a)
%
%
% a(1:2,:)
%
%
% a(1,:)
%
%
%
% a(1,2);
%
%
% a(1:2,2)
%
%
% a(... |
%loading the data into the workspace
load('digits.mat');
%getting the size of trainImages and storing the dimensionality of the
%image in variables m and n. In other words, each image is an mxn image.
[m n o samples]=size(trainImages);
%generating a random permutation for training images selection
permutation... |
%% Init
% bpminit;
%% Info
Prefix = getfamilydata('BPM','BaseName');
NBPM = length(Prefix);
% Initialize BPMs for injection triggering of FA mode
for loop=1:NBPM
setpvonline([Prefix{loop} ':wfr:FA:arm'],0);
% setpvonline([Prefix{loop} ':wfr:FA:triggerMask'],bin2dec('10000000'));
% setpvonline([Prefix{l... |
%%% cirumpolar box budget for 2014 in iter 133.
cy = 334;%latitude 59 S
advy=3% make sure the advection lines up with this guy! 4 with 335, 2 w 333, etc.
ts = 74;
tl = 5; % length of time
dt = 432000; % 5day timestep
folder = '../../../data/bSOSE/iter133OLD/';
x = 1:2160; % all longitudes
ylen = 570;
y = 1:ylen; ... |
%************************
%% INITIALIZE
%************************
clc
close all
clear
%************************
%% DASHBOARD
%************************
% Idea if to transform a plot into a quadratic form
xa = -100:100;
%************************
%% MATRIX
%************************
A = [ 2, 2; 2 2]; % choose any m... |
Fs = 200; %sampling frequency in Hz
sT = 20; %length of TS in seconds
L = Fs*sT; %length of the time series
T = 1/Fs; %sampling period
t = (0:L-1)*T; %time vector
fF = 50;
dfF = 25;
y = 0.7*sin(2*pi*10*t)+2*sin(2*pi*50*t)+3*s... |
% Copyright 2018, by the California Institute of Technology. ALL RIGHTS
% RESERVED. United States Government Sponsorship acknowledged. Any
% commercial use must be negotiated with the Office of Technology Transfer
% at the California Institute of Technology.
% -----------------------------------------------------------... |
function raise_me (me,nothing)
% UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010
%
% raise_me - callback to raise clicked object to front of visibility
%
% Usage:
% raise_me (hObject, event, me)
%
% Description:
% Pulls the clicked object to the top of the ui stack; useful
% for raising parti... |
function bamp_extract_calculate_states(options,currentVAR)
if nargin < 2
currentVAR = 'sa1hat';
end
allSubjects = [options.controls, ...
options.psychopathy, options.antisocial];
% variables needed for plotting
nCon = length(options.controls);
nAnti = length(options... |
function color_rgb = light_goldenrod_yellow
color_rgb = {'color', [0.98039, 0.98039, 0.82352]};
end |
% Function plotGraph(G, paths) plots graph G and all paths in paths. The
% paths parameter must be a vector of cells (of possibly different sizes).
function plotGraph(G, paths)
% store number of paths
nPaths = size(paths,2);
% compute number of columns to make square plot
nCols = ceil(sqrt(nPath... |
function[Starts Goals Decoded Vec_l RateDiff Error] = DistanceCellModel(GC_cpm,DrawFig)
%% Distance cell / number line model of vector navigation with grid cells
% Daniel Bush, UCL Institute of Cognitive Neuroscience
% Reference: Using Grid Cells for Navigation (2015) Neuron (in press)
% Contact: drdanielbush@gmail.... |
%% Tests
clear
kuka=RobotConnectorKUKA;
cam = webcam('Logitech');
%%
clear original blocks
original=snapshot(cam);
original=original(MyParameters.YMIN:MyParameters.YMAX,...
MyParameters.XMIN:MyParameters.XMAX,:);
blocks=RecognizeBlocks(original);
x=blocks.blue(1,1);
y=blocks.blue(1,2);
angle=blocks.blue(1,3);
if (... |
folder = 'Data/SplitData/';
fileName = 'studyinterictalAH04';
headFile = [folder fileName '_header.txt'];
dataFile = [folder fileName '_data.txt'];
% Make sure the data file exists
if ~exist(headFile, 'file')
disp(['ERROR: Header file for does not exist!'])
exit;
end
if ~exist(dataFile, 'file')
dis... |
clear all
clc
%% outline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% show en, ch results with trained net
% plus 3-20Dia cluster. each has 2500 ser
% choose one trained net.
% use XP gen ser 3-20 dia int as input
% atom int as ANN input
% en (no transform)
%
%% load data en %%%%%%%%%%%%... |
%
% Created by Tiago Carvalho Mendes
% October, 2019 - University of Aveiro
%
clear;
close all;
clc;
Ta = 0.01;
t = [0:Ta:5-Ta]';
x = 2*sin(4*pi*t);
y = cos(10*pi*t);
z = x.*y;
t_w = [0:Ta:10-Ta]';
w = 3 * sin(pi*t_w) + 2*sin(6*pi*t_w);
figure(31);
plot(t,x,'-r');
hold on;
plot(t,y, '--b', 'LineWidth', 2);
plot(t,... |
clc;
clear;
A = magic(5000);
f = ones(1,20),20;
tic;
B = filter(f, 1, A);
tCPU = toc;
disp(['Total time on CPU: ' num2str(tCPU)])
tic;
AonGPU = gpuArray(A);
BonGPU = filter(f, 1, AonGPU);
BonGPU = gather(BonGPU);
wait(gpuDevice)
tGpu = toc;
disp(['Total time on GPU: ' num2str(tGpu)])
toc;
tic;
MATLABpool ope... |
function result = tools(command,varargin)
% Copyright 2007-2012 The MathWorks, Inc.
if nargout > 0, result = []; end
persistent JAVA_TOOLS;
if isempty(JAVA_TOOLS)
nnpath.add_jar;
JAVA_TOOLS = javaObjectEDT('com.mathworks.toolbox.nnet.matlab.nnTools');
JAVA_TOOLS.initialize(matlabroot,nnpath.nnet_toolbox,nnDepe... |
function [CurPt, id_target] = cursor_inside_Patches(S_TRG)
% This acts basically as wrapper for the inpolygon function
% CurPt - current cursor coordinates
% id_target - polydon id within matrix of structures S_TRG
% S_TRG acts like a micro dstabase
% and holds crucial data about the polygons
% Sam14Aug2... |
syms q4 q5 xe ye ze
syms xA1 yA1 zA1
syms xA2 yA2 zA2
syms xA3 yA3 zA3
syms L1 L2
%second part of mech
% L1 = 125;
% L2 = 150;
%base init
% xA1 = -85;
% yA1 = 0;
% zA1 = 0;
% xA2 = 0;
% yA2 = 100;
% zA2 = 0;
% xA3 = 85;
% yA3 = 0;
% zA3 = 0;
%base init
A1 = [xA1;yA1;zA1;];
A2 = [xA2;yA2;zA2;... |
IMG_H = 20;
IMG_W = 50;
dim= 100;
nb_num = 5;
% method = 'naive';
% method = 'randomBase';
% method = 'pca';
method = 'randomBase';
addpath(genpath('sparse_coding'));
addpath('debug_img');
addpath('kpca');
train_dir = 'test/NOR';
test_dir = 'train/AMD';
out_dir = ['output/', num2str(IMG_W), '_', num2str(IMG_H), '_... |
cd C:\shared\muthu_rest\ForRussell
EEG = pop_readedf('s1_send_run01-edf.edf') ;
chanN = 22 ;
% step 1: get the indices of the gradient epochs
hp = eegfiltfft(EEG.data(chanN,:),5000,20,5000) ;
allhp = eegfiltfft(EEG.data([1:16],:),5000,30,5000) ;
stdhp = std(allhp,0,1) ;
dhp = diff(hp,2,2) ;
xc = x... |
load('Calib_Results_right.mat');
for ita = 1:22
eval(['rkk = omc_' num2str(ita),';']);
eval(['tkk = Tc_' num2str(ita),';']);
eval(['originx = x_' num2str(ita),';']);
[BX,BY,XR,YR]=LeastSqure55SC(X_1(1,:)',X_1(2,:)',1,originx(1,:)',originx(2,:)',0,1);%,0,125,125,150,150
% [BX,BY]=LeastSqure13SC(X_1(... |
%% MyMainScript
tic;
k1 = [0,1,0; 1,-4,1; 0,1,0];
k2 = [-1,-1,-1; -1,8,-1; -1,-1,-1];
Fk1 = fftshift(fft2(k1,201,201));
Fk2 = fftshift(fft2(k2,201,201));
lf_k1 = log(abs(Fk1)+1);
lf_k2 = log(abs(Fk2)+1);
fig1 = figure(1);
subplot(121); imshow(lf_k1,[-1 2]); colormap(jet); colorbar;
title('N,N-point DFT of k1');
subp... |
function ClusterFunc_CutOnBestProjection(self)
% PreCut Clusters - ClusterFunc_CutOnBestProjection
%
% Adds ability to cut differences between this cluster and all others by
% merging and limiting
MCC = self.getAssociatedCutter();
FeatureNames = cellfun(@(x)x.name, MCC.Features, 'UniformOutput', false);
[Selection,... |
%authors: Johannes Gätjen, Lorena Morton
%close all;
kappa = 6; %free parameter, change between 2 and 6
deltaT = 0.01;
maxT = 100;
time_vector = 0:deltaT:maxT;
Fmax = 40;
input = [-10; 10];
initial = [7; 11];
activity = repmat(initial, 1, length(time_vector));
connectionM = [-2 3; -3 2 ];
for t = 1:length(time_vecto... |
function spots = spot_finder_canny(filename)
%Finds spots using canny edge detection.
%% Setting Variables and Parsing Arguments
ss = imread(filename);
s = size(ss);
frames = length(imfinfo(filename));
J = zeros(s(1),s(2),frames,'uint16');
IMG = zeros(s(1),s(2),frames,'double');
spots = zeros(0,3);
movnm = [fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.