text stringlengths 8 6.12M |
|---|
function mm_drop_database( m,database_name )
% drop database
% This software is distributed under the MIT License (MIT): see copyright.txt
%{
m : handle to MongoDB client
database_nam : name of database that is to be removed
%}
cur_db = m.listDatabaseNames().iterator() ; % curso... |
function [ fig ] = plot_cross_sections( image_in, DisplayName, limits, fig )
%Plots the integrated horizontal and vertical cross sections of image_in
% === Inputs ===
% image_in should be a 2D array. This function is useful for both pixel
% counts and optical depths.
%
% DisplayName should be a string giving t... |
function [methodBest, optimalV] = zoomOptimizeParameter( ...
setNum,method,diaryFile,logger,parameter,values,varargin)
% OPTIMIZEPARAMETER Optimize single parameter iteratively
pathTypes = 1:6;
runInParallel = true;
minV = values(1,:);
maxV = values(end,:);
methodBest = method;
% get original parameter value
des... |
ua=0:5:120;
m=8830;
g=9.8;
n_min=881;
n_max=2995;
G=m*g;
ig=[7.86 4.45 2.72 1.68 1];
eta_T=0.858;
r=0.417;
f=0.0076+0.000056*ua;
C_DA=0.6*4.75;
i0=5;
L=4;
a=1.947;
hg=0.9;
If=0.218;
Iw1=1.798;
Iw2=3.598;
n=n_min:10:n_max;
Tq=-6209+17007*(n/1000)-17184*(n/1000).^2+8471*(n/1000).^3-2043*(n/1000).^4+193*(n/1000).^5;
Ft... |
function objvector = listparams(obj, onezero)
objvector = {};
if obj.limits.pi0.constant == onezero
objvector = [objvector {'pi0'}];
end
if obj.limits.sens1.constant == onezero
objvector = [objvector {'sens1'}];
end
if obj.limits.spec1.constant == onezero
objvect... |
function new_image = exp_ace_filter_cvip( imageP,W, k1,k2)
% EXP_ACE_FILTER_CVIP - performs an exponential ACE filter.
%
% Syntax :
% -------
% new_image = exp_ace_filter_cvip( imageP,W, k1,k2)
%
% Input Parameters include:
% -------------------------
%
% 'imageP' Input image can be gray image or ... |
function plotValidationCurve(lambda_vec, error_train, error_val)
plot(lambda_vec, error_train, lambda_vec, error_val);
legend('Train', 'Cross Validation');
xlabel('lambda');
ylabel('Error');
end
|
% dy/dx + y^2 = 4x
syms y(x);
ode = diff(y,x) + y^2 == 4*x;
ySol1(x) = dsolve(ode)
cond1 = real(y(0)) == 0;
cond2 = real(y(1)) == 0;
conds = [cond1 cond2];
ySol(x) = dsolve(ode,conds)
% ySol = simplify(ySol)
% ySol2(x) = dsolve(ode,conds)
% ySol2 = simplify(ySol2)
figure(1);
plot_y(1)=ezplot(real(ySol(x)));
x... |
%--------------------------------------------------------------------------
% by Ho-Seung Cha, Ph.D Student
% Ph.D candidate @ Department of Biomedical Engineering, Hanyang University
% hoseungcha@gmail.com
%--------------------------------------------------------------------------
function y = featCC(x,order)
if nargi... |
%B is left wheel
%A is right wheel
% ***** NUMBERS HAVE TO BE NEGATIVE ******
brick.MoveMotor('AB', 30);
pause(1.5);
%brick.StopAllMotors(); |
function [logparahat, logLik] = fmeTraining(Y, t, logpara0, diffusePrior)
%fmeTraining computes the MLE of logpara and the maximized loglik
% options can be set to inspect the optimization process
Obj = @(logpara) ...
NlogLik(Y, t, logpara, diffusePrior);
% inspect optimization process
% options = optimset('Dis... |
%%
cur_dir=pwd;
cur_dir=[cur_dir,filesep];
addpath([cur_dir,'CmsTools']);
addpath([cur_dir,'S3kPlot']);
addpath([cur_dir,'CmsRead']);
addpath([cur_dir,'CmsPlot']);
addpath([cur_dir,'func']);
addpath([cur_dir,'CmsMatstab/model_th']);
addpath([cur_dir,'CmsMatstab/model_neu']);
addpath([cur_dir,'CmsMatstab/model_fuel']);
... |
function poly_rectangle(p1, p2, p3, p4)
% The points must be in the correct sequence.
% The coordinates must consider x, y and z-axes.
x = [p1(1) p2(1) p3(1) p4(1)];
y = [p1(2) p2(2) p3(2) p4(2)];
z = [p1(3) p2(3) p3(3) p4(3)];
fill3(x, y, z, rand(size(p1)));
hold on
end |
function color_rgb = lavender
color_rgb = {'color', [0.90196, 0.90196, 0.98039]};
end |
clc
count=0;
name=zeros(2,7);
off_sem=readtable('Offre_Semaine_Etudecas2.csv'); %Lecture de la Table CSV demandée
%Il faut choisir la plage horaire souhaitée en format décimal
%(00:00=0, 06:00=0.25, 09:00=0.375,12:00=0.5, 18:00=0.75, 21:00=0.875 )
off_sem=off_sem((off_sem{:,13})>=0.25 & (off_sem{:,13})<=0.29,:); ... |
function [timescale_out,varargout] = ...
pad_data(timescale, new_length, length_type, varargin)
% Pads data with zeros at the end, while extending the associated
% timescale.
%
% Example: [timescale_out,varargout] = pad_data(timescale, new_length, length_type, varargin)
%% zero pad the time domain.
% This will imp... |
darkThreshold = 0.02;
datadir = '../data/q3';
resultdir = '../result/q3';
if(~exist(resultdir,'dir'))
mkdir(resultdir);
end
load(sprintf('%s/lights.mat', datadir), '-mat');
[g1 d1] = separateGlobalDirect(sprintf('%s/light01_checkerboard', datadir));
[g2 d2] = separateGlobalDirect(sprintf('%s/light02_checkerboar... |
%% Q2e
% DESCRIPTIVE TEXT
data = getData([], 'test','list');
ids = data.ids(1:3);
for i = 1:3
imdata = getData(ids{i}, 'test', 'left');
im = imdata.im;
%add three detection's ds into one ds for easier comparsion
car_ds = imdata.car.ds;
person_ds = imdata.person.ds;
cyclist_ds = imdata.cycl... |
% test
macHostIP = '130.91.72.120';
winHostIP = '130.91.74.15';
udpPort = 2007;
%% Open up the UDP communication.
% Both computers have to execute their open command to go
% beyond this point.
matlabUDP('close');
matlabUDP('open',winHostIP,macHostIP,udpPort);
msg = input(' What do you want to say? ','s')... |
% EPG Matrix implementation of the Extended Phase Graph (EPG) algortihm.
% H = EPG(N,TAU,R1,R2,ALPHA) calculate the echo amplitudes for a CPMG
% sequence with N echoes and echo spacing of (2*TAU). The parameters are
% R1=1/T1 (scalar) and R2=1./T2 (scalar or vector) and ALPHA the flip
% angle. The matrix H... |
function I = Simpson(x,y)
%Simpsons 1/3 method algorithm with trapezoidal rule
%
%Input arguments: x, an input array of x values
% y, an input array of y values
%
%Output arguments: I, the evaluated integral of the given inputs
%
%Example Call:
% x=([1,2,3,4])
% y=([1,2,3,4... |
function plotChainPanels(model,X,nplot)
global baseParameters exp1 exp3 exp10 exp32 exp100 exp3ca exp10ca exp32ca exp100ca exp320ca
%this matches the experimental conditions of fig 1
% from Anmar's JGP paper
m_cal=17.953218701151055;%1;
if nargin==3
X=correlatedSubChain(X,nplot);
end
subplot(2,1,1);
plotCha... |
function animateBumpcurlTrials(trial_data,field,bump_colors,waitperiod,tail_length)
td = trial_data;
epoch_names = {'BL','AD','WO'};
min_field = min(cat(1,td.(field)));
max_field = max(cat(1,td.(field)));
figure;
for timeCtr = 1:size(td(1).(field),1)
for epochCtr = 1:length(epoch_names)
subplo... |
function perm_mat = perm_gen(n)
perm_mat = zeros(2^n, 2 * n);
for i = 0 : 2^n - 1
temt=dec2bin(i)-48;
len=length(temt);
tem=[zeros(1,n-len),temt];
tem_perm1=find(tem);
tem_perm2=find(tem==0)+n;
perm=[tem_perm1,tem_perm2];
perm_mat(i+1,perm)=1;
end
perm_mat = fliplr (perm_mat);
... |
% Name:Tommy Lee Truong
% Last Edit:Oct 27 2020
% Program Name: Homework 8
%% 2ci
clc; clear all; close all;
% define the true function (note in the hw this is sin(x) or 1/x^2+1
f = @(x) sin(x);
% define the x values (i.e., nodes) and y values
% these values here are from Example 1 / Section 3.3 / pag 124
... |
function [ ] = power_lines2( las, ras )
% compute features for input LAS data
% calculate power line echo: first return / total returns
powerline_echo = ras.r1 ./ ras.den;
% figure; myimage(ras.x,ras.y,powerline_echo); title('power line echo: r1 / rTotal')
% threshold power line echo raster
pl_echo_thr = powerli... |
function [scope_data]=get_wcm(scope)
%##################################################################
% Returns scope data at given bpm.
% assumes WCM signal is on 3rd channel!
%##################################################################
ad = getad;
if ad.simFlag
scope_data = [(1:1000)'*1e-9,rand(1000,1)... |
function [mean_vec] = meanEval(input,varargin)
% meanEval: mean vector
% input
% image
% mask
% weights
% Nicola Falco
% nicolafalco@ieee.org
% ---------------------------------
%
% 20/06/2014
if nargin < 1
disp('COVMat must have at least 1 input: image!/n')
return
elseif nargin == 1
mask = 0... |
%%
%Create dictionary
%Use K means to find the centres (C), A_tra_shape = assigments
clear
load('data2/descriptors_chosen_tra_shape');
DictionarySize = 2000;
run('vlfeat-0.9.16/toolbox/vl_setup');% to compile the vlfeat lab.
tic
[C,A_tra_shape] = vl_kmeans(descriptors_chosen.tra_shape,DictionarySize,'algorithm', 'elk... |
param.stimWav = 'square';
param.intensity = 100;
param.baseline = 20;
param.ORNtoORN = 1;
param.ORNtoLNPN = 1;
param.PN = 1;
param.LNtoORN = 1;
param.LNtoLNPN = 1;
param.DepletionRate = 0.3e-3;
param.TauReplenishment = 1e3;
param.fname = '2020-12-04_ORN_mult_DoOR_2-hep_stimWav-square_intensity-100_baseline-20_ORN-1_PN-... |
function nl = force_terms_on_molly_fourier(gam,mu,ep,F,u,gvals,Nvorts,Ntrunc)
xpos = u(1:Nvorts);
zpos = u(Nvorts+1:2*Nvorts);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ntrg = Nvorts*(Nvorts-1)/2;
Nproc = feature('numcores');
Nstep = floor(Ntrg/Nproc);
Nrem = mod(Ntrg,Nproc);
Kmmx =... |
function varargout = Experiment_PB_DAQ(varargin)
%EXPERIMENT_PB_DAQ MATLAB code file for Experiment_PB_DAQ.fig
% EXPERIMENT_PB_DAQ, by itself, creates a new EXPERIMENT_PB_DAQ or raises the existing
% singleton*.
%
% H = EXPERIMENT_PB_DAQ returns the handle to a new EXPERIMENT_PB_DAQ or the handle to
% ... |
classdef HMMModel < handle
properties(SetAccess=private)
transProb,
emitProb,
initProb,
cachedAlpha,
cachedBeta,
isCache,
end
properties(Dependent)
nStates,
nObserve,
end
properties(Constant)
ITER_TOLERENCE = 1e-4... |
%% Reset the workspace (maxIter = 52; kf_ID = 32; %25)
resetWorkspace; maxIter = 0; kf_ID = 0; %25
for iter = 0:maxIter
close all;
%% Only if multiple loops
if maxIter > 1
kf_ID = iter;
out_Loc = [0 0]; out_Yaw = 0; out_Dist = [0 0];
save('summary.mat', 'out_Dist', '... |
function [accelX,throttleOrBrake,stateVar] = optimizer(Car,speed,curvature,mode,prevThrottleorBrake,maxAccelX)
% *************************************************************************
% FUNCTION NAME:
% optimizer
%
% DESCRIPTION:
% Optimzes throttle or braking for maximum possible Ax
% Modes:
% 0 - C... |
%% PLOTTING STEPS: script designed to plot response of the PSO controller
%% USER PARAMETERS
x0 = zeros(1,n)-0; % initial states.
Speed_noise = 1E-9;
%% START
fprintf('Plotting average step responses PSO framework \n')
%% FIGURE SPECIFICATIONS
colorspec = { [0 1 0]; [ 0.9290 0.6940 0.1250];[0.466... |
function [peak height width area]=getampsize(xdata,ydata)
%function [peak height width area]=getampsize(xdata,ydata)
%
% fits amp data and then produces an area value
if (nargin < 1)
amps=[1 2.5 5 10 15 20 25 30];
fr1=[35 29 33 57 113 147 168 211];
fr2=[0 0 8 34 ... |
function [predicted model] = trainAndPredict(train_x_all,train_y_all,train_size,test_x_all,test_y_all,test_size,modeltype,log2lambda)
%this function train a model according to the modeltype, output the predict value
%train & test: extend this part according to modeltype
%test_size = size(test_x,1);%row num
predicted... |
classdef MultipleOrigins < vt.Component.Checkbox
properties
actionType = @vt.Action.ToggleMultipleOrigins
end
methods
function this = MultipleOrigins(parent, label)
this@vt.Component.Checkbox(parent, label);
end
function [] = onIsEditingChange(this, state)
switch(state.isEditing)
case 'region'... |
function tfmPoly = transformPolygon3d(poly, tfm)
%TRANSFORMPOINT3D Transform a polygon with a 3D affine transform.
%
% TFMPOLY = transformPoint3d(POLY, TFM);
% returns the polygon TFMPOLY by transforming POLY according to the
% affine transform specified by TFM. POLY can be either 2D or 3D. If POLY
% is 2D, zer... |
% COMPUTE THE PRESSURE AT THE RECEIVER
% Shifted the Green's function using the position data of the sound source g_l(t_k - r_l/c_0)
% Sum the pressure from each source up to get the receiver pressure
function Pv = CompPReceiver(X,c0,T)
global gl_g O
NumElem = size(X,3);
pl = zeros(1,NumElem);
Pv = zeros(1,leng... |
function [Ysample, Ymean] = mk_sampleReconstruction(X_pred, X, Y, hyperpara_Ky, Ky, invKy)
% (X_pred, X, Y, hyperpara_Ky, Ky, invKy)
% N = size(X,1);
M = size(X_pred,1);
D = size(Y,2);
%
[A, B] = computeCondKernel([X; X_pred], hyperpara_Ky, Ky);
Km = B - A'*invKy*A;
% mu = [];
% C = [];
Ymean = zeros(M,1); ... |
function y = eq_vl(S,jm,alfa);
%
% y = eq_vl(S,jm,alfa)
%
% INPUT: slip,volumeflux and void.
%
% OUTPUT : Axial liquid velocity
%
% Equation 4.4.106
%@(#) eq_vl.m 2.2 02/02/27 12:07:40
global termo
c15 = termo.css(:,4);
y = (jm - alfa.*c15)./(1+alfa.*(S-1));
y(1) = 0;
|
instrreset
SerialReciever = serial("COM4")
fopen(SerialReciever)
recieved_array = 0;
data_array = 0;
% wait for "DATA" keyword
while(isvalid(SerialReciever))
recieved = (fgetl(SerialReciever))
if recieved == "DATA"
break
end
end
% Read number of values
recieved = str2num(fgetl(SerialReciever))
as... |
%%%%
%%%% Init
%%%%
clear;
addpath('./model');
addpath('./funcs');
addpath('./funcs2');
init_font;
%%%
trange = [-1.0,1.0];
fig = figure;
%%
%% Basal
%%
DAo = 2.^[-2:2] * 0.5;
Icol = (1:numel(DAo))/max(numel(DAo));
yrange1 = [-0.2, 2.2];
yrange2 = [0.02, 5.0];
a1 = plot_prep(fig, trange, yrang... |
function fileID = StartLatexReport(ReportName,Sname,Svalue)
NrOfParameter = length(Svalue);
%
fid = fopen('LatexReportTemplate.txt','r');
f=fread(fid,'*char')';
fclose(fid);
for iParameter=1:NrOfParameter
f = strrep(f,[Sname{iParameter} 'Replace'],num2str(Svalue{iParameter}));
end
fileID = fopen([ReportName '.te... |
function [Ph_NW, Ph_MW] = Phasiness4(sig_ref, sig_test, General)
%[Ph_NW, Ph_MW] = Phasiness4(sig_ref, sig_test, General)
% Returns a measure of Phasiness
global debug_var
if debug_var
disp('Phasiness 4');
end
N = 2048;
L = 1*N/4;
fade_length = 4*N;
fade = 0.5*(1 - cos(2*pi*(0:fade_length-1)'/(fade_length-1)));... |
%%
%%
%%
function save_tw_max_concs(sd, sd_noDAdip, sd_noCa, targs, data_dir, container);
T_VGCC = container('Toffset_VGCC');
Toffset_VGCC = T_VGCC.Value;
for k = 1:numel(targs);
maxconcs = max_concs(targs{k}, sd, Toffset_VGCC);
save(sprintf('%s/maxconcs_%s.mat', data_dir, targs{k}), 'maxconcs');
maxconc_no... |
% This is a demo showing how to measure reaction time using RTBox.
% Run the program and follow the instruction in the command window.
% The program will measure and plot your RT.
% The result RT is a little longer since the start time is recorded
% before sound play. The gaussian envolop also causes a small delay.
%... |
clear all, close all
trajs = load('trajs');
trajs = trajs.trajs;
figure,
for i = 1:(size(trajs, 2)/12/2)
ix_q = (i-1)*12+1:2:i*12-4;
ix_dq = (i-1)*12+2:2:i*12-4;
ix_u = (i-1)*12+9:i*12;
subplot(3,1,1)
plot(trajs(:, ix_q)), hold on
subplot(3,1,2)
plot(trajs(:, ix_dq)), hold on,
subplot(... |
function outlier_detection()
clear
clc
%----saeed source files
source_dir = 'C:\Temp\Oscop data\';
source_file= [source_dir,'preprocessed.mat'];
dest_dir = 'C:\Temp\Oscop data\';
dest_file=[dest_dir,'preprocessed.mat'];
load(source_file,'signal');
sig_size=size(signal,1);
for i = 1:sig_size
D(i,:)=signal{i,2};
en... |
clc;clear all;close all;
% -------------------------------FIR_filter--------------------------------------%
% Generate an input signal.The input signal is composed of two signals with large differences in frequency.
% -------------------------------------------------------------------------------------%
%% System param... |
function [y_pos] = bending_theory(phos_state, e_params, x_pos, dimer_length, smooth_window)
%{
returns y positions of a bending microtubule predicted by theory.
Parameters
----------
phos_state: vector
phosphorylation state at a given time for all dimers of microtubule
e_params: structure containing parameters fo... |
function [] = fcon_group_select(files_in,files_out,opt);
% Get multiple database age selections.
%
% [] = fcon_group_select(files_in,files_out,opt);
%
% files_in : vector containing name of chosen databases to select from.
% files_out : string to which save the files. (Do not include extensions.)
% opt : structure c... |
function fig = draw_3d_platelet(em, height, zcom)
[x_wall, xp, y_wall, yp, z_wall, zp] = define_parametric_vars();
ph = acos(em(1));
th = atan2(em(3), em(2));
R = [cos(ph), -sin(ph), 0;
cos(th)*sin(ph), cos(th)*cos(ph), -sin(th);
sin(th)*sin(ph), sin(th)*cos(ph), cos(th)];
p_arr... |
imds = imageDatastore('resnet_images/training_images');
for i=1:16000
images_training(:,:,:,i)= readimage(imds,i);
end
imds = imageDatastore('resnet_images/validation_images');
for i=1:4000
images_validation(:,:,:,i)= readimage(imds,i);
end
%Training Options
options = trainingOptions('sgdm', ..... |
% get exceedance probabilities and posterior probabilities of subgroups
clearvars pxp xp exp_r bor
full_data_path = 'D:/MACS/dcm/rAmy_ORB_p9/BMS';
Nregs=2;
cd(full_data_path);
folders=dir('HC_*');
for ngroup=1:length(folders)
load(fullfile(full_data_path,strcat(folders(ngroup).name,'/BMS.mat')));
xp(ngroup,:)... |
function out = rect(t)
out = u(t-(-0.5))-u(t- 0.5);
end |
% Debug Function for Interceptor_v04_model
% States
x = 0;
y = 0;
z = 0;
u = 0;
v = 0;
w = 0;
x_inv = 100;
y_inv = 100;
z_inv = -100;
u_inv = 0;
v_inv = 10;
w_inv = 0;
% Controls
T_x = 0;
T_y = 0;
T_z = 0;
states = [x; y; z; u; v; w; x_inv; y_inv; z_inv; u_inv; v_inv; w_inv;];
controls = [T_x... |
%% Display Start message
disp('Starting PSK BER Simulation set.')
%% Plot theoretical curves
disp('Plotting theoretical curves.')
SNRs = -5:28;
[h_fig, h_lines] = PSK_BER_Curves(SNRs);
%% Run Monte Carlo simulations
disp('Running Monte Carlo simulations.')
PSK_BER = zeros(6,length(SNRs));
hold on
simLines =... |
% vertikalus kampas tarp klausytojo ir garso saltinio
elevation = 0;
% Horizontalus kampas tarp klausytojo ir garso saltinio
angle = 45;
%pagrindinis garsas
filename = `StarWars1.wav`;
%nuskaitomas pagrindinis mono garsas
[Y FS BTS] = wavread(filename);
if mod(length(Y), step_cnt) > 0
ts = Y;
... |
function tsa = ts(t,tUnits)
%
% TSD = ts(t,units)
% TSD = ts(t)
%
% A ts object contains a sequence of times. The units should be specified.
% If units are not specified, 'sec' are assumed.
%
% Methods
% ts/Data - Returns the timestamps as a matlab array
% ts/StartTime - First timestamp
% ts/EndTime... |
clc;
clear all;
close all;
%% Map of bones
SkeletonConnectionMap = [[1 2]; % Spine
[2 3];
[3 4];
[3 5]; %Left Hand
[5 6];
[6 7];
[7 8];
[3 9]; %Right Hand
[9 10];
[10 11];
[11 12];
[1 17]; % Right Leg
[17 18];
[18 19];
[19 20];
[1 13]; % L... |
function out = sample_frame_rate(p,m)
N = length(p);
for i = 1:N
p_new{i} = p{i}(1:m:end);
end
out = p_new; |
function [theta_output, cost_history] = mla_linear_regression_gradient_descent(X, y, theta, alpha = 0.1, iteration = 10, lambda = 0, history = false)
%% Purpose: Generate new_theta for one step further
%% Purpose: This function is part of gradient descent algorithm
%% Info: lambda is used for regularization purpose
%... |
function [ newheatmaps ] = translate_heatmaps( heatmaps, d)
%TRANSLATE_HEATMAPS returns heatmaps translated to the specified center
%heatmaps dimensions x y nlm
%used for testing only
for i=1:size(heatmaps,3)
h = heatmaps(:,:,i);
n=imtranslate(h,d(end:-1:1),'OutputView','full');
newheatmaps(:,:,i)=n;
end
end... |
function [ite_input_r,N_r,u_r,x_o1,x_o0]=digitreuse_v2(operand1,operand0,x1,x0)
%function [test1,test_r,test3,ite_input_r,u_r,CAx1,CAx0,N_w,N_r,addr_w,addr_r,x_o1,x_o0]=digitreuse(operand1,operand0,x1,x0)
%function [test1,test_r,test3,test4,u_r,CAx1,CAx0,N_w,N_r,addr_w,addr_r,x_o1,x_o0]=digitreuse(operand1,operand0,x... |
function [pts mask] = centerAreaFilter(pts, radius)
%Wycina punkty leżące w kuli o środku w punkcie ciężkości i zadanym
%promieniu.
centroid = getCentroid(pts);
[pts mask] = getNeighbours(centroid, radius, pts);
|
%*******************************************************************************
%* Program: plot_mhd.m
%* Description: Plotting routine for solution to exact nonlinear Riemann
%* sovler for 1D Magnetohydrodynamic equations.
%* Author: Andrew Kercher
%-----------------------------------------------------... |
% Solving coupled estimation and control problem for the nonlinear system
clear all
close all
parameters;
[A,B] = get_system_matrices();
C = [1 0 0 0;
0 0 1 0];
Q = C'*C;
Ru = 1/3^2;
[K,X] = lqr(A, B, Q, Ru);
disp('Eigenvalues of A-B*K')
eig(A-B*K)
% Observation operator
H = [1, 0, 0, 0;
0, 0, 1, 0];
... |
function res = holetskogo()
A = [241 -49 -64 -32 83 -73 57 66 -17 -47 -1; -49 42 65 -9 -45 25 8 10 0 16 -54; -64 65 207 71 -195 103 41 27 43 92 -167;
-32 -9 71 241 -129 79 83 144 98 30 -50; 83 -45 -195 -129 216 -93 -48 -36 -86 -84 83; -73 25 103 79 -93 218 -36 -2 -58 182 -213;
57 8 41 83 -48 -36 236... |
clear
clc
close all
%%
filename = 'Basil6_CPMG_01AUG2018';
filedir = 'Z:\Data\ADF\Summer 18\Basil\Decay\';
fileloc = strcat(filedir,filename);
[ap,spec,spec2,spec3,spec4] = readTecmag4d(strcat(fileloc,'.tnt'));
spec = squeeze(spec2(1,:));
tEcho = 300; %Echotime (us)
nEchoes = 128; %Number of echoes
nPts = ap.ctd;
t... |
%1)
v=[3,-2,5,7,-3];
u=[5,3,-1,-1,9];
A =[-3,-3,-4,-9,-8;-6,7,5,-9,1;-5,2,5,1,-1;2,1,-3,6,-10;-1,9,1,9,-3];
v.*u; % The "." tells Matlab to multiply each element by each element.
% ans = [15 -6 -5 -7 -27].
v*u'; % This is multiplying the two arrays together. The apostrophe changes
% a row vector into a column vecot... |
function varargout = RFL_Interface2(varargin)
% RFL_INTERFACE2 MATLAB code for RFL_Interface2.fig
% RFL_INTERFACE2, by itself, creates a new RFL_INTERFACE2 or raises the existing
% singleton*.
%
% H = RFL_INTERFACE2 returns the handle to a new RFL_INTERFACE2 or the handle to
% the existing singleton... |
function linearODESolveslowSpike()
global q1 q2 q3 q4 q5 q6 vout p0 Acell Tsoln I Y imin imax t0 Q;
%#codegen
generatorMatrixslowSpike();
for i=imin:imax
p0=p0*expm(Q*(Tsoln(i)-t0));
Y(i,:)=p0;
I(i)=Acell*10^12*(p0(3)+p0(4))*V;
end
end |
% (* ::Package:: *)
clear
load 'J:\SHARE\OAQPS 2014-2019\Reduced Form Tools Testing (3-40)\Models\AP3\2014_PM_Worksheet_Area_Low_Western_Adj'
%load 'J:\SHARE\OAQPS 2014-2019\Reduced Form Tools Testing (3-40)\Models\AP3\PM_Incidence.mat'
%%
SO2 = zeros (3109,5);
NOx = zeros (3109,5);
NO3 = zeros (31... |
%%
%
% N = closefig(ID);
%
% Inputs
%
% ID - identifier string.
%
% Outputs
%
% N - number of figures closed.
%
% Closes all figures tagged with ID string.
%
% See also FIG
%
% Sumedh Joshi
% The University of Texas at Austin
% sumedhj@mail.utexas.edu
% 26 May 2009
function varargout = clo... |
% t_rgcAverageFull
%
% Generate a moving bar stimulus and measure the response of a simulated
% retinal patch from photoreceptors to retinal ganglion cells.
%
% The tutorial begins with the user choosing several parameters, including
% the eccentricity and field of view of the simulated retinal patch. The
% isetbio p... |
gamma = 0;
lambda =3;
eta =1;
T = 0;
beta=3;
tend = 1000;
i = 0;
alphavec = 0.2:0.2:1;
stressvec = 0.05:0.05:1;
a = length(alphavec); s = length(stressvec);
L = a*s;
straincell = cell(1,L);
stresscell = cell(1,L);
flagcell = cell(1,L);
historycell = cell(1,L);
t_historycell = cell(1,L);
%global external_force monofla... |
%=========================================================================
%
% Program to perform tests of the stationary distribution of the
% interest rate based on the gamma distribution
%
%=========================================================================
function test_interest( )
clear all
cl... |
function [ei] = ei_vector(i, n)
%unit vector with zeros except for the i^th element.
%
%usage
%-----
% ei = ei_vector(i, n)
%
%input
%-----
% i = index of element equal to 1.
% n = vector dimension
%
%output
%------
% ei = column vector of unit 1-,2-,\infty-norm with i-th element 1
% = [0, .... |
%Illustration of the Neyman-Pearson testing paradigm
%Code by Matthew Dunham
xmin = -4;xmax = 8;
ymin = 0;ymax = 0.3;
res = 0.01;
domain = xmin:res:xmax;
sigma = 1.5;
f1 = @(x)normpdf(x,0,sigma);
f2 = @(x)normpdf(x,4,sigma);
linesize = {'LineWidth',2.5};
plot(domain,f1(domain),'-b',linesize{:});
hold on;... |
function [x] = Jacobi_sparse(G_values, G_colind, G_rowptr, c, tol)
% aplicare metoda Jacobi in aflarea lui x
prev_x = zeros(size(c)); % este x0
while 1
%calculam x de la pasul curent
x = csr_multiplication(G_values, G_colind, G_rowptr, prev_x);
x = x + c;
%verificam daca eroarea e mai mica decat tol... |
function [ res ] = abs_w_ni_u_v_neighbour_local( llcoord, params, paramsP,...
grid, tria_index, local_vertex_index )
%ABS_W_NI_U_V_NEIGHBOUR_LOCAL Summary of this function goes here
% Detailed explanation goes here
res = zeros(params.ndofs_per_element);
gids = ldg_global_dof_index(params, grid);
N = [grid.NX(t... |
%% 初始化工作空间
clc
clear all
close all
% 载入网络(网络名net)
load CSNetSpring.mat
global net counter
%设置图像显示计数器
counter=0;
%% 设置图像输入设备(image acquisition toolbox)
% 查看系统图像输入设备 imaqhwinfo
% Window 设备名称通常为 'winvideo'
%'YUY2_640x480'
vid = videoinput('winvideo', 3,'YUY2_640x480');
% 构造图形输出窗口
fig = figure('Visible',... |
% length_signal = 256;
%
% inputsig = idinput(length_signal,'rbs');
%
% inputsig = ceil((inputsig + 1)/2);
%
% Nq = 4;
% M = 2^Nq;
function [qam_modulated, M] = qam_mod(inputsig, M)
qam_modulated = qammod(inputsig, M, 'InputType','bit');
end
|
%TVdeblur_demo Demo script for TV deblurring algorithm
%
% This script illustrates the use of the TV deblurring algorithm
% implemented in the function TVdeblur; it produces Fig. 4 in the
% accompanying paper. The user can easily modify the script for
% other images, point spread functions, and noise levels.
%
% The s... |
clear; clc;
load data/default_data
nip_init();
[vol sampled] = nip_subsample_mesh(vol, 4000);
cfg.L = L(:,sampled);
cfg.t = 0;
model = nip_create_model(cfg);
clear cfg;
x = zeros([model.Nd , 3]);
aux = dip_pos(sampled,:);
[idx_act , d] = dsearchn(aux,[100 0 0]);
x(idx_act,:) = [1 1 1];
point = mean(vol.vertices)... |
function [d1,d2,d3,d4,d5,d6,d7]=fin_diff(fcn,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23)
%fin_diff
%
%[d1,d2,...]=fin_diff(fcn,p1,p2,...)
%
%Calculates the finite difference of a function fcn
%and its parameters from p1 up to p13.
%
%Ex: y=fcn(p1,p2,p3) where
%
%y = (fcn(p1*h,p2... |
function [dX,dY,dTip,dTilt,dFoc] = missalignment(bench)
% measure the miss alignment of the mirror
% measure it from a given phase screen or take a phase screen if not given.
% Return
% - dX: in m
% - dY : in m
% - dTip : in um rms
% - dTilt : in um rms
% - dFoc : un um rms
[dX,dY,dTip,dTilt,dFoc] ... |
function Build_Figs14ADG_Enolase_Plos1_CompBio_July2021
Script_DTWPathFigs_Build_AddCaption_Plos1_CompBio_July2021('14ADG');
figHandle = figure(1); text(-100, -100, sprintf('\\fontsize{20}%s', 'A) - 14'));
legend('DBA CONSENSUS', 'VOTED(DBA CONSENSUS)', ...
'SSG CONSENSUS', 'VOTED(SSG CONSENSUS)', ...... |
function [ry,rye,t,vary]=acfma(c,v,m);
%usage: [ry,rye,t]=acfma(c,v,n)
% c: numinator polynomium
% v: variance of innovation
% m: max number of lags
%
% ry: covariance function
% rye: cross covariance function
% t: time index
% Programmed 1994 by Niels K. Poulsen
% Department of Mathematical Modelling,
% Techn... |
clear all;
l1 = 1; l2 =1 ; r1 = 0.5 ; r2 = 0.5 ; m1 =12 ; m2 =12 ;
ix1 = 0.0125 ; ix2 = 0.0125 ;iy1 = 1.0025 ; iy2 =1.0025 ; iz1 =1.01 ; iz2=1.01 ;
%problem 1
pset = [5,15,40]; tset = [0, 1, 2];
a = 80; dt = 0.01;
[x1out,t]=LFPB_ViaPoint(pset,tset,a,dt);
T=0.0001;
t = t(1):T:t(end); N = length(t);
Kv = [0.05,0;0,0.0... |
% PrepareDataWavelengths(directory_search, directory_output)
%
% Prepares data collected with the NIRScoutX 64x32 system for analysis by
% creating a copy of the dataset that contains only the specified
% wavelengths. By default, these are 785 and 850.
%
% INPUTS:
% directory_search Path to the starting point of the... |
clear all
figure(1); clf;
termination = 100;
x = linspace(-2,1,640);
y = linspace(-1,1,480);
x_index = 1:length(x) ;
y_index = 1:length(y) ;
img = zeros(length(y),length(x));
N_total = 0;
for k=x_index
for j=y_index
z = 0;
n = 0;
c = x(k)+ y(j)*i ;%complex number
wh... |
barrel_1_start_x = 31;
barrel_1_end_x = 47;
barrel_1_start_y = 152;
barrel_1_end_y = 168;
barrel_2_start_x = 67;
barrel_2_end_x = 83;
barrel_2_start_y = 214;
barrel_2_end_y = 230;
barrel_3_start_x = 52;
barrel_3_end_x = 68;
barrel_3_start_y = 301;
barrel_3_end_y = 317;
barrel_4_start_x = 67;
barrel_4_end_x = 83;
barrel... |
function y = Derivative()
syms x;
y = diff(sin(x)+x+1);
end |
function output = F_calmat_ils(input)
if isfield(input,'filename')
filename = input.filename;
[ifg,~,paramas] = ImportOpus(filename,'SampleInterferogram');
warning('off','MATLAB:pfileOlderThanMfile');
fclose('all');
if rem(paramas.Instrument.GFW+paramas.Instrument.GBW,2) ~= 0
disp('Error: Number... |
function [botSim] = localiseOld(botSim,map,target)
% This function returns botSim, and accepts, botSim, a map and a target.
% LOCALISE Template localisation function
%% setup code
%you can modify the map to take account of your robots configuration space
modifiedMap = map; %you need to do this modification yourself
bo... |
function [trans_behav] = translate_collective(behav)
if strcmp(behav, 'Dismissal')
trans_behav = 'dismissal';
elseif strcmp(behav, 'Gathering')
trans_behav = 'approaching';
elseif strcmp(behav, 'Talking')
trans_behav = 'standing group';
elseif strcmp(behav, 'Walking')
trans_behav = 'walking group';
els... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.