text stringlengths 8 6.12M |
|---|
function d=dfx(f,c,x,a) %funcion,coeficientes, nodos y punto de derivacion para dar la derivada numerica
f=inline(f);
d=f(x+a)*c;
end
%double(d) notacion decimal
|
function centroid = mean_point(mat);
% mat must be N*Dimension
% return the mean point (centroid) of a set of point
% 2016 Margot Cantaloube
[N,D] = size(mat);
centroid = sum(mat) / N;
|
function rootSim()
%% parameters
%%% for root
rootLength=900;% length of "rootHalf" matrix and maximum length of root
rootWidth=4;% width of "rootHalf" matrix
%%% for cold treatment
pregrowth=10;% day of transfer from warm to cold (9 days growth in warm before cold)
vernalization=42;% duration of cold (vernalization) ... |
function [X,Y,Z,Uxgd,Uygd,Uzgd,Pgd]=gridformat(L,P,H,Nx,Ny,Nz,v,Ux,Uy,Uz,Pr)
%----------------------------------------------------------------------
% Construction du format meshgrid/MATLAB
%----------------------------------------------------------------------
% Construction du maillage du cube [0,L]x[|O,P]x[0,H]... |
function [data] = read_sl_logfile(filepath,reps)
fid=fopen(filepath);
cdata=textscan(fid,'%f %f %f %f %f %f',reps,'delimiter',' ', 'HeaderLines',1);
fclose(fid);
data = cat(2, cdata{1}, cdata{2},cdata{3},cdata{4},cdata{5},cdata{6});
|
function PlotMarginalCDF( tCopula )
%
figure( tCopula.iLabel )
plot( tCopula.afMarginalCDFDomain, tCopula.afMarginalCDFRange );
%
end % |
% uses new toolbox
addpath D:\Dropbox\Matlab\DownloadedCode\PowerLawAaronClauset\powerlaws_full_v0.0.10-2012-01-17\powerlaws_full_v0.0.10-2012-01-17
clear
%% params
prePlots=false;
multiPlots=true;
singlePlots=false;
plotPDFs=true;
plotCDFs=false;
old=false; % updated data
%% load data
if old
comp... |
function Error = reachMargem(Pwr_Min,bwdth,Freq,Gtx,Grx,T,Desired_CoverN,Desired_Margem)
%Constants
k=1.38064852e-23; %(m2Kgs-2K-1)
c=3e8; %(m/s)
d=36000e3; %(m)
%Free Path Loss
FPL = 20*log10(4*pi*d*Freq/c);
%Link Budget
CoverN = Pwr_Min - 10*log10(bwdth) + Gtx - FPL + Grx - 10*... |
function data_analysis
close all
bloodhound_directory_location = '/home/josh/Dropbox/Bloodhound/';
for run = 6
run_directory = [bloodhound_directory_location 'autonomous-runs_11-12/' num2str(run) '/'];
[time,robot_position,robot_pose,sensor_measurements,c_vals] = reformat_raw_log_file([run_directory 'estimat... |
% lc_mat = linear_comb_bc(obj1, obj2, trian_ch)
% Linear combination matrix obj Buffa-Christiansen as linear combination of obj2 RWGs
%
% obj1 = original (large) RWGs
% obj2 = refined (6x) barycentric RWGs
function lc_mat_bc = linear_comb_bc(obj1, obj2, trian_ch)
Ne1 = length(obj1.ln);
Nv2 = size(obj2.vertex, 2);
%lc... |
function varargout = reglage_pos_energie_v3(varargin)
% REGLAGE_POS_ENERGIE_V3 M-file for reglage_pos_energie_v3.fig
% REGLAGE_POS_ENERGIE_V3, by itself, creates a new REGLAGE_POS_ENERGIE_V3 or raises the existing
% singleton*.
%
% H = REGLAGE_POS_ENERGIE_V3 returns the handle to a new REGLAGE_POS_ENERGI... |
function eventRecord(W, H,e,handles)
%% Parametres
nFrame = 10000;
n = 1; %n
T =3300; %T us
t0 = e.t(1);
%Initialisation of circle fitting
Rfit = 84;
xfit = W/2;
yfit = H/2;
Rfitcf = 84;
xfitcf = W/2;
yfitcf = H/2;
%Initialisation of events
j = 1; %the jth event
m = zeros(H,W); %a map of events
mAfter = zeros(H,W);... |
clc; clear;close all;
tic;
% Define the data to be fit
alpha = (-25:5:25)'; % angle of attack
beta = (-25:5:25)'; % angle of slide
delta_phi = (-30:10:30)'; % deflection of pitch dynamics
delta_psi = (-30:10:30)'; % deflection of yaw dynamics
delta_gamma = (-30:10:30)'; % deflection of roll dynamics
... |
% db.getCollection('experiments').aggregate
%(
% [
% {$match: {ExperimentId: 5}},
% {$unwind: "$Steps"},
% {$match: { "Steps.Name": {$in: ["LocalLexicalKnnSubstitution"] }} },
% {$project: { LVi: "$Steps.LVi", k: "$Steps.Args.k"}}
% ]
% )
query = '[{$match:{ExperimentId:5}},{$unwind:"$Steps"},{$match:{... |
function n = saveasgwy(filename,data,numstepsx,numstepsy,startx,endx,starty,endy,label,unit,time,varargin)
%saveasgwy Save NxM or NxMxL matrix as Gwyddion native data file.
% Save data (NxMxL matrix) for Gwyddion (SPM (scanning probe microscopy)
% data visualization and analysis)
% More information about Gwydd... |
function [] = writeParam(fileID, param)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
fields = fieldnames(param);
for i=1:numel(fields)
fieldName = fields{i};
fieldVal = param.(fields{i});
if isnumeric(fieldVal)
fieldVal = num2str(fieldVal);
elseif islogica... |
function fitness = fitnessEval_demo(ind, userObj)
dimension = length(ind);
fitness = 0;
for i=1:dimension
v = ind(i);
fitness = fitness + v*v;
end
end |
% load the data
data = load('forecasting.txt');
dataLen=size(data);
trainLen = round(dataLen*0.7);
testLen = dataLen-trainLen;
initLen =1000;
resSize = trainLen*0.5;
desired=1.0e-5;
[data]=NormalizationX(data,1,-1);
% generate the ESN reservoir
inSize = 1;
outSize = 1;
a = 1; % leaking rate
W = rand(resS... |
%rota un tensor esfuerzo plano o tensor deformacion plana
function r = rotar_plano(m, a)
a = deg2rad(a);
R = [cos(a), -sin(a), 0;
sin(a), cos(a), 0;
0, 0, 1];
r = R' * m * R;
end |
%beta = sym('b', [1 3]);
x_1 = sym('x', [1 3]);
%beta_mat = sym('b_l', [5 3]);
beta_mat = sym('b', [5 3]);
%expr = log(exp(beta*x_1')/(1+sum(exp(beta_mat * x_1'))));
expr = log(exp(beta_mat(1,:)*x_1')/(1+sum(exp(beta_mat * x_1'))))
%grad = gradient(expr, beta);
%grad_1 = gradient(expr, beta(1));
grad = gradient(ex... |
function [f,g] = OF_Switch(vy,opstr)
idx = opstr.idx;
par = opstr.par;
n_real = opstr.n_real;
n_int = opstr.n_int;
x = vy(1:n_real);
y_int = vy(n_real+1:n_real+n_int);
y_bin = vy(n_real+n_int+1:end);
y = [y_int;y_bin];
k = par.value;
for ii=1:1:size(idx,2)
k(idx{ii})=x(ii);
end
D_max = opst... |
function varargout = GENERATE_INPUT(varargin)
% GENERATE_INPUT MATLAB code for GENERATE_INPUT.fig
% GENERATE_INPUT, by itself, creates a new GENERATE_INPUT or raises the existing
% singleton*.
%
% H = GENERATE_INPUT returns the handle to a new GENERATE_INPUT or the handle to
% the existing singleton... |
function ScaledImage(fig,ax,image,varargin)
p=inputParser;
addRequired(p,'fig');
addRequired(p,'ax');
addRequired(p,'image');
addOptional(p,'X',[1 size(image,2)],@isnumeric);
addOptional(p,'Y',[1 size(image,1)],@isnumeric);
parse(p,fig,ax,image,varargin{:});
imagesc(ax,image,'XData',p.Results.X,'YData',p.Resu... |
function PlotSol(FilePath);
figure;
Set.filename = FilePath;
fd = PetscOpenFile(Set.filename);
Set.S = PetscBinaryRead(fd,'complex',true,'indices','int64','precision','float32');
%-vecload_block_size 1
close(fd);
n = round( length(Set.S)^(1/3) );
Set.S = reshape(Set.S, [n,n,n]);
x = zeros(n,1);
step = 1/n;
for j=2:n... |
function PhasePowerCorr(fname, varargin)
% function PhasePowerCorr(fname, varargin)
%
% INPUTS
%
% fname: name of file to extract LFPs from. **Note: if you want
% to use sample file name, remove comment marker from fc line**
%
% varargins (with defaults):
% F1 = frequency band to analyze power. Default is [45 65]
% F1_... |
% base workspace exported at 04-Oct-2015 %
% Delay workspace exported %
|
% Load Development Data
% Perform perfect segmentation using annotation file
%
% Authors: Christian Sherland
% Sameer Chauhan
% Sharang Phadke
%
% Date: 2-27-13
%
% Project: Speech Processing Signal Segmentation
%
% Bugs:
%
globalVar;
%Read time tags for dev set
fid = fopen(devAnnotPath);
devAnnot... |
function std=computeDiscreteSTD(P,mu)
N=sum(P.^2);
var=N*mu;
std=sqrt(var);
end |
clear all;
names = {'Go','Si'};
%% Load Go and Si splits
splits = 6;
for i = 1:splits
go(i) = load(['results/optimize/parameterStudyGo_' num2str(i) '-of-' num2str(splits) '.mat']);
goTable(i) = struct('binFilter','gaussian',go(i).method.descriptorArgs{:});
si(i) = load(['results/optimize/parameterStudySi_... |
function [A,B,k,C,vare]=sysinit(dets)
% Initialise system, ie. determine models and constants.
%
% Usage: [A,B,k,C]=sysinit(dets)
%
% dets: Deterministic (1) eller stochastic (0) simulation
global t t0 Tnext Ts % Time administration
global As Bs Cs Ds Xs % D-time Linear model
Ts=0.1;
%-----------------... |
% This is material illustrating the methods from the book
% Financial Modelling - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors: Joerg Kienitz
% Daniel Wetterau
%
% Please send comments, suggestions, bugs,... |
function X = nmeaparse(s)
%
% x = nmeaparse(s)
% Extract data from the NMEA sentence in string s. Supported sentences
% are:
% $GPRMC, $GPGGA, $GPGLL, $PGRMF
% The following data are extracted into structure x, if available in the
% sentence (x has matching fieldnames):
% time=[y m d h m... |
%% Yunhao Bai for MIBIsubgroup, 20200421
%assumption, for adjacent cell A and BCD:
%(cell B channel X counts) = (cell B channel X counts) - (cell A channel X counts, only around the boundary) * BoundaryAB/perimeterA - cell C/D...
% + ((cell B channel X counts, only around the boundary)*BoundaryAB/perimeterB + (cel... |
function subjectData = retrieveData(IDNameDBFile, dataDBFile)
%IDNameDBFile = 'C:/Users/Andrew/Documents/Work/EEGleWave/EEG Report Generation/trunk/Octave/data/Confidential Identification.xlsx'
%dataDBFile = 'C:/Users/Andrew/Documents/Work/EEGleWave/EEG Report Generation/trunk/Octave/data/SCAT3 results.xlsx'
% NOTE:... |
function [tendXY tendYX] = CompTend(x,y,binnum)
%Find joint histogram
[tsteps,counts] = hist2_extra(x,y,binnum,binnum);
XYjointProbMat = counts/(sum(sum(counts)));
% Allocate return variables
tendXY = zeros(size(XYjointProbMat));
tendYX = tendXY;
%Find inidividual counts and tendencies
for iter = 1:1:binnum,
... |
shot_bin = read_float_binary("baretta_9mm_indoors");
shot = shot_bin(1:10000);
shot_lin = transpose(shot);
shot_match_filt = fliplr(shot_lin);
sens_input = read_float_binary("baretta_9mm_indoors_crowd_shot");
sens_out = conv(sens_input,shot_match_filt);
csvwrite("/home/ben/Desktop/senior_design/shot_taps/baretta_9mm_in... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
% Discrete Fourier Transform properties
% Parseval's Theorem
n=0:10;
x=1./(n+1);
En=sum(abs(x).^2)
N=length(x);
X=dft(x);
Edft=(1/N)*sum(abs(X).^2)
|
% GARCH_1_1_simulation.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code: GARCH_1_1_simulation.m %
% Student Name: Jonathan Nolan %
% Student Number: 16071514 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% given parameters of GARCH model and va... |
clear all
close all
clc
load('\dades.mat')
k=4;
%%%%%%%%%%%%%%%%%%%%%
% Funcion k-means %
%%%%%%%%%%%%%%%%%%%%%
[centro, Xcluster, Ycluster, clustering]=kmedia(X, Y, k);
% Presentacion de resultados por pantalla.
% Creamos los colores.
colr=zeros(k,3);
for i=1:k
colr(i,:)=rand(1,3);
end;
% ... |
%Mamdani
global mu_giris CIKIS mu_CIKIS
altsinir_x=-10; ustsinir_x=1000; altsinir_y=-30; ustsinir_y=30; altsinir_z=-30; ustsinir_z=30;
X=altsinir_x:50:ustsinir_x; Y=altsinir_y:3:ustsinir_y;
for i=1:size(Y,2)
for j=1:size(X,2)
toplam_alan = 0;
x=X(j); y=Y(i);
%İrtifa üyelik fonksiyonları
ucgenFIS... |
function mangoSimulator()
%MANGOSIMULATOR this function starts the software with splashScreen wrapper
% Descritption: GUI for simulation of drying mangos
% Author: Mario Hügi
% Date: 09. January 2020
% splash screen startup and configuration
s = SplashScreen('SplashScreen', 'img/mango.png');
... |
function [ Y ] = Window_Flat_Top( x )
% Ventana Flat Top
% x: Seņal de entrada
% W: Ventana calculada
% Y: Seņal de salida
a0 = 1;
a1 = 1.93;
a2 = 1.29;
a3 = 0.388;
a4 = 0.032;
N = length(x);
W = zeros(1,N);
for n = 1:N
W(n) = a0 - a1 * cos((2*pi*n)/(N-1)) + a2 * cos((4*pi*n)/(N-1));
W(n)... |
%%修改图像分辨率
clear;clc;
X=inputdlg('您是否已经设定好了分辨率?是输入1,否输入0');
Y=str2num(cell2mat(X)); %将cell型X转为数字Y
if Y==0
fprintf('请确认分辨率是否设置正确!');
break; %这几句是为了防止分辨率弄错,CG修改错又得重新提取
end
Path = pwd; %pwd可获取当前工作目录路径
imagePath = strcat(Path,'\'); %路径后还要拼接\才正确
imageFiles = di... |
%%
%
%% Cleanup
clear
close all
clc
%% Parameters
c = conversion_factors();
load nh3_v4.mat;
fluid = nh3_v4;
%% Input parameters
Thx_init = c.C_to_K(25);
Nhx_init = 100;
Vhx = 0.01;
%% Inputs
% Q:
q = 1e2;
tStart_q = 5 * c.min_to_sec;
tEnd_q = tStart_q + 10 * c.min_to_sec;
% Fluid in:
... |
% Matlab program
function Y = multidimensional_scaling(D, k)
% Input: D, n*n EDM 矩陣, 元素為距離平方
% k, 要降到的維度, k 為正整數, k<n
% Output: Y: k*n data matrix, k 個 features 以及 n 個 samples
n = size(D, 1); % n 個 samples
mu = sum(D, 1)/n; D = D - mu; %
mu = sum(D, 2)/n; B =... |
function arplot_sbm0(monthStr, days, year1, month2Str, days2, year2)
% arplot_sbm0(Month1 String, Days1, Year1, Month2 String, Days2, Year2)
%
% Plots archived data about the spare Superbend.
%
% Example: arplot_sbm0('January',22:24, 1998);
% plots data from 1/22, 1/23, and 1 in 1998
%
% C. Steier, August 2... |
%% 交易
td = Tdx_Connect();
% 需要循环等待才行
SetWait(0);
Wait();
%% 一定要等待登录成功才做
orders = ReqQryOrder(td)
positions = ReqQryInvestorPosition(td)
return;
|
function addVarStats_tetheredMaze_30trials(directory)
%% add additional stats to tethered data files
% note: I want to be organized. each additional var should have its own
% function. This will lend modularity
global info
cd(directory)
homeDir = pwd;
mkdir('processed_files')
saveDir = [homeDir '... |
%% P3DX dimensions
D = 0.195;
R = D/2;
L = 0.038;
Vmax = 1.2;
%% Running V−REP and loading test scene
%%winopen('cena.ttt');
%% Loading V−REP remote interface − client side
vrep = remApi('remoteApi');
%% Closing any previously opened connections
vrep.simxFinish(−1);
%% Connecting to remote V−REP API server
retCod = 0;... |
function h=axis_inc(s)
%This function widens the axis limits by h_inc=w*(s-1), where w is the
%length of the diagonal of the axis window and s the scaling factor
%%
%Get axis limits
h=axis;
%Calculate increments
wx=h(2)-h(1); h_inc_x=wx*(s-1); %Axis limit increment
wy=h(4)-h(3); h_inc_y=wy*(s-1); %Axis ... |
% TOMASZ KUBAT
% 218551
% FILTROWANIE
%% SYSTEM CLEARING
clearvars;
clc;
%% INPUTS AND SETTINGS
nameOfPicture='Leopardnoisesmall.jpg'; % any rgb picture
maskLength=5; % int from (3:2:min(ySize,xSize))
bilateralFilterThreshold=200; % int from (0-765)
%% PICTURE READING
orgPicture ... |
function mp3data_info()
audio_files=dir('All_mp3_DATAS\*.mp3');
for i=1:length(audio_files)
audio_file=strcat('All_mp3_DATAS\',audio_files(i).name);
audioname = extractAfter(audio_file,"All_mp3_DATAS\");
[y,Fs] = audioread(audio_file);
% code to resample audio
Fs_new = 5500;
% Take ratio from o... |
function result = doxysearch(query,filename)
%DOXYSEARCH Search a query in a 'search.idx' file
% RESULT = DOXYSEARCH(QUERY,FILENAME) looks for request QUERY
% in FILENAME (Doxygen search.idx format) and returns a list of
% files responding to the request in RESULT.
%
% See also DOXYREAD, DOXYWRITE
% Copyright (C)... |
%COMPGX04: Robot Vision and Navigation
%Keshav Iyengar
%task 1: Car Dead Reckoning
clear variables
%define constants
Define_Constants
%extract data from given files
M = csvread('Workshop3_Speed_Heading.csv');
time = M(:,1);
forward_speed = M(:,2);
heading = M(:,3)*deg_to_rad;
dr_positions = zeros(2,size(time,1));
dr... |
function [F_MIPs,A_MIPs,Astd_MIPs] = extractMIPs3(sf,ANAL_DIR,f0min,nMIPs,t_debut,t_fin,pm2command)
if nargin < 7
pm2command = 'pm2';
end
if nargin < 6
t_fin = 1.5;
end
if nargin < 5
debut = 0.5;
end
if nargin < 4
nMIPs = 15;
end
if nargin < 3
f0min = 20;
end
[tmp_v, sr_hz] = FreadSoundFile(sf... |
function keigenvector(path, k)
colors = {'#3498db', '#e74c3c', '#1abc9c', '#f39c12', '#95a5a6', '#34495e'};
E = csvread(path);
%%%%%% step 1
col1 = E(:,1);
col2 = E(:,2);
max_ids = max(max(col1, col2));
As = sparse(col1, col2, 1, max_ids, max_ids);
A = full(As); % NxN
%%%%%% step 2... |
%%%prisoner dillemma%%%
%spatial_pd .m
clear all
Nstp=100;
Dim=100; %10 by 10 grid with 100 cells
xx=zeros(Dim,Dim);
xx=round(rand(Dim,Dim));
%xx(round(Dim/2),round(Dim/2))=1;
mymap=[0,0,1;0,1,0;1,1,0;1,0,0];
colormap(mymap);
%caxis ([0 3])
%caxis manual
%imagesc(xx)
for tt =1:Nstp
for ii =1:Dim
for jj =... |
function fig_gen_spheres(pos_mag,angle_view)
cur_f=figure(1);clf;
%axes('Position',[0.3 0.3 4 4]);
set(gcf,'Units','pixels');
pos = set(gcf,'Position',round([10 10 300 450]*2));
if nargin<2
view([51 31]);
else
view(angle_view);
end
inca=1;
list_angl=(0:inca:360)*pi/180;
hold on
plot3(0*cos(list_angl),1*cos(... |
function core=stampBJT(core,t)
bF=100;% forward beta
bR=4; % reverse beta
Va=10; % Early voltage
%tau = 2 * 10^(-11) ;
leakage = 1e-13;% saturation current
vt = 0.02585126075 ; % 1/40 % thermal voltage
Vtf= 1;
Cj = 10 ^ (-14) ;
%Vj = 0.8 ;
%fc = 0.5 ;
mj = 0.5 ;
beta=10... |
function g_set_analysis
global goose
goose.gui.settings.fig = figure('Units','normalized','Position',[.05 .5 .3 .4],'Menubar','None','Name','Settings','Numbertitle','Off');
dx = .15; %Breite der UIs
dy = .05; %Höhe der UIs
dy2 = .02; %Abstand zwischen Zeilen
dw1 = .1; %Abstand Txtfelder von links (west)
dw2 ... |
% at06_05[script]
clear all, close all, clc;
img = imread('cameraman.tif');
h = fspecial('laplacian',0);
lap = edge(img,'zerocross',90,h);
%t é um limiar que atua na sensibilidade da
%detecção das passagens por zero
sob = edge(img,'sobel');
figure, imshow(lap)
title('Laplace')
figure, imshow(sob)
title... |
function create_acc_fig(X1, Y1, x_label, y_label)
%CREATEFIGURE(X1, Y1)
% X1: vector of x data
% Y1: vector of y data
% Auto-generated by MATLAB on 20-Jan-2016 14:12:27
% Create figure
figure1 = figure;
% Create axes
axes1 = axes('Parent',figure1);
hold(axes1,'on');
% Create plot
%plot(X1,Y1,'MarkerSize',0.01,... |
% reglage correcteur verticaux LTI pour injection booster
setsp('VCOR',vcor0);
dz=0 ; % pos (mm)
QP=10; % num QP
n1=QP-1; % Num CV
n2=QP;
n3=QP+1;
T1=+dz*0.08/1.2;
T2=-dz*0.04/1.2;
T3=+dz*0.08/1.2;
stepsp('VCOR',T1,[n1 1]);
stepsp('VCOR',T2,[n2 1]);
stepsp('VCOR',T3,[n3 1]);
%dev2tango('V... |
clear all;
%clc;
echo off
disp('_______________________________________________________________');
%% Загрузка и подготовка обучающей выборки, настройка SOM:
data_path_train = ...
'D:\myworkspace\data\speech\workingproc';
cd(data_path_train)
%
% voice1:
%load('fsp1train1_mfcc.mat');
load('fsp1train2_mfcc.mat');
l... |
% color deconvolution project by Jakob Nikolas Kather, 2015
% contact: www.kather.me
% initialize
format compact, close all, clear all, clc;
% specify source image
% this image is from www.proteinatlas.com, used in accordance with the license
% found under http://www.proteinatlas.org/about/datausage
%imageURL = 'http... |
%*******************************************************************************
%* Program: init_RJ1a.m
%* Description: Inititialization file for problem 1a [1].
%* Author: Andrew Kercher
%* References:
%* [1] Ryu, D. and Jones, T. W., "Numerical Magnetohydrodynamics in
%* Astrophysics: Algorith... |
x=linspace(0,2*pi,100);
y1=5*sin(x);
y2=sin(10*x);
y=y1+y2;
subplot(2,2,1);
plot(x,y1,x,y2);
subplot(2,2,2);
plot(x,y);
subplot(2,2,3);
plot(x,y1*100,x,y2*100);
|
%% Load Colony Sizes
% Matlab Colony Analyzer Toolkit
% Gordon Bean, December 2012
%
% Load colony size data for a single file, array of files, or a directory
% of files.
%
% Usage
% ------------------------------------------------------------------------
% [cs files] = load_colony_sizes( filename, varargin )
% FILENA... |
clear;
% Read image.png
I = imread('image2.png');
% Display image
imshow(I);
% Get two mouse clicks, top left and bottom right
[X,Y] = ginput(2);
% Crop image to within those boundaries
C = imcrop(I, [min(X) min(Y) abs(diff(X)) abs(diff(Y))]);
% Get new and original sizes
orig_size = size(I);
new_size = size(C);
... |
% DemoLFSynth: This is a demonstration of LFSynth, a bare-bones light field renderer implemented in
% MATLAB.
%
% The renderer deals only with flat, textured objects. Shapes are implemented through opacity or
% tiling in the texture bitmaps. Most functionality of a typical rendering tool are missing: it's
% only plane... |
function remove_tracks_cback(~,~,main_figure)
layer=get_current_layer();
curr_disp=get_esp3_prop('curr_disp');
[trans_obj,idx_freq]=layer.get_trans(curr_disp);
trans_obj.rm_tracks;
display_tracks(main_figure);
end |
% spMillikan2.m
% 171003
% Ian Cooper School of Phyiscs University of Sydney
% http://www.physics.usyd.edu.au/teach_res/mp/mscripts/
% Calculations for Millikan's Oil Drop Experiment
% Using simulated data
% S.I. units used for all physical quantities
clear all
close all
clc
% KNOWN PARAMETERS ==================... |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clc;clear;close all;format shortg
addpath([pwd,'/utility/'])
load('twistedxor2data.mat')
whos
% Name Size Bytes Class Attributes... |
function [X,T,Stats]=TRT_SInterp(Data,Para,Inversion)
%
%% Description of the function :
% TRT_SInterp finds the combination of parameters minimizing the calibration error between the temperatures measured during a thermal response test
% and the temperatures predicted by a finite line-source model (FLSM) and/or a ther... |
function z = phasor_interp2( X,Y,y,XI,YI,method,extrapval )
% 2D routine that more correctly interpolates complex matrices such as
% pressure waves than does interp2. Uses normalized input matrix to find
% accurate phase angles. X, XI are row vectors; Y, YI are col. vectors.
if min(y(:))==0
zia = interp2(X,Y,y... |
clear;
clc;
close all;
Q = [-109.3, -124.75, -100.81, -14.74, 76.24, -27.91];
roboplot(Q); |
function[Out,Ratios] = CompFFACGillespie(Which, Alpha, r1, Kon1, Koff1, vpoldefault, TotalTime, L, TimeRes,Nreps,PathToSave,Cumulative,ACLagMin, Bootstrap)
FRAP = 0;
%vpoldefault = 2;
%TotalTime = 100; %min
%TimeRes = 10; % "
alpha = [1,1,1,1];
alpha(Which) = Alpha;
r2 = alpha(1)*r1
Kon2 = Koff1/((Koff1+Kon1)/(Kon1... |
% Figure 7.80 Feedback Control of Dynamic Systems, 5e
% Franklin, Powell, Emami
%
%% fig7_80.m
%% Heat Exchanger
clf;
[t]=sim('Fig7_78cl');
plot(t,u);
grid;
title('Fig. 7.80: Control effort for heat echanger');
xlabel('Time (sec)');
ylabel('Control, u');
|
outlier_rate = 0.1
[pts,pts_tilde,A_true,t_true] = affine_test_case(outlier_rate)
[A, t] = estimate_affine(pts, pts_tilde)
mean_error = evaluate_transformation(pts, pts_tilde, A, t, outlier_rate) |
% Start socket
function [ ] = StartSocket(portNum)
global t
if nargin == 1
t = tcpip('129.127.10.18', portNum, 'NetworkRole', 'client');
t.OutputBufferSize = 2048;
t.InputBufferSize = 1; % Change this
fopen(t);
else if nargin == 0
t = tcpip('129.127.10.18', 8220, 'Net... |
function stationary_cells(num_cells, diameter, speed)
% function stationary_cells(num_cells, diameter,speed)
%
% moving_cells() - produce an animation of 10 blue cells that move at
% a constant speed of ..
% optional arguments num_cells sets the number of cells to be used and the
% optional parameter speed sets the sp... |
function imgOut = imRigidTransform( imgIn, p )
% transforms an image according to given rigid transformation.
%
% SYNTAX:
% imgOut = imRigidTransform( imgIn, p ), where imgIn and imgOut and
% input and output image respectively. p is the rigid transformation
% parameter: p(1) and p(2) are translation along row
... |
function [Ixx, Iyy, Ixy] = polygonSecondAreaMoments(poly)
%POLYGONSECONDAREAMOMENTS Compute second-order area moments of a polygon.
%
% [IXX, IYY, IXY] = polygonSecondAreaMoments(POLY)
% Compute the second-order inertia moments of a polygon. The polygon is
% specified by the N-by-2 list of vertex coordinates.
%
%... |
function [z,rows] = road_modifier_1(y1)
%THE MATRIX TO THIS FUNCTION SHOULD BE IN FOLLOWING FORMAT
%TRIPID/STARTING CENTRE/ENDING CENTRE/TRAVELTIME/ROAD SEGMENT/TIMESLOT
%THIS FUNCTION LISTS THE CENTRES WHICH ARE NOT JUNCTIONS
%PASS THE OUTPUT OF THIS FUNCTION TO road_modifier_2.m
z=[];
rows=[];
tripid=y1(:,1);... |
function hpol = plot_polar(theta,rho,line_style,maxRsp,options,axisLabel)
%
% handle = plot_polar (theta, rho, line_style, maxRsp, options)
%
% plot_polar returns a handle to the object drawn so that the user
% can change attributes such as marker size, line width, etc.
% NOTE: the handle is valid only until the next c... |
function lhtot = jonesfit_irreg(rcs,mdsnn,p);
%
% function lhtot = jonesfit_irreg(rcs,mdsnn,p);
% mdsnn cell variable of dimension{2,K}, containing K sequences of ti and xi
% ti input missing data time instants
% xi input signal
% rcs = tan(.5*pi*rc), length p + q
% p AR order
%
% Berekent de likelihood van e... |
function d = derivativeCheck(funObj,x,varargin)
% diff = derivativeCheck(funObj,x,varargin)
[f,g] = funObj(x,varargin{:});
fprintf('Checking Gradient...\n');
[f2,g2] = autoGrad(x,2,funObj,varargin{:});
fprintf('Max difference between user and numerical gradient: %e\n',max(abs(g-g2)));
d = max(abs(g-g2));
if d > 1e-4... |
% x_dot = A*x;
% y = h(x);
A = [ 0 , 0 , 0 , 1 , 0 , 0
0 , 0 , 0 , 0 , 1 , 0
0 , 0 , 0 , 0 , 0 , 1
0 , 0 , 0 , 0 , 0 , 0
0 , 0 , 0 , 0 , 0 , 0
0 , 0 , 0 , 0 , 0 , 0
];
b = [zeros(3);eye(3)];
% Pseudo-linearized measurement function
% 0 = H*x;
sym('az','real');
sym('el','r... |
function bw = pa_freq2bw(F1,F2)
% BW = PA_FREQ2BW(F1,F2)
%
% Determine bandwidth in octaves between low frequency F1 and high
% frequency F2
% (c) 2012 Marc van Wanrooij
bw = F2/F1; % bandwidth in Hz
bw = log2(bw); % bandwidth in octaves
|
clc;
q0 = [qBase;qShoulder;qElbow;qWristRoll;qWristPitch;qWristYaw];
[RI0, p0] = ForwardKinematics(q0);
RPY = @(roll,pitch,yaw)(rotx(roll)*roty(pitch)*rotz(yaw));
pf = [X;Y;Z];
rf = [Roll;Pitch;Yaw];
if (exist('Time','var') == 1 && Time ~= 0)
tf = Time;
else
tf = 10;
end
tf = 0.1;
% Find final orientation o... |
function [c] = CostFunction(testdata, vars)
%This function evaluates the cost function laid out in
%(http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4398971) to be
%minimized.
%Inputs:
%testdata = vector of TestData objects containing all points and
%corresponding rotation matrices and translation vec... |
classdef expRetina < handle
properties (SetAccess = private)
Date
Genotype
Neurons %container for neurons in associated retina
Stims %container for stims in associated retina
Rig
end
properties
Misc
end
properties (Hidden = true)
recordingDirec... |
function Prod = mymult(x,y)
if isnan(x.*y)
Prod=0;
else
Prod= x.*y;
end
end
|
asacc = {5};
pgacc = {5};
muacc = {5};
astime = {5};
pgtime = {5};
mutime = {5};
ascgstoptime = zeros(5,1);
pgstoptime = zeros(5,1);
mustoptime = zeros(5,1);
for i = 1 : 5,
filename = ['sORL50acc',num2str(i),'.mat'];
load(filename,'AccuracyGNMFD_AS3','GdASCG','AccuracyGNMFD_PG3','GdPG',...
'Accura... |
function [ RSMapMatrix ] = Map_RS( RBNum,DMRS_FREQUENCY,DMRS_TIME )
%% 函数功能:
% 构造参考信号的资源映射矩阵,矩阵每行代表频域上对应的1个子载波,每列代表时域上对应的1个符号,对应矩阵元素 1: 数据, 2: DMRS,
%% 输入参数:
% RBNum :仿真所考虑RB数量
% DMRS_FREQUENCY:DMRS所在的频域位置,1个RB内
% DMRS_TIME:DMRS所在的时域位置,1个RB内
%% 输出参数:
% RSMapMatrix:资源映射矩阵
%% Modify history
% 2017/10/28 created by Liu Ch... |
%%
%
% perlOneLineDescription(Returns quadratic relative permeability)
%
%%
function [krL, krG] = quadraticRelPerm(sL)
krL = sL.*sL;
krG = (1 - sL).^2;
end |
function logprob = innerGibbs_reverse(X, S_idx, target_labels, Models)
%INNERGIB Summary of this function goes here
% Detailed explanation goes here
n = size(S_idx, 2);
logprob = 0;
logprob_all = [];
randpidx = randperm(n);
for i = 1:size(randpidx, 2)
cidx = S_idx(randpidx(i));
k = getCompLabel(M... |
classdef atparticle
%ATPARTICLE Particle definition for AT
%
% A particle is defined by its name, rest energy and charge
properties(SetAccess=private)
name % Name of the particle
rest_energy % Particle rest energy [eV]
charge % Particle charge [elementary charge]
... |
function [output1] = dJb_Pelvis(var1,var2)
if coder.target('MATLAB')
[output1] = dJb_Pelvis_mex(var1,var2);
else
coder.cinclude('dJb_Pelvis_src.h');
output1 = zeros(6, 20);
coder.ceval('dJb_Pelvis_src' ...
,coder.wref(output1) ...
,coder... |
function tdat = plotTiming(p)
if nargin<1
fprintf(2, 'Functionified! %s needs pldaps ''p'' struct or PDS struct input; returns handle to histo. Try:\n\t h = plotTiming(p)\n',mfilename);
evalin('caller', 'h = plotTiming(p)');
return
end
%% Extract params from input
% Deal with inconsistencies btwn pldaps o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.