text stringlengths 8 6.12M |
|---|
function [deltaS_b]=s_balance(K,T,S,deltaT,ml_depth,dTdz_min);
%
% S_BALANCE: Computes the balanced salinity anomaly
%
% [deltaS_b]=s_balance(K,T,S,deltaT,ml_depth,dTdz_min)
%
% This function computes the balanced salinity anomaly for the
% error covariance balance operator:
%
% deltaS_b = fac * dS/dz * dz/d... |
function [varargout] = likSech2(hyp, y, mu, s2, inf, i)
% likSech2 - sech-square likelihood function for regression. Often, the sech-
% square distribution is also referred to as the logistic distribution not to be
% confused with the logistic function for classification. The expression for the
% likelihood is
% li... |
function ran = FineTuning(ran, input, target_output)
if (ran.hidden_dimension == 0)
ran.Bout = target_output;
return;
end
for epoch = 1 : ran.parameter.MAX_EPOCH
overall_distance = dist(ran.unit_centers', input);
% current_min_distance = min(overall_distance);
activation = radbas(overall_d... |
function [str] = jess_encode(v)
% JESS_ENCODE, v: jess.Value
% The inverse function of j.eval(str).
mv = matlab_value(v);
switch v.type()
% this pain is derived from these documents:
% http://www.jessrules.com/docs/71/api/jess/Value.html , and
% http://www.jessrules.com/docs/71/api... |
function [hout,t]=h_max_en(h,N)
% H_MAX_EN A rectangular window of length N is shifted over
% the impulse response h and the energy inside the
% window is computed as a function of the start
% position of the window. The point t where the energy
% the first time becomes a maximu... |
clear all; % clears plot
close all; % closes plot
x = [0:1]; % establish range for x
plot(x, hubbard(x, 0.25)); % plot the hubbard function w/ respect to x
hold on; % tells MatLab not to delete the above plot
plot(x, hubbard(x, 0.75)); % plot the hubbar... |
% this is the driver for the prep-processing for chi-processing
%
% created by:
% Johannes Becherer
% Tue Sep 20 10:51:19 PDT 2016
clear all;
close all;
%_____________________set processing flags______________________
do_parallel = 0; % use paralelle computing
do_vel_m = 0; % ... |
%Katarzyna Pencak
function [rhs] = przyklad3(t,x,eps,i)
eps=0;
if(i==0)
rhs = [x(2); -2*x(1)-3*x(1)^2-x(2)];
elseif (i==1)
rhs = [0,1; -2,-1]*x;
else
rhs = [0,1; 2,-1]*(x-[-2/3; 0]);
end;
return;
|
% basic implementation of the Age Master Equation using a Euler Forward scheme
% details on the model variables at the bottom of the file
function SAS_EF_basic(Pars,data)
%--------------------------------------------------------------------------
% prepare the run
%---------------------------------------------------... |
function [index_vals,dist_vals,vector_vals] = kd_nclosestpoints(tree,point,n,first_iter_flag)
% the code gives you a really fast, approximate value of the closest point
% tree is the kd tree
% point is the query point for which we would want to find the nearest
% point in the kd tree
% first_iter_flag - plea... |
%-------------------------------------------------------------------------%
% teval - Jeremy Turner
%
% This function runs the symbolic deriver methods to analyze their
% performance. Given a number of runs to average over (m) and the numbers
% of links to use (n), teval.m will run the specified method for n links m
%... |
function [stimfilename, trials] = makeMix(m1,m2)
% function [stimfilename, trials] = makeMix(m1,m2)
% DO NOT USE !!! Use makeStim instead to get paired Mixed trials
% makeMix combine make Same and Diff trials for two ratios: m1/m2 and m2/m1
% m1, m2 (pos real): means 1 and 2 for the sets.
% stimfilename (string): .m... |
function IndexInt = indicesInteriores(p,t,problem)
[circleBoundary,~] = essentialBoundaryOnCircleFilter(p,t,problem);
[m,~] = size(p);
IndexInt = zeros(m,1);
tmpi = 0;
for i = 1:m
if ~any(circleBoundary == i)
tmpi=tmpi+1;
... |
% nptel -matlab
% module 1 ; Solved problems
% The vertical location from ground when a ball is thrown upwards is given by:
% , - = . / - − 0.5 4- ) . Find the ball location at every 0.1 seconds interval until ball
% reaches ground again. Initial velocity is 20 m/s and 4 = 9.8 m/s )
tmax = (2*20)/9.8;
t = 0:0.1:tmax;
y... |
clear
close all
% decide of the cycle
% maybe we'll cut Huntington in two parts because of the different cycles
% for now, let's fix it at: (66+84+88+88+112+112+156+136)/8 = 842/8 = 105.25
% THIS IS AN ARBITRARY CHOICE, we could have decided of weights
cycle = 105;
windowtype = 'pretimed';
% see about delta, it depe... |
function ss = inprod_n(fdstr1, fdstr2, Lfd1, Lfd2, wtfd, JMAX, EPS)
% INPROD Computes matrix of inner products of functions
% by numerical integration
% using Romberg integration with the trapezoidal rule.
% Arguments:
% FD1STR and FDSTR2 ... these may be either functional data or basis function
% ... |
clc, clear all, close all;
%%
% *Arrays*
%%
% _definicion_
a = [1 2 3 4 5] % arreglo
m = [1 2 3; 4 5 6; 7 8 9; 10 11 12] % matriz
m(1,2) % acceder a elementos 1ra fila 2da columna
a(2),m(2); %elementos especificos
a(2:4) % elementos del 2 al 4 del arreglo
m(2:4,2) % tomar filas 2-3-4 de la columna 2
b = l... |
% Goal: Adequately Segment OCT Images
% Author: Yoan Yomba
% clear workspace
clc; clear all; close all;
% add all path
addpath(genpath('.'));
addpath(genpath('D:\Yoan\Git\leverUtilities'));
addpath(genpath(('D:\Yoan\Git\leverjs')));
% compile c files to be used in anisotropic diffusion
compile_c_files
%% declare var... |
function LBCN_databrowser_FASST(fname,indchan)
% Function to display ECoG data using the FASST (http://www.montefiore.
%ulg.ac.be/~phillips/FASST.html) toolbox. It will display all channels and
%all time points.
% Inputs:
% - fname: name of file to display, in SPM format
% - indchan: indexes of specific channels to dis... |
function exp = setSettings()
%SETSETTINGS sets the default settings for the experiment.
% it uses a structure called EXP. It contains the 'levels' COLOR for colors,
% FONT for font settings (e.g. font sizes, line-height), SCREEN contains
% settings for the screen (e.g. left screen offset), KEY contains all
% settings f... |
% link path
function finalpath = linkpath(rrtree)
finalpath = zeros(length(rrtree),2);
finalpath(1,:) = rrtree(end,1:2);
node_num = rrtree(end,3);
for i =2:length(rrtree)
if (node_num > 0)
finalpath(i,:) = rrtree(node_num,1:2);
node_num = rrtree(node_num,3);
else
finalpat... |
clear all
% Open Time video
[FileName,PathName] = uigetfile('*.mat','Select the time for the video');
load(strcat(PathName,FileName))
% Open Time camera
[FileName,PathName] = uigetfile('*.mat','Select the time for the fluo');
load(strcat(PathName,FileName))
% Open Data
[FileName,PathName] = uigetfile('*.nii','Select... |
% avazu dataset
label = 'avazu';
grid = 1;
load('../data/avazu_C_result_6_2G.mat');
PlotLarge(subOptNR, '-', 'SIG', label, grid);
PlotLarge(subOpt, ':', 'SVRG', label, grid);
PlotLarge(subOptKatyusha, ':', 'SVRG-K', label, grid);
PlotLarge(subOptK, '-', 'SIG-K', label, grid);
PlotLarge(subOptIAG, ':', 'IAG', label, gri... |
a = 0:0.5:10
plot(a, sin(a)); |
occur = zeros(1,6); % Initialise 6-vector of outcome counters
for m = 1:Mrep
x = randint(6); % Simulate die roll
occur(x) = occur(x) + 1; % Increment counter corresponding to outcome
end
relfreq = occur/Mrep; % Scale the occurrence counters to find
... |
function o = boxoverlap(b1, b2)
% Compute the symmetric intersection over union overlap between a set of
% bounding boxes in a and a single bounding box in b.
%
% a a matrix where each row specifies a bounding box
% b a matrix where each row specifies a bounding box
% a(1) = b1(1);a(2) = b1(2);a(3) = b1(1)+b1(3);a(4... |
tic
screensize = get(0,'Screensize'); figwidth = 800;
% figxpos = screensize(3)-100-figwidth; %one screen
figxpos = 100;%screensize(3)+100; % two screens
% legend plot
h2 = figure('Name','Legend','Position',[figxpos+180 0 figwidth 800]);
hold on
legendlist = {}; ii = 1;
plotPoint(pCOM(:,ii),'r.'); legendlist =... |
function [X, y] = preprocess(path_to_dataset, histogram, count_bins)
% path_to_dataset = calea catre folderul care contine datele
% histogram = tipul de histograma
% count_bins = numarul de valori pentru axa orizontala a histogramei
% X = matricea de caracteristici
% y = vectorul coloana de etichete
% Se stabilesc cai... |
function final_data = SROA_conversion(V)
cold_tip = -179.2*V(1)^2 - 234.18*V(1) + 517.03;
SC_diodes = -190.*V(2:4).^2 - 263.36.*V(2:4) + 574.87;
pressure = 10^(2*V(5)-11);
% thermocouple coefficients found: http://www.omega.com/techref/pdf/z198-201.pdf
% c= [0,17.057,-2.330175e-4,6.543558e-9,-7.356274e-14];
E1 = V(6)... |
clear all
load('Seed156.mat')
rng(s)
FMs_test = [2, 4, 8, 16, 32, 64, 128, 200, 240, 300];
ntrials = 10;
FMs_gen = repmat(FMs_test,1,ntrials);
stim_dur = 1; %duration of each noise, 3 will be played per trial
fs =48828.125;
BPfilt = designfilt('bandpassiir', 'StopbandFrequency1', 190, 'PassbandFrequency1', 200, 'Passba... |
clc;
clear;
Start_time = 0;
Stop_time = 20;
Sample_time = 0.1;
default_data_shape = [1,1];
specified_data_shape = containers.Map();
default_data_type = 'double';
specified_data_type = containers.Map();
default_data_range = [-10,10];
specified_data_range = containers.Map();
test_time = 7200;
model = 'Control_Logic_... |
classdef QuadRotor < handle
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties(GetAccess= 'private', SetAccess= 'private')
%state vars
cur_state;
start_state;
desired_state;
%recorded vars
x;
y;
... |
%-------------------------------------------------------------------------------
% outcome_hypoxia_hyperoxia: simple analysis on large NIRS dataset (120+ babies)
%
% Syntax: [sum_st]=simple_analysis_3dataset(all_info)
%
% Inputs:
% all_info - NIRS data structure with the following fields:
%
% ... |
f=4;
t=0:0.002:1.5
s=square(2*pi*f*t)
s(find(t>=0 & t<0.25))=-5;
s(find(t>=0.25 & t<0.5))=-3;
s(find(t>=0.5 & t<0.75))=-1;
s(find(t>=0.75 & t<1))=1;
s(find(t>=1 & t<1.25))=3;
s(find(t>=1.25 & t<=1.5))=5;
figure(1)
plot(t,s),grid
xlabel('Timp [s]'),ylabel('Amplitudine'),grid
f=4;
t=0:0.02:1.5
s=square(2*pi*f*t)
s(fin... |
function c = correlate_plot(x_val, xuid, y_val, yuid)
sort_q = questdlg('Would you like your x_parameter sorted?');
x_param = getappdata(0, 'x_param');
y_param = getappdata(0, 'y_param');
dataset_str = getappdata(0, 'dataset_str');
switch sort_q
case 'Yes'
... |
%% ·½Î»ÏòIFFT
FidReadReal = fopen( 'RanCurveCorrTurnReal.dat' , 'r' ) ;
FidReadImag = fopen( 'RanCurveCorrTurnImag.dat' , 'r' ) ;
FidWriteReal = fopen( 'AziIFftReal.dat' , 'w' ) ;
FidWriteImag = fopen( 'AziIFftImag.dat' , 'w' ) ;
for m = 1 : NrNew
Data = fread( FidReadReal , Na , 'float32' ) + 1j * ... |
function [best_attribute, best_threshold] = ChooseAttributeClassification(features)
% implements Gini impurity from CART algorithm
attributes = zeros(2,size(features,2));
for i = 1:size(features,2)
[attributes(1,i), attributes(2,i)] = getThreshold(features(:,i), label);
end
best_attribute = find(attributes(1,:)==mi... |
%% Ben Larson Lab 2
clear; clc; close all;
%% Create Shapes
stack = meshgrid(1:64,1:64,1:32);
stack = stack.*0;
cylinder_1_center = [15,32,5];
c1 = cylinder(stack,cylinder_1_center,3.5,24,'z',100);
cylinder_2_center = [25,50,16];
c2 = cylinder(stack,cylinder_2_center,3.5,24,'x',100);
cylinder_3_center = [30,32,5... |
function y=mintfun(x,n)
y=normpdf(x,600,196.6292)./(2*x+n);
|
% XXXXXXXXXXXXXXXXXXXXXXXXXXXXX MAR_MERGE_MF XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
% Author : Mario Hartanto
% Date : Jan 27 2014
% Function : merges membership functions with small centroid difference
% Syntax : mar_merge_mf(net, option, index)
%
% net - FIS network structure
% option - 'input... |
function [ calibration ] = dataCalibrator_staticAccAttitude(calibratorInfo)
%Reed Gurchiek, 2018
% takes accelerometer data from static trial and returns the gravity
% offset and constant dcm to rotate acc data to segment. Third axis is
% aligned with segment long axis which is assumed vertical during trial.
% ... |
function [MC] = graph_construct_func(len_graph, high_graph)
count_of_nodes = len_graph * high_graph;
A = zeros(len_graph, high_graph);
% Making Manhatan graph from diagonal matrix
%diagonal matrix
for i = 1:1:count_of_nodes
for j = 1:1:count_of_nodes
if i == j
A(i,j) = 1;
... |
net_path = '../../face-rec-matconvnet/trained-model/vgg_face_matconvnet/data/vgg_face.mat'; % update me
%% digital dodging example
digital_dodging(net_path, './data/', 's478', 478);
%% physical dodging example
physical_dodging(net_path, './data/', 's478', 478);
%% digital impersonation example
target = 152; % Antoni... |
function [ WPsResults , Name] = RecognizeCityName(xmlFile, LoadDataStructure, OutputFolder )
%RecognizeCityName Summary of this function goes here
% RecognizeCityName( 'C:\Users\kour\Second Degree\Hand Writing recognition\Arabic ICR\Data\TestSet\1233527883322.xml' , true, 'C:\OCRData\StrokeOutput\')
global Lette... |
%% White Balance Demo
% OpenCV color balance demonstration sample.
%
% <https://github.com/opencv/opencv_contrib/blob/3.2.0/modules/xphoto/samples/color_balance.cpp>
%
%% Load input image
src = cv.imread(fullfile(mexopencv.root(),'test','test1.png'), 'Color',true);
%% Options
alg = 'grayworld'; % color balance algor... |
function v = partXY_matlab(Xt,Y,I,J,L)
% Input:
% Xt --- k x m matrix
% Y --- k x n matrix
% I --- row indices
% J --- column indices
% L --- length of v
% Output:
% v --- XY(I,J);
v = zeros(L,1);
for p = 1:L
i = I(p);
j = J(p);
v(p) = Xt(:,i)'*Y... |
function [ mol ] = rotate( mol, MAX_ROTATE)
theta = (0.5-rand) .* MAX_ROTATE;
nsize = size(mol);
nMol = nsize(1);
nSites = nsize(2);
%pick random molecule
i_pick_mol = randi(nMol,1);
%translate so that oxygen is at the origin
% save oxygen coords
cp_x = mol(i_pick_mol,1,1);
cp_y = mol(i_pick_mol,1,2);
... |
%将多帧显示在同一图片上
function skelModifyA(handle, channels, skel, padding,isFinal)
% SKELMODIFY Helper code for visualisation of skel data.
%
% skelModify(handle, channels, skel, padding)
%
% Copyright (c) 2006 Neil D. Lawrence
% skelModify.m version 1.1
if nargin<4
padding = 0;
end
channels = [channels zeros(1, padding)... |
%% Declaration of Authoriship
% This code was written by Dirk DeVilliers and some portions were edited by Jason K. George
% for the purpose of his final year project at Stellenbosch University
% in partial completion for the subject Project (E) 448
%% Code
% close all
function yi = ddv_phase(angle_in, n, Nscan, shift_... |
IMNGF=zeros(512);
IMNGFTR = zeros(512);
[im,map]=imread('imtest01.png');
size(im)
size(map)
%imNG=0.3*im(:,:,1)+0.59*im(:,:,2)+0.11*im(:,:,3);
%size(imNG)
mapNG=([0:255]'/255)*[1 1 1];
%imNG=imNG(1:512,100:611);
colormap(mapNG)
IMNG=fft2(im);
IMNG2=fftshift(IMNG);
%size(IMNG2)
%surf(1:256,1:2... |
% This file is a modification of the file bicgstab.m, downloaded from
% http://it.mathworks.com/matlabcentral/fileexchange/2158-templates-for-the-solution-of-linear-systems
%
% Amos Egel (KIT) made the following changes to the original file:
% - convergence monitor output to console
% - input matrices A and M are func... |
%{
reso.TraceGlia (imported) # calcium trace
-> reso.SegmentGlia
trace_id : smallint # mask number in segmentation
-----
ca_trace : longblob # raw calcium trace
%}
classdef TraceGlia < dj.Relvar
methods
function makeTuples(self, key)
reader = getReader(reso.Alig... |
function [y] = switch_r(Vin,W,L,flavor)
% switch_r
%
% - vin:
% - W: voltage between transistor drain and transistor source (V).
% - L: transistor length (um).
% - flavor: 'n' -> nmos , 'p' -> pmos
%
% Example
% R = switch_r();
%
% See also
global s_dat
if flavor == 'n'
y = inte... |
% linelist: list of all detected and derived lines
% labels: Link labels (mx1)([0,1])
% clique: Clique Set
%
function E = CalculateEnergyLL(linelist, labels, clique, mrf)
Vtot = mrf.params.eratio * SegmentPotentialsLL(linelist, labels, mrf); % V(d_i|l_i)
Vc = CliquePotentialsLL(linelist,... |
%%%% Process CSV files with EMG, etc. and output from Simons processing
%%%According to Bruker, collection begins with first galvo rotation and
%%%does not skip any, such that only galvo rotations on the end of the time
%%%series should be ignored. Verify with Pockels blanking signal in the
%%%future
close all
cl... |
% Question 4
clc;
clear;
close;
x = 5;
tol = 0;
L = 100;
h = 97;
for i=1:1000
func1 = (L- 2*x*sinh(h/(2*x)));
func2 = ((h*cosh(h/(2*x)))/x - 2*sinh(h/(2*x)));
div = func1/func2;
XP = newton(x,div);
err = abs((L- 2*XP*sinh(h/(2*XP))) - (L- 2*x*sinh(h/(2*x))));
x = XP;
if(err < tol)
... |
% Copyright (c) 2017 The Johns Hopkins University/Applie?d Physics Laboratory
% This software was developed at The Johns Hopkins University/Applied Physics
% Laboratory (“JHU/APL”) that is the author thereof under the “work made for hire”
% provisions of the copyright law. Permission is hereby granted, free of cha... |
function [] = GPABC_uncertainty_demo()
% Demonstrates using simulation in a simple 1d scenario how the uncertainty in the
% likelihood compare to the normalised likelihood i.e. posterior when the discrepancy is
% modelled with GP as in the paper "Efficient acquisition rules for model-based
% approximate Bayesian com... |
%function RUN_Step6_PlottingResults(filename, options)
for i3= 1:length(filename.folders.fols) %Looping through each slide
fold = filename.folders.fols{i3};
coordmat = [filename.folders.main filename.folders.output filename.folders.coordinates fold '.mat'];
load(coordmat, 'Coordinates')
[r, c] =... |
function [mu_Ch_K,p_Ch_K,p_K]=image_segmentation(Ch_img,varargin)
%This function is distributed under the terms of the GNU General Public License 2.0 or
%any later version. See http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
%for the text of the license.
%% reading imagery data
if(ischar(Ch_im... |
%-----------------------------------------------------------------------
% Job saved on 04-Aug-2014 15:15:19 by cfg_util (rev $Rev: 5797 $)
% spm SPM - SPM12b (5889)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
matlabbatch{1}.spm.util.defs.comp{1}.comp{1}.def ... |
function obj = compute( obj, fieldname, key )
fprintf( 'Computing %s/%s...\n', class( obj ), fieldname );
switch fieldname
case 'job'
obj = update( obj, 'job', 0 );
temp = take( CircTraces(key), 'skewness' );
obj = update( obj, 'job', 1 );
case {'nframes','fps','total_size','first_val... |
function y=f4(x,a)
% y=f4(x,a)
%
% input:
% a: base
% x: x-point
%
% implements the function to ingegrate to calculate phi
y=exp(-x).*(1.+x).*f3(a,x).*x.^-2;
|
clc
clear States gState PIP G;
%% Make the matrix of basic gates
Gate(1).gate=[1 0 0 0;0 1 1 1];
Gate(1).Name = 'AND';
Gate(2).gate=[0 1 1 1;1 0 0 0];
Gate(2).Name = 'NAND';
Gate(3).gate=[1 1 1 0;0 0 0 1];
Gate(3).Name = 'OR';
Gate(4).gate=[0 0 0 1;1 1 1 0];
Gate(4).Name = 'NOR';
Gate(5).gate=[1 0 1 1;0 1 0 0];
Gat... |
function [LN] = LineMaps(Maps)
% [~,file,~] = fileparts(NAme);
% DirxEBSD = [NAme '\' file '.mat']; load(DirxEBSD,'Maps');
% DirDef = [NAme '\' date '_Lines']; mkdir(DirDef);
close all;
imagesc(Maps.X(1,:),Maps.Y(:,1),Maps.S12)
set(gca,'YDir','normal'); axis equal; axis tight
po... |
% build a random grid graph
d = 2; % 2D planar graph
nrNodes = 100; % graph has n = 100 vertices
probLC = 0.8; % probability of loop closures in the grid graph
rotStd = 0.01; % noise standard deviation for rotation
tranStd = 0.01; % noise standard deviation for translation
graph = grid_random_graph_2D(nrNodes, ...
'Ro... |
function [mapped]= TargetMapper(data)
datasize= size(data,1);
classes= unique(data);
numclasses= length(classes);
mapped= zeros(datasize, numclasses);
for i=1:numclasses
index= find(data== classes(i));
mapped(index,i)= 1;
end
end |
%% Clear all data and command window
clear all
close all
clc
%% Load Data
data = load('ex1data2.txt');
X = data(:, 1:2);
y = data(:, 3);
m = length(y);
% Print out some data points
% First 10 examples from the dataset
fprintf(' x = [%.0f %.0f], y = %.0f \n', [X(1:10,:) y(1:10,:)]');
%% Feature Norma... |
clear all, close all
%% petit script pour vérifier que reflect rend bien -1 quand on lui passe un dirac
%medium
rho0=1.225; % Densite air
c=340; % Vitesse son
a=2e-2; % Rayon tube
S=pi*a^2; % Section tube
l=50e-2; % Longueur tube
Zc=rho0*c/S;
fe=10e3;
te=1/fe;
wc=0.27;
b=fir1(3, wc, ... |
%% 3.2 研究不同的超参数对性能的影响
% 首先研究不同的种群规模对结果以及鲁棒性的影响
clear all
clc
time_start = datetime;
array_population_size = 4:4:30;
[~,number_population_size] = size(array_population_size);
matrix_power_best = zeros(number_population_size,8);
matrix_time_elapsed = zeros(number_population_size,8);
matrix_max_g... |
function y = discretize(x, nbins, partition)
% DISCRETIZE - Re-expresses signal amplitude in terms of its membership with discrete partitions.
%
% SYNTAX:
% y = discretize(x)
% y = discretize(x, nbins)
% y = discretize(x, nbins, dist)
%
% OUTPUT:
% y: [ DOUBLES ]
% A one-dime... |
%% Import Script for EBSD Data
%
% This script was automatically created by the import wizard. You should
% run the whoole script or parts of it in order to import your data. There
% is no problem in making any changes to this script.
%% Specify Crystal and Specimen Symmetries
%close all
% clear
% clc
... |
% Description:
% This script generates transparent PNG image, by adding the masks on the
% images (both obtained from scan) as a trasnparency layer. Please note
% that the output images are PNG format, and thus you may need a SFM
% software that can handle PNG images.
% Before running, please change the variables "ful... |
% Matthew Conrad
% Test Script for Homework 2
%% Tests for GetNeighborhood
clear all; clc;
% Create test inputs
image = [1,2,3,4,5;...
5,2,4,3,1;...
1,5,3,4,5;...
5,3,3,3,1;...
1,2,3,1,5];
pixel_location = [3,3];
adjacency = '8';
V = [3,4,5];
[neighborhood, neighbor... |
function [ k ] = rbfker( x1, x2, sigma )
%RBFKER Calculates exp^(-sigma^2*abs(x_i-x-j))
% Detailed explanation goes here
if ~(length(x1)==length(x2))
disp('The lengths of two vectors do not match.');
k=-1;
return;
end
k = exp(-1/sigma^2*norm(x1-x2));
end
|
function pagesetup(handle)
% function pagesetup(handle)
% setup pager size as figure size
sz = get(handle, 'Position'); sz = sz(3:4);
set(handle,'Paperposition', [0 0 sz], 'PaperUnits', 'points', 'PaperSize', sz);
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [slope] = determineSlope(z, medianZ, maxZ)
zdiff = z - medianZ;
% if sign(zdiff) == -1 %dont change values that are nearer than median
% slope = 1;
% elseif sign(zdiff) == 1
% zdiff_norm = zdiff./(maxZ-m... |
clc;
clear;
format long;
digits(30);
A = eye(5);
for i = 1:5
for j=1:5
A(i,j)=sin(i)*cos(j);
end
end
[V,d]=eig(A);
V
d |
function [ h ] = LPFtrunc( N )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
n = 0:N-1;
h = (2/pi)*sinc((2/pi)*(n - ((N-1)/2)));
end
|
function idx_hat = func_alg_active_learning_OS(control_plot,delta_inv,S,tau,alpha,alpha_hat,w_D,noise_mat,P,h,OS_rate,A_BS_OS)
if control_plot ==1
figure;
end
delta = 1/delta_inv;
PI = delta*ones(delta_inv,1);
posteriors = func_compute_posteriors(PI,S,control_plot);
PI_OS = (1/(OS_rate*delta_inv))*ones(... |
function dmcerr = dmc_eval(params)
global s
u_pp = 1.1;
y_pp = 2.5;
N = floor(params(1));
Nu = floor(params(2));
du_max = 0.1;
u_max = 1.6;
u_min = 0.6;
lambda = 1;
dmcerr = 0;
D = 200;
M = zeros(N,Nu);
for i = 1:size(M,1)
for j = 1:size(M,2)
... |
clc
clear
%% Analysis 1-Reciever Diamter
clc
clear
Pt=75;
Dt=0.2; %D transmitted (m)
lambda=1550*10^-9; %m
Dr=0.5:0.5:15; %D recieved
L=0.4*1.496*10^11; %range meters
gamma=0.35; %obscuration ratio
No=0.3; %tranmitter optics efficiency
Np=0.3;%transmitter pointing efficiency
la=0.79 ;%Atmosperic losse... |
%% Quantum dots (gaussian)
function re=hqd(a,mu,delta,vz,alpha_R,mumax,l0,dim)
t=25/a^2;
sx=[0,1;1,0];
sy=[0,-1i;1i,0];
sz=[1,0;0,-1];
alpha=alpha_R/(2*a);
band11sm=(spdiags([ones(dim,1) ones(dim,1)],[-1,1],dim,dim));
band1m1sm=(spdiags([ones(dim,1) -ones(dim,1)],[-1,1],dim,dim));
eyesm=speye(dim);
% mulist=mu*ones(dim... |
function alldata = mergeActivityIntoAlldata(alldata, activity, framesPerTrial, ...
trialNumbers, frame1RelToStartOff, badFrames)
% alldata = mergeActivityIntoAlldata(alldata, activity, framesPerTrial, ...
% trialNumbers, frame1RelToStartOff [, badFrames])
%
% INPUTS
% activity should be the nFrames x nUnits a... |
%
% D_MERCATOR2ROMS: Driver script to create a ROMS initial conditions
%
% This a user modifiable script that can be used to prepare ROMS
% initial conditions NetCDF file from Mercator dataset. It sets-up
% all the necessary parameters and variables. USERS can use this
% as a prototype for their application.
%
%... |
function PlotMovingEdgeResponses(modelName)
%% This function plot responses of motion detector models to moving
%% light and darke edges we use to classify T4/T5 * a/b in our experiments
models = {'T4original','T4modified','T5','Barlow-Levick','MotionEnergy'};
if nargin < 1
modelIndex = listdlg('PromptString','Se... |
clear all, close all
it=2;
yy = [1 2 4 8 16];
xx = [11 5 3 1.5 0.75];
i=yy(it);
nx=270*i;
dx=xx(it);
ny=nx*3;
pin=['/nobackupp2/mpschodl/llc/prep/llc_' num2str(nx) '/bathy/'];
pin1=['/nobackupp2/mpschodl/llc/prep/llc_' num2str(nx) '/init/'];
%%% get latitudes
lat01=readbin([pin1 'LLC' num2str(nx) '_LA... |
clear
groundStructure = GeoGroundStructure3D;
x=50; y=50; z=200;
spacing = 25;
solverOptions = OptOptions();
solverOptions.nodalSpacing = spacing * 1.75;
groundStructure.createCustomizedNodeGrid([0,0,0], [x, y, z], [spacing, spacing, spacing]);
loadcase1 = PhyLoadCase();
load1NodeIndex1 = groundStructure.findNodeIndex... |
function [x,y]=LoadData(filename)
load(filename);
x=data(1,:);
y=data(2:end,:);
|
function [xcovlaps,lags] = mpfc_thetasweeps_xcov(thisdir,binsize,wind,cutoff)
load(thisdir,'times_armon_thetaof_headingarm_lap_thetahalf_all','spikedata','other_cells','laps_singlepass','armpos','pos'); %'headingarm','armpos');
Th = times_armon_thetaof_headingarm_lap_thetahalf_all;
clear times_armon_thetaof_headinga... |
clear all
close all
clc
%% Load Image Files
path_non_CVD = 'C:\Users\Haoti\.spyder-py3\CS760_Final_Project\non-COVID-new-1';
path_CVD = 'C:\Users\Haoti\.spyder-py3\CS760_Final_Project\COVID-new-1';
a = dir([path_non_CVD '/*.png']);
out = size(a,1);
non_CVD = zeros(out, 200, 200);
b = dir([path_CVD ... |
function [ip, ipw] = generate_int_point_weight(atom_xyz, atom_num)
% Get numerical integral points and their weights for XC integral
% Ref: [JCP 88, 2547], doi: 10.1063/1.454033, and http://sobereva.com/69
% Input parameter:
% atom_xyz : Atom coordinates
% atom_num : Atom number (H:1, He:2, Li:3, ...)
% Output para... |
%%%%%%geiselhw3_2bupwind
%%%%%%by Dean Geisel
%%%%%%for Dr. Mohamed Sulman
%%%%%%in MTH 7170
%--------------------------------------------------------------------------
%%%%%%This script is written to approximate the advection equation given in
%%%%%%problem 2 of homework 3 by using the upwind method.
%%%%%%It ... |
function [u, ix, iy, iz] = crop2mask(x, mask)
%CROP2MASK [u, ix, iy, iz] = crop2mask(x, [mask])
% See also UNCROP2MASK, CROPINDICES
narginchk(1, 2);
if nargin < 2, mask = x; end
[ix, iy, iz] = cropIndices(mask);
u = x(ix,iy,iz);
end
|
function [F] = getWheelForce(RPM, CVT, GB, r)
% TODO
F = getWheelTorque(RPM, CVT, GB) / r;
end |
t = [0:0.01:0.98];
y1 = sin(2*pi*4*t);
plot(t,y1,'g')
hold on;
y2 = cos(2*pi*4*t);
plot(t,y2,'b')
xlabel('time')
ylabel('value')
legend('sin','cos')
title('plot')
close;
subplot(1,2,1)
plot(t,y1);
subplot(1,2,2)
plot(t,y2)
clf;
A = magic(5)
imagesc(A), colorbar, colormap gray;
A(1,2)
imagesc(magic(15)), colorb... |
function map = AffineMap(varargin)
if(nargin == 1)
% this not very safe (matlab vector is a matrix and vectors can be vertical or horizontal)
if isvector(varargin{1})
map = ConditionalMap(varargin{1},"b");
else
map = ConditionalMap(varargin{1},"A");
end
el... |
%#codegen
function microphone_baseline()
coder.ceval('MicrophoneSetBaseline');
end
|
classdef Unfolding
% Unfolding class
%
% Represents a 2D unfolding of a 3D surface as a graph of cut edges and
% fold lines. Includes functions for composition of unfoldings and
% animations of the folded state.
%
% written by: Cynthia Sung
% last modified: 01/14/2014
%
% TO... |
% Calculations of mean, Variance by using direct function and by without functions.
% Checking the Row profile and column profile.
% Calculating Histogram by direct function and without function.
clc
clear all
close all
a=imread('cameraman.tif')
imshow(a)
a1=double(a)
% Mean by using function
s=mean(m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.