text stringlengths 8 6.12M |
|---|
%
% Regional Geop. Synthesis Individual Project
% - a redistribution of plot_cen_maggrav and profile_cen_maggrav
%
% Main features and capabilities
%
% The package is capable of
% 0) showing places where horizontal gradients are locally higher than
% surroundings
% 1) plotting the gravity map and showing seve... |
% stop the SensorSim timer
stop(sensorSimTimer);
% close the SensorSim WiFly
fclose(ioSensorSimWiFly);
% set(fig1, 'Visible', 'off');
% set(fig2, 'Visible', 'off');
clf(h);
% clear all state
clear all; |
function [result] = executeFabertMultiLateration9(data)
for i = 1:length(data.Distances())
out = solver_fabert_lin9(data.Distances(i,:),data.AnchorPositions);
result(i,1:2) = out(1:2);
end
end |
function x1 = Fun_Newton(g,gprime,x0,err)
cnt = 1;
x1 = x0 + 1;
while abs(x1-x0) >= err
x0 = x1;
x1 = x0 - g(x0)/gprime(x0);
cnt = cnt +1;
if cnt >100
break;
end
end
end
|
function [derivs] = del_log_det_B(hyps, func, n, n_class, X, y, approxF)
% a function evaluating d log.det B d theta_i
% by Mark Norrish, 2011
% hyps: as a vector; [ h_class1 ; ... ; h_class_c ]
dim = length(hyps) / n_class;
Hyps = reshape(hyps, dim, n_class);
bigK = zeros(n*n_class); K = zeros(n,n,n_class); sigma_n... |
a = load('answer.dat');
the_answer = zeros(50,4);
for i = 1:50
countA = a(i,2);
countB = a(i,3);
the_answer(i,1) = i;
the_answer(i,2) = a(i,2);
the_answer(i,3) = a(i,3);
%ripe is represented by 1, unripe is represented by 0
%if side-A has 0 then stem isn't visible so only check side-B... |
%Number of decision makers k, i.e.
k=4;
%Number of criterias to be evaluated n i.e.
n=4;
%Information about is the given criteria cost or benefit criteria:
%Benefit=1, Cost=2, should be given as a vector of length n. i.e.
criteria=[1 1 1 2];
%Number of attributes to be ranked (suppliers in ex... |
function object=calculateInverses(object)
table=nan(object.NumberClouds,3);
for k=1:object.NumberClouds
sigmax2=object.CloudData{k}.Moments(1,2);
sigmay2=object.CloudData{k}.Moments(2,2);
sigmaxy=object.CloudData{k}.Correlations(2,1)*sqrt(sigmax2*sigmay2);
matrix=[sigmax2 sigmaxy; sigmaxy sigmay2];
... |
function [ x_opt, f_opt ] = nesterov_accelerated_gradient_method(x_t, Ai, yi, s_hyp)
model_opt = s_hyp.model_opt;
alpha = s_hyp.alpha;
d = s_hyp.d;
if strcmp(model_opt,'ridge_regression')
f = @(x) (Ai*x-yi)*transpose(Ai*x-yi) + alpha/2*(x'*x);
g = @(x) (Ai*x - yi)*Ai'+alpha*x;
elseif strcmp(model_opt,'logist... |
clear all
load('./2.OnCAD/evolving_S1.mat')
dim = size(dataset, 2);
plotFigs = 1;
filename = 'out8.avi';
min_wgh = 0.1;
[AnomalyScores, Clusters, ClusterIndexes] = OnCAD( dataset, dim, plotFigs, filename, 3,0.99, -1, min_wgh, 500); |
disp('What the fuck')
function output=TheTestFunction(x,y,z)
output=x.^y +z;
end
|
function [ extrudedPhantom ] = extrudePhantom( bodyModel, inputPhantom, xOffset, yOffset, zOffset )
%EXTRUDEPHANTOM Extends base xz plane of "inputPhantom" into "bodyModel" until encoutering one of the specified tissue types
%
% Copyright 2016 Joseph V Rispoli
% 2016/04/13
%
% Input variables
% bodyModel: three-dimen... |
function [ selected ] = selectAL( L_features, L_labels, U_features, params )
% Set up parameters
train_args = ['-t 2 -g ' num2str(params.maxG) ' -c ' num2str(params.maxC) ' -q -b 1'];
test_args = '-b 1 -q';
nClasses = numel(unique(L_labels));
% Assume all unlabeled are each class
dist = ze... |
function [S_index,S_value]=S_detection(y0,y_HP,R_index,fs)
%S hullamok csucsai
S_index=[];S_value=[];
%Variabilitási indexek
QS5=0;
ind_QS=0;
ind=0;
max_RR_d=max(R_index(2:end)-R_index(1:end-1));
max_QRS_d=round(max_RR_d/4);
j=1;
y_HP3=y_HP.*y_HP.*y_HP;
delay=34;
R_index2=R_in... |
%% Generate an Airy Pattern and add noise.
N=65;
xrange=[-1 1];
x=linspace(xrange(1),xrange(2),N);
[xx, yy]=meshgrid(x);
[theta, rr]=cart2pol(xx,yy);
AiryPattern=jinc(rr).^2;
AiryPattern=uint16((2^10-1)*AiryPattern);
NoisyPattern=imnoise(AiryPattern,'poisson');
%% Filter and Interpolate.
xs=x(2)-x(1);
fcut=2; % The Fo... |
function [m,result] = gpt_carnivoroustraps_3d_supp_20191031( m, varargin )
%[m,result] = gpt_carnivoroustraps_3d_supp_20191031( m, varargin )
% Morphogen interaction function.
% Written at 2019-10-31 13:43:15.
% GFtbox revision 6030, 2019-03-06 16:30.
% The user may edit any part of this function lying between l... |
%%
%%
%%
function init_params = InitParams_Ca_PKA();
%%
% SVR = SVRtarg/SVRspine;
% SVR = 1;
%%
beta1 = 1.600000e-03;
beta2 = 1.040000e-01;
gamma = 2.870000e-02;
koff_R_N = 22000 ;
koff_T_C = 2600 ;
koff_R_C = 6.500000e+00 ;
spec = {
%%
%% AC1 cAMP production PDE degradation
%%
'Km_PDE' , 0.05 ;%
... |
function I_padded = mirrorpad(I, x_min, x_max, y_min, y_max)
right_pad = I(:, (end-x_max):(end-1));
right_pad = fliplr(right_pad);
if x_min < 0
left_pad = I(:, 2:((2-1-x_min)));
left_pad = fliplr(left_pad);
I_padded = [left_pad, I, right_pad];
else
I_padded = [I, right_pad];
end
bottom_pad = I_padde... |
% This function wraps matlabs plot function except that it trnasforms data
% points and axis labels using th two provided functions. This is similar
% to using gca.XScale but more general.
% For example:
% Pej_plot_fxfy(x,y,@(x)log(x), @(y)y, '.', linewidth', 2)
% would be equalt to:
% semilogx(x,y, '.', linewidth', 2... |
monthAverages=zeros(12,3);
monthStd=zeros(12,3);
%Finding monthly mean and standard deviation
for m= 1:12
monthAverages(m,:)=[mean(d(d(:,2) == m,4)), mean(d(d(:,2) == m,5)),mean(d(d(:,2) == m,6))];
monthStd(m,:)=[std(d(d(:,2) == m,4)), std(d(d(:,2) == m,5)),...
std(d(d(:,2) == m,6))];
end
%
%Finding th... |
function plotmesh(sourceV, sourceF, targetV, targetF)
sF = sourceF;
sV = sourceV;
if (nargin<3)
targetV = sV;
targetF = sF;
end
trisurf(sF,sV(:,1),sV(:,2),sV(:,3), 'FaceColor', 'cyan','FaceAlpha', 0.8);
%plot of the meshes
h=trisurf(sF,sV(:,1),sV(:,2),sV(:,3),0.3,'Edgecolor','none');
hold
light
lighting phong;... |
function feature_rms = AmplitudeEnvelope(in, hop, wLen)
if (~exist('in'))
error('AmplitudeEnvelope(in, ...): "in" es un parametro requeridos')
end
if (~exist('hop'))
hop = 256;
end
if (~exist('wLen'))
wLen = 1024;
end
in = in(:,1);
w = hanning(wLen);
normW = norm(w,2);
pft = 1;
lf = floor((length(in) - wL... |
% varargin is for cases where you want to have more than one file pattern,
% so for example you want to combine results from Reactom with TF binding.
function Pej_Visualize_Enrichments_General(OutputFolder, EnrichmentOutputPathPattern, varargin)
Q_Thr = .01;
MinQ_log10 = 1E-15; % The smallest Qvalue to plot, smaller o... |
function [Q,C,info] = retrieval(q,gt_q,retriev,gt_r,options)
%
% [Q,C,info] = retrieval(quer,gt_q,retr,gt_r,opt)
%
% quer : query set (one sample per row)
% gt_q : groundtruth for the query set
%
% retr : retrieval set (one sample per row)
% gt_r : groundtruth for the retrieval set
%
% opt : default options f... |
function peaks = findPeaks4( Amp, MAX_PEAK, EPS_PEAK, SSF )
%plot(Amp);
% This version modified from findPeaks.m by P. Moller-Nielson
% 28.3.03, pm-n. ( see http://www.daimi.au.dk/~pmn/sound/ )
SPECTRUM_SIZE=length(Amp);
%three = Amp(3:SPECTRUM_SIZE-1);
%two = Amp(2:SPECTRUM_SIZE-2);
%four = Amp(4:SPECTRUM_SIZ... |
% SINC amplitude table generator for Tecmag
clear
clc
close all
%%%%%%% User-defined parameters %%%%%%%
slice = 0.350; %mm, slice thickness
G = 6.59; %T m-1, B0 field gradient
% tau = 79.68e-6; %s; pulse length
bandwidth_factor = 4.73;
integral_factor = 0.07;
% Nlobes = 0; %# of sinc lobes
dt = 1e-8; %s, time per pu... |
% Disp('add or copy this file to your matlab default startup folder');
% Disp('and change matlab_m3dk_path to your local path');
set(0,'DefaultTextInterpreter','latex');
set(0,'DefaultAxesFontSize',18);
set(0,'DefaultAxesFontName','Latin Modern Roman');
matlab_m3dk_path='/Users/fwang/matlab_m3dk';
addpath(matlab_... |
%{
1 = 1/1
2 = (1+2)/2
3 = (1+2+3)/3
%}
A=[1,2,3];
B=[];
sum=0;
for i=1:length(A)
sum=sum+A(i);
avg=sum/i;
B(i)=avg;
end
disp(B);
|
% MATLAB R2015a function
% S. M. Farzaneh, farzaneh@nyu.edu
% Created: November 30, 2017
% Title: Quantum capacitance of bilayer graphene
function [cq] = quantum_capacitance(surface_potential, energy_asymmetry, temperature)
% cq: quantum capacitance [F/m^2]
% surface_potential: [V]
% energy asymmetry [J]
% tempera... |
function K = covPref(hyp, x, z, i)
%COVPREF K = covPref(hyp, x, z, i)
%
% The preference kernel.
if nargin<2, K = '2'; return; end % report number of parameters
dg = false;
if nargin == 3 && strcmp(z,'diag')
dg = true;
z = x;
end
if nargin<3
z = x; % self-covariance (make suze z exist)
end
p... |
function sk = pick_curves(mask)
% pick_curves - ask for the user to build a set of curves
%
% sk = pick_curves(mask);
%
% mask is a background image (should be in [0,1] approx).
%
% The user right-click on a set of point which create a curve.
% Left click stop a curve.
% Another left click stop the process.
... |
function [V,D]=cellEig(C)
% function [V,D]=cellEig(C)
% ------------------------------------------------------------------------
% Computes eigenvalues and eigenvectors for each matrix contained in the
% cell array C, i.e. [v,d]=eig(c) is executed for each cell entry.
%
%
% Kevin Mattheus Moerman
% gibbon.to... |
function [xi, yi, zi, face] = Devoir4(nout, nin, poso)
xi = 0;
yi = 0;
zi = 0;
face = 0;
systeme = Donnees();
AfficherSimulationVisuelle(poso, systeme.CylindreTransparent.Centre.GetHorizontalArray());
AfficherCylindre(systeme.CylindreTransparent);
% Valeurs à choisir ici :... |
line(map(:,1), map(:,2), 'lineWidth', 2, 'Color', 'r'); % draws arena
line(new_map(:,1), new_map(:,2), 'lineWidth', 2, 'Color', 'g'); % draws padded map |
function [plt, fit, Xs, Ys] = scatterbound(x, y, numpt, order, varargin)
p = inputParser;
p.KeepUnmatched = true;
p.addParameter("ShowDetail", false, @islogical);
p.addParameter('Ax', gca, @(x) isa(x, 'matlab.graphics.axis.Axes') || isa(x, 'matlab.graphics.GraphicsPlaceholder'));
p.addParameter('Exact', false,... |
function [ xPhantomOffset, yPhantomOffset, zPhantomOffset ] = phantomPlacement( inputPhantom, position, xVoxelL, xVoxelR, yVoxel, zVoxel )
%PHANTOMPLACEMENT Returns dimensions to place "inputPhantom" on whole-body voxel model
%
% Copyright 2016 Joseph V Rispoli
% 2016/04/13
%
% Input variables
% inputPhantom: three... |
%combineBacPop: Combine together data taken from different takes
%into one structure
%
% USAGE rProp = combineBacPop(takeData, trainingList);
%
% INPUT
% takeData: nx1 structure containing the following fields"
% takeData(n).fileDir: directory containing single bacteria
% number... |
classdef DBManager < Base.Manager
%DBMANAGER Responsible for handling save callbacks
% The methods here prepare a data struct with a few default fields
% before passing to a Modules.Database instance:
% data.origin: The module whose data is being saved
% data.saved_by: The soon-to-be... |
%% Load Data ex 2: house prices estimation
clc
clear
close all
data = load('Data\ex1data2.txt');
X = data(:, 1:2); % regressors matrix
y = data(:, 3); % output
N = length(y); % number of training samples \ observations
% Print out some data points
fprintf('First 10 examples from the dataset: \n');
fprintf(' x = [%.... |
%% 第五章 图像复原
%% 例5.2 各种噪声
clc
clear
r = imnoise2('gaussian',100000,1,0,1);
bins = 100;
hist(r,bins)
title('gaussian')
r = imnoise2('uniform',100000,1,0,1);
bins = 100;
figure,hist(r,bins)
title('uniform')
r = imnoise2('salt & pepper',1000,1,0.1,0.27);
bins = 100;
figure,hist(r,bins)
title('salt & pepper')
r = imnoi... |
function cnt=BaryCenter(v)
% BaryCENTER computes the barycenter of the core.
%
% Usage: cnt=BaryCenter(v)
% Define variables:
% output:
% cnt -- Barycenter of the core.
%
% input:
% v -- A Tu-Game v of length 2^n-1.
%
% Author: Holger I. Meinhardt (hme)
% E-Mail: Holger.Meinhardt@wiw... |
function length = input_shiplength(prompt,index)
% input the length and output the prompt
% if it is not required format, repeat input
fprintf(prompt,index);
length = input('');
while length < 2 || length > 5
fprintf(prompt,index);
length = input('');
end
end |
function[f,g]=fun01(x,indf,indg,nprob,iutil,rutil)
%programado por Marcelo de Franca Cordeiro em 04/2001
%fun32 - computes f and g
%
% f is the objective function
% g(ncstr) is a vector with the response contraints ordered as follows:
%
% g(1),...,g(neqlin) - Linear equality constraints
% g(neqlin+1),...,g... |
logFile = 'myLog_TranslatedMnist_2.txt';
logFile0 = 'myLog_rva_xp1_std=0.11.txt';
logFile1 = 'myLog_rva_xp2_std=0.11.txt';
string = 'tester:confusion accuracy';
y0 = getStat(logFile, string);
y1 = getStat(logFile0, string);
y2 = getStat(logFile1, string);
colorList = {'r','g','b','m','black','b','m'};
plot(y0,'LineW... |
%% SCRIPT: PIPELINE_NON_LOCAL_MEANS
%
% Pipeline for non local means algorithm as described in [1].
%
% The code thus far is implemented in Cuda GPu.
%
% Mastoras Rafail Evangelos
% 7918
% January 2017
%
% DEPENDENCIES
%
% [1] Antoni Buades, Bartomeu Coll, and J-M Morel. A non-local
% algorithm for image denoising... |
clear;
addpath(genpath('/home/scw4750/github/global_tool'));
caffe_path='/home/scw4750/github/caffe/matlab';
rank_n=50;
% for lightencnn
prototxt='/home/scw4750/github/IJCB2017/lightencnn_deploy.prototxt';
% caffemodel='/home/scw4750/github/IJCB2017/final_LightenedCNN_C.caffemodel';
caffemodel='/home/scw4750/github/IJ... |
close all
clear all
clc
N=5;
L=2;
fo=0.1;
n=0:N-1;
x=sin(2*pi*fo*n);
y=zeros(1,L*length(x));
y([1:L:length(y)])=x;
subplot(211)
stem(n,x)
subplot(212)
stem(n,y(1:length(x))); |
function [ex,ey,ez] = quat2xyz(q)
%QUAT2XYZ Convert quaternion to XYZ Euler angles
% [EX,EY,EZ] = QUAT2XYZ(Q) converts the quaternion Q to its
% corresponding Euler angle representation.
%
% © Copyright Phil Tresadern, University of Oxford, 2006
X = q(1); Y = q(2); Z = q(3); W = q(4);
xx = X * X;
xy = X * Y;
xz... |
% ECE 403
% Assignment 5 Problem 2.10
% Author: Noah Rondeau V00816430
%NOTE: THE FUNCTIONS grad_desc, newton, and bfgs HAVE BEEN MODIFIED TO
%OUTPUT ALL THE x_k FOR ALL k IN THE ARRAY xs, WHERE THE LAST ELEMENT IS
%THE SOLUTION (IF ONE IS FOUND)
%THEY HAVE ALSO BEEN MODIFIED TO STOP ITERATING AFTER 2000 ITERATIONS
%... |
function dMdx = MnUBubmb2(x,M,p)
% M must be a column vector
% p is a structure with the parameters
% M is a vector of size 2*p.n,1
% the first p.n components are M
% the second p.n components are dM/dx
% dMdx is a vector of size 2*p.n,1n
% the first p.n components are dM/dx
% the sec... |
function [driverPath, x0, y0, v0, yaw0, simStopTime] = ...
createDriverPath(scenario,subsample)
% Create driver path
% v0 % Initial speed of the ego car (m/s)
% x0 % Initial x position of ego car (m)
% y0 % Initial y position of ego car (m)
% yaw0 % Initial yaw angle of ego ca... |
function [UVW]=HKLtoUVW(lsfits,HKL,Temp)
%CTERun License
%Copyright (c) 2012, The Kriven Research Group. All rights reserved.
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions are met:
%1. Redistributions of source code must reta... |
function [results]=gab_task_erplab_basicfilter(args)
%% DESCRIPTION:
%
% INPUT:
%
% These inputs are taken directly from pop_basicfilter.m. Please refer
% to pop_basicfilter.m for a complete description of these variables. A
% brief description of each is provided here.
%
% args.channels: channels to fil... |
ccc
temp = dir('./RawData/meas_MID00051_FID30521_UCAIR_Ungated2D_SPGR_MB3_11_3ml_stress_Kspace_PCA.mat');
if isempty(temp)
temp = dir('./RawData/kSpace_1.mat');
if ~isempty(temp)
load('./RawData/kSpace_1.mat')
else
error('missing file kSpace_1.mat under ./RawData')
end
temp = dir('./... |
clc;
clear;
close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script is for processing the annotation files.
% Last editted by brady deng in 1-22
% Finally we can get the starttime and durtion time of the apnea and
% hypopnea in the anno mat file.
%%%%%%%%%%%%%%%%%%%... |
%%ACKLEY Ackley's test function for numerical optimization
%
% Known global minimum is the origin (in any dimension)
%
% The function is vecotrized and supports any number of dimensions.
%
% Author(s): Soren Ebbesen, 14-Sep-2011
% sebbesen@idsc.mavt.ethz.ch
%
% Version: 1.1 (19-Jun-2013)
%
% Institute for Dynamic Sy... |
function x_dot = Dynamics_pack(~, x, u, model)
global Param
Vc = x(2);
Tc = x(3);
Ts = x(4);
R1 = getParamESC('RParam',Tc,model); % RC circuit resistance
tau = getParamESC('RCParam',Tc,model); % RC time constant
C1 = tau/R1; % RC circuit capacitance
Q_... |
function output = reframe(filename, top, right, bottom, left)
%% Cuts the number of pixels specified by the user from top, right, bottom, and left
%% Reading the image
img = imread(filename);
img = im2double(img);
% Size of the output image
[m,n,p] = size(img);
%% Info
disp(['The original size of the image is : ' int2... |
function x = clearance(x,c)
if c > 0
x = max(x-c,0) + min(x+c,0);
end |
allfiles_ori = uigetfile('*.mp4','MultiSelect','on');
if ~ischar(allfiles_ori)
allfiles = cell2struct(allfiles_ori,'name');
else
allfiles = struct;
allfiles(1).name = allfiles_ori;
end
SPEED = 0.029;
DIST = 0.66;
AREA = 0.85;
yes_n = 1;
no_n = 1;
for fi = 1:length(allfiles)
load(strcat(allfiles(fi).... |
close all
clear all
% Note for 1st time use :
% ======================
% Upon completed connection with the Hue-Bridge, you will get an appID,
% stored to a mat file "userNameWQuotes.mat" for later use.
% Keep an eye to this newly generated file
% testType = 'AroundHues'; %SingleColors, AroundHues, None
% testType... |
% For testing the function createMovie.m
% This is a sandbox script really
% Rl or 'RobotLinks' is a vector of booleans cooresponding to whether each
% link is a 90 degree bracket or a link. 'true' for a link.
Rl = [false, false, true, false, true, false];
% bracket is a 1x6 bool array. For bracket links, 'true' = li... |
% perform tests for the particular net
% you can run setcions manually, just keep in mind to
% run this init section first
%% init section - train the net or load saved state
display('Initialising network . . .')
[net, info] = cnn();
% change last layer for testing purpose
net.layers{end}.type = 'softmax';
% load... |
function [filteredBoxes, priorityHelper] = BoundingBoxFilter(boxes, rows, cols)
% Filter bounding boxes based on priority, size, and aspect ratio
filteredBoxes = zeros(size(boxes,1),size(boxes,2));
priorityHelper = zeros(rows, cols);
lastIndex = 1;
for i=1:size(boxes,1)
bbox = boxes(i,:);
width_ = bbox(4) - bb... |
function [output_img] = dft2d(input_img, flags)
[N, M] = size(input_img);
output_img = zeros(N,M);
% disp(N);
% disp(M);
if flags == 1
f = input_img;
Fxv = zeros(N,M);
for u = 1:M
for v = 1:N
for y = 1:N
Fxv(v,u) = Fxv(v,u) + f(y,u)*exp((-i)*... |
function arrayhandsvideo = SetVideo(videopath)
% Detecta las manos de cartas en un video y extrae sus combinaciones de
% sets
% Inicializamos la estructura
handvideo.InitialFrame = [];
handvideo.FinalFrame = [];
handvideo.Cards = [];
handvideo.Sets = [];
arrayhandsvideo = handvideo(1:1);
... |
% read all images
inputDir = '/home/thanuja/RESULTS/cvpr/TED/cnn_stc';
type = 'png';
inputFileList = dir(fullfile(inputDir,strcat('*.',type)));
% for each image, create a subdirectory and copy the image there
for i=1:length(inputFileList)
filename = strsplit(inputFileList(i).name,'.');
imgName = filename{1};
... |
clear paramsAll;
% clear params;
% params.Gridjob.runLocal = false;
% params.Gridjob.requiremf = 3000;
% params.Gridjob.jobname = 'layer1PhaseAll';
% params.PhaseSimulation.inActFolder = 'layer1ActRectified';
% params.PhaseSimulation.inActFilenames = 'act.*.mat';
% params.PhaseSimulation.inFileid = num2cell(1:185);
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function d = klDivergence(P, Q)
% Computes the KL-divergence between the two (discrete) distributions P and Q. Solely computed
% over the range of Q, that is, where Q is non-zero. <-- is that valid???
%
% Input parameters:
%
% Output param... |
load('data.mat');
representations = col2im(W_1', [48 48], [5 5], 'distinct');
imagesc(representations);
colormap(gray); |
function C = mkron(A,B)
C = [];
for i = 1:size(A,1)
row = [];
for j = 1:size(A,2)
row = [row A(i,j,:).*B];
end
C = [C; row];
end |
%% Estimate Glc consumption
clear all
close all
clc
%%
td = 90; % doubling time
g = log(2)/(td/60); % 1/hr
u = 0.003 % %/doubling;
t = [0:0.01:30]; % hrs
od_0 = 2.3506e-05; % [od]
od_0 = 0.02;
c_0 = 2^-6; %
%%
r = 0.5;
figure(1)
subplot(2,1,1)
plot(t/(td/60),od_0*exp(g*t),'k');hold on;ylab... |
function [C, R] = LinearPnP(X, x, K)
% X - size (N x 3) matrix of 3D points
% x - size (N x 2) matrix of 2D points whose rows correspond with X
% K - size (3 x 3) camera calibration (intrinsics) matrix
% C - size (3 x 1) pose transation
% R - size (3 x 1) pose rotation
num = size(X,1); % number of points
X = [X, ones(... |
function[x] = newtontor(u,R,r)
x = pi;
for i = 1:1000
x_new = x - (-u - pi + (x/(2*pi))+ (r*sin(x))/(2*pi*R))/(1/(2*pi) + (r*cos(x)/(2*pi*R)));
if abs(x_new - x) < 0.00000001
x = x_new;
return
else
x = x_new;
end
end
|
fs = 1000; %#sampling rate
f0 = 50; %#notch frequency
fn = fs/2; %#Nyquist frequency
freqRatio = f0/fn; %#ratio of notch freq. to Nyquist freq.
notchWidth = 0.1; %#width of the notch
%Compute zeros
notchZeros = [exp( sqrt(-1)*pi*freqRatio ), exp( -sqrt(-1)*pi*freqRat... |
function [uShapelets, labelsResult, resultRI, totalTime] = RunManyClusters_Fast(varargin)
global params;
split_op = params.split_op;
params.path.aligned_data = ['data', split_op, 'aligned_data'];
test_results = ['results', split_op, 'test_results'];
workspace = [test_results, split_op, 'workspa... |
function [theoryDataCells,X,Y,XDis] = doubleVesselChangV1V2(V1,V2,varargin)
%迭代体积V1,V2的结果,其中,输出theoryDataCells是一个cell长度是分段数总和
%既是length(param.sectionL1) + length(param.sectionL2) + length(param.sectionL3)
%theoryDataCells每个内容是一个结构体,结构体定义为:
% res.X V1
% res.Y V2
% res.Z 计算的脉动结果
%
% massFlowE1 经过fft后的质量流量,直接对质量流量进行去直... |
function [lh_log,R_tmp] = compute_ll(X,PI,P);
% this function is used to calculate log-likelihood and store tempory matrix used for calculating reponsibilities later.
% input: X - observed data.
% PI - mixing proportions
% P - probabilities of Bernoulli
% output: lh-log - log-likelihood
% R... |
function retval = face_colors(IFSObj,varargin)
if ~face_colors_exist(IFSObj)
error('Face colors do not exist.');
end;
if isempty(varargin) || isempty(varargin{1})
f = 1:nof(IFSObj);
else
f = varargin{1};
end;
retval = double(IFSObj.FC(f,:))/255;
|
function pr_feedback(version)
global exp
%% Look up which key is the right one
if exp.better_box_left == 1
better_key = exp.nkey.le;
elseif exp.better_box_left == 0
better_key = exp.nkey.ri;
end
%% Determine accuracy and present feedback
% When participants gave no response
if isempty(exp.key)
... |
function y = CEM(X, d)
%CEM is a classic target detection algorithm.
% Assume n is the number of the pixels,
% d is the number of the bands.
%
% Then,
% X should be a n*d matrix,
% D should be a 1*d matrix.
R = X' * X;
R_ = pinv(R);
w = R_ * d' / (d * R_ * d');
y = X * w;
end |
function dict = integrals_map(element_locations, distribution, low_lim, high_lim, mu, d_var )
L = numel(element_locations);
pd = kron(element_locations, ones(L, 1));
pdd = kron(ones(L, 1), element_locations);
set1 = pd-pdd;
tmp1 = pdist(set1, @(x, y) x - y);
tmp2 = pdist(set1, @(x, y) y - x);
set2 = unique([tmp1(:); tm... |
%function for plotting the flow and the velocity of the flow at different
%points
function [] = plotflow3(p,v,u,t);
global u_0
%work out heigts of the flow along
pmin=min(p);
pmax=max(p);
% u2=NaN(n);
% u2(1:length(u))=u;
x=[pmin-10:0.01:pmax+10];
[h,~]=Gauss(x,p,v);
figure;
subplot(121)
plot(x,h); hold on
plot(... |
clear all
clc
%% outline
% show ch,en,fs result
%% en %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clf
fi_na=['../res_data/en/en_rand_chose/Mat_rand_chose_4000_rep2.mat'];
load(fi_na);
plot_rang=[-569.59 -569.55 -569.59 -569.55];
subplot(1,2,1)
re=dat_En_tr;
si=out_tr_pr_en;
h=fun_plot_res_... |
function [ out ] = lab3_ej5()
datos = load("datos_aeroCBA.dat");
year = datos(:,1);
temp = datos(:,2);
year1 = (1957:1/8:2017)
x = [];
y = [];
z = [];
w = [];
for i = 1 : size(year)
if (isnan(temp(i)) == 0)
x = [x year(i)];
y = [y temp(i)];
... |
function [x,y] = eightshape(t)
arg = t;
x = sin(arg);
y = sin(arg).*cos(arg);
end
|
clear,clc;
load('data\D.mat');
ComparisonMethods = D(1).methods;
nrCompMethods = size(ComparisonMethods,2);
maxarray = zeros(1,nrCompMethods);
minarray = ones(1,nrCompMethods)*inf;
maxOutliers = zeros(1,nrCompMethods);
minOutliers = zeros(1,nrCompMethods);
for j = 1:nrCompMethods
for i = 1:size(D,2)
... |
% generate a testcase:
% - <adj_nontrans> is a randomly generated non-transitive DAG
% - <adj_trans> is a DAG created by adding a few transitive edges to
% <adj_nontrans>
% For large graphs the testcase generation may run for quite a while,
% since the code is far from optimized for runtime
[adj_nontrans,adj_trans]=... |
%% Completes the matrix using the start values stored in the Solver
%%
%% params: maxErrIn, spectralErrThreshold, boundSpecErr, GT
%%
%% result: iterations, ANew,
%% specErr, distErr
%% breakReason,
%% LNew, RNew, ZNew, ANew
function [result] = SigmaxSolver(M, para... |
function [cl,level,x,X] = getclickx(x,thresh,fs,opts)
%
% [cl,level,env,X] = getclickx(x,thresh,fs,[opts])
% Returns the time cue to each click in x, in seconds. Click extraction
% is done in two steps. First the approximate click locations are found
% from a conventional low-pass filtered rms envelop... |
[a,b,c] = fileparts(mfilename('fullpath')) ;
[a,b,c] = fileparts(a);
root = a ;
addpath(fullfile(root,'function'));
addpath(fullfile(root,'code_old'));
%addpath(fullfile(root,'gmm'));
%addpath(fullfile(root,'segmentation'));
if systemJudge() == 1
addpath('~/projects/imageprocessing/common');
addpath('~/pro... |
function lab6OF(ImPrev,ImCurr,k,Threshold)
% Smooth the input images using a Box filter
ImPrev=double(ImPrev);
ImCurr=double(ImCurr);
% ImPrevB = imboxfilt(ImPrev,5);
% ImCurrB = imboxfilt(ImCurr,5);
% Calculate spatial gradients (Ix, Iy) using Prewitt filter
[Ix, Iy] = imgradientxy(ImCurr,'Prewitt');
% Calculate ... |
function [V,C,connectivitylist] = hexgrid_voronoi(gridsize,sidelength)
%creates hexagonal list of vertices V, cell of cells C, and matrix of
%connetivity between the two. Neighbouring cells is list of neighbouring
%cells for each
%xsize is size of cells in x direction, ysize is size of cells in y
%direction
if nargin =... |
clear;
clc;
N = 9; % No. of subjects
D = 55; % No. of descriptors
% M = zeros(N, D);
num_iter = 1e3;
num_bins = 100;
freqs = zeros(1, num_bins);
progressbar
for xx = 1:num_iter
M = randi([0, 1], N, D);
loa = loa_semantics(M, 'jaccard');
freq_idx = ceil(num_bins * loa);
if(freq_idx == 0)
freq_idx... |
function [xy_departure]=Backward_Advection(flowname,xy,tout,dt)
% this program advects a blob in the cavity flow
% outputs:
% C: the advected field at time stamps in T
% tout(1) is the start time and C(:,:,1) is the initial field
% xy_dp: the location of dparture points at time stamps in T
% xy(:,i) is the location at... |
function y=Gaussian_PDF(x)
y=1/sqrt(2*pi)*exp(-x.^2/2);
end
|
function proj2d = compute_one_projection(xs,ys,zs,data3d,psrc,pcdet,su,sv,nu,nv)
%
% proj2d = compute_one_projection(xs,ys,zs,data3d,psrc,pcdet,su,sv,nu,nv)
%
% xs,ys,zs,data3d - to describe the 3D object
% psrc = [x,y,z] - the x-ray source point
% pcdet = [x,y,z] - the detect center point position
% su,sv - t... |
function [N, NRHS] = relaxM(M, RHS, phi0, omega)
% Relaxes matrix by omega factor
%
% [N, NRHS] = relaxM(M, RHS, omega)
%
% M: matrix
% RHS: right hand side
% phi0: previous step field value
% omega: relaxation factor
N = M + diag(diag(M)*(1 - omega)/omega);
NRHS = RHS + (1... |
function [x,y]=dioph(a,b,c,nx,ny,show)
%
% usage: function [x,y]=dioph(a,b,c,nx,ny)
%
% solve the polynomial equation:
%
% C = A*X + B*Y
%
% where the order of c is increased so the equation has a solution.
% Sylvester method.
% Programmed by Niels K. Poulsen
% Department of Math... |
function rerr=setGirderError(r,pert,errval,mag_group)
% rerr=setGirderError(r,pert,errval,mag_group)
%
% sets specified girder errors (absolute values)
% mag_group is the output of getMagGroupsFromGirderIndex(ring);
%
%
%see also:
if nargin<4
mag_group=getMagGroupsFromGirderIndex(r);
end
magindex=[mag_gr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.