text stringlengths 8 6.12M |
|---|
function [xminmax1, xminmax2, fminmax, out] = minmaxjade(fitfun1, ...
maxfunevals1, lb1, ub1, lb2, ub2, options1, options2)
% MINMAXJADE Two-level JADE for min-max problems
% MINMAXJADE(fitfun, lb, ub, maxfunevals) minimize the function fitfun in
% box constraints [lb, ub] with the maximal function evaluations
% maxfu... |
pkg load io;
citrus = xlsread('citrus.xlsx')';
year = citrus(:,1);
year = year - min(year);
b = citrus(:,2);
r = 1:4;
% Polynomial interpolation
A = zeros(6, 4);
A(:,1) = 1;
A(:,2) = year;
A(:,3) = year .^ 2;
A(:,4) = year .^ 3;
% Least squares, SVD decomposition
[U,S,V] = svd(A);
U = U(:,r);
S = S(r,:);
z = U' * b;
... |
function r = rossd2fdp2(t,fd_cell,p)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% rossd2fdp2
%
% The second derivative of the Rossler equations with respect to
% p at times t with values y.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
r = cell(3,3,3);
r(1... |
%QUESTION NO:3
% a)Design and Train a feedforward network for the following problem:
% Parity: Consider a 4-input and 1-output problem, where the output should be
% 'one' if there are odd number of 1s in the input pattern and 'zero'
% other-wise.
clear
inp=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1;0 0 0 0 1 1 1 1 0... |
load('Howell_1');
load('Howell_2');
Dbeta_Psi_curve = spline(Howell_1(:,1),Howell_1(:,2));
Psi_curve = spline(Howell_2(:,1),Howell_2(:,2));
|
function [out] = isinrange_atleast(value, minval, maxval)
% checks if a value, or atleast one value in a row vector of values lies within an interval
% returns '0' or '1' depending on whether atleast one value lie within the interval
chk_vector1 = value > minval;
chk_vector2 = value < maxval;
chk_vector3 = chk_... |
clc;
clear all;
close all;
%% Zuallererst die vl_setup.m ausführen!!!
%% Ort des Classifiers
%path('C:\Users\stefan\Documents\Doktorarbeit\Matlab\Pattern Recognition\ClassifierManifoldLearn');
%addpath(path);
%% Einlesen von Einzelbildern
%I = imread('Fluegel.jpg');
%I = imread('Federgreen.jpg');
%I... |
function A = fouriercoefficients(B,N)
A=zeros(2*N+1);
T=2*pi;
wo=2*pi/T;
t=-3*T:0.001:3*T;
for k=-N:N
for i=1:size(t,2)
A(k+N+1)=A(k+N+1)+B(i)*exp(-1*1i*k*wo*t(i));
end
end
A=A/size(t,2);
%plot(-N:N,A);
|
%Ali AHMED, Youba OTMANI, Zakaria Mzirda
function [rshort] = rSHORT()
deltatF=0.3125*10^(6);
Sk=[];
Sk=sqrt(13/6).*[0 0 1+j 0 0 0 -1-j 0 0 0 1+j 0 0 0 -1-j 0 0 0 -1-j 0 0 0 1+j 0 0 0 0 0 0 0 -1-j 0 0 0 -1-j 0 0 0 1+j 0 0 0 1+j 0 0 0 1+j 0 0 0 1+j 0 0];
Sk=Sk';
length(Sk)
Nst=length(Sk)-1;
Tshort = 0.8*10^(-... |
function [b] = return_test(a)
b == 1;
if a == 1
return;
end
b == 2;
end
|
function xor1
%T = Target
%P = Matriz de Entrada para teste
%Q = Matriz com bit errado para rede avaliar
P = [0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 1 1 0;
0 1 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1;
1 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 1 1 0;
1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0;
1 1 1 1 1 0 0 0 1 ... |
function [hapdata,snppos]=i_gethap(chrid,startn,endn,popid)
Data=[];
load(sprintf('chr%d_%s_haplo',chrid,popid),'Data');
load(sprintf('chr%d_%s_info',chrid,popid),'markinfo');
idx=(markinfo.chrpos>startn&markinfo.chrpos<endn);
hapdata=Data(:,idx);
snppos=markinfo.chrpos(idx);
end |
function xcm = com_comp(ep,gam,xpos,zpos,gvals)
chi = @(r) 1./pi.*(2.*exp(-(r.^2))-.5*exp(-(r/sqrt(2)).^2));
diffmat = sqrt((xpos*ones(1,length(xpos))-ones(length(xpos),1)*xpos').^2 + gam^2*(zpos*ones(1,length(zpos))-ones(length(zpos),1)*zpos').^2);
ivec = gam*chi(diffmat/ep)*gvals/(ep^2);
Finterp = sc... |
function [me, ae] = loadenso
%LOADENSO Store in structure array with commonly indexed years/months
%different valid predictors for ENSO. Note that monthly records are
%averaged to create an alternative annual record, but the converse is not
%performed.
%
% Ted Amdur
% 9/29/20
me.sources = ["Kaplan 3.4";...
"Kaplan... |
% script ShuffleMexDemo.m
% Create demo figure showing effect of ShuffleMex across various dimensions
%
% 2018-08-16 TBC Wrote it.
% sample matrix
sz = [10,4,3];
x = nan(sz);
x(:) = 0:numel(x)-1;
%% Plot various shuffles
h = figure;
set(h, 'name', 'ShuffleMexDemo','NumberTitle','off')
colormap(hsv)
nsp = lengt... |
function [accuracy,predict_y] = runLinearSVM(train_x, train_y, test_x, test_y, Classifier_opts)
%RUNNN Summary of this function goes here
% Detailed explanation goes here
fprintf('Traing classifier using linear SVM.\n');
opts = ['-s ',num2str(1),' -c ',num2str(1)];
classifier.model = train(train_y,sparse(doubl... |
function intersect = circleRefLineIntersect(refLine,bCirc)
%CIRCLEREFLINEINTERSECT Check if any point of refLine is in bCirc
% when implementing else use for and check each state to prevent
% unnecessary iterations
%
%----------------------------------------------------------------------
%... |
function [L,U,pi]=lup_decomposition(A)
n=size(A);
pi=1:n;
L=eye(n);
U=zeros(n);
for k=1:n
p=0;
for i=k:n
if abs(A(i,k))>p
p=abs(A(i,k));
k_pie=i;
end
end
if p==0
fprintf('singular matrix');
en... |
%% Cross Domain Zero-Shot Classification
% Author: Qian Wang
% Date : 18 Aug 2018
% Update: 10 Nov 2018
% Update: 08 Jan 2019
%% Loading Data:
% Features are extracted using resnet50 pretrained on ImageNet without
% fine-tuning
%clear all
addpath('./utils/');
%data_dir = '/mnt/HD2T/DomainAdaptation/OfficeHomeDataset_1... |
function predict = predict_cross( cross_nn,input_x)
% PREDICT_CROSS Summary of this function goes here
% Detailed explanation goes here
predict = zeros(size(input_x,1),1);
for ii = 1:10
predict = predict + nnpredict(cross_nn(ii),input_x);
end
predict = predict / 10;
end
|
classdef Bucket < handle
properties
end
properties(SetAccess = private)
triangles = [];
x
y
end
methods
function b = Bucket(x,y)
if nargin > 0
b.x = x;
b.y = y;
end
end
functi... |
function point = intersectLinePlane(line, plane)
%INTERSECTLINEPLANE Intersection point between a 3D line and a plane
%
% PT = intersectLinePlane(LINE, PLANE)
% Returns the intersection point of the given line and the given plane.
% LINE: [x0 y0 z0 dx dy dz]
% PLANE: [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2]
%... |
%{
05/14/2022
Purnanand Elango
Compare solvers for determining solution to feasible problem
with fine termination tolerance
High accuracy solution is estimated
%}
clc
clear variables
close all
addpath utils
addpath solvers
addpath solvers/expipg
x_max = 1;
u_max = 0.5;
n = 256;
m = n/2;
N = 20;
% Code generatio... |
%% Selected commands from the command history
% Copyright 2010 - 2011 MathWorks, Inc.
ds = dataset('xlsfile', 'Data.xls') ;
scatter(ds.LDL_BL , ds.LDL_12wk )
LDLplot(ds.LDL_BL, ds.LDL_12wk, 50, 'g')
gscatter(ds.LDL_BL , ds.LDL_12wk , ds.Group )
ds.Group = nominal(ds.Group) ;
grp1 = ds.Change_LDL(ds.Group == 'S... |
% Example using lsqnonlin optimizer and registration error image
% instead of value.
% clean
clear all; close all; clc;
% Add all function paths
addpaths
% Read two greyscale images of Lena
I1=im2double(imread('lenag1.png'));
I2=im2double(imread('lenag2.png'));
% b-spline grid spacing in x and y dire... |
% SVM classification for data
% Need to have run Training.m first
clear;
load('data1/BoW_tra','BoW');
fprintf('\nClassification using BOW rbf_svm\n');
labels = importdata('jpl_interaction_labels.xlsx');
labels1 = struct('name',[],'label',[]);
labels1.name = labels.textdata.segmented(2:85,1);
labels1.label = labels.dat... |
clc; clear all; close all;
load('100m.mat');
x=val(1,:);
ecg=x';
figure(1);
plot(ecg); grid on;
title('ecg wave'); xlabel('time (msec)'); ylabel('amplitude(mV)');
N=8; M=8;
k=input('enter the total no.of samples ');
% n=0:1:k;
figure
n=1:1:2*k;
for i=0:1:7
x=ecg(n); y=ecg(n+i+1); ... |
function txtscn = textscan_cfg(filename, subdir, format, delimiter, headerlines)
% ======================================================================
% Syntax: txtscn = textscan_cfg(filename, subdir, format, delimiter, headerlines)
% Description: open file and reads content with command textscan
%
% IN: ... |
% kinematic model of purely Kelvin-voigt model for peristalsis motion
% case: five-segment larval structure
% Mechanical model:
% Kelvin-voigt model (spring and dashpot in parallel)
% Mass is represented for the cuticle circle
clc;
clear all;
% configure for the model
% refer: mechanics of exploration i... |
function Env_ForestFire(agent,map)
%% environment class demo
clc
% env property をEnv classのインスタンス配列として定義
Env.type="ForestFireMap_sim";
Env.name="firemap";
Env.param.name="firemap";
Env.param.D = 1;
Env.param.map_min = [-50 -50];%[x_min y_min]
Env.param.map_max = [50 50];%[x_min y_min]
if ~isempty(map) %グローバ... |
addpath('../general_functions')
addpath('../../chapter 1')
clear variables
tol=10^(-10);
lam_iter=linspace(0.5,0.999999,10^4);
d_iter=[2 3 4 5];
ER_LL=zeros(length(d_iter), length(lam_iter));
ER_SQ=zeros(length(d_iter), length(lam_iter));
for d_i =1:length(d_iter)
d=d_iter(d_i);
for lam_i = 1:length(lam_iter)... |
function [ ] = project1( num )
for j = num:num
image_name = strcat('train', num2str(j));
load_file_path = strcat('./data1/', image_name, '.jpg');
directory_path = strcat('./Stage2_symbolLoc/', num2str(j), '/');
i = importdata(load_file_path,'jpg');
disp('Starting adapt. Please wait.');
... |
%% toy example
addpath(genpath('/Users/Flight/codes/falkner'))
xx=-10:0.1:10;
[x1,x2]=meshgrid(xx);
x1r=reshape(x1,[],1);
x2r=reshape(x2,[],1);
nsamps=length(x1r);
rho=1;
delta=3;
y_noise=0.2*rho;
x1_c=-2; % peak center coordinates
x2_c=7;
xdist=(x1r-x1_c).^2 +(x2r-x2_c).^2;
y=rho.*exp(-xdist./(2*delta^2))+randn(nsa... |
function uT=unitTangent(v)
% Calculates the unit vectors of the spectral derivate of a curve.
uT=normr(fftD(v,1,1));
end |
function [categories,scores]=predictCategory(im,categoryClassifier)
if nargin==1
categoryClassifier=load('classifier.mat');
categoryClassifier=categoryClassifier.categoryClassifier;
end
[labelIdx, scores] = predict(categoryClassifier, im);
categories=categoryClassifier.Labels(labelIdx);
|
%Evaluates the gradient of the socp barrier for a product of cones
function g = eval_socp_gradient(problem,xc)
g = zeros(size(xc));
i = 1; %Index of the first variable of the cone
for(j=1:problem.n_soc_cones)
%Calculate 1/x'Jx
xjxi = xc(i)^2-norm(xc(i+1:i+problem.soc_cones(j)-1))^2;
x... |
function fnval = SEIR_ode(t,y,parms)
p = parms.p;
more = parms.more;
beta = more.beta_fun(t,p,more);
beta = beta(:);
tmpvec = beta.*y(:,1).*(p(2) + y(:,3));
r = y;
r(:,1) = -tmpvec + p(1) - p(3).*y(:,1);
r(:,2) = tmpvec - p(4).*y(:,2) - p(3).*y(:,2);
r(:,3) = p(4).*y(:,2) - p(5).*y(:,3) - p(3).*... |
% Burger_Vector_Calculator_Mathematical_Models
% This script was made to make a plot of the performance of the program
% with the 3D data set to be used for analysis in the program's associated
% paper
%% Introduction
% Computes the Burgers vector for a specified Burgers circuit from elastic
% strain and lattice rot... |
function menu()
clear
clc
fprintf("\tTURUNAN PERTAMA\n");
fprintf("\t MENU PROGRAM\n\n");
fprintf("1. Masukan big O yang pasti\n");
fprintf("2. Tampilkan semua kemungkinan big O\n");
fprintf("3. Masukan sembarang big O dan uji\n");
pilihan = input("\ninput pilihan >> ");
fprintf("\n");
... |
function varargout = feedforward_graph(varargin)
% FEEDFORWARD_GRAPH MATLAB code for feedforward_graph.fig
% FEEDFORWARD_GRAPH, by itself, creates a new FEEDFORWARD_GRAPH or raises the existing
% singleton*.
%
% H = FEEDFORWARD_GRAPH returns the handle to a new FEEDFORWARD_GRAPH or the handle to
% t... |
function deghost_image(img_path)
% Dependencies
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Patch-GMM prior
addpath('epllcode');
% Bounded-LBFGS Optimization
addpath('lbfgsb/lbfgsb3.0_mex1.2');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I_in = im2double(imread(img_path));
fprintf('Size of image: %d %d %d\n', size(I_in));
... |
RGB = imread('rice.jpg');
I = rgb2gray(RGB)
BW = im2bw(I, 0.6)
B = medfilt2(BW)
RGB1 = imread('brown_rice.jpg');
I1 = rgb2gray(RGB1)
BW1 = im2bw(I1, 0.6)
B1 = medfilt2(BW1)
points1 = detectSURFFeatures(B);
points2 = detectSURFFeatures(B1);
[f1,vpts1] = extractFeatures(B,points1);
[f2,vpts2] = extractFeatures(B1,poi... |
% Clear extra lines from plot for ZNLDetect.m
%
% Matt Allen, July 2005-Aug 2006
global ZNLD
chs = get(102,'Children');
ax_h = find(strcmp(get(chs,'Type'),'axes') & ~strcmp(get(chs,'Tag'),'legend'))
all_lhs = get(chs(ax_h),'Children');
clear_lhs = setdiff(all_lhs,ZNLD.lhands.hands);
% Delete all the li... |
function [PolyBboxes] = Bboxes2PolyBboxes(bboxes)
% PolyBboxes | x y | reshape(~,4,[])
Point_1=bboxes(:,1:2);
Point_2=[bboxes(:,1) bboxes(:,2)+bboxes(:,4)];
Point_3=[bboxes(:,1)+bboxes(:,3) bboxes(:,2)+bboxes(:,4)];
Point_4=[bboxes(:,1)+bboxes(:,3) bboxes(:,2)];
Point_all=[Point_1 Point_2 Point_3 Point_4];
P... |
%% r is the rotation vector, a row vector of four elements,
%% where the first three elements specify the rotation axis, unit vector (l,m,n) and the last element defines the angle θ.
%%
%% how to create rotation matrix
%% refs:
%% https://en.wikipedia.org/wiki/Transformation_matrix#Rotation
%% https://en.wikipedia.o... |
function [ f ] = f17( D, params, noisy )
%F_17 Schaffers F7 Function
if nargin < 1
D = 2;
end
if nargin < 2
params = default_params(D);
end
if nargin < 3
noisy = 0;
end
x_opt = params{1};
f_opt = params{2};
R = params{3};
Q = params{4};
... |
clear all;
%%Analytical section
syms t x_0 v_inf t_obs omega
g_inf = sqrt(1/(-v_inf.^2 + 1));
g = @(t) ((1+(v_inf.*t/x_0)^2)/(1+(v_inf.*t/(x_0.*g_inf)).^2)).^(1/2);
tau = @(t) int(1/g(t),t);
tau_obs = tau(t_obs);
s = -tau(t) + tau_obs;
x = @(t) x_0.*(1+(v_inf.*t/x_0).^2).^(1/2);
dx2 = -(t-t_obs)^2 + (x(t)-x(t_... |
function nedges = countOutgoingEdges(A)
%%COUNTOUTGOINGEDGES Returns the number of incoming edges in a graph.
%
% edges = countOutgoingEdges(A) returns a column vector containing the
% number of all outgoing edges from the node indexed in the array. That is:
% if the 1st element as a value of 2, it means that 2 edges s... |
function [ ms ] = samp2ms( sample, samplingRate )
%converts from samples to milliseconds
%samplingRate is in Hz
ms = sample./(samplingRate/1000);
end
|
% this is the function of counting the addresses I got in a txt file.
|
function varargout = GUI_Relaxation(varargin)
% GUI_Relaxation MATLAB code by Edi Suprayoga
% feel free to contact me at suprayoga.edi@gmail.com
% last edit 3 Mar 2016
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui... |
function [IO,A] = apply_texture_map(tsh,UV,T)
% [IO,A] = apply_texture_map(tsh,UV,T)
%
% Inputs:
% tsh handle to trisurf
% UV #tsh.Vertices by 2 list of UV-coordinates into [1:size(T,2) by 1:size(T,1)]
% T tc-height by tc-width by 3 rgb texture image
% Output:
% IO gcf-height by gcf-width b... |
function O = imwarp_grad_im(uv, I)
O = imwarp_bilinear_mex(uv(:,:,1), uv(:,:,2), I);
% bi-linear warping
% if nargout >1
% compute the gradient of warped image w.r.t. the input image I
% u = uv(:,:,1);
% v = uv(:,:,2);
%
% % Image size
% sx = size(I, 2);
% sy = size(I, 1);
%
% % Image size w/ padding
% % Warped ... |
function out = LapIter(BV)
w = 1;
[m,n] = size(BV);
Fnew = zeros(m,n); % Initialize the updated angle field
Fold = BV;
Fupdate = zeros(m,n) + 1;
Fupdate(1,:) = 0;
Fupdate(end,:) = 0;
Fupdate(:,1) = 0;
Fupdate(:,end) = 0;
iter = 0;
maxiter = 1000;
tic
while iter<maxiter
iter = iter+1;
disp(iter)
... |
clear
load bugsScraped.mat
colours = parula(24);
%% disaggregated data
figure(1)
clf
for ip = 1:6
subplot(2,3,ip)
H = bar(tBugs,dataBugs(ip,:));
H.FaceColor = colours(4,:);
xtickangle(90)
xticklabels(year(tBugs));
title(fieldsBugs(ip))
end
%% averaged ordinal data (statisti... |
function gt = get_gt(Tt)
% 函数功能: 计算树的节点t的损失函数
% 函数输入参数:
% Tt: 以节点t为根节点的子树
% 函数输出值: 节点t的损失函数
Ct = Gini_fun(Tt.labels); %该节点t的基尼指数
clear leaf_cnt;
leaf_labels = leaf_cnt(Tt); %求子树t的叶子节点的类别标签
CTt = 0;
for i = 1:length(leaf_labels) %计算所有叶子节点的基尼指数
Ni = length(leaf_labels{i});
Gi = Gini_fun(leaf_labels{i... |
% Script to run batch mode for asymptotic safe set
% Authors:
% Shibabrat Naik, Shane Ross
% Last modified:
% 01 April 2015
N = 1001;
global epsilonC
for epsilonC = 1.9:0.05:3
fileName = ['diary_',num2str(epsilonC)];
diary(fileName)
asymptotic_sculpting_finder(N)
diary off
close all
end
|
function updated_map = avgProjMapWithInputData(proj_map, input_data, alpha, h, w, is_use, t)
%==== Set variables ====
input_points = input_data.pointcloud.Location;
input_colors = input_data.pointcloud.Color;
input_normals = input_data.normals;
proj_points = proj_map.points;
proj_colors = proj_... |
function [tx, bits, gain] = tx1_flat()
tonecoeff = 4;
msgM = 4;
trellis = poly2trellis(7,[171 133]);
fsep = 8e4;
nsamp = 16;
Fs = 120e4;
M = 16;
k = log2(msgM);
bits = randi([0 1],1024*k/2,1);
bits_transmit = convenc(bits, trellis);
syms = bi2de(reshape(bits_transmit,k,length(bits_transmit)/k).','left-msb')';
msg =... |
%=========================================================================
%
% Plot a near unit root process
%
%=========================================================================
function unit_nearunitroot( )
clear all;
clc;
RandStream.setDefaultStream( RandStream('mt19937ar','seed',123) );
... |
k = 30;
theta = normrnd(0,1, [k,1]);
theta = theta / norm(theta);
while true
eta = W * theta;
eta_new = zeros(Vocs,1);
temp1 = zeros(Vocs,1);
temp2 = zeros(Vocs,2);
for l = 1:Docs
cl = trainX(l,:)';
temp1 = cl*(eta'*cl)*(eta'*cl) + 2*(cl.* cl.* eta) - 2*(eta'... |
function [S,D,J] = sample_discrete(D,n)
% SAMPLE_DISCRETE Sample a discrete distribution given by D n times. This
% employs the "Alias Table Method". Ensuring that the running time is O(n +
% m)
%
% Inputs:
% D m list of probabilities summing to 1
% n number of samples to output
% Outputs:
% ... |
fun = @solve2eq;
x0 = [2.5 2.5];
x = fsolve(fun,x0);
disp(x) |
function [snd,profile] = multimvripfft(rippleList, cond)
% MULTIMVRIPFFT generates multiple moving ripples via FFT
% s = multimvripfft();
% s = multimvripfft(rippleList);
% s = multimvripfft(rippleList, cond);
% [s, profile] = multimvripfft(rippleList, cond);
% rippleList = [Am1, w1, Om1, Ph1
% Am2, w2, Om2, Ph2
... |
conn.W = [];
conn.inputSubtract = zeros(1,1,3);
conn.inputSubtract(1,1,:) = [0.4045, 0.4165, 0.4027];
%%
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 12000;
params.Gridjob.jobname = 'lMLayer1';
params.ApplyWeights.inActFolder = '../20130318_AE400/labelMeInput';
params.ApplyWeights.inActFi... |
% LoadTexture - this will load the image into texture buffers for display in the D3d viewer.
% Viewer.LoadTexture(Image,BufferType)
% Image -- This should be an matrix up to five dimensions in the order (y,x,z,channel,time).
% BufferType -- this can either be 'original' or 'processed' and corresponds to the ... |
function [] = graficar_variables(v1,v2,v3,tit,yl,n)
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
t = 1:length(v1);
figure(n)
grid()
hold on
plot(t,v1)
plot(t,v2, 'r')
plot(t,v3,'g')
ylabel(yl,'Fontsize',13)
xlabel('t', 'Fontsize',13)
title(tit,'Fontsize',14)
legend(["CG","MoM","h"],... |
function p34=p34(h)
sldata;
limitpoints;
slopes;
p2=p1*(T2/T1)^(-g/(m12*R));
p3=p2*exp(-g*(h3-h2)/(R*T2));
T34=9.92e-4*h+196.56;
p34=p3*(T34/T3)^(-g/(m34*R)); |
function java_calcbow(cn,channel_bow)
global cs;
cs.s(cn).calc_channel_bow(channel_bow);
cs.s(cn).fint = squeeze(max(max(cs.s(cn).pow)));
end
|
function varargout = mangoGui(varargin)
% MANGOGUI MATLAB code for mangoGui.fig
% MANGOGUI, by itself, creates a new MANGOGUI or raises the existing
% singleton*.
%
% H = MANGOGUI returns the handle to a new MANGOGUI or the handle to
% the existing singleton*.
%
% MANGOGUI('CALLBACK',hObject,ev... |
function daisyPlotSetup(fileName)
% =====================================================
% All this could be added to a function, where input
% arguments are the figure handle fh and the file name.
fh = gcf;
columnWidth = 16.8; % 17 cm for DIN-A4
set(fh, 'PaperUnits', 'centimeters');
set(fh, 'Units', 'centimeters');
... |
%@(#) cyshow.m 1.6 98/06/16 12:42:04
%
function cyshow
load simfile
s=size(filenames);
if length(bocfile)<s(2),bocfile=[bocfile setstr(32*ones(1,s(2)-length(bocfile)))];end
if length(bocfile)>s(2),filenames=[filenames setstr(32*ones(s(1),length(bocfile)-s(2)))];end
s=size(filenames);
filenames=[bocfile; filename... |
function Problem2_26
%Problem 2.26 Ternary condensation inside a vertical tube.
% Uses the function BVP4C to numerically solve the boundary-value problem.
% BVPINIT is used to form an initial guess for the solution on
% a mesh of ten equally spaced points. A guess for unknown parameters
% (the two fluxes) is the last... |
function coeffMatrix = dfdxFiniteDifferenceMatrix(f,h,dim)
%DFDXFINITEDIFFERENCEMATRIX finds coeff matrix for the first finite difference on a uniform grid.
% COEFFMATRIX = DFDXFINITEDIFFERENCEMATRIX(F, H, DIM)
% Creates the coefficient matrix, COEFFMATRIX which is sparse, to take the
% first centered finite difference... |
%Andrew Brown Homework 8 Problem 2
clc
clear
% Richter Scale
%Define the given table
RichterScale=[2,2.5,3,3.5,6,6.1,8.5,8.6,9.9,10]; %Richter scale
KKI=[1e-3,6e-3,3.2e-2,0.18,10e4,2e4,5.6e6,8e6,5e8,1e9]; %Kelly Kiloton Index
%Data Points
subplot(2,3,1)
plot(RichterScale,KKI,'.r','Markersize',15)
xlabel('Richter... |
function viewpdf( mean, sd )
%VIEWPDF Summary of this function goes here
% Detailed explanation goes here
x = -50 : 0.1 : 255;
y = normpdf(x, mean, sd);
plot((x-mean)/sd,y);
end
|
%This is a .m that serves to orient DotProbe_Body towards the appropriate
%image folder. |
function phi = chanvese(f, phi, varargin)
%CHANVESE Chan-Vese two-phase image segmentation
% phi = CHANVESE(f,phi0,opt) performs two-phase segmentation on image f
% using the Chan-Vese model, where f is the image to be segmented, phi0
% is the initial level set function, and opt is a struct containing all
% ... |
function [ M ] = Is_in( E, threshold )
% Compute the vector of points in the nodule from the matrix of probabilities
[m,n,p]=size(E);
M=zeros(m*n*p,3);
t=1;
for i=1:size(E,1)
for j=1:size(E,2)
for k=1:size(E,3)
if E(i,j,k)>threshold
M(t,1)=i;
M(t,2)=j;
... |
img_height = 64;
img_width = 64;
dimension = img_height * img_width;
prompt= 'Enter the name of Dataset on which you want to test the algorithm? Yale, gtdb, faces96, MUCT, or Grimace: \n';
str = input(prompt,'s');
if(strcmp(str,'Yale'))
num_e_test = 3;
num_e_train =12;
train_size=456;
test_size=114;
... |
function [qp]=pp2a_2(input)
% [qp]=pp2a_2(input)
% PID A-2 pole placement controller for 2nd order processes.
% This function computes parameters of the controller (q0, q1, q2, p1, p2).
% The dynamic behaviour of the closed-loop is defined by its
% poles: z1 = alfa+j*omega, z2 = alfa-j*omega, z3,z4 = alfa.
% T... |
%Tyler Matthews 4/15/19
%System Simulation Problem 13
close all; clc; clear; %Clear Console and Close Figures
%% Alpha = 0.1 - Initial Condition x,y,z=0.1
N = 10000;
T = 0.1;
t = linspace(0, T*N, N+1);
alpha = 0.1;
fxc = zeros(1,N);
fyc = zeros(1,N);
fzc = zeros(1,N);
xp = zeros(1,N);
yp = zeros(1,N);
zp = zeros(... |
function f = taxi_fare(distance, time)
distance = ceil(distance);
time = ceil(time);
f = 5 + ((distance - 1) * 2) + (time * 0.25);
end
% fare = taxi_fare(3.5, 2.25); |
% Enumeration of available prefilters
% -------------------------------------------------------------------------
%
% AUTHOR:
% Nicolas Chenouard, nicolas.chenouard@gmail.com
% Ecole Polytechnique Federale de Lausanne
%
% -------------------------------------------------------------------------
%
% REFERENCE:
%... |
% This script takes positions of all alphas in particular stock
% and attempts to predicts return of that stocks.
% Plots results.
nd = 50; % max num_dates-1
ns = 10; % num_stocks
start_id = 1;
lag = 1;
t = 0;
C = 1;
epsilon = 0.1;
cmd = ['-s 4 -t 0 -h 0 -q' ' -c ' num2str(C) ' -p ' num2str(epsilon) ... |
function [xa,ya,xv,yv]=CreateDataAppVal(xapp,yapp,ratio);
n=size(xapp,1);
ind=randperm(n);
na=floor(n*ratio);
classcode=[1 -1];
[aux,aux,aux,aux,indice]=CreateDataAppTest(rand(n,2),yapp,na, classcode);
xa=xapp(indice.app,:,:);
ya=yapp(indice.app);
xv=xapp(indice.test,:,:);
yv=yapp(indice.test); |
%script file of video frame grab functions
% first line can't be function, so...
1;
function start_conversion(video, start_tm, stop_tm, fps)
% video : path and name of video file relative to 'this'
% start_tm : first frame time in seconds
% stop_tm : last frame time is seconds
% fps : fps
% this wil... |
function [s, varargout] = size(d, dims)
%SIZE Size of the distributed array.
% SIZE(D) returns the length of each dimension in distributed
% matrix D.
%
% SIZE(D, DIMS) returns the length of those dimensions specified
% in DIMS.
%
% Author: Nadya Travinin
% Edited: Edmund L. Wong (elwong@ll.mit.edu)
... |
clear all;
warning off parallel:gpu:device:DeviceLibsNeedsRecompiling
try
gpuArray.eye(2)^2;
catch ME
end
try
nnet.internal.cnngpu.reluForward(1);
catch ME
end
nr_img=20000;
[imgs_l labels] = readMNIST('train-images.idx3-ubyte','train-labels.idx1-ubyte', nr_img, 0);
y = gpuArray.zeros(10,20000);... |
function [Orbit, tout, DataTime, ErrorFlag] = getbpm_bts(Family, varargin)
% [x or y, tout, DataTime, ErrorFlag] = getbpm_bts(Family, DeviceList)
% [x or y, tout, DataTime, ErrorFlag] = getbpm_bts(Family, Field, DeviceList)
%
% Written by Greg Portmann
persistent x y xsum ysum TimeStamp
if nargin < 1
error('Mus... |
function X = equalizeabsorption(X,d,fs)
%
% X = equalizeabsorption(X,d,fs)
% NOTE: this is intended for beaked whale clicks recorded with
% a sampling rate of 96kHz, at distances of 0-2000 m
n = size(X,1) ;
N = 1024 ;
D = (0:250:2000)' ;
% acceptable freq. tapers for emphasis of waveforms recorded ... |
function [sP1 a1 sP2 a2]= calculateDisjointPaths(L,T)
nFlows= size(T,1);
nSP= zeros(1,nFlows);
for i=1:nFlows
[shortestPath, totalCost] = kShortestPath(L,T(i,1),T(i,2),1);
sP1{i}= shortestPath;
a1(i)= exp(-totalCost);
path1= shortestPath{1};
Laux= L;
... |
clc, clear all
nHard = 0;
windowSize = [134 70];
name = {'Go','Si','GoSi','Hog','HogDT'};
svmPath = cell(numel(name),1);
for i = 1:numel(name)
params = load(['results/optimize/inriaParameters' name{i}]); % SI settings
svmPath{i} = inriaTestSvm(params.method,params.svmArgs,true,nHard);
end
save('results/inri... |
function [paceable, paced_pk, paced_pk_time] = check_paceable(time,Ca,n_paces,n_paces_needed,fps,pacingfreq,cell_type)
Ca(1) = 0;
paceable = 0;
max_both = [max(Ca)/4,1e-2];
[pk,pk_time] = findpeaks(Ca,fps,'MinPeakHeight',max(max_both));
if cell_type == 1
rise_filt = 1e-1;
elseif cell_type == 2
rise_filt = 4e-... |
function caffe_reshape_net_as_input(net, inputs)
%
% This file is part of the code that implements the following ICCV2015 accepted paper:
% title: "Object detection via a multi-region & semantic segmentation-aware CNN model"
% authors: Spyros Gidaris, Nikos Komodakis
% institution: Universite Paris Est, Ecole des Pont... |
function [center,param]=findCenter(time,phase,amplitude)
t0=time(1);
duration=time(end)-t0;
time=(time-t0)/duration;
time=time(:);
N=numel(time);
phase=phase(:);
weight=min(amplitude);
weight=(amplitude-weight)/(max(amplitude)-weight);
weight=weight(:).^4;
order=3;
matrix=ones(N,order+1);
for k=1:order
matrix(... |
C1 = [1,0;0,1];
C2 = [1.5,0;0,1.5];
m1 = [0;3];
m2 = [2;1];
numGrid = 50;
xRange = linspace(-6.0, 6.0, numGrid);
yRange = linspace(-6.0, 6.0, numGrid);
P1 = zeros(numGrid, numGrid);
P2 = P1;
for i = 1:numGrid
for j = 1:numGrid
x = [yRange(j) xRange(i)]';
P1(i,j) = mvnpdf(x', m1', C1);
... |
%DEG2RAD Converts degress to radians
function r = deg2rad(d)
r = (d/180) * pi;
end
|
%dyntoutcnasa
%computes the equivalent universal time (UT) from an input dynamical time (TD)
%references: algorithms from https://eclipse.gsfc.nasa.gov/SEcat5/deltatpoly.html,
%which cite Espenak and Meeus (Five Millennium Canon of Lunar Eclipses:
%-1999 to +3000); and Chapter 10 (pp. 77-80) of Astronomical
%Al... |
function [TUV]=convert_NN_NC_to_TUVstruct(file,dtime,conf)
%% function written on April 14, 2015 by Hugh Roarty to convert a HYCOM
%% netCDF file to TUV structured array
%% read in the nc variables
tot.t=ncread(file, 'time');
tot.lat = ncread(file, 'lat');
tot.lon = ncread(file, 'lon');
I = find(tot.lon >= conf.Total... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.