text stringlengths 8 6.12M |
|---|
clear;clc
x = linspace(-2,1,5)
y = linspace(2*exp(x(1))-x(1)-1,2*exp(x(end))-x(end)-1,5)
plot(x,y,'o')
|
function [Theta,llh] = hg_lasso_lqa(Psi,param)
%% Hermitian Graphical LASSO by Local Quadratic Approximation
% computations based on Singula Value Decomposition
%% hg-lasso initialization
a = param.a;
A = param.A;
maxiter = param.maxiter;
nu = param.nu;
... |
% F: The Fourier descriptor of a contour
% G: The a resized Fourier descriptor with n elements
% Processes F to obtain G, which has been shortened to contain only n elements (assume F has more than n elements).
function [G]=resizeFD(F, n)
G=F;
len=length(F);
if (len>n)
T1=fftshift(F);
p=round((len-n)./2... |
function[im3] = im3read(fname,N)
%IM3READ(fname,N) - reads a 3d image file, N=number of images
im = imread(fname);
cl = class(im);
s = size(im);
im3= zeros(N,s(1),s(2),cl);
for i=1:N
if mod(i,40)==0
fprintf('%d ',i);
end
im3(i,:,:) = imread(fname,i);
end |
function bpdesign
Wls=100;
Wlp=200;
Wup=16000;
Wus=17000;
dev=[];
Fs = 44100;
% rp = 1; % dB Ripples in passband
% rs = 40; % dB Attenuation
%
f=[0 Wls Wlp Wup Wus Fs ]; % corner frequencies
m=[0 0 1 1 0 0];
m_dB=[-40 -40 0 0 -50 -50 ]; % dB mag... |
function S = vect2skew(t)
S = [0,-t(3),t(2);t(3),0,-t(1);-t(2),t(1),0];
end |
function [f] = empore2com1side(t,y,opts,k,K,Cw,twd)
%-----------------------------------------------------------
% function file for c18 disk uptake of diuron in tank exp3
% states are: y(1)= mass of a in membrane(ng)
% y(2)= mass of a in sorbent(ng)
% units are: volume in L
% ... |
function []=MFP_with_field()
close all;
clear;
clc;
k=1.381e-23;%boltzmann constant;
m=0.26*9.109e-31;%effective mass;
T=300;%temperature in K;
xbound=200e-9;
ybound=100e-9;
numofelectron=1000;
tau=0.2e-12;
timestep=2000;
vth=sqrt(2.*k.*T/m);%the thermal velocity in 2 degrees of freedom;
%mean free path
lamuda=vth*ta... |
%% multiHypoConcept
% run_script('multiHypoConcept', '20k patches, context-full');
% dbstop if error; run_script('multiHypoConcept', '20k patches, context-prob');
% dbstop if error; run_script('multiHypoConcept', 'save data');
%%
global SAVEPATH
global SAVEPREFIX
%% helper functions
downsamplerRs = Tid.getDownsample... |
% Реализация функции "ИЛИ" (англ. "OR") с использованием нейрона Мак-Каллока-Питтса
clear;
clc;
% Задание весов и значения порога
disp('Введите веса');
w1=input('Вес w1 =');
w2=input('Вес w2 =');
disp('Введите величину порога');
theta=input('Порог =');
y=[0 0 0 0];
x1=[1 1 0 0];
x2=[1 0 1 0];
z=[1 1 1 0];
... |
function s2 = s_escape_tex ( s1 )
%% S_ESCAPE_TEX de-escapes TeX escape sequences.
%
% Discussion:
%
% In particular, every occurrence of the characters '\', '_',
% '^', '{' and '}' will be replaced by '\\', '\_', '\^',
% '\{' and '\}'. A TeX interpreter, on seeing these character
% strings, is then like... |
% Bestimmung der Übertragungsfunktion Gs der Strecke
% konstanteK: Verstärkung K der Strecke
% zeitkonstantenT: Array mit den Zeitkonstanten der Strecke
% totzeitTt: Totzeit der Strecke
% typeofControlledSystem: String der den Streckentyp beinhaltet. Funktion hat 3 Streckentypen
% implementiert. Streckentypen: 'PTn... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FRE 6251 Numerical and Simulation Techniques in Finance
% Assignment #5
% Name: Surya L Gurung ID: 0449604
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [zero, it] = bisection(fn,a, b, hTol,... |
function [lcurve index_maxcurvature]= AMIGO_LCurve(reg_summary, plotflag)
% AMIGO_LCurve computes and plots the curvature of the Lcurve.
if nargin < 2 || isempty(plotflag)
plotflag = true;
end
alphaSet = reg_summary.alpha;
Q_LS = reg_summary.Q_LS;
Q_penalty = reg_summary.Q_penalty;
% make sure the ordering is ... |
function train_set = get_mode_feature_set(segm_image, feature_mask, labels)
% m -> height
% n -> width
% p -> feature count(e.g. 3 for RGB)
[m n p] = size(segm_image);
train_set = zeros(m*n,p);
rgn_cnt = max(max(labels));
ind_road = 1;
for i=1:rgn_cnt
... |
function [ D spif triggerif ] = util_load_spike_trigger_mcdstream ( varargin )
%UTIL_LOAD_SPIKE_TRIGGER_MCDSTREAM Load spike and/or trigger stream from
%MCD data file. Using MCINTFAC
% The procedure is based on MCINTFAC(datastrm), therefore only works on
% Win32 Matlab.
%
% This function is a 32/64-bit mixe... |
addpath('/home/physics/rjh119/ParticleMaker1')
streak = 285; % um/degS
disp = 0.75282;% m
E = 135e6;
%Charge=140; %pC -add history and date
%start_time = input('Please enter start time (mm/dd/yyyy hh:mm:ss): ', 's');
start_time = '10/14/2015 16:38:56';
timeRange = {start_time;start_time};
charge = 'SIOC:SYS0... |
function [discrdata] = discretiseData(data,types,nBins,varNames);
% this function discretises data by binning it, and converting strings to
% categorical numbers.
[nrows,ncols]= size(data);
count=1;
for i=1:ncols
if types(i)==1
for j=1:nrows
temp(j,1)=data{j,i};
end
... |
classdef OptObjectSlave < OptObject
properties
master
end
methods
function obj = OptObjectSlave()
end
end
end
|
function [P, channel_info, num_overfiltered] = spm_fnirs_temporalpreproc_no_ui(F)
% Apply temporal filters to fNIRS data
% Modified by Erik Boberg 2020-04-08 to not require GUI input.
% Expects that the supplied file has the settings pre-set in P.K
% FORMAT [P] = spm_fnirs_temporalpreproc_ui(F)
... |
% test for maximization of distance
% under L1 and Linf constraints on the metric
n = 160; % size of the problem
path(path,'data/');
name = 'square';
name = 'room';
name = 'cavern';
name = 'simple';
rep = 'results/maxim-dist/';
if not(exist(rep))
mkdir(rep);
end
% bounds on the metric, should be around 1
rmax ... |
Wanneer je de index (1,3) op vraagt van
de vector v=[1.1 1.2 1.3] krijg je een foutmelding. |
function out1 = hess_grf_ceq_heel1114(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL1114
% OUT1 = HESS_GRF_CEQ_HEEL1114(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:33:36
out1 = 0.0;
|
function [GO, GF] = gauss2(I, sigma, shape)
if nargin < 4, shape = 'same';end;
if isa(I,'double') ~= 1
I = double(I);
end
for x = -fix(sigma):fix(sigma)
for y = -fix(sigma):fix(sigma)
% GF is gaussian Filter
GF(fix(sigma)+x+1,fix(sigma)+y+1) = exp(-.5*((x/sigma)^2+(y/sigma)^2));
end
en... |
%% Create all necessary folders to run the analysis and add them to path.
% Go into the images directory where you want to store your analysis and
% then run the section below to create all folders.
AnalysisDate = '20160222';
%AnalysisDate = '20150716';
mkdir(AnalysisDate);
cd (AnalysisDate);
mkdir('ImagesOriginal');
... |
function Q=NewCot_aper_comp(fun,a,b,n,N)
%------------------INPUT
% NEWTON COTES APERTE COMPOSITE
% fun : funzione integranda
% a,b : estremi di integrazione
% n+1 : numero di nodi
% N numero di suddivisioni di [a,b]
%-----------------OUTPUT
% Q : quadratura risultante
%-----------------------
H=(b-a)/N;
% int... |
% P2.3.1: x1(n) = {...,-2,-1,0,1,2,-2,-1,0,1,2...} periodic. 5 periods
clc;
n1 = [-12:12];
x1 = [-2,-1,0,1,2];
x1 = x1'*ones(1,5);
x1 = (x1(:))';
Hs = stem(n1,x1,'filled'); set(Hs,'markersize',2);
axis([min(n1)-1,max(n1)+1,min(x1)-1,max(x1)+1]);
xlabel('n');
ylabel('x_1(n)');
title('Sequence x_1(n)'); |
function Grf_heel_c3 = Grf_heel_c3(in1,in2,s,H)
%GRF_HEEL_C3
% GRF_HEEL_C3 = GRF_HEEL_C3(IN1,IN2,S,H)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 07-Jul-2020 02:00:44
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
q4 = in1(:,4);
q5 = in1(:,5);
q6 = in1(:,6);
t2 = cos(q1);
t3 = cos... |
function plotBmIntensityMap(vertices, bms)
% Plots a heat-map of mean bone marrow intensity as a function of
% two-dimensional coordinates in vertices. Vertices should be an Nx2 matrix.
maxs = max(vertices);
mins = min(vertices);
ranges = maxs - mins;
BINS = 50;
intensitySums = zeros(BINS, BINS);
counts = on... |
%Martello strumentato
set (0,'DefaultFigureWindowStyle','docked')
clc
close all
clear variables
load segnali_accelerazione.mat
scarti=0;
%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
% Importazione di forza e accelerazione
%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
campione='Calibrazione speaker';
accelerometro=0;
punta='';... |
%%%Calibration Exp
force_tether_length = 90e-9; %nN/meter
length = 16000;
force_tether = force_tether_length*length
force_tether = 0.0144
mass = 24;
tether_accel = force_tether/mass;
%%%% xfinal = 0.5*a*t^2
helio_distance = 0.5*tether_accel*(10*365*24*3600)^2;
%%% Estimate Time for Solar Sail
force = 720e-6;
mass = ... |
%% Test daq boards
settings = sensor_settings;
s = daq.createSession('ni');
aI = s.addAnalogInputChannel('Dev1', 0:3, 'Voltage');
s.Rate = settings.sampRate;
s.DurationInSeconds = 20;
for i=1:4
aI(i).InputType = 'SingleEnded';
end
[data, time] = s.startForeground();
figure;
for i=1:4
subplot(4,1,i)
plot(tim... |
% Design of FIR Filter Sampling technique/Windowing Method
clc;
clear;
close all;
% High pass filter design using a Hamming Window
Tau = 20 ;
M = 2*Tau + 1;
n = 0:1:Tau;
hd = zeros(1,Tau+1);
WH = zeros(1,Tau+1);
% Calculating hd(n)
for i=1:length(n)
if n(i)-Tau==0
hd(i) = 0.3;
else
hd... |
%% define of structure
params.secNum = 7;
params.secDof = 1;
params.massCoef = 0.0114;
params.stifCoef = 430000;
params.coupCoef = 45430;
params.dampCoef = 1.443;
%% define of force
params.eo = 1;
params.amp = 1;
params.frq = 1; |
%% Read the value from OPC using simple tag name and type
%
% value = ppReadTagValue(tagName, tagType)
%
% Returns:
% level Value read from OPC as double
%
% Examples:
% level = ppReadTagValue("cstr1", "temp");
function value = ppReadTagValue(tagName, tagType, recordCount)
arguments
tagName... |
function ShowHOSVD()
n = [5 6 7 8];
d = length(n);
r = 3;
X1 = randn(n(1),r);
X2 = randn(n(2),r);
X3 = randn(n(3),r);
X4 = randn(n(4),r);
a = zeros(prod(n),1);
for k=1:r
a = a + kron(X4(:,k),kron(X3(:,k),kron(X2(:,k),X1(:,k))));
end
A = reshape(a,n);
clc
fprintf('Higher-Order SVD\n\n')
fprintf('s... |
function x0 = ip_point(x,y,y0)
% finds the abscissa point x0 for the value of y0, obtained using linear
% interpolation between x1 --> y1 and x2 --> y2
% latter ones are stored in vectors x and y
% it seems data type 'double' stores 15 digits
if (y0<=max(y))&&(y0>=min(y))
y=y-y0;
x0 = x(1) + abs(y(1))/... |
% Implementation of two-point Gaussian Quadrature for integral approximation. Implemented on an example function.
% https://en.wikipedia.org/wiki/Gaussian_quadrature
function In = gauss2(a,b,n)
N = n^2;
x = linspace(a,b,N);
h = x(2) - x(1);
c_1 = 1/2 * h * (1 - 1/sqrt(3));
c_2 = 1/2 * h * (1 + 1/sq... |
function [xes,chis,xnew]=pointAlignerLoop(x,Z, iterations)
xes=zeros(3,iterations);
chis=zeros(1,iterations);
xnew=x;
for i=1:iterations
[xnew,chiNew]=pointAlignerIteration(xnew,Z);
xes(:,i)=xnew;
chis(1,i)=chiNew;
end
endfunction
|
%test histeq
% ----灰度图像----
% I = imread('../asset/gray.jpg');
% I = imread('../asset/gray2.png');
% I = imread('../asset/gray3.jpg');
% I = imread('../asset/gray4.jpg');
% ----彩色图像----
% I = imread('../asset/example.png');
% I = imread('../asset/color.jpg');
% I = imread('../asset/small_xin.png');
% I = imread('../as... |
function [thnew,thit,Qest,Rest] = emFFBSi(y,u,param)
% Extract theta
theta = param.theta;
% Save theta iterations in here
thit = [];
% main loop for EM
for k = 1:param.maxit
% E-step
[xp,wp,ll] = bpf(y,u,theta,param);
[xs] = bsi(xp,wp,u,theta,param);
% M-step
[theta... |
%mex -v erfc_func.c
%mex -v erfc_func0.c
%mex -v erfc_func2.c
%mex -v trapzf.c
%mex -v trapzf2.c
%mex -v weight_update_iter.c
mex -v weight_out_compo_delay_time.c
%return
%%% Error dY = Y - W * X
mex -v error_delay_time.c
mex -v error_delay_time_sw.c
%%% Error correlation : dYX = dY * X'
mex -v error_... |
% gene circuit motif
% clear
% close all
% clc
%addpath(' C:\Users\ccheng\Google Drive\Research\Matlab Toolbox\MaxEnt')
a = -0.2;
b = -0.63;
% deterministic
tau = 3.16;
lamD = lambertw(0, b*tau*exp(0.2*tau))./tau + a ;
lamD = real(lamD);
% MC
alpha = 2;
beta = 2;
ksi = betarnd(alpha, beta, 1e4, 1);
tau1 = tau + (2... |
function [eVented,xL,lb,ub] = VentedEnergy(xL,lb,ub,param)
%add states at each node to allow puroseful energy discharge (venting heat or cooling)
global Plant
if strcmp(param,'H')
net = 'DistrictHeat';
opt = 'excessHeat';
elseif strcmp(param,'C')
net = 'DistrictCool';
opt = 'excessCool';
end
if any(str... |
function [ geom ] = loadProjectionGeometryCT( p )
% Load system geometry
% inputs:
% p - configuration parameters
% output:
% geom - geometery parameters
%
% Copyright (c) 2010-2012 by Andreas Keil, Stanford University.
% Modified by Meng Wu at 2012.9
fprintf('Loading system geometry ...\n');
% or... |
function [detectedBH blackHole boundary area] = detectBlackHoles(lungWindow, originalOnWhite)
detectedBH = 0;
origWhiteBW = im2bw(originalOnWhite,0.05);
regions = regionprops(~origWhiteBW,'Area');
blackness = bwareaopen(~(origWhiteBW),300);
blackAreaRegions = regionprops(blackness,'Centroid... |
function [rescaled_matrix] = rescalify(data, miny, rangy)
% expects matrix = NxM, min = 1xM, range = 1xM,
%cleverly subracts min and divides through range for every column
%keyboard
rescaled_matrix = (data - repmat(miny,size(data,1),1))*spdiags(1./(rangy)',0,size(data,2),size(data,2));
|
warning off
mkdir('../pictures')
subplot(1,3,1)
m=importdata('../orbit_results/wall.plt',' ',2);
wall=m.data;
xw=wall(:,1);
zw=wall(:,2);
plot(xw,zw,'r')
hold on
load ../orbit_results/poincare.plt
p=poincare(:,1);
t=poincare(:,2);
x=poincare(:,3);
z=poincare(:,4);
r=poincare(:,5);
pz=poincare(:,6);
plot(x,z,'.','Marker... |
function [ket] = productstate(th1,th2,ps1,ps2)
ket = [cos(th1/2)*cos(th2/2)
cos(th1/2)*sin(th2/2)*exp(-1i*ps2)
cos(th2/2)*sin(th1/2)*exp(-1i*ps1)
sin(th1/2)*sin(th2/2)*exp(-1i*ps1)*exp(-1i*ps2)];
end |
clear members
members=properties(gNLv);
idx=strmatch('all',members);
members(idx)=[];
for i=1:numel(members)
if ( strcmp( class( gNLv.( members{ i } ) ) , 'Subject' ) && ~strcmp( members{ i } , 'all' ) )
sl_s2m_rateL(i) = gnlsv_all.default.apply_classifier( gNLv.(members{i}).default , 'name' , 'groupL' , 'target_ma... |
function [x,delta,Js] = simu(m,iter,x0,xt,t,n_p)
%x0 represent the parameters` true value
%xt represent the parameters` estimated value
%n_p represent the total number of photons we use
%x10 = 1;
%x20 = pi/3;
%x30 = pi/6;
%t0 = 1; %t represent total time
%m = 5; %m represent the numbe... |
function result = frame_scores_filename(original_filename)
[di, name, ext] = fileparts(original_filename);
result = sprintf('%s/fscores_%s.mat', di, name);
|
Nn = 100;
Ns = Nn;
Np = Nn;
z_neg = linspace(0,Ln,Nn);
z_sep = linspace(0,Ls,Ns);
z_pos = linspace(0,Lp,Np);
%% Post-Process quadratic Results
a0_quadratic_vector = a_quadratic_vector_results(1,:);
a2_quadratic_vector = a_quadratic_vector_results(2,:);
a3_quadratic_vector = a_quadratic_vector_results(3,:);
a4_quadrat... |
function stim = makeTextures(display, stim)
%stim = makeTextures(display, stimulus)
%
% - Note that there is another command, createTextures, that does the
% same basic function. We need to decide which we want and merge -
% Bob thinks at the moment that we should use createTextures, but we're
% not sure.
%
% Repl... |
Met behulp van de colon-operator (:) kan een numerieke
vector worden aangemaakt. |
clc;
clear all;
close all;
Q = 0.375;
Str = num2str(Q); %Converting number to a string
decimal_pt = find(Str == '.'); %Finding the index of decimal point.
Int = Str(1:decimal_pt - 1);
Int_num = str2num(Int);
Int_num_bin = dec2bin(Int_num);
Frac = Str(decimal_pt + 1:length(Str));
Frac_num = str2num(Frac)/10^(... |
function varargout = gui03(varargin)
% GUI03 MATLAB code for gui03.fig
% GUI03, by itself, creates a new GUI03 or raises the existing
% singleton*.
%
% H = GUI03 returns the handle to a new GUI03 or the handle to
% the existing singleton*.
%
% GUI03('CALLBACK',hObject,eventData,handles,...) cal... |
function [] = codkolmogo( rou1, K1, P, C, a, e, m, ini1, ini2 )
%Inputs rou1, K1, P, C, a, e, m, ini1, ini2
%rou1 - nastavuje porodnost koristi
%K1 - nastavuje kapacitu zivotniho prostredi
%P - nastavuje maximalni prirustek dravce
%C - nastavuje paremetr premeny biomasy
%a,e,m - jsou pozitivni konstanty
%ini1 - pocatec... |
function h = rgb2hex(r, g, b)
% RGB2HEX - Converts RGB color values into an equivalent hexadecimal notation.
%
% This function converts from RGB color notation to the equivalent hexadecimal representation. Both notations are
% frequently used to represent colors in various programming languages. Inputs to this func... |
function[X F V R] = cut_network(X,F,V,R,window)
%REDUCE_NETWORK - takes only a piece of the larger network
xkeep = zeros(size(X,1),1);
ikeep=find( X(:,1)>=window(1) & ...
X(:,1)<=window(2) & ...
X(:,2)>=window(3) & ...
X(:,2)<=window(4) & ...
X(:,3)>=window(5) & ...
... |
% creates the letter with 1 px black frame around it and size specified
% globally by regionHeight and regionWidth
function [ normalized ] = normalizeLetter( letterImage )
global regionHeight;
global regionWidth;
framed = zeros(regionHeight, regionWidth);
%cut region with letter
colSum = ... |
function [rhos, thetas] = myHoughLines(H, nLines)
[num_rows, num_cols] = size(H);
threshold = 0.5 * max(H(:))
receptive_field_x_axis = floor(size(H, 1) / 100.0) * 2 + 1
receptive_field_y_axis = floor(size(H, 2) / 100.0) * 2 + 1
p_rhos = []
p_thetas = []
for i=1:nLines
H_sorted ... |
% Programmed by Majid Afshar on 15/08/19
% Ph.D. Candidate
% Department of Computer Science
% Memorial University of Newfoundland
% mman23 [AT] mun [DOT] ca
% Input: Selected features and Classifier name
% Output: Classification accuracy using one of Support Vector Machine(SVM),
% Random Forest (RF),k-Nearest... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Digital Signal Processing %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% As a ... |
% synex: scan alpha_k (lower values)
clear all
% dimensionless parameters
aks = logspace(-3,-2,30);
am = 0.3;
bk = 15;
bm = 10;
rho = 0.5;
mu = 1;
h = 2;
p = 2;
% parameter that sets molecule number
kk = 10;
% parameter that sets timescale
lambda = 1;
% dimensionful parameters, for stochastic description
alphaks = ... |
% ECHO_FEATS Compute BI-RADS echo pattern features.
% [X,FEAT] = ECHO_FEATS(I,BW) computes BI-RADS echo pattern features
% according to the BI-RADS lexicon defined for breast ultrasound, where
% I is the gray-scale image containing a lesion and BW is the binary shape
% of the lesion:
%
% BI-RADS feature... |
%Semitons para hertz
function [hZ] = TCCSemi2Hz(semi)
f0 = 21.83;
a = 2 ^ (1/12);
hZ = f0 * a .^ semi;
endfunction |
function Vnew_t = conv_sw_lagrange(mesh, Vold_t, dt)
% Procede a une iteration par la methode des volumes finis
g = 9.81;
% ---- Normales aux arretes
N1_KL = mesh.fac_nor(:,1);
N2_KL = mesh.fac_nor(:,2);
dsol_t = zeros(3, mesh.nbt);
% ---- Assemblage de la matrice A
for ia=1:mesh.nba
ie = mesh.fac_elm(ia, :... |
function StrOut = ShiftCrypt(str,kappa)
% StrOut = ShiftCrypt(str,kappa)
% Inputs: str = a string of lower case text (alphabet: a, b, ..., z)
% kappa, an integer mod 26
% Output: StrOut = a string of corresponding upper-case ciphertext (alphabet: A, B, ..., Z):
% resulting from encrypting str using the shift ci... |
function [] = RemoveSilence( data, fs, bitsPerSample, outputFname)
i = 1;
while(data(i) == 0)
i = i+1;
end
newData = data(i:length(data));
audiowrite(outputFname,newData,fs,'BitsPerSample',bitsPerSample);
end
|
function err = ...
errorfun_spectralintegration12(V,IA_fullspec,...
ILD_piece1,...
ILD_piece2,...
ILD_piece3,...
ILD_piece4,...
ILD_piece5,...
ILD_piece6,...
ILD_piece7,...
ILD_piece8,...
IA_bestloc)
%This function takes only ILDAlone mean arrays
% errorfun_spectralintegratio... |
% Driver function to test the n-dimensional cross product function
%
u2d = [1 2]';
v2d = mth_cross(u2d);
fprintf('\n2D |V| = %1.3e and U dot V: %1.3e', norm(v2d), dot(u2d, v2d));
u = [1 2 3]';
v = [3 1 4]';
uv = [u v];
x1 = cross(u, v);
x2 = mth_cross(uv);
fprintf('\nDifference between 3D cross Product: %1.3e', norm... |
function [ sig, sig_normed ] = get_signal_vecs(evoked, stim_trials, nCells)
sig = [];
sig(1,:) = mean(evoked(:,stim_trials{1}),2)';
sig(2,:) = mean(evoked(:,stim_trials{2}),2)';
sig(3,:) = mean(evoked(:,stim_trials{3}),2)';
sig_normed = sig;
for i = 1:nCells
sig_normed(:,i) = sig(:,i)./norm(sig(:,i));
end
end
|
p(1)=400;pa(1)=120;
n=2;
while(p(n)>pa(n))
p(n)=400*((1.1)^n);
pa(n)=120*((1.2)^n);
n=n+1;
end
p
pa |
function varargout = trigStimModeGUI(varargin)
% TRIGSTIMMODEGUI MATLAB code for trigStimModeGUI.fig
% TRIGSTIMMODEGUI, by itself, creates a new TRIGSTIMMODEGUI or raises the existing
% singleton*.
%
% H = TRIGSTIMMODEGUI returns the handle to a new TRIGSTIMMODEGUI or the handle to
% the existing si... |
function data = simulate_data(P,R,T)
% Simulate data from reinforcement learning agent on an X-armed bandit.
%
% USAGE: data = simulate_data(P,R,T)
%
% INPUTS:
% P - [N x 1] structure of parameters for N subjects, with the following fields:
% .invtemp - inverse temperature
... |
function [ drawImage ] = drawComponentCharacteristics(image, characteristics)
% Function to draw the component characteristics taking in an image
% and characteristics structure, returned by
% getComponentCharacteristics
%
% Usage:
% drawImage = drawComponentCharacteristics(image, characteristic... |
% Tournament reproduction rate
function R = tournament_rate(f,t)
%R = t * (S(f)/N)^(t-1);
N = length(f);
S = compute_cdf(f);
R = t * (S/N).^(t-1); |
delta = 0.125;
m = 5;
h = delta/m;
n = 1/h;
% ------------------------------------------------------------------------
% remember to add at the end of the computation 2/delta^2
% ------------------------------------------------------------------------
M_q=zeros(n,n); % quadratic term
M_l=ze... |
clc;
clear;
%Get the following parameters from your calibration
px=285.68687;%Principal point X
py=244.43693; %Principal point Y
fx=693.14908; %Focal length
fy=690.66062;
%Homogenous transformation matrix
K = [fx,0,px;
0,fy,py;
0,0,1];
X_cam = [8;5;80;1]; %3D location
IM = eye(3,4);
x = K*IM*X_cam;
u... |
% レートリミッタ
% |(x-yold)/dt|<変化レートならば、 y=x
% |(x-yold)/dt|≧変化レートならば、 y=yold+変化レート
% u(1):入力変数
% yold=u(2):前回出力値
% set(1)=u(3):変化レート
% set(2)=u(4):計算刻み
% y : 出力変数
function [y] = BRLMT(u)
yold = u(2);
set(1)= u(3);
set(2)= u(4);
delta = (u(1) - yold) / set(2);
if (delta ... |
function edges = Median_Edges(presents)
edges = median(presents(:, [2,3,4]), 2);
end |
function collectFeaturesELA(func,dim,ssize)
% -------------------------------------------------------------------------
% Preliminaries
localSetup; % Run script with local setup
FILENAME = ['_D' num2str(dim) '_C' num2str(ssize) '.mat']; % Parameters of the experiment
%... |
function idx_e = energy_selection(e,c_global_id)
%ENERGY_SELECTION Summary of this function goes here
% Detailed explanation goes here
myPATHs = get_myPATHs();
load(fullfile(myPATHs.PARAMETER_PATH,'system_parameters','energy_window_byCrystal_2.mat'))
e_window = e*0;
idx = c_global_id>0;
e_window(1,idx) = peaks_byCr... |
fx(1)=input('Ingrese el intervalo inferior: ');
fx(2)=input('Ingrese el intervalo superior: ');
tol=input('Ingrese el porcentaje de error: ');
syms x;
f=input('Ingrese la funci˛n: ');
f1=subs(f,x,fx(1));
f2=subs(f,x,fx(2));
ea(1)=100;
i=1;
j=2;
while abs(ea(i))>=tol
xf(j+1)=(xf(j-1)*f2-xf(j)*f1)/(... |
function Va = ConverXCourt2xEBSD(DirxEBSD)
Maps=load(DirxEBSD);
% rotation
Va.W11 = Maps.rmap_w11; Va.W12 = Maps.rmap_w12; Va.W13 = Maps.rmap_w13;
Va.W21 = Maps.rmap_w21; Va.W22 = Maps.rmap_w22; Va.W23 = Maps.rmap_w23;
Va.W31 = Maps.rmap_w31; Va.W32 = -Maps.rmap_w23; Va.W33 = Maps.rmap_w33;
V... |
%% Step 2.3
% The objective is to fit 4 linear functions, parameterised with a_i and
% b_i, to a piecewise function, consisting of 5 nonlinear functions. The
% cost function is given in the exercise. It is the integral of the
% nonlinear function minus the linear fit squared.
%
% We have minimised the cost as follows:
... |
function [mds]=V1Model2MDS(ed,mds_dim)
%[mds]=V1Model2MDS(ed,mds_dim)
%
% Runs mds analysis with MDS_DIM dimensions on euclidian distances.
mds = mdscale(ed,mds_dim); %set to (im,2) for 2-dimensional scaling.
|
function [h,dH] = dynamics_constraints(z, N, nx, nu, dt)
%DYNAMICS_CONSTRAINTS(z) compiles the dynamics constraints generated by
%dynamics_constraint_with_derivative.
% @param z: decision variable (column) vector containing the x_i and u_i
% @param N: number of sample points; scalar
% @param nx: dimension of stat... |
clc; clear;
kare=-1;
araba=imread('C:\Users\furoz\OneDrive\Masaüstü\project 2\araba3.jpeg');
araba=imcrop(araba,[300 175 520 1000]);
darkCarValue=55;
darkCar= rgb2gray(araba);
noDarkCar= imextendedmax(darkCar, darkCarValue);
imshow(darkCar);
figure, imshow(noDarkCar)
sedisk= strel('square',7);
noSmallStructures = imope... |
function[x, uu, tt] = n1res_ks(N, m, Tf, p)
% This functions solves the PDE
% u_t = uu_x - u_{xx} - u_{xxxx}, x \in (0, 32*pi)
% u(x, 0) = cos(x/16)*(1 + sin(x/16))
% and periodic boundary conditions with Fourier spectral in
% space and RE null scheme in time.
%
% Key features:
% + 4th order stiff term
% + ... |
% plot dataset size vs humanbehavioral grades
% for original images
%% (1) biggan FLOWER:
x1 = 4000; % dataset size
y1 = 4.08556; % average rating
%% (2) stylegan2 FLOWER:
% Nan
%% (3) biggan CelebA:
x3 = 200; % dataset size
y3 = 3.69333; % average rating
%% (4) stylegan2 CelebA:
% Nan
%% (5) biggan LSUN:
x5 = 100... |
function [c] = constraint_builder( delta_x)
% Constraint for optimization problem
global g_lr_tran rho
c(1) = norm(delta_x,2) - rho;
c(2) = norm(g_lr_tran, inf) - 1;
% ceq = all(dev_arg_of_den(r, a, ak) == 0); % TODO: value of r, a, ak need to be passed here
%this place is reserved for stability
% VERY IMPORTANT
%one... |
%%
CD = @(r1, r2) ( nanmean(r1,1) - nanmean(r2,1) )./sqrt( nanvar(r1,[],1)+nanvar(r2,[],1));
goodT = @(X) find(~cellfun(@isempty,X));
bin = 0.01;
filtWidth = 0.02;
pre = 1.0;
post = 1.8;
addpath ../Rajeev_Code
Datapath = '../ForContextSwitchProject/DoubleCueDatabase/SOMCre/DualModalityCue/';
ExptDates... |
function [Qadj] = GenerateQuadric_svd(Rcw, tcw, box, K)
% Rcw, tcw: poses of all views
% box: bounding boxes correspoinding to each view
% K: Camera Intrinsic Matrix
% baseline, original code from "Rubino, Cosimo, Marco Crocco, and Alessio Del Bue. "3d object localisation from multi-view image detections." IEEE tran... |
function H = Entropy(A)
%% Entropy
% Calculates the Shannon entropy of a network from its degree distribution
% Input:
% A: Network adjacency matrix
% H:
%Network entropy
%%
H = 0;
[p, k] = Degree_Dist(A); %Degree distribution
for i = 1: length(p)
if p(i) > 0
H = H - p(i)*log2(p(i));
end
e... |
function varargout = drawbond(varargin)
% DRAWBOND MATLAB code for drawbond.fig
% DRAWBOND, by itself, creates a new DRAWBOND or raises the existing
% singleton*.
%
% H = DRAWBOND returns the handle to a new DRAWBOND or the handle to
% the existing singleton*.
%
% DRAWBOND('CALLBACK',hObject,ev... |
function y = CP0NG(x,t,r)
y = ((r*t)/(2*pi))^.5*exp(-x^2*r*t/2);
end |
%% Generate the data
N_train=76;
N_test=600;
%D=1;
%
lb=-1;
ub=1;
%x_train = linspace(lb,ub,N_train);
x_train = get_chebyshev_nodes(lb,ub,N_train);
y_train = sin(2*pi*4*x_train);
%y_train = 10*x_train.^3 + 5*x_train.^2 + x_train + 1;
y_train = y_train';
%x_test = 1:N_test';
x_test = linspace(lb,ub,N_test);
y_test = sin... |
function [ indBeltHoldUp ] = isBeltHoldUp( obj,bars )
%%
% 《日本蜡烛图技术》,1998年5月第一版,P99
%% Parameters
lenLimit = 0.015*obj.zoomFactor;
shadowLimit = 0.01;
%%
indLen = bars.barLen./bars.open>lenLimit;
indDownLine = bars.lineLenDown./bars.barLen<shadowLimit;
indYang = bars.yinYang==1;
indBeltHoldUp = indLen&indYang&indDown... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.