text stringlengths 8 6.12M |
|---|
function highLowRelation( ticks )
%HIGHLOWRELATION 在command中输出,ticks中的last较bid、last较ask的高低关系
% 一共统计6个量,last=bid, last>bid, last<bid ; last = ask, last>ask, last<ask
% @luhuaibao
% 2014.6.3
if ~isa(ticks, 'Ticks')
disp('错误:数据类型必须是Ticks');
return;
end
if isempty(ticks.latest)
n = length(ticks.last);
... |
clf; clear; clc; min = 60; %clear figure, workspace and command window
%Experimental conditions
s = 0.4/60; % variable to set the space velocity in sec-1. standard is 0.4
v = 1500; % variable that defines reactor volume in uL
Temperature = 24; % variable ... |
function figh = ctaptest_plot_bad_chan(EEGprepro,chinds,varargin)
p = inputParser;
p.addRequired('EEGprepro', @isstruct);
p.addRequired('chinds', @isnumeric);
p.addParameter('context', '', @ischar);
p.addParameter('savepath', '', @isfolder);
p.parse(EEGpre... |
function phalpressurep(varargin);
% phalpressurep( [...] );
% Pressure P
h = timeplot({'SD1_P','SD2_P','LabDuctP'}, ...
'Pressure P', ...
'P', ...
{'SD1\_P','SD2\_P','LabDuctP'}, ...
varargin{:} );
|
function H = modulation(omega,amplitudes,phis,time)
%MODULATION calculate time-series envelope of two cosines.
%
% envelope = modulation(w,A,phi,t)
%
% calculates analytically the envelope time series h(t) of
% two cosines at times t:
%
% h(t) = A(1)*cos(w(1)*t - phi(1)) + A(2)*cos(w(... |
function [h,T,perm,theGroups] = wtbxdendrogram(Z,varargin)
%WTBXDENDROGRAM Generate dendrogram plot.
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 26-Jun-2006.
% Last Revision: 20-Jul-2010.
% Copyright 1995-2010 The MathWorks, Inc.
% $Revision: 1.1.6.2 $ $Date: 2010/08/11 14:38:48 $
m = size(Z,1)+1;
p = v... |
function params = DCDefParams(params)
if (~isfield(params,'dispsnips'))
params.dispsnips = 50;
end
if (~isfield(params,'ACTime'))
params.ACTime = 0.01;
end
if (~isfield(params,'NSpikes'))
params.NSpikes = 1000;
end
if (~isfield(params,'NNoise'))
params.NNoise = 2000;
end
if (~isfield(params,'BlockSize'))
params.Bl... |
clear all ; close all ; clc ;
nt1_MI=1; nt2_MI=728;
load('C:\Users\tkalra\Desktop\Observationaldata\Matanzes_Inlet\Matanzes_Inlet\matfiles\skewness_steve_MI_depth_corrected.mat',.....
'Su_skewness','dn');
% FETCH VSPEC DATA
wh_MI=fullfile('C:\Users\tkalra\Desktop\Observationaldata\Matanzes_Inlet\Matanzes_Inlet\MI... |
function Vec = RandIntGen(min, max, length)
% Vec = RandIntGen(min, max, length)
% Inputs: min, max, length, where, min < max are integers,
% and length is a positive integer.
% Output: Vec, a vector with length components that are
% radomly generated integers in the range min <= k <= max
Vec = min + floor((max+1-mi... |
function [grampc,Tsim,grampc_sdata] = initData()
% This function initializes a grampc struct in MATLAB and sets parameters
% and options. In case of three output arguments the struct grampc_sdata for
% the use in Simulink is created as well. Define all options and parameters
% for the use of GRAMPC in MATLAB here.
%
%... |
classdef Segmentation
methods(Static)
function maskIndices = convex2D(img, pixelPitch, opt)
assert(all(isfield(opt, {
'sigma1' 'sigma2' 'min_area' 'max_area' 'max_eccentricity' 'min_rel_intensity'
})), 'missiong options')
original = i... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MODULE: Build Tree
% function to build heiarchichal structure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function build_tree(qImage,nr1,nr2,winnerNeuron,winnerKeyFrame,finalFrameBMU,gTruth,neuron_KeyFrame,key... |
% DISP テキストとしてLaurent多項式オブジェクトの表示
%
% DISP(P) は、多項式名 (ここでは P として) を印字するためにLaurent多項式 P を
% 表示します。
% DISP(P,VarName) は、多項式名として "VarName" を使います。
%
% 例題:
% P = laurpoly(1:3,0);
% disp(P)
% disp(P,'Poly')
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 19-Mar-2001.
% Last Revision 08-Jul-2003.
% C... |
function fig2_par_sweep(Fig2ax,linewidth,fontsize)
%This script plots the mean growth and CVs for figure 2
load('large_multicell_sweep.mat')
max_growth = 25*100/(1+1);
colors = [0 0 0;...
230 159 0;...
86 180 233;...
0 158 115; ...
240 228 66;...
213 94 0;...
204 121 167]/255;
%% Plot growt... |
function [ Q, R , R1,P ] = qrpivotingg( A )
% Implement the givens trasnformation QR solution for matrix A(m x n)
%
% Return Q
% Return R
%
R=A;
[m,n]=size(R);
R1=zeros(n,n);
if m < n
fprintf('The matrix length %d is not greater than its width %d ',m,n);
exit;
end
Q=eye(m);
P=eye(n);
%vector to keep track of... |
function sanity_check
% sanity_check - Sanity checks the implementation of PCA and LDA on
% different datasets
% include PCA and LDA
addpath ./lib
for dataset=0:1
% load the dataset
[fea, gnd, ~] = load_dataset(dataset);
figure;
for mode=1:3
% split the dataset
[fea_Train, ~, gnd_Train, ~] = split_dat... |
function [time, freq, amp, window, step] = fft_sl(tx,xx, window, step, minf, maxf)
% Do sliding FFT of xx(tx) with some window and step.
% Parallel calculations are used.
%
% -- slazav, feb 2012, dec 2013.
if nargin < 3 || window<=0; window=floor(length(tx)/100); end
if nargin < 4 || step<=0; step=floor(wind... |
% This is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation, either version 3
% of the License, or (at your option) any later version.
%
% This is distributed in the hope that it will be useful,
% but WITHOUT... |
% PLOTBEARTH Plot the Earth's magnetic field lines using the IGRF.
%
% Plots a globe and a number of magnetic field lines starting at each point
% specified by the vectors in lat_start and lon_start. Both distance and
% nsteps should be the same length as lat_start. The plot will spin if spin
% is true and will c... |
function [xp,xm] = quadform(a,b,c)
if(b<0)
xp = (-b+sqrt(b.^2-4*a*c))/2.*a;
xm = c./(a.*xp);
else
xm = (-b-sqrt(b.^2-4*a*c))/2.*a;
xp = c./(a.*xm);
end |
function [J, grad] = costFunctionReg(theta, X, y, lambda)
%COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
% J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
% theta as the parameter for regularized logistic regression and the
% gradient of the cost w.r.t. ... |
function [ broj ] = raspakuj_izlaz( vektor )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if vektor == [0;0;0;0;0;0;0;0;0]
broj=0;
elseif vektor == [1;0;0;0;0;0;0;0;0]
broj=1;
elseif vektor == [0;1;0;0;0;0;0;0;0]
broj=2;
elseif vektor == [0;0;1;0;0;0;0;0;0]
broj=3;
e... |
SVMModels = cell(3,1);
classes = unique(label);
for j = 1:numel(classes)
indx=(label==classes(j));
SVMModels{j} = fitcsvm( pr(:,[1,3]),indx,'ClassNames',[false true],'KernelFunction','rbf','Standardize',true);
end
|
%function freq_resp_plot(varargin)
%
%use freq_resp_plot(filename) when calling from the matlab command line
function freq_resp_plot(varargin)
if(nargin==7)
freq=varargin{1};
amp=varargin{2};
phi=varargin{3};
ambient=varargin{4};
distortion=varargin{5};
raw_ambient=varargin{6};
Fs=varargin{7};
elseif(na... |
function [t, x, y]=Sys2ODEsRKclas(ODEs, ab, h ,INI)
t=ab(1):h:ab(2);
x(1)=INI(1);
y(1)=INI(2);
N=length(t)-1;
c1=1/6; c4=1/6; c2=2/6; c3=2/6; a2=1/2; a3=a2; b21=a2; b32=a2; a4=1; b43=1; b31=0; b41=0; b42=0;
for i=1:1:N
K1=ODEs(t(i), x(i), y(i));
K2=ODEs(t(i)+a2*h, x(i)+b2... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implemetation of the tracker described in paper
% "MEEM: Robust Tracking via Multiple state.experts using Entropy Minimization",
% Jianming Zhang, Shugao Ma, Stan Sclaroff, ECCV, 2014
%
% Copyright (C) 2014 Jianming Zhang
%
% This p... |
% A function to run a test
% add QuMat to path
addpath(genpath('QuMat'));
runCodegenTests = false;
% run all tests
testRes = runtests('./tests/qregister/','IncludeSubfolders',true);
testResultChecker(testRes);
testRes = runtests('./tests/singleQubitGates/','IncludeSubfolders',true);
testResultChecker(testRes);
testRe... |
function channels = get_channels_from_model(model,src,dst,enable_printing)
lambda = model.lambda;
amps = model.amps;
if(enable_printing)
figure;
display_model(model);
end
%% Check if there are reflections
rays{1} = [src;dst]; %Direct path
ray_status=[0,0];
for... |
% function (vector) straight = zigzag ((matrix) block)
% The function zigzag takes a matrix (8x8) as an input argument and traverses
% in zigzag fashion on the matrix, converting this matrix into a vector of
% dimension 1x64 as needed in JPEG compression.
function straight = zigzag(block)
straight = zero... |
function [ storm, tree ] = cluster_wwlln( data, varargin)
%CLUSTER_WWLLN takes in normally formatted WWLLN data returns a vector of
% storm ID numbers for each stroke. Storm 0 strokes are ungrouped.
%
% Created by: Michael Hutchins
%% clusters Parameters
eps = .12; % Degrees
minPts = 2; % Points
epsTime = 1080... |
%two-moons.mat
% This dataset is already split in training and testing data.
%Aqua-all.csv
% Here, the first column denotes the outcomes y, the remaining columns
% the features. Use the first 100 samples as training data for the
% kernel_ridge_fit function. Use the remaining 97 samples for testing in
% kernel_ridg... |
function [ x, y ] = implicitCurve_ortho_noCorr( F, dFx, dFy, x0, y0, steps, stepWidth )
%implicitCurve Generiert eine Menge von Wertepaaren mit F(xi,yi)==0 und
%xi=x0+stepWidth*i mit i aus 0 bis steps
%
% F Funktion mit 2 veraenderlichen, dF/dy ~=0 in allen relevanten Bereichen
% dFx und dFy sind die Ableitungen v... |
clear all;
height=100;
width=100;
window_s=1;
window_e=height;
window_h=window_e-window_s+1;
ColMap=colormap(parula(101));
%as=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8];
t=0:2:300;
tau=44;
phi=0.34;
dd='/home/xiaoling/SpiralWave/data/';
% fprintf('a=%f bH=%f bL=%f c=%f\n',a,bH,bL, c);
matr... |
%% Generalized Projected Gradient Descent Algorithm
%created by Huang Sen
%Email: huangsen1993@gmail.com
%mo is the momentum parameter and distance
function [x beta obj] = GPGD(M,N,F,R,Rb,Rm,Ym,G,tau,inv_Omega,upper,max_dis,min_dis,XYZ,plt)
thres = 20;
mo = 1.01;
ss = 1e-4;
x = [];
x = Initialization(XYZ,max_dis,min_di... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Sam Feig
% Vladimir Zhdanov
%
% CSCI 4831/5722
% Homework 5
% Instructor: Ioana Fleming
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function features = ComputeFeatures(img)
% Compute a feature vector for all pixels of an image. You can use this
% function as a starting point to implement your own ... |
% Write a script that computes a tuple (x,y) of the function f = @(x,y) [x^2 + y^2 - 1; cos(pi*x)] which satisfies f(x,y) = (0,0) using the two-dimensional Newton's method.
% Store your solution in a variable x = [ANS_X; ANS_Y].
f = @(x,y) [x^2 + y^2 - 1; cos(pi*x)];
invJ = @(x,y) [0, -1/(pi*sin(pi*x)); 1/(2*y), x/(pi*... |
function data_object = dataobject_initialize(functional_folder,anatomical_folder,IMG_folder,segments_folder,ROI_folder,MNI_brain,num_file_slices,TR,ephys_folder,ephys_rate)
% INITIALIZE_data_object
% Creates a data structure to store human fMRI data
%
% data_object =
% dataobject_initialize(
% functional_folder, Fol... |
% A palindromic number reads the same both ways. The largest palindrome
% made from the product of two 2-digit numbers is 9009 = 91 × 99.
%
% Find the largest palindrome made from the product of two 3-digit numbers.
% Ans: 906609 = 913 * 993
for a = 9:-1:0
for b = 9:-1:0
for c = 9:-1:0
pal = a * 1... |
function cooccurFeats = ComputeCooccurFeatures(img,offset)
% we can see some effects by setting large offset; if we set too small
% offset, the textures will be indistinguishable (you can convince youself)
error('Implement your function here');
end
|
% uuvSimRun.m e.anderlini@ucl.ac.uk 02/10/2017
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script simulates the dynamics of an UUV.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Clean up:
clear;
close all;
%% Initialization:
% Run the set... |
clear ; clc ;
addpath(genpath('SBL_Tipping2001\'))
addpath(genpath('SparseLab2.1-Core'))
addpath('tools\')
rand_state = rng(0,'v5normal') ;
% load image data
I0 = imread('Dataset\Mondrian.tif');
I0 = double(I0);
% experimental setting
num_method = 5 ; nums = 10 ;
% filename = 'ResultsData\Image_Reconstruction\Mon... |
function out = extract_features(ds)
id = ds.Id;
labels = ds.Labels;
path_for_asset = ds.path_for_asset;
cache = create_cache(ds.path_for_asset(["tmp", "edge_classifier"], "dir"));
n = height(labels);
comparisons = cell(n, 1);
parfor i = 1:n
l = labels(i, :);
... |
function SegmentationProcessTiles(Slide, Desired, T, Folder)
%Uses openslide library to process tiles in slide.
%Paths must be set to OpenSlide, ColorDeconvolution and BoundaryValidator.
%inputs:
%Slide - string containing slide path and filename with extension.
%Desired - scalar, desired magnification.
%T - scalar, ti... |
% %% LlodyMax
% clc; clear; close all;
function Iq = LMquantize(I,n)
% I = imread('brain.png');
% n = 10;
% Initialize, randomly select a(i) from image
mx = max(I(:));
mn = min(I(:));
if mn == 0
mn =1;
end
a = randi([mn,mx],1,n-1);
a = sort(a);
b = zeros(1,n);
Io = I;
%% Recursive part
% Create the boundaries,... |
%==========================================================================================
% Create_Petersen_Networks_Struct.m
%
% This script extracts the Petersen parcellations and the ROI indices of each network.
%
% Note: .xls file had to be cleaned in the following way:
% Some network names were altered so tha... |
%Data Import Process
folder = 'Data';
% Example: folder = 'C:\Temp\Data';
sheetname = 'ISONE CA';
if strcmp(sheetname, 'ISONE CA')
NEData = dataset('XLSFile', sprintf('%s\\2004_smd_hourly.xls',folder,yr), 'Sheet', 'NEPOOL');
else
NEData = dataset('XLSFile', sprintf('%s\\2004_smd_hourly.xls',folder,yr), 'Shee... |
%% Define and load vars
% LNP kernels
cluster_dir = '/mnt/40086D4C086D41D0/Reverb_neuronal_data/Kernel_fits/kfolds/LNP_model/perfreq/ridge/10ms/200ms'; %Absolute path to the kernel used for the prediction
%Get the cochleagrams
coch_file = '/mnt/40086D4C086D41D0/Reverb_neuronal_data/Cochleagrams/Cochleagrams/New_th/Der... |
% This is something I always wondered...
% Manuel Diaz, NTU, 2014.01.21
%
A = magic(6);
%
idx = 1:6;
idx_new = repmat(idx,[6,1]);
%
x = linspace(0,1,6);
v = sin(2*pi*x);
% operation
b = A.*v(idx_new);
disp(b);
% conclusion:
% matlab indexes = c++ pointers ;)
|
function M = CS6640_MM(vidObj)
% CS6640_MM - segments moving objects in video
% On input:
% vidObj (video object obtained by VideoReader): input video
% On output:
% M (Matlab movie): movie of segmented moving objects
% Call:
% vidObj = VideoReader(?../../../video.avi?);
% M = CS6640_MM(vidObj);
% Author:
%... |
% Test if subject already exists:
sub.dir = [pwd(),filesep(),'data',filesep(),sprintf('sub_%02d',sub.code)];
% If it exists:
while(exist(sub.dir))
fprintf('Subject with number: %02d already exists.\n',sub.code);
rep = input('Replace? ');
if (~rep)
sub.code = input('Please re-enter subject c... |
%GENETIC ALGORITHM TO SOLVE RATSTRIGIN FUNCTION
clc; clear all; close all
tic
disp('Program for GA is running....')
hh=waitbar(0,'Please wait the program for GA is running.....');
%% function and side constraints definition
f=@(x) 10*2+(x(1)^2-10*cos(2*pi*x(1)))+(x(2)^2-10*cos(2*pi*x(2)));
%here f(x) and f(xp)... |
function xlsIdx = xlsIndex(decIdx)
% convert decimal index to an index of base 26 to split the index into the
% correct number of elements; '-1' because we start counting from 0
tmpStr = dec2base(decIdx-1, 26);
% convert each element back to the corresponding decimal
decIdx = arrayfun(@(x) base2dec(x,26),tmpStr);
% ... |
function ret = HexSum(str)
% REQUIRES: a list of hexadecimal numbers separated by ' '
% RETURNS: the hexadecimal sum of the numbers
% Using split function, we could simply separate tthe string into
% pieces, and we could apply system function to any kind of arraies and
% matrices (recall RC1), ... |
function fluxlimiter(N, method)
% N = number of grid points
% grid spacing on interval (-1,1)
dx = 2./N;
% location of cell centers
x = linspace(-1+0.5*dx, 1-0.5*dx, N);
% advection speed
u = 1;
% cfl condition + safety margin
dt = 0.25*dx;
% final time
FinalTime = 2;
Nsteps = ceil(FinalTime/dt);
dt = FinalTi... |
function q = Q(t, state)
%данная функция вычисляет управление по состоянию системы и текущему
%моменту времени
%проекция e (единичного вектора, направленного вдоль стержня) на ось x
%это - текущее положение стержня
e_x=state(1);
%положение стержня, к которому он будет стремиться
otkl_stat=0.99;
% управление, пр... |
%% compute the convergence
% [Investigating automatic measurements of prosodic accommodation and its dynamics in social interaction]
load([project.paths.processedData '/processed_data_word_level.mat']);
filelist = dir([project.paths.processedData '/GMM_configs/GMM_scores_' num2str(project.gmmUBM.gmmcomp) '_10_mwv_mfc... |
function [window,wnrange,gasvec,invgas,ninvgas,sol_shift_wn,solar_line_file] = window_details(gas,window_number,varargin)
% [window,wnrange,gasvec,invgas,sol_shift_wn,solar_line_file] = window_details(gas,window_number)
solar_line_file = 'input_data/solar_lines_1500-1700.dat';
switch lower(gas)
case 'co'
... |
function text1d()
addpath textures
small=0
if small
nr=10;
nz=11;
np=18; % should be even
pars=''
w=640; h=480;
else
nr=25;
nz=25;
np=48;
pars='vec_len=0.075 vec_wid=0.015';
w=1280; h=1024;
end
[r a b ~] = textread('text1dx.dat', '%f %f %f %f',...
... |
function [model , mf , nrm] = training(data,amt)
% data: 205 feature * 128 data * 205 scene
model = {};
mf = {};
nrm = {};
% which scene labels contain
root_s = [1,2,3,5:1:22,24,25,26,28:1:38,40:1:49,51:1:63,65,66,...
67,69:1:75,77:1:81,83:1:94,96:1:99,101:1:119,121:1:138,140,142,143,145,...
147,148... |
clear;
close;
clc;
x = linspace(1,4,100);
y1=1-x;
y2 = x.^2 -5*x +4;
X = [x,fliplr(x)];
Y=[y1,fliplr(y2)];
area(x,y2,"facecolor","green");
hold on
fill(X,Y,'r');
grid
print ('ee16b1008.eps', '-color')
|
% demo error of finite differencing for f' as function of h. Barnett 10/29/19
clear
f = @(x) tan(x); % func to test
fp = @(x) 1./cos(x).^2; % its analytic deriv
x0 = 1.1; % ordinate to test finding f' at
hs = logspace(-16,0,100); % range of spacings h
es = ... |
function showwindowedmovie
%% This function should be called in the session directory to load the
%% stimInfo for the windowed movie sessions or movie sessions
% The Red Points indicate the endpoints of the hand mapped RFs
% The Green Points indicate the size of the window used.
%% Load the stimulus information
st = s... |
function [taus] = boundariesTrapezoidicFootPrintArc(dsd_ds, tproj0, dsxy0, wu, dx_cos_2, dx_sin_2, dy_sin_2, n_dy_cos_2)
% define ratio(x,y) (tproj0 x dx_cos_2 y dy_sin_2 ) / (dsxy0 x dx_sin_2 y n_dy_cos_2)
% define taufun(x,y) dsd_ds * ratio(x,y)
taus = zeros(1,4);
taus(1) = dsd_ds * atan(( tproj0 + dx_cos_2 + dy_s... |
clc
close all
clear all
load('12k_1.mat')
nh = [60,40,30,20]; %ims AND cwru
% nh = [100,70,50,30]; %Air Compresser
eta=0.5;
%% deeper
d=3;
[W,b]=dnn(nh,eta,training_inputs,training_results);
[W,b]=deeper(W,b,nh,d,eta,training_inputs,training_results);
accur=accuracy(test_inputs,test_results, W, b... |
%% MMSP2 - Lab 1
% Exercise 1 - Audio signal encoding
clearvars
close all
clc
%% 1) Load file 'pf.wav' and plot it.
%% Check that its values are included between [-1,+1]
[x,Fs] = audioread('pf.wav');
figure()
plot(x)
ylabel('Amplitude')
xlabel('Samples')
disp(['Fs: ' num2str(Fs)]);
disp(['size(x): ' mat2str(siz... |
function lub = leastUpperBound( t1, t2 )
%leastUpperBound Summary of this function goes here
% Detailed explanation goes here
if nargin<1
t1 = 1:20;
t2 = 5:50;
end
lub = min( max( t1(:) ), max( t2(:) ) );
end
|
%This code computes the Hadamard Product of two vectors or matrices
%Written by Jhelum Chakravorty
function R = hadamard_prod(vec,mat)
[a,b]=size(mat);
for i=1:a
for j=1:b
R(i,j) = vec(i)*mat(i,j);
end
end
% R(1:-k+n+1,:) = epsil*mat(1:-k+n+1,:);
% R(k+n+1:2*n+1,:) = epsil*mat(... |
clear all,clc
N = 2000;
K = 12;
d = 2;
% Plot true manfold
tt0 = (3*pi/2)*(1+2*[0:0.02:1]); hh = [0:0.125:1]*30;
xx = (tt0.*cos(tt0))'*ones(size(hh));
yy = ones(size(tt0))'*hh;
zz = (tt0.*sin(tt0))'*ones(size(hh));
cc = tt0'*ones(size(hh));
subplot(1,3,1); cla;
surf(xx,yy,zz,cc);
view([12 20]); grid off... |
function [predLabel, output] = MLSWKnnPred(trainSample, trainLabel, testSample, K, simMea, W)
% Multi-label predicting based on Distance-weighted k-nearest Neighbor and linear regression
%
% trainSample - training samples
% trainLabel - training samples' label vectors
% testSample - testing samples
% K - the number of ... |
function c = dtfs0(x)
N = length(x);
n = 0:N-1;
c = zeros(1, N);
for k = 1:N
c(k) = 1/N*sum(x.*exp(-i*2*pi/N*k*n));
end
end |
function ARB = arb(Zur, Zul, roll, loc, fcm)
if (loc == 0) % Front ARB
arbs = fcm.arbsf;
elseif (loc == 1) % Rear ARB
arbs = fcm.arbsr;
end
roll_u = (Zur - Zul)/fcm.Lcw;
Marb = -(roll - roll_u)*(180/pi)*arbs;
Fu = Marb*0.5*fcm.Lcw;
ARB.Farb = Fu;
ARB.Marb ... |
clc
clear
allFiles = dir('idfs');
files = {allFiles(3:end).name};
noOfFiles = size(files,2);
for i = 1:noOfFiles
mkdir(['idfPara/' files{i}(1:end-4)]);
copyfile(['idfs/' files{i}],['idfPara/' files{i}(1:end-4)])
fileNo(i) = str2double(files{i}(1:end-4));
end
% Global Variable
amazonEC2Client = com.amazo... |
randn('seed',3); % 2
% begin generate data.
d = 10; % dimension
N = 3000;
K = 3; % 2,3
scale = 100;
scale2 = 1;
centroid = randn(d,K);
centroid = centroid ./ (ones(d,1) * sqrt(sum(centroid.^2,1))); % 10 * 4 with unit norm.
centroid = centroid * scale;
prob_record = [];
X = scale2 * randn(d,N);
for i = 1:K
X(:,(N... |
for j = 1:10
archivo = dir(['C:\Users\Ruth\Desktop\unet-hela-head\exp' num2str(j) '\*.jpg']);
disp(['C:\Users\Ruth\Desktop\unet-hela-head\exp' num2str(j) '\*.jpg']);
disp(length(archivo));
for i = 1:length(archivo)
archivo1 = archivo(i).name;
disp(['C:\Users\Ruth\Desktop\unet-hela-... |
%input: destination location, visited locations (empty at first call),routes belief grid
%output: cell array with routes. a route of length n is a matrix of nx2
%with x coordinates in column 1 and y coordinates in column 2.
%using algorithm from http://stackoverflow.com/questions/58306/graph-algorithm-to-find-all-conne... |
function neighbours = generate_neighbours_1(solution)
l = length(solution);
neighbours = zeros(l-1,l);
for i = 2:l
neighbour = solution;
idx1 = ceil(rand()*l);
idx2 = ceil(rand()*l);
while idx2 == idx1
idx2 = ceil(rand()*l);
end
neighbour(idx1:idx2) = fliplr(neighbour(idx1:idx2));
... |
function [inst, cols] = code_tree_walk(func, nodes, inst, cols, html_loc)
% Uses the nodes structure to generate the dot syntax for the diagram
% creation.
% Args:
% func (str): name of the current function being assessed.
% nodes (structure): Contains the interrelationships between the nodes.
% inst ... |
syms x
f = 25600*x^4 - 25600*x^3 + 6416*x^2 - 16*x + 4;
% Compute first and second derivatives of f.
diff(f);
diff(diff(f)); |
function n = multiplier(a,irxn)
% MULTIPLIER Multiplier for reaction rate of progress.
%
% The multiplier multiplies the reaction rate of progress. It may
% be used to implement sensitivity analysis, or to selectively
% disable reactions. For reversible reactions, it multiplies both
% the forward and reve... |
function wdisplaymatlabcode(mcode_str,option)
%WDISPLAYMATLABCODE Display Matlab code in the editor.
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 16-Mar-2011.
% Last Revision: 16-Mar-2011.
% Copyright 1995-2011 The MathWorks, Inc.
% $Revision: 1.1.6.1 $
switch option
case 'editor'
% Throw to c... |
function [ bg, outImg , idx] = ICV_q5_genbg(v)
% Function: ICV_q5_genbg
% Input: Video object
% Output:
% bg: Background image in greyscale
% outImg: Total frame
% idx: Frames count in video
fr1 = ICV_rgb2grey(readFrame(v));
if(hasFrame(v))
fr2 = ICV_rgb2grey(readFrame(v));
end
... |
function [] = create_recon_video(Recon)
% Your video should display top 100 fourier basis and their corresponding
% reconstructed images. After that display every 10th reconstructed image
% and its basis. Effectively you will get[num = 100+(M*N-100)/10] reconstructed
% images in the image sequence to be converted to v... |
% Obtained from: https://www.mathworks.com/matlabcentral/answers/430248-how-do-i-plot-a-1-d-random-walk-that-generate-1-and-1-with-equal-probability-i-am-struggling-to-pl
% From user Torsten
n = 10;
P = zeros(2,n);
P(:,1) = 0; % Starting value
%% Performing 2D random walk
% Steps are size 1
for i=2:n % i is the ... |
function [axh,npix] = CreateAxes64
% axh = CreateAxes64
% Sets up the axes for 64-channel acquisition & plotting
% axh is the vector of handles to the axes
% npix is the length of the x axis in pixels
set(0,'Units','pixels')
% A trick for producing correct-sized screen:
%scrnsize = get(0,'ScreenSize');
%figure('Positio... |
%square root of a matrix A. x*x=A
function f = matrixSQRT(A)
f = sqrtm(A); |
p2 = readData('output.avi'); %load the video and converts to double
p2 = double(p2);
[m,n] = size(p2(:,:,1));
% % I want to have all the pixel values in one row
for count = 1:300
X(:,:,count) = reshape(p2(:,:,count),[1,(m*n)]);
end
%The for loop is to store the next values of X in Y
count = 1;
for cou... |
function SetOnOff(obj,On)
% set instrument output to on or off
% adcmt 6166: 6161-compatible mode must be set to ON (set by using the instrument front panel)
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
TYP = lower(obj.drivertype);
... |
% ELM364 - Digital Signal Processing
% Homework 1 - Section 2
% Mete Can Gazi
% 141024020
clc;clear;close all
syms t n
%Finding Common Period;
f(t) = cos(500*pi*t) + sin(800*pi*t); %Functions
freq = gcd(250,400); %Common Frequecny of the funtion;
T = 1/freq; ... |
classdef ProbeLayout
% ProbeLayout layout of a multielectrode probe with shanks and sites
%
% This transposes the function MichiganGetLayout into an object...
%
% ONE DAY this should have a 4-dim array with indices
% row,col,depth,tet. Row and col indicate the shank and depth is along
% the... |
function [R, a, xi] = hyper_sphere(X, C)
% hyper_sphere - get the optimal eclosing hyper sphere for the given
% dataset X, and return the radius (R), center (a), and error (xi) for each
% point.
% Arguments:
% - X: input dataset
% Returns:
% - R: radius
% - a: center
% - xi: error
% transpose X to make it shape F x N,... |
function mainVD_h_p_k_ref()
% Valutazione e grafico di spline VD
clear all
close all
%Colori
col=['k','r','g','b','m','c','y','k','r','g','b','m','c','y'];
a=0;
b=1;
% inserimento manuale dei coefficienti
hold on;
g=1;
t=[0 0 1 1];
Y=[1 1];
mpK=length(Y);
figure(1);
hold on;
n=31;
[nm,mesh]=an_mesh(g,t,n);
iv = f... |
function [parameters] = loadParameters()
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
parameters.W0 = 330993; %[kg] MTOW
parameters.Wcruise = 1; %WRONG
parameters.T0 = 211002*0.85; %%% (lbs) 938585*0.85; %[N] Two engines combined. %%% 85% thrust of GE9X for thrust "e... |
function Cohere_w = w_cohere(x,y,fs_o,Dt,t_step,fs_d,w_name,Scale)
% This function estimates and plots a wavelet-based magnitude-squared (MS)
% coherence "Cohere_w" between two time series "x" and "y" both sampled at
% "fs_o" Hz.
%
% Other required input parameters:
% "Dt" - one half of the time interval in sec... |
function [int_wf,int_time_ms] = interpolate_wf(wf,wf_time,upsamp_factor,method)
%function [int_wf,int_time_ms] = interpolate_wf(wf,wf_time,upsamp_factor,method)
%This function does interpolation on spike waveforms to obtain a more
%continuous version of the original waveform. This aids in the computaton
%of clustering ... |
close all
clear
clc
n = -6:0.4:6;
A = 3;
w = 2*pi*0.125;
y = A*sin(w*n+pi/5);
gambar1 = figure;
stem(n,y,'k')
axis([-6 6 -4.5 4.5])
xlabel('n')
ylabel('f[n]') |
function [c d]=fcontr2D(X)
t1=X(1);
t2=X(2);
r11=X(3);
r21=X(4);
c=[];
d=r11^2+r21^2-1;
end
|
% PT_HOME
%
% Function PT_HOME returnes path to the home folder of the input file
%
% pt_home_path = pt_home(inp)
%
% juraj.oravec@stuba.sk
%
% 2012.04.17
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Mo... |
s_datasets = {'ATNT50','ATNT200'};
s_file_types = {'txt','csv'};
s_file_names = {'trainDataXY','testDataXY','testDataX'};
%% Control START %%
i_dataset = 1; %% 1 is 50, 2 is 200
b_SVM = 1;
b_KNN = 1;
i_KNN_n = 5; %% Max is 45 for 'i_dataset = 1;' and 179 for 'i_dataset = 2;'
b_CM = 1;
b_LR = 1;
%% ... |
function [ripple2,timeasleep,DEMAIS,y1]=gui_ripple_level_2020_pfc(level,nrem,notch,w,lepoch)
%Band pass filter design:
fn=1000; % New sampling frequency.
Wn1=[100/(fn/2) 300/(fn/2)]; % Cutoff=100-300 Hz
[b1,a1] = butter(3,Wn1,'bandpass'); %Filter coefficients
%LPF 300 Hz:
fn=1000; % New sampling frequency.
Wn1=[320/... |
globalfullspeller = zeros(40,8);
for pZerolevel = -10:10
run('ProcessP300.m');
run('GeneralClassifyP300.m');
globalfullspeller(pZerolevel+11,:) = globalspeller(:);
end
[i,v] = max(globalfullspeller) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.