text stringlengths 8 6.12M |
|---|
function timevp_visualization(csvfile_list, vis_args)
if isfield(vis_args, 'windows')
windows = vis_args.windows;
is_multi_rows = true;
num_windows = size(windows, 1);
vis_args.ForceZero = true;
vis_args.time_ref = windows(:,1);
windows_dur = windows(:,2) - windows(:,1);
dur_min = min(... |
function [A, z] = normalize(A, dim)
% NORMALIZE Make the entries of a (multidimensional) array sum to 1
% [A, z] = normalize(A) normalize the whole array, where z is the normalizing constant
% [A, z] = normalize(A, dim)
% If dim is specified, we normalise the specified dimension only.
% dim=1 means each column sums to ... |
classdef VREPSimScene < handle
% VREPSim: is a communications object with the V-REP simulator
% This class handles the interface to the simulator and
% low-level object handle operations
%
% A VREP object holds all information related to
% the state of a connection to an instance o... |
function generateModels(features,log2c,log2g,p)
%% This function takes as input features (like gist) for images and builds
%% an SVM based on the C and g values whose logarithms are passed as arguments.
%% p is the ratio of training to testing images. Usually it is 0.7
% load '../matfiles/kernel.mat';
% load '../m... |
%PAM_LLR_MEX Compute LLRs for PAM
% Use this function to compute log-likelihood-ratios
% for M-PAM constellations assuming an AWGN channel.
%
% Usage: pam_llr_mex(C, sigma2, y, Pk)
% C := Real constellation in Gray-mapping order
% sigma2:= Noise variance per each constellation point
% y := Re... |
function gama = FuzzyDependencyDegree(indI,Feature,cls)
% DependencyDegree 返回D对C的依赖度gama
% Input: Name description type
% U 论域 array
% C 条件属性 array
% D 决策属性 array
% Output: Name description tpye
% g... |
h1=plot(result,'r*-');
set(h1,'LineWidth',2.5)
hold on
h2=plot(result1,'bo-');
set(h2,'LineWidth',2.5)
hold on
h3=plot(result2,'g<-');
set(h3,'LineWidth',2.5)
hold on
T2013=xlsread('Input.xlsx','sheet2','A1:A31');
h4=plot(T2013,'r-');
set(h4,'LineWidth',2.5)
% hold on
% plot(CCI(1:252),'b--')
hold off
le... |
% function does watermark coding
function [imgOut, mask] = doWmCoding(imgOriginal, imgWM, SNR, strPathOut)
figure, imshow(uint8(imgOriginal), []);
title('Original image');
imwrite(uint8(imgOriginal), strcat(strPathOut, 'img_original.jpg'));
imgWM = double(rgb2gray(imgWM));
figure, imshow(uint8(imgWM), []);
title('Wat... |
function Plot_DSOS_compare(d1, d2, roin, types)
%比較する condition で表示を揃えて DSOS properties を plot
for roi = roin
[x1, y1] = set_dFF_s_each(d1, roi);
[x2, y2] = set_dFF_s_each(d2, roi);
%DS, OS, Nonselective, Ambiguos
dir_vec = d1.imgobj.directions;
R_boot_med1 = d1.imgobj.dFF_boot_med(... |
function observations = hmmArun(preid, postid)
observations = getObservationSeq(preid, postid);
end
function observations = getObservationSeq(preid, postid)
observationSeq = [];
observations = [];
for i=1:size(preid,2)
observationSeq = [observationSeq, preid(i)];
observat... |
%------------------------------------------------------------------------------------------
% amip_trends_ncout.m
%
% write output to a netcdf file for use in ncl
% this netcdf file doesn't have to work as input for gfdl model
%
% levi silvers Aug 2016
%---------------------------... |
#! /bin/octave
% image template matching minimizing absolute difference
pkg load image
args = argv(); % command line params into a cell array
if nargin > 1
tnam = args{1}; % first parameter the template image
inam = args{2}; % second parameter the image
else
tnam = "mona_temp4.png";
inam = "monal... |
function info = tag()
info.nametag = '1D_controllers';
info.description = 'Generate a series of controllers to handle the holes.';
% Define how to execute the example
info.run = 'initial;';
% Define how to execute the example in a fast way, by using abstr. and
% cont saved previously.
info.f... |
function [data_stim] = Extract_StimData(data, descriptor)
data_stim = [];
for i = 1:length(data)
data_i = data{i};
if isfield(data_i, 'Stimuli') && isfield(data_i.Stimuli, 'short_description') && strcmp(data_i.Stimuli.short_description, descriptor)
data_stim = [data_stim {data_i}];
end
end
if isem... |
function mvdr()
% Define hyper-parameters
chanlist=[1:8]; % number of microphone array
pow_thresh=-20; % threshold in dB below which a microphone is considered to fail
wlen = 1024; % STFT window length
regul=1e-3; % MVDR regularization factor
cmin=6400; % minimum context duration (400 ms)
cmax=12800; % maximum context... |
algo_id = 1;
%{
train=load('data/train/conv_11_0');
valid=load('data/train/conv_11_1');
test=load('data/test/conv_11_2');
%}
%algo_id:
% 1: malik
f_train = U_conv_feat(train,algo_id);
ww = (f_train')\train.mat_y';
save(['B1_' num2str(algo_id)],'ww')
f_valid = U_conv_feat(valid,algo_id);
f_test = U_conv_feat(test,algo_... |
function [xRes,SRes,yRes,ARes,MRes,rGridRes,kGridRes,rkGridRes,F,FH,fail]=downsampleOperators(l,x,S,y,A,M,gibbsRing,fo,gpuIn)
%DOWNSAMPLEOPERATORS Spatially downsamples the aligned reconstruction operators
% [XRES,SRES,yRES,ARES,MRES,RGRIDRES,KGRIDRES,RKGRIDRES]=DOWNSAMPLEOPERATORS(L,X,S,Y,A,M,RGRID,KGRID,RKGRID,{... |
%% Input images
dset_dir = fullfile(setup_data.DATA_DIR, 'iCubWorldUltimate_centroid256_disp_finaltree');
%dset_dir = fullfile(DATA_DIR, 'iCubWorldUltimate_centroid384_disp_finaltree');
%dset_dir = fullfile(DATA_DIR, 'iCubWorldUltimate_bb60_disp_finaltree');
%dset_dir = fullfile(DATA_DIR, 'iCubWorldUltimate_bb30_disp_... |
function PROC_DBToNewFeature_CleanUpFileFractions(DBname,NewLabel);
% function PROC_DBToNewFeature_CleanUpFileFractions(DBname);
%
if(nargin > 1)
[pathname,filename,extension] = fileparts(DBname);
DBname = fullfile(pathname,[filename,'_',NewLabel,extension]);
end
nparts = length(dir([DBname,'part_*of*.mat']))
for... |
for i=1:fn
Sp = abs(fft(y(:,i))); % FFT变换取幅值
Sp = Sp(1:wlen/2+1); % 只取正频率部分
Ep=Sp.*Sp; % 求出能量
prob = Ep/(sum(Ep)); % 计算每条谱线的概率密度
H(i) = -sum(prob.*log(prob+eps)); % 计算谱熵
end
Enm=multimidfilter(H,10); % 平滑处理
Me=min(Enm); ... |
% Draw_Station
% Input: fig_id
% The figure id of the window you want to overly
% Input: Station
% The data matrix of Station
function Draw_Station(fig_id,Station)
figure(fig_id);
for i=1:length(Station)
if Station(i,3)==0
plot(Station(i,1),Station(i,2),'rx');
else
plot(Station(i,... |
%Cargar
%Cargo resultados clasificacion
matrix=cell(3,1);
load('clasificacionF.mat');
matrix{1}=clasifyf;
load('clasificacionF2.mat');
matrix{2}=clasifyf;
load('clasificacionF3.mat');
matrix{3}=clasifyf;
%Uno clasificaciones
matf=cell2mat(matrix);
%Me guiare para la etiqueta como la moda de los resultados de predic... |
function newTracklets = extendTracks( tracklets, imageStack, ~, ~)
windowSize = [6 6]; windowSearchSize = 4;
distanceThreshold = 3; intensityThreshold = .5; angleThreshold = .7;
% Extends the tracks obtained from TrackMate using correlation tracker.
[T,~,N] = size(tracklets);
newTracklets = tracklets;
for n=1:N
... |
function [model,hs,ps] = learnClassifier(X,Y)
% num_1s = sum(Y==1);
% num_2s = sum(Y==2);
% data_wts = zeros(size(Y,1),1);
% data_wts(Y==1) = 0.1/num_1s;
% data_wts(Y==2) = 0.9/num_2s;
addpath(genpath('pdollar_toolbox'))
forest_params.M = 10;
forest_params.H = 2;
forest_params.N1 = round(size(X,1)*0.2);
forest_params.... |
function H = estimate_homography_reweighted(px1,py1,px2,py2, ep)
% px1 ... x coordinate of first point
% py1 ... y coordinate of first point
% px2 ... x coordinate of second point
% py2 ... y coordinate of second point
% ep ... stop distance
n = length(px1);
% Build up the matrix A
A = zeros(2*n,9);
f... |
%% PUMPKIN
bumps=10; bdepth=.1; bdepth2=.02; dimple=.5; width_r=1; height_r=.8;
[ Xs, Ys, Zs ] = sphere(199);
Rxy=(0-(1-mod(linspace(0,bumps*2,200),2)).^2)*bdepth + (0-(1-mod(linspace(0,bumps*4,200),2)).^2)*bdepth2;
Rz = (0-linspace(1,-1,200)'.^4)*dimple;
Xp = (width_r+Rxy).*Xs;
Yp = (width_r+Rxy).*Ys;
Zp = (height_r+R... |
function out = repeat2(x, ratio)
step = 32;
win_ratio = 32;
step_ratio = ratio;
win_len = ceil(step * win_ratio);
step2 = ceil(step * step_ratio);
n = length(x);
seg = max(0, ceil((n - win_len) / step));
x = [x; zeros(win_len + seg * step - n, 1)];
m = win_len + seg * step2;
ou... |
N = 100;
hold on;
for i=1:N
x = Ps{i}(:,1);
y = Ps{i}(:,2);
z = Ps{i}(:,3);
h1 = scatter3(x,y,z,'filled','MarkerFaceColor',[1 0 0]);
x = Ps_mat_t{i}(:,1);
y = Ps_mat_t{i}(:,2);
z = Ps_mat_t{i}(:,3);
h2 = scatter3(x,y,z,'filled','MarkerFaceColor',[0 1 0]);
axis([-10 10 -10 10 20... |
function [ position, avgCost, commission ] = flop_pos(obj, spotPrice, posNew )
% Close current positions and build opposite positions, return latest
% position, avgCost and total commissions.
%%
% determine direction of new position
if obj.currUnit>0
posNew = - posNew;
end
[~,~,commission1] = obj.close_pos(s... |
function [brainarea] = arearead_TT(session, cellname)
%
filename = ['TT_',session]; eval([filename])
monkey = parsession.monkey;
electrode = str2num(cellname(1));
locs = parsession.locations;
uprobe = parsession.uprobe;
if ~isempty(locs)
if ~uprobe
ind = find(locs(:,1)==electrode);
... |
function output = HHReta(x, eta)
HHR = x.HHR;
taus = x.taus;
[n, k] = size(x.U);
output = eta;
for i = k : -1 : 1
output = output - taus(i) * HHR(:, i) * (HHR(:, i)' * output);
end
end |
% wait for data
while (s.BytesAvailable <= 0)
end
image.packetType = fread(s, 1, 'uchar');
image.outputForm = fread(s, 1, 'uchar');
image.imageId = swapbytes(uint16(fread(s, 1, 'uint16')));
image.mode = fread(s, 1, 'uchar');
image.treshold = swapbytes(uint16(fread(s, 1, 'uint16')));
image.bias = fread(s, 1, 'uc... |
%Matlab functions for imaging process of light passing through a ideal thin lens
%
% Tianxiang Wu 2021/07/01
% wtx@zju.edu.cn
function Output = ImagingThroughLens(Photon,Input,Output)
if Photon.muz <= 0 %Photon escape
return;
end
Photon = MoveToLens(Photon,Input);
if HitShutter(Photon,Input) %Pho... |
%% dataIndexing.m
% Author: Julianna Evans and Siwani Regmi
% Data: 07.26.17
% Last Revision: 04.12.18
% Finds the indices of the dataset using the input time, alt, lat, and lon
% values
function [time_idx, alt_idx, lat_idx, lon_idx] = dataIndexing(epSec, newAlt, newLat, newLon)
%% Take epSec and put into terms of N... |
function patches = CS5320_corner_patches(im,k,w)
% CS5320_corner_patches - produce patches (see Alg. 5.2 text)
% On input:
% im (mxn array): input image
% k (float): scale parameter in Alg. 5.2
% w (int): window size parameter for Harris function (called k)
% On output:
% patches (px4 arr... |
% 距离+角度测量,使用直接测量量进行相对导航
disp(strcat('Simulation Start:',datestr(clock)));
clear
close all
load leo20
%% filter
rou_error = 10/1000/3; % 距离测量误差
angle_error = 0.05*rad/3; %角度测量误差
atti_error = 0.05*rad/3; % 姿态控制误差
atti_measure_error = 0.05*rad/3; % 姿态测量误差
realtime = 0;
rou = zeros(length(t),1);
alpha = zeros(length... |
function x = restrain_value(x,min,max)
if x<min
x=min;
elseif x>max
x=max;
else
x=x;
end
end |
% function [cams, cam_centers] = reconstruct_stereo_cameras(E, K1, K2, data);
%
% Method: Calculate the first and second camera matrix.
% The second camera matrix is unique up to scale.
% The essential matrix and
% the internal camera matrices are known. Furthermore one
% ... |
function [ Vehicle ] = meanradius( Vehicle )
% MEANRADIUS Calculates the average radius between the right and left been
% pre estimated also by returning the standard deviation
%
%perform mean and deaviation std
radiusmean = mean([Vehicle.wheelLeft;Vehicle.wheelRight]);
radiusstd = std([Vehicle.wheelLeft;Vehicle.whe... |
function installSteno3D(varargin)
%`installSteno3D` Add Steno3D to the MATLAB environment
% `installSteno3D()` copies steno3dmat to '~/.steno3d_client/' and adds
% steno3d to the default MATLAB path.
%
% `installSteno3D(folder)` copies steno3dmat to `folder` and adds steno3d to
% the default MATLAB path.
%
% ... |
function a = bt_lsearch2019(x,d,fname,gname,p1,p2)
rho = 0.1;
gma = 0.5;
x = x(:);
d = d(:);
a = 1;
xw = x + a*d;
parameterstring ='';
if nargin == 5
if ischar(p1)
eval([p1 ';']);
else
parameterstring = ',p1';
end
end
if nargin == 6
if ischar(p1)
eval([p1 ';']);
else
... |
function dist = pdm(u, v);
% Poincare Disc Model - find a distance in hyperbolic space
% dist = pdm(u, v)
%-------------------------------------------------
% returns
% dist - distance between points u and v
%-------------------------------------------------
% arguments
% u - point u
% v - point v
invar = 2 * (abs... |
function controlvec = quadLQR(state_vec, desired_state, time_step)
% Quadrotor constants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%moment of intertia units: kg.m^2
Ix = 2.297e-2; % Quadrotor moment of inertia around X axis
Iy = 2.297e-2; % Quadrotor moment of inertia around Y axis
Iz = 4.935e-2; % Quadrotor mom... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXXX htet_plot_roc_graph XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Function :
% Stars :
% XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
clear;
clc;
load hcl_safin_frie_cv5_... |
%index 30: fits are not too different, only one wayward optimization,
%median fine
format shortg;
close all
T = readtable('../Residual_Algorithm/PatientInfo07212021.csv','Headerlines',2);
figureson = 0;
Hfigure = 1;
%for i = 1:4, 6:12;
%load(strcat('../../Control/Control_Optimized/control',num2str(i),'_optimized.... |
function patchFill(x,y,color,xoffset,yoffset,vert,varargin)
ip = inputParser;
ip.addParameter('FaceAlpha', .5);
ip.addParameter('LineWidth', 1);
ip.parse(varargin{:})
if nargin < 3 || isempty(color)
color = 'k';
end
if nargin < 4 || isempty(xoffset)
xoffset = 0;
end
if nargin < 5 || isempty... |
% SETPATH Add lib folders into Matlab path.
%
% Yaguang Zhang, Purdue, 06/10/2019
cd(fileparts(mfilename('fullpath')));
addpath(fullfile(pwd));
addpath(genpath(fullfile(pwd, 'lib')));
% A workaround for making Matlab R2019b work. If
% preprocessIndianaLidarDataSet.m is in the path, it has trouble using
% loaded funct... |
fprintf('Compiling ptByDpOverPfMex.cpp...\n');
mex -I/users/jang/c/lib -I/users/jang/c/lib/audio -I/users/jang/c/lib/utility -I/users/jang/c/lib/wave ptByDpOverPfMex.cpp /users/jang/c/lib/audio/audio.cpp /users/jang/c/lib/utility/utility.cpp /users/jang/c/lib/wave/waveRead4pda.cpp -output ptByDpOverPfMex
fprintf('Done... |
function out = exp_average(a,b)
persistent sum;
persistent bb;
if(nargin==2)
bb=b;
sum=a;
elseif(nargin==1)
t=[];
if(isequal(t,sum))
bb=0.1;
sum=a;
else
sum=bb*a+(1-bb)*sum;
end
end
out = sum;
end |
clear
img = imread('images/boat/img1.pgm');
tic
% [corn, poi, strength] = harris_detector(img, 1, 150/255, 10, 1);
poi = myHarris(img,0.01);
toc
|
function data_ = get_data(Solver_)
% add by Sifei Liu
net_ = Solver_.net;
attr = net_.get_attr();
num = length(attr.hBlob_blobs);
for m = 1:num
data_(m).name = attr.blob_names(attr.input_blob_indices + m);
blob = net_.blobs(data_(m).name{1});
data_(m).data = blob.get_data();
data_(m).diff = blob.ge... |
s_datasets = {'ATNT50','ATNT200'};
s_file_types = {'txt','csv'};
s_file_names = {'trainDataXY','testDataXY','testDataX'};
%% Control START %%
i_dataset = 2; %% 1 is 50, 2 is 200
b_KNN = 0;
i_KNN_n = 11; %% This is the number of nearest neighbors; Max is 45 for 'i_dataset = 1;' and 179 for 'i_datase... |
function [ featureDescription ] = Describe_Features2( img, row, col, radius )
numberFeatures = length(row); %number of features
featureDescription = zeros(numberFeatures, (2 * radius + 1)^2);
padHelper = zeros(2 * radius + 1);
padHelper(radius + 1, radius + 1) = 1;
paddedImg = imfilter(img, padHe... |
%% Opdracht 7
% Gegeven de rijvector v = [3 5 8 12 16 18].
% Maak een logical rijvector met de naam lv en inhoud [1 0 0 1 0 1].
% Gebruik lv om het eerste, vierde en zesde element van v in een nieuwe
% vector r te stoppen.
v = [3 5 8 12 16 18];
|
%总单/故障单过滤函数,用于过滤某一字段的数据,类型为double.(a,b]
%输入为总单(cell),以及要过滤的列数(double)
%及用于匹配的关键字(double),关键字可以为多个,m*1的cell
%选取线段上一个范围,大于num1,小于等于num2
function ret=filter_num(raw,col,num1,num2)
if num1>num2
temp=num1;
num1=num2;
num2=temp;
end
data=raw(:,col);
if iscell(data)
data=cell2mat(data... |
rgb2xyz = [ ...
0.4124564 0.3575761 0.1804375;
0.2126729 0.7151522 0.0721750;
0.0193339 0.1191920 0.9503041];
N = 51;
Ntot = 6*N.^2;
rgb = nan(Ntot,3);
x = linspace(0,1,N);
[X,Y] = meshgrid(x,x);
rgb0 = [X(:) Y(:) zeros(N.^2,1)];
rgb1 = [X(:) Y(:) ones(N.^2,1)];
for i=0:2
j = i*2;
rgb(j*N.^2+1:(j+1)... |
function [alpha]=zoom_sectioning(fun_quad,Grad,x,d,aLo,aHo,ops)
% function
Q=fun_quad.Q;
b=fun_quad.b;
phi0=0.5*x'*Q*x+b'*x;
i=1;
%
while(i>0)
alpha_c = 1/2*(aLo+aHo);
Xkk=x+alpha_c*d;
phi_c=0.5*Xkk'*Q*Xkk+b'*Xkk;
Grad_c=(Q*Xkk+b)'*d;
xLo=x+aLo*d;
phiLo=0.5*xLo'*Q*xLo+b'*xLo;
... |
%finding keypoints pixels
function [keypoint, coordinates] = keypoints(im, neighbourhood_size, r, c)
%% im is the image where neighbourhood pixels has to be found
%% neighbourhood_size is the matrix dimension of the neighbourhood pixels
%% r and c are the coordinates of the local features /keypoints found earlier us... |
function [nwwin_x,nwwin_y,nwwin_width,nwwin_height]=get_nw_region()
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Folder:
% alldata_actin_arp_cp:
% Define the network position window
% (nwwin_x, nwwin_y, nwwin_width, nwwin_height):
% 01_actin_sample_2_(day3)_1:
nwwin_x(1,1)=93;
nwwi... |
% 2020/05/06 Create by:Fred Liu
% 1. Input content image and style image
% 2. Input interrations
% 3. Hit transfer button
% 4. Export Image |
function [sigERI]= eri(High, Low, Close,period)
% Function to calculate the Elder Ray Indicator
% 'data' is the vector to operate on. The first element is assumed to be
% the oldest data.
% 'period' is the number of periods over which to calculate the momentum
%
% Example:
%
EMA=ema(Close,13);
T=length... |
function phi = diffin1DNeumann1(dx,L,Tl,qr,k,c,Q)
% ------------------------------------------------
% Metodo de Diferencias Finitas en 1D con condiciones Dirichlet
% ------------------------------------------------
% dx = diferencial x
% L = longitud de la barra
% Tl = condicion del borde... |
clc
clear all
close all
width = 7; % Width in inches
height = 7; % Height in inches
alw = 0.75; % AxesLineWidth
fsz = 11; % Fontsize
lw = 1.5; % LineWidth
msz = 8; % MarkerSize
set(0,'defaultLineLineWidth',lw); % set the default line width to lw
set(0,'defaultLineMarkerSize',msz); % set th... |
%thickness_calc
b12 = 'Brandon_beveled_(1.2).s2p';
frequency = dlmread(b12,' ',9,0,[9 0 209 0])/1e9;
b12_m11 = dlmread(b12,' ',9,1,[9 1 209 1]);
b13 = 'Brandon_beveled_(1.3).s2p';
b13_m11 = dlmread(b13,' ',9,1,[9 1 209 1]);
b14 = 'Brandon_beveled_(1.4).s2p';
b14_m11 = dlmread(b14,' ',9,1,[9 1 209 1]);
b15 = 'Br... |
clear; clc; close all;
load('NAME_initialization_data.mat')
load('Name_output_data.mat')
u = Input;
t = Time;
pos = Y_1;
vel = Y_2;
sample = 30;
%% System Identification
slope = (pos(end) - pos(end-sample)) / ( t(end) - t(end-sample) ); % [rad / s ]
volt_avg = mean(vel(end-sample:end)); % steady state volt... |
%% Control design for Area 1
% Conversion to state-space form
G1ss=ss(G1);
% Closed-loop poles selection and state-gain
[K1, ~, e1] = ...
lqr(G1ss.A, G1ss.B, eye(size(G1ss.A,1), size(G1ss.A,2)),1);
%e1=[-2.5765 -3.46 -7.38].';
%K1=place(G1ss.A,G1ss.B,e1);
% Change of sign for the state-gain
K1 = -K1;
% Observer-... |
function z = junk(x)
global alpha delta1
op=odeset('reltol',1e-12,'abstol',1e-12);
delta1=x(1);
x0 = x(2);
xd0 = x(3);
[t,y] = ode45('mathieu1',[0,4*pi],[x0;xd0],op);
y = y(end,:)'-[x0;xd0];
z = [y;x0^2+xd0^2-1];
|
function handle = renderEdit(this, control)
UISize = size(this);
xpos = control.pos(2) * this.scale;
ypos = UISize(1) - control.pos(1) * this.scale - this.scale * 2;
xsize = control.size(2) * this.scale;
ysize = control.size(1) * this.scale;
pos = [xpos, ypos];
dim = [xsize, ysize];
label = uicontrol('Parent', this... |
function Final_probabilty=Approx_Multiscan_JPDA_Probabilities(M,Obj_info,mbest)
U=size(Obj_info,1);
Final_probabilty=cell(1,U);
% Final_probabilty2=cell(1,U);
M2=sparse(M);
% h = view(biograph(M2));
% [~,C]=graphconncomp(M2);
[~,C]=graphconncomp(M2,'Directed','false');
C2=C(1:U);
NR=cell2mat(cellfun(@(x) siz... |
function [ea] = Bisection(xl,xu,maxIter,error,equationString, handles)
equation = strcat('@(x)', equationString);
tic;
format long;
f = str2func(equation);
if f(xl)*f(xu) >= 0
set(handles.extraInfo, 'String', 'no bracket');
return;
end
set(handles.table, 'Data', {})
maxIterations=maxIter;
i=0;
xr(1)=0;
set(hand... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 3/3/2020
function [J, I] = matMeshgrid(one2len_n, one2len_m)
n = one2len_n(end);
m = one2len_m(end);
J = zeros(m, n);
I = zeros(m, n);
for i=1:m
for j=1:n
I(i,j) = i;
... |
clear all
%print the Gamma-X plot
y_list=linspace(0,pi/2,300);
%y represent k2*a/4 which ranges from 0 to pi/2
%x,z represent k1*a/4 and k3*a/4 respectively, both are 0 on Gamma-x
g0_list=0.*y_list;
g1_list=0.*y_list;
g2_list=0.*y_list;
g3_list=0.*y_list;
E=zeros(10,300); %E matrix saves the energy on 10 different ene... |
% Copyright (c)2017 Ries Lab, European Molecular Biology Laboratory,
% Heidelberg.
%
% This file is part of GPUmleFit_LM Fitter.
%
% GPUmleFit_LM Fitter is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation... |
//
// Copyright 2011-2014 NimbusKit
// Copyright 2014 XING AG
//
// 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 ... |
function [percent, dollar, kCal] = Household_Waste(base, income, children, adults)
% EDIT TEST 2
if income < 15001
inclvl = 2;
elseif 15000 <= income < 30000
inclvl = 3;
elseif 30000 <= income < 40000
inclvl = 4;
elseif 40000 <= income < 50000
inclvl = 5;
elseif 50000 <= income < 70000
... |
function [ROIs_mat] =ROICell2Mats(ROIs)
ROIs_mat = cell(size(ROIs));
for i = 1:length(ROIs)
tempROI = [];
for j = 1:length(ROIs{i})
tempROI = [tempROI ROIs{i}{j}];
end
ROIs_mat{i} = tempROI;
end |
%% find indices of zero rows and delete them in both sessions
nnz_sess1tcurveLR = ~all(sess1_tcurveLR0==0,2); % not zero rows
nnz_sess2tcurveLR = ~all(sess2_tcurveLR0==0,2);
nnz_both_LR = nnz_sess1tcurveLR & nnz_sess2tcurveLR;
sess1_tcurveLR = sess1_tcurveLR0(nnz_both_LR, :);
sess2_tcurveLR = sess2_tcurveLR0(nnz... |
function [eeg,filterParam] = temporal_filtering(eeg,varargin)
%FILTERING_PROCESSING filter the data from eeg with different options
% EEG = FILTERING_PROCESSING(EEG). EEG is a structure containing the
% signal recorded (channel x time matrix)
% [...] = FILTERING_PROCESSING(..., 'PARAM1',VAL1,'PARAM2',VAL2,...) ... |
function [out] = mergeOutput(signal)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
out=zeros(1,length(signal));
base=1:length(signal);
for i=1:length(out)
if signal(i)
out=out+exp((-(base-i).^2)/1.27);
end
end
out=out>0.5;
end
|
function q = f_to_srvf(f,time)
addpath(genpath('bspline_tools'))
binsize = mean(diff(time));
[M, N] = size(f);
fy = zeros(M,N);
for ii = 1:N
y = Bspline(f(:,ii),3);
ydiff = diff(y);
fy(:,ii) = ydiff(1:length(time))/binsize;
f(:,ii) = y(1:length(time));
end
q = fy./sqrt(abs(fy)+eps); |
function [overlap,area1,area2] = ellipse_ellipse_overlap(a1,b1,theta1,a2,b2,theta2)
L = min(max(a1,b1),max(a2,b2));
n = 1001;
x=linspace(-L,L,n)';
y=linspace(-L,L,n)';
dx = x(2)-x(1);
dy = y(2)-y(1);
[X,Y] = ndgrid(x,y);
XT = X*cos(theta1) + Y*sin(theta1);
YT = -X*sin(theta1) + Y*cos(theta1);
ellipse1 = sqrt((XT/a... |
clear
clc
format long
n=3
for i=1:n Xi(i)=0.5; end
printf("\n Solucao por Newton:\n")
X=fNewton3(Xi)
residuomaximo=max(G(X))
printf("\n Solucao por Newton com derivadas numericas:\n")
X=fNewtonNnum(n,Xi)
residuomaximo=max(G(X))
printf("\n Solucao por Broyden:\n")
X=fBroyden3(Xi)
residuomaximo=max(G(... |
function standardisedFeatures = standardiseData(dataSet)
%STANDARDISEDATA Function that takes a data set as input and returns
% its standardised version to match other function, class formats
% used throughout this project.
global featureMethod;
% Standardise the data based on what feature type we use. The result... |
function Mk = delayAwareAlgorithm( V, mlmin, GAMMA, gamma, CB )
% implementation of the cost-free delay minimisation algorithm
% INPUTs
% V: video robability distribution (in asc. order)
% mlmin: minimum required size of cached data
% GAMMA: matrix K by mlmax with all gradients of all files
... |
classdef WebcamEvaluation < vicos.experiment.AffineEvaluation
methods
function self = WebcamEvaluation (varargin)
parser = inputParser();
parser.KeepUnmatched = true;
parser.addParameter('dataset_path', '', @ischar);
parser.parse(varargin{:});
... |
%script9_6.m
total=0;
num=2;
cnt=0;
while cnt<100
if isprime(num)
total=total+num;
cnt=cnt+1;
fprintf('%3d: prime=%3d, sum=%5d\n',cnt,num,total)
end
num=num+1;
end |
% Put ECG trigger events to EEG dataset
chan_ecg = 137 ; % define ecg channel index
[beatTimes, mag] = peakfinder(EEG.data(chan_ecg:chan_ecg,:)); % get latency and magnitudes of R peaks
ecgEventName ='666'; ... |
function [mu, muEff] = materialAttenuation( energy, material, photonsPerEnergy, energyEff)
% Return linear attenuation coefficeints of materails at given x-ray energy
% Inputs:
% energy - X-ray photon energies
% material - material name, see below for defined material names
% photonsPerEnergy - us... |
clc;
clear all;
xn = [1,1,1];
N = 50;
Xk = dft1(xn,N);
magXk = abs (Xk);
angXk = angle (Xk);
k = 0:N-1;
subplot (2,1,1); stem(k,magXk);
xlabel ('k'); ylabel('|x(k)|');
subplot (2,1,2); stem(k,angXk);
xlabel ('k'); ylabel ('ang (x(k))');
|
function empl = plotReg(emp,emp2, regN) %return normalize number of employees in region (podíl
[a,~,c] = size(emp);
for i = 1:a
for j = 1:regN(i,1)
[up,down,x,y] = rawall(reshape(emp2(i,j,regN(i,2):c),[c+1-regN(i,2),1]),2,c+1-regN(i,2),2,5,10.4);
[top,bottom,bottom2] = find... |
function [xlimits ylimits] = get_MR_image_boundaries(baseline_MR_volume)
sum_over_slices = squeeze(sum(abs(baseline_MR_volume),3));
row_sums = sum(sum_over_slices,2);
col_sums = sum(sum_over_slices,1);
valid_row_idx = find(row_sums > 0);
valid_col_idx = find(col_sums > 0);
if isempty(valid_row_idx) || isempty(valid... |
%子程序模块:
%dtw.m
function dist=dtw(t,r)
n=size(t,1);
m=size(r,1);
%帧匹配距离矩阵
d=zeros(n,m);
for i=1:n
for j=1:m
d(i,j)=sum((t(i,:)-r(j,:)).^2);
end
end
%累积距离矩阵
D=ones(n,m)*realmax;
D(1,1)=d(1,1);
%动态规划
for i=2:n
for j=1:m
D1=D(i-1,j);
if j>1
D2=D(i-1,j-1);
else
D2=realmax;
end
if j>2
D3=D(i-1,j-2)... |
function plot_spectrum( params, eigenvalues )
% INPUT:
% :params: parameter of NLS with nonlinear potential (see info.txt)
% :eigenvalues: eigen values of differential operator, that correspon to
% the evolution of perturbations
figure
hold on
% Continuous spectrum
% line([0 0], [ params(1) 100], 'Color'... |
% Delta Robot - Inverse Kinematics
function [qi, Fi, Ji, Ei] = IK(E, alpha, f, e, rf, re)
% Robot Parameters of the Delta Robot
% sym pi;
% syms x_Ji y_Ji z_Ji % Coordinates of the origin
% syms x_Fi y_Fi z_Fi % Coordinates of joint Fi
% Rotation matrix about y-axis
Roty = [cos(alpha) 0 sin(alpha);
0 ... |
function [x yi t1 y1 t2 y2] = trapezoid_test(a, b, y0, h)
y = inline('3*exp(t.^2/2)-t.^2-2');
x = a:h:b;
yi = y(x)-1+y0;
[t1 y1] = trapezoid([a b],y0,h);
[t2 y2] = euler([a b],y0,h);
%plot(x, yi, x, yi,'b-', t1,y1, t1,y1,'o', t2,y2, t2,y2,'+' );
%plot(x, yi, x, yi,'.');
%hold on
plot(t1,y1, t1,y1,'o', t2,y2, t2,y2,'... |
function analysis2
%ANALYSIS2
% Enable dependecies
initializedependencies;
[githubDir,~,~] = fileparts(pwd);
circadianDir = fullfile(githubDir,'circadian');
addpath(circadianDir);
% Have user select project location and session
[plainLocation,displayLocation] = gui_locationselect;
[plainSession ,displaySession ] = g... |
function PushBufferContact(dGap2)
%--------------------------------------------------------------------------
% All copyrights reserved @ 2014-2020 Dr. Gaofeng Zhao
% TIANJIN UNIVERSITY (China), UNSW (Australia)
% Email: zhaodlsm@gamil.com
%--------------------------------------------------------------------------... |
%problema do jogador inexperiente jogando dardos.(Caderno)
Nexp = 100000;
X = rand(1,Nexp); %sorteia uma matriz com 1 linha e Nexp colunas entre 0 e 1
Y = rand(1,Nexp);
figure(1)
scatter(X(1:1000),Y(1:1000)); %plot os valores como pontos no grafico
%(1:1000) pega os primeiros 1000 valo... |
load net;
inputs = zeros(size(testX,1), size(testX, 2), size(testX, 3), size(testX, 4)* 9);
targets = zeros(size(testY,2),10);
labels = zeros(size(testY,2),10);
cur = 0;
m_lb = eye(10);
for i = 1:size(testY,2)
predLabelsTest = net.classify(testX(:,:,:,i));
if (predLabelsTest ~= categorical(testY(i)))
... |
% x is DxM
% y is Mx1
% mu is KxD
function mu = get_mean(x, y, k)
% num_y(i) is the number of training examples w/ label i.
num_y = sum(y == [1:k])';
for i = 1 : k
mu(i,:) = sum((y == i) .* x');
end
mu ./= num_y;
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.