text stringlengths 8 6.12M |
|---|
clear
clc
close all
%engineering toolbox
rho_g = 0.1785
%wikipedia
rho_l = 973;
%Provided
D = 2e-3;
%http://www.inchem.org/documents/ehc/ehc/ehc112.htm
%(SI)
nu = 0.0000035;
mu = rho_l * nu;
%Surface tension:
%https://www.engineeringtoolbox.com/water-surface-tension-d_597.html
sigma_60 = 6.62e-2;
sigma_70 = 6.4... |
%% Windowing of sinusoidal signals
% beta controls the side-lobe area Asl (leakage)
% Increasing the window length improves resolution
% Increasing the FFT size does not improve resolution
clear, clc
Nfft = 512; % FFT size
Lwin = 256; % Window length
% If window length is smaller than... |
function [Vp, Ip, Pp] = bm_ext_eig_lamm(fr,Rl)
% beam base structure material constants
lp = 100.0e-3;
Ys = 10.0e10;
rhos = 7.165e3;
hs = 0.25e-3;
b = 20.0e-3;
% piezo layer material constants
Yp = 66.0e9;
rhop = 7.80e3;
hp = 0.2e-3;
ep33S= 15.93e-9;
d31 = -190e-12;
e31 = d31 * Yp;
% ext... |
function computeBaselineAndDFF_Neuron(F)
%computeBaselineNeuron computes baseline per neuron
% Layers are the layers you want to compute the baseline on
% window is the window span in seconds (ex 50 sec)
Layers = F.Analysis.Layers;
% create dff directory
dffPath = F.dir('DFFNeuron');
Focused.mkdir(F, 'DFFNeuron');
... |
function[Tcomp_out,Hcomp_out]=compressor1(P2,eta_comp)
%% Already known
T1= 298;
P1=101;
R=8.314;
%% initial value
T2guess=198;
T2=T2guess+200;
T2s=T2;
h2=0;
iter=0;
%% iteration of Cp,Cv, h2
a=28.11;
b=0.1967*1e-2;
c=0.4802*1e-5;
d= -1.966*1e-9;
while abs(T2-T2guess)>0.2&&iter<1e6
iter=iter+1;
T2guess=T2;
... |
%% Non-convex S3VM problem
% x = ceil(sprand(data.dim, 1, data.spr));
% y = sign(dot(x, z_sample));
% x = ceil(sprand(data.m, data.dim, data.spr));
%x = rand(data.m, data.dim);
x1 = [ones(m,1),sprandn(m, data.dim-1,data.spr)];
y = sign(x1*data.sample);
x2 = [ones(m,1),sprandn(m, data.dim-1,data.spr)];... |
function [nn,ns,ni,D]=hapmap_at_ensemblgene(geneid)
nn=-1; ns=-1; ni=-1; D=[];
%transid='ENST00000360131';
%geneid='ENSG00000084693';
%genename='AGBL5';
[transidlist,transcord,D]=getcdscord(geneid);
%[transid2,transcord2,D]=genename2cds(genename);
if isempty(D)
return;
end
cdslen=zeros(1,length(transidlist)... |
%Brian Polagye
%September 17, 2014
%Description: load Vectrino data into array
%note: assumes that dir function returns files in same order for each
%prefix
%Change log:
% - 9/19 BLP: change to accept Vectrino profiles (rather than point data)
% - 9/19 BLP: change to pre-allocate array of structs
fun... |
function [spiketrain, tau] = deconvolveCa(Fnorm, tau)
%if not given tau, estimate tau from autocorrelation of residuals
Fnorm = Fnorm(:);
if nargin<2
AC = zeros(1,51);
for tau = 10:60
spiketrain = NN_KP(Fnorm, tau);
f = conv(spiketrain, exp(-(0:tau*8)/tau)); f = f(1:length(Fnorm));
... |
%@(#) buntext.m 1.4 05/12/08 09:43:41
%
function buntext
[bun,mminj]=readdist7(setprop(5),'asytyp');
for i=1:size(bun,1)
yx=knum2cpos(i,mminj);
text(yx(2)+.1,yx(1)+.5,bun(i,:),'fontsize',8,'color','black');
end
|
% Identities from
% Byrd, P.F., Friedman, M.D., 1971. "Handbook of elliptic integrals for
% engineers and scientists", 2d ed. Springer-Verlag, Berlin, New York,.
cfun = {'HeumanLambda(x,k)*pi/2 - (elE(k) - elK(k))*pelF(x,kc) - elK(k)*pelE(x,kc)',... %151.03
'HeumanLambda(x,0) - sin(x)',... % 151.01
'... |
% Lagged_Vector_AutoReg_MatrixData_v1
% This function create a Vector Auto Regression Matrix along with first
% column as 1's intercept
function [ X , Y_actual ] = Lagged_Vector_AutoReg_MatrixData_v1( lag, column_data )
first = 2;
last = lag + 1;
[signalLength, channels] = size(col... |
function [isScottish] = ScottishCatchmentIndices(ID,Easting,Northing)
%SCOTTISHCATCHMENTINDICES Returns indices of Scottish catchments.
%
% INPUT
% ID: Catchment ID [-]
% Easting: Easting [m]
% Northing: Northing [m]
%
% OUTPUT
% isScottish: boolean array that indicates whether catchment is Scottish
% bel... |
% Auteur : Olivier Cots, INP-ENSEEIHT & IRIT
% Date : 2018
%
% Etude du probleme de controle optimal (double integrateur) :
%
% min J(u) = 1/2 * int_{t0}^(tf} u(t)^2 dt
% dot{x1}(t) = x1(t),
% dot{x1}(t) = u(t), |u(t)| <= umax
% x(t0) = x0
% x(tf) = xf
%
% t0 = 0, tf = 1, x0 = (-1,0), xf = (0,0).
%
% On reinitialise... |
Filename = "..\03-Apr-2019";
Personname = "WZT";
Groupname = ["down1","down2","left1",...
"left2","right1","right2","up1","up2"];
COUNT = 1;
% ====================<Read Data>================================
for iP = 1:length(Personname)
PersonReading = Filename + "\" +Personname(iP);
for iG = 1:... |
clear all; close all; clc
%% 路径
location='f:';
mlocation=([location,'\2Cannon_ERP\2CannonERP_20150903\data\ERPdata\tcl']);
%datalocation=([location,'\Matlab_Projects\socialDecision\gavg\avg_unuse\asd\']);
datalocation=([location,'\2Cannon_ERP\2CannonERP_20150903\data\ERPdata\avgf\200ms_lvbo100\']);
savelocation=([locat... |
% etdiffnp_hlp.m
% script for simulating enrgy transfer and exciton diffusion in a nanoparticle.
% the main script is "etdiffnp". This is a helper script,
% make a matrix for storing ET efficiency results
if exist('parm')~=1,
disp('run etdiffnp instead')
return
end
% Do some sanity-checking here
D = parm.l... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Two phase Cell Migration (1D Code)
% Contact: Yizeng Li (liyizeng52@hotmail.com or yli54@kennesaw.edu)
% Lingxing Yao (lyao@uakron.edu)
% Yoichiro Mori (y1mori@math.upenn.edu)
% Sean Sun (ssun@jhu.edu)
% U... |
function saida = transictionfunction_fs( s)
%
% Geração da função de transição complexa F=F(S)
%
% function saida = funcaotransicaofs( s)
%
% saida : Vector de saída com o função de transição F(S);
% s : Vector com S's de entrada para o calculo da função F(S).
%
saida = s*0;
k = 0;
fs = 0;... |
fileNames{1}='Service_Network_20Object_7-5-2012.out.txt';
fileNames{2}='Albilene_50Object_AllPaths_8-12-12.out.txt';
fileNames{3}='Albilene_50Object_2Paths_8-12-12.out.txt';
fileNames{4}='Albilene_50Object_1Path_8-12-12.out.txt';
fileNames{5}='Albilene_10Object_AllPaths_8-12-12.out.txt';
fileNames{6}='Albilene_10Object... |
function y = f(x)
y = zeros(size(x));
mask = abs(x) ~= 2;
y(mask) = cos(2.*x(mask))./abs(x(mask)-2);
end
|
function [P1, P2, Ytest]=sph_bayes(Xtest, X, Y)
py1 = sum(Y==1)/size(Y,1);
py2 = sum(Y==-1)/size(Y,1);
[mu1MLE sigma1MLE] = sge(X(find(Y==1),:));
[mu2MLE sigma2MLE] = sge(X(find(Y==-1),:));
pxnew1= mvnpdf(Xtest,mu1MLE,(sigma1MLE^2)*eye(size(Xtest,2)));
pxnew2= mvnpdf(Xtest,mu2MLE,(sigma2MLE^2)*eye(size(Xtest,2))... |
% supervertex by NCut
%
% a cluster may contain multi-patches, why?
% sometimes a cluster contains no face, why?
% 每次的结果可能不一样
%
% Copyright (c) 2012 Junjie Cao
clear;clc;close all;
addpath(genpath('../../'));
DEBUG = 1;
%% input
M.npatch = 50;
USE_CONCAVE_WEIGHT=0;
M.filename = '/data/wolf0.off'; %cube... |
function P = pveMap( ROIs, PSF)
%
% This function calculates a partial-volume-map for ROIs
% Assumptions are:
% - neighboring regions can be treated as homogenous
% - scanner resolutions in x,y,z directions are.
%
% INPUT:
% ROIs 3D matrix with ROI indeces
% PSF [sigmaX, sigmaY, sigmaZ] in pixels. ... |
function [param, v, s] = LSTM_initialization(n_input, n_hidden, ...
n_output, connectivity)
% n_input: size of input data
% n_hidden: number of hidden units
% n_output: size of output data
% connectivity = percentage of connectivity between neurons (0 to 1)
G_1 = erdos_renyi(n_hidden, connectivity);
G_2 ... |
%Karol Wadolowski - Project #0 Warm Up
clear; clc; close all;
%% Part 1: No Channel QAM
%First confirm that the theoretical and simulated BER and SER curves match
%for several QAM constellations.
%Simulation parameters
numIter = 1e2; %Number of iterations
numSyms = 1e3; ... |
function EnergyComputation( tController )
%
try %
%
afTsa = tController.tActuationValues.fAirConditionedTemperature;
afTai = 21;
afTroom = tController.tSimulation.aafStatesMatrix(1,:);
afMassFlowTotal = tController.tActuationValues.fAirMassFlow;
afMassFlowVenting = afMassFlowTotal*0.68;
afMass... |
% reproduce Adult communities through pipetting, when six phenotypes could
% mutate
% 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 = p... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loadReviews function %
% Arguments: None %
% Return value: reviews' table %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [dataReviews] = loadReviews()
% LOAD AMAZON AND YELP DATA
% timer start
% tic;
% First we load our Amazon and Yelp data... |
% Task 1: Smoothing
clear all;
clc;
% img = londonEye;
img = imread('LondonEye.jpg');
imgG = rgb2gray(img);
imgd = im2double(imgG); % imgd in [0,1]
% f = ones(3,3)/9;
% f = ones(3,3)/18; % darker
% f = ones(3,3)/4; % lighter
% different sizes
% f = ones(6,6)/9; % whiteout
f = ones(3,3)/9; % whiteout
img1 = imfilter(i... |
clear all ; close all ;
cd c:/shared/papsaves ; times = load('times') ; times = times.times ; freqs = load('freqs') ; freqs = freqs.freqs ;
% fmri
allstimepochs = load('allstimepochs') ; allstimepochs = allstimepochs.allstimepochs ;
for i=1:22
for j=1:6 ;
for k=1:45
allstimepochs(i... |
function writePOLY_tetgen(filename,V,F,H,varargin)
% WRITEPOLY_TETGEN prints vertices and planar facets to a .poly file for
% tetgen
%
% writePOLY_tetgen(filename,V,F,H)
%
% Input
% filename: name of output file as string (caution! will clobber
% existing)
% V #V by dim list o... |
function [xyRay, cnRay, angRay] = raytraceOverCn(lon, lat, cn, xya0, dtN)
% [xyRay, cnRay, angRay] = RAYTRACEOVERCN(lon, lat, cn, xya0, dtN)
%
% inputs
% - lon: longitude vector of the domain.
% - lat: latitude " " " "
% - cn: eigenspeed field (for every lon/lat coordinate).
% - xy... |
%% Ejemplo de Graficas Animadas en MATLAB
function varargout=animate(varargin)
parar=false;FCos=false;
%Crea una figura, le establece nombre, posición y color
fig(1)=figure('name','Fourier','menubar','none','position',[200 200 800 700],'color',[0 0 0])
%Comando que mueve la figura al Centro de la pantalla
movegui(fig(1... |
%% Optimization Code with Cogeneration and PV constraint
clear all; clc; close all
% helps you set options for your optimization problem.
options=optimoptions('intlinprog','MaxTime',300) ; % this is used to limit the solution time to max. 180 sec
n=288; % t... |
% More efficient and numerically-stable closed-form solutions
% for 'inv(X_k)' in the Semi-Collapsed GIBBS sampler
%
% X_k = (a-b)*I_{k*k} + b*1_{k*k}
% e.g. [[a b b b];
% [b a b b];
% [b b a b];
% [b b b a]];
%
% dets: dets(k) = det(X_k), output by scgibbshelper
% suminv: suminv(k) = sum(sum(inv(... |
clear
%--------------------------------------------------------------------------
% fine grid size, coarse grid size, dim of coarse grid, num of coarse grid
d=1; N=2^11; hg=1/(N+1);
sizeH=2^4; dimH=sizeH^d; H=sizeH*hg; num=(N/sizeH)^d;
fprintf('d=%g, grid points %g, loc-dom size %g\n',d,N,sizeH);
%-----------... |
function mu = weighted_mean(particles)
tmp = sortrows(particles, 4);
tmp = tmp(end-9:end,:);
tmpwt = tmp(:,4);
tmp = tmp(:,1:3);
tmpwt = tmpwt / sum(tmpwt);
mu = sum(tmp.*[tmpwt,tmpwt,tmpwt]); |
%Case 1:
dimx = 16;
dimy = 17;
indata = single(rand(dimx,dimy));
debug_outdata=tom_rescale(indata,[7 7]);
outdata = complexinterleaved(hermitiansymmetrytrim(debug_outdata));
fid = fopen('Input_Resize_1.bin','W');
fwrite(fid,indata,'single');
fclose(fid);
fid = fopen('Output_Resize_1.bin','W');
fwrite(fid,outdata,'singl... |
function [arrlap] = laplasian(I,inp);
for i=1:inp
array(i).img = I;
G = fspecial('gaussian',[3 3],1);
h = imfilter(I,G);
bkp = h;
I = imresize(bkp,0.5);
end
arrlap(inp).img = array(i).img;
for i=1:inp-1
arrlap(inp-i).img = array(inp-i).img - imresize(arr... |
clc;
close;
clear;
image1 = load('image/cifar-10-batches-mat/data_batch_1.mat');
image2 = load('image/cifar-10-batches-mat/data_batch_2.mat');
image3 = load('image/cifar-10-batches-mat/data_batch_3.mat');
image4 = load('image/cifar-10-batches-mat/data_batch_4.mat');
image5 = load('image/cifar-10-batches-mat/data_batch... |
function output = read_V(dir)
fid = fopen(dir,'r');
d = 1;
line1 = fgets(fid);
line2 = fgets(fid);
line2 = fgets(fid);
V{d} = fgets(fid);
while ~feof(fid)
V{d+1} = fgets(fid);
d = d + 1;
end
fclose(fid);
num = length(V);
for n = 1:num %-1
V{n} = strread(V{n}, '%f', 'delimiter', '\t');
output{n} = num2s... |
%% Introduction to Programming and Data Processing
% module 007
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Plotting - Line graphs
clear all; close all; clc;
figure(1);
x = [1 3 4 5];
y = [2 3 3 4];
plot(x, y);
title('Simple line graph');
xlabel('x-values');
ylabel('y-values');
xlim(... |
function browse_mdl(bpath)
% browse_mdl(bpath), Browse models
%
% A quick and dirty simulink model file browser
% Copies pictures of the simulink models files specified by bpath into a new word document with the model name
% If bpath is not specified it lists all the simulink files in the current directory.
if ... |
function [d, pt1, pt2] = distanceLines3d(line1, line2)
%DISTANCELINES3D Minimal distance between two 3D lines.
%
% D = distanceLines3d(LINE1, LINE2);
% Returns the distance between line LINE1 and the line LINE2, given as:
% LINE1 : [x0 y0 z0 dx dy dz] (or M-by-6 array)
% LINE2 : [x0 y0 z0 dx dy dz] (or N-... |
phy_tx_t = phy_tx_t - phy_tx_t(1);
figure;
plot(phy_tx_t, phy_tx_numSubcarriers);
title('Number of subcarriers');
xlabel('Time (s)');
ylabel('Number of Subcarriers');
xlim([min(phy_tx_t) max(phy_tx_t)]);
figure;
plot(phy_tx_t, phy_tx_cp_len);
title('Length of Cyclic Prefix');
xlabel('Time (s)');
ylabel('Samples');... |
function show_figure(figure_name)
dqn_pca = true;
switch figure_name
case 'plot_gp_CV_EMPA'
% plot_gp_CV.m
load(fullfile(get_mat_dir(), 'agg_gp_CV_us=1_glm=1_model=EMPA_theory_nsamples=100_project=1_fast=1.mat')); % this is it !!!!!!!!!!!!!!!!!!!!ontroller five
assert(use_smooth);
... |
function varargout = newton_GUI(varargin)
% NEWTON_GUI MATLAB code for newton_GUI.fig
% NEWTON_GUI, by itself, creates a new NEWTON_GUI or raises the existing
% singleton*.
%
% H = NEWTON_GUI returns the handle to a new NEWTON_GUI or the handle to
% the existing singleton*.
%
% NEWTON_GUI('CALL... |
function yout=nac(y)
% function for "properly normalized" autocorrelation, for
% obtaining number of molecules in excitation volume.
% returns "yout". In principle, yout(1) is the reciprocal of
% the mean number of fluorophores. However, Poisson and other
% noise also affect yout(1), so it is best to estimate G(0)... |
function [x, w] = gauherm(n, mu, sigma)
% Returns abscissas and weights for the Gauss-Hermite n-point quadrature
% over the interval [-inf, inf] using the Golub-Welsch Algorithm.
E=sqrt((1:n-1)/2);
[x,V]=trideigs(zeros(1,n), E);
x=(sqrt(2)*sigma)*x'+mu;
w=sqrt(2*pi)*sigma*V(1,:).^2;
end |
function [T,I,Y]=perfusionResponseP2X4(ton,toff,Ttot,y0)
ode=modelODEP2X4(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0);
I=getTotalCurrentP2X4(Y);
end |
function sig=recon(model,gene,tf,coefs)
% model is a 1*beta cell
%gene is a 1*1 cell
% tf is a tf_num*1 cell
% disp('inside recon')
n=length(gene{1,1});
beta=size(model,2);
variables=cell(beta,1);
% compute model variables
for i=1:beta
if length(model{1,i})>=1
% disp('haha')
% leng... |
% ---------------------------------------------------------------------------- %
% TABLE 5 - Estimation Results under Different Sets of Identifying Assumptions %
% ---------------------------------------------------------------------------- %
clear
if exist('set_path.m', 'file') == 2
set_path
else
error('ERR... |
function [lr_patch, hr_patch] = get_patch_from_HR(hr_img,s,sigma,lrpatch_size,hrpatch_center_size)
[hr_img, lr_img] = generate_LR_image(hr_img,s,sigma);
[lr_row, lr_col] = size(lr_img);
num_of_lrpatch = (lr_row - lrpatch_size + 1) * (lr_col - lrpatch_size + 1);%计算lrpatch的数目
pixels_of_lrpatch = lrpatch_size^2 - 4;%每个lrp... |
function [figureHandle,axisHandles,textHandle] = createFigure
%CREATEFIGURE Summary of this function goes here
% Detailed explanation goes here
figureHandle = figure;
configureFigure(figureHandle);
% Plot of simulated input
axInput = subplot(3,4,[1,4]); % rows, columns, grid position
configureAxInput(axInput);
% P... |
%% Navier-Stokes Equations on an Annulus
% with Chorin pressure correction
% u_t = - uu_r - vu_th/r + v^2/r + ( (ru_r)_r/r + u_{thth}/(r^2) - u/(r^2) - 2v_th/(r^2))/Re - p_r
% v_t = - uv_r - vv_th/r + uv/r + ( (rv_r)_r/r + v_{thth}/(r^2) - v/(r^2) + 2v_th/(r^2))/Re - p_th/r
% (ru_r)_r + v_th = 0
% Domain - annulus [r... |
function RR=timeindexedechogram(x,CL,T,F,df)
%
% RR = timeindexedechogram(x,CL,T,F,df)
% Compute an echogram with a time axis rather than a click axis.
% x is the signal vector
% CL is a vector of click cues in samples
% T = [left right] are the times in samples to display with
% respect t... |
function boxOut = bbox_scale2(boxIn,scale,szOut)
% Copyright (C) 2016 Hakan Bilen.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
if isempty(boxIn), boxOut = []; return; end
boxOut = scale * (boxIn-1) + 1;
boxOut =... |
function varargout = gui_particle_finder(varargin)
% GUI_PARTICLE_FINDER() Lets you dynamically analyze and intercact with
% spots
% This program allows you to analyze a glimpse sequence file and implements
% Grier's spot finding algorithm to automotically locate spots. You can
% edit the spots and analyze tracks (spot... |
clear all;
close all;
for Nq = 4:4
M = 2^Nq;
length_signal = 100000;
length_signal = length_signal*Nq;
inputsig = randi( [0,1],length_signal, 1);
[qam_modulated, M] = qam_mod(inputsig, M);
nf = modnorm(qam_modulated,'peakpow',1);
qam_modulated = qam_modulated*nf;
% if Nq = 6
% ... |
function DfDx = dfdxFiniteDifference(f,h,dim)
%DFDXFINITEDIFFERENCE does first finite difference on a -uniform grid.
% DFDX = DFDXFINITEDIFFERENCE(F, H, DIM)
% Does the first centered finite difference on a uniform grid of F
% along direction DIM (1 is row, 2 is column, and 3 is page) where H is the
% grid spacing. The... |
function contingentMiesenbockShort()
global allScheduledEvents;
allScheduledEvents = []; % Clear existing schedule
% Setup generic experimental info
exp.experimentName = [datestr(now,'YYmmDD-HHMMss-'),'contingentMisenbockShort'];
exp.genotype = 'NorpA[7]/y ; H134R / Or42b-Gal4 ; Or92a-Gal4 / +';
exp... |
%General Parameters
S.maxTrials = 500;
S.trialsPerBlock = 50;
S.startingBlock = 1; %1, or 2
S.modality = 2; %0 = odor and sound, 1 = odor, 2 = sound
S.modalityProb = 0; %Probability of odor trial (0 to 1)
%General GUI
S.GUI.freeWater = 1;
S.GUIMeta.freeWater.Style = 'checkbox';
... |
%##########################################################################
% File: Fourier2D.m
% Purpose: Demo skript for discrete 2D fourier transform
% Author: Marcus Hudritsch
% Date: 15-FEB-09
% Copyright: Marcus Hudritsch, Kirchrain 18, 2572 Sutz
% THIS SOFTWARE IS PROVIDED FOR EDU... |
disp("flsin function");
graphics_toolkit("gnuplot");
function flsin = f(a, w, p, ni, nf) %flsin is the variable returned, f is the name of the function
x = ni:1:nf
flsin = a*sin(w*x + p)
end
function [indicies, values] = flsinB(a, w, p, ni, nf)
indicies = ni:1:nf;
values = a*sin(w*indicies + p);
end
... |
function[theta dist]=get_theta_dist(centb,centf,bot_cent,node)
node_centroid=zeros(1,2);
t=node;
a=floor(t/8);
b=mod(t,8);
if(b==0)
b=8
end
node_centroid(1,1)=a*30;
node_centroid(1,2)=b*30;
bot_vector1=centf-centb;
bot_vector2=node_centroid-bot_cent;
x1=bot_vector1(1,1);
y1=bot_vector1(1,2);
a=complex... |
%% open_file.m
%
% ESP3 main function to open new file(s)
%
%% Help
%
% *USE*
%
% TODO
%
% *INPUT VARIABLES*
%
% * |file_id| File ID (Required. Valid options: char for a single filename,
% cell for one or several filenames, |0| to open dialog box to prompt user
% for file(s), |1| to open next file in folder or |2| to ... |
linewidth = 2.0;
fontsize = 18;
rho_v = 1000;
rho_EG = 1113;
v_EG = 0.0000558;
rho_DG = 1118;
v_DG = 0.0000949;
rho_PG = 1036;
v_PG = 0.0000734;
%
MW_EG = 62.07 / 1000.0; % kg/mol
MW_DG = 106.12 / 1000.0; % kg/mol
MW_PG = 76.10 / 1000.0; % kg/mol
MW_2EH = 130.23 / 1000.0; % kg/mol
x0 = 1e-10;
... |
function c = pitty(AB)
c = sqrt((AB(1:end,1).^2) + AB(1:end,end).^2);
end |
function h = gimbal(M,A,H0)
%
% h = gimbal(M,A,H0)
%
if nargin==2,
H0 = 0 ;
end
[pitch roll] = pr(A,1) ;
h = heading(M,pitch,roll,H0,1) ;
|
function stactrl = sta_control_exp(type)
%%
% visualize sta in the control experiment with different contrast in
% orientation reverse correlation stimuli
%
if nargin < 1; type = 'run'; end
% path ==========================
if mean(ismember('gpfs0', cd))==1
mypath = '/gpfs01/nienborg/group';
else
mypath = 'Z:... |
% Code for running ParamSeep_GCE on the cronusx server
% Boleslaw Osinski (2015)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
input_file = 'OB_params_GCE.txt';
[dt,tsim,numtp,nmit,ngradist,ngraprox,sampf,timevec] ...
= InitNetwork_GCE(input_file);
%% Run ParamSweep_GCE
... |
%% Theis (1941) interpretation.
% This is a demonstration of the interpretation of a pumping test in a
% confined aquifer with a boundary effect using the Theis (1941) solution.
%
% MIT License
% Copyright (c) 2017 Philippe Renard - University of Neuchâtel (CHYN)
%% Load the data
% The data set for this example has... |
function M = solve_oligomer(ODE, BC, p)
% This function expects to recieve a function containing the ODE system to be solved
% and a function containing the boundary conditions as the first two arguments
% p is a structure containing all the parameters that the ODE and BC functions need
% It returns a m... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab M-file Author: Yuchun Li
%
% Project: Simulation of two interacted fireflies
%
% Name: run.m
%
% Description: run script
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
... |
close all;clearvars;clc;
%% GENERATING RECTANGULAR SIGNALS
Tsample=.01;
Ttotal=[0.25 .5 1];
Ton=.05;
Toff=.2;
amplitude=1;
for i=1:length(Ttotal)
no_graph=2*i-1;
[s,t]=triSigGenerator(Ttotal(i),Tsample,Ton,Toff,amplitude);
figure(no_graph);
plot(t,s,'linewidth',2);
grid on;
%% Gene... |
function get_feature_map(video_dataset, rois_data, net_def, modelfile, clsName, varargin)
ip = inputParser;
ip.addRequired('video_dataset', @isstruct);
ip.addRequired('rois_data', @isstruct);
ip.addRequired('net_def', @ischar);
ip.addRequired('modelfile', @ischar);
ip.addRe... |
%PERFILES ANGULARES EN SEGUNDA ETAPA
clear all
alfamax=6.3; %rad/seg2
dt=.1; %seg
tf=1;
t1=(1-4*dt)/2;
ti2=[0 dt t1+dt t1+2*dt t1+3*dt 2*t1+3*dt tf]';
alfai=[0 alfamax alfamax 0, -alfamax, -alfamax 0]';
plot(ti2,alfai)
t=(0:.01:1)';
t2=(0:.01:3)';
alfa_z=interp1(ti2,alfai,t,'linear');
a... |
function [viterbi, posterior, posteriorIBD1, oblist, emission, inconsistency, error] = posterior_decode_1pair(family, all_inheritance, parameters, family_genotype, input_pair)
error = 0;
emission = [];
inconsistency = [];
global debug_mode;
display([' family ',nu... |
function [dx, dy, min] = minCost(costs)
[row, col] = size(costs);
min = 65537;
for i = 1:row
for j = 1:col
if (costs(i,j) < min)
min = costs(i,j);
dx = j; dy = i;
end
end
end
|
function Mref = get_Mref_for_constant_M(t, y, config)
% Get a constant internal moment
% Reference moment to be produced by gimbal rotation
Mref = config.controller.constant_output;
end
|
function [ status ] = interpolate_poscar( filename1, filename2, N )
%INTERPOLATE_POSCAR Interpolate a chain of images between two POSCAR files.
% status = interpolate_poscar(filename1,filename2,N) interpolates a chain
% of N images between two POSCAR files. The interpolated geometries are
% placed in 00/POSCAR, 0... |
close all
clear all
[sampled_data, sample_rate] = audioread('/corrupted_voice.wav');
Fs = sample_rate; % Sampling frequency
T = 1/Fs; % Sampling period
t = (0:numel(sampled_data) - 1)/Fs;
L = length(sampled_data); % Length of signal
y = fft(sampled_data);
% y = fftshift(fft... |
%此程序研究多期下只收单一价格货物(当天发送,推迟到第二天则提供赔偿)的最优仓容问题---总量
%遍历法确定最优仓容,迭代法的解与之比较,表明迭代法可行
%试验最优值的稳定性--不同的随机种子
%采用报童-迭代法(波尔查诺二分法)
clc
clear
close all
%% 参数设置
sj=10; %产生随机数的次数
n=50; %观测多少天
rate=1; %运价
fare=0.6; %仓容单位价格
p=0.2; %每延后一天,赔偿p
D1=0.2E4; %试验仓容的最低值
D2=10.2E4; %试验仓容的最高值,D1和D2的取值是根据到货的分布
Gap=100; ... |
clear all;
% 定义输入向量和目标向量
time=0.01:0.01:10; %时间变量
noise=(rand(1,1000)-0.5)*4; %随机噪声
input=sin(time); %信号
p=noise; %将噪声作为ADALINE的输入向量
t=input+noise; %将噪声+信号作为目标向量
% 创建线性神经网络
net=newlin([-1 1],1,0,0.0005);
% 线性神经网络的自适应调整(训练)
net.adaptParam.passes=70;
[net,y,output]=a... |
function [ t_tilde, z, T_tilde, P_tilde] = SecondaryMasterProblem_fStar_BinarySearch(lambda )
%SECONDARYMASTERPROBLEM_FSTAR Summary of this function goes here
% Detailed explanation goes here
% input: t_tilde, lambda
% output: t_tilde, z*, T_tilde*, P_tilde*
global S_num R_num threshold B T_frame W N P_max P_min alph... |
function [stdev] = mysd(x)
%mysd Returns the std deviation of matrix x
stdev = sqrt(myvar(x));
end |
function header=ECAT_writeHeaderReal(header, byteN, value);
%
% Writes a real number to the Nth byte (byteN) in ECAT header/subHeader.
%
% function ECAT_writeHeaderReal( subHeader, byteN);
%
% Inputs:
%
% header - subHeader/mainHeader in uint8 matrix 512*1 or 1024*1
% byteN - byte N... |
clear all
close all
ndbc_data='/Users/hroarty/data/NDBC/48213';
[Data_48213]=NDBC_monthly_readin_func(ndbc_data,'txt');
ndbc_data2='/Users/hroarty/data/NDBC/48214';
[Data_48214]=NDBC_monthly_readin_func(ndbc_data2,'txt');
plot(Data_48213.time,Data_48213.WVHT,'b','LineWidth',2)
hold on
plot(Data_48214.time,Data_48214... |
function oblist = oblist_sc(all_data, sp, pm)
input_genotype_data_sc = genotype_sc(all_data(sp, 7:end));
oblist = input_genotype_data_sc(pm.sampled_markerlist(:,1));
end
|
for obj= 2:2:10
Result=cell(9,1);
objective = obj
for p= 1:9
%Problem=p
run = 30;
%-----------------------------------------------------------------------------------------
C = [ ];
for i = 1:30
eval(['load D:\CODES-OUR-ALGORITHMS\SPEA-2+SDE-OUR\SPEA2+SDE-our-WFG\SPEA2+SDE-our-WFG\SPEA2+SDE... |
function Cs = getCosineSimilarity(x,y)
if isvector(x)==0 || isvector(y)==0
error('x and y have to be vectors!')
end
if length(x)~=length(y)
error('x and y have to be same length!')
end
xy = dot(x,y);
nx = norm(x);
ny = norm(y);
nxny = nx*ny;
Cs = xy/nxny;
|
% This is the main file for generating Monte-Carlo Simulations
clear all;
close all;
clc;
numSims = 1;
targets = [ 50 100];
for i = 1:numSims
for j = 1:length(targets)
[tartime, pconvg] = mainSim(i, targets(j));
monte(i).tarLength(j).targetTime = tartime;
monte(i).tarLength(j).covgTime = ... |
% Ejemplo de umbral
clc; clear; close all
pkg load image
A = imread('files/imagen4.jpg');
subplot(2,2,1)
imshow(A)
title('Imagen Original')
[m, n] = size(A);
% Paso 0
[q, class] = imhist(A);
% Paso 1
h = q * (1/(m*n));
% Paso 2
p = cumsum(h);
% Paso 3
mc = cumsum((0:255)' .* h);
% Paso 4
mg = mc(256);
% Paso 5
sigma... |
clear
clc
num = [31,30,31,31,26];
name1 = '2006-2010-d4';
name2 = '2011-2015-d4';
initial = 2005;
T = zeros(7,9);
d = 1;
day_max = null(920);
daily_Temp = null(61);
for year = 1:5
for i = 6:8
for k = 1:num(i-4)
if k > 9
... |
%% Method 2: Random
clc; close all; clear;
load('data_new1.mat')
indic_random = ismissing(Xtrain_random);
Xtrain_random_indic = reshape([Xtrain_random;indic_random], size(Xtrain_random,1), []);
tree_random_indic = fitctree(Xtrain_random_indic, Ytrain);
% training accuracy
y_hat_train_random_indic = predict(tree_ran... |
function MatingPool = F_mating(Population, FunctionValue, FrontValue, KneePoint)
% This function is used for the mating selection
[N,D] = size(Population);
%-----------------------------------------------------------------------------------------
% Calculate the weighted distance of each solution
% the neighb... |
classdef Agent<handle
properties
name = 'Agent'
pos = struct('x',0.0,'y',0.0);
path_ = [];
handle = [];
task_id;
temp_input;
f_cnt;
moves = 0;
end
properties(Constant)
FREE = 0;
SEARCH = 1;
PICK = 2;
... |
function [source, features] = oa_feature_extraction(data, cfg)
% function [source, features] = oa_feature_extraction(data, cfg)
%
% Extracts features from EEG recording optimized for ocular artefact
% analysis, according to papers [1][2][3].
%
% INPUT:
% * data - a cell containing eeg data arrays:
% * d... |
function da=disagreement(v)
% DISAGREEMENT computes the disagreement vector of game v.
%
% Usage: da=disagreement(v)
% Define variables:
% output:
% da -- The disagreement vector of game v.
%
% input:
% v -- A TU-game of length 2^n-1.
%
%
% Author: Holger I. Meinhardt (hme)
% E-Mail: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.