text stringlengths 8 6.12M |
|---|
%rest calculation
filename = 'acc_at_rest.xlsx';
A0 = xlsread(filename);
x0 = A0(:,1);
y0 = A0(:,2);
z0 = A0(:,3);
base_avg = 0;
base=[];
for i = 1:size(z0)
base(i) = sqrt(x0(i)^2+y0(i)^2+z0(i)^2);
end
baseCorrected = base(100:500);
% mx = max(baseCorrected)
% mn = min(baseCorrected)
base_avg... |
function [nam] = reducedNameSet(nam)
for i =1:length(nam)
j = splitString(nam{i},';');
nam{i} = j{1};
end
end |
clear all
%close all
clc
load s0471_rem.mat
[ch,samp] = size(val);
signal = val;
clear val
heartbeat = signal(1,55:570);
x = 1:500;
y =sin(x - pi/3).*exp(-0.02*x) + 0.1*sin(0.5*x - pi/3).*exp(-0.002*x) + 2*sin(1.2*x - pi/3).*exp(-0.1*x) ;
figure
plot(y)
%% Step 1: Arrange data points in LxM Hankel Matrix H
N = leng... |
%% Stelling 10
%
% Wanneer je de index (2,3) op vraagt van een vector
% v=[1.1 1.2 1.3] krijg je een foutmelding.
%
Antwoord = 1;
|
function J=Jacobian6DoF_Ln(th1,th2,th3,d4,th5,th6)
% close all
global Link
jsize=6;
J=zeros(6,jsize);
Link(2).th=th1*pi/180;
Link(3).th=th2*pi/180;
Link(4).th=th3*pi/180;
Link(5).dz=d4;
Link(6).th=th5*pi/180;
Link(7).th=th6*pi/180;
for i=1:7
Matrix_DH_Ln(i);
end
Link(1).p=Link(1).p(1:3);
for i=2:7
Link(i).... |
% Function: get singilarity
% Date: 2018/04/06
clc;
clear all;
figure;
th1=0;
dz=0;
th3=0;
th4=0;
th5=0;
th6=0;
Link_J_MyRobot(th1,dz,th3,th4,th5,th6,0);
pause; hold off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% set an initial position
% stp=10;
% for th1=0:stp:180
% Link_MyRobot(th1,dz,th3,th4,th5,th... |
function out = ST_cross_correlation(S1,S2,window_size,nBins)
%function out = ST_cross_correlation(S1,S2,window_size,nBins)
%
% Order of spike trains defines directionality, spikes of S1 are the
% reference, S2 spikes come before or after as indicated by the time below
% or above zero
%size(S2)
switch 2
... |
function r = exercise_4_7_1(num_rows, num_cols)
%%% creates a matrix of random numbers of size (num_rows, num_cols)
%%% loops through the matrix and prints whether each number is bigger
%%% than 0.5 or not
switch nargin
case 0
num_rows = 4;
num_cols = 8;
case 1
... |
function v = get_options(options, name, v, mendatory)
if nargin<4
mendatory = 0;
end
if isfield(options, name)
v = eval(['options.' name ';']);
elseif mendatory
error(['You have to provide options.' name '.']);
end |
function wr_head(fil_nam, fil_typ, fil_hd, flag)
% Program to write the header for the TypeA1 and TypeB1 and HTK
% file for the Tfrontm
% Programmer : Jaishree. V.
% Date : 10\24\99
% : 11-23-99 Montri K. -- add HTK file type
% : 02-14-00 Montri K. -- add flag, to allow updati... |
function [] = tsnr_resamp_agg()
% aggregate tsnr across subjects
% karen larocque, may 2014, modified june 2014
%% general params
% experiment & subjects
%exp=[]; % assigned later based on subject
sublist={'PSER01','PSER02','PSER03','PSER04','PSER05','PSER06','PSER07','PSER08','PSER09','PSER10','PSER11','PSER12','PS... |
% Plots Definition of Outbreak Size Plot.
%
% load('StepAnalysis.mat');
% Data is from sizes 1:8
% Take only data for sizes 2 to 5:
cutofflow = 2;
cutoffhigh = 5;
mus_remap = mus(cutofflow:cutoffhigh,:);
sigmas_remap = sigmas(cutofflow:cutoffhigh,:);
reremap = remap(cutofflow:cutoffhigh);
% Bring data into gscatter ... |
function [vecJointPos,vecJoint2to6] = KUKA_LBR_iiwa_inverse_kinematic(vecPosDes_,quatOriDes_,KUKA_LBR_param_,ellbowAngle_,vecGlobalConfig_)
% * Creation of a new function that calculates the jointAngles of the robot arm
% * The function works with three variables which are necessary for calculation
% * vecJointP... |
function [I T] = romberg(a,b,f,n,k)
%compute the approximate integral of f in the domain [a,b] using romberg
%integration, which uses richardson extrapolation
%TESTED AND CORRECT!
R=zeros(n);
I=0;
%generate the first column, using the trapezoidal rule
for i=1:n
R(i,1) = trapezoid1D(a,b,f,2^(i-1));
end
%compute the ... |
function Xf = filter_apply(X,h_filter);
% function Xf = filter_apply(X,h_filter);
%
% Applies the FIR h_filter to the timeseries on the matrix X (ntimeseries x ntimes)
%
% INPUTS:
% X: matrix of timeseries (nTimeseries x nTimes)
% h_filter: filter coefficients
%
% OUTPUTS:
% Xf: matrix of filtered timeseries
%
% ... |
function H = besselh_derivative(nu,K,x)
% besselh_derivative(nu,K,x) using the recursive relationship to calculate the derivative of
% bessel's funtion of third kind, i.e. Hankel's function
%
% nu order of the bessel's function
% K = 1 if it is Hankel's function of the first kind; K=2 if it is Hankel's function of the
... |
% directory_name = uigetdir('\\centos\secured\shared_data\diffWidthVolFracFilling');
% directory_name = '\\centos\secured\shared_data\Cyl4.4VolFracFilling\';
directory_name = 'D:\SimResults\Chrono\SmarticleU\tests\angChange2\';
folds = dir(directory_name);
folds = folds(3:end);
dFile = '\PostProcess\volumefraction.txt'... |
% This script will do the final CA to use for clustering analysis
clear all
addpath script/helpers
addpath data/
data_dir = 'data';
load([data_dir '/dtm_9987sparsity.mat']) %% Make sure this is correct
data_stemmed=data;
clear data
[lambda,tau,~,fi,~,~,~,fj,~,~]=corresp(data_stemmed);
clear data_stemmed
Fi20=fi(:,... |
%% RCNN_SymmetricGroups :Visualization
%--------------------------------------------------------------------------
%
% This function implements visualization of the intermediate layers of the
% CNN and the t-SNE(t- Stochastic Neighbor Embedding)
%
% [in] : matFile (this .mat file should contain the "net" ofyour CNN)
%... |
% This function implements the loss function of a logistic regression with
% training data stores in 'D' and +1/-1 class labels stored in 'c'.
function y = logreg_objective(x,D,c)
Nd = size(D,1);
f = zeros (Nd,1) ; % allocate space to store objective values for each data point
z = c.*(D*x); % Compute CDx
f(z>=0) = ... |
%% -- EZW ENCODING -- %%
function [Im_EZW,Im_Dif] = EZW(Im_WQ,Limit)
%% -- THRESHOLDS -- %%
Init_Thresh = 2^(floor(log2(max(max(Im_WQ)))));
T = [Init_Thresh];
i=2;
while(1)
T(i) = T(i-1)/2;
if(T(i)==1)
break;
end
i = i+1;
end
%% -- INITIALIZING -- %%
[Height,Width] = size(Im_WQ);
Sig = zeros(Heig... |
function [ SegmentationPointsData, SegmentationScore, SPIndexes] = BackwardSegmentationSelection( minScoresTable, recognitionScoreTable )
%BACKWARDSEGMENTATIONSELECTION Summary of this function goes here
% Detailed explanation goes here
k = size(minScoresTable,1);
SegmentationScore = 0;
SegmentationPointsData ... |
function run_all_experiments
try
warning('off', 'all')
% setup algorithm variables
bins_list = [1024, 2048, 4096, 8192];
k_list = [5, 10, 15, 20];
alg_list = [1, 2];
runs = 5;
% get the directory structure reset and ready to go
setupPath
delete('eval_temp/*');
scen... |
function ob = getOb(delta,sd)
for s = 1:6
for sprime = 1:5
xmax = sprime+0.5;
xmin = log(0);
fun = Gaussian(s+delta,sd);
p = integral(fun,xmin,xmax);
Ppost(s,sprime) = p;
end
Ppost(s,6)= 1 - integral(Gaussian(s+delta,sd),log(0),5.5);
end |
function [x, y] = loadHouses()
load houses.txt;
[m n] = size(houses);
a = ones(m, 1);
x = houses(:, 1);
x = [a x];
y = houses(:, 2);
|
%% Plotting the grids (Quadtree from Basilisk C dump files)
% Author: Vatsal Sanjay
% vatsalsanjay@gmail.com
% Physics of Fluids
clc
clear
close
%% Output Folder
folder = 'Grids'; % output folder
opFolder = fullfile(cd, folder);
if ~exist(opFolder, 'dir')
mkdir(opFolder);
end
%%
tic
nGFS = 99;
dt = 0.01;
xmin = 0.0; xm... |
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% system_configuration.m
% Configuration file for the whole system, including
% processors, applications, tasks, messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Licong Zhang, last update 18.12.16
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [T_0,P_0]=atmosferaISA(z,T_SL,P_SL)
T_0=T_SL-6.5*10^(-3)*z;
P_0=P_SL*(1-(6.5*10^(-3)*z)/(T_SL))^5.252;
end
|
function [ Data, Info ] = rpca2d_l2( X, varargin)
%RPCA2D_L2 Solves NO2DRPCA with a L2 penalty on T and Frobenius norm
% min (1/2)*(alpha_c*||Uc||_F^2 + alpha_c*||Ur||_F^2 +
% alpha_r*sum(||Tn||_F^2) + sum(labmda_n*||En||_1)
% s.t for all n Xn = UcTnUr^T + En
%
% Mehdi Bahri - Imperial College London... |
function [pose] = h2tr(K, H)
ProdR1R2t = inv(K) * H;
% First Row is R1
R1 = ProdR1R2t(:, 1);
s = norm(R1);
R1 = R1/s;
% Second Row is R2
R2 = ProdR1R2t(:, 2)/s;
% Cross product of R1 and R2
R1xR2 = cross(R1, R2);
% Third Row is t
t = ProdR1R2t(:,3)/... |
function gk = mstiffg(e,a,bl,cx,cy,ncjt)
gk = zeros(2*ncjt, 2*ncjt);
z = (e*a)/bl;
z1 = z*(cx.^2);
z2 = z*(cy.^2);
z3 = z*cx*cy;
gk(1,1) = z1;
gk(2,1) = z3;
gk(3,1) = -z1;
gk(4,1) = -z3;
gk(1,2) = z3;
gk(2,2) = z2;
gk(3,2) = -z3;
gk(4,2) = -z2;
gk(1,3) = -z1;
gk(2,3) = -z3;
gk(3,3) = z1;
gk(4,3) = z3;
gk(1,4) = -z3;
... |
function [q_new commandes]=Extend(q_rand,q_near,M,eps)
sinu2=(q_rand(2)-q_near(2))/M;
cosu2=(q_rand(1)-q_near(1))/M;
t=1;
if eps<M
q_new(1) = q_near(1) + t*cosu2;
q_new(2) = q_near(2) + t*sinu2;
theta = acos(cosu2);
else
q_new=q_near;
theta = acos(cosu2);
... |
function [ M2V, V2P ] = optimizeCamera( featureImage, featureVertex )
% Tao Du
% taodu@stanford.edu
% Feb 21, 2015
%
% Given a couple of 2D vertices, and its 2D projections, estimate the
% intrinsic and extrinsic parameters of the camera. Here we assume a
% perspective camera model.
%
% Input: featureImage: n x 2 matri... |
clc
clear all
close all;
BAU= xlsread('BAU.csv');
Trees= xlsread('Trees.xlsx');
ren= xlsread('renewables.csv');
zeroC=xlsread('Phase out coal.csv');
dy_tax=xlsread('Dynamic tax.csv');
C15= xlsread('15 euros.csv');
C50= xlsread('50 euros.csv');
C100= xlsread('100 euros.csv');
years= [2015:2050]; % timescal... |
function x(t) = solution(x0,dt,a,N)
x(t) = normaldif(a,x0,N)*dt+x0
end |
function img = psimread(f, fd, c)
%PSIMREAD Open a document in Photoshop and return the pixel values.
% PSIMREAD(F) Is equivalent to calling PSOPENDOC(F); I = PSGETPIXELS();
% F is the name of the file. Full path to the file is required.
%
% PSIMREAD(F,FD) FD is for flatten the document. If the document is a
%... |
% Syntax
% err = PS_SetRate(StimN, ChN, Rate)
% Description
% Set repetition rate for a channel in Hertz.
% Default value is 200 Hz.
% StimN - stimulator number to configure (starts from 1)
% ChN - channel number to configure (starts from 1)
% Rate - rate in Hertz; valid values are from... |
clear all
close all
clc
% Pojazd: Lancer 1.5, 955 kg
A = 2.18; % m^2
cx = 0.3;
f0 = 0.01;
eff = 0.9;
Pmax = 80; %kW
g=9.81;
m = 955; %kg
rd = 0.360; % m
brake_force=7500; %N
start_speed=10; %m/s
% opóźnienie czasu hamowania
t_opz = 1; %s
% parametry wzniesienia
angle=0;
%Parametry silnika
M... |
%ÖZGÜR KAN
%15011702
%13.05.2020
clear all;
clc;
noSamples=10000;
noBins=15;
%MY GENERATE POİSSON DİSTRİBUTİON HİSTOGRAM,PDF AND CDF
samples=poissonGenerate(6,noSamples);
samples1=poissonGenerate(4.5,noSamples);
[freqs, interval, delta]=histogram(samples, noBins);
[freqs1, interval1, delta1]=histogram(... |
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
% Giacomo Mazzamuto (LENS)
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% * Redistributions of source ... |
function [xhit, yhit, num_dart] = findDartLocation(dart, masks)
rows = size(dart, 1);
% 先對 dart map 做 disk dilation,把區域補起來
dart_mask = (imdilate(dart.^2 > 0.2 * graythresh(dart.^2), ...
strel('disk', round(rows/100))));
% 找出該區域的 orientation
sDart = regionprops(dart_mask, 'Orientation', ... |
function interactive_bayesian_PK_model_inference(DCE_MRI_Struct, PK_Params_Prior, varargin)
num_samples_to_plot = 2000;
% Check input arguments
if nargin <= 1
disp(sprintf('%s(DCE_MRI_Struct, PK_Params_Prior, {PK_Params_Proposal_Dstr}, {T10_Prior}, {Noise_Prior}, {num_PK_param_vecs_to_sample}, {num_T10s_to_sample})... |
clear all;
close all;
syms a 'positive'
syms b 'positive'
syms c 'positive'
syms g 'positive'
syms l 'positive'
syms A 'positive'
syms tau 'positive'
syms t 'real'
assume(t>=0)
syms w 'real'
syms w0 B tau0 'positive'
syms d0 D 'real'
syms E F G H 'real'
assume(4*g-(a-b)^2>=0)
% [a, b, c, g, l, A] = solve([tau0 == (a+... |
#include "..\..\..\lib/std.mi"
Global Group tipGroup;
Global Text tipText;
Global GuiObject tipBorder;
Global Layer tipBG;
Global Double layoutscale;
Global Container containerMain;
Global Layout layoutMainNormal;
System.onScriptLoaded() {
containerMain = System.getContainer("main");
layoutMainNormal = container... |
function [] = draw_4sigm(alfa,c)
close all
y = -0.15:0.01:4.28;
for k= 1:length(y)
% mi1(k) = 1/(1+exp(-alfa*(y(k)-c)));
% mi2(k) = 1 - 1/(1+exp(-alfa*(y(k)-c)));
mi1(k)=1-1/(1+exp(-alfa*(y(k)-c(1))));%-0.05
mi2(k)=1/(1+exp(-alfa*(y(k)-c(1))))-1/(1+exp(-alfa*(y(k)-c(2))));%1.4
... |
function F_save_fig(file_name)
saveas(gcf, file_name,'png');
saveas(gcf, file_name);
if verLessThan('matlab','9.8')
else
exportgraphics(gcf,[file_name,'.pdf'],'BackgroundColor','none','ContentType','vector')
end
if ispc==1
saveas(gcf, file_name,'meta');
end
end |
% ======================================================== %
% ---- PV-Battery Tool (PVBT) Sizing Optimization ------- %
% Version: 1.2 (2/2021) --------------------------------- %
% ======================================================== %
% This code was developed by Ahmed A.Raouf Mohamed: ------ %
% ------ AARa... |
function par = simulation_init(par)
% use runId random seed (enables reproducibility)
rng(par.runID);
% set up Gray-mapped constellation alphabet (according to IEEE 802.11)
% Gray code ref: https://www.sciencedirect.com/topics/engineering/gray-mapping
switch (par.mod)
case 'BPSK'
... |
clear all
close all
load acmod
load temp_initguess
ac.p_exp = 1;
N = (length(Z)-3)/8;
tfin = Z(end);
t = linspace(tfin/N,tfin,N);
V = Z(1:N);
chi = Z(N+1:2*N)+Z(end-2)*t.';
gam = Z(2*N+1:3*N);
x = Z(3*N+1:4*N);
y = Z(4*N+1:5*N);
z = Z(5*N+1:6*N);
CL = Z(6*N+1:7*N);
mu = Z(7*N+1:8*N);
figure
plot3(x,-y,-z,'-b');
ho... |
function [img] = applyMask(Img,mask)
img = Img;
for c = 1:size(Img,3)
img(:,:,c) = Img(:,:,c).*mask;
end
end |
% 2.7: Levenberg-Marquardt algorithm
% Implement the Levenberg-Marquardt algorithm. You should motivate your algorithmic
% choices and explain the algorithm. Test this algorithm for various starting points.
% Use the contour plot to demonstrate the convergence sequence for this algorithm.
% Make tables and plot... |
function fig = seeClassPerf(Prediction, varargin)
% Plots performance metrics of classification model
% -------------------------------------------------------------------------
% fig = seeClassPerf(Prediction, varargin)
% -------------------------------------------------------------------------
% INPUTS
% REQU... |
function [x, y] = trajectory_position(v0, theta, t)
d1 = 5.3/100;
d2 = 15.9/100;
d3 = 7.5/100;
g = 9.81;
x0 = d2 * cosd(theta) - d3 * sind(theta);
y0 = d1 + d2 * sind(theta) + d3 * cosd(theta);
x = x0 + v0*cosd(theta)*t;
y = y0 + v0*sind(theta)*t - (1/2)*g*(t^2);
end |
function f = ramp(t)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
f = (sign(t) + 1)*0.5;
f = f.*t;
return
|
function plot_trajectory(x,y)
%plot_trajectory: plots trajectory
% Detailed explanation goes here
figure(3)
% trajetoria do robot
plot(y,x, 'x','Color',[1, 0.7, 0])
end
|
clear;clc;
%% Problem 1.1
syms l1 l2 q1 q2 real
q = [q1;q2];
f = [l1*cos(q1) + l2*cos(q1+q2);l1*sin(q1) + l2*sin(q1+q2)]
%% Problem 1.2
Ja = jacobian(f,q)
%% Problem 1.3
Ja_inv = simplify(inv(Ja)) |
classdef Kinematics
methods(Static = true)
function q = toQuaternion(yaw, pitch, roll) % yaw (Z), pitch (Y), roll (X)
% Abbreviations for the various angular functions
cy = cos(yaw * 0.5);
sy = sin(yaw * 0.5);
cp = cos(pitch * 0.5);
... |
clear;
close all;
addpath(genpath('calib_data'));
addpath(genpath('lightDirectionSnaps'));
addpath(genpath('/usr/not-backed-up/Dropbox/PhDmed/code/Matlab_Functions'));
Irgb=imread('/export/mailgrp2_d/scssaq/captureVideo/CalibData/cam0/light6pos0.bmp');
%isolate the yellow circle. yellow hue value [50-65]/255 http://mkw... |
classdef GeometryOData < sbfsem.io.OData
% GEOMETRYODATA
%
% Description:
% Responsible for importing Closed Curve geometry data
%
% Constructor:
% obj = GeometryOData(ID, source)
%
% Inputs:
% ID Neuron structure ID
% source Volume name or abbreviation
%
% Properties:
% ID ... |
%% initialize
import AMF.*
model = Model('toyModel');
data = DataSet('toyData');
loadGroup(data, 'toy');
initiateExperiment(model, data);
%% config
model.options.useMex = 1;
model.options.savePrefix = '';
model.options.odeTol = [1e-12 1e-12 100];
model.options.numIter = 20;
model.options.numTime... |
function elem=atrbend(fname,varargin)
% ATRBEND creates a rectangular bending magnet element with class 'Bend'
%
% Two calling methods (that can be combined)
% ATRBEND(FAMNAME,LENGTH,BENDINGANGLE,K,PASSMETHOD)
% INPUTS
% 1. fname family name
% 2. LENGTH length of the arc for an on-energy p... |
% Generate numerical sensitivity module of the CAT phantom
%
% Meng Wu at Stanford University
% 2014
supraRadius = 58.4;
supraTargetsRaduis = 6.1;
supraAngle = [pi/12 pi/3 pi/2 2*pi/3 11*pi/12];
subRadius = 15;
subDensity = 1.1;
subTargetsDiameters = [10 8 6 4 3 2 1.5 1 0];
subTargetsRaduis = subTargetsDiameters / 2... |
% quasiclassical quantization integral and its derivative over frequency
function res = qint(nf, nu, nu0, hmin, cper, cpar, nub, dbetan, R, N)
% if N=0 return n(w) function
% if N=1,2,3 return dnu (nu0) for 1->N, nu is not used
rr = linspace(0,R,100);
if dbetan>0
% mbetan = asin(sqrt(4/5));
% betan = (... |
function [ BestNet_AANN,AANN_FaultCriterion ] = WSN_AANN_Training( ANN_SensorData_Cell, Mode, NetType, hiddenLayerSize, TrainFunc, TotalNets )
%% Function Input and Output Argument Description:
% Input Arguments:
% ANN_SensorData_Cell :
% Mode :
% NetType :
% hiddenLayerSize :
% TrainFunc :
% TotalNets :
% Outpu... |
function run_wac2(name, lqrsp, params)
lambdas0 = [logspace(-1, log10(3), 3)];
cases = {'case39'};
for i=1:length(cases);
lambdas = lambdas0(i,:);
[A,B,W,Q,R] = problem_wac2();
%K0 = zeros(size(B'));
K0 = -lqr(A,B,Q,R);
for j=2 %1:length(lambdas)
Lambda = lambdas(j)*ones(size(B'));
[K{j},h{j}] = lqr... |
function value=htheta(theta,X)
% theta:a column vector
% X: matrix, each line is an instance's feature vector
% value: a column vector
value = 1 ./(1+ exp(-(X * theta)));
end |
function Out = RemoveCharacterGroup(In,Target)
TargetLength = size(Target,2);
StringSize = size(In);
for m = 1:StringSize(1)
LocOut = In(m,:);
for n = 1:StringSize(2)
Span = n+TargetLength-1;
if (Span <= StringSize(2))
Removals = n:1:Span;
Logical = (In(m,Removals) == Target);
if(sum(Logical... |
%TEST0 different iks for both legs
%close all;
clear all;
osc2
generateHex
DIP=20;
COM_POS=[0 0 0];
%s=serial('COM5');
%set(s,'baudrate',57600);
%fopen(s)
k=80;
for n=1:1
for i=1:1:k
plot3(trajtotx2(1,:),trajtoty2(1,:)-42.5,trajtotz2(1,:),'o');
hold on;
plot3(trajtotx(1,:),trajtoty(1,:)+42.5,t... |
function [idsTrain, idsP] = RD(X, d)
%% RD in the paper:
%%
%% D. Wu, "Pool-based sequential active learning for regression,"
%% IEEE Trans. on Neural Networks and Learning Systems, 30(5), pp. 1348-1359, 2019.
%%
%% Dongrui Wu, drwu@hust.edu.cn
[idsClass,~,~,D] = kmeans(X,d,'MaxIter',200,'Replicates',... |
function [registeredff2,tform]=RegisterMaps(ff1,ff2);
%function [RegisteredVolume, Response]=RegisterFF(FFPRE,FFPOST);
%2D registration of a pair of FF slices to generate RegisteredVolume (ff2 is
%registered to fit ff1)
%Written by T Bray Jan 2022
%t.bray@ucl.ac.uk
%Follows the outline given on https://uk.mathworks.c... |
function accuracyScore = getAccuracyScore(predictions, data)
alpha = 0;
postiveDataIndexes = find(data(:,2) == 1);
truePositives = sum(predictions(postiveDataIndexes)) + alpha;
totalPositives = sum(predictions == 1) + alpha;
precision = truePositives/totalPositives;
expectedPositives = length(postiveDataIndexes) + al... |
%%
rng(mean('hyperalignment'));
%% Get Carey Q inputs.
cfg_data = [];
cfg_data.use_adr_data = 0;
% Fig 2b, 3, 4, and S2 use removeInterneurons = 0, otherwise 1.
cfg_data.removeInterneurons = 0;
cfg_data.normalization = 'none';
%%
cfg_data.left_one_out = 0;
cfg_data.half_split = 0;
[Q] = prepare_all_Q(cfg_data);
%% F... |
%Generate standard user distribution for the paper
%Generate only once, because all the experiment presentations are based on
%the user distribution.
%The user distribution should include the version information to
%distinguish different user distributions
%'prb_4' stands for user distribution type 4
clear;
clc;
nam... |
function [] = runSimsParam2(scenario,numSims,fixedAttacks)
dir = "resim/";
subdir= "sims30/";
%File with Attack Matrix in previous scenario simulation
%IMPORTANT: FILE TO LOAD MUST HAVE >= NUM SIMULATIONS THAN THIS
%load "./resim/vmattackA.mat" vmattack;%vmattack is a CellArray
load(fixedAttacks,"vmatta... |
function z = my_obj_fun_Sustainability_PJM_no_corr(x) %x is an nx1 vector of weights
%rho is the PJM correlation matrix derived from first stages of model
%in this function it is the identity matrix (no correlation between
%technologies)
% x will be a row vector of size specified in main function call
Rho =... |
clear all; close all; clc;
pkg load signal
Ts = 16; % pontos por simbolo (para cada bit 16x)
Tb = Ts; % tempo de duracao do bit
Nb = 1000; % numero de bits tentando aproximar do infinito
B=rand(1,Nb) > 0.5; % gera Nb bits aleatoriamente metade estao acima de 0.5 e metade a abaixo
%se for menor da b... |
function image = dct_quant(image, q_mat)
dct_matrix = dctmtx(8);
dct_matrix_t = dct_matrix';
[h, w] = size(image);
for i=1:8:h
for j=1:8:w
image(i:i+7,j:j+7) = round((dct_matrix * image(i:i+7,j:j+7) * dct_matrix_t)./q_mat);
end
end
end |
function [track_x, track_y] = trackPoints(pt_x, pt_y, im, ws)
% Tracking initial points (pt_x, pt_y) across the image sequence % track_x: [Number of keypoints] x [nim]
% track_y: [Number of keypoints] x [nim]
% Initialization
N = numel(pt_x);
nim = numel(im); track_x = zeros(N, nim); track_y = zeros(N, nim); track_x(:,... |
clear
%as = Grab_set('ETIENNE','Etiennewater')
%psd = THREECOMPMODEL('empore2com1side')
%ps.plotperiods
%ps.calibrate(as,'atr-Des',psd,'F')
ps = Passive2_set('Gale','Gale-mem','Gale-sor');
as = Grab_set('GALE','Galewater','phenanth');
psd = THREECOMPMODEL('spmdmodel');
%ps.plotperiods
%ps.outplot('phenan... |
function sy8(n)
% 实验八 图像复原
% n=1 去噪:随机噪声
% n=2 去噪:周期噪声
% n=3 去卷积
if(n == 1)
% 去噪:随机噪声
f = imread('./pic/Lena_gray_512.tif');
f = tofloat(f);
[M, N] = size(f);
n = imnoise2('erlang', M, N); % 爱尔兰噪声
g = f + 0.03*n;
% figure;
% subplot(121),imshow(... |
% make_shrinkage_p.m
% Links the object file for shrinkage_p with MEX.
%
% Georgios Papamakarios
% Imperial College London
% Aug 2014
!make shrinkage_p.o
mex -cxx shrinkage_p.o
|
function Y = tril(X,offset)
% Symbolic lower triangle.
% TRIL(X) is the lower triangular part of X.
% TRIL(X,K) is the elements on and below the K-th diagonal
% of X . K = 0 is the main diagonal, K > 0 is above the
% main diagonal and K < 0 is below the main diagonal.
%
% Examples... |
function cb = getCB95(x,dim)
%GETCB95 Return 95% confidence bounds
%
% cb = utils.getCB95(x);
% cb = utils.getCB95(x,dim);
%
% Inputs
% x - Data vector
% dim - 1 (def) | 2 [Dimension to estimate confidence-band along]
%
% Output
% cb - Cell containing [lb, ub] based on sorted values of x.
% -> Removes nan... |
function [bounds] = crb(p,N,theta,sigma_z)
%function to calculate Cramer Rao bound for a sum of real sinusoids
%in noise for unbiased estimator - See "Modern Spectral Estimation"
%by Steven Kay, Section 13.4
%p - number of real sinusoids
%N - number of data points available
%theta - a vector consisting of all amplitu... |
clear;
clc;
%% Author: HongZhao
%% Date:2018-1-31
%% SAIAPR 数据结果均已经测试,与论文中一致
%% Hierarhcical results;
load('News20GroupTrain.mat')
load('indicesNews21.mat');
[m,n]=size(data_array);
% rand('seed',5);
numFolds = 10;
% indices = crossvalind('Kfold',m,numFolds);%//进行随机分包 for k=1:10//交叉验证k=10,10个包轮流作为测试集
load('anszhNew... |
iptsetpref('UseIPPL',false);
original = imread('xvokra00.bmp');
originalDouble = im2double(original);
dimensions = size(original);
file = fopen('reseni.txt','w+');
% step1.bmp - zaostření obrazu - hotovo
step1matrix = [-0.5 -0.5 -0.5; -0.5 5.0 -0.5; -0.5 -0.5 -0.5];
step1 = imfilter(original, step1matrix);
imwrite(st... |
%ABSTRACT
% Library function for SDCM. Kolmogorov Smirnov test, supporting weighted distributions:
function [log10_p,ks] = ksTestW(X1,W1orMass1, X2orCDF2,W2orMass2, commonMinX,sTail, bPlot) %,sPSmallIfX1hasThisValuesRelativeToThisX2)
%%.Initialization and parameter check:
bUnweighted1 = isempty(W1orMass1);
i... |
function relationData = convertDataStruct(relationData, varargin)
%CONVERTDATASTRUCT Converts relation data from old-style data structures into the new data objects.
%This relationData class-specific method is a protected method not intended for general purpose use.
%
% Written by Josh Grooms on 20130428
% 2013... |
function h = i_double_cos(x, a, theta)
%h = a * [cos(x); cos(x+theta)];
h = [a(1)*cos(x); a(2)*cos(x+theta)];
end |
%% loop all participants
subjects = {'EEG_01'}; %Define Subjects
cond ={'_Pred_Ac','_NPred_Ac','_Pred_In','_NPred_In'};
ext={'.mat'}; % extension
% variable number of wavelet cycles & wavelet parameters
%%
num_frex = 150;
min_freq = 15;
max_freq = 90;
% set a few different wavelet widths (number of wavelet cycles... |
delete(instrfind({'Port'},{'COM15'}))
ser = serial('COM15','BaudRate',115200);
ser.ReadAsyncMode = 'continuous';
fopen(ser);
pause(2)
while true
bytes = ser.Bytesavailable;
if bytes>=200
str = strsplit(convertCharsToStrings(char(fread(ser,bytes))),'\n');
str = fliplr(str(2:length(str)-1)... |
function [mi, hAB, hA, hB] = mutual_information(A, B, binsA, binsB, overlap)
%
% Calculates the mutual information between the input
% variables.
%
% Written: April 3, 2002 (lzollei)
% Modified: November 17, 2002 (lzollei)
%
if ~exist('overlap')
overlap = 0;
end
if overlap == 1
ind = find(~(isnan(B)));
B = B(... |
clear all
close all
clc
% load('../result&Images/AllenGabriel.mat');
% load('AG_wavelet.mat');
% load('../result&Images/RushilGabriel.mat');
% load('RG_wavelet.mat');
load('../result&Images/RushilShijia.mat');
load('RS_wavelet.mat');
personNum = size(traceSig,1);
traceNum = size(traceSig,2);
sensorNum = size(trace... |
clear all;
% read train set from excel
Xtrain = xlsread('tak2train.xlsx');
% train set labels
Xlabels = Xtrain(:,end);
% remove last column
Xtrain(:,end)=[];
% remove first column
Xtrain(:,1)=[];
% read tets set from excel
Xtest = xlsread('tak2test.xlsx');
%add bias
Xtrain(:,end+1)=1;
Xtest(:,end+1)=1;
% save variabel... |
classdef CONTINUE
% a marker used in Deferred
%
% Copyright 2016 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
d
end
methods
function self = CONTINUE(d_)
self.d = d_;
end
end
end |
Fs = 10000;
T = 1/Fs;
xn1 = linspace(0,1,Fs);
f = 500;
original = sin(2*pi*f.*xn1)';
delay1 = 5*T;
defasada = delayseq(original,delay1,Fs);
%figure
%hold on
%plot(original)
%plot(defasada)
gccphat(original,defasada,Fs)
utils.tau_gcc_phat(original,defasada,Fs)
|
function imdb = getJaffeImdb(TrainDir, ValDir, imageSize)
Timset = imageSet(TrainDir,'recursive');
Vimset = imageSet(ValDir,'recursive');
imCounter =sum([Timset(:).Count])+sum([Vimset(:).Count]);
Images = zeros([imageSize, imCounter ],'single');
labels = zeros(1, imCounter);
set = zeros(1, imCounter);
% Load and re... |
% implementation based on the function here
% https://github.com/vlfeat/vlfeat/blob/master/toolbox/demo/vl_demo_sift_match.m
run('vlfeat-0.9.20/toolbox/vl_setup')
test = 'image_stitching'; % image_alignment image_stitching
if(strcmp(test,'image_alignment'))
Ia = imread('boat1.pgm');
Ib = imread('boat2.pgm');
... |
function varargout = listselect(varargin)
% LISTSELECT MATLAB code for listselect.fig
% LISTSELECT, by itself, creates a new LISTSELECT or raises the existing
% singleton*.
%
% H = LISTSELECT returns the handle to a new LISTSELECT or the handle to
% the existing singleton*.
%
% LISTSELECT('CALL... |
%upload examples:
%
% Example 1: %%%ref[Log in](steno3d.login), implictly convert a figure, and %%%ref[upload](steno3d.upload) as private
% %%%codeblock
% % Before uploading to steno3d.com you must login. With no
% % parameters, login looks for a saved API key at the default
% % location, ~/.steno... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.