text stringlengths 8 6.12M |
|---|
cd c:/shared/raw ; subs=dir('MONG*') ;
EEG = pop_loadbv('C:\shared\MONG_01_RB\','MONG_01_RB_FIX_BOX.vhdr') ;
EEG = pop_chanedit(EEG,'lookup','C:\eeglab10_0_0_0b\plugins\dipfit2.2\standard_BESA\standard-10-5-cap385.elp') ;
for sb=1:length(subs)
% get the electrode coordinates and perform the inverse transform ... |
% EGB342 Assignment 2B
% b = string_to_bits(str)
%
% Converts a 7-bit ASCII character string into an array of (bipolar)
% bits.
function b = string_to_bits(str)
b = double(dec2bin(str,7))-48;
b = sign(b - 0.5);
b = reshape(b', 1, numel(b));
|
% Bar Properties
plt.bar_width = 0.8;
plt.bar_color = [0.6 0.6 0.6];
% Significance Properties
plt.sig_mrkr = '*';
plt.sig_sz = 50;
plt.sig_yfudge = 0.1;
plt.sig_xfudge = 0.05;
plt.sig_color = [0 0 0];
plt.sig_cut2 = 0.001;
plt.sig_cut3 = 0.000001;
plt.legend = 0;
plt.legend_loc = 'best';
|
function [X,names]=elipcyl
% [X,names]=elipcyl defines elliptic
% cylinder coordinates
syms et ps z real; names=[et ps z];
X=[cosh(et)*cos(ps);
sinh(et)*sin(ps); z]; |
function [W, H] = Block_Division_and_NMF_Implementation(Img,no_region,block_size)
%% This function is intended for dividing the image into blocks, computing
% the histogram of each block, building the data matrix V, and applying NMF
% to ontain W and H factor matrices
% Inputs:
% Img : the original image ... |
## Copyright (C) 2021 Robertson
##
## This program 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, either version 3 of the License, or
## (at your option) any later version.
##
## This program is dist... |
assertEqual = @(x, y) assert(isequaln(x, y));
m = model('test_order_links.model', 'OrderLinks', true);
m.f = 1;
m.d = 10;
%% Test OrderLinks=
m1 = refresh(m);
assertEqual(m1.e, m1.f);
assertEqual(m1.b, 2*m1.f);
assertEqual(m1.a, m1.b+m1.d+m1.e+m1.f);
assertEqual(m1.c, m1.a);
%% Test with Disabled Link
m2 = deacti... |
function XYZ=i_xyy2xyz(xyy)
%I_XYY2XYZ Converts from xyY to XYZ.
% XYZ=I_XYY2XYZ(XYY) with size(XYY)=[M 3] returns matrix XYZ with
% same size.
%
% Remark:
% This is a low level function, that has a rigid parameter passing
% mechanism and no error handling. It is only to be used when the
% ... |
function output = get_gamma_dot_c_Wie2005(t, y, tau_r, config)
% Get the control input for the current state and desired reference moment,
% using the o-DSR method presented in:
% Wie, B., "Singularity Escape/Avoidance Steering Logic for Control Moment Gyro Systems," Journal of Guidance, Control, and Dynamics, Vol. 28,... |
%% Record
%
% Create 2017-10-16
%%
clc;
clear;
FigureIdx = 2017101601
%%
currentPath = pwd;
testImgName1 = 'alphaimg/light11.jpeg';
testImgName2 = 'alphaimg/dark11.jpeg';
% testImgName1 = 'lapimg/apple.jpg';
% testImgName2 = 'lapimg/orange.jpg';
img1 = imread(fullfile(currentPath, testImgName1));
img1 = imresize(img1, ... |
data = load('Rome_classification');
tX = data.X_train;
tX = normalize(tX);
tY = data.y_train;
alpha = 0.07;
beta = logisticRegression(tY,tX,alpha);
ypred = sigmoid(tX*beta)>0.5;
tX1 = tX(ypred == 1,:);
tX2 = tX(ypred == 0,:);
scatter3(tX1(:,1),tX1(:,2),tX1(:,3));
hold on
scatter3(tX2(:,1),tX2(:,2),tX2(:,3));
... |
%% X Ray computed Tomography : Radon Transform
%%
% We use the Shepp-Logan phantom image here
Fxy = phantom(128);
imshow(Fxy);
title('Shepp-Logan Phantom image')
%%
% We will have to shift the coordinate frame to the center since the
% default matlab convention places the origin at one of the edges of the
% image.
|
clear all, close all
addpath('../gp')
addpath('../gpml/')
startup
addpath('..')
[fPrior, prefs, context, samples, forceJerk, ixSlow] = humanFeedbackRobotHandover();
% sampleMean = mean(samples, 1);
% sampleStd = std(samples);
% samples = bsxfun(@minus, samples, mean(samples, 1));
% samples = bsxfun(@rdivide, samples,... |
%Suppose UAV flies along a path which is a circle.
%The center of the circle is at (ox,oy,oz), the radius of the circle is
%represented by r; and target is centering at (xt,yt,zt). the simulation is
%firstly to show the performance of conventional target location method
%without considering the influence of plane ... |
%% pointSetDistMap
% Below is a basic demonstration of the features of the |pointSetDistMap| function.
%%
clear; close all; clc;
% PLOT SETTINGS
fig_color='w'; fig_colordef='white';
markerSize1=5;
markerSize2=5;
lineWidth=2;
fontSize=10;
faceAlpha=0.8;
%% DEFORMING A 2D MESH
% SIMULATING A 2D EXAMP... |
function makefigures
% makes figures by opening original step data files
close all;
setenv("GNUTERM","x11")
colorgreen = [0, 102, 51]/255;
purple = [153, 51, 255]/255;
violet = [102, 0, 204]/255;
orange = [255, 128, 0]/255;
midgray = [160,160,160]/255;
epsilon = 1e-10;
plot_deformed_flag = false;
%----------------... |
function Show_Curvelets_boundaries(f,Bw,Bt,option)
%=======================================================================
% function Show_Curvelets_boundaries(f,Bw,Bt)
%
% This function plots the angular sectors corresponding to the
% detected scales and angles in the 2D spectrum.
%
% Inputs:
% -f: input image
%... |
function [vH] = proj(v,m,n)
%PROJ Projection onto gi=0-plane
% Projection of a vector onto the H-plane
% described in section 2.3 of the paper, equation (2.17)
vHp=zeros(2*m*n,1);
for i=1:2*n
s=0; %the scalar product
for j=0:m-1
s=s+v(j*2*n+i);
end
for j=0:m-1
vHp(j*2*n+i)=s;
en... |
function [obj,R_b,R_ir,FC_bc,m_fCHP,m_fB,Q_CHP,Q_B,DeltaQ_S,Q_S,E_CHP,E_ir,E_b,ON] = GAMSREAD(time_i,sample_q,N,S,sample_i)
% Objective
rs.name = 'obj';
r = rgdx ('results', rs);
obj=r.val(:,1);
% Bidding revenue
rs.name = 'R_b';
r = rgdx ('results', rs);
R_b(time_i,1)=r.val(time_i,2);
% Imbalance reduction revenue
... |
load('Orlinit.mat'); %载入数据:A:原始数据矩阵,10304*400;Y:分类下标,400*1,一个人有十张脸部图片,图片的尺寸为 112*92
[M,N] = size(A); % M*N 为矩阵A的维数
A_new = A; % 给一部分(80%)照片加随机遮挡规格为 30*40
for i=1:400
if mod(i,10) < 3
continue;
end
a = A(:,i);
face = reshape(a,112,92);
lm = round(80*rand)+1;
ln = round(50*rand)+1;
face(lm:lm+... |
%% Solution to Exercise 1 of TP0 (Matlab Programming Basics)
clear all;
close all;
clc;
%% 1) Load Image Dataset and Visualize images
%% 1st way of loading images (using dir function)
% Path of Dataset Folder
dataset_path = './TP0_Image_Dataset';
% Search for file names within folder
imagefiles = dir([... |
rng(500);
colors = ['b','r','c','g','m'];
markers = ['o','.','*','+','x'];
load('hw5_blob.mat');
for k = [2,3,5]
r = kmeans(points,k);
scatter(points(find(r==1),1),points(find(r==1),2),[],colors(1),markers(1));
hold on;
for i = 2:k
scatter(points(find(r==i),1),points(find(r==i),2),[],colors(i)... |
% open matlab data file
fid = fopen('HITS_PageRank_IQ_Matlab.out');
% get title line
tline = fgetl(fid);
% get data
[A, count] = fscanf(fid, '%g', [11 inf]);
% compute completeness score
completenessScore = 0.4 * A(9, :) + 0.6 * A(10, :);
% compute reputation score
reputationScore = 0.2 * A(2, :) + 0.2 * A(3, :) +... |
%data = dlmread('2014-12-22 20-13-52.txt'); % Stable measurements
data = dlmread('2014-12-22 16-37-55.txt'); % Unstable measurements
j = 1;
pairedData = zeros(length(data),6);
% pairedData = [timeSyncError, beaconPeriod, drift, skew, temp, seq, timestamp]
for i = 1:length(data)-1
if ((abs(data(i,7) - data (i... |
function [outImage] = plotVisual(inVol,eccVol,polVol,roiInd,axLim,vArea)
% Plots values from an input volume in visual field coordinates
%
% Usage:
% [outImage] = plotVisual(inVol,eccVol,polVol,roiInd,axLim,vArea)
%
% See also:
% convert_image2surf
%
% Written by Andrew S Bock Mar 2016
%% to do
% create a v... |
function [index hot radius] = renorm_rand_dip(cfg, limsup, liminf, vertices, ico, go)
if nargin < 6, go = false; end
totalndips = size(cfg.dip.pos,1);
index = [];
while (size(find(index),1) < 2)
index = false(totalndips,1);
one = ceil(totalndips * rand(1,1)); % two random dipoles
index(one) = 1;
radiu... |
summ = 0;
for i = 1 : numel(s1)
if s1(i) > 230
summ = summ + 1;
end
end |
function gamI = invertGamma(gam)
N = length(gam);
% x = [1:N]/N;
x=[1:N]/(N);
% xx=[1:N-1]/(N-1);
gamI=interp1(gam,x,x,'linear');
% gamI = spline(gam,x,x);
% idx=find(gamI>1);
% gamI(idx)=1; |
function z = arraymult( x, y, varargin )
% ARRAYMULT multiply 3d array with matrix/vector
% Multiplication with vector reduces dimensionality
% Only two types of post-multiplication have been defined
% Compare with mmult.m
isarray = @(a)(length(size(a)) == 3);
dotmult = nargin == 3 && varargin{1} == 2;
if isarray(x)
... |
clear all;
absolPath = "/var/tmp/dataset/ILSVRC/";
dataPath = "Data/CLS-LOC/";
gtPath = "ImageSets/CLS-LOC/";
dataPathid = ["test/" "train/" "val/"];
gtPathid = ["test.txt" "train_cls.txt" "val.txt"];
fid =fopen(strcat(absolPath, gtPath, 'random50k.txt'), 'w');
gtid= fopen(strcat(absolPath, gtPath, 'merg... |
function pretty_print_results(labels, detections)
give_factor = 5;
linger_factor = 6;
[bl,bd,el,ed] = frames_to_sequences(labels, detections, give_factor);
fprintf('\nBlink beginning and end (frame number)\n')
fprintf('--------------------------------------\n')
fprintf('Beginning TRUE '),fprintf('%i ',bl)... |
% *************************************************
% Sammy Robens-Paradise,Cindy McGinnis, Mary McPhee
% Cochlear Implant, SYDE 252
% ************************************************
% get names of all .wav files in the "Input Sounds" folder
% NOTE: If you are running this on a UNIX based system them
% you will need ... |
function [h, p, stat] = test2DEquality(x1, w1, x2, w2, type)
% [h p stat] = test1DEquality(mcVar, exVar, type)
%
% types: kolm-smirn-2D
%
alpha = 0.05;
if strcmp(type,'kolm-smirn-2D')
[h, p, stat] = test_wKS2s2d(x1, w1, x2, w2, alpha);
else
error('Wrong type of test.')
end |
clc; clear; close all
pkg load image
A = imread('files/baby_yoda.jpg');
subplot(1, 2, 1)
imshow(A)
% Crear la máscaras del operador de Sobel
Bx = [-1 -2 -1; 0 0 0; 1 2 1];
By = [-1 0 1; -2 0 2; -1 0 1];
A = im2double(A);
Cx = conv2(A, Bx, 'same');
Cy = conv2(A, By, 'same');
C = sqrt(Cx.^2 + Cy.^2);
C = ... |
function masks = create_masks_from_mni(file_prefix, mni, do_create, sphere)
% create spherical masks around MNI coordinates
%
% file_prefix: prefix of the mask filenames where to save them
% mni: [n x 3] list of MNI coordinates
% do_create: whether to actually create the files (or just generate th... |
clear
clc
comeP = 0.5;
comeS = 0.5;
serveP = 0.5;
serveSingleS = 0.1;
k = 5;
blockRatio = getBlockRatio(comeP,comeS,serveP,serveSingleS,k);
interruptRatio = getInterruptRatio(comeP,comeS,serveP,serveSingleS,k);
avgLength = getAvgLength(comeP,comeS,serveP,serveSingleS,k);
avgDelay = getAvgDelay(comeP,comeS,serveP,serveS... |
clear; clf;
out=load('out'); % load the data file out
t =out(:,1); % time
xp=out(:,2); % the position of the primary star
yp=out(:,3);
xs=out(:,4); % the position of the secondary star
ys=out(:,5);
Ep=out(:,6); % the energy of the primary star
Es=out(:,7); % the energy of the secondary star
plot(xp,yp,'DisplayName'... |
% note:
% t is just time, for example, from 0 to T, its length should be the same with dataIn
% Y must be a N X M matrix
function XYZlmts = decideAxisRange(t, Y, extension)
yMax = Y(1,1);
yMin = Y(1,1);
dataSets = length(Y(:,1));
dataLen = length(Y(1,:));
for i = 1 : dataSets
for j = 1 : dataLen
if yMax < Y... |
function Korrespondenzen = korrespondenzen(I1,I2,Mpt1,Mpt2,varargin)
%% Input parser
P = inputParser;
% Fenstergroesse
P.addOptional('window_length', 25, @(x) isnumeric(x) && x>1 && rem(x,2)==1 );
% Unterer Schwellwert fuer die staerke der Korrelation zweier Merkmale
P.addOptional('min_corr', 0.... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Importance Sampling - Parallel Dynamic Programming (IS-PDP) Toolbox
%
% This toolbox purpose is to solve the curse of dimensionality of multi-reservoir
% impoundment operation, in an example of three-reservoir system (Li-Yuan,A-hai,
%... |
function datastruct = fitF0smoother (datastruct, widthfactor)
% if matlab pool is running, movies are processed in parallel, otherwise
% it is done in serial order.
if matlabpool('size') == 0
matlabpool open
end
if nargin<2
%Timescale over which to look for a local minimum
widthfactor = 20;
end
if ~isstr... |
function update_forces(obj)
switch (obj.kinetic_scheme)
case '3state_with_SRX'
bin_pops = obj.myofilaments.y(2+(1:obj.myofilaments.no_of_x_bins));
obj.cb_force = ...
obj.parameters.cb_number_density * ...
obj.parameters.k_cb * 1e-9 * ...
sum(... |
clc
close
clear
x=5;
y=6;
z=3;
% the shorter route is on the longer side. not on the shorter side
% s=linspace(0,y,1000);
% a = (x^2 + (y-s).^2).^.5;
% b = (s.^2 + z^2).^.5;
% min(a+b)
% longer side can be done w/ above by putting y greater than x
s=linspace(0,y,1000);
a = (x^2 + (y-s).^2).^.5;... |
txt_dir='/home/scw4750/github/IJCB2017/liufeng/without_3d/bbox/probe';
all_txt=dir('/home/scw4750/github/IJCB2017/liufeng/without_3d/bbox/probe/*/*.txt');
img_dir='/home/scw4750/github/IJCB2017/liufeng/without_3d/probe';
output_dir='/home/scw4750/github/IJCB2017/liufeng/without_3d/probe_croped';
for i=1:length(all_txt... |
function char_codes
for ii = 33:126
fprintf('%d:%s\n',ii,char(ii));
%fprintf('%s',char(ii));
% fprintf('%s\n',char(ii));
end
fprintf('\n'); |
function L = alm_mc(M, nil)
% ALM method for matrix completion
m = size(M, 1);
n = size(M, 2);
S = zeros(m, n);
Y = zeros(m, n);
nil_values = (M == nil);
M(nil_values) = 0;
% According to starting mu of paper, setting mu = mu_0 of paper
mu = 0.5/norm(sign(M));
mu_inv = 1/mu;
max_iter = 150;
max_time = 300; % sec... |
function [ f ] = plotTrained2dModel( model, N, maxVal, minVal, savePath, fig, Xbw, Ybw)
if nargin < 3
maxVal = 5;
end
if nargin < 4
minVal = -maxVal;
end
if nargin < 5
savePath = 0;
end
if nargin < 6 || fig == 0
fig = figure;
end
if nargin < 7
Xbw = 0;
end
if nargin < 8
Ybw = 0;
end
if ... |
function clearBuffers
% clear mouse and keyboard buffers
[Mx My Mb]=GetMouse;
while KbCheck | ~all(Mb==0)
[Mx My Mb]=GetMouse;
end |
clear
clc
set=input('Please Enter Your Set: ');
sizeSet=size(set,2);
subsetBody=zeros(1,sizeSet);
output=findSubset(subsetBody);
sizeOutput=size(output,1);
disp('Perms: ');
disp(output);
disp('Subsets: ');
output=logical(output);
for i=1:sizeOutput
disp(set(output(i,:)));
end
disp('Number of Subsets: ');
disp(size... |
TestVideoFile = {};
TestVideoFile{end+1}.gt_frame = [60:152];
TestVideoFile{end+1}.gt_frame = [50:175];
TestVideoFile{end+1}.gt_frame = [91:200];
TestVideoFile{end+1}.gt_frame = [31:168];
TestVideoFile{end+1}.gt_frame = [5:90, 140:200];
TestVideoFile{end+1}.gt_frame = [1:100, 110:200];
TestVideoFile{end+1}.gt_fr... |
%% load data
%cd('C:\Users\Mirone\Desktop\Aarhus Uni\Dropbox\Exe\Exe_matlab')
clc; clear; close all;
anatomical=csvread('anatomical.csv',1,1);
anatomical=reshape(anatomical,256,256,256);
%% show image
S=input('Choose slice for the analysis S:\n');
imagesc(anatomical(:,:,S));
%% Extract data for analysis
... |
function hor200meV_script_test_reduced
%==================================================================================================
% Script to create sqw file
%==================================================================================================
% Give locations of input files
indir=pwd; % sour... |
function [ newcoord, newele, neweleCentre, neweleQT, neweleSize, neweleMat ] ...
= qt_remove_phantom(coord, ele, eleCentre, eleQT, eleSize, eleMat, mat)
pmat = cellfun(@(a)a.phantom, mat);
truelem = pmat(eleMat) == 0;
neweleCentre = eleCentre(truelem,:);
neweleQT = eleQT(truelem,:);
neweleSize ... |
function featVec = selectBoundaryFeatures(featStruct, boundaryInd, varargin)
%% Parse arguments
defaultArgs = struct(...
... Sp-based features
'IntMin', 0, 'IntMinNorm', 0, ...
'RGBMin', 0, 'RGBMax', 0, 'RGBRatio', 0, 'RGBDiff', 0, ...
'RGBMinNorm', 0, 'RGBMaxNorm', 0, 'RGBRatioNorm', 0, 'RGBDiffNorm'... |
function output = gaussian_blur(filename, sigma)
%% Appplies a gaussian blur filter on the input image
%% Reading the image
img = imread(filename);
img = im2double(img);
% Size of the image
[m,n] = size(img);
%% Building the filter
% Sigma is the intensity of the blur specified by the user
filter = fspecial('gaussian... |
% Function to load SSA data, combine with QBs and then run IFS
function outIFS = combineDataIFS(SSAname, runs, runsdiv, folder, fileRoot)
% Assumptions and modifications
% - based on threshPeakDetectFn3
% - getQBSSAStream assumes QBdiv[num] and gives QBpcs[num] and data folder
% - assumes process of interest is an IPP... |
function [ Sim_Struct ] = Create_Kernels( Sim_Struct, Verbosity )
% ------------------------------------------------------------------
% ------------ Create_Kernels --------------------------------------
% ------------------------------------------------------------------
% ------ Creates Gaussian, Larsson, Sourbron a... |
function [pc,rpc,ev,rev] = wavePCA(cv)
%
% [pc,rpc,ev,rev] = wavePCA(cv)
%
% Principal Component Analysis of standardized waveforms from a
% given (unstandardized) waveform covariance matrix cv(nSamp,nSamp).
% If input is a cell array of covariance matrices the outputs are
% corresponding cell arrays.
%
%
%... |
function [ D, imDims, L0, S0, GTidx ] = loadTensor( data, varargin )
%% Loads data from a mat file stored a tensor of w * h * n dimensions
%
% Author: Vahan Hovhannisyan, 2017.
dataX = data.X;
if isfield(data, 'GTidx')
GTidx = data.GTidx;
else
GTidx = ':';
end
if isfield(data, 'GT')
dataGT = data.GT;
e... |
im = imread('abc.jpg');
for i = 1:size(im,1)
for j = 1:size(im,2)
image(i,j,:) = im(i,j,:) + 50;
end
end
subplot(1,2,1),imshow(im)
subplot(1,2,2),imshow(image) |
%% reject_IC_semi_automatic works with 05_ERP_esports_data_after_ICA folder:
% - use SASICA plugin to visualize components and their properties
% - mark ICs not related to brain activity
CFG = define_defaults();
answer = questdlg('Would you like to review Independent Components manually?', 'Review ICs manually', ...
... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%problem 10- Energy spectral density
% x(t)=exp(-3t)u(t)
%Fourier Transform of autocorrelation
syms t w r
x=exp(-3*t)*heaviside(t);
x1=x;
x_2=subs(x1,t,t-r);
x2=conj(x_2);
R=int(x1*x2,t,-inf,inf)
A=fo... |
function bb=finish_learn(bb)
% bb=finish_learn(bb)
%
% clear some variables
% G. Raetsch 10.12.99
% Copyright (c) 1998,1999 GMD Berlin - All rights reserved
% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD FIRST Berlin
% The copyright notice above does not evidence any
% actual or intended publication o... |
% MVLMCLRC.M
% Script to clear menu figure
% Reset menu offset incr
mmgmincr = mmgmincr - 1 ;
% Get rid of local variables
clear mvldtxtv ...
mvlem mvlemtxt mvlet ...
mvlfn mvlfntxt mvlfntxtv mvlfnv ...
mvlmclr mvlnp mvlpi mvlpntxt ... |
function Brain_window_tight(hObject, eventdata, handles)
window=[-10 90];
% Display HELP and get out of callback
if imlook4d('DisplayHelp', hObject, eventdata, handles)
return
end
% Set window level
imlook4d('setColorBar',guidata(gcf),window ) |
%=========================================================================
%
% Estimate an artificial neural network by maximum likelihood
%
%=========================================================================
function nlm_ann( )
clear all;
clc;
% Initialise the random number generator
... |
function [] = examplefebruary2013()
warning off
set_path_had
ds = csvread('/datas/xlan/hours/akamai/datasets/02082012_02112012.dir/csvfiles/psql_output_0802_1102_without_loss_cache.csv',1,0);
time_distance_rtt = ds(:,[1,2,4]);
[X,Y,Zlin,Zcub,Zv4,Znr,Zlinflatten,Zcubflatten,Zv4flatten,Znrflatten] = extrapolate(time_dist... |
%Code to Process Merged Filter Data Sheets for SPARTAN Sites
%Written By Paul Bissonnette (Paul.Bissonnette@dal.ca)
%Feb 23, 2018
%-----------------------------------------------------------------------%
%Input file: SITE.xlsx for example (CHTS.xlsx)
%Output files: PM25_Site.csv for example (PM... |
num = [31,30,31,31,29];
year = 2038;
Temperature = null(152);
lat = 16;
lon = 31;
n = 1;
for i = 5:9
for k = 1:num(i-4)
if k > 9
filename21 = ['E:/output/',num2str(year),'/wrfout_d04_',num2str(year),'-0',num2str(i),'-',num2str(k),'_','21_... |
function[] = plot_error_shade(hax,x_mean,x_error,x_col,y_mean,y_error,y_col)
x_alpha = 0.2;
y_alpha = 0.1;
if size(x_mean,1)<size(x_mean,2)
x_mean = x_mean';
end
if size(y_mean,1)<size(y_mean,2)
y_mean = y_mean';
y_error = y_error';
end
if ~isempty(y_error)
x_vector = [x_mean; flipud(x_... |
%% This script runs through all of the photos in a given folder
% and produces a clustering and a mat file. Note that on line 4, the folder path may need to be changed.
folder_path = 'Rotated_and_Cropped/';
dirstr=pwd; % A string with the current directory
filestr=strcat(folder_path,'*.JPG');
pic_files = dir(filestr)... |
function RM = mkSRotationMatrix(psi);
%MKSROTATIONMATRIX(PSI) coordinate transformation matrix
% that describes s-rotation of the ELEMENT
%
% | cos(psi) 0 sin(psi) 0 0 0 |
% | 0 cos(psi) 0 sin(psi) 0 0 |
% | -sin(psi) 0 cos(psi) ... |
function S = SignaltoNoise(C1,C2)
% function S = SignaltoNoise(C1,C2) calculates the signal to noise ratio in
% the network. Where:
%
if isobject(C1)
a1 = sum(sum(C1.O));
a2 = sum(sum(C2.O));
else
a1 = sum(C1);
a2 = sum(C2);
end
%S = a1 / (a1 + a2);
S = 1 - (a2 / a1);
if S > 1
S = 1;
elseif S < 0
... |
function CovarsHori
loadsubj
Drug = cell2mat(subjlist(:,3));
RT = cell2mat(subjlist(:,4));
Hits = cell2mat(subjlist(:,5));
Hori = cell2mat(subjlist(:,6));
figure('Color','White');
for i = 1:2
subplot(2,2,i)
if i == 1
f = fit(Drug(Drug > 0),Hori(Drug > 0),'poly1');
plot(f,Drug(Dru... |
function [ke,fe] = domain1(xi, eta, coord, k, Q)
x = coord(:,1);
y = coord(:,2);
alpha = 1 - xi - eta ;
ddmat = [4*xi - 1, 0, 1 - 4*alpha, 4*eta, -4*eta, 4-8*xi-4*eta;
0, 4*eta - 1, 1-4*alpha, 4*xi, 4-8*eta-4*xi, -4*xi];
J = ddmat*coord;
N = [xi*(2*xi -1), eta*(2*eta - 1), alpha*(2*alpha - 1), 4*xi*eta, 4... |
m = input(inline(),t)
print(m) |
%% Linear Algebra MATLAB Exercises
% Chapter4: #1
clc; clear all;
W = triu(ones(4));
x = 1:4; x = x';
F = [W(:,1), W(:,2), W(:,3), W(:,4)];
%% Exercise 1 (a)
disp('Exercise 1-(a)');
A_F = [0 0 5 1;
1 0 4 2;
0 1 3 3;
0 0 2 4];
disp('the matrix A representing L with respect to F ');
disp(A_F);
%... |
% Covariance functions to be use by Gaussian process functions. There are two
% different kinds of covariance functions: simple and composite:
%
% 1) Elementary and standalone covariance functions:
% covZero - zero covariance function
% covEye - unit covariance function
% covOne - unit constan... |
function A = shift( A, shiftsize, varargin)
%SHIFT Shifts the array A noncircularly,inserting 0s (or, if specified as 3rd argument, something else) into empty spaces
if nargin == 3
ins = varargin{1};
else
ins = 0;
end
if ~issparse(A)
sparse_mat = 0;
else
sparse_mat = 1;
end
%Dont do unnecessary dimshifts, th... |
clear all;
initialize_folder_names;
filename=strcat(DATA_FOLDER,'physics_constants.mat');
load(filename);
mr=mDT*mHe/(mDT+mHe);
filename=strcat(DATA_FOLDER,'pressure_profile.mat');
load(filename);
filename=strcat(DATA_FOLDER,'motions_map_dimensions.mat');
load(filename);
%pause
close all
mHe=mD
ZHe=1
% Main importa... |
function [T,I,Y]=naivePerfusionResponseIVP2X4Stack2(ton,toff,Ttot)
ode=modelODEP2X4Stack2(ton,toff);
naive=zeros(33,1);
naive(1)=1;
setAuxiliaryP2X4Stack2(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:33,'MaxStep',0.01));
I=getTotalCurrentP2X4Stack2(Y);
end |
function printfile()
% AvgNDCGSquaredGain=importdata('E:\Papers\Programs\Yandex\SquaredNDCG10.txt','\n');
% AvgNDCGSvmGain=importdata('E:\Papers\Programs\Yandex\SvmNDCG10.txt','\n');
% AvgNDCGKLGain=importdata('E:\Papers\Programs\Yandex\KLNDCG10.txt','\n');
% AvgNDCGSmoothGain=importdata('E:\Papers\Programs\Yandex\... |
%%%%% Question 1 %%%%%%
filename = 'u.data';
delimiterIn = ('\t');
u= dlmread(filename, delimiterIn);
num = size(u,1);
%Creating an empty matrix R initialized with zeros
R = NaN(943,1682);
W = NaN(943,1682);
%Storing the values in R from the Dataset
for i=1:num
R(u(i,1),u(i,2)) = u(i,3);
W(u(i,1),u(i,2)) = 1;
e... |
function plot_preprocessing(ex)
% visualize the effects of preprocessing
% - stimulus triggered LFP
% - power of it
% - spike triggered LFP
% - power of it
close all;
h = figure;
ncol = length(ex.Trials(1).preproLFP);
N = length(ex.Trials);
disp(['The number of trials: ' num2str(N)])
% visualize
for c = 1:ncol
... |
function pressure = pressureeqn(P,timex)
% P(1) = Po
% P(2) = P1
% P(3) = tau
pressure = (P(1) - P(2)) * exp((-timex/P(3)) + P(2));
end
|
function [DATA, ARRAY_MICS] = readArray2Data(file_path, remove_mic, calib, calib_file_path)
% ---------------------------------------------------
% Reading array data for TU Delft acoustic arrays
% Author: Anwar Malgoezar
% Date: 2-12-2016
% ---------------------------------------------------
fprintf('\t------... |
function [L,x0,y0] = Resection(Pts)
%Step 1. Initialize L0 & x0,y0
x0=0;
y0=0;
x0_last=x0;
y0_last=y0;
%1.1 Initialize L
L=Initialize_L(Pts);
%1.2 Initialize x0 y0
[x0,y0]=Update_InteriorElement(L);
%Step 2. Iteration
equationNum=size(Pts,1)*2;
M=zeros(equationNum,15);
W=zeros(equationNum,1);
% 2.1 first iteration... |
function [ Y ] = classify2( model, X )
centroids = model.centroids;
whitener = model.whitener;
mean = model.mean;
normalize_mean = model.normalize_mean;
normalize_std = model.normalize_std;
svm = model.svm;
X = double(X);
features = generate_descriptor(X, centroids, mean, whitener)... |
function opts=SIN_TestSetup(testID, subjectID)
%% DESCRIPTION:
%
% Function to return test information. This will vary based on the test.
% Alternatively, this can also return a list of available tests
% (default).
%
% INPUT:
%
% testID: string, test identifer. Or, if the user wants to return a
% ... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% Impulse response
% H(s)=10/(s^2+2s+10)
n=10;
d=[1 2 10]
H=tf(n,d);
impulse(H)
%second way
figure
syms s t
H=10/(s^2+2*s+10);
h=ilaplace(H,t);
t=0:.1:6;
h=subs(h,t);
plot(t,h)
leg... |
function [meanV, covarianceV, transformX, transformY] = mpcca(X, Y, dimZ, numComponents, maxIterations)
%MCCA apply mixture probabilistic CCA method on multi-view problems
% using EM algorithm
%INPUT:
% featureX (dimX x numSamples) : View 1
% featureY (dimY x numSamples) : View 2
% dimZ : dimension of shared space for... |
function p = stop(p)
%pds.newEraSyringePump.stop stop dispensing
%
% p = pds.newEraSyringePump.stop(p)
%
% jk wrote it 2015
if p.trial.newEraSyringePump.use
%get current given volume and store
h = p.trial.newEraSyringePump.h;
IOPort('Write', h, ['STP' p.trial.newEraSyringePump.commandSepa... |
%a=ExtrKNN_Score(Datainput,DataLabel,RatioSet,blosumnum);
%Datainput='VATEEKKETSNKSSSSSPSASPAGLNCDPEVKE';
Datainput={
'IANQAVPFSACTMLLDSEVYNMPLESQGDENKS'
'AKQGDTILVSGMKTGSSKLKARIQEAVYKNVRP'
'TMQTLTKQDTMLKAMFSGRMEVLTDSEGWILID'
'FDTLSLDSSDSMETSISACSPDNISSASTSNIA'
'LGQQPMTELDSSSDLISSPGKKGAAHPDPSKTS'
'ATVIERANQVYREFLKSSDGI... |
% R = CREATERESPONSEMATRIX(I, wsize, k)
%
% Creates the cornerness response matrix of an image
% using a window of size (2*wsize+1)*(2*wsize+1) and constant k
%
% The cornerness response at point (i,j) is given by:
% det(M)-k*(trace(M))^2
% where matrix M contains derivatives of image I in
% a specific window around ... |
function test_example_SAE
load mnist_uint8;
% why divided by 255? normalization
train_x = double(train_x)/255;
test_x = double(test_x)/255;
train_y = double(train_y);
test_y = double(test_y);
%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN
% Setup and train a stacked denoising autoencoder (SD... |
function flag=LMI_Aut16_th3(A,B,C,K,L,h,r0,etaM,alpha)
% This MATLAB program checks the feasibility of LMIs from Theorem 3 of the paper
% A. Selivanov and E. Fridman, "Observer-based input-to-state stabilization of networked control systems with large uncertain delays," Automatica, 2016.
% The program uses YALMI... |
%Deal with apd files to use the shape only. Generate SecDtimefile, for each
%second, collect dtime data accordign to dataset calculation (use
%rowrange). SecDtime file contain 3 columns, first one is dtime in each
%time range, the second is distribution of dtime in that second in edge
%1:6252, third column is intensity... |
function model = fct_w_a_geostrophic_stochastic_kriging(recompute_kriging)
%% Algorithnm parametrisation
model.error_obs_h=true;
model.kriging.param_estimated_by_MLE=false;
model.plot_high_kriging=false;
% recompute_kriging=true;
% recompute_u=true;
model.model_order=-1;
% recompute_kriging=false;
model.obs_local=fal... |
function CreateCutterWindow(self)
% MClustCutter.CreateCutterWindow
MCS = MClust.GetSettings();
MCD = MClust.GetData();
self.CreateCutterWindow@MClust.Cutter(); % call superclass to build initial window
%--------------------------------
% constants to make everything identical
uicHeight = self.uicHeight;
uicWidth ... |
function S2 = NewAnswer(S1)
%% 输入
% S1:当前解
%% 输出
% S2:新解
N = length(S1);
S2 = S1;
a = round(rand(1,2)*(N-1)+1); %产生两个随机位置 用来交换
W = S2(a(1));
S2(a(1)) = S2(a(2));
S2(a(2)) = W; %得到一个新路线 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.