text stringlengths 8 6.12M |
|---|
function is_consistent = cache_check_consistency( cache )
% is_consistent = cache_check_consistency( cache )
%
% cache_check_consistency checks cache data structure of one object for consistency.
% This functions performs partial check which is relatively fast.
% If you are suspecting a cache bug try using cache_check... |
function cap_vec = get_subchannel_capacity(u)
cap_vec = zeros(1, length(u));
for i = 1:length(u)
cap_vec(i) = Capacity_Binary_AWGN(u(i), sqrt(2*u(i)));
end
end |
% Search('all_souls_000013.jpg', [136.5, 34.1, 648.5, 955.7], 20, 'C:\Users\nguye\Desktop\APP\VIR-Demo\VIR-Demo\' )
function result = Search( fileName, parts, top, path)
%% init parameter
addpath('AKM');
addpath('vlfeat\toolbox');
run('vlfeat\toolbox\vl_setup.m');
datasetDir = [path, 'oxford\images\'];
num_words = 10... |
% Good units script
% a is a CmaesBox object with everything loaded
disp('Freeway entrance link, verified in the pems and in the beats link ids lists :');
c=a.link_ids_beats(logical(a.mainline_mask_beats.*a.source_mask_beats))
c=a.link_ids_pems(logical(a.mainline_mask_pems.*a.source_mask_pems))
disp('Entrance of the f... |
function pointData = tsTimeSeriesToPointData( ms, potThreshold, potThresholdError )
% tsTimeSeriesToPointData: given a ms produces a structure pointData
% like the one produced by tsEvaSampleData
ms1 = ms(ms(:,2) > potThreshold, :);
percentile = (1 - size(ms1, 1)/size(ms, 1))*100;
pointData.completeSeries = ms... |
%logo design exercise
clc;clear;close;
%img = imread('logo_design.jpg');
img = imread('apple.jpg');
gray = rgb2gray(img);
%imhist(gray);
T1 = 50;
T2 = 35;
binarization = (gray>T2);
imshow(binarization);
roi_size = sum(sum(binarization));
%imshow(img); |
a=0;
b=2;
c=1;
i=1;
for L=-2:0.001:2
K=((L-a)+sqrt((a^2)-2*a*L+(L^2)-4));
r=[-K^2+(L-a)*K; -c*K; 0];
M=[K^(-2)+(a-L)*K^(-1), c, 0; c*K^(-1), b-L, c*K; 0, c, (a-L)*K+K^2];
x=r\M;
D(i)=det(M);
Real(i)=real(D(i));
Imag(i)=imag(D(i));
R(i)=x(1);
X0(i)=x(2);
T(i)=x(3);
i=i+1;
end
abs(T(1500))^2... |
%% MMSP2 - Lab 1
% Exercise 3 - Discrete memoryless source coding
clearvars
close all
clc
%% 1) Generate one realization of length 1000000 of the following process:
%% y(n)=min(max(0,round(rho*y(n-1)+w(n))),15)
%% where rho=0.95 and w(n) is Gaussian with variance=1
%%M = max(A,[],dim) returns the maximum eleme... |
function PSPM_EXAMPLE_scr_overview()
%%% A MICE Raw SCR Data Overview %%%
% harcoded parameters
datadir = '/Users/kylekurkela/Documents/datasets';
datadirs = cellstr(spm_select('FPList', datadir, 'dir', '^PsPM'));
names = regexp(datadirs, 'SCRV.', 'match');
names = unNest_cell_array(names);
trims = {1:180, 1:45,... |
%test nominateJ
n=[200 150 150];
m=[20 0 0];
rho=1;
M=[.5 .3 .4; .3 .8 .6; .4 .6 .3];
N=.5*ones(3,3);
Lam=rho*M+(1-rho)*N;
rng(123); % set the seed
[A, observe, truth] = makeSBM(n,m,Lam);
d = rank(Lam);
k = length(n);
numRedLeft = n(1)-m(1);
%% Test 1: test obvious case
order = nominateJ(A, observe, k, d);%, embedF... |
%% Merge script
cd('E:\EEGMeditationLab\A3_Manual_Cleaned')
allSets = dir('*.set');
for subjectId = {'104','105','107','210','211','212','213','103'}
for sessionId = {'0','1'}
subjectsets = {};
for setIndex = 1:length(allSets)
loadName = allSets(setIndex).name;
subject = l... |
% modelParam: 'sig', 'pp' or 'pl' for sigmoidal, piecewise power or piecewise linear
function [x, yy, eFR,iFR,peakFreq,harmonicFreq,freqRatio,peakAmp,harmonicAmp,powerRatio,hilbPhaseDiff] = test_WCJS2014(e0,i0,displayFlag)
if ~exist('displayFlag','var'); displayFlag=0; end
eqnName = 'e... |
function spc_undo
global gui;
global spc;
if (spc.switches.imagemode == 1)
%save settings
spc_roi = get(gui.spc.figure.roi, 'Position');
saveSize = spc.size;
%%%%%%%%%%%%%%%%%%
%spc.imageMod = spc.image;
spc_openCurves(spc.filename);
%try; spc.size = spc.sizeOrg; catch; end
%image = res... |
function [ r ] = DIS( R , DISs)
%R: set of selected attribute index
%DISs: DIS of each attribute
% Merge DIS of selected attribute set
r = [];
for i=R
r = union(r,DISs{i});
end
end
|
% Очистка командного окна
clc
% Вывод двух векторов и матрицы 2X2
v = [8 3]
w = [4; 1]
m = [29 -2; -44 22]
% Нулевая матрица 2го порядка
m0 = zeros(2)
% Матрица с единичными элементами 2го порядка
m1 = ones(2)
% Матрица с элементыми, имеющими случайное значение 2-го порядка
mr = randn(2)
% Единичная мат... |
function A = shift( A, i, k )
% Shifts the ith row of the Matrix A to the right k times.
% A Matrix, i row index, k shift number
[M,N] = size(A);
if i>M
error(['Row index ', i, ' is out of bounds for the matrix A.'])
end
if exist('k','var')
if k > N || k < 0
k = mod(k,N);
end
else
k = 1;
... |
function [ssResponses,ssRTs,savedResponsesFile] = TMSrunEventRelated(ScanName,params,savedTrialsDir)
% General script to run an event-related TMS experiment.
% Allows you to adjust the run length and stimulus length by
% adjusting the first few parameters. The stimuli should be saved as a
% separate mat file for each... |
%==========================================================================
clear all, close all
clc
%load subbands_InGaN_201.mat
%==========================================================================
% define FEM grid
mesh.L = 10e-9; % total length, m
mesh.nn = 201; ... |
% Subsonic Drag Code
% Form factor is used for pressure drag because wave drag is not included.
% Form factor is from Mason FRICT code
% Initialisation
clear
close all
fclose('all');
addpath('../jsonlab-1.5/');
datapath = '..\data';
% Load in isa.json
ISA = loadjson([datapath filesep 'isa.json']);
% Load in require... |
function P = myband(Ax,H,CData,XCoor,LData,HData,Opt)
% myband [Not a public function] Plot error bands aroud central line.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%---------------------------------------------------------... |
function [ret] = loginCTP2(obj)
obj.srcType = 'CTP';
front_addr_ = 'tcp://140.207.227.81:41213';
broker_id_ = '16337';
investor_id_ = '8880010013';
investor_password_ = '458230';
mdlogout;
pause(3);
ret = mdlogin(front_addr_, broker_id_, investor_id_, investor_password_);
end |
%%
% Peter 1200 deg twitch
files = [856:905];
% Peter sweeps
files = fTypes(s1',3)'; % Catch
files = fTypes(s2',3)'; % single pulse at 1 sec
files = fTypes(s3',3); %
files = fTypes(s4',3);
files = fTypes(s5',3);
files = fTypes(s6',3)'; % Ramp and Hold?
files = [490:500];
% Left AP Awake Trials
files = [362,364,36... |
clc;close all;clear all;
addpath(genpath('manopt_cur'));
addpath(genpath('test_slate'));
addpath(genpath('image_experiment_focm'));
Times = 100;
patch_size = 8;
D = dir(fullfile('test_slate', '*.pgm'));
idx = 8;
img = imread(D(idx).name);
if ndims(img) > 2,
I = double(rgb2gray(imread(img)));
... |
function getPlots(vawt, option)
%GETPLOTS Plot generator of the VAWT solution.
%
% vawt.getPlots plots power coefficient against tip speed ratio and
% torque, residuals, flow velocity, interference factor and angle of
% attack against azimuthal angle.
%
% vawt.getPlots(option) plots the VAWT solution diff... |
clear all, close all
it=5;
yy = [1 2 4 8 16];
xx = [11 5 3 1.5 0.75];
i=yy(it);
nx=270*i;
dx=xx(it);
ny=nx*3;
dy=ny*4+nx;
pin=['/nobackupp2/mpschodl/llc/prep/llc_' num2str(nx) '/bathy/'];
fn=[pin 'Bathy_compact_llc' num2str(nx) '_' num2str(nx) 'x' num2str(dy) '_v0.bin'];
fn1=[pin 'ima... |
'hello world'
|
function filter12(block)
setup(block);
function setup(block)
block.NumInputPorts=1;
block.NumOutputPorts=1;
block.SetPreCompInpPortInfoToDynamic;
block.SetPreCompOutPortInfoToDynamic;
block.InputPort(1).DirectFeedthrough=true;
block.SampleTimes=[-1 0];
block.SimStateCompliance='DefaultSimState';
block.SetAccelRunOnTLC... |
classdef ACZ < sqc.op.physical.operator
% adiabatic controled Z gate
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
aczLn % length of the acz pulse, pad length and meetup longer not included
amp
thf... |
function demo1
%
% This demo computes the intersection between a cone and a plane, and
% represents the intersection as a Gaussian Probability Density Function
% (PDF). The algorithm can be used to extract probabilistically information
% concerning gazing or pointing direction. Indeed, by representing a visual
... |
function [all_theta] = oneVsAll(X, y, num_labels, lambda)
m = size(X, 1); % number of experiments (rows)
n = size(X, 2); % number of features (colums) pixels
all_theta = zeros(num_labels, n + 1); % row per label, 1 + columns per feature
% all_thetha looks like this
% p 1 | p 2 | p 3 | p 4 | p 5 | ...
% lab... |
% ADDMGAP.
%
% MPF: I neglected to add the relative gap to the info_sol structure.
% This manually computes the gap for the natural image experiment. For
% `wflow`, just add 'NaN', since it's not relevant there and won't be
% used.
files = dir('cache/wusterland_saga*');
for i=1:length(files)
name = files(i).name;
... |
function [CR C] = measure_contrast_ratio(sta_image,image,xc_nonecho,zc_nonecho,r_nonecho,r_speckle_inner,r_speckle_outer,f_filename,plot_flag)
if nargin < 9
plot_flag = 0;
end
%% Non echo Cyst contrast
xc_speckle = xc_nonecho;
zc_speckle = zc_nonecho;
% Create masks to mask out the ROI of the cyst and ... |
function OutFileName = subfnWriteDatatoCSV(Location)
BasePath = '/share/users/js2746_Jason/Studies/ApoEStudy'
load(fullfile(BasePath,'FSheader.mat'));
for i = 1:length(Header)
fprintf(1,'%d\t%s\n',i,Header{i});
end
SelectedPath = spm_select(1,'dir');
cd(SelectedPath)
if exist('data_0001.mat')
load data_0001... |
function [a_lms, gamma] = recover_vol_coeffs_from_moments(a3_micro, a2_micro, a1_micro, maxL, L, B, W, B_lists, r_cut, a_init)
% Function to solve a least-squares problem to recover the volume expansion
% coefficients and the average fraction of pixels in a micrograph occupied
% by signal.
%
% Inputs:
% * a3_micro, ... |
function [x,y] = pathbdry(p)
% Returns coordniates of the boundary of path with center (p.xc,p.yc),
% width p.width and type p.pathtype
if p.pathtype
disp('Unknown path type.')
end
w = p.width/2;
xc = p.xc;
yc = p.yc;
n = length(xc);
dx = diff(xc);
dy = diff(yc);
l = sqrt(dx.^2+dy.^2);
% connecting lines: c*x+... |
function f=getslim(path,slno,imno,imsize,ext)
% Usage ... f=getslim(path,slno,imno,imsize,ext)
%
% For images written natively in Sun/Unix computers use [64 64 1]
% For images written natively in PC/Linux computers use [64 64 2]
if nargin<5,
ext='';
else,
if (~isempty(ext)), ext=[ext,'.']; end;
end;
if imno<1... |
clear all;
%% Employee assignation algorithm for a AMPM store chain
%
% The algorithm uses a Genetic Algorithm as the minimization solver.
% It currently works as a proof of concept. The main objective
% function is the minimization of employee costs. The code is not
% optimized so the program... |
function [Reg_model,rms] = learn_one_BLSregressor_version2(Data,LearnedDistribution, options, current_cascade)
nData = length(Data);
n_points = size(Data{1}.shape_gt,1);
shape_dim = 2*n_points;
GMMtag = options.GMM;
if strcmp(options.descType,'sift') == 1
desc_dim = 128;
... |
function [ startFrame, endFrame ] = getBestLoop( src, minLength )
%GETBESTLOOP Calcule la paire de frames la plus ressemblante
% minLength correspond à la taille minimale de la boucle vidéo
% src correspond à une tableau 4D des pixels de la vidéo (w,h,col,frames)
% TODO : Question 1
startFrame = 1;
end... |
clear;
clc;
name_list = ["citywall.bmp" "citywall1.bmp" "citywall2.bmp" "elain.bmp" "elain1.bmp" "elain2.bmp" "elain3.bmp" "lena.bmp" "lena1.bmp" "lena2.bmp" "lena4.bmp" "woman.BMP" "woman1.bmp" "woman2.bmp"];
img1 = imread('citywall.bmp');
img2 = imread('elain.bmp');
img3 = imread('lena.bmp');
img4 = imread('woman.bmp... |
function v = rev(x)
l=length(x);
v=x(1:l/2);
v = [];
for j=1:length(x)
v(j) = x(length(x)-j+1);
end |
classdef Polynomial2D
methods ( Access = public )
function obj = Polynomial2D( coefficients )
assert( all( diff( size( coefficients ) ) == 0 ) );
obj.coefficients = coefficients;
obj.order = size( coefficients, ndims( coefficients ) );
... |
timeperiod={{[0 100 900 1000]} {[1000 1200 2800 4000]}};
labels={'1sec'};
nomove='NO1';
immove='IM1';
ammove='AM1';
n_con_ex=6;
clear dm Res_in Res_out Y decision_values
code_louk_2ds
zerds1=ztype;
dsR1i=Res_in;
timeperiod={{[0 250 2750 3000]} {[3000 3250 5750 6000]}};
labels={'3sec'};
nomove='NO3';
immove='IM3';
a... |
function cueLabel = binWave2CueLabel(binWave)
% binWave2CueLabel: get sample indices of cue points from a given binary
% waveform
% Usage: cueLabel = binWave2CueLabel(binWave)
% binWave: binary waveform (it must contain some cue points)
% cueLabel: sample index of each cue point
%
% For more details abo... |
clear;
clc;
[Y,Fs] = audioread('C:\Users\Hi\Desktop\LVTN\GUI_matlab\Audio\s0.wav'); %doc file am thanh
% do dai cua 1 frame theo giay
fr_du = 0.01;
% do dai cua 1 frame theo sample
fr_le = fr_du * Fs;
% do dai cua file am thanh theo sample
N = length(Y);
% tao ma tran thoi gian cua file am thanh
time = (0:N-1)/Fs;
lap ... |
function [PFC, MD, goodPFC, goodMD] = cleanData(Spfc, Smd, Z_C1)
addpath('/Users/rvrikhye/Dropbox (Personal)/Rajeev/Rajeev_Code/');
%% compile all spikes.....................................................
if isfield( Spfc, 'SpikeTimes_R1C1_inc') == 1
ver = 'new';
elseif isfield( Spfc, 'SpikeTimes_R1C1_inc') ... |
% small_ice_FTP_in.m ADVISOR 2003-00-r0116 input file created: 29-Mar-2014 12:38:53
global vinf
vinf.name='small_ice_FTP_in';
vinf.drivetrain.name='conventional';
vinf.fuel_converter.name='FC_SI41_emis';
vinf.fuel_converter.ver='ic';
vinf.fuel_converter.type='si';
vinf.transmission.name='TX_5SPD';
vinf.transmission... |
%2012 12 16 by lichao
%2012 12 24 修改,克服了黑色网格化现象。
%传统相机成像
%距透镜d的物体,在透镜后v处成的像
%适用与近轴光学,即物体离透镜的距离远大于焦距
%可分别令v=16,17,0,17.094,15.84
%%
clc
clear all
close all
addpath(genpath('.\image'));
addpath(genpath('.\sub'));
%% 参数
D=4; %直径
F=16; ... |
function [ outPts ] = geoTiffProj(info, pts, direction, isXY)
% GEOTIFFPROJ
%
% DESCRIPTION
%
%
% SYNTAX
%
%
% INPUTS
% info: output of geotiffinfo.m
% pts: Nx2 [ image space is row/col; model space is x/y ]
% direction: 0 or 1
% (0) image -> model convers... |
classdef Config
methods(Static)
function ret = rootPath
ret = 'C:\Users\rudi\Documents\GitHub\BaSampleApp';
end
function ret = jfxrtPath
ret = 'C:\Program Files\MATLAB\R2015b\sys\java\jre\win64\jre\lib\jfxrt.jar';
end
function re... |
function equations = tracks_to_equations(cameras, tracks)
num_tracks = length(tracks);
% Build linear systems of algebraic error.
equations = struct('Q', {}, 'q', {});
for i = 1:num_tracks
[Q, q] = track_to_equations(cameras, tracks(i));
equations(i).Q = Q;
equations(i).q = q;
end
end
|
close all;
%results;
for ind = 1:32
newFile = fullfile("results"+num2str(ind)+".m");
run(newFile);
surf(F);
% axis([-1 1 -1 1, -0.06, 0.06]);
caxis([-0.04, 0.04]);
colorbar;
shading interp;
pause(0.1);
end
|
%#eml
function [StanceFoot_pos,StanceFoot_alpha,SwingFoot_pos,SwingFoot_alpha,stance_left_right,swing_left_right] = ...
Switch_from_Current_to_New_Configuration...
(StanceFoot_pos,StanceFoot_alpha,SwingFoot_pos,SwingFoot_alpha,stance_left_right,swing_left_right)
temp_swing_footpos = SwingFoot_pos;
temp_stance_... |
qq% Clear the workspace
close all;
clearvars;
% set wd
version = 'version_fin_withEyetracking';
try
EXP_DIR = ['/Users/steffimeliss/Dropbox/Reading/PhD/Magic tricks/fmri_study/' version '/'];
cd(EXP_DIR)
catch
EXP_DIR = ['/Users/stefaniemeliss/Dropbox/Reading/PhD/Magic tricks/fmri_study/' version '/'];
... |
function out = ANSI_away(In)
% Atomic Norm System ID
% Later to be used for Multiresolution exploration
% includes away steps to speed up convergence and promote sparsity
%% Process Input
T = In.T;
y = In.ym;
tau = In.tau.tauAtom;
delta = In.tau.delta;
t_max = In.t_max;
m = In.k;
N = size(T,2);
if isfield(In,'h0')
... |
% Ejercicio 1
v1 = [3.0, -1.0, -3.0];
v2 = [4.0, 3.0, 3.0];
res1 = dot(v1, v2);
% Ejercicio 2
name = 'jose maria';
vN = double(name);
surname = 'jeswani000';
vA = double(surname);
vA = 3 * vA;
res2 = vN + vA;
% Ejercicio 3
d = [24, 5, 1999];
res3 = mod (norm(d, 2), 11);
% Ejercicio 4 (optati... |
clear; clc;
x =[4; 8; 16; 30; 50];
y=[25; 125; 100; 75; 30; 5];
ycum=[25; 150; 250; 325; 355; 360]
mu=11;
sigma=2;
crit =lognpdf(x,mu,sigma)
|
function out = project_settings
% Edit these variables to for your project
%
% This file is only used during project initialization. You can throw it away after
% that, but I'd keep it around anyway, just in case.
% The name of your project and its GitHub repo. Capitalization should match what
% your public "branding"... |
% This program displays a list of 1 to 8 options for transmission line
% analysis and compensation.
%
% Copyright (C) 1998 by H. Saadat.
global resp model par1 par2 linelngt freq
clc
menu2 = [
' TRANSMISSION LINE PERFORMANCE '
' ----------Analysis---------- Select'... |
% =========================================================================
% Function: GetRectangularShearStressSF
%
% Parameters: shearForce (N), length (mm), width (mm), yieldStrength
% (MPa)
%
% Outputs: n (shear stress safety factor)
%
% Description: Calculates the shear stress safety factor for a
%... |
x = linspace(0, 1, 20);
%plot curve
d = 0.6 * sin(2*pi*x) + cos(2*pi*x);
plot(x, d);
xlabel('x');
ylabel('d');
%Inputs for perceptron
n = 6; %four neurons
W = randn(n*2,1);
B = randn(n,1);
b_out = randn(1); % ouput bias value
y = zeros(1, 20);
e = zeros(1, 20);
nu = 0.03; %learning rate
for l=1:1000000
for i=1:2... |
function out = bbgp(A, b, x0, opt)
%
% function out = bbgp(A, b, x0, opt)
% Solve a nonnegative least squares problem, min ||Ax - b||_2, s.t. x \ge 0
% Barzilai-Borwein Gradient Projection.
%
%
% x0 -- Starting vector (useful for warm-starts).
%
% OPTIONS -- This structure contains important opt that control how the
% ... |
function [ time_TimeShift, velocityZPrime_TimeShift, oxygenPrime_TimeShift, ecFluxOxygen_TimeShift, ecFluxOxygen_NoTimeShift, velocityZPrime, oxygenPrime, iFigure, bestPValue, pValues, timeshift, iShiftOxygen] ...
= segment_time_shift_EC_imposed( Param, time, velocityZ, oxygen, plots, imposed_shift)
%Update Jun... |
function [ descriptor ] = get_descriptor_from_data_with_model( input,layer_size,acc,gyro )
% return feature of the input data
% input: 6 * sample_size;first 3 rows is acc data, last 3 rows is gyro
% data
%
% add model and util funtions to matlab path
addpath('../util/');
% load trained model parame... |
% necessary path
addpath(genpath('./Surfacelet'));
% parameters (see mrics5_PLS_TV_init_515_objhalf)
alpha = 2;
alphal = .01;
beta = 1;
betal = .1;
mu = 0.5;
mul = .1;
gamma = .01;
% Can adjust max iteration number and tolerance
MaxIter = 10;
tol = 1e-4;
% get original P(x,r), choose one slice for experiment, then ... |
% This function makes classification of customers data included in a csv file
% and exports them into an arff file (weka format)
function preprocessing()
clear all;
n = 3000;
% Open csv file and split into arrays
input = csvread('RFM_Data.csv',1,0);
% Initialize arrays
ID = zeros(n,1);
R = zeros(n,1);
... |
function dX = my_dynamics(t,X,param)
[N,s,M,Nq] = getParams();
g = 9.81;
alpha = param.alpha;
T_stance = param.T_stance;
z = X(1);
dz = X(2);
s = t/T_stance;
Fz = polyval_bz([0, alpha],s);
ddz = -g + Fz/M;
dX = [dz;ddz];
end |
function rgbPoints(snapShot, properties)
figure, imshow(snapShot);
hold on;
for c1 = 1:numel(properties)
radius = sqrt(properties(c1).Area / pi);
halfRadius = radius / 2;
plot(floor(properties(c1).Centroid(1) - halfRadius), floor(properties(c1).Centroid(2)), 'rx');
plot(floor(p... |
% Rozdělení bodů pomocí klasifikátoru s minimální vzdáleností
function [ ] = minimalni_vzdalenost( tridy2, stredy )
% tridy = rozdělení bodů do shluků
% stredy = středy shluků
data_size = size(tridy2);
[pocet_shluku,~] = size(stredy); % počet shluků
velikost_shluku = zeros(1, pocet_shluku); % počet bodů v jednotlivých... |
classdef Busstop < Road
properties (SetAccess = protected)
peopleCount
end
end
|
function motif = make_motif( tile, group )
% motif = make_wallpaper( tile, group )
% Creates a 2D image wallpaper motif given an m x n image patch
% and a specified wallpaper group type.
%
% tile : m x n sparse matrix
%
% motif : sparse matrix
%
% Written by Rick Gilmore, thatrickgilmore@gmail.com
%
% ... |
function [xsol, NumSV] = BCAugLag(xstart, lambda0, etaTol, omegaTol, C, Data)
mu = 10; omega = 1/mu; eta = 1/(mu^(0.1)); NumIter = 0;
x = xstart; lambda = lambda0; n=length(x);
y = Data(:,1); H = MatQPD(Data);
while 1>0
NumIter = NumIter + 1;
% generate the model coef for the updated mu and lambda
[G, c, l, u... |
% This function is the implementation of the measurement model.
% The bearing should be in the interval [-pi,pi)
% Inputs:
% x(t) 3X1
% j 1X1
% Outputs:
% h 2X1
function z_j = measurement_model(x, j)
... |
function [LineSign] = calc_lineside(Longitude, Latitude, x1, x2, y1, y2)
% A1 = [119.7767 -0.7050];
% A2 = [119.8465 -0.8800];
% A3 = [119.8694 -0.8720];
% A4 = [119.8030 -0.6953];
% x1 = A1(1);
% y1 = A1(2);
%
% x2 = A2(1);
% y2 = A2(2);
b = -(x2-x1)/(y2-y1);
c = -x1 + (x2-x1)/(y2-y1)*y1;
LineSign... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% viewer.m simply shows an image or sequence that is chosen via user
% interface. The possible argument is an vector defining the part of the
% frames that should be shown, limits=[xmin,xmax,ymin,ymax].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function plotResults(control)
global GLB_INVP;
set(0, 'defaultaxesfontsize',16,'defaultaxesfontweight','normal',...
'defaultaxeslinewidth',1.0,...
'defaultlinelinewidth',1.0,'defaultpatchlinewidth',1.0,...
'defaulttextfontsize',16,'defaulttextfontweight','normal');
show(GLB_INVP.mesh.t, GLB_INVP.mesh.p, ... |
%% Compare different tracking methods, Sensivity vs. specificity plot
global dynanets_default;
simscenarios = {'Expand'; 'Contract'; 'Split'; 'Merge'};
cfg = [];
cfg.data.patients = {'Simulation'};
cfg.preprocess.ref = '';
cfg.preprocess.filt = 'firls';
cfg.preprocess.band = [4 50];
cfg.infer.method = 'corr_0_lag';... |
clear all
%% freesurfer
area_data=readNPY('.../abcd_area.npy');
fs_ids=readtable('.../abcd_fs_id.txt','ReadVariableNames',false,'Delimiter','\t');
fs_ids=fs_ids.Var1;
fs_ids1=fs_ids;
for i=1:10888
f=fs_ids{i};
fs_ids1{i}=strrep(f,'sub-NDAR','NDAR_');
end
fs_ids2=fs_ids1(area_data(:,1)~=0);
area_data=area_dat... |
function [specStruct, variableFactors] = script2_testingSpec(outputString, wantVariableOnly)
addpath(genpath(fullfile('..','Common')));
variableFactors.outputString = outputString;
outputStrSplit = strsplit(outputString, '_');
switch outputStrSplit{3}
case '10'
docsim_gen_settings_10knots; % 10knots 20kn... |
function [result_image, tracking_info] = ...
find_hand_initial2(depth_frame, previous_tracking_info, parameters)
% function [result_image, tracking_info] = ...
% find_hand_initial2(depth_frame, previous_tracking_info, parameters)
%
% identifies hand candidates by finding differences to initia... |
% Generated through Matlab
% Author: Christian Haffner
% E-Mail: christian.haffner@ief.ee.ethz.ch
% Organization: ETHZ ITET IEF
% Last Edited: Christian Haffner
function results = calculateDragEffect(model, varargin)
%Input Variables: - model = comsol model
% VARARGIN options (extend o... |
%
% Make a pair of plots of the monitor SPDs
%
cd /wusr5/brian/book/11app/fig/subPhosphors
load hit489
xtick = [400 500 600 700];
ytick = [0:.2:1];
wave = 370:730;
wgts = [.8 1 .5]';
hit489 = hit489*diag(wgts);
m = mmax(hit489);
hit489 = hit489/m;
r = hit489(:,1);
g = hit489(:,2);
b = hit489(:,3);
p = plot(wave,r,'... |
function [Cov_E, Mu_E] = Cov_E_and_Mu_E(noisy_data,freqs,num_of_delta_alpha,n_r,Sigma)
FFT_noisy_data = zeros(2*n_r,size(noisy_data,2));
for i= 1:size(noisy_data,2)
FFT_noisy_data(:,i) = nufft1(noisy_data(:,i),freqs);
end
FFT_noisy_data = reshape(FFT_noisy_data,2*n_r*(2*num_of_delta_alpha+1),[]);
Mu_E = m... |
function [im,imData] = LoadImage( im, imData, imagePath, bufferNum )
%LOADIMAGE [varargout] = D3d.LoadImage( im, imData, imagePath, bufferNum )
%sends the image data to the directX viewer.
%
%IM is an 'uint8' image 3D-5D image matrix, optional.
%IM_DATA is astructure that holds metadata for the image and
% needs to b... |
close all;
clear;
global Link
ROBOT = 'robot-2';
switch ROBOT
case{'robot-2'}
robot_2
end
ToDeg = 180/pi;
ToRad = pi/180;
DRAW = 1;
LAMBDA = 0.5;
num=1;
last_arm = length(Link);
i = linspace(-pi,pi,50);
y_paint = 5 * 16 .* sin(i).^3;
z_paint = 10 * (13 .* cos(i) - 5 .* cos(2*i) - 2 .* cos(3*i) - cos(4*i)... |
%
% Day 18, Advent of code 2017 (Jonas Nockert / @lemonad)
%
%
% Part one.
%
program0 = program(0, 'day18.in', true);
program0.run([]);
first_frequency = program0.getFrequency();
fprintf('Value of the first recovered frequency: %d\n', first_frequency);
assert(first_frequency == 7071)
%
% Part two.
%
program0 = prog... |
Img=zeros(1,576*720);
for q=270:1:290
for w=300:1:320
Img(q*720+w)=1;
end
end
p0(1)=270;
p0(2)=297;
imshow(Img); |
function envFinal = envelopeGenerator(signalAmp, signalTime, index, row, maxAmp, samples, fs, interpType)
% envFinal = envelopeGenerator(signalAmp, signalTime, index, row, maxAmp, samples, fs, interpType)
%
% signalAmp : amplitude array
% signalTime : time array
% maxTime : time is in milliseconds
% fs : samplin... |
for i=1:size(spikes,2)
sX(:,:,i)=X(sEEG_idx,SP(i)-50:SP(i)+50);
x=sX(:,:,i);
sY(:,:,i)=X(iEEG_idx,SP(i)-50:SP(i)+50);
y=sY(:,:,i);
r(i,:)=y(1,:);
w(:,i)=inv(x*x')*x*r(i,:)';
z(i,:)=w(:,i)'*x;
end |
function [armAngles] = readArmPos(Serial)
fprintf(Serial,'%s\r', 'QP 0 QP 1 QP 2 QP 3 QP 4');
armAngles = fread(Serial,5,'uint8');
armAngles = armAngles.*10;
armAngles = armAngles';
end
|
function x = enumStr(enum)
% ENUMSTR
%
% Description:
% Returns only the 2nd output of Matlab's enumeration fcn
%
% Syntax:
% x = enumStr(enum)
%
% Input:
% enum Name of enumeration class as a char
%
% Output:
% x Cell array of enumeration m... |
function varargout = Lastik_Tanima_AnaPencere(varargin)
% LASTIK_TANIMA_ANAPENCERE MATLAB code for Lastik_Tanima_AnaPencere.fig
% LASTIK_TANIMA_ANAPENCERE, by itself, creates a new LASTIK_TANIMA_ANAPENCERE or raises the existing
% singleton*.
%
% H = LASTIK_TANIMA_ANAPENCERE returns the handle to a new L... |
function [Tx, Ty]=demosimp(im, refim)
% Original image size
dimen=size(refim);
% Go across sublevels
Tx=0;Ty=0;
for level=3:-1:1
% Size at the smallest hierarchical level, when we resize to smaller
M=floor(dimen/2^(level-1));
% current image size
refim1 = imresize(refim,M);
im1 = imresize(i... |
function plan = buildfile
plan = buildplan(localfunctions);
plan.DefaultTasks = "test";
plan("test").Dependencies = "check";
end
function checkTask(~)
% Identify code issues (recursively all Matlab .m files)
issues = codeIssues;
assert(isempty(issues.Issues),formattedDisplayText(issues.Issues))
end
function testTask(... |
clear all
close all
%Zadanie 1
A = MacierzA(alfa,N);
% %Zadanie 2
alfa = detMacierzA(A, N);
%zadanie 3
Y1 = wyznaczOdwrotnaLLt(A);
Y = wyznaczOdwrotnaLU(A);
%zadanie 4 i 5
B = MacierzB(k,N);
%% Zadanie 1
%Wygenerowanie macierzy o zadanym rozmiarze n i zadanej wartosci x
function A=MacierzA(alfa,N)
%A-zwracana wyg... |
clear all
clc
root = GetFullPath(fullfile(fileparts(mfilename('fullpath')), '..', '..', '..'));
train = [17, 19, 20, 21, 22, 24, 25, 26];
test = [11, 12, 14, 16, 24, 25];
trainFile = arrayfun(@(x) strcat('v', num2str(x), '-1500frames-processed.mat'), train, 'UniformOutput', false);
testFile = arrayfun(@(x) strcat('v... |
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/AMIGO_sensRHS.m 2161 2015-09-22 07:18:19Z attila $
function inputs = AMIGO_sensRHS(inputs)
% ---- Core code ---------------------------------------------------------
% the code computes analytically the right hand side of the Sensitivity equation
%
% The system can be inde... |
function ds_heel_con = ds_heel_con(in1,s_heel,th)
%DS_HEEL_CON
% DS_HEEL_CON = DS_HEEL_CON(IN1,S_HEEL,TH)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 24-Jun-2020 17:52:13
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
q4 = in1(:,4);
q5 = in1(:,5);
q6 = in1(:,6);
t2 = cos(q1);
t3 =... |
function [plaintext,Key]=crackhill(knownplaintextsnippet,ciphertext,blocklength)
temp=block(knownplaintextsnippet,1,blocklength)-97;
[rows,cols]=size(temp); %get row and column
booleanInvert=0; % boolean to see if we have found the inverse of plaintext.
while booleanInvert==0
ind... |
clc
clear all
cou = 0;
for i = 1:7500
% Randomly picking 2 unvoiced samples
un_i = randi(7552);
un_j = randi(7552);
% Randomly picking 3 voiced samples
vo_i = randi(19066);
vo_j = randi(19066);
vo_k = randi(19066);
% Converting into their filenames
un_file1 = ['unvoi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.