text stringlengths 8 6.12M |
|---|
function [opt] = gurls_train(X,y)
% gurls_train(X,y)
% Trains a linear model using the dual formulation of RLS
% The regularization parameter is chosen using a leave-one-out crossvalidation.
%
% INPUTS:
% - X : input data matrix (one sample per row)
% - y : labels (must have as many entries as there are rows in X... |
% Lpms Data recording demo
% Summary:
% This example demonstrate how to obtain
% and plot real time data from LpmsSensor
%
% Author: H.E.Yap
% Date: 2016/07/19
% Revision: 0.1
% Copyright: LP-Research Inc. 2016
close
clear
clear all
clc
% Parameters
nData = 1000; % number of data to record
... |
function visc=sw_visc(s,t,p)
% function visc=SW_VISC(S,T,P)
%
% kinematic viscosity (nu) (no pressure dependence examined)
%
% based on dan kelley's fit to knauss's table ii-8
%
% s salinity (ppt)
% t temperature (deg. c)
% p pressure (dbars)
%
% visc kinematic viscosity (m**2 s-1)
%
% vi... |
%READ
%This function converts the parameter strings and replaces them with
%something more familiar. This conversion is used when showing the listdlg of
%parameters to select from when sorting.
%Based on non_BSA_list.m, BSA_list.m definitions and nvn_extract_data.m
%If parameters from nvn_extract_data and BSA_lis... |
function [ h ] = myHistogram(I)
%% MYHISTOGRAM - This fuction computes the Histogram of the given Image, I.
%
% Input : I - Input Image
%
% Output : h - Histogram of the Input Image
%% The Function starts here
[r,c]=size(I); % Read the size of image
t=1:256;
n=0:255; % Represents the total no. of Intensit... |
function SpeechRecognitionFFTcov()
fs = 20000; % Sampling Frequency
[x,fs]=audioread('green5.wav');
N = 9000; %!!! take first N frames from sample
x = x(1:N);
sound(x,fs);
voicefft = fft(x);
voicefftn = (voicefft-min(voicefft))/(max(voicefft)-min(voicefft))*1000;
%plot(abs(voicefftn));
%voice=cov(voicefftn);
[y0,... |
function varargout = ElevatorPanel(varargin)
% ELEVATORPANEL MATLAB code for ElevatorPanel.fig
% ELEVATORPANEL, by itself, creates a new ELEVATORPANEL or raises the existing
% singleton*.
%
% H = ELEVATORPANEL returns the handle to a new ELEVATORPANEL or the handle to
% the existing singleton*.
%
%... |
% input-C matrice dei corner
% input-i,j indici dell'elemento da testare
% input-d raggio dell'intorno
% uotput-lm booleano che vale true se C(i,j) e un massimo locale
function lm=local_max(C,i,j,r)
[m,n]=size(C);
% il seguente codice gestisce le situazioni negli estremi di C
i_under=1-(i-r);% uscita finestra in alt... |
% clc
% clear all
% close all
% function [KnockOrNot, KI, Efficiency, IMEP] = MainScript(ON,N)
global NASA CA
dbstop if error
NASA = load('NasaThermDatFull.mat');
CA = -360:360; % [°] Crank Angles
R = 8.3145; % [J/kgK] Universal gas constant
%% Engine geometry
EngGeom.S = 80.5e-3; % [m] Stroke
... |
%%% http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/
data = prob;
rows = size(data, 1);
cols = size(data, 2);
colorSet = varycolor(rows);
set(gca, 'ColorOrder', colorSet);
plot(1:cols, data(1:20, :), 'x')
|
% Subroutine for boundary layer calculation using,
% 1. Approximation method for Laminar regime
% 2. Karman momentum-integral method for Turbulent regime
% NOTE:
% *transition checked using Cebeci and Smith (1974) method
% which is an improvement of Michel's method
function [deltas, thetas, cf, trans, ... |
function [max_index,max_value]= find_max_delta_in_delta_vector(vector)
%find the max difference direction, X Y or Z direction, then, we will modify along this
% direction in the next. The direction (XYZ) is saved in max_index by (1,2,3)
n=size(vector,2);
if (n==3)
max_index=1; max_value=vector(1);
for... |
function hndl_ax = gcayy
hndl_ax(1)=findobj('type','axes','color','white');
hndl_ax(2)=findobj('type','axes','color','none');
end |
%% 3DP2018 dataset
% Por algun motivo no anda la ruta relativa, hay que setearla absoluta
%%%% SETEAR ESTA DE FORMA ABSOLUTA:
path_practica = '~/facultad/vision/vc-2018-2c/practicas/p9_escaneo3d/';
%%%% NO TOCAR ESTAS:
turntable_images_path = strcat(path_practica,'imagenes/turntable-small/gray');
calib_images_path ... |
function dist_cell2sinu = dist2sinusoid(X,mask,save_dir)
%
% Calculates the distance from every cell to the closest sinusoid.
%
% SYNOPSIS
%
% dist_cell2sinu = dist2sinusoid(X,mask)
% dist_cell2sinu = dist2sinusoid(X,mask,save_dir)
%
% INPUT
%
% X: coordinartes of the observed... |
% This file is called by the function DCA() to initialize the parameters
% used in the corresponding function.
%% ------------------------ Initialization ----------------------------- %%
Num_Sensor = 2;
Num_Ag = Num_Sensor;
numDC = Num_Ag; % Initialize # of cells
DC_store(Num_Sensor) = Num_Ag;
% Assignment... |
x = []
y = []
z = []
s = []
for i = 0:29
T = csvread(sprintf("%s.scs/a0.s%d.csv", argv(){1}, i))
x = [x; T(:,1)]
y = [y; T(:,2)]
z = [z; T(:,3)]
s = [s; ones(size(T)(1,1), 1) * i]
end
scatter3(x, y, z, 10, s, "filled")
input("Paused...") |
function [numWwins, numBwins, numDraws] = simulateGame(numSimulations, whiteAlg, blackAlg)
% This function simulates a number of games WITHOUT displaying anything
% in the GUI. It returns the number of times black wins and white wins.
numWwins = 0;
numBwins = 0;
numDraws = 0;
hwb = waitbar(0, 'Ca... |
%Problem2a
clear
clc
dt = 0.01;
et = 2;
x = 0:dt:et;
y = x.^2;
plot(x,y,'g'); |
function [xParams, ParamsMeanErr0, ParamsMeanErr1, ParamsMeanErr2, ParamsCorr, ParamsErr1, ParamsErr2, ParamsLickdistri, ParamsLickdistriXpred, ParamsPostbeforelick, ParamsMeanPostbeforelick] = TestDecodingParams(EXP, nspdbinslist, smth_spdlist, latcorrectionlist, alphalist, deltalist)
SpeedThreshold = 5;
traincont =... |
% File: FastObj.m
% Author: Urs Hofmann
% Date: 03. Jan 2018
% Mail: hofmannu@student.ethz.ch
% Note: If you want to use a card with more input channels, please adapt
% - property NO_CHANNELS
% - size of the channels array (line 40)
% - Acquire_Data function (line 172)
% Missing:
% - Add a function whic... |
function days = to_datestr(days, varargin)
% TO_DATESTR -- Convert day__ labels to datestr labels.
%
% IN:
% - `days` (cell array of strings, char)
% OUT:
% - `days` (cell array of strings, char)
defaults.config = dsp2.config.load();
params = dsp2.util.general.parsestruct( defaults, varargin );... |
function [ I, V, F, featureImage, featureVertex, M2V, V2P, s, rms ] = ...
optimizePascalExample( modelName, imagesetName, fileName)
% Tao Du
% taodu@stanford.edu
% Mar 21, 2015
%
% Run our optimizeCameraAndScale on Beyond PASCAL dataset.
%
% Input: modelName: a string like 'aeroplane'.
% imagesetName: a string... |
%% General initialization
%Load generated results
LoadResults;
%Dimension-related declarations
dimensions = [10, 30];
%Algorithm-related declarations
algorithmNames = {'Nelder-Mead', 'Hooke-Jeeves', 'Implicit Filtering',...
'Multidirectional Search', 'Pattern Search'};
%Function-related declarations
functionName... |
% Implements NMF algorithm described in:
%
% D.L. Sun and C. Fevotte. "Alternating direction method of multipliers
% for non-negative matrix factorization with the beta divergence." ICASSP
% 2014.
%
% Original source:
%
% https://web.calpoly.edu/~dsun09/admm.html
%
function [W, H, f] = nmfadmm (V, W, H, r, tol... |
function y = fn_coerce(x,m,M)
% function y = fn_coerce(x,m,M)
%---
% y = min(max(x,m),M);
% Thomas deneux
% Copyright 2002-2012
y = min(max(x,m),M);
|
function [features] = feature_extraction(input_image,feature_size,index_i,index_j)
% function [features] = feature_extraction(input_image,feature_size)
[h,w] = size(input_image);
% Compute integral image
I = integralImage(input_image);
hs = feature_size;
ly = h-hs-1;
lx = w-hs-1... |
%CUMSUMALL cumulative sum of integer elements
% For vectors, CUMSUMALL(X) is a vector containing the cumulative sum of
% the elements of X. For matrices, CUMSUM(X) is a matrix the same size
% as X containing the cumulative sums over each column.
%
% Class suport:
% int8, int16, int32
%
% Keep in m... |
clear all;
close all;
clc;
locations = LoadCityLocations;
POP_SIZE = 30;
MUTATION_PROBABILITY= 0.025;
NUMBER_OF_GENERATIONS = 10000;
TOURNAMENT_PARAMETER = 0.75;
population = InitializePopulation(POP_SIZE, size(locations,1));
% Set arbitrary sequence as current best sequence
bestRoute = population(1,:);
bestFitness ... |
addpath('../ROUTINES/')
addpath('../ROUTINES/FEM/')
addpath('../ROUTINES/GRAPH/')
setid = 5;
fil = {'1_AROUNDSET', '2_ABOVESET', '3_SINGELEMABOVESET', '4_INTSET', '5_INTSETNPS'};
Ngens = [26, 26, 26, 26, 19];
sel_method = 'P' % {'P', [2 3 4 5 6 7 10]}, {'PD', [2 3 4 5 6 7 10]}
for Nlevs = [7]
clearvars -except Nlevs ... |
clc
clear
close all
labeltsize=35;
fw = 'normal'; %%是否加粗斜体之类
fn='Times New Roman';
linewide1=3;
mkft = 15;
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%H1vsH2%%%%%%%%%%%%%%%%%%%%%%%
%% 主副数据
load Hom_tau_L20_rho2.mat
figure();
hold on
plot(tau,Accuracy_AIC2*100,'r-o','linewidth',linewide1,'MarkerSize',mkft)
plot(... |
%% *遗传算法主程序*
function GAMain()
clc,clear,tic
% 参数初始化
maxgen=100; %进化代数,即迭代次数,初始预定值选为100
popsize=200; %种群规模,初始预定值选为100
pcross=0.9; %交叉概率选择,0和1之间,一般取0.9
pmutation=0.01; %变异概率选择,0和1之间,一般取0.01
individuals=struct('fitness',zeros(1,popsize),'chrom',[]);
%种群,种群由popsize条染色体(chrom)及每条染色... |
function cn2b=get_cn2b_acc_mag_ned(acc, mag)
%https://github.com/Aceinna/gnss-ins-sim/blob/master/gnss_ins_sim/attitude/attitude.py
% function to get orienation from acc and mag
%def get_cn2b_acc_mag_ned(acc, mag):
% '''
% Calculate NED to body transformation matrix from acc and mag.
% Args:
% ... |
%% Intro
% This document verifies if the directional floating-body robot's GIE
% maxes out by the total mass of the robot. Analyzed a planar, 5-DoF,
% floating, serial robot on xy-plane. The first 3-DoF consist of px, py, rz of
% the torso(3), followed by 2-DoF of rz's of hip and knee.
%% Init
clear; clc;
addpath(g... |
function [real_out, perm_out]=lm_perm(table,predictor,formula,totperm,flagbinomial)
% table=GO_table;
%
% formula='RT~1+pred+Task+(1|SubID)';
% permvars={'Task','SubID'};
% totperm=100;
if nargin<5
flagbinomial=0;
end
% run real model
eval(sprintf('table.pred=table.%s;',predictor));
if ~flagbinomial
model= fitl... |
function cad2matdemo(filename)
% CAD2MATDEMO, a demonstration of importing 3D CAD data into Matlab.
% To get CAD data into Matlab, the process is:
%
% 1) Export the 3D CAD data as an ASCII STL (or Pro/E render SLP) file.
% 2) This Matlab routine reads the CAD data
% 3) Once read, the CAD data is rotated around a bit.
%... |
% calculate rate of O2 + HOCO -> HO2 + CO2
% Updated 7/14/06 AEP
% Based on JPL Data Evaluation #15
% New entry for JPL - no T dependence
% rate = kO2HOCO(T,M)
function j=kO2HOCO(T,M)
j=2e-12.*exp(0../T); |
function [ Ycap] = call_ICA_CPA( Y,opts)
%% This function calls the ICA_CPA algorithm.
% Usage: Ycap=call_ICA_CPA(Y,opts);
% Output: Ycap is a ktensor (CP tensor)
% Input: Y -- tensor
% opts.
% R: rank of Ycap;
% alfa: weighting factor (between 0 and pi/2) that weighs the relative contribut... |
classdef Exp6 < handle % different Size with presentation2
properties
nick;
data;
presentation;
end
methods
function obj= Exp6( nick, mode )
if ~exist( 'mode', 'var' )
mode= true;
end
% first we nee... |
clear all
close all
clc
load('./train_images/data.mat')
%% Hold Out validation and test datasets
N = size(HOG,1);
N_val_test = round(N*0.3);
idx_train = true(N,1);
idx_test = false(N,1);
idx_val = false(N,1);
idx = randi(N, N_val_test, 1);
idx_train(idx) = 0;
idx_val(idx(1:round(N_val_test*0.4))) = 1;
idx_test(id... |
% Harvest a plant
function [this, plant] = harvest_plant(this, plant)
% Counting the harvested plant to the total number
% I.e. adding one for each plant
this.plantsHarvestCounter = this.plantsHarvestCounter + 1;
% This can happen if a plant grows big enough, so it can be removed
% As in the cas... |
function tile = tile3ddata(data,dist,ncols,box)
% dist
if ~exist('dist','var') || isempty(dist), dist=1; end
% dims
dims=size(data);
if length(dims)~=4
% error('Data must be 4D!')
dims(numel(dims)+1:4)=1;
end
% ncols, nrows
if ~exist('ncols','var') || isempty(ncols), ncols=floor(sqrt(dims(3))); end
n... |
function [Finall_AIM] = loadpic(name)
global INx INy;
%LOADPIC Summary of this function goes here
% Detailed explanation goes here
% Import AIM.png
% standardizing AIM
% [aim_x,aim_y]=size(AIM);
% if aim_x<=INx+1
% ZEROM=zeros(INx+1-aim_x,aim_y);
% AIM=[AIM',ZEROM']';
% disp('你的图片x太小,已经被我扩充'... |
% Estimates parameters of adjustment function and idiosyncratic shocks
clear; clc
global pdfdata adjtype
set(0,'DefaultFigureWindowStyle','normal') % undock all figures
load acnielsen
lbound = -0.5;
hbound = 0.5;
edges = [-inf linspace(lbound,hbound,24) inf]; % same bin edges as in calcstats; pr... |
function [mssim, ssim_map] = my_ssim_index(img1, img2, roi, K, window, L)
%========================================================================
%SSIM Index, Version 1.0
%Copyright(c) 2003 Zhou Wang
%All Rights Reserved.
%
%The author is with Howard Hughes Medical Institute, and Laboratory
%for Computational Vision... |
function [ pz, px_z, rPx] = plca_train( data, px, K )
%PLCA_TRAIN Summary of this function goes here
% Detailed explanation goes here
%just for this example, we use k =3;
maxiter = 140;
[M, N] = size(px);
Dim = 2;
pz = rand(K, 1);
pz = pz / sum(pz); %prior paorbility of component
for k = 1:K
px_z{k}... |
j=ExWaterMarked;
for kkk=1:mE
for kk=1:4:nE
j(kkk,kk:kk+3)=j(kkk,kk:kk+3)-MatA(h(kkk,kk),:);
end
end
for kk=1:nE
for kkk=1:4:mE
j(kkk:kkk+3,kk)=j(kkk:kkk+3,kk)-MatA(:,h(kkk,kk));
end
end
ExWaterMarked=j;
% sheet='C:\Users\hp\Desktop\project on watermarking\excel_sheets\at... |
% This is a simple script to plot some diagrams.
% It assumes you have already run inpaint, storing into the
% variables i1,i2,i3,c,d, like so:
%
[i1,i2,i3,c,d,mov]=inpaint('1.png','2.png',[255 0 0]);
figure(1);
subplot(231);image(uint8(i2)); title('Original image');
subplot(232);image(uint8(i3)); title('Fill region'... |
% clear
region_nx = 1024;
region_ny = region_nx;
path1='G:\GdriveBackup0707\kondo\SEKI MIKA';
path2='1.3.46.670589.11.71301.5.0.600.2015120713070416000';
% path2='1.3.46.670589.11.71301.5.0.9424.2015120713065106000';
searching = 1; % 1だとフォルダ内検索、0だと単体
% fname='1.3.46.670589.11.71301.5.0.9424.2015120713065160004';
... |
% Read player stats
all_player_stats = csvread('PlayerStats.csv', 1, 3);
% This is a matrix containing player position and expected points per week
all_player_returns = generate_player_returns(all_player_stats);
num_total_players = length(all_player_returns);
all_player_returns = [all_player_returns cumsum(ones(num_to... |
classdef VGG < vicos.descriptor.OpenCvDescriptor
% VGG - OpenCV VGG descriptor extractor
%
% (C) 2018, Rok Mandeljc <rok.mandeljc@fri.uni-lj.si>
properties
implementation
type
end
methods
function self = VGG (varargin)
% self = VGG (varargin)
... |
function [el,er,sdl,sdr,y,soHs]=comparingInter(p,lr)
switch nargin
case 1
lr='r';
end
N=1024;
sr=2^16;
binRes = sr/N;
minFreq = 70;
maxFreq = 16000;
%maxFreq = 20000;
t = [1:1:1024];
f=440;
x = sin(2*pi*f/sr*t);
y=spatialInterpol(x,p,1,lr);
soHs=spatialInterpol(x,p,0,lr);
%y=interpol(p,1);
%soHs=int... |
function [ locMean, locCov ] = computePrediction( initialPosition, initialTime, gpParameters, trackletData )
[~,~,N] = size(trackletData);
covfunc = @covSEiso;
likfunc = @likGauss;
locMean = zeros(1,2);
locCov = zeros(1,2);
% Obtain subset of trackletData that is nonzero at frame t
locs = [];
vels = [];
counter = 1;
f... |
function y = scale_importance_weights(x, negsamples, batch_idx, data, param, pvar)
if(param.flag_imp_sampling==0)
y = x;
return;
end
aux = param.is.freq_power(negsamples);
if(param.ns==1)
aux = aux';
end
y = x.*bsxfun(@rdivide, param.is.sum_freq_power-param.is.freq_power(data.Y(batch_idx))', aux);
|
% --- Outputs from this function are returned to the command line.
function varargout = small_ball_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles st... |
% XXXXXXXXXXXXXXXXXXXXXXXXXXXX htet_pre_process_bank_data XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Htet
% Date : Sep 11, 2019
% Function : pre process data by shuffling without replacement
% Syntax : htet_pre_process_bank_data(input, data_percent, fixed_size)
% input - any data set
... |
function A = gena( N, n, sb )
%GENA Generates the BTTB matrix bigA, as well as the Toeplitz matrix A.
% This function is separate since many unneeded smaller Toeplitz
% matrices, as well as many vectors, are created in the process of
% creating bigA.
%bigQ = cell(N,1);
Q = cell(2*n,1);
for d_ly = 0:(2*n-... |
function out = blk_ifft2(in)
out = zeros(size(in));
for i=1:size(in,3)
for j=1:size(in,4)
out(:,:,i,j)=real(ifft2(in(:,:,i,j)));
end
end
end |
%x0=1;
%dt=1;
%syms x;
%f(x)=-x;
%x(1)=x0+f(x0)*dt;
%x_daszek=x(1)
%dt=10^-1;
x_zkropka=-x;
dx(t)/dt=f(x(t),t);
x(t0)=x0;
|
function [eta, lambda] = mth_cart2oblsph(b, xyz)
% MTH_CART2OBLSPH computes oblate spheroid coordinates given Cartesian
% coordinates and the semimajor axis as the ellipsoid fit (constraint)
% parameter.
%
%-----------------------------------------------------------------------
% Copyright 2017 Kurt Motekew
%
% This So... |
function y=readim(a,f,h,type,compflag)
% usage .. readim(a,f,h,type,comptype);
% displays matrix "a" is a string that names the input file
% and "f" is the optional size - default is [128 128]
% and "g" is the optional header size - default is 0 bytes
%if exist('f') == 0,
% f = [128 128];
%end
%if exist('h') == 0,
... |
%% This function recons images using the regredding method
function [final_recon_im] = Bruker_recon_3Dradial_cryocoil(runno, dv, kv, dcfv, mat)
%===============INPUTS====================
%runno=run number
%dv=k-space data
%kv=k-space coordinates for the data in dv
%dcfv=density compensation factors
%mat=reco... |
% Computes the statistics of price increase from the file 'filename'
% where scarcity outputs are stored, baseline urban price 'p', and a target
% price increase 'p_increase', expressed as % increase.
%
% Binary option "toplot": there is no plot if it is 0 or if argument
% omitted
%
% Charles Rouge, 2017
... |
% Jacob Krol
% Locates "non-collatz" numbers by finding amount of odd steps in each
% value's collatz sequence.
max = input('Maximum Value:');
steps = zeros(4,max+1);
for i = 1:max
Tsteps = 1;
Osteps = 1;
moving = i;
while(moving>1)
if(mod(moving,2)==0)
moving = moving /... |
classdef GaitLegPosition
properties
%% Anatomical Points
% Vector positions for each segment of the leg
ThighPositionX
ThighPositionY
ShankPositionX
ShankPositionY
% Distances Used for inverse Dynamics
% Distance from the Ank... |
function ic_importer()
addpath_OMEkit;
ic_importer_impl;
end
|
clear all; close all; clc;
load City_Index.mat
load CityInfo.mat
N = 6;
K = 7;
iter_num = 3;
season = 1;
count_region = zeros(K,N,3);
optimal_neighbor_numbers = cell(1,3);
for p = 1:1
for city = 1:3%size(CityInfo,1)
accuracy_city = NaN(K,N,iter_num);
fprintf('City %d', city);
for ave_iter = ... |
function D = parseMouseYellow(fname)
[behavior] = textread(fname,'%s', -1,'delimiter','\t');
% %separating file into LED state and timestamps
% timestamps = behavior(1:2:end-1);
%
% %convert to an aray of doubles
% LEDstate = behavior(2:2:end);
ct = 0;
ct2 = 0;
for i = 1:size(behavior,1)
foo = sprintf( beh... |
%% Problem 1
close all; clear; clc;
e0 = 8.85e-12; % [E/m]
Lx = 0.03; %[m]
Ly = Lx;
R = Lx/6;
x0 = Lx/2; y0 = Ly/2; % center of the cylinder
rou0 = 8.85e-12; % charge density [C/m^3]
nx = 20; % number of intevals
ny = nx;
delx = Lx/nx;
dely = Ly/ny;
x = 0:delx:Lx;
y = 0:dely:Ly;
[X, Y] = meshgrid... |
clc;
close all;
clear all;
phi = 0:0.01*pi:2*pi;
l = input('Enter length');
cs = pi*l;
e = abs((cos(cs*cos(phi))-cos(cs))./sin(phi));
polar(phi,e);
title('Radiation Pattern'); |
function [VC]=fevd_irf(irf,K,h);
% Structural forecast error variance Decomposition
% using estimated impulse response functions for horizon h
% Input:
% irf: impulse response function
% K: number of variables
% h: horizon
%
% Output: rows = horizon; first K cols = effect of first shock
% on all variables
the... |
function W = crear_individuo(mu, var, size_w_in, size_w_out,size_w_mid)
largo = size_w_in + size_w_mid + size_w_out;
W = normrnd(mu, var, largo,1);
end
|
function [idx] = RetrieveIndexByLabel(label)
LABEL_INDEX = { 'asus_box', 'burti', 'canon_camera_bag', 'cisco_phone',...
'coffee_container', 'felix_ketchup', 'fruchtmolke', 'jasmine_green_tea',...
'muller_milch_banana', 'muller_milch_shoko', 'open... |
function [extremaHigh, extremaLow, currentStat] = LastExtrema(data, mu_up, mu_down)
% 输出最近的高点,低点,以及当前在下降还是上升(相比最近的极值点)
% 调用trendAnalysis
% 相比hhigh 和 llow函数,lastExtrema不限定过去步长,但是使用斜率来判断极值点
%% 预处理
[stat, lastSure] = trendAnalysis( data, mu_up, mu_down );
nPeriod = size(stat,1);
extremaHigh = nan(nPeriod, 1);
extremaLow... |
function modelfun = get_socmodel_original(res)
% GET_SOCMODEL_ORIGINAL - Given a resolution, build a function that will take a set
% of parameters and a preprocessed stimulus frame and predict the response
% for those parameters. This is the original, optimized code directly
% from knk's repository. The resolution must... |
function [ output_args ] = xComparisonMatrix( ax, X, Label )
%xComparisonMatrix will plot the result of ttest/ttest2 in a grid matrix
% J. Cagle, University of Florida, 2017
% Check
N = length(Label);
if length(X) ~= N
error('Label Length and Data Length not match');
end
% Setup
cla(ax); hold(ax,'on'); box(ax,'... |
function plotLineScansGUI(scans)
% last edit: Perry Spratt 02/10/2017
lineScanUI = figure;
%% Panels
panel_load = uipanel(...
'units','normalized',...
'position',[.825 .75 .15 .2]);
panel_selectChannel = uibuttongroup(...
'units','normalized',...
'position',[.825 .6 .075 .15],...
'SelectionChange... |
function example_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to e... |
close all
clear all
clc
global poly polyp Tint vec_T impactindex xstep1 xstep2 violation_percent
% Go back to previous directory
cd ..
% Load an already optimised set of parameters for simulation
load('Optimisation Parameters Results\Optim_Parameters11_V11.mat');
Walk_Speed = 1.1; % Set this according to the fi... |
function s=smooth_simple(N,para)
%for 'extMeyer.m'
x=(1:N-1)/N;
switch para
case '0'
s=x;
case '1b'
s=x.*x.*(3-2*x);
case '2b'
s=x.*x.*x.*(10 -15*x +6*x.*x);
case '3b'
s=x.*x.*x.*x.* (35 -84*x +70*x.*x -20*x.*x.*x);
case '4b'
s=x.^5.*(126 -420*x +540*x.*x -315*x.*x.*x +70*x.*x.*x.*x);
case '5b'
s=x.... |
function plot_projections2(I, R, C, K, X1, X2, x)
if size(x,2) == 2
x = [x, ones(size(x,1),1)];
end
if size(X1,2) == 3
X1 = [X1, ones(size(X1,1),1)];
end
if size(X2,2) == 3
X2 = [X2, ones(size(X2,1),1)];
end
P = K*R*[eye(3),-C];
%calculate reprojection error
proj1 = bsxfun(@rdivide, P(1:2, :)*X1', P(3,:)*X1... |
% This script uses the 3-EXP method to obtain fits for DT and DR to a
% function that is a sum of three exponentials. This method originates in
% the paper [Proistosecu and Huybers, 2017]
%% Define function & set options to disable additional information
opts1= optimset('display','off');
f = @(x,t) ...
[... |
% 清除多余变量和图形界面
clf ;
file_input = uimenu('Label','文件');
uimenu(file_input,'Label','退出','callback','file_closefigure_callback;');
set (gcf,'numbertitle','off','name','回测报告GUI');
% 重新设置figure的设定
resetfigure(gcf,Configure_Gildata_Backtest.Figure_Position);
% 布局页面
uicontrol('style','frame','position',[0.03,0.2,0.8,0.69])... |
function LabDB = GetUniqueListLab(dbname)
% give list of lab test in the database
% should help me to clean the DB more easily
load('/Users/Lorette/Documents/MATLAB/database/global/mdp.mat')
conn = database(dbname,'root', mdp,'Vendor','MySQL','Server', 'localhost');
ping(conn) %To check the connection:
sqlquery=['SEL... |
classdef bpsk
methods(Static)
function [result] = modBPSK(data)
% modulates binary bits to BPSK
% such that 1 -> 1, 0 -> -1
% make column vector
if size(data,2) > 1
data = data';
end
... |
%% Declaration of Authoriship
% This code was written by Jason K. George
% for the purpose of his final year project at Stellenbosch University
% in partial completion for the subject Project (E) 448
%% Code
phase_rel = 0;
snr = 1;
x = 0:pi/8:12*pi;
% tau =
y = awgn(sin(x), snr);
z = awgn(sin(1*x), snr);
a = xcorr(y,z... |
function FDcalc_FMRIPREP(datafile,varargin)
% function for calculating FD and making tmasks from FMRIPREP
% difference from FMRIPREP output: filters FD values, does more
% conservative tmasking (contig frames, min per run, etc.)
%
% Dependencies:
% need the BIDS matlab toolbox in your path to load confounds: https://gi... |
X = [[0;0] [1;0] [0;1]]; % points with high p.d.f.
model = mmgauss(X); % run minimax algorithm
% visualization
figure; ppatterns(X,'xr',13);
pgauss(model, struct('p',exp(model.lower_bound))); |
% Quadratic programming implementation of wrench closure condition
% Author : Jonathan EDEN
% Created : 2016
% Description : Implementation of wrench closure condition using the
% quadratic programming
function inWorkspace = wrench_closure_quadprog(dynamics,options)
% Determine necessary variables... |
% This finds the minimum time to meal using fminbnd (an optimization
% method from Week 5). It tries all the angles from 0 to 360 on the
% timeToMeal function and selects the one that results in the minimum
% value.
[xmin, fvalMin] = fminbnd(@timeToMeal, 0, 360);
% This finds the maximum time to meal using fminbnd. Th... |
clear;clc;
% Declare symbolic variables for maximal coordinates and collect into vectors
syms x1 y1 phi_1 x2 y2 phi_2 dx1 dy1 dphi_1 dx2 dy2 dphi_2 ddx1 ddy1 ddphi_1 ddx2 ddy2 ddphi_2 real
syms t x1t(t) y1t(t) phi_1t(t) x2t(t) y2t(t) phi_2t(t)
syms lambda_1 lambda_2 lambda_3 lambda_4 real
syms m l g C F tau real
q_m =... |
function dxtide=detide(dxyz,xsun,xmoon,mjd,fmjd)
%
% Function detide
% ==================
%
% This function was created to compute the tidal corrections
% of station displacements caused by lunar and solar gravitational
% attraction.
% detide.m routine removes all tidal deformation, b... |
function leg = addLegendToAxes(ax,params,varargin)
%ADDLEGENDTOAXES Add legend to axes depending on fields of params
%
% leg = utils.addLegendToAxes(ax,params);
% leg = utils.addLegendToAxes(ax,params,'Name',value,...);
%
% Inputs
% ax - Axes to add legend to
% params - Parameters struct that has fields 'Le... |
classdef KmeansClustering < handle
properties
X
k
seeds
indicators
end
methods
function objInstance = KmeansClustering(X, k)
%objInstance = KmeansClustering();
objInstance.X = X;
objInstance.k = k;
end
function indicators = KmeansCluster(obj)
[m, n] = size(obj.X);
labels ... |
function allAccTot = collectAcc(tmid,allAcc, trialsNum, chanceLevel)
Nmin=Inf;
kk=1;
for k=1:length(tmid)
if length(tmid{k}) == Nmin
kk=k;
end
Nmin = min(Nmin, length(tmid{k}));
end
accv = zeros(size(allAcc(1).raw.accv,1), Nmin, length(tmid));
for k=1:length(allAcc)
i... |
load('dataSetA.csv');
load('dataSetC.csv');
figure;
histogram(dataSetA)
title("dataSetA")
figure;
histogram(dataSetC);
title("dataSetB/C") |
function [X, labels] = sample_pixels(L, part, I, I_seg, numpts, params, params2)
X = zeros(2 * numpts, params.numscales * (params.nfeats + params2.nfeats));
labels = zeros(2 * numpts, 1);
p = []; n = []; t = [];
for i = 1:size(I_seg, 3)
if ~isempty(find(I_seg(:,:,i) == 1))
p = [p; ... |
% punch : calls punch (John Hole, eikonal)
%
% CALL :
% t=punch(Vel,x,y,z,S)
%
function t=punch(Vel,x,y,z,S)
punch_bin='~/RESEARCH/PROGRAMMING/GSLIB/visim/visim_examples/punch';
punch_bin='/scratch/tmh/RESEARCH/PROGRAMMING/mGstat/bin/punch';
if exist(punch_bin)==0
disp(sprintf('Could not locate PUNCH bin... |
%% Clear and close everything
clear; close all; clc;
%% Tello model
dt = 0.05;
ax_pv = dt;
ax_vv = 1;
bx_v = 0.05;
ay_pv = dt;
ay_vv = 1;
by_v = 0.05;
az_pv = dt;
az_vv = 1;
bz_v = 0.05;
%% Load Trajectory and add time
load('no_obstacle\sequential\Drone1Traj.mat','full_path');
traj = full_path;
traj_t = 0.05 * (... |
function [synapseDownloadServer, synapseDownloadToken, synapseDownloadChannel] = getSynapseDownloadTokens()
FC15_Settings;
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.