text stringlengths 8 6.12M |
|---|
function tGenerator = LoadFromMatFile( strFilepath )
%
tLoadedWorkspace = load(strFilepath);
%
tGenerator = tLoadedWorkspace.tGenerator;
%
end % function
|
function [ave,ave2,fave,fresult_str,yt,ytl]=f_measure_profiles(fave,fresult_str,fyt,fytl,fx,fy,fheadline,fsp_paras,fmaxval,fdata_type,s_para)
fsp_posi=fsp_paras(1);
fsp_size=fsp_paras(2);
fsp_start=fsp_paras(3);
%fsp_index=fsp_paras(4);
if s_para.window_mode==1
dfcols=[s_para.colors([3 3])]; % individu... |
function y = vl_nneuclideanloss(x, t, varargin)
% VL_NNEUCLIDEANLOSS computes the L2 Loss
% Y = VL_NNEUCLIDEANLOSS(X, T) computes the Euclidean Loss
% (also known as the L2 loss) between an N x 1 array of input
% predictions, X and an N x 1 array of targets, T. The output
% Y is a scalar value.
%
% Copyright (C) 20... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ADM algorithm: tensor completion
% paper: Tensor completion for estimating missing values in visual data
% date: 05-22-2011
% min_X: \sum_i \alpha_i \|X_{i(i)}\|_*
% s.t.: X_\Omega = B_\Omega
% by Ji Liu
% @article{Liu2013PAMItensor,
% title={Tensor completion for estimating missin... |
function [ min_SHAPE, max_SHAPE, threshold_SHAPE, ETERNA_score, d_bin ] = determine_thresholds_and_ETERNA_score( data, pred, NEW_SETTINGS );
% DETERMINE_THRESHOLDS_AND_ETERNA_SCORE
%
% [ min_SHAPE, max_SHAPE, threshold_SHAPE, ETERNA_score, d_bin ] = determine_thresholds_and_ETERNA_score( data, pred, NEW_SETTINGS );
%
%... |
%=========================================================================
%
% Program to estimate a SUR system
%
%=========================================================================
function linear_sur( )
clear all;
clc;
RandStream.setDefaultStream( RandStream('mt19937ar','seed',123) )
... |
% Parameter Estimation and Inverse Problems, 2nd edition, 2011
% by R. Aster, B. Borchers, C. Thurber
%
%set the number of points on the ellipse to generate and plot
function plot_ellipse(DELTA2,C,m)
n=100;
%construct a vector of n equally-spaced angles from (0,2*pi)
theta=linspace(0,2*pi,n)';
%corresponding unit vect... |
clc
clear
close all
%% OPTIONS
options
%% INPUT VALUES
% HUB/TIP RATIO
lambda = 0.5;
% ROTATIONAL SPEED
n = 9000; %rpm
% ROTOR INLET RELATIVE MACH NUMBER @ TIP
M_R1_t = 0.99;
% STATOR FLOW DEFLECTION
V2Tm_V1Tm = 0.5; % Put 0 for axial velocity at stator outlet
% SOLIDITIES
sigma_R_m_design = 1.3;
sigma_S_m_desi... |
function [myminpos mymaxpos] = findminmax(myarray)
% @author M.Moriche
%
% @brief Function to get the positions of relative maximums and
% minimums of an array.
%
% @date 26-12-2013 by M.Moriche \n
% Taken from old function and documented.
%
% @details
%
% No signal processing, which means that every time... |
function [out1,out2,out3] = adaptwb(in1,in2,in3,in4,in5,in6)
%ADAPTWB Sequential order incremental adaption w/learning functions.
%
% [NET,AR,AC] = <a href="matlab:doc adaptwb">adaptwb</a>(NET,PD,T,AI) takes a network, delayed inputs,
% targets, and initial layer states, and returns the updated network,
% adaption r... |
function p_decodedChromes = checkIfRectsOverlap(p_decodedChromes)
lenToIter = length(p_decodedChromes);
for i = 1:lenToIter
for j = i:lenToIter
if j ~= i && p_decodedChromes(i).exists == 1 && p_decodedChromes(j).exists == 1
p_decodedChromes(i).area = (p_decodedChromes(i).area... |
function [KRGP KRGPC]=k_Reduced_game_propertyQ(clv,x,K,str,tol)
% K_REDUCED_GAME_PROPERTYQ checks whether an imputation x satisfies the
% k-reduced game property (k-consistency).
%
% Usage: [KRGP KRGPC]=clv.k_Reduced_game_propertyQ(x,K,str,tol)
% Define variables:
% output: Fields
% rgpQ -- Returns 1 (true) whene... |
function [out, b_hat] = decoder_3(degree,y,in)
%
%Variable decoder of Belief propagation for BEC channel
%
%Author: Yuqi Zhang 2016/2/25
%
%
for ii = 1:degree
ind = find([1:degree]~=ii);
if all(in(ind)==0) && y == 0
out(ii) = 0;
else
out(ii) = 1;
e... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Name : <Sunny Patel>
% GT Email : <sunnypatel18@gatech.edu>
% Homework : hw10
% Section : <B05>
% Collaboration: <place here one of the following:
% "I worked on the homework assignment alone, using
... |
function [result, dist] = search(query, list, W, desc_func)
if(nargin < 3 | isempty(W) | ~W), W = inf; end
if(nargin < 4), desc_func = 'scd'; end
if(nargin < 5), param = []; end
% initialize distance vector (list length)
dist = zeros(1,length(list));
% distance function corresp... |
%User input - Start this script on the root folder
dcmodels <catalogue_name> -nc mfilament -ws o -gm 1 %nc --> contains the following terminology
c=1; % counter for table
for tomo = 1:length(o.models) % loop over tomograms
m = o.models{tomo}; % read models
myTable{c}=m.grepTable(); %get table from model
... |
function decision = spaceOpen(grid, row, col)
% spaceOpen - determine whether the given space is open.
% inputs:
% grid - the grid containing particles.
% row - the row that may or may not be open.
% col - the column that may or may not be open.
% outputs:
% decision - true or false based on whether the given... |
function [correct_cell,maxspeedF,data] = problem_correct_eastwest(qstar,qeast,qwest,data,cellcenter,iv1)
maxspeedF = 0;
correct_cell = 0;
vectphi_east_Trans = data.vectphi_east_Trans;
vectphi_west_Trans = data.vectphi_west_Trans;
vectphi_dxii_Trans = data.vectphi_dxii_Trans;
vectpsi_east = data.vectpsi_east;
vectpsi... |
% coarse to fine grid extractor for two dimensional domain with neuman
% boudary conditions. The fine grid is the reference solution for computing
% errors.
% Emmanuel Asante-Asamani
%11/05/14
function sol = finetocoarse(n,nf,g,solref)
% INPUTS n: the number of nodes along x direction of coarse grid
% nf: the n... |
% MRLRFMTC.M
% To read editable text
% for RFm (RFmax in uT)
% Called by MRLRM
% Check for replot turned on ***********
if mrlreplv == 1 ;
set(mrluirepl, 'Visible', 'off') ;
set(mrlreplb, 'Visible', 'off') ;
mrlreplv = 0 ;
end ;
% Proceed *************
mrlrfms = get(mrlrfmtx,'String');
mrlrfm = str2num(mrlrfms... |
function output = AddGaussianNoise(image, sigma)
if size(image, 3) == 3
image = rgb2gray(image);
end
image = double(image);
[row, col]= size(image);
g_noise = randn([row,col]) * sigma;
output = uint8(double(image) + g_noise);
end
|
clear;clc;
fid = fopen('input.txt');
%% read
result = 0;
i = 0;
commands = "";
while 1
tline = fgetl(fid);
if ~ischar(tline)
break;
end
i = i + 1;
commands(i,1) = tline;
end
%%
sum = 0;
for i=1:length(commands)
result = solveGeneral(char(commands(i)));
sum = sum + str2num(r... |
function [EOE] = EOE_Set(p,f,g,h,k,L)
% Create structure EOE
EOE.p = p;
EOE.f = f;
EOE.g = g;
EOE.h = h;
EOE.k = k;
EOE.L = WrapTo2Pi(L);
end
|
%1 Sample kept the same. Suspect time stretched
sample_no = 1;
sample = '../Audio/sample.aif';
suspect_no = 1;
suspect = '../Audio/suspect.aif';
[result, locs] = time_stretch(sample, suspect, sample_no, suspect_no);
fprintf('Sample# %d vs Suspect# %d: %d\n',sample_no, suspect_no, result);
suspect_no = 2;
suspect = '..... |
function varargout = process_detectBadTrial( varargin )
% @=============================================================================
% This function is part of the Brainstorm software:
% http://neuroimage.usc.edu/brainstorm
%
% Copyright (c)2000-2016 University of Southern California & McGill University
% ... |
function script_ver
%% clear timer existed already
h_timer = timerfind;
if ~isempty(h_timer)
delete(h_timer);
end
%% create a timer object
h_timer = timer('TimerFcn',@worker, 'Period', 0.1, 'ExecutionMode', 'fixedRate', 'TasksToExecute' , 100);
start(h_timer)
function worker(arg1, arg2)
d... |
function [ output] = QAM_dec( data )
for k = 1: length(data)
if real(data(k)) <= 0 && real(data(k)) >= -2 && imag(data(k)) <= 0 && imag(data(k)) >= -2
output(k,:) = [0 1 0 1];
elseif real(data(k)) <= 0 && real(data(k)) <= -2 && imag(data(k)) <= 0 && imag(data(k)) >= -2
output(k,:) = [0... |
function ClickFcn(handle, ~, board)
idx = str2double(get(handle, 'Tag'));
msgbox(sprintf('Hello from %s!', board(idx).Name))
|
function taskID = getclus_taskid(serverID)
% getclus_taskid: collects the environmental variable taskID from cluster
% in use (compatible with spock and della)
%
% Usage:
% taskID = getclus_taskid(serverID)
%
% Args:
% serverId: server ID (spock or della)
taskID = [];
if ~exist('serverID', 'var') || isempty(se... |
close all
fs = 44100;
filterorder = 4;
fc_start = 14000;
fc_end = 500;
impulse = zeros(100,512);
fc_start = log10(fc_start);
fc_end = log10(fc_end);
fc_loss = (fc_start-fc_end)/99;
%figure(1)
for i = 1:100
[b,a] = butter(filterorder,10^fc_start/(fs/2));
h = impz(b,a);
impulse(i, 1:length(h)) = h';
fc_st... |
%--------------------------------------------------------------------------
% Subroutine of plato_mode_ID_echelle.m
%
% Automatic mode ID from echelle diagram dedicated to l=2. Must be used
% once l=1 and l=0 modes have already been identified.
%
% Patrick Gaulme, MPS, 19.1.19
%-----------------------------------------... |
%load B
judge2=zeros(40320,1);
for i=1:40320
if FobTime(i)>87.58
judge2(i)=1;
else
judge2(i)=0;
end
end
|
[x y]=meshgrid(A0,deltaP0);
figure;
e_surf=surface(x,y,con_e,'LineStyle','none')
axis([min(A0) min(deltaP0) max(A0) max(deltaP0)])
hold on;
z=get(e_surf,'ZData');
set(e_surf,'ZData',z-10);
for i=1:length(A0)
[O_e(i) posi]=max(con_e(:,i));
deltaOP(i)=deltaP0(posi);
end
plot(A0,deltaOP)
|
function segment_gm(session_dir,subject_name)
%% Set default parameters
if ~exist('session_dir','var')
error('"session_dir" not defined')
end
if ~exist('subject_name','var')
error('"subject_name" not defined')
end
SUBJECTS_DIR = getenv('SUBJECTS_DIR');
%% Segment GM
disp('Segmenting GM, WM, ventricles, brain... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is an implementation of CONFIGR,
% as described in:
% Carpenter, G. A., Gaddam, C. S., & Mingolla, E. (2007).
% CONFIGR: A vision-based system for long-range figure completion.
% Neural Networks, xx(x) xxx-xxx.
% Technical Report CAS/CNS TR-2007-01... |
%AW: Looks good. see comment below. 0.95/1.
%Inclass assignment 8 - Sanjana Srinivasan
%Using the swalign function
% A. Create a random DNA sequence of length 100.
dnaseq1=randseq(100);
% B. Create a second sequence from the first one by changing the middle 20 basepairs (at positions 41-60)
dnaseq2=strcat(dnaseq1(1:... |
function ssdiff = compareCurves(vars, curv1, curv2, tquery)
% Given two curves, interpolate the first in reference to the second and
% find the sum squared differences betweeen the two curves as a function of
% a time offset. This can be used to minimize difference between two time
% offset curves. The second curve sho... |
%% Main Script for STRING, taken from code for TFs
%% Human
specific_path = '/home/jhow/Documents/OfficialRents/';
addpath(genpath(specific_path))
net_path = strcat(specific_path, 'DataSets/STRING/Final_STRING_Networks/');
cd(net_path)
list_files = dir('*.txt');
% Loop through all species, and process
for t = 1:lengt... |
% cur_macrostate = q_x, q_y, p_x, p_y
function cas_ent_force = calc_cas_ent_force(cur_macrostate, ...
num_sample_path, num_time_steps)
if nargin == 1
num_sample_path = 1;
num_time_steps = 5;
end
sample_paths = zeros(4,num_time_steps,num_sample_path);
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DESC: Train and evaluate linear regression model to predict violent
% crime rate in the US (at community level) based on socio
% demographic factors
% DATE: 21/10/2019
% AUTHORS: Miguel Bravo & Hesam Rafiei
%%%%%%... |
%{
#
cage : varchar(64) # cage identifying info
---
purpose : varchar(128) # cage purpose
%}
classdef Cage < dj.Lookup
end |
clear all;
close all;
B1 = load('D:\abanobi\Documents\STAGEISTERRE\gueguen\Archive\ERGATZ\CS1\060304_1309.001.mat');
B2 = load('D:\abanobi\Documents\STAGEISTERRE\gueguen\Archive\ERGATZ\CS1\060304_1326.002.mat');
B3 = load('D:\abanobi\Documents\STAGEISTERRE\gueguen\Archive\ERGATZ\CS1\060304_1344.003.mat');
B4 = l... |
list=dir('gallery/*/*.png');
fid=fopen('list.txt','wt');
for i=1:length(list)
name=list(i).name;
class=name(1:3);
fprintf(fid,'%s %d\n',[class filesep name],str2num(class));
end |
trial_time = 3000;
i = 1;
SAMPLE_MEAN = 2.5;
SAMPLE_VAR = 1.25;
for k=[2 5 10 30 50]
%%
% This section generates 300 such sums and histogram the results.
trials = randi([0 1], k, trial_time, 5); % Generate the 5 successes Bernoulli trial.
trials = sum(trials,3);
samples = sum(trials);
subplot(5,... |
function ini=read_ini(fname)
% READ_INI - read GUI parameter file
if ~exist(fname,'file')
error('File not found.')
end
fid=fopen(fname);
names = textscan(fid,'%s%*[^\n]');
names=names{1};
frewind(fid);
data=textscan(fid,'%*s =%[^\n]');
data=data{1};
params={'filename','%s';...
'pathname','%s';...
'... |
%% Working with Multiple Currents
% In this script, two currents are created. One, Gaussian, will act as the
% plasma current, while the other one will act as a filament creating a
% basic magnetic divertor.
%% Domain and Current Definition
% While currents can be initialized without having to care about a valid
% dom... |
function save_image(file_name,j)
F = getframe(gcf);
[X, ~] = frame2im(F);
imwrite(X,[file_name,'\slice_',num2str(j,'%03.f'),'.jpg']);
end |
function [ outputs ] = get_outputs( generators )
K = size(generators, 1);
n = size(generators, 2); % Number of output bits = 1/r
num_states = 2^(K-1);
%% Create a table of the possible shift register states
states = zeros(num_states, K-1);
for i=1:num_states
s = dec2bin(i-1, K-1);
for j=1:K-1
... |
%TP PFE MASTER-AHMED AKHAJJAM
%2020/2021
function x = LDLFact(A,b)
[n,n]=size(A);
L = zeros(n,n);
for i = 1:n
L(i,i)=1;
end
D = zeros(n,1);
for i=1:n
D(i)=A(i,i)-L(i,1:i-1).^2*D(1:i-1);
for j=i+1:n
L(j,i)=(A(j,i)-L(j,1:i-1).*L(i,1:i-1)*D(1:i-1))/D(i);
end
end
% Ly=b, Dz=y, L^Tx=z
z = zeros(n,1);
y = ze... |
clc;clear;close all
t1=0:1/40:7.5-1/40;
t2=7.5:1/40:25.6-1/40;
t=[t1,t2];
x1=sin(1.6*2*pi*t1)+sin(3*2*pi*t1+0.04*2*pi*t1.^2+4*sin(0.1*2*pi*t1));
x2=sin(1.6*2*pi*(t2-7.5)+0.055*2*pi*(t2-7.5).^2)+sin(3*2*pi*t2+0.04*2*pi*t2.^2+4*sin(0.1*2*pi*t2));
x=[x1,x2];
N=length(x);
y=awgn(x,11);
fs=40;fc=3;totalscal=200;
FreqBins=li... |
function index = vertex_search(XYZ,vertex)
% This function searches vertex indexes for which the coordinates of the
% corresponding vertices are nearest to the input XY / XYZ.
%
% Inputs
% XYZ : (X,Y)/(X,Y,Z) coordinates of ponits in the form of k x 2 / k x 3
% matrices
% vertex : n x 3 vertices coordinates
%... |
function pyramid = chnsPyramid( I, varargin )
% Compute channel feature pyramid given an input image.
%
% While chnsCompute() computes channel features at a single scale,
% chnsPyramid() calls chnsCompute() multiple times on different scale
% images to create a scale-space pyramid of channel features.
%
% In its simple... |
% Use this version to cluster by hand using "GraphOK.mat" created using
% NOTE that the folder_path may need to be re-written on line 9.
% Only works after the matlab file "GraphOK.mat" has been created using
%
warning('off'); % Warnings will be issued from kmeans- annoying!
load GraphOK;
folder_path = 'Rotat... |
% Parametrisation
initialCond = [0.1 0];
a1=0;
a2=20;
y = 10;
% User defined constants
m = 1.7; % mass [kg]
k = 34; % spring constant [N/m]
beta = sqrt(k/m);% damping coefficient
%Extension
%P_l = 1350; % lung pressure [cmH2O]
%ro = 1.15; % density of air
%U = 600; % flow
% cross sectional area (at the entrance ... |
function [confidence] = getConfidence(costs, locs, step_thres, cost_thres)
locs_diff = diff(locs);
locs_diff = [1 locs_diff];
steps = find(locs_diff~=0);
steps = [steps, numel(locs)];
length_steps = diff(steps);
length_steps(end) = length_steps(end)+1;
min_in_step = zeros(1, numel(steps));
locs_in_step = zeros(1, num... |
function t3AU = T3AU()
%t3au - The pairs of spherical locations that the T3 au affine group spans
d = ejovo.golden.path;
load(d, 'T3AU_CONSTANT')
t3AU = T3AU_CONSTANT;
end |
function p = qpow2(q, r)
% power of q to r
[m n d] = size(q);
q_r = q(:,:,1);
q_i = q(:,:,2);
q_j = q(:,:,3);
q_k = q(:,:,4);
f = find(sum(abs(q),3)==0);
clear q;
if (length(f)>0)
q_r(f) = 0;
q_i(f) = 0;
q_j(f) = 0;
q_k(f) = 0;
end
r = repmat(r,[m n 1]);
q = reshape(cat(3,q_r,q_i,q_j, ... |
% Auther: Shervin Shoai-Naini
% Purpose: Final project for data science class
% Ground vehicle driving cycles in Atlanta, GA
%%
clear all
for i =1:548
m=num2str(i);
ftoread = [' ',m,'.csv'];
fid = fopen(ftoread);
fgetl(fid); %reads line but does nothing with it
M = textscan(fid, '%D %f %f %f %f', 'Delimiter',... |
function out = speed_control(v,a)
out = (v + 1) ./ (((v + 15) ./ a)+1) + 1;
end
|
% this project aims to process data automaticlly for the detection of defects in materials, including the following steps:
% 1.reducing noise using the leastquares
% 2.standardizing the data
% 3.selecting the crucial pictures
% 4.confirm the areas of the defects
% 5.calculating the depth of the defects
% 6.making judge... |
% ray tracing subroutine
% from Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%
% [cxl,czl] = cellfunc(x1,xv,z1,zv)
%
%find the indices of the cells that are to the upper left of the
%raypath points(x1,z1)
function [cxl,czl] = cellfunc(x1,xv,z1,zv)
cxl=ones(length... |
function feat = shape_signature(pnts)
x0 = pnts(:, 1);
y0 = pnts(:, 2);
x = x0 - x0(1);
y = y0 - y0(1);
s = 1 / sqrt(x(end)^2 + y(end)^2);
x = x * s;
y = y * s;
x2 = x(end) * x + y(end) * y;
y2 = -y(end) * x + x(end) * y;
feat = [x2; y2]';
|
function eightshape_variation_test()
close all; clc
dt = 0.01;
t = 0:dt:20;
maxX = 4500;
maxY = 10000;
[x,y] = eightshape_variation(t,maxX,maxY);
subplot(3,1,1);
plot(x,y); grid on; grid minor; %axis equal;
subplot(3,1,2);
plot(t,x); grid on; grid minor;
subplot(3,1,3);
plot(t,y); grid on; grid minor;
figure
velocit... |
function varargout = dac_creator(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @dac_creator_OpeningFcn, ...
'gui_OutputFcn', @dac_... |
function disparity = surfFeaturesToDisparity(leftImage, rightImage, windowSize, maxSearchSpace)
width = size(leftImage,2);
height = size(leftImage,1);
progressBar = waitbar(0, 'Performing SURF Feature Matching...');
leftSubImage = leftImage (1 : windowSize, 1 : windowSize);
surfFeatures = detectSURFFeatures... |
% Copyright by Siddharth Gopal, Carnegie Mellon University, gcdart@gmail.com
%
% Implements the TCS-GM-* methods given in
% Siddharth Gopal and Yiming Yang, Transformation-based Probabilistic Clustering with Supervision,
% Uncertainty in Artificial Intelligence, 2014
%
% Inputs : 1. X (PxN matrix) : training examp... |
%% Assignment 5, Problem 2 b)
% MPC with quadprog. Perfect model.
% Tor Aksel N. Heirung, April 2013.
%% Problem data
% System matrices, model
A = [0 0 0;
0 0 1;
0.1 -0.79 1.78];
B = [1 0 0.1]';
C = [0 0 1];
x0 = [0 0 1]'; % Initial state
N = 30;
block_len = [1, 1, 2, 4, 8, 14]';
n_blocks = numel(block_len... |
function [model] = M3D_load_model2_Iter1()
model.input_model_type='charmodelC';
model.n_st=4;
model.n_par=9;
model.n_stimulus=1;model.st_names=char('Cit_mrna','Cit_foldedP','Cit_fluo','Cit_AU');
model.par_names=char('alpha1','Vm1','h1','Km1','d1','alpha2','d2','Kf','sc_molec');
model.stimulus_names=char('IPTG')... |
function [Sc,Uc] = cuthosvd(S,U,d)
% CUTHOSVD Truncate HOSVD to d elements.
%
% Syntax:
% [S_c, U_c] = CUTHOSVD(S,U,d)
%
% Input:
% S: HOSVD core tensor
% U: HOSVD singular vector matrices (stored in a cell array)
% d: number of elements to truncate to
%
% Output:
% S_c: core tensor truncated to d element... |
function rgb = violet
rgb = [0.93333, 0.5098, 0.93333];
end |
clear all
close all
% generating data
% dataflag == 1 spiral data simulation
% dataflag == 2 real data analysis
dataflag = 1;
if dataflag == 1
t = linspace(0,10*pi,500);
N1 = length(t); %sample size
n=N1;
x = 5*sin(t)+0.5*randn(n,1);
y = 5*cos(t)+0.5*randn(n,1);
z = t+0.5*randn(n,1);
data = [x,y,z]';
end
if dataflag ... |
clear;
clc;
close all;
% original size image
listSubFolder = dir('Train2\**\*.jpg');
% cropped size image
% listSubFolder = dir('data\cropped\**\*.JPG');
% mixed size image
% listSubFolder = dir('data\mixed\**\*.JPG');
label2 = zeros(size(listSubFolder,1),1);
imageData =cell(1596,6);
imgResize=cell(1596,6);
for i = 1... |
function acc = accuracy(prob,test_target)
[~,index_model] = max(prob,[],2);
%[max_b,index_num] = max(test_target,[],2);
sum = 0;
test_target = full(test_target);
for i = 1:size(test_target,1)
% if index_model(i) == test_target(i);
if test_target(i,index_model(i))==1
sum = sum + 1;
end
end... |
function ClusterIndices = RBNN(Points, r, nMin)
% RBNN finds a segmentation of the input point set into clusters
% such that the clusters are bigger than nMin, and point pairs that
% are less than r apart in euclidean distance are in the same cluster
ClusterIndices = repmat(-1, size(Points, 1), 1);
KdTree = cr... |
function testGetEuropean()
%% Test invalid inputs.
function testInputCheck()
wrong_volSurface = rmfield(volSurface, 'spots');
testCase('Test incomplete volSurface.', @getEuropean, wrong_volSurface, 0.8, @(x)max(x-fwd,0));
testCase('Test vectorial T.', @getEuropean, volSurf... |
%% MOLTO-OR Software
% This program is developed at Universidad Carlos III de Madrid as part
% a Master Thesis.
% The software and its components are developed by Sergio de Vera Muņoz,
% tutored by David Morante.
% 2020, Madrid.
%% Main script - Multi Objective Low Thrust Optimization - Orbit Raising... |
function [ location ] = randomLocation( location_params, streetNames, buildingNames )
%randomLocation generates a random location string given the desired type
%of location. location_params is a string containing either a simple street
%address (street name and number) or a building name with a room number
ROAD_NUMBE... |
function [Points] = defineRegion()
% Choose two players to follow, first the attacking player, then the
% injured player. Choose 4 points on the ice to follow throughout
% the sequence. Use these four points to make homography in each frame.
% Also choose one point close to the players to remove the global motion of... |
% F1=figure;
% set(F1,'position',[18 144 560 420]);%Numero de paralelepipedos
lo=2; %Lado del paralelepipedo base
deltax=5; %Altura del paralelepipedo
xo=-lo/2; %Punto de origen en x
yo=-lo/2; %Punto de origen en y
zo=0; %Punto de origen en z
lin... |
function [ x,y ] = EulerPro(f, x0, xn, y0, h)
%改进欧拉方法
%输入 f=函数f(x,y),
% x0=左端点,
% xn=右端点, x0 <= x <= xn
% y0=初值y0=y(x0),
% h=步长,
%输出 向量x的元素是自变量x的取值,
% 向量y的元素是利用改进欧拉方法公式求出初值问题在向量x的元素处的数值解
x(1)=x0;y(1)=y0;
n=(xn-x0)/h;
for i=1:n
x(i+1)=x(i)+h;
y1=y(i)+h*f(x(i),y(i));
y(i+1)=y... |
clear all;
flux = 0;
Q = 1;
k = 8.987*10^9;
x = 0.5;
for y = 0.5:-0.01:-0.5
for z = 0.5:-0.01:-0.5
E = k*Q*0.5/sqrt(x^2+y^2+z^2)^3; % take angel into account
flux = flux + E/10000; % E*dA
end
end
x = -0.5;
for y = 0.5:-0.01:-0.5
for z = 0.5:-0.01:-0.5
E = k... |
clear
clc
dp = 'I:\DataAnalysis\EOEC\';
con = {'BO','BC'};
for c = 1: length(con)
ip = fullfile(dp,con{c},'\ROI264NoGMC\GretnaMetrics');
op = fullfile(dp,'Results');
if ~exist(op,'dir');mkdir(op);end
% datapath = '/data/Data/EOEC/BC/ROI90NoGMC/GretnaNetworkMetrics';
% datapath = '/data/Data... |
function H = getAutoCorrKernel(Xtrain,Xtest,acorr,acx,acy,acz)
[str1,str2]=size(Xtrain);
stst1=size(Xtest,1);
deltaR = zeros(stst1,str1,str2);
for nx=1:stst1
deltaR(nx,:,:) = bsxfun(@minus,Xtest(nx,:),Xtrain);
end
deltaRv = reshape(deltaR,[stst1*str1,str2]);
dRv = num2cell(deltaRv,1);
NN=1e6; % Maximum size for ... |
function bar_line_plot( x,bar_y,bar_legend,line_y,line_legend )
% x:表示月份
% bar_y:SS_Degree表格的某一列,比如第2列表示沙尘暴等级I1每个月发生多少次
% bar_legend:表示条形图的说明,条形图展现的是什么属性
% line_y:weather_data的某几列属性,查看这几个属性与bar_y的关系
% line_legend 表示折线的说明,每条折线表示什么意思
line_type ={'-o','-*','-+','-s','-d','-^'};
figure;
hold on ;
% 条形图
bar(x,bar_y,0.4)... |
function edgecurves = extractedge(inpic, scale, threshold, shape)
if (nargin < 4)
shape = 'same';
end
lv = Lv(discgaussfft(inpic, scale), shape);
lvv = Lvvtilde(discgaussfft(inpic, scale), shape);
lvvv = Lvvvtilde(discgaussfft(inpic, scale), shape);
lv_mask = (lv > threshold) - 0.5;
... |
function results = analysis_WordSpan(results, varargin)
%% DESCRIPTION:
%
% Analysis function for Word Span test. This is intended to be used in
% conjunction with the results structure from SIN's player_main.
%
% Word span is scored in a few ways.
%
% 1) Recognition % correct. This is a score of the recogniti... |
function y = get_trajectory(X,numofsim,Tmax,H,plant)
% simulate trajectory for feedback control model
%
% inputs:
% X - parameters:
% 1. time of target jump
% 2.
% 3.
% 4-7. Feedback gains L
% randomization seed
% len ?
% H ?
% Ad, Bd - discretized plant model dynamics
Ad = plant.Ad;... |
function [ B ] = barycenter(V, F)
% BARYCENTER Compute the barycenter of every triangle
%
% B = barycenter(V,F)
%
% Inputs:
% V #V x dim matrix of vertex coordinates
% F #F x simplex_size matrix of indices of triangle corners
% Output:
% B a #F x dim matrix of 3d vertices
%
% See also: qua... |
function [P] = annulus(r,R,xf,Xf,yf,Yf)
% Creates a annulus patch object and returns the handle. Input arguments
% are the inner radius, outer radius, inner x offset, outer x offset, inner
% y offset and outer Y offset. Changes to the edgecolor and linestyle are
% allowed, and will preserve the correct look of the a... |
clear; clc; close all;
global map zone robot task direction
%% initialization of some parameters
robot_num = 3;
task_num = 10;
carrier_num = 4; % must be integer times of 2
carrier_absence_rate = 0.4; % 0 ~ 1
run_mode = 1; % 1 for run, else for debug
last_data = 0; % to use the last data, 0 to generate new data
fi... |
function [T,I,Y]=naivePerfusionResponseFourP2X7(ton,toff,Ttot,amp)
ode=modelODEFourP2X7(ton,toff,amp);
naive=zeros(4,1);
naive(1)=1;
[T,Y]=ode15s(ode,[0 Ttot],naive);
I=getTotalCurrentFourP2X7(Y,-60*10^-3);
end |
function [ M ] = fittingfn( x )
%FITTINGFN Summary of this function goes here
% Detailed explanation goes here
M = DLT(x); % TODO: Implement DLT.
end
|
function g_subl(file)
% G_SUBL(FILE) Open file in Sublime Text Editor. File has to be on current path
%
% g_subl(FILE)
%
% INPUT file - str with the file name
%
% Gunnar Voet, APL - UW - Seattle
% voet@apl.washington.edu
%
% Created: 02/14/2014
cwd = pwd;
if isempty(strfind(file,filesep))
file = [cwd,f... |
% 获取策略集中最好的逃逸卫星策略
function Solution=GetBestUe(Xpt,Xet,Ue,t,onedt,dt,siz,Vemax)
bestAlf=0;
bestBat=0;
J=0;
%遍历Ue,取使J最小的Ue
for i = 1:siz
for j = 1 : siz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%积分法求位置%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Xet(t,:) = OneGameByDt(Xet(t-1,4)... |
clearvars; clc;
%% ReadBinary output
% direc = 'Satakev8.0_Real_ke/';
% fname = 'SatakeT_HYB_Real_ke2D.t';
% oname = 'Satakev8.0_Real_';
% direc = 'Satakev8.0_3D_Nobw/';
% fname = 'Satake_NOBW_Real_ke2D.t';
% oname = 'Satakev8.0_3D_NoBW_';
direc = 'Satakev8.0_3D_Real_BW/';
fname = 'Satake_BW_Real_ke.t';
oname = 'Sat... |
function cls_results = visualize_cls_res(dataset, output_cache, categories, draw, varargin)
ip = inputParser;
ip.addParameter('baseline', 'output/srcnn_cachedir/conv_ucf_0_p_0_c_scene', @ischar);
ip.addParameter('weights', [], @ismatrix);
ip.addParameter('split', 1, @isscalar);
ip.addParameter('set', 'test', @ischar)... |
function obj=get_esp3_prop(prop_to_get)
obj=[];
esp3_obj=getappdata(groot,'esp3_obj');
if~isempty(esp3_obj)&&isprop(esp3_obj,prop_to_get)
obj=esp3_obj.(prop_to_get);
end
|
%%AUTHOR Neil Fordyce
%%DATE 27/01/14
%Rewrite of TAS detection_overlap.m to support own labeling framework, for
%non-rigid objects. Orignal TAS detection overlap compared bounding boxes,
%which are not be suitable for Golgi groundtruths.
function ov = detection_overlap(bb, mask)
%Crop the mask to the bounding b... |
function S = apollonian_2D(n,level,display_inversion_circle,...
create_mpost,create_svg,filename_export)
% This function creates and displays 2D Apollonian gaskets.
%
% In mathematics, an Apollonian gasket or Apollonian net is a fractal
% generated from three circles, any two of wh... |
function b_min_all = get_top_of_distribution(numlist)
%%
mult = 1/min(numlist);
numlist = mult*numlist;
bins = 0:1:50;
numlist = round(numlist);
num = histc(numlist,bins);
[~,ind] = max(num);
b_min_all = bins(ind)/mult;
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.