text stringlengths 8 6.12M |
|---|
%% Import data from text file
% Script for importing data from the following text file:
%
% filename: /media/teamlary/Team_Lary_1/gitGubRepos/Lakitha/mintsDataAnalysis/FWNode/MINTS_001e06323a06_GPSGPGGA_2019_04_29.csv
%
% Auto-generated by MATLAB on 04-Jun-2019 17:42:27
%% Setup the Import Options
opts = delimitedT... |
function [att0, attk, xkpk] = alignfn9(imu, qnb, pos, phi0, imuerr, ts)
% SINS initial align uses Kalman filter with fn as measurement.
% Kalman filter states:
% [phiE,phiN,phiU, ebx,eby,ebz, dbx,dby,dbz]'.
%
% Prototype: [att0, attk, xkpk] = alignfn(imu, qnb, pos, phi0, imuerr, ts)
% Inputs: imu - IMU data
% ... |
function t = timetpaps(x,y,u,v,p, n,reps)
good = find(isfinite(x) & isfinite(y) & isfinite(u) & isfinite(v));
N = length(good);
for i = 1:length(n),
for j = 1:reps,
k = round(rand(n(i),1)*(N-1)) + 1;
fprintf('%d elements: ',n(i));
tic;
sp = tpapslong([x(k)+u(k)/2 y(k)+v(k)/2]',[u(k) v(k)]',p);
t(i,... |
%% Lotka-Volterra Model
% Example code from https://mjlaine.github.io/mcmcstat/ex/algaeex.html
% Edited to fit Lotka-Volterra model by Christina Catlett & Maya Watanabe (June 2020)
% Uses functions lotkaVolterrasys.m, lotkaVolterrafun.m, lotkaVolterrass.m,
% and mcmcstat library
%% Loading and plotting observed data
... |
function W = CS6640_gen_wedges8(n)
% CS6640_gen_wedges8 - Produce 8 binary matrices of wedges
% On input:
% n: size of matrices to create (2n-1 x 2n-1)
% On output:
% W (2n-1 x 2n-1 x 8 boolean array): Set of boolean matrices where
% each represents one of 8 wedges. Wedges are represented by 1's
% ... |
%Matlab 2014 source code for Power Quality Signals Disturbances Compression
%Author: Luciano Carli Moreira de Andrade
%This souce code was adapted from original NSGA-II available in Mathworks
%website library to Power Quality signals disturbances compressio
clc;
clear all;
close all;
set(0,'RecursionLimit... |
%filename = input('Open file: ', 's');
clear all
load('Statistics.mat')
load rocdata
%fid = fopen(filename);
fid = fopen('spambase.data');
b =[];
tline = fgetl(fid);
while ischar(tline)
%disp(tline);
ind = find(tline == ',');
ind = [0 ind size(tline,2)+1];
a =[];
for i=1:size(ind, 2)-1
a = cat(2, a, sscan... |
% tests
L = Quantities.dimension('length');
T = Quantities.dimension('time');
M = Quantities.dimension('mass');
a = Quantities.dimension('acceleration',L./T.^2);
F = Quantities.dimension('force',M.*a);
temp = Quantities.dimension('temperature');
kilo = Quantities.prefix('kilo',1000,{'k'});
deci = Quantities.prefix('de... |
function endFrame = CreateMarker_TwoLink(Marker_Param)
% ----------------------------------------------------------------------- %
% The OpenSim API is a toolkit for musculoskeletal modeling and %
% simulation. See http://opensim.stanford.edu and the NOTICE file %
% for more information. OpenSim i... |
% Calculate floating base base inertia matrix for
% %RN%
% Use Code from Maple symbolic Code Generation
%
% Input:
% %INPUT_QJ%
% %INPUT_PHIB%
% %INPUT_PKIN%
% %INPUT_M%
% %INPUT_MR%
% %INPUT_IF%
%
% Output:
% Mqb [6x6]
% base inertia matrix (gives inertial forces on the base from base acceleration)
% %VERSIONINFO... |
function Daylight_Savings = is_DLS(DATE)
%Function takes a date as a string in 'mm/dd/yyyy' format and outputs a
%logical, true if the date is during daylight savings time for that year. See
%definition of daylight savings time in the USA
%
% HISTORY:
% Modified by K. Lapo to use time_builder format for a speed b... |
classdef mongo
% MONGO 从mongo数据库里取数据
% 很久没有使用了
% Cheng,Gang; 20140124
properties
end
methods (Access = 'public', Static = true, Hidden = false)
% 用于设置参数,然后从database取出一个TsMatrix
paramTSM = tsmParams(property, assets, startdate, enddate,tablename, dbname );
TSMobj =... |
% Fast Fourier Transform tutorial of MathWorks
% ********************************************
%
% Based on https://nl.mathworks.com/help/matlab/ref/fft.html
% ----------------------------------------------------------
%% 1 - Initialisation
%% 1.1 - Parameters
Fmax = 500; % Maximal sampled frequency (500 to g... |
function [vector] = vectorizeSigma(mat)
At = mat.';
m = (1:size(At,1)).' >= (1:size(At,2));
vector = At(m); |
%function [PSI,PHI,PSIinv]=generate_matrices_caltech256(R,N)
clear variables;
rseed = 2013;
rand('state',rseed);
randn('state',rseed);
R=4;
N=128;
%wavelet_type='waveletcdf97'
wavelet_type='daub8'
PSI=[];
PHI=[];
%% Setup path
cdir=pwd;
cd('L1-homotopy')
addpath utils/ ... |
function img_cropped = mrir_image_crop(img_oversampled, varargin)
%MRIR_IMAGE_CROP crop image volume reconstructed from oversampled k-space
%
% cropped = mrir_image_crop(img_oversampled)
% cropped = mrir_image_crop(img_oversampled, prot)
% cropped = mrir_image_crop(img_oversampled, os_factor_freqencode, os_factor_phas... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Código para gerar dissimilaridade para conjunto de treinamento
% Diego B. 28/07/2016
% v1.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ nome ] = zotessoDissTreino( input_args , num_ref, instanciasTr, num_bandas, num_cl... |
clear
path = '../../CommonExperiment';
p = genpath(path);
addpath(p);
addpath('../StimDev')
fs = 44100;
tlen = 1;
t = 0:1/fs:tlen-1/fs;
risetime = .050;
ERB_halfwidth = 0.5;
ERBspacing = 1.5;
target_f = 4000;
noise_bands = CMRbands(target_f, ERB_halfwidth, ERBspacing);
SNRdB_1 = 4:-6:-38;
SNRdB_2 = 6:-6:-30;
mod_... |
clc; clear all; close all;
A = [1 2 1; 2 -1 1; 3 3 -2]
b = [8 3 3]'
n = length(b);
Ab = [A b]
for sut=1:n
for sat=1:n
if sut~=sat
Ab(sat,:) = (-Ab(sat,sut)/Ab(sut,sut))*Ab(sut,:)+Ab(sat,:);
end
end
end
Ab
for sat=1:length(b)
x(sat,1) = Ab(sat,end)/Ab(sat,sat)
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION: tries to determine whether a number is prime
% or not using WHILE-loops
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function is_It_Prime_2(N)
% flag that says number still appears prime
isPrime = 1;
% initialize fi... |
% onoff_pairs = csvread("taxi_onoffpair_2018-04-16_070000_100000.csv");
timediffs = onoff_pairs(:, end);
VALID_DURATION = [0, 7200]; % sec, e.g., up to 2 hours
timediffs = timediffs(find(timediffs > VALID_DURATION(1)));
timediffs = timediffs(find(timediffs < VALID_DURATION(2)));
figure(1); clf;
histogram(timediffs,... |
function [dc_power_after, a_after] = min_peak_interactive...
( grid_load_data , a, aLowerBound, b_flat, PP, IP)
T = length(a);
%% Optimzie the violation frequency
cvx_begin
variable a_min(T);
variable peak_energy_max;
minimize peak_energy_max;
... |
function feats = optimalLoadings(X,Y,varargin)
%FEATS = OPTIMALLOADINGS(X,Y,NUMFEATS,NUMCOMPS)
% Selects NUMFEATS features based on Optimal Loadings criterion that
% maximizes the determinant of loadings matrix obtained through Partial
% Least Squares model of NCOMPS components. It uses a tweaked version of
% CANDEX... |
test = load('test.dat');
patch(P(:,1),P(:,2),'green'), grid on, hold on, axis equal
plot(test(:,1),test(:,2))
plot(test(1,1),test(1,2),'ro') |
function [ ] = insertCol(obj, colVec, nameStr, idx)
%在Matrix2D中插入一列,改变obj.data和obj.xProps
% [ ] = insertCol(obj, colVec, nameStr, idx)
% colVec: 要插入的列向量,类型须为数据,长度要吻合,如有多列只取第一列
% nameStr: xProps中插入的列序列名,比如日期,默认'newCol'
% idx: 制定插入地点,0表示最后插入,默认0
% ----------------------
% 程刚,20150519,初版本
%% 预处理
% check nan
if isnan(... |
classdef DD < matlab.mixin.CustomDisplay
properties(GetAccess = public, SetAccess = private,Hidden = false)
hi = 0;
lo = 0;
end
methods (Static)
function out = ddformat(varargin)
persistent style
if(isempty(style))
%preset is 0
... |
function visualize_vesselSegmentationSlices(imageStack, tubularity, segmentation, titleString, saveOn, options)
if nargin == 0
load testVisualize3DsegmentationSlices.mat
close all
whos
else
save testVisualize3DsegmentationSlices.mat
end
% Init figure
fig = figur... |
%%% 全体の動作を決定する関数
% 初期化
make_setup();
disp('Setup Finished.');
% 魚眼カメラのキャリブレーション
fisheye_calibration();
disp('Camera Calibration finished.');
% 魚眼カメラ画像の円のハフ変換
% fisheye_houghcircle();
% disp('Fisheye circle detection finished.');
% ラインレーザのCalibration
linelaser_calibration();
disp('Linelaser Calibrati... |
%%
close all
clear
[t, force, torque] = readFTDataLVM('RUN01.lvm');
figure(1)
subplot(2,1,1)
plot(t, force(:,1), 'r')
hold on;
plot(t, force(:,2), 'g')
plot(t, force(:,3), 'b')
legend('x','y','z')
xlabel('Time [s]');
ylabel('Force [N]')
title('Free flight drilling - force measurement')
subplot(2,1,2)
plot(t, torque... |
function [value, isterminal, direction] = EventsFcn(t,var,extras)
value=0;
isterminal=0;
direction=0;
end
|
%% particle filter for 1D signal
clear
N = 500;
iter = 20;
x_s0 = 1;
sigma = 0.5;
X = zeros(1,N);
U = zeros(1,N);
w = zeros(1,N);
X_sample = round(normrnd(x_s0,sigma,1,N)); % 粒子的初始状态
w0 = 1/N * ones(1,N); % 粒子的初始权重
sigma_noise = 0.01;
for i = 1:iter
noise_state = normrnd(0,sigma_noise,1,N); % 模型噪声,高斯噪声
X = X_... |
function [concatMatrix,decisionStumps] = hw2_train_DT_recursive(train_data,decisionStumps, roundNo,weights)
display(roundNo);
[rowSize, columnSize] = size(train_data);
%display(columnSize);
for i = 1:columnSize-1;
labelMatrix = train... |
function lfid = hfid2lfid( hfid) %#codegen
% HFID2LFID Obtains local face ID within a cell from half-face ID.
coder.inline('always');
if isstruct( hfid)
lfid = hfid.lfid;
else
lfid = int32(bitand(uint32(hfid),7))+1;
end
|
function [phi,pin,pout] = Tryphon_NB(I, phi, iter, dt, alpha, flag_approx)
%Coded by: Romeil Sandhu
%Function: This function implements the active contour flow for the energy
% presented in "A New Distribution Metric for Medical Imaging."
% The framework can also be used to implement other ene... |
function b=CFP2_1D(a,tanTheta)
hlen=size(a,1)/2;
if 2*ceil(hlen/2)-hlen>0.1
b=CFP2bandDecomSub2(a,tanTheta);
else
b=CFP2bandDecomSub1(a,tanTheta);
end
N=size(a); hN=N/2;
a=b;
b(1:hN(1),:)=a(1:2:N(1),:); b(hN(1)+1:N(1),:)=a(2:2:N(1),:);
|
%% One image
clear; close all;
I = imread('~/Desktop/dframes/depth_00019.png');
I = I(44:212, 131:220);
I(I>489) = 0;
D = depth_to_cloud(double(I));
N = pcnormal(D);
imshow(N);
imwrite(N, 'normals.png');
%% Averaged over 100 frames
clear; close all;
F = dir('~/Desktop/dframes/');
D_sum = zeros(169, 90, 3);
c = 0;
t = ... |
% ArtifQuakeLetII - CWT based modification of historic records to obtain
% spectrum compatible acceleration series
% Luis A. Montejo (luis.montejo@upr.edu)
% Updates: https://sites.google.com/a/upr.edu/montejo/
% References:
% Montejo, L. A. and Suarez, L. E. (2013). An improved CWT based algorith... |
% $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% predict ratings, choices and success evolution as a function of choices
% and successes plus a constant drift
% $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
function results = SG_invert(data,run_options)
%% IN:... |
function y = Normalize(X,Xmin,Xmax,shift)
[n , D] = size(X);
x = X - repmat(shift,n,1);
xmin = Xmin - shift;
xmax = Xmax - shift;
y = x;
for n=1:D
y(:,n) = (x(:,n))/(xmax(n) - xmin(n));
end
|
% 校正的矩陣
function UnDistort_Predict = CalibrationTPS(TPS, UnDistort_Calibration)
% 算 TPS
TPS_U_X = tpaps(UnDistort_Calibration(:, 1:2)', UnDistort_Calibration(:, 3)');
TPS_U_Y = tpaps(UnDistort_Calibration(:, 1:2)', UnDistort_Calibration(:, 4)');
% 預測
UnDistort_Predict_X = fnval(TPS_U_X, TPS(:, 1:2)')'... |
clear
clc
tic;
basemva=10;
basekv=111;
% 1.bus no 2.realpower(KW) 3. Reactive Power(KVAR)
clear
clc
tic;
basemva=10;
basekv=11;
busdata=[1 0 0
2 35.28 36
3 14 14.28
4 35.28 36
5 14 14.28
6 35.28 36
7 35.28 36
8 35.28 36
9 14 14.28
10 14 14.28
11 56 57.13
12 35.28 36
13 35.28 36
14 14 14.28
15 35.28 36
16 35.28 36
17 8.... |
% compute objects
[ndintra,frdintra] = ProcessDirs(ndintra,'Object','frdiff');
[ndinter,frdinter] = ProcessDirs(ndinter,'Object','frdiff');
[ndintra,frdintra10] = ProcessDirs(ndintra,'Object','frdiff','AdjSpikes','redo','BinSize',10);
[ndinter,frdinter10] = ProcessDirs(ndinter,'Object','frdiff','AdjSpikes','redo','Bin... |
function [strSPL, strSpec1, strSpec2] = stimdispDEP(Stim)
% stimdispDEP - strings describing specific parameters of DEP stimulus
% [strSPL, strSpec1, strSpec2] = stimdispDEP(Stim) returns strings
% strSPL, strSpec1, strSpec2 describing the stimulus parameters of the
% DEP stimulus. Stim is the struct containin... |
function [code_A,code_B,... % these are matrices of sizes of A,B holding the calculated code per patch
bitCountPerTable,... % denotes how many bits were used to build this code
numKernelsPerAlternative] = ... % this is for statistics (internal)
BuildWalshHadamardCodes(tableInd,width,currFiltImgs_A... |
function seg_len = SegLength(cood_vec)
%UNTITLED 此处显示有关此函数的摘要
% 此处显示详细说明
[row,col] = size(cood_vec);
last_col = cood_vec(:,col);
%num_NaN = length(isnan(last_col));
if col<4
disp('col<4');
end
dist = 0;
counter = 0;
if col <= 4
counter = counter + 1;
for i = 2:1:(col-2)
dist = dist + sqrt(power(co... |
clc;
f = input('Digite a função f(x): ', 's');
df = diff(f);
x0 = input('Digite o primeiro ponto: ');
x1 = input('Digite o segundo ponto: ');
eps = input('Digite a tolerância desejada: ');
n = input('Digite o número máximo de iterações: ');
erro = 1;
i = 0;
fx0 = erro;
fprintf('| Iteração | Valor X0 | F... |
function subfnPrintResults(Parameters,fid,Thr)
if nargin == 1
fid = 1;
Thr = 9999;
elseif nargin == 2
Thr = 9999;
end
ModelNum = Parameters.ModelNum;
switch ModelNum
case '1'
% Get the threshold
Thresholds = fieldnames(Parameters.CondMod{1}.BCaci);
FirstThresh =... |
function [t,x,hdr] = read_sac(filename)
% [USAGE]
% [t,x,hdr] = read_sac('filename');
% [INPUTS]
% filename: filename ... the filename/path of the SAC file.
%
% [OUTPUTS]
% t: sac function time axis
% x: sac function data
% hdr: a structure containing header information
% hdr.data
%... |
function [D_off] = find_cmp_offset(basedir)
%% [D_off] = find_cmp_offset(basedir)
% This functnio calculates the compass offset based on
% temp.mat and vel_m.mat
% does not need Pitot velocity
%
% created by:
% Johannes Becherer
% Thu Mar 21 17:23:04 PDT 2019
D_off = 0;
Tfid =[ba... |
function desiFileUpload(~,~,fig,defP)
%desiFileUpload - this is the main function for starting to upload a file
%into the new DESI toolbox. This could be a saved file (mat/h5) or a new
%dataset to be processed, such as imzML or RAW.
% Close annotation / manipulation windows
f0 = findobj('Tag','manipulation');
close(f0... |
% f_cfo_est = estimate_sto_from_pilots(y_p, k_idx, l_idx, method='dft')
%
% Estimates time offset of OFDM frame from pilots using Lank-Reed-Pollon
% (Prony's) or DFT method.
% Dimension of input vectors is [N_sc, N_sym, N_ant].
%
% Arguments:
% x_p - matrix of transmitted pilot symbols
% y_p - matrix of... |
function y = mpyLt( L, lambda, x )
% mpyLt multiply vector by transpose of L factor from LTL or LTDL
% mpyLt(L,lambda,x) computes L'*x where L is the lower-triangular matrix
% from either LTL or LTDL and lambda is the parent array describing the
% sparsity pattern in L.
n = size(L,1);
y = x; % to ... |
function [BW2,fb,params,fits] = pcnnsegment(I,S)
if nargin < 2
S = [];
end
% Crop ROI
[I0,Gstr,rect] = getROI(I,S);
% Preprocessing
I1 = clahe(I0,[2 2],0.5);
I2 = isf(I1,15);
% Data structure
Data = datastr(I2,Gstr);
% Initialize population
[xi,fit,BWs] = initpop(Data);
% Differential evolution loop
tmax = Data.DE.... |
function anarad(respfname,ILD,ITD,LEVEL,T,MAP,b_array, direc)
% ANARAD calculates weighting factors for ILD,ITD and LEVEL input and T output using radial basis functions
% ANARAD(respfname,ILD,ITD,LEVEL,T,MAP,b_array, dir)
%
% ILD interaural level difference
% ITD interaural time difference
% LEVEL monaural ... |
%get image and create variables for other images
a = imread('rose.jpg');
[m,n]= size(a);
b = zeros(m,n);
c = zeros(m,n);
d = zeros(m,n);
e = zeros(m,n);
f = zeros(m,n);
g = zeros(m,n);
h = zeros(m,n);
i = zeros(m,n);
%loop to change grey levels for each image
for y=1:m
for x=1:n
b(y,x) = a(y,x)/2;
... |
%% Pitching moment curve of wing with (leading-edge and) trailing-edge high-lift devices deployed at low speeds
%% Clear and load in data
clear all
close all
fclose('all');
addpath('../jsonlab-1.5/');
datapath = '../data';
master_data = loadjson('../data/master_data.json');
pre_aero_data = loadjson('../data/pre_aero_d... |
function Rate_MUE_Vec = Rate_MUE(channel_mue_bs)
power_mue = 10^2.3;
%load('channel_mue_bs.mat');
cov_BS=zeros(20,20);
for i=1:180
cov_BS=cov_BS+power_mue*(channel_mue_bs(:,5+9*(i-1))*channel_mue_bs(:,5+9*(i-1))');
end
B=20*10^6;
power_noise = (10^-17.4)*B; %Total noise power (B*sigma2 in W)
frac=1;
Rat... |
function [x_playback,Gxx] = recording_background(fs,quantize,time_rec)
% [x_playback,Gxx] = recording_background(fs,quantize,time_rec)
% Inputs:
% fs = sampling rate
% quantize = quantization rate for signal
% time_rec = how long the time needs to be recorded
% Outputs:
% x_playback = recorded signal
% Gxx = G... |
% // clang-format off
function cropped = CropRandom(im, crop)
if length(crop) == 1
crop = [crop, crop];
end
window = randomCropWindow2d(size(im), crop);
cropped = imcrop(im, window);
end
|
function [dU_total] = gradient_decent(q, qG, CB)
% attractive potential
k_att = 1; % attractive gain
g_star = 3; % attractive threshold
if norm(q-qG) <= g_star
dUatt = k_att * (q - qG);
else
dUatt = k_att * (q-qG) / norm(q-qG);
end
% repaulsive potential
k_rep = 50; % repulsive gain
q_star = ... |
function [ D spif triggerif ] = util_load_spike_trigger_mcdstream_basefunc ( varargin )
%UTIL_LOAD_SPIKE_TRIGGER_MCDSTREAM_BASEFUNC Load spike and/or trigger stream from
%MCD data file. Using MCINTFAC
% The procedure is based on MCINTFAC(datastrm), therefore only works on
% Win32 Matlab.
%
% The procedure c... |
%Motor Constants
k = .9134; Rm = 2.14; J = 1.85; B = 357; Tgear = .0328;
%Resistor and Capactor Values
CI = .1E-6; %ohm
RI = 82E3; %ohm
Rb = 560; %ohm
Ton = .615; %seconds
Ksens = 610*Ton;
KI = 1/(CI*RI);
G0 = 1/k;
R = Rm + 2 * Rb/B;
Wm = (k^2)/(J*R);
s = tf('s');
Gm = G0*1/(1+s/Wm);
Gc ... |
% matrix file path
matrixFileName = "../data/ex15.mat";
usesymamd = 1;
% file in which to save memory
demo_mem_name = "demo_mem.txt";
disp("Run this into shell");
fprintf("'..\\scripts\\mem_monitor.ps1 [MATLAB.exe|octave-gui.exe] [interval in seconds; e.g. 1] | out-file demo_mem.txt -encoding ascii'\n");
i = input("[... |
function adjmat = twoset(~)
nforprofit = 14;
forprofitprob = 73/91;
nregional = 11;
regionalprob = 3/55;
crossprob = 75/154;
n = nforprofit + nregional;
zerodiag = ones(n) - eye(n);
ul = rand(nforprofit) < forprofitprob;
lr = rand(nregional) < regionalprob;
adjmat = [ul ur; ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Course: Understanding Deep Neural Networks
% Teacher: Zhang Yi
% Student:2019141460009
% ID:\:9a6c\:6653\:6668
%
% Lab 5 - Handwritten Digit to Speech Convertor
%
% Task: Design and train a neural netowrk to produce
% standard speech according to input
% ... |
%%hej
hej; |
function [ result ] = dev_arg_of_den(r, ak, ak_1)
%r is the r_max. a is the coe of denominator
%this function returns the derivative of argument of transfer function denominator
%this function is unfinished
delta_a = 0.000001;
syms w
f(w) = 0*w;
for k = 1:length(ak)
f(w)= f(w) + ak(k)*((r*exp(1j*w))^(-(k-1)));
end... |
% l1eq_example.m
%
% Test out l1eq code (l1 minimization with equality constraints).
%
% Written by: Justin Romberg, Caltech
% Email: jrom@acm.caltech.edu
% Created: October 2005
%
% put key subdirectories in path if not already there
% path(path, './Optimization');
% path(path, './Dat... |
function [PC_back,cycle_back,intmem_back]=MovACCToDir(PC,cycle,intmem,promem)
intmem_back=intmem;
addr=promem(PC+1,1)+1;
%load ACC
ACC=intmem(225,1);
%save Reg
intmem_back(addr,1)=ACC;
%cycle count
cycle_back=cycle+2;
PC_back=PC+2;
end |
function[X F V R] = check_danglers(X,F,V,R,p)
%check_danglers(X,F,V,R,p) - identify edges that connect only to one x-link.
% if they are running parallel to another edge (dangler or no) remove it.
% if they run in the same direction as a cross-linked edge, keep it. but
% make sure only to keep one. otherwise, remove ... |
function [ h ] = plotTensorComps( Y,opts )
defopts=struct('plotfunc','plot','position',[]);
if ~exist('opts','var')
opts=struct();
end
[plotfunc,fig_pos]=scanparam(defopts,opts);
Ycls=class(Y);
tensorName=inputname(1);
switch Ycls
case 'ktensor'
NumOfComp=length(Y.lambda);
NumOfMode=numel(siz... |
function heid = fleids2heid(fid, leid) %#codegen
% Encode <fid,leid> pair into a heid.
% HEID = FLEIDS2HEID(FID, LEID)
% See also HEID2FID, HEID2LEID
heid = fid*4+int32(leid)-1;
|
function [mem] = getFreeMemory(opt)
%GETFREEMEMORY [mem] = getFreeMemory(opt)
if nargin < 1, opt = '-m'; end
mem = 0;
if isunix
[s, m] = unix(['free ', opt, ' | grep Mem']);
if s ~= 0
warning('%s', m)
else
mem = str2double(regexp(m, '[0-9]*', 'match'));
... |
clear all
close all
clc
%% Funzione di costo e punto di minimo
f2 = 5; % derivata 2a
fcn = @(theta,t) 6+f2/2*(theta-5-sin(t/4)).^2;
Tf = 100;
t = 0:1e-2:Tf;
thetamin = 5+sin(t/4);
%% Parametri ES
%%% Lento, dimostrativo
a = 0.2; % osc. amplitude
omega = 50; % probing freq.
k = 5; % integrator g... |
clear
clc
close all
AnalizStruct.myPath='MyTest.wav';
AnalizStruct.Y = audioread(AnalizStruct.myPath);
data=audioinfo(AnalizStruct.myPath);
AnalizStruct.stepen=2;
AnalizStruct.new_vector = get_norm_vektor(AnalizStruct.Y,AnalizStruct.stepen);
AnalizStruct.timeInterval=25;%time of window
AnalizStruct.Fs=data.SampleRate... |
function selected_bands = Min_Max_Pooling(vec_hsi, reduced_bands_count)
% Preserve key characteristics in the spectral graph with
% min max pooling
% Find the maximum value by pooling
[len,d] = size(vec_hsi);
filter_size = floor(d / reduced_bands_count);
% Square filter without ove... |
function [] = run_lblDm(ndim, numWords, numDocs, newDocBOW, maxiter, savefile, impFeat, wPrior, dPrior)
% this is the main code to run to learn vectors
% it sets up model parameters and what training data to use
% the computing environment (i.e. minfunc path) is also se here
% declare global params used later
glo... |
function [rxBits] = Rx_CCDM_PAS(rxBits_afterFEC,PCS)
% Last Update: 29/03/2019
%% Input Parameters
nPol = size(rxBits_afterFEC,1);
idx_sign_perBlock = PCS.idx_sign;
idx_amp_I_perBlock = PCS.idx_amp_I;
idx_amp_Q_perBlock = PCS.idx_amp_Q;
idx_PAS_perBlock = sort([idx_sign_perBlock ...
idx_amp_I_perBlock idx_amp_Q... |
function [vFitsL, vFitsR, vErrL, vErrR] = func_vel_fit_list( frames, lftloc, rgtloc,SkipList,time_list,graph)
global yBin
global yBotEnd
global TPH
global umPerPixel
%This function simply creates a list of velocity fits based off the polyfit
%function
%Uses R-squared > 0.50 as a threshold for keeping a linear fit.
%Se... |
classdef NoOpTransformer < Transformer
methods
function [D,T] = trainAndApply(T,D)
end
function D = apply(T,D)
end
end
end |
function hh = xerrorbar(x, y, l,u,symbol)
% xerrorbar: Put error bars on x coordinate, rather than y coordinate
hh1 = errorbar(y,x,l,u,symbol);
for i = 1:length(hh1)
temp = get(hh1(i),'XData');
set(hh1(i),'XData',get(hh1(i),'YData'));
set(hh1(i),'YData',temp);
end
|
function [ g,b ] = CornerMatch( SADs,SADs_sorted,dstns,listL,GT, choosenRate)
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
g = 0;
b = 0;
[n_l,n_r] = size(SADs);
dsp = SADs_sorted(:,1:choosenRate*n_r);
[aa,bb] = size(dsp);
for i = 1 : aa
for j = 1 : bb
v = dsp(i,j);
... |
function [y,C,SR] = measurementModelArm(x,u,param)
%States
theta = x(1, 1:3);
omega = x(1, 4:6);
bias = x(1, 7:9);
% Measurement prediction
y = [
%accellometer measurement model
g*cos(theta)
%gyro measurment model
omega +bias
%magnetometer measurment model
... |
function f0c = logLinearTransform(f0s,f0t,f0)
%This function uses a Log Linear Transform to estimate the fundamental
%frequency of the morphed speech given the average fundamental frequencies
%obtained during training and the average fundamental frequency of the test
%speech
g = find(f0s == 0);
f0s(g... |
%This is the Accelerator Toolbox particle tracking code.
%Accelerator Toolbox was originally created by Andrei Terebilo.
%Development is now continued by a multi-laboratory collaboration,
%atcollab.
%
%The integrators used for tracking particles may be compiled with
%the command atmexall.
%For getting started, one may ... |
function ValveGrafBehavior = Model_Equations()
z = 0:.005:1;
A = 10;
QuickOpening = (1 - exp(-A*z));
SquareRoot = sqrt(z);
Linear = z;
B = 0.63;
EqualPercentage = - log(-.82*z + 1)/1.715;
SquareRoot2 = sqrt(z);
ModifiedParabolic = z.^3;
ValveGrafBehavior = plot(z,QuickOpening,z,SquareRoot,z... |
function[centers] = detectCircles(im, radius)
centers=[];
% find the edge of the image first
im_gray=rgb2gray(im);
im_edge=edge(im_gray,'canny',0.3);
% create a counter matrix same size of the image. For each detected edge
%pixel draw the circle and for each pixel on that circle increment count... |
clc
close all
clear all
%% Bakalářská práce
% Název: Segmentace ultrazvukových sekvencí
% autor: Jana Schwarzerová, učo: 186686
% Verze Matlab R2015b
%% Segmentace Rozvodí
% ****************************Načtení dat**********************************
% ... |
clear all;
close all;
clc
%Read all files
%orbit without bump nor kick
for i=1:720
%orbit without bump nor kick
file_orbit=['orbit_seed' num2str(i) '.twiss1'];
[num,s,orbit_x(:,i),a4,a5,a6,a7,a8,a9,a10,a11] = textread(file_orbit,'%s%f%f%s%f%f%f%f%f%f%f','commentstyle','shell');
%bumped or... |
%initialize parameters
t0 = 0;
tf = 1;
L=4;
N=4;
%define space mesh
a=0;
b=1;
dx = (b-a) / L;
x = a: dx : b;
% define time mesh
%dt = (tf - t0) / N;
dt=dx;
t = t0 : dt : tf;
%wave speed
c = .8;
%CFL number
mu = c * dt / dx;
%set inital value fucntion
f = sin(pi * x);
%set boundary valu... |
function [sigmah, thetah, sigma, theta, asi] = iccp_plot_ccpairs_fiofit_theta_sigma(ccpairs)
% Get data from ccpairs struct array
sigma = [];
theta = [];
asi = [];
sigmah = [];
thetah = [];
for n = 1:length(ccpairs)
if ( ccpairs(n).nmse1 < 0.1 )
sigmah = [sigmah; ccpairs(n).sigma1];
thetah =... |
clear;
micro = 1e-6;
step = 0.05*micro;
start = -1*micro;
finish = 1*micro;
t_pulse_input = start:step:finish;
t_pulse_input = t_pulse_input';
t_pulse_output_theoretical = t_pulse_input; %ideally should be out = in
t_pulse_output_experimental_x1 = extract_td_data("C:\Users\Test\OneDrive - Imperial College London\FYP... |
function [ion,fig,flag] = dpnDetIonMode(sp)
% Determine the ion modes of the various lines, considering that they
% haven't all been done perfectly.
%
% Tested using (JLA003_tumour_S4)
%
%
%
% James McKenzie, 2016.
% Note that mzcounts is just the number of features detected, rather than
% the intensities. If we ca... |
close all
tic;
qwe=RES_MOD2;
SNR=[10,5];
N_obs=10; %[1,3,10];
eps=[0.1, 0.05, 0.01];
N_samp=[250,300,400];
alfa=[610, 2000, 1060, 1900, 1480, 870, 3200];
for t=1:7
T=qwe{t,2};
str_f0=num2str(table2array(T(1,'f0')));
for k=1:length(SNR)
for l=1:length(N_obs)
for i=1:length(eps)
... |
function r = doubleInt(a,xmin,xmax,ymin,ymax,xne,yne)
%DOUBLEINT 此处显示有关此函数的摘要
% 此处显示详细说明
r = 0;
for xi = 1:xne
x_left = xmin + (xmax-xmin)/xne*(xi-1);
x_right = xmin + (xmax-xmin)/xne*xi;
for yi = 1:yne
y_left = ymin + (ymax-ymin)/yne*(yi-1);
y_right = ymin + (ymax-ymin)/yne*yi;
... |
function [vx,vy]=DynamicWindowApproach(pose_x,pose_y,ob_pose,V_x,V_y)
%A very simplified DWA path planning
pre_px=[pose_x];
pre_py=[pose_y];
pre_p=[pose_x pose_y];
delta_t=0.1;
for i=1:15
pre_px(i+1)=pre_px(i)+delta_t*V_x;
pre_py(i+1)=pre_py(i)+delta_t*V_y;
pre_p=[pre_p;pre_px(i+1) pre_py(i+1)];
end
ob_num=... |
function [xShift, yShift] = track_subpixel_wholeframe_motion_fft(...
stack, ref)
%[xshifts,yshifts]=track_subpixel_wholeframe_motion(movref,refframenum,maxshift);
% Tip: This function performs best if the input matrices have even numbers
% of rows and columns.
% Efficient subpixel image registration by crossco... |
%Aeolian Sand Ripples
%Jessica Bobeck
clear all
figure(1)
clf
%% initialize
%grain size
dgrain = .25/1000; %.25 mm diameter for grains
eta = 0.3; %porosity of soil
%distance array
xmax = 10; %m, max distance
dx = 0.02; %2 mm, distance between bins (4 grain widths wide)
x = (dx/2):dx:xmax-(dx/2); %x value is in the m... |
% CLXCURVE Complexity curve.
% [X,FEATS] = CLXCURVE(I,BW) computes five features from the complexity curve
% of the gray-level image I masked by the binary image BW: Maximum value of
% transitions (mv), average value of transitions (av), aample mean (sm),
% sample standard deviation (ssd), and entropy (ent). ... |
%-----------------------------------------------------------------------
% Job script created by scr_job_create, 28-May-2014 09:48
%-----------------------------------------------------------------------
global settings ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.