text stringlengths 8 6.12M |
|---|
%%
% Time correlation function of direction
%
% Input: n-by-2 or n-by-3 vector
% U: velocity vector
%
% Output: C: Time correlation function, (n-1)-by-1 vector
% The time stamp for C is from t(2) to t(end)
%%
function [C] = time_correlation_directions(U)
% evaluate length of U
[n, m] = size(U);... |
function [T,I,Y]=naivePerfusionResponsepotentP2X4coop3(ton,toff,Ttot)
ode=modelODEpotentP2X4coop3(ton,toff);
naive=zeros(21,1);
naive(1)=1;
setAuxiliarypotentP2X4coop3(naive);
[T,Y]=ode15s(ode,[0 Ttot],naive,odeset('NonNegative',1:21));
I=getTotalCurrentpotentP2X4coop3(Y);
end |
%image_path = ([pwd '/PreProcessed/',name,'_PreProcessed.tif']);
I = imread('VAMP2pHluorin_488_wt_4.tif');
I = imadjust(I);
m = readtable('VAMP2pHluorin_488_wt_4_Processed_tracking.csv');
radi = repmat(10,size(m.centroid_1,1),1);
image = insertShape(I,'Circle',[m.centroid_1 m.centroid_2 radi], 'LineWidth',4... |
function x_recover=sub_x_recover_r1(x,sens_map_mat,x_reduce)
org_N=size(x,1);
x_recover=zeros(org_N,1);
for j=1:org_N
x_recover(j,1)=x_reduce(sens_map_mat(j,1),1);
end
|
% run
savename = 'biasscore.mat';
d = dir('s*');
r = [];
h = waitbar(0, 'Running tests');
N = 1000;
errors = [];
for i = 1:length(d)
filename{i} = d(i).name;
fprintf('Testing %s ', filename{i});
cd(filename{i})
shots = zeros(1, N);
seeds = shots;
if exist('err', 'file')
disp('error reco... |
classdef PulseSequenceManager < Modules.Driver
%PulseSequenceManager Combines PulseSequences with the nidaq and
%PulseBlaster hardware.
% Detailed explanation goes here
properties
PS % Handle to PulseSequence
end
properties(SetAccess=immutable,Hidden)
pb ... |
mex 'Alignment\Align3D.cu' Helper.cu; |
function t = mahalanobisDistance(x, mu, S)
% Computes the squared Mahalanobis distance.
%
% Inputs:
% x - (N, r) data, r - dimension
% mu - (r, 1) cluster centroid
% S - (r, r) cluster scatter matrix
%
% Outputs:
% t - (N, 1) squared Mahalanobis distances
%
% created by Christian A. Schroth, 29.... |
% This function bouds the value in X between 0 and 1 while preserving their
% ranks. If Tol = .01 then it keeps everything between for example .01 and .99 as they are and uses a
% nonlinear transformation to squeez in the rest of the values between
% 0-.01 or .99-1
function Y = Pej_Bound_to_Quantile(X, LowerboundQ, Up... |
function [ P,f_AB, fab, Fadim_AB, T] = AfterBurner( PI,P,CP,TAU,gam,ETA,h,T0,R, T,f, M9, M0, P0)
%Pg 455 pdf elements of gass turbines
%data from Exercici43
%% Exercici 43 apartat b
T.t9 = T.t7; %T.t7 es definida a 2400K
P.t9 = PI.n*P.t6; %A pressió constant
T.s9 = T.t9/(1+(gam.AB-1)/2*M9^2);
TAU.AB = T.t7/T0;
fab = C... |
% the performance of action recognition
% perfActionRecog
% videoPath = 'C:\zxk\Research\monkeyData\20121011_cam1_ex009';
% video = dir(fullfile(videoPath,'ex009*'));
% nObj = 6;
if ispc
videoPath = 'C:\zxk\Research\monkeyData\cam1-127389';
elseif ismac
videoPath = fullfile('~','research','data','monkey','cam... |
function [x Fv]=newtonsysmd(xo,Niter,tol)
x=xo';
for i=1:Niter
delta=eye(length(xo),1);
if (Ffun(x)== zeros(length(xo),1) | abs(max(delta))<=tol)
disp("")
disp ("The method completed successfully!")
disp (Niter)
disp("")
return;
else
Jv=Jfun(x);
... |
function value_list = apply_filter(filter_instance,session_instance,knowledge_instance)
% APPLY_FILTER - Returns the list of possible values allowed in the
% search process for the field associated to the filter.
%
% Usage: value_list = apply_filter(filter_instance,session_instance,knowledge_instance)
%
attribute = f... |
function [Y,del] = soln(X,y,mu=0, sigma=0)
m = size(X,1);
Y = zeros(m,1);
Z = zeros(m,1);
del = zeros(m,1);
for i = 1:m
x1 = X(i,1);
x2 = X(i,2);
x3 = X(i,3);
x4 = X(i,4);
x5 = X(i,5);
Y(i) = 1.151865 * ((x1)/tan((x2)*(x4))) + 0.786789 * ((x3)/log(((x1)*(x4))/tan(x5))) +16.029434;
Z(i)= ((x1)/tan((x4)*(x2... |
function error = ms_err(image1, image2)
% MEAN SQUARE ERROR
% error = ms_err(image1, image2)
% computes the error between image1 and image2
% dimensions must be equal
if size(image1) ~= size(image2)
disp('input matrix dimensions must be the same');
return
end
M = si... |
function [] = LeaningReport(X,Y,TolOption,MaxLag)
if(length(X) < 20),
error('LeaningReport error: X must have at least 20 data points.\n');
end;
if(length(Y) < 20),
error('LeaningReport error: Y must have at least 20 data points.\n');
end;
if( strcmp(TolOption,'std') ),
xtol = std(X);
ytol = std(Y);
... |
function [S,H,V1,V2,LL] = ddschurprod(adjx,adjy,A1,A2,Dx,Dy,C1,C2)
% Computes the Schur complement for a separable operator kron(I,A1)+kron(A2,I)
% Enforces continuity in the first derivative.
m=size(Dx,1);
n=size(Dy,1);
rd1=[1,m];
rd2=[1,n];
kd1=2:m-1;
kd2=2:n-1;
east =rd1(1);
west =rd1(2);
north=rd2(1);
south=rd2(2);... |
function [ ] = array( )
imBluePrint=imread('blprnt.j2c');
%sizeOfArray = size(imBluePrint);
imBluePrint = imresize(imBluePrint, [60,100]);
z=1;
for i=1:20:60
for j=1:20:100
box=imcrop(imBluePrint,[j i 20 20]);
red= box(:,:,1);
green=box(:,:,2);
redMean=mean(me... |
function tools = nnNPoint(varargin)
% Copyright 2012 The MathWorks, Inc.
% Mode
tools.mode = mfilename;
% Default Hints
hints.name = '';
hints.subcalc.name = 'default';
% Override Default Hints
hints = nncalc.argPairs2Struct(hints,varargin);
hints.precision = 'double';
% Name
if isempty(hints.name)
hints.name = ... |
%Vagelis Papalexakis, 2012
%School of Computer Science, Carnegie Mellon University
%Implementation of ParCube Non-negative PARAFAC decomposition for
%memory-resident tensors
function [A B C lambda] = parCube(X,F,sample_factor,times,nonneg)
if nargin == 4
nonneg = 0;
end
mypath = pwd;
p = 0.55;
s = size(X); I = s... |
function formatFigure(fHandle , varargin)
% reformats figure fHandle to custom settings
if ~isempty(varargin)
fnSw = parseArgs(varargin{1});
else
fnSw = parseArgs;
end
figPos = [[1-fnSw.figDim(1), 1-fnSw.figDim(2)]/2, fnSw.figDim];
set(fHandle, 'units', 'normalized', 'outerposition... |
clear;clc;
[apple, banana, medal, box]=fileread();
% [ResultingFeatures] = extractinstances(apple{1,1},100);
AppleFeat = {};
BananaFeat = {};
MedalFeat = {};
BoxFeat = {};
MS_apple = {};
MS_banana = {};
MS_medal = {};
MS_box = {};
for i = 1:size(apple,1)
i
[result_apple, im_apple] = extractinstances(apple{... |
function glycanFileViewer(glycanFileName, varargin )
%glycanFileViewer read the sequence file of a glycan and return a graphical
% represenation of its 2D structure.
%
% glycanFileViewer(FILENAME, FILEFORMAT,OPTIONS) reads a file name
% in the string input argument FILENAME using a sequence format specified
% with ... |
function setFigureProprietes
fig = figure(1);
set(fig,'units','points','position',[400,125,430,400]);
x = [-5 15];
y = [-5 15];
set(gca, 'xtick', x(1):1:x(2));
set(gca, 'ytick', y(1):1:y(2));
hold on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
xlab... |
%plotgirderesp is a MATLAB script that reads in
%qxmat and qymat binary files generated by qresp script.
%girder responses gx/ymat are formed by grouping elements on girders
%cell responses cx/ymat are formed by grouping girders within a cell
%note that gx/ymat and cx/ymat are NOT saved
%this forces all data to be gene... |
function plot_prime
M=mat_gen(200);
for ii = 1:40000
if isprime(ii)==0
[row,col]=find(M==ii);
plot(col,row,'.','Color','w','MarkerSize',10);hold on;
set(gca,'color','m')
else
[row,col]=find(M==ii);
plot(col,row,'.','Color','k... |
function [CList,CSS,BB] = lidar2dbhf(shotnumber,LGE,LGW,pft)
% INPUT
% shotnumber = waveform number
% LGE = ground elevation file
% LGW = waveform file
% pft = percent plant functional type
% pft6,8 = early, late successional conifers (e.g. pine)/(e.g. hemlock / spruce)
% pft9,10,11 = early, mid, l... |
% clear all;
% close all;
% clc;
%
% all_files = dir('RESULTS//savings*');
% load(strcat('RESULTS//', all_files(1).name));
%
% s = savings{1};
%
% figure;
% plot(s.servingBS_IDs, '-');
% title('serving BS ID');
%
% figure;
% hold on
% plot(s.all_ids, s.chunks, 'o');
% plot(s.all_ids, s.BSs_mem_state, '*');
% title(... |
% Generarea vectorului alfa
alfa=0:pi/50:2*pi;
% Incarcarea vectorului y
y=sin(alfa).^2;
% Reprezentarea grafica y=f(alfa)
plot(alfa,y)
% Personalizarea reprezentarii grafice
% - precizarea titluluicu font Arial Black ingrosat
title('\fontname{Arial Black} \bf EXEMPLU')
% - precizarea etichetelor... |
%This is my first program. It's going to do very basic things.
%I hope we can work well together and achieve greatness
%Ask for name
input('What is your name?')
%Ask named person how they are
disp('Hello World2') |
%--------------------------------------------------------------------------
%
% IERS: Management of IERS time and polar motion data
%
% Last modified: 2018/02/01 M. Mahooti
%
%--------------------------------------------------------------------------
function [x_pole,y_pole,UT1_UTC,LOD,dpsi,deps,dx_pole,dy_pole,... |
function [p f C Accuracy] = prediction(theta, X,threshold,y)
%PREDICT Predict whether the label is 0 or 1 using learned logistic
%regression parameters theta
% p = PREDICT(theta, X) computes the predictions for X using a
% threshold at 0.5 (i.e., if sigmoid(theta'*x) >= 0.5, predict 1)
m = size(X, 1); % Number o... |
%%Section 2.1
%Problem 10
for i=4:12
H = hilb(i);
Hi = invhilb(i);
b = ones(i,1);
x1 = H\b;
x2 = Hi*b;
dx = abs(x1-x2);
fprintf('Hibert matrix of order %d \n',i)
fprintf(' | solved using \\ | solved using inverse | difference \n')
disp([x1,x2,dx])
disp(norm(x1-x2)/norm(x2))
en... |
function printsfg2(sfg, filename);
% Check number of input arguments
if nargin < 1
error('Not enough input arguments');
end
if nargin > 2
error('Too many input arguments');
end
% Set a file identifier
if nargin < 2
fid = 1;
else
if ~isstr(filename)
error('The filename must be a string');
end
i... |
classdef subject < handle
% SUBJECT - A class to store all modeling simulations for a subject.
%
%
% Created by Megan Schroeder
% Last Modified 2014-04-11
%% Properties
% Properties for the subject class
properties (SetAccess = protected)
Cycles ... |
% THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION IS RELEASED "AS IS." THE U.S. GOVERNMENT MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, CONCERNING THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT ... |
function f_approx = eval_lin_f(x,p,u)
[A, B] = linearize_in_x(@eval_f3, x0, p, b)
f_approx = A*x+B*[1; u.vEmitter; u.vCollector]; |
classdef Move
% Move Summary of Move
% This class implements the execution of precalculated movements for
% all agents
%
% Move properties:
% ac - array of aircraft in simulation
% lattice_size - dimensions of the simulation lattice
% step_counter=1 - keeps trac... |
function z = f(x,y,mux,muy,sgmx,sgmy,r)
z = 1/(2*pi*sgmx*sgmy*sqrt(1-r*r))*exp(-1/(2*(1-r*r)).*((x-mux).*(x-mux)./(sgmx*sgmx)-(2*r).*(x-mux).*(y-muy)./(sgmx*sgmy)+(y-muy).*(y-muy)./(sgmy*sgmy)));
end |
oxPPP = 0.403 %oxPPP contribution to NADPH production
subb = 0.432 %substrate labelling measured from 100% [1-2H]glucose feeding experiment
ex = 0.8 %water exhcange fraction to be fixed when substrate labelling is varied
KIE = 1.8; %deuterium kinetic isotope effect for G6PDH
NADPH = zeros(10,4); %NADPH is output ... |
function features=ExtrKNN_Score(Datainput,DataLabel,RatioSet,blosumnum)
Len=length(DataLabel); NNset=ceil(RatioSet*Len);LenNNset=length(NNset);
MaxR=max(NNset);features=zeros(Len,LenNNset);
for i=1:Len
Compaset=setdiff([1:Len],[i]);
ProteinSeq1=Datainput{i,1};
Disset4i=1000000*ones(2,MaxR);
for j... |
function files = getfilenames(path, pattern, fullpath, recurse)
% Return cell array of files matching the pattern at the specified path.
%
% files = getfilenames(basePath, <pattern>, <fullpath>, <recurse>)
%
% 'pattern': pattern to be matched. The special case of 'images' will find
% all image types in the inpu... |
function pc=expfallone_mxl(tau,intervals,tm,tx)
%
% function expfallone_mxl(tau,intervals,tm,tx)
%
% Will test out a maximum likelihood algorithm for fitting a distribution
% function. in this instance we will try just a simple exponential with a
% single fit parameter tau. User must also input the minimum resolution... |
function [ hd ] = getdistance( t1, m1, t2, m2 )
% t1 : gallery template
% m1 : gallery mask
% t2 : probe template
% m2 : probe mask
% hd : hamming distance
maxShiftX = 5;
maxShiftY = 1;
hd = 1;
for ys = 0:maxShiftY
for xs = -maxShiftX:maxShiftY
ts = circshift(t2,[-xs,-ys]);
ms = circshift(m2,[-xs,... |
function Result = Minutiae_Match(Image1,Image2)
Result = (Image1 == Image2);
end
|
% WARNIFPARALLELCOMPUTINGBUG warns about a particular bug that prevents
% Javas >= 1.6.0 -39 from using MATLAB's Parallel Computing Toolbox.
function pass = WarnIfParallelComputingBug()
pass = true;
v = ver();
[installedToolboxes{1:length(v)}] = deal(v.Name);
isParallelInstalled = ismember('Parallel Computing T... |
% check_bend_current
%
% Routine used for topoff testing to find the peak current of the booster bend magnet
bendI=get_dpsc_current_waveforms_cond;
figure
subplot(2,1,1)
plot(bendI.Timevec,bendI.Data);
xlabel('t [s]')
ylabel('I [A]')
legend('Bend','QF','QD');
subplot(2,1,2)
plot(bendI.Timevec,bendI.Data);
xlabel('t [... |
function rm_subdata_cback(~,~,main_figure,field)
layer=get_current_layer();
curr_disp=get_esp3_prop('curr_disp');
trans_obj=layer.get_trans(curr_disp);
switch field
case 'denoised'
fields={'powerdenoised' 'svdenoised' 'snr' 'spdenoised'};
trans_obj.Data.remove_sub_data(fields);
curr_disp.... |
function I=trapeze_2D(f,a,b,c,d,n,m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Project : Diffraction électronique
%% Function name : Intégration numérique selon la méthode des trapèzes
%
%% Author : Jean-Christophe G.-A., Thomas R., Nouffel S.
%% Date ... |
clear;
%啮合齿轮的接触应力都相等,只需校核齿轮副,只校核2,4,6,8,10,11的齿轮
%主动齿轮有1,4,6,8,10,11
%从动齿轮有2,3,5,7,9,12
K_c=[8.5 8 8 8.5 8 8];
m_n=[4.5 4 4 4 4.5 4.5];
%是校核齿轮的螺旋角,同时也是从动主动齿轮的螺旋角
Beta=[0.451 0.406 0.367 0.323 0 0];
Z=[37 27 35 43 13 14];
%压力角的选择
alpha=20/180*pi;
Z_z=[17 27 35 43 13 14];
Z_b=[37 35 28 21 47 23];
X_b=[0.7 0.4 0.1 0.1... |
%% Program to test the forward and inverse kinematics of the standford robot
clear all
clc
%Create the StandfordRobot object
Robot=StanfordRobot();
%% Test point 1
disp('-----------Test point 1---------')
T=[0,0,-1,8;-1,0,0,0;0,1,0,22;0,0,0,1]
%%%%%%%%%%%%%%%%%%%%%%% Inverse kinematics %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Fi... |
function [score, indBestMatch, bgDist] = computeGlobalRealismScore(...
colorConcatHistPath, textonConcatHistPath, ...
colorObjHist, textonObjHist, colorBgHist, textonBgHist, alpha, k)
% Computes the global realsim score based on a large database of images
%
% [score, indNearestNeighbor] = computeGlobalRealism... |
function sim1()
%% Goal
% Here we batch animate a sim of zombies in DK
%% Setup
should_plot = true;
pause_length = 'none';
if isnumeric(pause_length)
pause_func = @() pause(pause_length);
else
pause_func = @() drawnow;
end
figure
%% Fetch data
transitions_file1 = 'data/zomInDKrun2.mat';
batches_file1 = 'data... |
function view_err(ds, poss, err, err_map, label, varargin)
%VIEW_ERR Summary of this function goes here
% Detailed explanation goes here
save_figs = ~isempty(varargin) && strcmp(varargin{1}, 'save');
POS_LABEL = 'position along arm (0.25=middle of arm)';
figure;
plot(poss, err, '-x');
title(sprintf('%s: End arm decod... |
% Plot Pi - 2d
%============================
% Jacobi form
figure(1)
clf
hold on
m = 0.5;
nu = [-2,-1,0,0.5,1, 2];
x = -1:0.0001:1;
clg={};
for n = 1:length(nu)
clg{n} = num2str(nu(n));
plot(x,mEllipticPi(x,nu(n),m),'LineWidth',2)
end
hlg = legend(clg,'Location','best');
title(hlg, '\nu','FontWeight','normal'... |
function [ TY, P, sigma2 ] = cpd_coherent( X, Y, lambda, beta2, w, errtol, maxiters, sigma2)
%CPD_COHERENT performs the coherent CPD algorithm
% [ TY, P, sigma2 ] = cpd_coherent( X, Y, lambda, beta, w, errtol, maxiters, sigma2)
%
% Inputs:
% X N x D matrix of input points
% Y M x D matrix of Gaussian cent... |
% FitData.m - Demonstrate curve-fitting
%
% FitData.m : Fit a spreadsheet of voltage readings and temperatures
% using both linear and quadratic curves.
data = xlsread('FitData.xlsx');
volts = data(:, 1); % Voltage readingss in column A
temps = data(:, 2); % Fahrenheit temperatures in column B
% Draw the points as... |
% This code combines two images a and b. It puts an image 'b' on the top of
% 'a' starting from the half of the picture 'a'till the top.
% a should be in the format: 'a.format' example: pict.jpg'
%All right are reserved to:
% Nassim Khaled
% American University of ... |
addpath('libsvm-3.20/windows');
total_runs = 1000;
fprintf('13)\n');
linearly_inseparables = 0;
h = waitbar(0, 'Running RBF-SVM, checking for separability...');
n = 100;
for i = 1 : total_runs
X = unifrnd(-1,1, n, 2);
y = sign(X(:, 2) - X(:, 1) + sin(pi * X(:, 1)) / 4);
libsvm_options = char(s... |
i = find(A.Time == 30/365)
Unik = unique(A.Settlement(i))
for n = 1:length(Unik)
%PREPARING MATRIX FOR EACH UNIQUE SETTLEMENT TIME
clear B C D E F
B = A(i,:);
j = find(contains(B.Settlement, Unik(n)))
C = B(j,:);
C.T = C.Time;
C.Time = [];
C.Maturity = [];
C.Properties.VariableNames{'Vols'} = ... |
function prob = survProbStdModel(t,b,time)
% survProbStdModel: Computes survival probability using the standard model
prob = ones(size(t));
time0 = [0;time];
dtime = diff(time0);
for jdx=1:length(time)
if jdx < length(time)
tmpidx = t > time0(jdx) & t <= time0(jdx+1);
else
tmpidx = t > ti... |
% assuming the input vectors are column vectors.
function [a, b] = zeroPadding(a, b)
if length(a) > length(b)
b = [b; zeros(length(a) - length(b), 1)];
else
a = [a; zeros(length(b) - length(a), 1)];
end
end |
function output_args = threshold_std( temptrace,th_param )
%UNTITLED Summary of this function goes here
% This is max's attept at creating a better thresholding function
fret = temptrace(:,3);
left = 1;
right = size(fret,1);
thresh = mean([th_param(1) th_param(2)]);
xdata = 1:size(fret,1);
% Taken from Updat... |
function F = obj_find_valve_param_a_max(x,Q_r)
% Objective function to find the maximum valve area parameter value
% Copyright 2010 MathWorks, Inc.
assignin('base','a_max', x);
% If necessary, reset parameterizaton to second option (table)
model = 'valve_testrig_flow_char_4way';
load_system(model);
blkpth = find_sys... |
%% Primer Modelo Adaline
clear all;
close all;
clc;
%% Esto es para ver que funciona, pero no es necesario en el modelo
X = rand(100,1);
Y = 10 + 3*X + X.^2 + 4*X.^4;
%% Mínimos Cuadrados
m = size(X,1); %Cantidad de Datos del Problema
% Armar X*
Xa = ones(m,1); %Columna de Unos
for k = 1:4 %el 4 es para una regresión d... |
function fis=update_fis(stat)
%% This function update the rule base of the fuzzy logic controller according to the Q-values
% ------------------------------------------------------------------------
% Authors: Pooyan Jamshidi (pooyan.jamshidi@gmail.com)
% The code is released under the FreeBSD License.
% Copyright (C) ... |
function init_butterfly
global exp;
%% Determine which butterfly likes which flower
% Determine randomization version based on subjID
n_randomizations = 4;
exp.version = mod(exp.subj, n_randomizations);
% Determine butterfly liking
if exp.version == 1
exp.le_flower_butterflies = [1 2];
exp.ri_flower_butterfli... |
function antsApplyWarp(subject,ROI,histoVol,path,val)
% this code will apply the warp calculated in antsCreateWarp.m to the MPM ROIs
%
%
% Input:
% subject = name of the subject directory in the histoRecons
% ROI = the MPM ROI you want to register to the histo vol
% histoVol = 3D histological volume
% path = path to... |
function [xsave] = sampleTrajectoryCPU2(px, hyp, mean_factor, ...
var_factor, start_states, polpar, s, steps)
%
% Matrix multiplication version of trajectory sampling with a SPGP model.
% !!! This version uses only CPU !!!
%
% Inputs:
% px: pseudo inputs [m, d]
% hyp: log hyper parameters (b, c, sig) [d+2, dim]... |
function [nlml, dnlml, alpha_kron] = gpr_covMaterniso_grid_mult(logtheta, xgrid, y)
logtheta;
N = prod(cellfun(@length, xgrid));
D = length(xgrid);
if size(y,1) ~= N
error('Invalid vector of targets, quitting...');
end
if length(logtheta) ~= D+2
error('Error: Number of parameters do not agree with covariance fu... |
%%%%%%%%%%%%%%%% MEASURE PCA %%%%%%%%%%%%%%%%
%
% Find the positions of the boundary points in shape space.
%
% Inputs:
% N - the number of images
% M - the number of boundary points in each snake
% frameDelta - the number of frames over which motion is measured
% savePath ... |
%solve_Kepler_for_E
%
%Inputs: Mean Anomaly (must be in radians)
% eccentricity
% tolerance (example, 0.05; default tolerance is 1 * 10^-8
%
%Outputs: Eccentric Anomaly (in radians)
%
%This function solves Kepler's Equation for Eccentric Anomaly, given Mean
%Anomaly and eccentricity of an orbi... |
clc;
clear all;
close all;
d=imread('E:\IMAGES\Matlab\obj1.jpg');
a=size(d);n=a(1,1);m=a(1,2);
for j=1:m;
for i=1:n;
r1(i,j)=d(i,j,1);
g1(i,j)=d(i,j,2);
b1(i,j)=d(i,j,3);
end
end
E(m,n)=0;
for j=1:m;
for i=1:n;
if(rem(i,2)==0&&rem(j,2)==0)
... |
function pixels = histeq( image, nacc, verbose )
%HISTEQ Histogram equalization of gray-level image
% Find min and max
zmin = min(image(:));
zmax = max(image(:));
% Rescale values
rimage = (image-zmin)/(zmax-zmin);
% Find bucket indices
%iimage = 1 + round( rimage*(nacc-1) );
iimage = 1 + floor( rimage*(nacc-1e-10));... |
function solution_summary = display_results_ultrasound(solution,conf)
algs=fields(solution);
y = solution.(algs{1})(50).Ytest;
n = length(y); nalgs=length(algs);
figure
for ia=1:nalgs
xpred=solution.(algs{ia})(50).coefs;
ypred=solution.(algs{ia})(50).Ytestpred;
subplot(nalgs,2,(ia-1)*2+1); plot(1:n,xpred);... |
function test_traceABsym(N)
%TEST_TRACEABSYM test_traceABsym(N)
if nargin == 0
N = 200;
end
A = rand(N); A = A + A.'; % make A symmetric
B = rand(N);
tic;
expected = trace(A*B);
fprintf('time using trace(A*B): %f\n', toc);
tic;
result = traceAB(A,B);
fprintf('time using traceABsym(): %f\n', toc);
assert(abs(expecte... |
function STATE = renorm_load2(datapath, varargin)
max = 1000;
if (nargin > 1)
max = varargin{1};
end
alpha = false;
if (nargin > 2)
alpha = varargin{2};
end
files = dir(datapath);
n = size(files,1);
if (n > max+2)
n = max+2;
end
STATE = cell(1,n-2);
for i=1:n
% fprintf('opening %d...\n', i);
... |
function result = metodaAdamsaBashforthaDlalUkladow(dxdt, dydt, h, x0, y0, t0, koniec, q)
if q < 0 || q > 4
result = NaN;
return;
end
wspolczynniki = zeros(5, 5);
wspolczynniki(1, :) = [1 0 0 0 0];
wspolczynniki(2, :) = [3 -1 0 0 0] / 2;
wspolczynniki(3, :) = [23 -16 5 0 0] / 12;
wspolczynniki(4, :) = [55 -59 ... |
function d=bhatta(m1,c1,m2,c2);
% BHATTA - Calcula la distancia de Bhattacharayya entre dos normales multivariadas
%
% d=bhatta(m1,c1,m2,c2)
%
% Copyright (c) Pedro L. Galindo (1998)
d = chernoff(m1,c1,m2,c2,0.5); |
function [K, dK] = CalKFun(x, y, p)
l = exp(p(1));
sf = exp(p(2));
l2 = l*l;
sf2 = sf*sf;
m = length(x);
n = length(y);
dK = {};
X = repmat(x, 1, n);
Y = repmat(y', m, 1);
R = (X - Y) .*(X - Y);
K = sf2*exp(-0.5/l2*R);
dK{1} = 1/l2 * R.*K;
dK{2} = 2*K;
end
|
function [s, b] = irig(doy, hour, mn, sec, duration, fs)
b = time2bits (doy, hour, mn, sec);
for (n = 1:duration)
sec = sec + 1;
if (sec >= 60)
sec = 0;
mn = mn + 1;
if (mn >= 60)
mn = 0;
hour = hour + 1;
if (hour >= 24)
hour = 0;
... |
% % Survey Field V1.1
% % Modifications: surveyField has been modified to include an input of an image "I" which was previously not there in V0
function [numCards, numFUP, numFDWN, coordsFUP, coordsFDWN, flag] = surveyField(I)
% surveyField captures an image of the playing field from the camera
% OUTPUTS
% % nu... |
%%返回Graph{i}(j)父节点的总产值
function sum_parents_V = calc_parents_V(Graph,Arc,V_list,i,j)
if i==1
sum_parents_V = 0;
else
parents = [];
sum_parents_V = 0;
for u = 1:size(Arc{i-1}, 1)
if Arc{i-1}(u,2)==Graph{i}(j)
sum_parents_V=sum_parents_V+V_list(Arc{i-1}(... |
function STATS=nscores(varargin)
% NSCORES Executes the Van der Waerden version of non parametric tests (Normal
% scores tests).
% Named for the Dutch mathematician Bartel Leendert van der Waerden, the Van der
% Waerden test is a statistical test that k population distribution functions
% are equal. The Van Der Waerden... |
load C
f=fittype('a*x+b'); %引号里的是你的函数模型,默认是以x为自变量,其余为待定参数
xt = (1980:2009);
figure
fity=fit(xt',C(21:50,1),f);
hold on;plot(1980:2050,fity(1980:2050),'r')
fity=fit(xt',C(21:50,2),f);
hold on;plot(1980:2050,fity(1980:2050),'b')
fity=fit(xt',C(21:50,3),f);
hold on;plot(1980:2050,fity(1980:2050),'g')
fity=fit(xt',... |
function px_spm8_stats_ttestp(op,cond,vector)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FROMAT px_spm8_stats_ttestp(op,cond,vector)
% Usage paired t-test
% op = '/Volumes/Data/data/PairedT';
%
% cond.path.a = '/Volumes/Data/data/cond1';
%
% cond.path.b = '/Volumes/Data/data/... |
% 標準偏差
w = -6 + randn(1, 100000);
hist(w, 50)
|
h = 1;
g = 0.1;
m = 10;
Fmax = 10;
p0 = [50,50,100]';
v0 = [-10,0,-10]';
alpha = 0.5;
gamma = 1;
K = 35;
cvx_begin
% position, velocity, thrust vectors
variables p(3,K) v(3,K) f(3,K);
fuel = 0;
for k = 1:K
fuel = fuel + gamma * h * norm(f(:,k),2);
end
minimize ( fuel );
subject to... |
%=======================set string color============================
%---------first element zero-----------
switch get(handles.menu_file_dispcolor_fez,'UserData')
case 1
fezc='red';
case 2
fezc='blue';
case 3
fezc='green';
case 4
fezc='yellow';
case 5
... |
%Assignment on Morphology
%Name:MD Tanvir Rouf Shawon
%ID:160104138
%Part A
close all;
f=[0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 1 0 1 0 0;0 0 1 0 1 0 0;0 0 1 1 1 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0];
figure;
subplot(1,2,1);
imshow(f);
title('Given image');
[x,y]=size(f);
p=zeros(x,y);
%A 3*3 Disc Structuring Element is needed... |
%Test script for git-cola walkthrough
fprintf('Hello world!')
%I made some changes to the script.
fprintf('Hello everyone') |
ti = -4;
tf = 4;
dt = 0.01;
t = ti:dt:tf;
xa = (-1<=t) & (t<=1);
xb = (t+1).*(t>=-1)-2*t.*(t>=0)+(t-1).*(t>=1);
j = find(t,1)-1;
for i=1:length(t)
if i == j
xc(i) = 1;
else
xc(i) = sin(2*pi*t(i))/(2*pi*t(i));
end
end
xd = exp(-0.5*t).*cos(2*pi*t).*(t>=0);
xde = exp(-0.5*... |
function driver_main_figures
%DRIVER_MAIN_FIGURES plots the main figures of the paper in a nice
%format for publication
load ../outputFigures/data_output_figure_1.mat
plot_figure_mean_error_bar_side_histogram(data_output,'file_append','figure1')
%Correlation genetic distance and set point of induction using RAD-seq ... |
clear all
s_zero = 14;
T = 0.5;
K = 15;
B = 20;
sigma = 0.25;
r = 0.1;
gamma = 1;
sigVar = 0.9;
rng(100, 'twister'); %Seeding random number generator
%Feel free to try our different values for times and simulations, but mind
%that complexity is O(times*simulations), meaning that the problem scales
%q... |
clear
clc
climb_angle=atan(asin(0.5*0.35-0.21/2.6));%drag 0.21
m =linspace(0,0.9);%0:0.1:0.9; %linspace(0,0.9)
h =linspace(0,14000);%0:500:13000;%linspace(0,13000)
[M,H] = meshgrid(m,h);
Ae=9.4*(0.8);
W0=144554.8*9.8;
W_W0=0.97;%W1/W0
T0_W0=0.35;
W0_Sref=4700;
W_Sref=W_W0*W0_Sref;
g0=9.81;
R=287;
h0=0;
h1=11000;
P0=... |
close all;
F = [0 51 3 65 7 3 15 13.5 55 70 85 30];
%% read xlsfile
fname = 'E:\DATA\KNO\PET\Phoneme.xls'; % location of xls-file containing phonemescores
[num,txt,raw] = xlsread(fname);
n = size(num,2)-1; % number of subjects
col = jet(n); % color map
T = [];
P = [];
for ii = 1:n
t = num(:,1); % month... |
% gravity_demo.m
% Copyright 2003-2010 The MathWorks, Inc.
clear, close all, clc
get_video_data, disp('press any key to select region'), pause
select_region, disp('press any key to remove background'), pause
remove_background, disp('press any key to segment balls'), pause
segment_by_threshold, disp('press any... |
function[coefs, mse, choice, yhat] = loo(x, y, alpha, lambda)
% Perform Leave-one-out (LOO) cross validation (CV). This is the outer
% function for parameter tuning, calling the opt_comp function for the
% optimization of the number of features (see line 11: opt_lambda).
% x is a cell array containing the feature se... |
function adjustCleanedNoHeaderDataInfo = AdjustForDataLength_Plos1_CompBio_July2021(cleanedNoHeaderDataInfo, ensembleInfo)
cleanedNoHeaderDirectory = ensembleInfo.cleanedNoHeaderDirectory; % 'CleanDataSets_Feb2019'; % './CleanDataSets_Sept2018/'
cleanedNoHeaderDataInfo.nameDetails = sprintf('%s_%1d_%1d'... |
% GMMB_EM_INIT_FCM1
%
% initS = gmmb_em_init_fcm1(data, C, verbose)
%
% Create an initialization structure for EM,
% called from gmmb_em, see gmmb_em.
%
% Fuzzy C-means clustering means, uniform weight and covariance
% Requires the Fuzzy Logic Toolbox.
%
% Author(s):
% Pekka Paalanen <pekka.paalanen@lut.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.