text stringlengths 8 6.12M |
|---|
function printoutTheNeighbors(theArray, matrix)
l= length(theArray);
for i = 1:l
node = theArray(i);
nodeNeighbors =node_Neighbors(node, matrix);
disp(node);
disp(nodeNeighbors);
end
end |
close all
%Put all song names into a cell array
songList = {
'\audio\track201-classical.wav', ...
'\audio\track204-classical.wav', ...
'\audio\track370-electronic.wav', ...
'\audio\track396-electronic.wav', ...
'\audio\track437-jazz.wav', ...
'\au... |
% Utilities for manipulating Polynomials
%
% euclid.m
% sylwest.m
% poldiof.m
% poldioph.m
% poldiopk.m
%
% polclr.m
% polcut.m
% pold2g.m
% poldc.m
% poldel.m
% polder.m
% poldiv.m
% polexp.m
% polgcd.m
% polgen.m
% polhank.m
% polmon.m
% polmul.m
% polord.m
% polq2d.m
% polq2g.m
% polreduc.m
... |
%% finding all fits files
files = dir('*.fits'); %find all excel sheets in folder
numofvids = length(files); % # of files
names = split([files.name], '.fits');
% load first video for picking neuron, bg etc
I = fitsread(strcat(names{1}, '.fits')); % reading in video
szv = size(I);
%% pick an area to analyze
... |
function iacv=IrredAntiCore(cm,method)
% IRREDANTICORE computes from a cost matrix the corresponding extreme points of
% the irreducible anti-core of the associated m.c.s.t. game.
% Using Prim's or Kruskal’s algorithm.
%
% Usage: iacv=IrredAntiCore(cm,method)
%
% Define variables:
% output:
% iacv -- Extreme po... |
%% Prepare for exercise 1
cmsinfo=ReadCore('../../../BigFiles/sim-dep.cms');
lhg3=ReadCore(cmsinfo,'3LHG');
exp3=ReadCore(cmsinfo,'3EXP');
%% 10) Calculate the fraction to limit in state pt 9 if the limits are given by:
xpo=[00.0 16.0 38.0 59.0 70.0];
lhg=[417.6 417.6 367.7 265.0 171.4];
figure
plot(xpo,lhg)
lims=... |
% remove Remove object(s) from the group
%
% This method removes one or more BoundingCurve objects from the group.
% Objects for removal can be specified by numerical index:
% >> remove(group,index);
% or all at once.
% >> remove(group,'all');
%
% See also BoundingCurveGroup, add
%
%
% created December 15, 201... |
function [seizure_times] = Seizure_summary
addpath('./cosinor');
sz_r4 = get_sz_tod (4,'./R004FileInfo.mat');
sz_r9 = get_sz_tod (9,'./R009FileInfo.mat');
sz_r10 = get_sz_tod (10,'./R010FileInfo.mat');
sz_r1 = get_sz_tod (4,'./R001FileInfo.mat');
all_sz = [sz_r4;sz_r9;sz_r10;sz_r1];
... |
clf;
clc;
clear;
tspan=[0 500]; % set time interval
q0 = 1.4155;
M=0.9953;
p0 = (1.545/48.888)*M;
S = 1.814;
D = 90.5*0.4814E-3;
h=[2, 2.3684, 2.3685];
%[t,y,q,p]=crk4(@rk,tspan,q0,p0,1000);
%[t1,y1,q1,p1]=FE(@rk,tspan,q0,p0,1000,h(1));
[t2,y2,q2,p2]=symplectic(@rk,tspan,q0,p0,2000,2.2);
%[t3,y3,q3,p3]... |
function [ quaternion ] = euler2quat( yaw, pitch, roll )
%EULER2QUAT convert euler angles to a quaternion
% convert euler angles to a quaternion
cdz = cos(yaw/2);
sdz = sin(yaw/2);
cdy = cos(pitch/2);
sdy = sin(pitch/2);
cdx = cos(roll/2);
sdx = sin(roll/2);
q0l = cdz*cdy*cdx; q0r = sdz*sdy*sdx;
q1l = cdz*cdy*sdx; ... |
%
% Smooth point-set registration method using neighboring constraints
% -------------------------------------------------------------------
%
% Authors: Gerard Sanromà, René Alquézar and Francesc Serratosa
%
% Contact: gsanorma@gmail.com
% Date: 15/02/2012
%
% Computes the Euclidean distance between two n-dimensio... |
%function cyc=year2cyc(block,year)
%
% ex. c=year2cyc('f2','1996');
function cyc=year2cyc(block,year)
opfil=['/cm/' lower(block) '/fil/op-year.txt'];
script=['awk ''substr($2,5,2) == "' year(3:4) '" {print $3}'' ' opfil];
[status,cyc]=unix(script);
dcyc=[10 double(cyc)];
i=find(dcyc==10);
cyc=[];
for j=2:length(i)
st... |
function FilesRelocationPairsRep()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PART I: copy ENCODING files
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%variables and folder
DirName='C:\fMRI_Data\SEL2\ANALYSIS_SPM8\';% Root location of analysis folder
subs= {...
'200615TF'... |
function [TTest2Cov_T,TTest2Cov_P]=y_TTest2Cov(Variable1,Variable2,CovariateVariable1,CovariateVariable2)
% [TTest2Cov_T,TTest2Cov_P]=y_TTest2Cov(DependentVariable,CovariateVariable)
% Perform two sample t test with or without covariates.
% Input:
% Variable1 - The Variable 1. Test if Variable 1 is greater than V... |
%% Interpolate and Fill Missing Spatiotemporal Data
%Highway Traffic Dynamics: Data-Driven Analysis and Forecast
%Allan M. Avila & Dr. Igor Mezic 2019
%University of California Santa Barbara
function [Bins]=InterpolateandFill(Bins,Name,Size,Save)
if strcmp(Name,'101')
% Remove Rows Missing More Than 20% of Data
Bins{1... |
function [r, s, U, U_exact, E, cost] = prob2(Nr, r_min, r_max, Ns, t_final)
%% Establish the discrete domain
dr = (r_max - r_min)/(Nr-1);
ds = (pi/2)/(Ns-1);
r = r_min:dr:r_max;
r = r';
s = 0:ds:pi/2;
s = s';
nu = 1.;
dim = length(r)*length(s);
%% estimate time step
circ = pi*2.*r_min;
h = min( dr,circ/Ns );
dtGuess ... |
% t refers to the time at the earliest point we consider
function u = adams_bashford_4(y_0, dy, dt, m, fcnHandle)
u = y_0(:,2) + 1.5*dt*fcnHandle(y_0(:,2), dy, m) - 0.5*dt*fcnHandle(y_0(:,1), dy, m);
end |
function [value,isterminal,direction] = touchdown5_slope_red(t,qu,alpha,theta_minus,theta_plus,d)
x = fcn_qu_to_q(qu,alpha,theta_minus,theta_plus);
Psfoot=fcn_position_swingfoot(x(1:5));
value = Psfoot(2)-tand(d)*Psfoot(1);
isterminal = 1; % Stop the integration
direction = -1; % Negative direction only
end |
% setModel Define fit model
%
% This method defines the model associated with a 2D cloud fit. Models are
% defined by a target function handle and a parameter array.
% object=setModel(object,target,param);
%
% The target function must accept three inputs and return one output.
% output=target(param,xbound,ybou... |
classdef (Sealed) timing_tests
methods (Static)
function run
% hashtable timing tests: performance at different sizes of hashtable
% compared with linear search (using MATLAB find()), struct field lookup
% (an alternative dictionary approach), and Java hashtable callout.
... |
% 1. Calculate the mean and covariance of KLT transformed Lenna image (KLT basis images are trained from Lenna image)
im_lenna = im2double(imread('lenna_gray.jpg'));
% KLT basis images of Lenna image
klt_base_v = compute_klt_basis(im_lenna);
block_splitter = @block_splitter_image;
[im_projected_lenna, ~, ~] = proj... |
function EstStates = Construct_EstStates()
%CONSTRUC_ESTSTATES Summary of this function goes here
% Detailed explanation goes here
EstStates.isCalibrated = false;
EstStates.Voltage = 0;
EstStates.initialized = 0;
EstStates.q = zeros(20,1);
EstStates.dq = zeros(20,1);
EstStates.dq_AR = zeros(20,1);
EstStates.a_world =... |
% function to implement the Iterated Extended Kalman Filter (IEKF)
% Inputs:
% OBSn - the observations (with noise)
% xest - initial state space estimates
% Ouputs:
% Xp - predicted states
function Xp = f_IEKF(OBSn,xest)
load avar % r1,r2, L, and T
tol = .1; % tolerance for iterations
diff = 1;
count = 0;
F = [1 ... |
[~, secs, ~] = KbCheck;
t0 = secs;
while secs < t0 + tmax
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown && keyCode(DataStruct.Parameters.Keybinds.RightArrow)
break
end
end
|
function drawplane(w,x,y)
% DRAWPLANE Draws a plane when d = 3
% drawplane(w,x,y)
% /!\ Only works if w(3) is non zero
% Plotting data points
class1 = (y' == 1);
class2 = (y' == -1);
xclass1 = x(:,class1);
xclass2 = x(:,class2);
plot3(xclass1(1,:),xclass1(2,:),xclass1(3,:),'+','Color','b','MarkerSize',6); hold on;
pl... |
function B = linearize_bands(HIM)
[xx,yy,ll] = size(HIM);
num_pixels = xx * yy;
B = reshape(HIM,num_pixels,ll);
end
|
function plot_depth(depth, new_figure, surface, saveit, filename)
x = depth(:,:,1);
y = depth(:,:,2);
z = depth(:,:,3);
invalid_points = z<-1e1;
x(invalid_points) = [];
y(invalid_points) = [];
z(invalid_points) = [];
if nargin < 2
new_figure=false;
end
if nargin < 3
surface = true;
end
if nargin < 4
sa... |
% RIESZCONFIG class of objects characterizing 3D Riesz-wavelet transforms
%
% -------------------------------------------------------------------------
%
% AUTHOR:
% Nicolas Chenouard, nicolas.chenouard?epfl.ch
% Ecole Polytechnique Federale de Lausanne
%
% -------------------------------------------------------... |
function [Sheep] = CheckBindingMatrix(varargin)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
Names=evalin('base','whos(''Set_*'')'); % 'Set_*' to add a filter
Classes={Names.class}; I=strcmp(Classes,'PitsSample');
Names=Names(I); Names={Names.name};
if isempty(Names)
... |
% Antonio de Jesús Ortiz González
% Centro de Investigaciones en Óptica
% 06/10/16
clear; close all; clc;
iR = cell(4); rR = cell(4); iF = cell(4); rF = cell(4);
for i = 1 : 4
iR{i} = imcrop(im2double(imread(strcat('i', int2str(i), '.tif'))), [330 1100 1399 649]);
rR{i} = imcrop(im2double(imread(strcat('r', ... |
function x=newtons(f,x0,tol,p1,p2,p3,p4,p5)
% x=newtons(f,x0,tol)
% Löser ekvationssystemet f(x)=0 med Newton-Raphson's metod
% Upp till 5 extra parametrar kan anges:
% t.ex; x=newtons(f,x0,[],p1,p2,...)
if nargin<3 | isempty(tol),
tol=1e-8;
end
err=1;
x=x0(:);
x_old=x;
maxiter=40;
n=0;
while err>tol,
n=n+1;
i... |
function [k, L] = wave_number_NR(w, h)
g = 9.81;
k_1 = (w^2)/g; % use deep water wavenumber as first estimate
k = fzero(@(x) (w^2) - g*x*tanh(x*h), k_1); % Newton-Raphson
k = abs(k);
L = 2*pi/k; % wavelength
|
function [h,area,bkgd,sigma,xpeak,cfun] = fitPeak(x,y,plotOrNot)
% x 能谱横坐标,道址
% y 能谱纵坐标,每道计数
% area 峰面积,0代表未拟合上
% 拟合公式
% y=a+slope*x+area*1/sqrt(2*pi)/sigma*exp(-(x-peak)^2/2/sigma^2);
% 20201112 删除输出量amp
% 20210406 删除输出量intercept,slope,添加bkgd。原:[area,sigma,intercept,slope,xpeak,cfun] = fitPeak(x,y,plotOrNot)
% 2021081... |
options.curvature_smoothing = 10;
options.verb = 0;
[Umin,Umax,Cmin,Cmax,Cmean,Cgauss,Normal] = compute_curvature(vertex_u,faces_u,options);
hold on
clf;
options.face_vertex_color = perform_saturation(abs(Cmin)+abs(Cmax),1.2);
plot_mesh(vertex_u,faces_u, options); shading interp; colormap jet(256);
title('Total curvat... |
function M = readacsv(filename)
filename = [filename '.csv'];
delimiter = ',';
fileID = fopen(filename,'r');
M = dlmread(filename,delimiter)
fclose(fileID);
end |
function varargout = predictfloatpaths(data, trainSize, ...
degree, xver)
% function [longs, lats, dLongs, dLats, stats] =
% predictfloatpaths(data, trainSize, testSize, degree, xver)
%
% Description
%
% Given the data reported by a mermaid, produces its locations with
% time. ... |
function funSimple = hyperIden(f, k, h, z)
% coefficients substitution,
funSimple = subs(f, (sinh(k*h))^2, (cosh(2*k*h)-1)/2);
funSimple = subs(funSimple, (cosh(k*h))^2, (cosh(2*k*h)+1)/2);
% coeff for \sinh^n
funSimple = subs(funSimple, (sinh(k*h))^3, sinh(k*h)*((cosh(2*k*h)-1)/2));
funSimple = subs(funSimple,... |
% CSC C11 - Machine Learning, Fall 2017, Assignment 1,
% F. Estrada, festrada@utsc.utoronto.ca
%
% A 2D - Radial Basis Function
%
% [z]=rbf2d(p,c,sigma)
%
% p - is a 2-row matrix, each column gives the coordinates of one
% point where the rgb is to be evaluated, e.g.
%
% p=[x_1 x_2 ..... x_n
% ... |
%---------------------------------------------------
% ROULETTE-WHEEL SELECTION
% Cumulative Sum
%---------------------------------------------------
running_sum = 0;
c_sum = zeros(nparticles, 1);
% for ind = 1:nparticles
% running_sum = running_sum + weight(ind);
% c_sum(ind) = running_sum;
% end
c_sum = cumsum(w... |
classdef progBar < dynamicprops
% Command line text progress bar for indexed loops
% EXAMPLE
% Setup: pb = progBar(allIdx, updatePct);
% % allIdx == set of indices used in loop
% % updatePct == percentiles to trigger text updates (def=[10:10:90])
%
% Use: for i = allI... |
clear all;
close all;
clc
disp('*****************************************************************');
disp('** OPERASI ARITMATIKA **');
disp('*****************************************************************');
disp(' ');
%input file citra
G = input('Masukkan nama gambar dengan... |
for i = 1:5
[bins, probs] = p4b_dicretize(numericaldata(:,i),trainsurvival);
bar(bins,probs);
title(numericalfeatures(i,:));
xlabel('Bin number');
ylabel('Survival Probability');
saveas(gcf,strcat('fig_4b_',num2str(i)),'png');
end
|
function [rout,Vout] = makegrid(Vfunc,E,opt)
if nargin<3
opt = boundoptions;
elseif ~isa(opt,'boundoptions')
error('Options argument ''opt'' must be of type boundoptions');
end
%% Create grid
numSegments = ceil(opt.rmax/opt.blocksize);
rtmp = linspace(opt.rmin,numSegments*opt.blocksize,1e3);
adiabat = Vfunc(r... |
% SAMPLEFROMPOSTERIOR turn a fullPosterior into a posteriorSamples by sampling
% from it.
%
% posteriorSamples = SampleFromPosterior(fullPosterior, numSamples)
%
% This function takes the output of GridSearch and converts it into the
% equivalent of what you would have gotten from MCMC.
%
% Example:
% fullPosterior =... |
% Process - Obtain the Filtered, Quadrature, Fringe Shift, and Contrast
% signals from a VISAR object.
%
% This method analyzes the VISAR object to provide the Filtered, Quadrature,
% Fringe Shift, and Contrast signals. This involves filtering the
% signals and applying the vertical offsets and scalings. ... |
st = tmpst3;
ml = max(cellfun(@max,{st.frame}));
slopes = cell(1,ml);
frw = 10;
frr = frw/2;
for fr = frr:frw:ml-frr+1
for i = 1:length(st)
frind = find(st(i).frame==fr);
if isempty(frind), continue; end
slopes{fr} = [slopes{fr} st(i).sl(max(1,frind-frr):min(length(st(i).frame),frin... |
clc;
close all;
clear;
camera_ray = [0; 0; 1];
%% Hand model
new_model = false;
input_path = '_my_hand/final/';
semantics_path = '_my_hand/semantics/';
load([semantics_path, 'fitting/names_map.mat']);
load([semantics_path, 'fitting/blocks.mat'], 'blocks');
load([input_path, 'centers.mat'], 'centers');
load([input_pat... |
function icatb_run_mancovan(mancovanInfo, step)
%% Run Mancovan
%
% Inputs:
% 1. mancovanInfo - Mancovan information
%
if (~exist('mancovanInfo', 'var') || isempty(mancovanInfo))
mancovanInfo = icatb_selectEntry('title', 'Select Mancovan Parameter File', 'typeEntity', 'file', 'typeSelection', 'single', 'filter', '... |
classdef generalMDP < MDP
properties
features_per_a;
action_features;
rewardCorrect = 1;
rewardIncorrect = 0;
cost;
discount = 1;
nr_arms;
end
methods
function mdp=generalMDP(nr_arms,gamma)
mdp.nr_arms=nr_arms;
mdp.... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
%
%
% problem 2- Evaluate the Laplace Transform of y''(t) and then replace y(t) by sin(t)u(t)
sym 'y(t)' ;
syms t s
z=laplace( diff('y(t)',2),s)
z=subs(z,'y(t)',sin(t))
z=subs(z,'y(0)',0)
z=s... |
clc
clearvars
rng('shuffle')
addpath('./model/')
n = 10;
m = 10;
all_N = [2:10, 20:10:100];
N_test = 1000;
delta = 1;
radius = 1;
eta = 0;
run_count = 100;
epsilon = [1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1];
param(1:run_count) = struct('W',[],'H',[],'h',[],'C',zeros(1,m),'d',0, ...
'pnor... |
function plotGMMContour(mix,RANGES,STEPS,i,j)
if (nargin < 2 || isempty(RANGES))
RANGES = [-5,5,-5,5];
end
oRANGES = RANGES;
mRANGES = max(abs(round(RANGES)));
RANGES = [-mRANGES,mRANGES,-mRANGES,mRANGES];
if (nargin < 3 || isempty(STEPS))
STEPS = [.1 .1];
end
mixModel = mix;
mixModel.nin = 2;
... |
function [route,val_route]=viterbi3(tfr,c1,sigma0,efxia)
[row,col]=size(tfr);
tfr(1:3,:)=-1000*ones(3,col);
[row,col]=size(tfr);
sigma=sigma0;
temp=zeros(row,1);
% N1:每列取的搜索点数
% N2:每个最大点搜索邻近的点数
N1=20;N2=20*4;
% pre_route=inf*ones(row,col);
% val_pre_route=inf*ones(row,col);
%%%%%%%记算代价函数f(x)=trf(x)
for di_... |
function [Kt_e, Fint_e,epsilon_p_return,stress] = elementrout(u_e,element_r,E,neu,sigma_y,lambda,meu,epsilon_p,e)
%%%Z = 0
%%%N1 = 1/2*(1-Z)
%%%N2 = 1/2*(1+Z)
le = element_r(2) - element_r(1);
%disp(le);
%%% epsilon = B*u
%%% u = N*ui
%%% J = le/2
B = [-1/le, 1/le ; 1/(element_r(1) + element_r(2)) , 1/(eleme... |
function Qd = calculateQd(tau,alpha,h)
%calculates Qd for noise simulation algorithm from paper DISCRETE SIMULATION OF POWER LAW NOISE
%equation: Qd = h / (2*(2pi)^alpha * tau^(alpha-1))
Qd = h / (2*(2*pi)^alpha * tau^(alpha-1)); %calculate Qd |
function [U1, U2, U3, V, V3, W] = solveUCMFH_devraj6_proj_propagate(X1, X2, X3, lambdas, gamma, alpha, bits, U1, U2, U3, W, rho)
%% Using commong latent factors
%% random initialization
X1 = X1.'; X2 = X2.'; X3 = X3.';
[dim1, nsam] = size(X1);
[dim2, ~] = size(X2);
V = rand(bits, nsam);
V3 = rand(bits, nsam)... |
close all; clear all;
%
% bvp_2.m
% second order finite difference method for the bvp
% u''(x) = f(x), u'(ax)=sigma, u(bx)=beta
%modified to be: u''(x) = f(x), u(ax)=alpha, u'(bx)=beta,
% Using 3-pt differences on an arbitrary nonuniform grid.
% Should be 2nd order accurate if grid points vary smoothly, b... |
function NoiseModel = createNoiseModelFactory(ActionSize,NoiseOpts,varargin)
% CREATENOISEMODELFACTORY Create a noise object given action size, noise
% options and optionally sample time.
% Copyright 2019 The MathWorks, Inc.
switch class(NoiseOpts)
case 'rl.option.OrnsteinUhlenbeckActionNoise'
NoiseModel... |
clear ; close all; clc
NUM_DATA_POINTS = 200;
var1 = randi([-25 -10], NUM_DATA_POINTS/2, 1); % var1 values
var2 = randi([-15 -10], NUM_DATA_POINTS/2, 1); % var2 values
var3 = randi([0 5], NUM_DATA_POINTS/2, 1); % var3 values
X = [var1 var2 var3];
var1 = randi([-5 25], NUM_DATA_POINTS/2, 1); % var1 values
var2 = r... |
classdef umanager_invisible < Modules.Imaging
%UMANAGER_INVISIBLE Provides interface to micromanager with basic
%camera control.
%
% Subclasses should inherit this and define the Abstract properties. Anytime
% one of these properties changes, the subclass should call the init method.
% NOTE: the... |
clc;
clear;
close all;
warning off;
addpath 'func\'
%cloud computing parameters
cloudcal_parameter;
Ant = M*N;
Rou = 0.7;
P0 = 0.3;
for i=1:Num
for j=1:Ant
x(i,j)=randn; %intial position
end
end
for i=1:Num
[p(i),p1(i),p2(i),p3(i)] = fitness(x(i,:));
Tau(i) ... |
function varargout = write_cmsplot_readme(ver)
% Programmers note: if you change this readme file, please change the date
% in variable versionread so it is updated.
versionread = 'Readme_cmsplot_save Version 2012-02-17';
if nargin == 1
varargout{1} = versionread;
return
end
fid = fopen('Readme_cmsplot_save.... |
%% HomeWork #2_2_2.59(a)
% y[n]-3y[n-1]=2x[n], y[-1]=3, x[n]=(-1/2)^n*u[n]
clear all
input = 10; % 입력의 개수(임의지정가능)
b = [2 0];
a = [1 -1/2]; % a의 첫 번째 요소가 1이 아니면 filter는 차분 방정식을 구현하기 전에 모든 계수를 a(1)로 나눔.
t = 1:10;
for n = 1:1:10
f(n) = -1/2.^n;
end
x = ones(1, input).*f;
i = filtic(b,a,3); % filter init... |
function pred_labels=predict_labels(train_inputs,train_labels,test_inputs)
pred_labels=randn(size(test_inputs,1),size(train_labels,2));
end
|
clear all ; close all ;
subs = {'sub_alex','sub_charest','sub_esteban','sub_fabio','sub_gab','sub_gabriella','sub_genevieve','sub_gina','sub_jeremie','sub_julie','sub_katrine','sub_lisa'...
,'sub_marc','sub_marie','sub_mathieu','sub_maxime','sub_mingham','sub_patricia','sub_po','sub_russell','sub_sunachakan'... |
function [M S W l] = newtestEM
%параметры модельных данных
n = 1000;
p1 = 1/4;
p2 = 1/4;
p3 = 1/2;
mu1 = 1;
mu2 = 4;
mu3 = -1;
sigma1 = 1;
sigma2 = 3;
sigma3 = 2;
%f_ = @(x, mu, sigma) (1/(sqrt(2*pi)*sigma))*exp(-(x-mu).^2./(2*sigma^2));
x1 = normrnd(mu1, sigma1... |
function varargout = fishImageBrowser(varargin)
% WORMIMAGEBROWSER MATLAB code for wormImageBrowser.fig
% WORMIMAGEBROWSER, by itself, creates a new WORMIMAGEBROWSER or raises the existing
% singleton*.
%
% H = WORMIMAGEBROWSER returns the handle to a new WORMIMAGEBROWSER or the handle to
% the exis... |
%test script fgg_2D_experiment.m for the 2D NFFT based on Fast Gaussian
%Gridding.
%
%NOTE: In order for this FGG_2D to work, the C
%file "FGG_Convolution2D.c" must be compiled into a Matlab executable
%(cmex) with the following command: mex FGG_Convolution2D.c
%
%Code by (send correspondence to):
%Matthew Fer... |
water=xlsread("ElkhornCreekUSGS.xlsx");
avgHeight = mean(water)
minHeight = min(water)
maxHeight = max(water) |
load('Y:\Github\DATA\Comparison\siyahlar\Data_with_parasitic01ohm');
input_current_with=InputCurr;
SAIA_with=SAIA;
SBIB_with=SBIB;
SCIC_with=SCIC;
capA_cur_with =capA_cur;
capB_cur_with=capB_cur;
capC_cur_with=capC_cur;
load('Y:\Github\DATA\Comparison\siyahlar\Data_without_parasitic01ohm');
input_current_wit... |
function Qplot()
%QPLOT interactive ploting program
% Qplot opens a standadr MATLAB figure with three options added to the
% menu bar: Qfile, Qoptions and Qgraph. Under Qfile you can read data
% files (text or Excel). Under Qoptions you can set the options of the
% graph: what columns are the X, the Y and the Z, a... |
%% Parameter Init File
earth.mu = 3.986004415E+14; % m^3/s^2
earth.Fs = 1358; % Solar Constant W/m^2
c = 3E8; % speed of light m/s
earth.MM = 7.96E+15; % earth magnetic moment tesla*m^3
%% Servicer
fgc.thrust = 20; % N
fgc.thrustCount = 2; % number of thruster
fgc.pulseWidth = 0.001; % sec
fg... |
%A = [0 0 0 0 0 0 1 1 0 0;0 0 1 1 0 0 0 0 0 1;0 1 0 0 1 0 0 0 0 1; 0 1 0 0 1 0 0 0 0 0;0 0 1 0 1 0 0 0 0 0;0 0 1 0 1 0 0 0 0 0;0 1 0 0 0 1 0 0 0 1;0 1 0 0 0 1 0 0 0 1;0 1 1 1 1 1 0 0 0 1;0 0 0 0 0 0 0 0 0 0];
A = imread('letlet.jpg');
A = A(:,:,1);
ori = A;
C = bwlabel(A,4);
SE = [1 1 1; 1 1 1; 1 1 1];
p = find(A ==... |
function [roF] = batchDLSRollOffFrequencyTheta (a0,a1,startTheta,endTheta,stepTheta,lambda,tcelsius,pSize,indref,eta,fs, deltaFit, figType, dispMode)
%-------------------------------------------------------------------------------
% Version 20171120, Silviu Rei
% function [roF] = batchDLSRollOffFrequencyTheta (a0,a1,st... |
% lc_mat = linear_comb6(obj1, obj2, trian_ch)
% Linear combination matrix obj RWGs as linear combination of obj2 RWGs
%
% obj1 = original (large) RWGs
% obj2 = refined (6x) barycentric RWGs
function lc_mat = linear_comb6(obj1, obj2, trian_ch)
Ne1 = length(obj1.ln);
%lc_mat = spalloc(Ne1, 6*Ne1, Ne1*10);
lc_mat = zero... |
function varargout = lec_14_demo(varargin)
% LEC_14_DEMO M-file for lec_14_demo.fig
% LEC_14_DEMO, by itself, creates a new LEC_14_DEMO or raises the existing
% singleton*.
%
% H = LEC_14_DEMO returns the handle to a new LEC_14_DEMO or the handle to
% the existing singleton*.
%
% LEC_14_DEMO('C... |
#include "userclasses_StateMachine.h"
const struct clazz *base_interfaces_for_userclasses_StateMachine[] = {};
struct clazz class__userclasses_StateMachine = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_userclasses_StateMachine ,0 , &__GC_MARK_userclasses_StateMachine, 0, cn1_class_id_us... |
for i= 113
[y,Fs] = audioread(sprintf('%s%d%s','english',i,'.mp4'));
% [y,Fs] = audioread('english100.mp4');
filename = sprintf('%s%d%s','english',i,'.wav');
audiowrite(filename,y,Fs);
t = 0:0.001:1-0.001;
ydft = fft(y);
freq = 0:Fs/length(y):Fs/2;
ydft = ydft(1:length(y)/2+1);
[maxval,idx] = ... |
% model 2: Y = lambda*A*Y + rho*Y_ttl + X*b + error (with firm fixed effects)
clear all
close all
%% Load data.
load('./Data/A.mat') % adjacency matrix
load('./Data/ID.mat') % firm ids
load('./Data/dm.mat') % missing data indicator
load('./Data/X1.mat') % firm covariates
load('./Data/X2.mat') % aggr
load('./Data/X3.... |
R = uint8(ones(120,160)*255);
G = uint8(ones(120,160)*0);
B = uint8(ones(120,160)*0);
red = -1;
for j=1:1:120
red = 255;
for i=1:1:160
red = red - 1;
R(j,i) = red;
end
end
image = uint8(R);
image(:,:,2)=uint8(G);
image(:,:,3)=uint8(B);
imshow(image)
imwrite(image,'sweep.bmp') |
function visualize_1l_filters(filters,num,row,col,normalize)
%Visualize filter
filters = filters';
if strcmp(normalize,'minmax')
MN = min(min(filters));
MX = max(max(filters));
filters = (filters-MN)/(MX-MN);
elseif strcmp(normalize,'sigmoid')
filters = logistic(filters)
end
show_images(filters,min(num,size... |
%%
% frictionless situation
% for each trial:
% generate a set of 6d points (candidate contact wrenches)
clear
P = 3; % dimensionality of wrench space
Qs_sat = P+1:P+20; % number of contact points to find with brute force
Qs_brute = P+1:P+3;
N = 40; % number of candidate contacts
n_trials = 1;
t_mp = sphere_samples(1... |
function varargout = TwoDspec1Q1Q(varargin)
% TWODSPEC1Q1Q MATLAB code for TwoDspec1Q1Q.fig
% TWODSPEC1Q1Q, by itself, creates a new TWODSPEC1Q1Q or raises the existing
% singleton*.
%
% H = TWODSPEC1Q1Q returns the handle to a new TWODSPEC1Q1Q or the handle to
% the existing singleton*.
%
% TW... |
function predicted = classify_costs_classtree_multiclass_learner( CLASSIFIER, x )
% function predicted = classify_costs_classtree_multiclass_learner( CLASSIFIER, x )
% Classify a set of projected using pixel-wise grey level difference.
%
% Input:
% CLASSIFIER, a structure returned by train_classtree_multiclass_learne... |
clc;
clear all;
close all;
%generating F using meshgrid
L = 32;
s = 1:512;
t = 1:L;
[I, J] = meshgrid(s,t);
const = 2j*pi/512;
F = exp(const*(I-1).*(J-1));
F = F.';
%generating h (multipath Rayleigh fading channel vector)
k = (1:L).';
lambda = 0.2;
p = exp(-1*lambda*(k-1));
a = normrnd(0, 0.5, [L,1]);
b = normrnd(0, ... |
%Ethan Green
%February 2nd, 2020
function batch = ODTUpdate(batch)
%Updates the t vector for usage in the ODPlot function.
%Takes input batch, the structure of all data for the batch.
d = '-';
s = {' '};
c = ':';
if isa(batch.ti,'datetime') == 0
tistring = {num2str(batch.ti(1)), num2str(batch.ti(2)), num2str(batch.... |
function [nn, tnew] = back_propagation(nn, training, target, ao, ai, ah, deeph)
output_delta = 0;
ERROR = target - ao;
output_delta = (derivative(nn, ao) .* ERROR)';
if size(deeph, 1) == 1
deeph_deltas = zeros(nn.nh-1, 1);
error_deeph = nn.wo(2:end, :) * output_delta;
deeph_deltas = derivative(nn, deeph(1,... |
% function [data, seg, settings, g_settings, status] = ModuleExportResults(data, seg, settings, g_settings, command)
function varargout = ModuleExportResults(varargin)
settings_struct = {...
'Export segmentation overlay on raw data (.tiff)', 'label_image', true, 'on';...
% 'Scale up this overlay image by'... |
close all, clear all, clc;
patchMatrixNeg = [];
boundaryArr = [];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% STEP 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Take all the positive samples and detect interest points
allImages = dir('*.png'); % the folder in which ur images exists
% Decaler a cell array to store the patches
n = 3000;... |
function y = vl_nnreshape(x, shape, varargin)
% VL_NNRESHAPE Feature reshaping
% Y = VL_NNRESHAPE(X, SHAPE) reshpaes the input data X to have
% the dimensions specified by SHAPE. X is a SINGLE array of
% dimension H x W x D x N where (H,W) are the height and width of
% the map stack, D is the image depth (numbe... |
function P = expectation(mus,vars,alphas,X)
K = size(alphas,2);
N = size(X,1);
P = zeros(N,K);
for k = 1:K
y_k = mvnpdf(X,mus(k, :),vars(:,:,k));
P(:, k) = alphas(k) * y_k;
end
norm_factors = sum(P, 2);
norm_factors = repmat(norm_factors, 1, K);
P = P ./ norm_factors;
end |
function environment = newEnvironment(config)
% start communication with temperatur sensor and fan control
% and return it as an environment object
environment = naomi.objects.Environment();
environment.connect;
end |
% reproduce Adult communities into Newborns with fixed BM(0)=BM_target
% comm_select: Adults to be reproduced
% const_struct: a structure to pass constants
% dil_factor: dilution factor
% rep_counter: current number of Newborn communities.
% parentnum: the rank of the Adult community
function comm_rep = fixBM0_spikeCM(... |
function demoVoronoiCell(varargin)
%DEMOVORONOICELL Compute and display voronoi polyhedron using geom3d library
%
% This demo show how to manipulate polyhedra, using matlab's voronoin
% function and the geom3d library.
%
% This demo generate some points in a unit cube, computes the 3D voronoi
% diagra... |
function [PP,CC,I] = spline_upsample(P,C,varargin)
% SPLINE_UPSAMPLE Upsample a spline
%
% [PP,CC,I] = spline_upsample(P,C);
%
% Inputs:
% P #P by dim list of control point locations
% C #C by 4 list of indices into P of cubic Bezier curves
% Optional:
% 'OnlySelected' see `upsample.m`
... |
A = [1 0 2; 1 1 0; 0 2 1; 2 1 1]
c = [2; 1; 1; 3]
for i=0:25
lambda = 0.2 * i
b = [
(9*lambda*lambda+58*lambda+87)/(lambda^3 + 18*lambda^2 + 74*lambda+84);
(6*lambda+9)/(lambda^2+16*lambda+42);
(8*lambda^2+42*lambda+45)/(lambda^3+18*lambda^2+74*lambda+84)
]
tmp = (A*b-c)
... |
% EigModel_make_test.m
clear all;
close all;
% Test for empty data
%
n = 10;
N = 0; % no observations
obs0 = rand(n,N);
m0 = EigModel_make( obs0 );
fprintf('zero model\n');
m0.N
m0.org
m0.val
m0.vct
% Test for unit data
n = 10;
N = 1; % no observations
obs1 = rand(n,N);
m1 = EigModel_make( obs... |
function pose = motion_model(pre_pose,u,dt)
%Motion model - Change position of robot according to the action u
%input - previous position, action u [velocity;angular speed] and time.
%output - new position
theta = pre_pose(3,1);
v = u(1,1);
w = u(2,1);
%amigobot hav... |
clearvars; close all; clc;
phobos = imread('phobos.bmp');
figure(1);
imshow(phobos);
figure(2);
histeq(phobos);
%% 3
load histogramZadany;
figure(3);
plot(histogramZadany);
J = histeq(phobos, histogramZadany);
figure(4);
subplot(1,2,1);
imshow(J);
title('Zadany histogram');
subplot(1,2,2);
imhist(J,255);
%% 4
pho... |
function [PrimaryMargin] = ...
PointAnalysisMOM(AC, State)%,nr,npsi)
if isnan(State.range)
State.Vcond = 'min power';
else
State.Vcond = 'max SAR';
end
if State.hmin == State.hmax
hFixed=true;
fixedh = State.hmin;
else hFixed=false;
end
if State.Vmin == State.Vmax
VFixed = true;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.