text stringlengths 8 6.12M |
|---|
function [H,S]=createpredictors(F,G,N)
% Create H and S in the prediction X = Hx(k)+SU
% System dimension
[n,m] = size(G);
% H (F_pred)
H = zeros(n*N,n);
for j=1:N
H(1+n*(j-1):n*j,:)=F^(j-1);
end;
% S (G_pred)
S = zeros(N*n,N*m);
for j=2:N
for k=1:j-1
S(1+n*(j-1):n*j,1+m*(k-1):k*m)=F^(j-k-1)*G;
end;... |
%% Esempio Z&N in anello chiuso
clear, close, clc
s = tf('s');
G = 5/(s+1)^3;
figure(1)
P = nyquistoptions;
P.ShowFullContour = 'off';
nyquistplot(G,P), grid on
%% Prova a ciclo chiuso
% Kp = 1.2;
Kp = 1.6;
sysCL = feedback(Kp*G, 1);
figure;
step(sysCL);
% Osservazione: il diagramma di nyquist passa per il punto cr... |
function [envelope] = create_envelope_ifft(bw,Tlen,fs)
%This function creates a random envelope in the frequency domain. More
%efficient than time domain. Also not doing half wave rectification because
%that can add low frequency energy which is undesirable here.
noise_mod = makeNBNoiseFFT(diff(bw),mean(bw),T... |
function monitorCollectDataTimerEvent
global experiment
global ReportMsgHeard
if ReportMsgHeard == 0
disp('Heard NO Report Message');
monitorRunCollectData;
else
disp('Start collect data wait timer');
if experiment.reportCommand == 0
delay = 10;
else
delay = 1;
end
stop(experiment.t);
set(exper... |
% revisit a query from recorded data
% understand why under theta=1, when the part-worth estimate is close, we
% still don't get the optimal design
%% head
load('../basedata.mat');
addpath('../../Tools/liblinear/liblinear_weights');
addpath('./mcmc');
DX = dXID + dXID';
TEST = 20;
MAX_ITER = 1000;
inq = 100... |
classdef PDE %< handle
properties %(SetAccess = protected)
Op = [];
f = [];
delta =[];
dim = 0;
d=0;
m = 0;
%ndof = 0;
sym = false;
name= '';
AssemblyVersion='OptV3';
end
methods
function self=PDE(Op,f,delta)
if nargin==0, return;end
assert( strcmp(class(O... |
x = imread('bfly.jpg');
subplot(1,3,1);
imshow(x,[]);
title('Original')
x = double(rgb2gray(x));
x = padarray(x, [1,1], 0, 'both');
subplot(1,3,2);
imshow(x,[]);
title('Grayscale (after padding)')
edgedetection = x;
[m,n] = size(x);
a = [0,-1,0; -1,4,-1; 0,-1,0];
for i = 2:m-1
for j = 2:n-1
... |
function ecsr_k = kAbsError(obj,ypred,yactual,weights)
ecsr_k = weights*abs(ypred - yactual);
end
|
function pop_c = mutation_childrens (pop_c, nMutation)
nPop = numel(pop_c);
for k=1:nMutation
i=randi([1 nPop]);
p=pop_c(i);
pop_c(i).x = mutate(p.x);
pop_c(i).cost = cost_function(pop_c(i).x);
end
end |
function varargout = secretary(varargin)
if nargin==0
regdir='D:\users\peter\VMI\';
regfile='datasets.xlsx';
basepath='.\';
filename='comments.txt';
elseif nargin==1
regdir='D:\users\peter\VMI\';
regfile='datasets.xlsx';
basepath=varargin{1};
filename='comments.txt';
elseif ... |
function F = uq_PCK_eval_F( X, polyindices, PolyTypes, Input)
%computing the vector F for a experimental design X, polyindices, PolyTypes
%and the auxiliary domains defined in current_model
%% get the marginals for the pce polytypes
[PolyMarginals, PolyCopula] = uq_poly_marginals(PolyTypes);
%% transform X to U from... |
clear, clc
k = 0:20;
h = 10.^(-1.*k);
diff = ((9+h).^0.5-9^0.5)./h;
trunc = diff-(1/(2*9^0.5));
format shortG
headings = {'k', 'h', 'diff', 'trunc'};
tk = k';
th = h';
tdiff = diff';
ttrunc = trunc';
disp(table(tk, th, tdiff, ttrunc, 'VariableNames', headings))
|
function pob=cruzamiento2(nhijos,pob)
% Función que crea "nhijos" número de hijos a partir de los códigos
% genéticos que se encuentren en "xpadresbin"
% ///////////////FUNCIÓN DESARROLLADA POR DR. RIEMANN RUIZ//////////
%
% Parámetros de Entrada:
% "nhijos", número de hijos que se generarán
% "pob", estructura de la ... |
%% Intro
% This document verifies if the directional floating-body robot's GIE
% maxes out by the total mass of the robot. Analyzed a planar, 5-DoF,
% floating, serial robot on xy-plane. The first 3-DoF consist of px, py, rz of
% the torso(3), followed by 2-DoF of rz's of hip and knee.
%% Init
clear; clc; close all;... |
function dim_val=BoxCountfracDim(im)
%Calculate the Box count fractal dimension
%This code is based on the original Hausdorff (Box-Counting fractal
%dimension) from Alceu Costa at https://www.mathworks.com/matlabcentral/fileexchange/30329-hausdorff--box-counting--fractal-dimension
%However, it deploy the multi-resoluti... |
function mask_sector = compute_mask_sector(USInfo)
[x,z] = meshgrid(USInfo.x,USInfo.z);
x = x - USInfo.radius*cos(pi-USInfo.t0);
[t,r] = cart2pol(x,z); % to polar
r0 = 0;
rf = USInfo.radius;
th0 = USInfo.tf;
thf = USInfo.t0;
mask_sector = t < thf & t > th0 & r > r0 & r < rf;
% [x_edge,y_edge] = pol2cart(t(isedge),r... |
function [concatenatedSpikes] = RasterPlotRay(timeStart, timeEnd, Sweeps)
% function [concatenatedSpikes] = RasterPlotRay(timeStart, timeEnd, Sweeps)
%Raster Plot function. Plots the raster plot and returns the
%concatenatedSpikes to be used in the PSTHRay function.
% timeStart and timeEnd define the time period ... |
function xi = getTwist(obj)
% returns the twist vector of the rigid joint
%
%
assert(~isempty(obj.Type),'The joint type is undefined.');
assert(~isempty(obj.Axis),'The joint axis is undefined.');
switch obj.Type
case 'prismatic'
xi = [obj.Axis,zeros(1,3)];
c... |
function [envmm,header] = loadenv(filename,n,time)
% [envmm,header] = loadenv(filename,n,timerange)
% Loads waveform data but stores only the envelope
% See loadFromEnv to load a .env file
[fid,message] = fopen(filename,'r');
if (fid < 1)
error(message)
end
header = ReadAIHeader(fid);
% End of header
ShowAIHeader(head... |
function [imdata, ATTRIBUTES, VALUES] = load_omero_image_stack(session, image, varargin)
% Copyright (C) 2013 Imperial College London.
% All rights reserved.
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Softwa... |
function vel = velocity_interp(xxq, yyq, t ,xx, yy, uu, vv)
% function [uuq, vvq] = velocity_interp(xxq, yyq, t ,xx, yy, uu, vv)
% interpolation sur meshgrid
uuq = interp2(xx,yy,uu,xxq,yyq, 'linear', 0);
vvq = interp2(xx,yy,vv,xxq,yyq, 'linear', 0);
vel = zeros(size(uuq,1), size(uuq,2), 2);
vel(:,:... |
clc
clear
filepath = 'D:\matlabproject\hmm\TRAIN1\0a.wav'; % 可以按自己的路径设置
[X, fs] = audioread(filepath);
x_mel_graph = mfcc_m(X,fs, 24, 160, 80); % 求mel系数
[R, C] = size(x_mel_graph); % 获取图像大小
subplot(511);
image(x_mel_graph);
title('initial mel image');
% Time Warping
% 图像向右移位,其余部分由随机噪声填充
% R:时间轴 C:频率轴
X_T... |
function y = filtro_w(w)
if abs(w) < 0.001
y = 0;
end
end |
clear;
clc;
root = '/home/xwhu/dataset/UCF-shadow/train_argu/';
%root = '/home/xwhu/data/UCF-shadow/test';
res = dir(fullfile(root,'*.jpg'));
gt = dir(fullfile(root,'*.png'));
fid = fopen('/home/xwhu/shadow/caffe-RADF-master/data/UCF/train_argu.txt','w');
for i=1:length(res)
fprintf(fid,'%s', res(i).na... |
%[H_est, v] = channel_estimate_SIMO(x_p, y_p, f_interp, t_interp, avg, method='LS')
%[H_est, v] = channel_estimate_SIMO(x_p, y_p, f_interp, t_interp, avg, method='MMSE', N_fft)
%
% Estimates the wireless channel matrix H using Least-Squares or
% Minimum Mean Squared Error method. Performs interpolation of
% estimated... |
function [ val,grad ] = HuberFunction(u,lambda)
%HuberFunction Sum of the value of the huber function and its gradient at each
%point
uAbs = abs(u);
thresholdCriteria = uAbs<=lambda;
val = zeros(size(u));
grad = zeros(size(u));
val(thresholdCriteria)=0.5*uAbs(thresholdCriteria);
val(~thresholdCriteria)=lambda*uAbs(... |
% 利用神经网络的残差,基于否定选择算法进行分类
clear;
clc;
dataset = load('err_dataset');
detector_size = 100;
min_dist = [0.05,0.0005,0.05,0.01,0.005,0.05];
for sensor_type = 1:6
fprintf('sensor:%d\n',sensor_type);
detectors{sensor_type} = generate_detectors(detector_size,dataset.err_events_train{sensor_type},min_dist(sensor_type))... |
%% EXAMPLE 2 : SOLVE A FUNCTION
clc
clear all
close all
% Parameters
port_Input = 9997 ;
port_Output = 1110 ;
packet_Length = 1e6 ;
timeout = 100 ;
while 1 % BREAK THE LOOP WITH CTRL + C
msg = [] ;
while isempty(msg) % While no msg Received
try
msg = judp('RECEIVE',port_I... |
%% MAIN FILE FOR THE SOFTWARE ACCOMPANYING:
%
% Title: "Altered bile acid kinetics contribute to postprandial
% hypoglycaemia after Roux-en-Y gastric bypass surgery "
%
% Authors: M. van den Broek, L.J.M. de Heide, F.L.P. Sips, M. Koehorst,
% T. van Zutphen, M. Emous, M. van Faassen, A.K... |
function Wv = Deriv(obj,dt)
% waveform derivative
% dt, dirivative step length, default 0.1, unit: 1/sampling frequency
% Copyright 2016 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
obj = copy(obj); % do make a copy!
if nargin == 1
dt = 0... |
function r = getGlobalSvw
global straight_view_width
r = straight_view_width; |
function l = fitvanmises(x,y)
testx = 1:180;
p = [10,2,pi/2,2];
end
function [p, resnorm, rsquared] = fit_vanMises(x,y)
%[A k phi offs]
range = max(y)-min(y);
if range~=0
p0 = [range/2, pi, (max(y)+min(y))/2];
lb = [.5*(range/2),0,min(y)];
ub = [1.5*(range/2),2*pi,max(y)];
... |
% Copyright (c) 2016 by Brian DiZio <brian.a.dizio@gmail.com>
% Permission is NOT granted for all other uses -- please contact the author for details
% Convert units
[lats,lons,els,ts]=readGPX('gpstrackA.gpx');
r=6378100; % Radius of earth
lons_m=cos(lats.*pi./180).*pi.*r.*lons./180; % Convert degrees to miles
lats_m=... |
function datafolder = RunSpinDepArray(...
fastring,...
Sig,...
OAM,...
nusp,...
nturns,...
npart,...
freq,...
kickampl,...
nproc,...
InPol,...
oarspecstring,...
DirectoryLabel )
%
% function datafolder = RunS... |
classdef CMMdataset
properties
name
type
data
end
methods
function Obj = CMMdataset(dataIn)
Obj.data = dataIn;
end
function output3D(Obj, plotOutput, type, res)
X = Obj.data(:,1);
Y = Obj.data(:,2);
Z = Obj.data(:,3... |
function [ crcBits,dataBitsCrc ]= calcCrc(msg,g_x)
%% CRC bits generieren 802.11a msg binär
if nargin==1
g_x=[1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 1 1];%generatorpolynom
end
%data = dectobin(msg,8,'msb');
data = [msg zeros(1,length(g_x)-1)];
data(1:32) = bitcmp(data(1:32),1);
... |
% % ICT4HEALTH LAB.5
% % ANI DEVER s225055
clear variables; close all; clc,tic;
%% preparing the data
load('chronickidneydisease.mat');
y = chronickidneydisease;
keylist = {'normal','abnormal','present','notpresent','yes','no','good','poor','ckd','notckd','?',''};
keymap = [0,1,0,1,0,1,0,1,2,1,NaN,NaN]; % it is better... |
% Use these commands to convert from portal time to actual time.
% Portal time starts at day 1, 0:00:00. Actual time start depends
% on the animal.
%
% On the portal, navigate to the event you want to look up. Note the time
% of the event, ie, Day 2 08:44:10. Enter this below, ie, portalTime =
% datenum('02:08:44:... |
addpath('functions'); % Make the 'functions' folder accessible to this script...
options = [];
thesis_config;
save_workspace = true; % Just a helper variable...
if isfile([options.workspace '.mat']) && options.load_workspace
disp(['Loading saved workspace from ' options.workspace])
tmp_options = options;
... |
clear;
load '../../matfiles/finalPyramids.mat';
load '../../matfiles/finalPyramidLengths.mat';
load '../../matfiles/modelNames.mat';
addpath('../../utils/libsvm-mat-3.0-1');
p = 0.5;
labels={};
for j=1:12
labels{j} = zeros(pyramidLengths{j}, 1);
end
bc=[];
bestcv = 0;
for k=1:12
testLabels = labels;
tes... |
%% Read in data
endurance_track_points = readmatrix('lat_long_endurance.csv');
%% Transform the data
X = [];
X = endurance_track_points(:,2)*pi/180*6371*1000.*cos((endurance_track_points(:,1)*(pi/180)));
X = X(:,1) - X(1,1);
Y = [];
Y = endurance_track_points(:,1)*pi*6371*1000/180;
Y = Y(:,1) - ... |
clear all;
height=100;
width=100;
ColMap=[1,1,1; 0 0 0]
OCC=load('/home/xiaoling/SpiralWave/data/Spi7_n5Rho0t240p420c10_OCCin.dat');
Y=floor(OCC/width);
X=rem(OCC, width);
Y=Y+1;
X=X+1;
SpiHead=[50 44 45 45 44 48 48 51 53 50;
18 19 27 39 49 47 41 31 23 18];
f... |
function [] = AddNFMSO(date,Add_dummies)
%adds [Add_dummies] # of NFs to simulated MSO data
addpath('../../Neuron Analysis Functions')
load(['MseqAnalyzed_' date '.mat'])
fs = 48828.125;
for i = 1:numel(data_MOVN)
MOVN_i = data_MOVN{i};
Mseq_StepDur = MOVN_i.Stimuli.MSeq_StepDuration;
Mseq_N = MOV... |
%170603108 自动化17-1 杨佳男
function A=myfft(x,N)
%N=length(x);
x=x(1:N);
A=zeros(1,N);%中间数组,用于存放每次蝶形运算的结果
T=log2(N);%此处T为执行蝶形运算的次数
%先将x整理成适合蝶形运算的形式
xlast=x;
for t=0:T-1%当前轮次t
for section=1:(2^t)%将整个数组分成2^t段中的第section段
sectionlength=N/(2^t);
startpoint=(section-1)*sectionlength+1;%每一段的开始位下标
for n=... |
%-------------------------------------------------------------------------
% Accelerometer Magnitude Source Code
%-------------------------------------------------------------------------
% Updated: 5/14/2016
%
% This source code does the following:
% 1. Specifed the COM port that the arduino or Xbee ... |
function [Jd, Js, Ja, Jm] = FourIdentity()
% FourIdentity.m
% 4th-order identity tensors
%
% Output: Jd, 4*4*4*4 matrix
% Js, 4*4*4*4 matrix
% Ja, 4*4*4*4 matrix
% Jm, 4*4*4*4 matrix
%--------------------------------------------------------------------------
% delta
delta = [1 0 0;... |
clear;
clc;
close all;
load TEPdata\mode1_normal;
load TEPdata\mode1_idv1;
load TEPdata\mode1_idv2;
load TEPdata\mode1_idv3;
load TEPdata\mode1_idv4;
load TEPdata\mode1_idv5;
load TEPdata\mode1_idv6;
load TEPdata\mode1_idv7;
load TEPdata\mode1_idv8;
load TEPdata\mode1_idv9;
load TEPdata\mode1_idv10;
load TEPdata\mode1... |
% Closer
%% Data Import
% Data should be delimited in Excel to consist of
% Rows - frames
% Columns - No. of fish * 2 (lights then fish)
% Data should then be imported as three matricies
% Lights_Binary - the light status of each fish @ every frame as either:
% 0 - off
% 1 - on
Lights_Binary = Untit... |
function SimuPop = DrawPopulation(cfg,zeroinfec)
% SimuPop = DrawPopulation(cfg,zeroinfec)
%
% Draw population from specific parameter set in struct cfg, obtained by
% calling:
%
% cfgHyper = InitHyperConfigs;
% cfgRandom = InitRandomConfigs(cfgHyper);
% cfg = CalibrateConfigs(cfgRandom);
%
% zeroinfec = 1 (default) ... |
function preparePlotTrajectory(figureTitle)
if ~exist('figureTitle', 'var')
figureTitle = 'Trajectory';
end
global trajectoryPlotHandle trajectoryAxis
% define base colors
lineColor(1, :) = [1 0.25 0] * 0.75;
lineColor(2, :) = [1 1 1] * 0.75;
lineColor(3, :) = [1 1 1];
... |
function [v] = endpoint_diff(f, p, h, points)
% Endpoint Formulas for Differentiation
%
% Approximates f'(p), given f and p.
%
% Error : 3 Point : |e| <= h^2 / 3 f^(3) (xi)
% 5 Point : |e| <= h^4 / 5 f^(5) (xi)
% Notes : Prone to roundoff error, an optimal h != 0 exists
%
% ... |
function dydt = NFmodel(t,y,theta) % theta(1)=net mineralization rate; theta(2)=alpha_min;
% theta(3)=nitrification rate;
% theta(4)=alpha_amo;
% theta(5)=nitrate consumption
... |
function [inv_sharp, amp] = opt_DispComp(CX, ...
img, sharps, isC2, CY, roi)
%opt_DispComp optimizes the dispersion compensation coefficients
% todo: write detailed description
%% Get simple indexing variables
n=size(img,1);
p=1:n;
k0=n/2;
%% Get dispersion compensation vector
if isC2
Gc = exp(1i*(CX*(p-k0)... |
function overlap_dendroplot(l_tree,varargin)
%this function plots a dendrogram with the supplied hierarchical tree
%information, colors the clusters in it and then also displays an arbitrary
%matrix of parameters underneath, followed by the soma depths of the cells
%provided
%Parameter list
%1) Distance tree ... |
function ratio=nanratio(num,denom)
% ratio=NANRATIO(num,denom)
% Return the fractional mean ratio of num/denom: calculate average ratio
% as a fraction num/(num+denom) to avoid numerical instibility for small
% values of denom.
ratio = fracttoratio(nanmean(num./(num+denom))); |
function get_roi_from_file( image_filename )
%GET_ROI_FROM_FILE Summary of this function goes here
% Detailed explanation goes here
[pathstr, name, ext] = fileparts(image_filename);
i = imread(image_filename);
figure;
imshow(i);
stillCutting = true;
class_list = {};
bboxes = [];
while stillCutting
bbox... |
function f1=matrix_maker1D(f,lx);
% lx size spatial scale of square matrix you want
f1=zeros(lx,length(f)/(lx));
for i=1:length(f)/lx;
f1(:,i)=f(lx*(i-1)+1:lx*i);
end
%f1=(fliplr(f1))';
f1=f1';
pcolor(f1);
shading interp; |
% answer for matlab problem 1
%% matlab 1
figure()
f = randn(256); % generate the random noise
PQ = paddedsize(size(f)); % padding
F = fft2(f, PQ(1), PQ(2)); % fft
[U, V] = dftuv(PQ(1), PQ(2));
H = 1./(U.^2+V.^2); % prepare H
H(1,1) = 0;
G = H .* F; % passing the filter
g = ifft2(G); % inverse fft
g = g(1:size(f,1)... |
function [result_u_F, result_v_F, result_w_F] = Calculate_uvw_F()
%UNTITLED 此处显示有关此函数的摘要
% 此处显示详细说明
global x_F y_F z_F
global p q r
global u v w
result_u_F = u + z_F*q - y_F*r;
result_v_F = v + x_F*r - z_F*p;
result_w_F = w + y_F*p - x_F*q;
end
|
function wallEndedFlag = pledgeDetectWallEnded(cursor, imgBinary, direction)
% Looks at the border of the area left to the current direction. Detects
% the end of a wall which we currently follow.
%
% INPUT
% cursor ... (x,y) coord. of the area center
% imgBinary ... binary represenation (wall=0, way=1)
% ... |
%% Create impulse train
clear;clc;%close all;
%__________________________________
pos = 7;
c = 3e8; % m/s
freqStartGHz = 2.0; % GHz
freqEndGHz = 2.4; % GHz
posRx = 165+100j; %position of fixed receiver in inches
% Testcase for Tx position
% requires Excel ... |
clear;clc;%close all
dates_all={'Mar_21_13' 'Apr_12_13' 'May_30_13' 'May_31_13'... %used different depolarized current range: 'Mar_19_13' 'Mar_21_13'
'May_31_13' 'May_31_13' 'Jun_24_13' 'Jun_24_13' 'Jul_03_13' 'Jul_03_13'...
'Jul_29_13' 'Jul_29_13' 'Aug_05_13' 'Aug_16_13' 'Sep_05_13' 'Sep_16_13'...
'Oct_0... |
%script9_5.m
total=0;
num=2;
while num<=100
if isprime(num)
total=total+num;
end
num=num+1;
end
fprintf('snm=%d\n',total) |
%Oppgave 5
%Tar inn en vektor og returnerer to indeksvektorer, stigende og synkende.
function [indvec1,indvec2] = finSort(vec)
len=length(vec)
indvec1=1:len;
indvec2=1:len;
for i = 1:len-1
indlow= i;
indHigh = i;
for j= i+1:len
if vec(indvec1(j)) > vec(indvec1(indlow))
indlow = j;
... |
function x=freqrotate(x,y)
%rotates any array x to the left by y steps
x(1:y)=fliplr(x(1:y));
x(y+1:length(x))=fliplr(x(y+1:length(x)));
x=fliplr(x);
end |
function [nearestValue,nearestValueIdx] = find_nearest_value( values, target )
% Elizabeth Spencer Sept 22 2019
%
% FIND_NEAREST_VALUE find the values in a vector that are closest to target
% measurements of interest.
% INPUTS:
% values = vector of numbers that you want to match your target
% target = vector of val... |
%Testing Rotation Differences
a = rand(3,1)*10;
da = rand(3,1)*0.1;
a = [3.1416; -1.5707; 1.5708];
b = [-0.0000; -1.5702; -1.5708];
yaw = a(1);
pitch = a(2);
roll = a(3);
R1 = angle2dcm(yaw,pitch,roll)';
R1z = rotz(yaw);
R1y = roty(pitch);
R1x = rotx(roll);
R2 = angle2dcm(b(1),b(2),b(3))';
R2z = rotz(b(1... |
function [u, v] = dg_windpol2cart(compassdir, mag)
% synopsis: function [u, v] = dg_windpol2cart(compassdir, mag)
%
% This function converts wind compass (from) direction in degrees and the
% magnitude, to the cartesian u & v components.
%
% DG 20091216
dbstop if error
%display('[u, v] = dg_windpol2cart(compassdir, m... |
function [Xinversed] = denormalize(X, param1, param2, normalization)
%DENORMALIZE Denormalize the data wrt to the normalization technique passed in
%parameter and param1 and param2 calculated during the normalization step
%normalization step
%
% input -----------------------------------------------------------------
... |
function Y = rowdec(X, h)
%ROWDEC Decimate rows of a matrix
% Y = ROWDEC(X, H) Filters the rows of image X using H, and
% decimates them by a factor of 2.
% If length(H) is odd, each output sample is aligned with the first of
% each pair of input samples.
% If length(H) is even, each output sample is align... |
function flush_water(sDur)
% flush water
% 2018 HRK newly created from test_water_value.m
%% initialize the channel
VirMEn_Def
SR = 5000;
daqreset
vr.ao = analogoutput('nidaq','dev1');
addchannel(vr.ao,[0 1]);
set(vr.ao,'samplerate',SR);
vr.ai = analoginput('nidaq', 'Dev1'); % connect to the DAQ card
% 0 : dX, 1: dY, ... |
function [ num_frame ] = extraction_num_frame( nom_image, motif )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
info = regexp(nom_image, motif, 'tokens');
% info = regexp(nom_image,'(\d+).png','tokens');
% disp (info{1}{1});
%
% if isempty(info)
% info = regexp(nom_i... |
function [ p1, p2 ] = FindDensePair(I1, I2)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
addpath('functions_nonrigid')
addpath('functions_affine')
% Compile the mex files
% compile_c_files
tic
% affine registration
[optimizer, metric] = imregconfig('multimodal');
optimizer.InitialR... |
P_Q = [1,0];
[d,a,c] = unique(P_Q,'legacy'); |
function [dxi,stop_condition,energy] = bearing_only_rendezvous_using_enclosing_circles(L,xi)
% This function implements a Bearings-only controller using the smallest enclosing circles
% of pseudo-positions of the neighbors based on bearing measurements
% The algorithm is based on the following reference:
% Kriegleder... |
%skrypt służący do rysowania wykresu analizującego
%prędkość wyznaczania miejsc zerowych przy użyciu metody Newtona w zależności od stopnia wielomianu
%zmieniamy tylko x, a, d, N według naszych preferencji
x = 1:0.1:1.9;
a = [1, 1, 0, 0, 0, 0;1, 1, 1, 0, 0, 0;1, 1, 1, 1, 0, 0;1, 1, 1, 1, 1, 0;1, 1, 1, 1, 1, 1];
d = 0.... |
classdef TotalDOFComputer < handle
properties (Access = public)
totalDOF
end
properties (Access = private)
numberofNodes
nNodesperBar
end
methods (Access = public)
function obj = TotalDOFComputer(s)
obj.init(s);
end
... |
clear all
clc
syms x
disp('MÉTODO DE STEFFENSEN')
fprintf('---------------------------\n');
Gx=input('Función g(x): ');
p0=input('Valor de Po=');
errorPrecision=input('Precisión: 10^-');
errorPrecision=10^(errorPrecision*-1);
p1=subs(Gx,p0);
p2=subs(Gx,p1);
P=p0-((p1-p0)^2/(p2-2*p1+p0));
n=1;
error=abs(P-p0);
fprintf('... |
function [NPCP] = PCP(title, fs, frame_size)
T = 24;
song_snip = songExtract(title,T);
%frame_size = round(fs/1.6) + 1; % to obtain resolution capturing smallest distance between chroma
frame_size = 2048;
K = frame_size/2 + 1;
num_frames = floor(size(song_sni... |
function Y_gray=gray_prediction(X0,Y0,N)
%gray_prediction.m
%X0 自变量
%Y0 应变量
%N 预测后面N个数
n=length(Y0);
lamda=Y0(1:n-1)./Y0(2:n) %求级比
range=minmax(lamda)
y1=cumsum(Y0); %累加
for i=2:n
z(i)=0.5*(y1(i)+y1(i-1));
end
B=[-z(2:n)',ones(n-1,1)]; %构造矩阵B和向量Y
Y=Y0(2:n)';
u=B\Y
x=dsolve('Dx+a*x=b','x(0)=x0');
x=subs(x,{'a','b'... |
%% gradient checker
%baseline x
clear;
modelName='human_3';
warning on verbose
%add share functions
addpath dyn/
addpath obj/
addpath gaitCon/
addpath plotRobot/
dbstop if error
addpath (['../',modelName,'/robotGen/'])
addpath (['../',modelName,'/robotGen/grad/'])
addpath (['../',modelName,'/robotG... |
function [ri, averageAccuracy, ri1, averageAccuracy1, wid] = udfFuzzyArtClustering( data, param, gt)
[wid,globalCluster,~] = fuzzy_art( data, param.rho,...
param.alpha, param.beta,...
param.max_epoches, param.prune);
%%transform to ... |
function [angles, acc] = imuprocess(N, Tc, param, prog)
rot_cycles = 0;
Acc1Theta = param.Acc1Theta; dTheta1 = param.dTheta1;
Acc1Psi = param.Acc1Psi; dPsi1 = param.dPsi1;
Nu1 = param.Nu1; Nu2 = param.Nu2;
Acc3Theta = param.Acc3Theta; dTheta3 = param.dTheta3;
Acc3Psi = par... |
%Dylan Balata
%section 005
clc
clear
close ALL
hkm=100; %max height in kilometers
hm=hkm*1000 %max height in meters
sf=25000; %starting height in feet
si=sf*12; %starting height in inches
scm=si*2.54; %starting height in centimeters
sm=scm/100 %starting height in meters
dt=hm-sm %distance traveled in meter... |
function kl=KLDz(X,Z,M)
%mui=MUIz(X,Z,M)
%Simple (1D) KL-divergence using histograms.
% X should be 1 x n array of n observations of the realizations of a
% 1-dimensional continuous-valued random variable X, Z should be a
% 1 x n array of the observations of a 1-dimensional two-valued ({0,1})
% random variable Y. The... |
function phi_end = get_phi_end( params, C, xspan )
% Find the \Phi(xspan(2)) value after the shooting from the xspan(1)
% using the asymptotical behaviour 'asympt'
%
% INPUT:
%
xstart = xspan(1);
% From the asymtote of the solutions
asympt_params = @(x) asympt(params, C, x);
% Derivative
eps = 1e-12;
... |
% Camera Setup
%---------------------------------------
vid = videoinput('gentl', 1, 'Mono8');
src = vid.Source;
triggerconfig(vid, 'manual'); % Configure the object for manual trigger mode.
vid.triggerrepeat = Inf;
vid.FramesPerTrigger = 1;
src.ExposureMode = 'Timed'; % Set exposuretime
src.ExposureTime = 2000... |
function [rgImg, gcampImg, tdTomatoImg] = inhibit_gcamp_merge(mouse, imagingFolder, mdfFileNumber, savefigs, plotA, removeBadA, qhg)
% Merge red (after bleedthrough correction) and green channels, and
% superimpose contours of identified inhibitory neurons.
if ~exist('savefigs', 'var')
savefigs = 0; % if 1, figur... |
% This code is about Delta A/C flight condition (2) dynamics in longitudinal and lateral modes with all degrees of freedom of approximation
% And use pole placement (Aker) and LQR methods to controll some states as follow in the code
% You must fill INPUT DATA section to get solution
%% Coded by
% Mohamed Mohamed ... |
function dx = pendulumSystem(x,A,P,grid,dyn)
% dx = pendulumSystem(x,A,P,pendulum)
%
% This function computes the closed loop dynamics of the pendulum, using
% the optimal controller from the MDP solve
%
th = x(1,:);
w = x(2,:);
u = pendulumController(x,A,P,grid);
dw = pendulumDynamics(th,w,u,dyn);
dx = [w;dw];
end |
function p = ps_adm(Y, p_init, tau, tol, max_iter)
done = false;
iter = 0;
p_old = p_init;
while ~done,
iter = iter + 1;
x = soft_thresholding(p_old' * Y, tau);
p_new = proj_sphere(Y * x');
if norm(p_old - p_new) < tol || iter > max_iter
done = true;
... |
NOx_CONFIG = Simulink.ConfigSet;
NOx_CONFIG.set_param('Name', 'Configuration');
NOx_CONFIG.set_param('Description', '');
NOx_CONFIG.switchTarget('ert.tlc','');
NOx_CONFIG.set_param('Solver', 'FixedStepDiscrete');
NOx_CONFIG.set_param('StartTime', '0.0');
NOx_CONFIG.set_param('StopTime', '1000');
NOx_CONFIG... |
function [A] = integerize(x)
x=(x(:))';
for i=1:size(x,2)
if rem(x(i),1)~=0
A='NONE';
return
end
end
u=max(abs(x));
if -1*u==min(x)
u=u-1;
end
if u<= 2^7-1
A=class(int8(u));
elseif u<=2^15 - 1
A=c... |
% Set up joystick
disp('Connecting to Xbox Controller... ');
XBOX_CONTROLLER = vrjoystick(1);
disp(caps(XBOX_CONTROLLER));
%disp(INSTRFIND);
POLL_RATE = 0.1;
% Xbox 360 controller mapping
% 1 - A Button
% 2 - B Button
% 3 - X Button
% 4 - Y Button
% 5 - L Bumper
% 6 - R Bumper
% 7 - Back Button
% 8 - Start Button
%... |
function [A,C] = tdiffcoeff(nx,nz,d,lamdam,Tbr,Tbl,Tbb,Tbt,Ttopconduction)
%this function builds matrix and column vector coefficients that
%are needed to solve the implicit form of the temperature advection-
%diffusion equation. A and C are coefficients such that in the
%absence of fluid flow, dT/dt = AT+C, using a ... |
clear all;
clf;
M0=zeros(256,256);
M0(1:256,1:100)=0;
M0(1:256,100:200)=0.5;
M0(1:256,200:256)=0.9;
subplot(2,3,1)
imshow(M0,[]);
title('input image');
N=256;
a=0;
b=0.2;
r = a + (b-a).*rand(N,N);
M = M0 + r;
subplot(2,3,2)
imshow(M-M0,[]);
title('uniform noise');
subplot(2,3,3)
imshow(M,[]);
title('noisy im... |
function MSDData = calculateMSD(data,windowSize)
% if nargin == 1
% windowSize = 210;
% end
% MSDData = zeros(size(data));
% num = numel(MSDData) - windowSize + 1;
% for i = 1:num
% temp = data(i : ( i + windowSize -1 ) );
% MSDData(i) = sqrt(mean((temp - mean(temp)).^2));
% end
if nargin == 1
windowSi... |
function [Zeq] = calcZeq(Xeq,Req)
Zeq = sqrt( power(Xeq,2) + power(Req,2) ) ;
end
|
function [lambda, phi, d] = KLE(l, a, d, t, err)
% [X, d] = uq.KLE(l, a, d, t, NS, mu, err)
% Performs the Karhunen--Loève Expansion (KLE)
% of a random process X(t,w) with exponential covariance
% of the form Cxx = exp(-abs(t1-t2)/l), with t in [-a, +a]
%
% Input arguments:
% l - Correlation length
% a - L... |
function [ ] = make_ace_climatology_serialmonth_by_eql( tanstruct, out_directory)
%A function to create zonally averaged climatologies of ACE measurements,
%by each unique calendar month. 'make_ace_climatology_by_eql.m' is called
%here.
% *INPUT*
% tanstruct_in: STRUCTURE - contains the gas specific ACE data... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.