text stringlengths 8 6.12M |
|---|
function plotDef_vBOOabs(Setup, Results)
% Plot absolute defender velocity
c = Setup.PostOptions.c;
vBOO = Results.Defender.States.Vel;
vBOO_abs = vecnorm(vBOO);
Figname = 'Absolute Defender Velocity';
% Plot Interceptor
figure('Tag',Figname,'name', Figname,'Position', c.Pos_Groesse_SVGA);
plot(Results.Time, vBOO_a... |
function BuildDocs(dir)
if(nargin < 1)
dir = '**';
end
MTBfolder = fileparts(fileparts(which(mfilename)));
options.evalCode = false;
options.format = 'html';
options.outputDir = 'docs';
cd(MTBfolder);
d = rdir(fullfile(dir, filesep, '**.m'));
for i = 1:length(d)
publish(d(i).name, options);
end
e... |
function [N, idxs] = get_area(M, Start, Area)
E = [M.TRIV(:, [1, 2]); M.TRIV(:, [2, 3]); M.TRIV(:, [3, 1])];
Adj = sparse(E(:, 1), E(:, 2), 1, M.n, M.n);
Adj = double(Adj + Adj' > 0);
Adj(1:M.n+1:end) = 1;
f = zeros(M.n, 1);
f(Start) = 1;
N.Area = 0;
while N.Area < Area
f ... |
V_0T_m = 0;
V_0T_t = 0;
V_0T_h = 0;
% Hub diameter
D_h = D_t * lambda;
b = (D_t - D_h)/2 ;
D_m = (D_h + D_t)/2;
U_m = omega * D_m / 2;
c_IGV_t = c_IGV;
c_IGV_h = c_IGV; |
% Script to generate sensitivity maps
clear all
close all
disp('Running script..')
tic
%% First, load the images
images={'hand_daniel_l.png','hand_daniel_r.png','hand_paul_l.png','hand_paul_r.png','hand_reinco_l.png','hand_reinco_r.png','hand_thijs_l.png','hand_thijs_r.png'};
for i=1:length(images)
eval_image... |
function [hei a b g] = q4_check(heihei,c,d,h,e,f)
%Q4_CHECK Summary of this function goes here
% Detailed explanation goes here
if (length(find(c==e))==0)
a=[c e];
b=[d f];
g=[h f];
hei=[heihei 1];
else
a=c;
b=d;
g=h;
hei=heihei;
hei(find... |
function h = plot_gp_CV_rois_helper(fs, test_type, statistic, regressor_names, roi_names, null_value, cmap, significant_scale, regressors_to_compare, font_scale)
sem = @(x) std(x) / sqrt(length(x));
nROIs = size(fs, 1);
nregressors = size(fs, 2);
nsubjects = size(fs, 3);
if ~exist('significant_sca... |
function [gWB,trainPerf,trainN] = grad(net,data,hints)
% Copyright 2012 The MathWorks, Inc.
[gWB,trainPerf,trainN] = nnGPUOp.bg ...
(net,data.Pc,data.Pt,data.Ai,data.T,data.EW,{data.train.mask},...
data.Q,data.TS,hints);
|
function d = getgaussclocktriggers(N)
% Example
% N = 25;
% Bg = linspace(.53, .538, 30);
% Ext = linspace(29400, 29500, 30);
% [X, Y] = meshgrid(Bg, Inj);
%
% for i = 1:length(Bg)
% for j = 1:length(Ext)
% d = getgaussclocktriggers(N);
% InjMesh(i,j) = mean(d.InjTrigger);
% BumpMesh(i... |
function [RHA, RHB, coefH] = decomposeMH_TRG(parameter, ID)
partitionMHbyBondBond(ID) ;
if parameter.parallel == 1
svdParallel_RG(parameter) ;
else
svd_RG(parameter) ;
end
coefH = truncate_RG(parameter) ;
[RHA, RHB] = createR ; |
P=[2,31.91,265.58,36993;3,3.68,260.59,142893;5,1.08,254.49,208116;2,13.31,253.38,395326;1,8.34,237.504,96440];
T=[2 3 5 2 1];
[p1,minp,maxp,t1,mint,maxt]=premnmx(P,T);
net=newff(minmax(P),[1,1,1],{'tansig','tansig','purelin'},'trainlm');
net.trainParam.epochs = 5000;
net.trainParam.goal=0.0000001;
[net,tr]=train(... |
function [] = plot_growth_params(od, t, fit, varargin)
%%
args = parse_namevalue_pairs(struct('log', false), varargin);
R = 8;
C = 12;
clf;
axs = tile_area([8, 12], 'gap', 0.01);
i = 1;
if args.log
od = log2(od);
end
yl = [quantile(min(od),.01), quantile(max(od),.85)];
xl = [0, max(t)];
for ci = 1:12
for ri =... |
function [mocTop] = compute_moc_from_w ...
(vertVelocityTop, botDepth, ...
latCell,lonCell, areaCell,transport,mocLat,landMask)
% Compute moc streamfunction from vertical velocity
%
% Mark Petersen, MPAS-Ocean Team, LANL, May 2012
%
%%%%%%%%%% input arguments %%%%%%%%%
%
%%%%%%%%%% output arguments %%%%%%%... |
clear;close all;
%% 对比有无毒品在不同角度的能谱
nameSymbol_b = 'SEP23-P00-R8';
nameSymbol_s = 'SEP23-P24-1kg-R10';
nR = 5;
nSpecPerR = 64;
n2 = 8; % 合并相邻角度能谱至一圈多少个点
nCh = 12; % 能谱合并为多少道?
plotOrNot = 1;
%% 中子计数率校正
file_bg = ['CH0-',nameSymbol_b,'-step0.01MeV-nml.mat'];
file_bn = ['CH2-',nameSymbol_b,'.mat'];
load(file_bg);bg = sgnl... |
function oovs = findOOVS(region)
% Input: text candidate regiobn
% Output: number of out of vocabulary words
oovs = '00';
[m n] = size(region);
if (n == 0)
oovs = '999';
end
for i = 1:n
if (region(i) == 'O')
if (region(i + 1) == 'O')
if (region(i + 2) == 'V')
if (region(i ... |
function output = squarefilter(imsrc, r)
[height, width] = size(imsrc);
temp = zeros(height,width);
cum = cumsum(imsrc,2);
temp(:,1:r+1)=cum(:,1+r:2*r+1);
temp(:,r+2:width-r)=cum(:,2*r+2:width)-cum(:,1:width-2*r-1);
temp(:,width-r+1:width)=repmat(cum(:,width),1,r)-cum(:,width-2*r:width-r-1);
output = zeros(hei... |
classdef DecodeMetric2 < Decode2
properties % Leave public, as get methods in other langauges are public
biasMI
biasClustMat
biasDistMat
end
methods (Access='public')
function self = DecodeMetric2(srN, inPart)
% population decoding using vector sp... |
function p = norm_path(p)
% P = NORM_PATH(P) Normalize path P to unix style. '\' are replaced to '/'.
% This is a need of HTK.
p = strrep(p, '\', '/'); |
image1 = imread('aceeeagle3.png');
image2 = imread('aceeeagle2.png');
tone = [1, 2, 3, 2, 1, 2, 5, 1, -7, 1, 4, 3];
rhythms = [1, 1, 2, 1, 1, 1, 3, 1, 0.5, 1, 1, 2];
y = [];
for i = 1:12
yx = gen_wave(tone(i), rhythms(i));
y = cat(2, y, yx);
end
flag = 0;
index=1;
for i = 1:12
rep = tone(i) + 1;
if(tone... |
function doCoOccurencesHisto
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2006-2007 Jean-Francois Lalonde
% Carnegie Mellon University
% Do not distribute
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
addpath ../database;
addpath ../../3rd_party/... |
%% Perform Barnes-Hut t-SNE on human gene data
clear variables
close all
addpath('../bh-tsne');
%% Load data (currently for a single brain)
id = '15697';
datadir = ['/home/mvandegiessen/data/tSNE_ABA/rawData_25Feb2014/normalized_microarray_donor' id '/'];
expressionlevels = load([datadir 'MicroarrayExpression']);
nge... |
function varargout = getblockpos(image_size,block_size,overlap,offset)
%% Parse input
if nargin < 3
overlap = 0 ;
end
image_size = image_size(:);
if length(image_size) == 1
n_dims = 1 ;
else
n_dims = length(image_size);
end
if length(block_size) == 1
... |
% Returns: the index of the first component of vector that is greater than or
% equal to val, unless val == vector(1), in which case 2 is returned.
% Returns -1 if val is greater than or smaller than all components of vector.
% PRE: vector must be non-empty and ordered ascending.
% PRE: val must be in the interval [vec... |
x = [];
pow10 = 7;
Ey = [];
Ez = [];
%set alpha to
%
% 1 for unirand in [1,2]
% 2 for unirand in [0,1]
% 3 for unirand in [-1,1]
alpha = 3;
if alpha == 1
% Unirand in [1,2]
for i = 1:pow10
x(i) = 10^i;
y = rand(1,x(i))+1;
z = 1./(rand(1,x(i))+1);
Ey(i) = 1.0/mean... |
% prefix = prefix before the number
% use sprintf('05d%','number') to match the '00015' thing
% N_file = number of files in that directory
% End atom number = 873
function result = getcoordinate(prefix, atom, N_file)
namestring = [prefix '%05d.pdb'];
result(N_file,4) = 0;
h = waitbar(0,'Getting coordinate...')... |
function aria = trapez(a, b, n)
%x = 0;
x = (b - a) / n;
aria = 0;
for i = 1:n - 1
st = a;
dr = a + x;
%p(i) = a;
h = dr - st;
aria = aria + ( (fun(st) + fun(dr)) * h ) / 2;
a = a + x;
end
end
|
%% 0 - Parámetros del tanque
tmuestra = 0.5;
Area = 1;
alpha = 1;
T1 = 90;
T2 = 10;
Te = 45;
Kp = .01;
K1 = 1;
K2 = K1;
tau1 = 5;
tau2 = 4;
tdelay1 = 2 * tmuestra;
tdelay2 = tmuestra;
tdelayQ = tmuestra;
% save ParametrosTanque tmuestra alpha T1 T2 Te Kp K1 K2 tau1 tau2 ...
% tdelay1 tdelay2 tdelayQ |
close all;
clear;
clc;
pict;
patterns = [p1;p2;p3];
w = train(patterns);
noise = [10:100:1000, 1024];
i=2;
rng(1);
subplot(3,4,1);
vis(p1);
title('Original')
for n = noise
p1dist = flip(p1, n);
[p1distr, iter, error] = recall_update(w, p1dist, patterns);
subplot(3,4,i);
vis(p1distr);
title(spri... |
function [ P ] = extract_patches( I, Np, win ) %提取图像块
% get image dimensions(尺寸)
width = size( I, 2 );
height = size( I, 1 );
% window offset from central pixel, patch will be win pixels either side of
% the central pixel. pwidth is the width of the patch, in pixels and N
% is the number of p... |
function [ fh ] = tagfig( tag )
%TAGFIG looks for a figure with a given tag, creates it if it doesn't
%exist, or gives it focus if it does exist -adam@adamcsnyder.com
%03Oct2014
if ~isempty(findobj('type','figure','tag',tag)),
fh = figure(findobj('type','figure','tag',tag));
else
fh = f... |
function output1 = thresh2kinetics(thresh_data)
data_2 = thresh_data;
% Need the X values for kinetics
temp_indexed_kinetics=data_2(1:end-1,:);
temp_kinetics =[];
temp_kinetics = [temp_indexed_kinetics(1,:),temp_indexed_kinetics(1,2)];
for i=2:size(temp_indexed_kinetics,1)
temp_kinetics = [temp_kinetics; [temp_index... |
function [ SE ] = shannonEntropy( Phase, nBins, tWindows, normSE, targets )
%SHANNOPNENTROPY Function that calculates the shannon entropy for each pair
%of nodes
%
% Input Parameters:
%
% Phase - 2-dim array, with phase signal over time (2.dim)
% nBins - number of bins to use to discretize the phas... |
function rtn = getHDPC(H, K, S, b)
MT = getMT(K, b);
g = getGamma(K, S, b);
rtn = gf(MT*g, b); |
%
% Script para probar la matrix de Fourier
%
n = 10;
a = 0;
b = 2*pi;
[F, x_i] = fourier_matrix(n, a, b);
f_val = exp(1i*x_i) - 15 * exp(-10i*x_i) ;
my_fft = F*f_val;
%
% El numero total de puntos es 2*n, asi que la normalizacion de matlab
% requiere dividir por 2n
%
fft_matlab = fft(f_val) / (2*n);
norm(my_fft... |
function result = sphereFitLSQ1_uncR(data,dummyVal1)
% This function takes 3 dimensional data of a sphere in a Cartesian
% coordinate system and returns the paramters of a sphere (Center, radius
% and residuals
%
%The input data is in the form of Nx3 matrix
%The output is a structure with the sphere parameters.
... |
% Build action natrix for variable "actMvar" given coefficient matrix M
% (GBsolver subroutine)
% by Martin Bujnak, mar2008
function [amrows amcols gjcols aidx] = gbs_BuildActionMatrix(cfg, M, algB, amLT, amLTall, algBidx, actMvar)
% extract action matrix for variable "actMvar"
cols = size(M, 2);
al... |
function [ stats,pathindex, ptindex,cubes,M ] = IntDimPCtopdown5( data,SVDbound,idimbound, dim, maxscale,K, stats,pathindex, ptindex,cubes, currentcube,varthresh,M )
%The difference between this version 5 and version 3 is an additional
%input parameter SVDbound and an additional input parameter idimbound.
%The use of t... |
function IMDB()
% Execute the script to import the file and assign it to a table variable
movieValue = importCsv();
% For each row on the file, we make an API request
for i = 1:1:height(movieValue)
%for i = 1:1:10
% We obtain only the year of the second cell
cell = table2a... |
% AMlarge.m: large carrier AM demodulated with "envelope"
pkg load signal
time=0.33; Ts=1/10000; % sampling interval & time
t=0:Ts:time; lent=length(t); % define a time vector
fm=20; fc=1000;
phase = [0.1, 0.5, pi/3, pi/2, pi];
g = [10, -10, 100, -100, 250, -250, 900, -900];
for idx = 1:le... |
function [ st,en ] = valueindex(y,x,fm,df1)
y=abs(y);
ymax=find(y == max(y));
st=ymax(2)-floor(1*floor((fm/df1)));
en=ymax(2)+floor(1*floor((fm/df1)));
end
|
classdef MixedLogitDemand2 < DemandEstimate
% Random Coefficient demand class
% Simulation of shares and estimation of parameters beta and rc_sigma.
% $Id: MixedLogitDemand.m 118 2015-05-26 10:34:48Z d3687-mb $
properties
alpha % beta defined in DemandEstimate
rc_s... |
% Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%Generate the m by n system matrix for the Shaw problem
%
% G = shaw_G(n,m)
%
%
% m and n must be even.
% Reference: C. B. Shaw, Jr., "Improvements of the resolution of
% an instrument by numerical solution of an inte... |
close,clear,clc
n = 0:5;
x = cos(pi*n/3);
figure(1)
stem(n , x)
title('discrete signal')
N = length(x);
Nc = N;
k = 0:Nc-1;
c = zeros(1,length(k));
for i1=1:length(k)
for i2=1:length(x)
c(i1) = c(i1)+1/N*x(i2)*exp(-1i*2*pi*k(i1)*n(i2)/N);
end
end
figure(2)
subplot(211)
stem(... |
% This script experiments with learning
clear all
dt = .0002;
x = load('signals_figure4.mat');
signal = x.signals(2,:);
[spikes, cov] = genUncorrelated(500, .3, dt, 30, [1 0 0]);
[statspikes, cov] = genUncorrelated(20, 10, dt, 200, [0 1 0], struct('SD', .001, 'meanSD', .002));
mean(cov)
std(cov)
iterations = 1000;
... |
function pstr = mixer2pan(mixer, varargin)
%% DESCRIPTION:
%
% Function to convert a DxP mixer to a pan string used by the pan
% parameter in FFmpeg.
%
% INPUT:
%
% mixer: DxP mixer, where D is the number of data channels in the
% existing file (e.g., 2 channels in a stereo MP4) and P is the
% ... |
plt_vars.plt_lim = [-0.2 3];
%plt_vars.plt_lim_R = [-0.5 1];
plt_vars.x_step_sz = 0.2;
plt_vars.legend = 1;
%plt_vars.legend_loc_S = 'northwest';
%plt_vars.legend_loc_R = 'northeast';
plt_vars.legend_loc = 'northeast';
plt_vars.clim_perc = [5 95];
plt_vars.ylim_fudge = 0.1;
plt_vars.errbar_alpha = 0.5;
%plt_v... |
function x = Markov(P,n,states)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
x = zeros(1,n);
x(1) = states(1);
state = 1;
for i=2:n
random = rand(1);
j = 1;
while(random > 0)
random = random - P(state,j);
j = j + 1;
end
j = j - 1;
state = j;
... |
function [accuracy] = testing(probes_weights, gallery_weights)
%this function is to get the PCA project of data for different no of PCs,
%and test the recognition rate for different no of PCs used for projections
result = zeros(size(probes_weights,2),1);
for numofPCs = 10:10:100
for i = 1:size(probes_weights... |
clc;
close all;
clear all;
Parent1 = [round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()) ];
Parent2 = [round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand()), round(rand())... |
function [ RPY ] = SO3toEulerAngles( RotMat )
% [ RPY ] = SO3toEulerAngles( RotationMatrix )
% Assumes R_ypr = ( R_y * R_p * R_r )
MATRIX_MATCH_TOLERANCE = 1e-4;
if ( sum( size(RotMat) == [3,3] ) ~= 2 )
error('SO3toEulerAngles - RotationMatrix must be [3x3]');
end
roll = atan2( RotMat(3,2), RotMat(3,3) );
yaw = a... |
%% Initialization
clear ; close all; clc
load('covMatrix.mat');
load('knnData.mat');
k = 100;
m = size(X,1);
mtest = size(Xtest,1);
invCovMatrix = pinv(cv);
dists = zeros(m,1);
Xtemp = zeros(size(X));
neighbors = zeros(mtest,k);
#performance on test data
for i = 1:mtest,
Xtemp = repmat(Xtest(i,:),m,1) - X;
[d1,... |
function indice = encuentra_indice_minimo ( vector )
i=1;
while i<=length(vector)
if vector(i) == min(vector)
indice = i;
end
i=i+1;
end |
function w = twist(R)
norm_w = acos((trace(R)-1)/2),
w = (norm_w / (2* sin(norm_w)))*[R(3,2)-R(3,2), R(1,3)- R(3,1), R(2,1)- R(1,2)];
end |
clear;
model=Model(1,0.3,200,150); %建立平均半径1m,半径变化范围0.3m,箱子宽度200m,箱子高度150m的模型。
majorCycle=300;
minorCycle=1000;
model.gravitySedimentation(majorCycle,minorCycle); %重力沉积,平衡300*1000次,每平衡1000次显示一次进度。
view=View(model);
view.plot('r'); %绘图,显示单元半径。
save('model/slope_model1.mat','model'); %保存模型文件。
pause;
slopetxt=load('slope... |
function sgm=GenSgmOriginalSize(s_prj,s_bkg,s_config)
%sgm=GenSgmOriginalSize(s_prj,s_bkg,s_config)
recon_para=jsondecodewithcomment(s_config);
img_bkg=readHydraEviFromDirect(s_bkg,recon_para.BkgNum,recon_para.BeginFrameIdx);
img_bkg=mean(img_bkg,3);
img_bkg=DeadPixelCorrection(img_bkg);
img_bkg=imresize(img_bkg(:,3:... |
function [spikes,thr,index, excluded] = dr_amp_detect_wcdrdg(handles)
% Detect spikes with amplitude thresholding. Uses median estimation.
% Detection is done with filters set by fmin_detect and fmax_detect. Spikes
% are stored for sorting using fmin_sort and fmax_sort. This trick can
% eliminate noise in the detec... |
close all
clear all
clc
load("2020-07-08-15-15-54_2T3MWRFVXLW056972_CAN_Messages.mat")
%% filter available data
valid_accel = accelx;
valid_relative_dist = lead_distance;
valid_relative_spd = relative_vel;
valid_speed = speed/3.6;
valid_relative_dist(valid_relative_dist>150) = nan;
%% scenarios accodring to the vi... |
function omega_en_n = transportrate(lat, Vn, Ve, h)
% transportrate: calculates the transport rate in the navigation frame.
h = abs(h);
if (isa(Vn,'single'))
[RM,RN] = radius(lat, 'single');
omega_en_n(1,1) = single(Ve /(RN + h)); % North
omega_en_n(2,1) = single(-(Vn /(R... |
clearvars; close all; clc
cm = 100;
h=figure('WindowState','normal');
for delta_reply = [1e-6 10e-6 100e-6]
ea_eb = (0:20)/1e6; %ppm
tau_err = delta_reply*ea_eb/4;
semilogy(ea_eb*1e6,cm*UWB_dis_tof(tau_err),...
'DisplayName',['\Delta_{reply} = ' num2str(delta_reply) ' [s]'],...
'Li... |
%Phase 1 Calculation
V=[0:1:50 51 51.19]';
for i=1:53
x(i,1)=(V(i,1))^(2);
y(i,1)=((49344)/(314511-(20.27*(V(i,1))^(2))));
end
plot(x,y,'b') %PLOT OF PHASE 1
for i=1:52
dist0=0
distx(i,1)=((y(i+1,1)+y(i,1))/(2))*(x(i+1,1)-x(i,1));
end
PHASE1=sum(distx(:,1));
%Phase 1 Distance =... |
function [phi, dphidx] = MLS_ShapeFunction_2nd_1D(pt, all_node, di)
A = zeros(3,3);
dAdx = zeros(3,3);
% $$$ m = size(all_node, 2);
% $$$ node = [];
% $$$ for I = 1 : m
% $$$ if abs(all_node(I) - pt) <= di
% $$$ node = [node all_node(I)];
% $$$ end
% $$$ end
node ... |
function IsingZ
import brml.*
N=10;
% form the potentials for each pair of neighbouring variables:
for x=1:2
for y=1:2
isingtable(x,y)=exp(1*(x==y));
end
end
S = reshape(1:N*N,N,N);
c=0;
for s1=1:N*N
[i1 j1]=find(S==s1);
for s2=s1+1:N*N
[i2 j2]=find(S==s2);
if (j1==j2)&(abs(i1-i... |
function logger(from,exptId,message)
getPaths;
tstamp = datestr(now,'yymmddhhMMss');
str = [tstamp ': ' from ': ' message '\n'];
fileID = fopen([logPath '/' exptId '.txt'],'a');
fprintf(fileID,str);
fclose(fileID);
end
|
function reloadPy()
%RELOADPY Reloads Python for use after Python code changes
warning('off','MATLAB:ClassInstanceExists')
clear classes
mod = py.importlib.import_module('mhkit');
py.importlib.reload(mod);
end
|
%
% parIO
%
%-> create
%
disp('--------------------------------------------------');
par = digitalio('parallel','LPT1');
disp(par);
%
%-> par information
%
disp('--------------------------------------------------');
info = daqhwinfo(par);
disp(info);
%
%-> each port information
%
disp('----------... |
function y_out = nn_spatialConvolutionMap_Matlab_slow(y, bias, weight, dH, dW, connTable)
[kH, kW, nOutputPlanes] = size(weight);
[h,w,nInputPlanes] = size(y);
h_out = floor( (h-kH) / dH) +1; %% check this
w_out = floor( (w-kW) / dW) +1; %% check this
y_out = zeros(h_out, w_out, n... |
function nSEC=counter_ROPRO(para)
format long;
q_ls=1;
c_ls=.1;
fai=para(5);
q_hs=q_ls*(1-fai)/fai;
c_hs=35;
c_os=73.07/100;
y_d_1=para(1);
y_f_1=para(2);
A=1.74;%Lm-2h-1bar-1
B=0.16;%Lm-2h-1bar-1
S=307*10^-6;%m
Am=.4;
y=para(3);
q_d_final=0;
q_f_fin... |
[XX_small ZZ_small]=meshgrid(scale_X,scale_Z);
X_scale_data=reshape(XX_small,size_X*size_Z,1);
Z_scale_data=reshape(ZZ_small,size_X*size_Z,1);
XZ_mesh=[X_scale_data Z_scale_data];
XZ_mesh_dtri=DelaunayTri(XZ_mesh);
Bphi_XZsmall_map=interp2(X_scale,Z_scale,Bphi_XZ_map',scale_X,scale_Z')';
... |
%% 利用模糊c—均值聚类方法(FCM)将
function [center,ClassN3]=xMyCluster2(in,gabout)
%% Cluster the data coordinates
[rows,cols] = size(gabout);
%% Eyes location on horizon
xleft0=fix(cols/2);%略去小数,往中间
%% eyes location on Y axis,找ClassN个Y轴的坐标
for i=1:floor(rows)%往小(左)靠????
%colsuml(i)=sum(gabout(i,1:xlr_min));
colsuml(i)=s... |
%Finite-length sinusoid generator
function [sinusoid, indicies] = flsinusoid(A, omega, rho, ni, nf)
indicies = [ni:nf];
sinusoid = indicies;
sinusoid = A*sin(omega*sinusoid + rho);
end |
function bp = filtfft(s,arg2,arg3,arg4)
% FFT calculation
% log10bp = bandpower(X, Fs, bands, smoothing, mode)
%
% INPUT:
% X raw data, one channel per column
% Fs sampling rate
% bands each row has two elements indicating the lower and upper frequency
% default va... |
function vdot = singleneuron(t, v)
%how do I get v_eq in this system before computing?
v_eq(1) = -24;
vj = 0;
%compute v_th(i)
v_th(1) = v_eq(1);
%compute phi(i)
phi(1) = 1/(1+exp(-params.beta.val*(v(1)-v_th(1))));
%compute sdot(i)
vdot(2) = params.ar.val.*phi(1).*(1-v(2))-params.ad.val.*v(2);
%compute Ig(i)
%su... |
function [mark_points, mark_points_img] = FuncIncisionAndMarksPointDetect(img, matching_points, template_circle, is_debug, incision_index, img_type)
overlap_pixel = 300;
if(incision_index == 1)
x_incision_start = 1;
x_incision_stop = matching_points(4, 2, incision_index) + overlap_pixel;
elsei... |
writerObj = VideoWriter('../plots/odom_000.avi');
open(writerObj);
for k=1:330
filename = sprintf('../plots/odom_%03d.png',k);
thisimage = imread(filename);
writeVideo(writerObj, thisimage);
end
close(writerObj); |
function [reven, rodd] = separate_by_two(A)
reven = A(mod(A,2) == 0)';
rodd = A(mod(A,2) == 1)';
end |
function [ path ] = getParentDirectory( level )
path = pwd
parts = strsplit(path,'/');
parts = {parts{1:end-level}};
path = '';
for i = 1:size(parts,2)
if isequal(parts{i},'')
continue;
end
path = strcat(path,'/');
path = strcat(path,parts{i});
end
path
end
|
%%
% SG1 is at 193 MHz and 16 dBm
% Use SG2 with 3 dBm and 193 MHz + 50 kHz;
%%
f_SG1 = 193e6;
df = 50e3;
f_SG2 = f_SG1 + df;
P_SG2 = 3;
sg.freq(f_SG2);
sg.pwr(P_SG2);
%% setup the VNA
znb2.tr(1, 'S11');
znb2.power(-29);
znb2.frange(1.843e9);
% znb2.frange(1.8445e9);
%% set VNA and FSW c... |
clc, clear all;
disp('El ejemplo ejecuta el archivo Ejemplo_01_simulink')
[num, den] = linmod('Ejemplo_01_simulink');
G = tf(num, den) |
clear all; close all; clc;
addpath('./toolbox');
% load feature trajectories
load('./data/monkey.mat');
% define some variables
dtrng = 40:0.5:60;
arng = 0.8:0.02:1.2;
projmodel = 'affine';
a_con = []; % set to a value to constrain a
% offset W1 by 50 frames
W1 = W1(51:end-50,:);
% run synchronization sc... |
function [cl] = cbsymmetric(x) % symmetric colorbar
colorbar
if nargin == 1
caxis([-x x]);
else
cl = [-max(abs(caxis)) max(abs(caxis))];
caxis(cl);
end
end
|
clear all;close all
I = imread('rose.jpg');
OR = pi/2;SF=0.1;
G=gabor_filter(OR,SF,3,10,41);
figure
subplot(1,3,1);imagesc(G);axis square; colorbar; title('Gabor function')
subplot(1,3,2); imagesc(I); title('original image');
subplot(1,3,3); imagesc(conv2mirrored(double(I),G));
colormap(bone); title(['Convolved image O... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 2000;
params.Gridjob.jobname = 'optim';
params.Gridjob.initRandStreamWithJobid = false;
params.Gridjob.continue = false;
params.Gridjob.requiredThreads = '3';
params.Gridjob.queue = [];%'nbp.q';
params.Gridjob.wc_host = '';
par... |
function [out] = checkImage(im1,im2)
img1 = imread(im1);
img2 = imread(im2);
if any(~(size(img1)==size(img2)))
out = 'The images have different dimensions.';
elseif img1==img2
out = 'The images are the same.';
else
out = 'The RGB values are different.';
mb = (img1~=img2);
r = mb(:,:,... |
function h = drawPlane3d(plane, varargin)
%DRAWPLANE3D Draw a plane clipped by the current axes.
%
% drawPlane3d(PLANE) draws a plane of the format:
% [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2]
%
% drawPlane3d(..., 'PropertyName', PropertyValue,...)
% Sets the value of the specified patch property. Multipl... |
function save_new_display_algos_config_callback(~,~,main_figure,name)
[answer,cancel]=input_dlg_perso(main_figure,'Enter new settings name',{'New settings name'},...
{'%s'},{''});
if cancel
return;
end
new_name=answer{1};
algo_panels = getappdata(main_figure,'Algo_panels');
if isempty(algo_panels)
return... |
function [] = ellipse(xc,yc,a,b,Q,style)
%(xc,yc) Center of ellip
% (a,b) Major and minor radius
% Q - rotation matrix Orientation (degree)
num = 20; % #points -> smoothness
theta = linspace(0,2*pi,num);
p(1,:) = a*cos(theta);
p(2,:) = b*sin(theta);
p = Q*p;
p(1,:) = p(1,:) + xc;
p(2,:) = p(2,... |
function [ ber, receivedSymbols ] = berCalc2( bits, symbolVector, compareVector, N0, context, Eb )
%BERCALC2 Summary of this function goes here
% context: define o canal e o equalizador de acordo com os itens pedidos
% no roteiro. context pode valer 0, 1, 2, 3. 0 para AWGN, 1 para o item ii, 2 para o item iii, 3... |
% this script generates all the required transforms for the kitti and
% shrimp dataset (currently wont do the camera as I am tweaking it)
%% user set variables
%path to data
%dataPath = 'C:\Users\Zachary\Documents\Datasets\IJRR-Dataset-1\'; dataset = 'Ford';
%dataPath = 'C:\Users\Zachary\Documents\Datasets\Shrimp\hig... |
clc;
clear;
%% Read the data from file and split into input and output for the encoder
%fulldata = importdata('testProb1_data_1.dat');
fulldata = importdata('train_data/SP_data_sd_5_0.dat');
inputs = fulldata(1:2:end, :)';
targets = fulldata(2:2:end, :)';
clearvars fulldata;
%% Create the deep network
hidden_size = ... |
datapoints = 40;
ds = zeros(length(datapoints),1);
for i = 2:datapoints
ds(i) = 2*i - 1;
end
seconds = zeros(length(ds),1);
% secondsmu = zeros(length(ds),1);
secondsimp = zeros(length(ds),1);
secondsimp2 = zeros(length(ds),1);
firsts = zeros(length(ds),1);
quos = zeros(length(ds),1);
firstsums = zeros(length(ds)... |
function [ outputImg ] = copyPixel( destImg, sourceImg, destXY, sourceXY )
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
outputImg = destImg;
[destR, destC, channels] = size(destImg);
[sourceR, sourceC, ~] = size(sourceImg);
destIndex = sub2ind([destR, destC], destXY(:, 2), destXY(:,... |
function [beg_ind, end_ind] = crop_signature(sb)
% fonction qui elimine lez zones superflues se trouvant a gauche et a
% droite de la region d'interet
count = 0;
beg_ind = 1;
for i = 1:length(sb)
if (count < 2)
if (sb(i)==1 && sb(i+1)==0)
count = count+1;
end... |
function var_exp = CalcVarianceExplained(D, z, base_var)
if (iscell(z))
bins = z;
else
z = z(:)';
[sorted_z, sorted_i] = sort(z);
bins = mat2cell(sorted_i, 1, diff(find(diff([0 sorted_z (max(z)+1)]))));
end
D = cast(D,'double');
if (nargin < 3)
base_var = CalcBaseVar(D);
end
if (CheckSymApprox(D)... |
clear; clc;
N = 10^5; % Total no of of bits per simulation per SNR_dB
bitstrm1 = []; %initialisation of matrices
bitstrm2 = [];
for i = 1:N
bitstrm1 = [bitstrm1 (-1+2*round(rand(1,1)))]; %creating random data for INPHASE component
bitstrm2 = [bitstrm2 (-1+2*round(... |
function f=radon_usfftadj(R,theta,epsilon,filter)
N=size(R,1);
%polar grid
rho=(-N/2:N/2-1)'/N;
x=rho*cos(theta);
y=rho*sin(theta);
%parameters for usfft
mu=-log(epsilon)/(2*N^2);
Te=1/pi*sqrt(-mu*log(epsilon)+(mu*N)^2/4);
M=ceil(2*N*Te);
%FFT1D
F=fftshift(fft(ifftshift(R)))/N;
if(filter==1)%paganin filter
F=F.*abs... |
function out=image_enhancement(database_in);
% Enhancing face images in the database the first time we run the program.
persistent image_enhanced;
persistent dataset_enhanced;
if(isempty(image_enhanced))
disp('Enhancing face images in the database...');
tic;
dataset=zeros(10304,400);
for i=1:size(datab... |
clc;
clear all;
maf = 0:0.01:0.5;
x_i = 0:0.01:1;
%{
u_gain_part1 = maf;
u_gain_part2 = maf;
u_gain_part3 = x_i;
u_gain_part4 = x_i;
u_gain_part5 = zeros([length(maf) length(x_i)]);
u_gain_part6 = zeros([length(maf) length(x_i)]);
%}
[X, Y] = meshgrid(maf, x_i);
u_gain_part1 = 1-X.^2.+X;
u_gain_part2 = ex... |
function [R0, T0, tmpError] = ExtensiveRT(MovData, RefData, params )
if nargin == 0
clc; close all;
load ../../StanfordData/Bunny
SelIdx = [2 3];
CoarseRes = 0.01;
pcData0 = bunny{SelIdx(1)}';
R = eul2rotm( deg2rad( [30.0 0.0 0.0] ) );
T = [0.5 0.0 0.0];
pcData1 = Loc2Glo( pcDa... |
function mcmc_prior_included( trait, param_init, parameter_update, fit_type, varargin )
% back to the original mcmc version, taking prior into account
mcmc_version = 'prior included';
% input parser
p = inputParser;
addRequired(p,'trait',@istable);
addRequired(p,'param_init',@isstruct);
addRequired(p,'parameter_upd... |
function C = adj2cluster_bf(A)
% http://raphael.candelier.fr/?blog=Adj2cluster
% Symmetrize adjacency matrix
S = A + A';
% Initialization
C = {};
I = 1:size(S,1);
% The main loop
while ~isempty(I)
C{end+1} = [];
J = I(1);
while ~isempty(J)
C{end}(end+1) = J(1);
J = setdiff(union(J, find(S(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.