text stringlengths 8 6.12M |
|---|
function output = springNeap(const,OPT,IN)
% Function used in morfacTide.getSignal
% Inputfields are defined in morfacTide.getSignal()
% Function returns a timeseries of a single repetition of a
% repr. spring-neap cycle.
% Rewrite the relevant constituents
idO1 = strcmp(const.name,'O1');
idK1 = strcmp(const.... |
function [poly, keepInds] = simplifyPolygon(poly, varargin)
%SIMPLIFYPOLYGON Douglas-Peucker simplification of a polygon.
%
% POLY2 = simplifyPolygon(POLY, TOL)
% Simplifies the input polygon using the Douglas-Peucker algorithm.
%
% Example
% elli = [20 30 40 20 30];
% poly = ellipseToPolygon(el... |
%clear the work space and close all open figure windows
clc; clear all; close all;
%Read in image
pic = imread('C:\Users\ELong\Desktop\Colege 17 -18\FinalYrProject\englishmansbay.jpg');
img = double(pic);
img = rgb2gray(img/255);
imshow(img);
offset = 10;
%boundary
right = 3115;
left = 2351;
top = 1698;
... |
function[Acc, predictions1, predictions, model]=FindPredictedClass(TrainLabel, TrainX, TestLabel, TestX)
W=TrainLabel;
Z=TrainX;
Y=TestLabel;
X=TestX;
model= svmlearn(Z,W, '-j 0.05 -c 1.0');
[err, predictions]= svmclassify(X,Y,model);
predictions1=predictions;
I=find(predictions>=0);
predictions1(I,:)=1;
I=find(pred... |
function rgb = salmon
rgb = [0.98039, 0.50196, 0.44705];
end |
function ObjVal=Sphere(Foods)
%global Foods;
[a,b] = size(Foods);
value = zeros(1,a);
for i=1:a
for j=1:b
value(i) =value(i)+ Foods(i,j).^2;
end;
end;
%S=Food.*Food;
ObjVal=value;%sum(S);
|
function [imsegs, M] = im2superpixels(im, para)
% Compute super-piexls from images.
%
% Input
% im - image
% para - parameter, 1 x 3
%
% Output
% imsegs - segmentation
% M - segmentation, h x w x nC
%
% History
% create - Derek Hoiem, 01-01-2005
% modify - Feng Zhou (zhfe99@gmail.com)... |
%% Plot example of acceprometer
addpath /home/mikkel/PD_motor/global_scripts
[dirs, sub_info, ~] = PD_proj_setup('tap');
addpath /home/mikkel/matlab/export_fig/
data_file = '/home/mikkel/PD_motor/tap/meg_data/0313/0313_tap_1_L-epo.fif';
hdr = ft_read_header(data_file);
misc_chan = find(~cellfun(@isempty, strfind(hdr.... |
function [alpha,Beta] = Para_K(hh)
Amp = sqrt(hh.*conj(hh));
m_half = mean(mean(Amp.^(1/2)));
m_1 = mean(mean(Amp));
n = 1;
temp1 = gamma(n+1/2)*gamma(n)/(gamma(n+1/4)^2);
funK = @(alpha)temp1*gamma(alpha+1/2)*gamma(alpha)/(gamma(alpha+1/4)^2)-(m_1/(m_half^2));
alpha = 0;
alpha0 = 1;
Beta = 0;
while alpha<=ep... |
% ECOR2606 - Lab 6
function [] = lab6()
A = [ 2 -14 5
5 6 -2
1 5 3 ];
b = [ 52; 2; 17 ];
x1 = inv(A) * b;
x2 = A^-1 * b;
x3 = A\b;
fprintf('[%5.3f %5.3f %5.3f]\n', x1);
fprintf('The value of b is %5.3f\n\n', x1(2));
fprintf('[%5.3f %5.3f %5.3f]\n', x2);
fprintf('The value of b is %5.3f\n\n... |
% CS 5810 -- Programming for data analysis
%
% Assignment 3 | Prof. Alberto Paccanaro
%
%
%
% Insert BELOW your code
% Marking ID is 65138
% this functions takes 2 inputs: Data and k value. initial define the
% centroid and index variable with the respective sizes
% if loop condition is false then goes inside loo... |
function new_waveforms = perform_spike_alignment_for_cpu(waveforms)
% perform_spike_alignment for WaveLimit, v1.3
% Adam Rouse, 4/24/20
% function for aligning spikes based on the peak or trough of the spike
% waveforms
% INPUT: file_path, directory where .mat files created with
% create_spike_mat is located
% OUTPUT:... |
function varargout = Props1SI(varargin)
[varargout{1:max(1,nargout)}] = CoolPropMATLAB_wrap(315,varargin{:});
end
|
% Make plots just to compare Jeff's model, Yu model and unscaled model.
figure;
subplot(4,1,1)
plot(t,Z_PLV,t,zplv,'--b',t,zplvs,'--r'); grid on;
xlabel('Time [sec]'); ylabel('P_{lv} [mmHg]');
title('P_{lv} comparison');
legend('Jeff model','Yu Orig','Yu Scaled');
axisB(1) = gca;
subplot(4,1,2)
plot(t,Z_PSA,t,zpsa,'-... |
function [meanAUC, stdAUC] = computeMeanAuc(AUC, nSet, nMethod)
%COMPUTEMEANAUC
AUCset = permute(mean(reshape(AUC,[],nSet,nMethod),1),[2 3 1]);
meanAUC = mean(AUCset,1);
stdAUC = std(AUCset,0,1);
end |
%% setupTargets(p)
function targets = setupTargets_9pt(p)
%function targets = pds.tracking.setupTargets_9pt(p)
%
% Create tracking calibration target positions struct
targets = struct();
halfWidth_x = p.trial.tracking.gridSz(1)/2;
halfWidth_y = p.trial.tracking.gridSz(end)/2;
% basic 9-point target grid (in degrees)... |
function [outStruct] = collateCellFields(inStruct)
fieldsList = fieldnames(inStruct);
outStruct = struct();
for ii = 1:length(fieldsList)
structField = inStruct.(fieldsList{ii});
if iscell(structField)
outStruct.(fieldsList{ii}) = cell2mat([structField(:)]);
else
outStruct.(fieldsL... |
function alp_returnvalue = seqput(obj, deviceid, sequenceid, picoffset, ...
picload, userarray)
% Loads user supplied frame data to an ALP device
%
% See also:
% seqcontrol, seqinquire
%
% File information:
% version 1.0 (feb 2014)
% (c) Martin Vogel
% emai... |
function elli = polygonInertiaEllipse(poly)
%POLYGONINERTIAELLIPSE Compute ellipse with same inertia moments as polygon.
%
% ELLI = polygonInertiaEllipse(POLY)
%
% Example
% % convert an ellipse to polygon, and check that inertia ellipse is
% % close to original ellipse
% elli = [50 50 50 30 20];
% ... |
citra = imread('E:/perkuliahan/CITRA\forest.jpg');
imshow(citra); |
clc
clear variables
%
% %% Getting the supported file formats
% form = imformats;
% formats = '\w\.(';
% for i = 1:size(form,2)
% if size(form(i).ext,2) > 1 % We have different extension for same format
% for j = 1:size(form(i).ext,2)
% if i~=1 || j~=1
% formats = strcat(formats... |
<<<<<<< HEAD
function [SOUND_chan,VNO_chan,VALVE_chan]=generate_single_washvalve_scan(valveState)
% open and close the valve - simply changing output level
% YBS - 2017
digoutV = 3.3;
if strcmp(valveState,'close')
samples_valve_duration=ones(1,100);
elseif strcmp(valveState,'open')
samples_valve_duration=zer... |
% slowness function generator for Example 4.7
% from Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
function s = slowfunctionsmooth(depth)
% s = slowfunctionsmooth(depth)
%
% Returns a vector of true one-dimensional slownesses for examples
% 4.4-4.7, given a vector... |
function [Vmin,Vmax,Val]=FVA(GEM,L,solver,split,Blocked,eps)
%Calculates the Vmin, Vmax and flux range per each reaction of the model
%Inputs:
%GEM: a model in cobra structure format (at least S and rev fields)
%L: the maximum absolute value used as boudary condition, default is 1
%solver: string displaying eith... |
function q = fq(p,v1,v2)
%FQ F distribution quantiles.
% Q = FQ(P,V1,V2) satisfies Pr(X < Q) = P, where X follows
% and F distribution on V1 and V2 degrees of freedom.
% V1 and V2 must be scalars.
%
% See also FP
% Gordon Smyth, gks@maths.uq.edu.au, University of Queensland
q = betaq(p,v1/2,v2/2);
q = v2/v1 * q./(1-q... |
function [model] = multivariateT(X)
[n,d] = size(X);
% Fit a multivariate student T
mu_old = ones(d,1);
mu = zeros(d,1);
sigma = eye(d);
dof = 3;
fprintf('Fitting multivariate student T density model...\n');
options.Display = 0;
while norm(mu-mu_old,'inf') > 1e-4
mu_old = mu;
% Update mean
funObj_mu ... |
load('data/q2_data')
m = length(q2t_train);
C = 1;
n0 = 1;
w = zeros(3,1);
b = 0;
%Actual SGD
for i = 1:200
alpha = n0/(1 + i*n0);
for iterating_var = 1:m
j = iterating_var;
indicator = q2t_train(j) * (w'*q2x_train(j,:)' + b);
if indicator < 1
w_grad = w/(m) - C * (q2t_train... |
close all
clear
jdqr, pause
jdqr('ILU',2,30,8,struct('Disp',1)), pause
jdqr('ILU',2.1,30,8,struct('Disp',1)), pause
jdqr('Example1',2.1,30,8,struct('Disp',1),'ILU'), pause
jdqr('Example2',0.0,30,8,struct('Disp',1),'Example2'), pause
jdqr('Example2',0.0,30,8,struct('Disp',1),'ILU'), pause
jdqr('Example2',0.0,30,8... |
function [O1,O2] = is_delaunay(varargin)
error('Call is_intrinsic_delaunay or is_extrinsic_delaunay directly');
end
|
function [sp_out] = sp_thd(sp,thd)
j=1;
sp_out = 0;
for i=1:length(sp)
if(abs(sp(i))>thd)
sp_out(j)=sp(i);
j=j+1;
end
end
end
|
function [lesion] = dosegmentation(fileName)
threshold = 0.015;
% addpath('D:\MATLAB codes\Segmentation\AdvancedTechniques');
% addpath('D:\MATLAB codes\Segmentation\Metrics');
lesionAndBorders = FuzzyCMeansClustering(fileName);
lesion = RegionGrowingModified(lesionAndBorders, threshold);
lesion = imgaussfilt(lesion,... |
% ComputeAndPlotXWTs Generates and plots crosswavelet spectra for pairs of signals
% This is a variant of XWPLOT in which data is stored as multidimensional
% arrays instead of as structures. File numbers change across the 3rd
% dimension and channel pair numbers vary across the 4th dimension.
% For e.g., Wxy(:,:,2,3)... |
% Title: Simulate choice when provided with two options of reward//delay combinations (Hyperbolic Discounting applied)
% Author: Alexander Fengler
% Date: Feburary 7th 2015
function choice = SimulateChoice(k,sir,ldr,delay)
% Not used for now
%p = exp(ldr/(1 + k*delay)) / (exp(sir) + exp(ldr/(1 + k*delay)));
% By Chab... |
function stepenergy(ScaleFactor)
% function stepenergy(ScaleFactor)
%
% 2010
% Booster extration kicker
Name(1,:) = 'BR2_____KE_____AC00';
% Booster bump magnets
Name(2,:) = 'BR2_____BUMP1__AC00';
Name(3,:) = 'BR2_____BUMP2__AC01';
Name(4,:) = 'BR2_____BUMP3__AC00';
% Booster Thin Septum
Name(5,:) = 'BR2_____SEN__... |
function [ gp ] = processGroupQuiz(path)
%% this function takes summarized data for each group, and save them
global p;
gp = cell(p.numDir,1);
% loop over all data dir
for i = 1 : p.numDir
% preallocate resources
gp{i}.meanSteps = nan(p.nSubj, 1);
gp{i}.monotonRate = nan(p.nSubj, 1);
gp{i}.compRate = n... |
function [fCN,aCN,aCN_SAN]=CN(usernet,attrinet,filename)
[m,n]=size(attrinet);
susernet=sparse(tril(usernet,-1));
link=nnz(susernet);
%fCN(i,j)表示,用户i与用户j之间共同朋友的数,
usernet = double(usernet);
fCN=usernet*usernet;
%aCN(i,j)表示,用户i与用户j之间共同属性的个数,
attrinet= double(attrinet);
aCN=attrinet*attrinet';
C... |
data_folder = "../data/Section2_SingleCapture";
files = dir(data_folder);
files = files(4:end);
global params
params.kernel = ones(1,10)/10;
params.c1 = 0.8;
params.c2 = 0.1;
params.c3 = 0.1;
for file = files'
image = imread(fullfile(file.folder,file.name));
% Get Lmin and Lmax
[Lmin,Lmax] = get_Lmin_Lmax(... |
function [ yi ] = Cubic( x, y, xi )
%Quadratic interpolation
% yi=Cubic(x,y,xi)
n = max([size(x, 2) size(x, 1)]);
if n ~= max([size(y, 2) size(y, 1)]) || n < 4
error('Where there is a wrong in size');
end
if (min([size(y, 2) size(y, 1)]) ~= 1 ...
|| min([size(x, 2) size(x, 1)]) ~= 1)... |
function J = kuwaharafilt(I, varargin)
%KUWAHARAFILT Kuwahara filtering of images
%
% J = kuwaharafilt(I) filters image I with 5x5 window
%
% J = kuwaharafilt(I, r) filters image I with specific filter size.
% `r` specify the window radius (please see below). This value must be an
% even number greater than 0.
%
% ... |
function [ pauta ] = getPauta(escolha)
%valores das notas
%3
si3 = 246.94/440;
% 4
do4 = 261.63/440; do4_sustenido = 277.18/440;
re4 = 293.66/440; re_sustenido = 311.13/440;
mi4 = 329.63/440;
fa4 = 349.23/440; fa4_sustenido = 369.99/440;
sol4 = 392.00/440;sol4_sustenido = 415.30/440;
la4 = 440.00/440; las4_usteni... |
function [Tlocal,Dlocal]=bspline_trans_points_double(O_trans,Spacing,X,check)
% If Spacing and points are not an integer, we can not use fast look up tables,
% but have to calculate the bspline coefficients for every point
if(nargin<4)
check = any(mod(Spacing,1)>0)|any(mod(X(:),1)>0);
end
switch size(X,2)
... |
function param = getParameters_ott(os, timePeriod, model, paramName)
% timePeriod: {'RD', 'cue', 'PE'}
tOfInt = ['mod_' timePeriod];
[~, param_ind] = intersect(os(1).(tOfInt).(model).paramNames, paramName);
if any(param_ind) == 0 % parameter not found
error('Parameter not found')
elseif length(param_ind) > ... |
% -*- matlab -*-
% return parameters which are used in bkm_km when mode=2.
function [A1,A2,Ncs,mcs] = bkm_km_parameters(classes,mode,xi,p1,p2,p3,p4);
[tmp,K] = size(classes);
for k=1:K
[D,Nc] = size(classes{k});
if Nc > 0
break;
end
end
switch mode
case 2
mu0 = p1;
eta0 = p2;
B0 = p3;
phi0 = p4;
... |
function [data] = load_nasdaq (filename)
monthlyData = csvread(filename,0,1);
% Open,High,Low,Close,Volume,Adj Close
quarters = floor(size(monthlyData,1)/3);
monthsPerQuarter = 3;
%quarterlyData starts from Q1 1995
%the columns are change over quarter, open, high, minimum, close index,
%swing, and momentum of swing (if... |
function [AlleleReplacementBackgrounds_mean,AlleleReplacementBackgrounds_std,AlleleReplacementBackgrounds_sem]=compute_fold_difference_across_backgrounds(data_output,StrainsWithBC187Allele_names,StrainsWithYJM978Allele_names)
%DETERMINE_FOLD_DIFFERENCE_ACROSS_BACKGROUNDS
%This assumes that strains are sorted equally ... |
% Read the header of a P file.
%
% [hdr] = read_hdr_14(Pfile)
% Pfile Name of the Pfile to read
% hdr Structure containing header information.
% Copyrights Bruno Madore, Harvard Medical School
% Written in Fall 2000.
% Summer 2006: Update to version 12.0 by Bruno Madore
% 08/02/2006: Update to version 14.3 by Renx... |
function [A, B, C, D, E] = mehdss(M, P, K, B1, C1)
ns = size(M,1);
n = ns(1);
p = size(B1,2);
q = size(C1,1);
E = ([M, zeros(ns); zeros(ns), eye(n)]);
A = ([-P, -K; eye(n), zeros(ns)]);
B = ([B1; zeros(n, p)]);
C = ([C1, zeros(q, n); zeros(q, n), C1]);
D = zeros(2*q, p);
|
he = imread('ex.jpg');
%figure,imshow('hi.jpg');
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
nColors = 3;
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
nClusters = 3 ;
rng(2);
ab = reshape(ab,nrows*ncols,2);
%[cluster_idx,cluster_center] = kmeans(ab,nClusters,'distance','sqE... |
function [vertResult,horiResult] = GaussianDeriFilter(target,sigma)
% this function is used to generate a gaussian derivative filter
% then conduct the convolution
gauss = fspecial('gaussian',[3 * sigma 3 * sigma],sigma);
gaussFilter = gauss(ceil(3 * sigma/2),:);
conv = conv2(target,gaussFilter,'same');
vertResult ... |
% demonstrate reading data from a file into an array (pg 338)
a=importdata('data1.txt')
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ZoomImage: zoom in on an image.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% To run in serial without distributed arrays, set
% PARALLEL = 0
% At the Matlab prompt type
% pZoomImage
% To run in serial with distributed arrays,... |
function [dict,costs,time] = learnDict_SPGD(imdb,getBlockBatch,LDS_opts,SC_opts,DL_opts)
%SPGD performs dictionary learning on LDSs with the Stochastic-Projected-Gradient-Decent method
%
% INUTS
% imdb - {} dataset
% getBatch - The function handle to get training batch from imdb
% DL_opts - . Di... |
function [Loc, S1_Loc, S2_Loc, y_envelope] = S1_S2_SegmentLoc(y_smooth , Fs)
%% %% BASED ON THE RESEARCH PAPER: A Robust Heart Sound Segmentation and Classification Algorithm using Wavelet Decomposition and Spectrogram
% By: Peter J. Bentley
%% FINDING PEAKS
L = length(y_smooth);
Ts = 1/Fs... |
clear all
close all
clc
name = 'input.jpg'
input = imread(name);
[m, n, k]= size(input);
%--------------------- up scaling --------------------------------------- %
for i = 1: 60
energy = estimateEnergy(input);
path = findVSeam(energy);
input = addSeam(path, input);
disp(['add seam # ', num2str(i)... |
function varargout = plot(h)
%PLOT: Drumplot plotting function. A drumplot object (h) contains no
% graphical elements, but is instead a blueprint for how the drumplot
% figure should be assembled. Information in h includes waveform data,
% number of minutes per line, color scheme, multi-waveform display type,... |
function [Y, e, max_rsq] = spikeResponse(Xw, noiseModel, baseline, snr)
if nargin < 2
noiseModel = 'gauss'; % 'poiss'
end
if nargin < 3
baseline = 0;
end
if nargin < 4
snr = 2.0;
end
% Xw = Xw - mean(Xw); % mean zero
ntrials = size(Xw,1);
if strcmpi(noiseModel, 'poiss')
if min(baseline + Xw) < 0
... |
box off
set(gca,'linewidth',3)
xAX = get(gca,'XAxis');
set(xAX,'FontSize', 20)
set(xAX,'color','k')
yAX = get(gca,'YAxis');
set(yAX,'FontSize', 20)
set(yAX,'color','k')
set(gca, 'TickDir', 'out')
set(gcf,'color','w')
set(gca,'Layer','top')
axis normal
|
%clear all;
close all;
baseDir = '/home/parkinsonjl/convection-in-sea-ice/MushyLayer/execSubcycle/';
% pout32Sponge = Pout([baseDir , 'output-sponge/pout.0']);
% pout32NoSponge = Pout([baseDir , 'output-noSponge/pout.0']);
% poutAMR = Pout(['/home/parkinsonjl/gyre/mushyLayer-periodic-adaptive/', ...
% 'CR5.0RaC80... |
% initialize x as the square root of n and the maximum positive integer
%whose multiples are being crossed out
clear all;
num=1000000;
x = floor(sqrt(num));
%create a one-dimensional array with each element being 1
a=ones(num,1);
%change the first 1 to a 0 since one is not prime
a(1) = 0;
%a for loop checking the mu... |
% test_middleLine
% from sue
clear;clc;close all;
%MYTOOLBOXROOT='E:/jjcaolib/toolbox';
MYTOOLBOXROOT='../..';
addpath ([MYTOOLBOXROOT '/jjcao_mesh'])
addpath ([MYTOOLBOXROOT '/jjcao_io'])
addpath ([MYTOOLBOXROOT '/jjcao_plot'])
addpath ([MYTOOLBOXROOT '/jjcao_mesh/geodesic'])
addpath ([MYTOOLBOXROOT '/jjcao... |
clear;clc;close all
src_dir = 'E:\Datasets\SVHN\all\images\train_bak';
dst_dir = 'E:\Datasets\SVHN\all\images\train';
samp_range = [202354:235755];
n_samp = length(samp_range);
parfor i = 1:n_samp
src_file = fullfile(src_dir, sprintf('%d.png', samp_range(i)));
dst_file = fullfile(dst_dir, sprintf('... |
function [corrRate,geodesicError,tau,sample_d]=...
compute_corrRate_for_benchmark(V,F,benchmarkSym,sampleCorr,maximal_d,sample_d)
% Copyright (c) 2014.07.05 Shuhua Li
if nargin < 5
nverts=size(V,1);sample_d=sparse(nverts,nverts);
A = triangulation2adjacency(F);
ind = find(A>0);
[I, J] = i... |
function stan_par_save(FILENAME,data)
% script for reading config files/sorting for processing/chopping
%
% takes logfile as input
%
%
%
%
save(FILENAME,'data');
|
function setStr = findMinimalDisjointIntegerSets(inputCell, varargin)
% Given sets of possibly overlapping integers, this function will return another
% collection of sets so that intersection of any two of the returned sets
% is the null set and the union of the returned sets equals the union of
% the original sets. T... |
fs=6e5;
fc=2.2e9;
% Open transmitter and configure it
rx=sdrrx('Pluto');
% Set receiver parameters:
% Carrier frequency
% Sampling rate
% AGC
% Receiver gain in dB
rx.CenterFrequency = fc;
rx.BasebandSampleRate = fs;
rx.GainSource = 'Manual'; % Disable AGC for manual setting of gain
rx.Gain = 55; ... |
%To clear the workspace
clear ; close all; clc
%To generate random X
X1 = 20 + fix(3880*rand(1,200));
X2 = 1 + fix(14 * rand(1,200));
X3 = 353 + fix(422 * rand(1,200));
X = [X1', X2', X3'];
%input THETA
THETA = [3800; 9; 350; 85];
%To input x0=1 to the X matrix
m = size(X,1);
X = [ones(m, 1) X];
%To comput y
y= X * TH... |
function [] = createTraining_game(ID)
%data = 'PranjulGame/GameTraining.txt';
data = 'IgorGame/Training.txt';
fid = fopen(data);
tline = fgets(fid);
len=1;
while ischar(tline)
tline = fgets(fid);
len = len+1;
end
len = len-1;
fclose(fid);
loc = strcat('../libdai/examples/data/HSMMtraining_',num2str(ID),'.t... |
%Q1.1
clear all
vr = VideoReader('pres_debate.avi');
numFrames = get(vr, 'NumberOfFrames');
vidobj=VideoWriter('pres_debate_final1.avi');
open(vidobj);
shapeInserter=vision.ShapeInserter;
N=100;
Xt=randsample(220:360,N);
Yt=randsample(205:330,N);
Xt_check=Xt;
Yt_check=Yt;
for k=1:46
image =... |
function hdr = SLH(img)
%% Pre-processing
L = double(rgb2gray(img)) / 255;
%% Weighted Least Square Filter
function OUT = wlsFilter(IN, lambda, alpha, L)
if(~exist('L', 'var')),
L = log(IN+eps);
end
if(~exist('alpha', 'var')),
alpha = 1.2;
end
if(~exist('lambda', 'var')),
... |
function gpprior_m = make_gpprior_m(x_timegrid)
T = length(x_timegrid);
m = zeros(1,T);
kernel = gausskernel(x_timegrid, log(1.0), log(0.05));
gpprior_m = gpmodel(x_timegrid, m, kernel);
end
|
function mu = linearLeftHandSide(p, KK, LL)
% Initialize
mu = zeros(p.ny, p.nx, p.nVars);
% Exponent reflecting the order of the diffusivity operator
powQ = p.nuNQ/2;
powA = p.nuNA/2;
% Diffusivity operator
DA = ( p.nuA^(1/powA)*KK.^2 + p.nuA^(1/powA)*LL.^2 ).^powA;
DQ = ( p.nuQ^(1/powQ)*KK.^2 + p.nuQ^(1/powQ)*LL.^2... |
function da=set_theta(da, theta) ;
% da=set_theta(da, theta) ;
% G. Raetsch 1.6.98
% Copyright (c) 1998 GMD Berlin - All rights reserved
% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD FIRST Berlin
% The copyright notice above does not evidence any
% actual or intended publication of this work.
... |
function E = selection_sampling(Js, array_length, coarray_length)
I = eye(array_length * array_length);
E = zeros(array_length * array_length, 2 * coarray_length - 1);
for n = - coarray_length + 1 : coarray_length - 1
J = Js(n);
cnt = 0;
for e = J
E(:, n + coarray_length) = E(:, n + coarray_length) ... |
% from Shuhei Ono's methane2.m script
% modified by DTW on 16 Nov 2013 to calculate partition functions for other
% alkanes, using frequency data from Galimov73, scaled to NIST WebBook
% betas calculated are relative to isotopologue described by *freqs(:,1)
close all
clear all
%% vibrational frequencies for methane... |
clc;
clear;
close all;
A = [16 20 15 17 22 19 17]';
B = [22 15 16 16 16 18]';
C = [23 9 15 18 13 27 17 14 16 15 21 19 17]';
group = [ ones(size(A));
2 * ones(size(B));
3 * ones(size(C))];
figure
boxplot([A; B; C],group)
set(gca,'XTickLabel',{'A','B','C'}) |
function [minimum,index,quan_dist] = deri_test(A,B,gap)
tar = target_im(A,B,0.0625);
tar = (tar-min(tar(:)))/(max(tar(:))-min(tar(:)));
[mag_tar_mat,~,~] = derivative(tar);
mag_tar = [];
for i=54:74
mag_tar = [mag_tar,mag_tar_mat(54,i)];
mag_tar = [mag_tar,mag_tar_mat(i,54)];
mag_tar = [mag_tar,mag_tar_mat... |
function createResolutionPyramid(obj)
% CREATERESOLUTIONPYRAMID Wrapper to create resolution pyramid based on
% the section.json
% see also createResolutionPyramid
% Author: Benedikt Staffler <benedikt.staffler@brain.mpg.de>
idx = strfind(obj.root, filesep);
topFolder = obj.root(1:idx(end-1));
if ~exist(fullfile(topFo... |
function scan_data = p10rd(ufilename,plotmode,verbose)
%P10RD Read Tencor P-10 surface profilometer data file
%
% SCAN_DATA = P10RD(UFILENAME,PLOTMODE,VERBOSE)
%
%P10RD reads the data from file UFILENAME.txt, and returns a 5-column
% array SCAN_DATA:
% (:,1) is the horizontal position data in microns
% (:,2) ... |
tic;
import containers.Map
xileibie_user=Map() %相当于论文的I_i
user_interest=Map() %用户感兴趣的细类别
alpha=0.5; %阈值,越大,越严格
p_i=0.05; %阈值,越小,越严格
for u=0:50843 %遍历用户数,共有50844位用户
tic;
user_xileibie=Map(); %建立一个用户u映射到细类别访问量的映射Map
user_index=find(VarName7==u); %在train文件中用户u所占那些行
N=sum(VarName9(user_index)); %用户u... |
ld = load('J_vs_E.mat');
x2 = ld.fj200.x;
f2 = ld.fj200.signal;
f2_err = ld.fj200.error;
x4 = ld.fj400.x;
f4 = ld.fj400.signal;
f4_err = ld.fj400.error;
e_min_s = 45;
e_max_s = 125;
% first subrange: take from ei200
ir2_min = find(x2==e_min_s);
ir2_max = find(x2==e_max_s);
x_tot1 = x2(1:ir2_min);
s_tot1 = ... |
function varargout = DPABINet_VIEW(varargin)
% DPABINET_VIEW MATLAB code for DPABINet_VIEW.fig
% DPABINET_VIEW, by itself, creates a new DPABINET_VIEW or raises the existing
% singleton*.
%
% H = DPABINET_VIEW returns the handle to a new DPABINET_VIEW or the handle to
% the existing singleton*.
%
% ... |
function [ synCom, synScores, edgeIdx ] = loadSynapses( p, t )
%LOADSYNAPSES Very basic function to load the synapse predictions
% from the global segmentation data.
% This assumes that 'globalBorder.mat' and 'globalSynScores.mat'
% exists in the segmentation main folder (e.g. saved by
% Seg.Global.saveGlobalSvgData in... |
close all
%% init plotly
plotly_path = '/home/lab/yuvval/git/plotly-MATLAB-api/plotly';
addpath(genpath(plotly_path));
signin('yuval', 'djwqkrplyw');
%% init paths
addpath('/home/lab/yuvval/mathworks_toolboxes/getAnnotation_matlab');
%% CD logdet, 4d, 135k triplets, Caltech256 50cat
path1 = '/cortex/yuvval/results_... |
% Generates task map file
% @param taskMapFile -- file name
% @param numTrialsTotal -- total number of trials used in the experiment
function generateTaskMap(taskMapFile,numTrialsTotal)
%shuffle all orientations for both of the triangles
orientations = Shuffle(randi(360, numTrialsTotal,1));
%TODO -- ... |
clear all
for si=1:10
Matrice =[];
% block set sizes
blocks = [2 3 4 5 3 5 2 3 4 5];
p = randperm(3);
blocks = [blocks(1) blocks(p+1) blocks(5:7) blocks(p+7)];
Matrice.blocks = blocks;
%%
% how many stimuli per action; total
R= [1 1 0 2;
0 1 1 2;
2 0 1 3;% make sure that sometimes one action incorrect for all... |
function [ES] = ESquick(s1,s2,sig)
s=[s1,s2];
[m,n] = size(s);
score = ones(n,1);
for i=1:n
if i==1
up = s1(1:sig,1);
down = s1((m-sig+1):m,1);
rank = s2(:,1);
else
up = s2(1:sig,1);
down = s2((m-sig+1):m,1);
rank = s1(:,1);
end
isgsUp = ismember(rank,up);
isgsDown = ismember(rank,d... |
clearvars
close all
% load object space output from 'script_psych_distribution.m'
load matlab
% setup
varnames = {'pop' 'hospPsy' 'mainline'};
hospPsyIndex = 3; % add 1 for the intercept
repetitions = N;
N_dummies = 3000;
wiggle_amount = 0.01;
if mfilename
diary(sprintf('%s_diary.txt',mfilename));
end
%% initali... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
% function MasterRIOSProcessProject_JH (foldernameMeta);
%% This is the 'Master' funcion. All sub functions are run from this one.
% Author: MANY and unknown
% Most Recent updates by: Josh Humberston
% USACE 2016
close all
%% Set rules:
% dbstop if error % This stops for debugging at location of error
% set(0,'Defaul... |
clear
close all
clc
phase = slove_phase(1, 0, 1, 0);
for i = 1 : 1 : 3
index = 0;
for j = -pi : pi/3 : pi
index = index + 1;
if abs(real(phase(i)) - j) < 0.01
fprintf('\n');
fprintf(strcat('phi_', num2str(i), ' =', 32, num2str(j)));
fprintf('\n'... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Autor: Prof. Alexandre Zaghetto %
% E-mail: zaghetto@image.unb.br %
% Disciplina: Sinais e Sistemas %
% Departamento: Ciência da Computação %
% Universiade de Brasília %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
%%%%%%%... |
function [pfn] = myGetFalseNegatives(estimation, annotation)
%% Computes the percentage of false negatives
% Input:
% estimation: (numBlocks x 1) float vector, estimated pitch (Hz) per block
% annotation: (numBlocks x 1) float vector, annotated pitch (Hz) per block
% Output:
% pfn: float, percentage of false ... |
% RGB ke grasyscale
close all;
%Gambar asli RGB
prabowo_img = imread('C:\Users\ignatha\Documents\MATLAB\2.jpg');
%konversi RGB ke Grayscale
prabowo_img2 = rgb2gray(prabowo_img);
figure(1);
set(gcf, 'Position', [100, 100, 1240, 500]);
subplot(1,2,1); imshow(prabowo_img);
subplot(1,2,2); imshow(prabowo_img2); |
% [INPUT]
% size = A vector of integers in which each element represents the size of a dimension of the output (optional, default=[1 1]);
% lim = An integer, greater than or equal to 9, representing the maximum possible value to be generated (optional, default=9).
% prob = A string representing the method to use fo... |
% Draw the corresponding epipolar line on the right by selecting a point on left image.
clc;
close all;
format long
% Hardcode the F matrix
F = [5.67727181723446e-06 -0.00104688474793069 0.168428043932593
0.00104180185458174 -1.57926498477318e-05 -0.304294908613248
-0.169371539518221 ... |
format long g
fx = @(x) (atan(x));
x0=0.5
x1=1
[c,i] = hw1_4_secant(fx,x0,x1,10e-10,10e-10,20)
x0=1
x1=1.3
[c,i] = hw1_4_secant(fx,x0,x1,10e-10,10e-10,20)
x0=1.4
x1=1.5
[c,i] = hw1_4_secant(fx,x0,x1,10e-10,10e-10,20)
x0=10
x1=11
[c,i] = hw1_4_secant(fx,x0,x1,10e-10,10e-10,20)
|
function vanishPt = calculateVanish(pt)
l1 = cross(pt(1,:), pt(7, :));
l2 = cross(pt(4,:), pt(6, :));
l3 = cross(pt(3,:), pt(5, :));
l4 = cross(pt(2,:), pt(8, :));
m1 = l1'*l1;
m2 = l2'*l2;
m3 = l3'*l3;
m4 = l4'*l4;
m = m1 + m2 + m3 + m4;
[~, ~, v] = svd(m);
vanishPt = v(:, 3... |
function [] = test(a)
if a == 'x'
disp(1)
end
end |
clear all;
a = 0;
b = 1;
y_0 = 0;
y_1 = 0;
q = @(x) x.^2 + 1;
r = @(x) -(pi^2 + x.^2 + 1) .* sin(pi * x);
Ns = [10, 100, 1000];
% a) metoda Gaussa
for i=1:length(Ns)
N = Ns(i);
h = (b-a)/(N+1);
t = a:h:b;
A_q = q(t(2:end-1)) * h^2 + 2;
A = diag(A_q, 0) - diag(ones(N-1, 1), -1) - ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Dataset set up setion
% Don't forget to do "add to path" for the folder "Feature Extraction" !!!
working_path = "/home/hguan/Vocal-Disorder-Diagnosis/Supervised learning Approach"
data_main_path = "/home/hguan/7100-Master-Project/Dataset-Ke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.