text stringlengths 8 6.12M |
|---|
function [lfs, mask_ero] = resharp_lsqr(tfs,mask,vox,ker_rad,iter_num)
% [LSF,MASK_ERO,RES_TERM,REG_TERM] = RESHARP(TFS,MASK,VOX,KER_RAD,ITER_NUM)
%
% LFS : local field shift after background removal
% MASK_ERO : eroded mask after convolution
% RES_TERM : norm of data fidelity term
% REG_TERM ... |
%% hexMeshSphere
% Below is a demonstration of the features of the |hexMeshSphere| function
%%
clear; close all; clc;
%%
% Plot settings
figColor='w'; figColorDef='white';
fontSize=15;
faceAlpha1=1;
edgeColor=0.25*ones(1,3);
edgeWidth=2;
%% Creating a hollow hexahedral mesh sphere
% Creating a sol... |
clear all
close all
% trzy_palce = 0.5*0.8354;
%
% % there and back again
% utx = [0.8 4 7 10];
% ux = [0 0.2 -0.4 0.2];
%
% uty = [0.8 4 7 10];
% uy = [0 0.2 -0.4 0.2];
% uty = [0.8 2 3];
% uy = [0.2 -0.4 0.2];
% utx = [1 2 3];
% ux = [0 0 0];
% there and stop
% utx = [1 3 10];
% ux = [0.5 -0... |
classdef Frame < NumberedFile & dynamicprops
%
% \author M.Moriche
% \date 25-05-2013 by M.Moriche \n
% Modified
% \date 07-06-2013 by M.Moriche\n
% Modified
% \date 07-06-2013 by M.Moriche \n
% Imported from trunk/ibmpi and set to
% work with ibsharp. Basic change, add readh5frame
% \date 17... |
clear; clc; close all;
datasize = 16383;
ksize = 500;
dataset = rand(datasize,3);
kdataset = rand(ksize,3);
tree = build_tree(dataset);
%% 최근접 점 찾기 (유클리드 거리)
tic
dist = ones(1,datasize);
index_k = zeros(1,ksize);
for i = 1 : ksize
for j = 1 : datasize
dist(j) = norm(kdataset(i,:) - dataset(... |
classdef ModelList
% List of different models. We fit them all.
% Subsequent calls to logprob/ predict/ impute use either best plugin model
% or use Bayesian model averaging.
properties
models;
bestNdx; % plugin
bestModel;
selMethod = 'bic';
predMethod = 'pl... |
experiment.name = 'standard';
tq1=35.6
tq2=35.5
tq3=34.9
tq4=35.8
cool1=24.8
cool2=24.8
cool3=25
cool4=24.5
%trial 1
experiment.protocol(1).trial_duration = 60;
%pattern control
experiment.protocol(1).pattern_ID = 1;
experiment.protocol(1).gain_bias = [0,0,0,0];
experiment.protocol(1).pat... |
clc;clear all;close all;
N =1024;%depth
m = 32;%width
%Read .csv
row = 1;%row 2 in csv
col_i = 3;%col 4 in csv
col_o = 4;%col 5 in csv
input_0 = csvread('iladata.csv', row, col_i,[row,col_i,row + N-1,col_i]);
output_0 = csvread('iladata.csv', row, col_o,[row,col_o,row + N-1,col_o]);
%After csvread
input_1 = abs(input_0... |
% 11.3.4 PSD_2012_v2.m
%This program will take the PSD of an image and fit it
%most updated as of Jan 2012
function [cfun gof log_radial_freq log_radial_psd_N h ]= PSD_2012_v2(im, N, percent1)
% This function calculates the PSD of an image and then fits the PSD three times with random
% initializations of fit parameter... |
function [ H ] = est_homography(video_pts, logo_pts)
% est_homography estimates the homography to transform each of the
% video_pts into the logo_pts
% Inputs:
% video_pts: a 4x2 matrix of corner points in the video
% logo_pts: a 4x2 matrix of logo points that correspond to video_pts
% Outputs:
% H: a 3x3 h... |
%%
% take a CAL!
%%
fm = 2.3e9;
piezo_smoothset(-3);
pause(1)
initZNB_narrow;
znb2.scan;
figure;
plot(znb2.data.f,abs(znb2.data.z));
data_narrow_dark = znb2.data;
pause(1)
initZNB;
znb2.scan;
figure;
plot(znb2.data.f,abs(znb2.data.z));
data_broad_dark = znb2.data;
%%
% znb.tr(1... |
function [ R ] = AverageArray( )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
% let M be matrix containing users and their respective rating
%M = dataset('xlsfile',file);
%M(1:50,:);
%M.user_id=nominal(M.user_id);
M = dataset('xlsfile','ubr.csv');
... |
function elem = atbaselem(famname,method,varargin)
%ATBASELEM Create an AT element structure + various checks
%
%ELEM=ATBASELEM(FAMNAME,METHOD,'FIELDNAME1',VALUE1,...) create AT element
% Create an AT element structure and check the consistence of
% PolynomA, PolynomB, MaxOrder and NumIntSteps
%
% NOTES
% 1. l... |
% Convert table to cell array of structs
% Columns that begin with nonlin are concatenated to a single string
specs = readtable('testinput.xlsx')
specs2 = readtable('testinput.xlsx', 'Sheet', 2);
isempty(specs2)
nonlincols = strncmpi('nonlin',specs.Properties.VariableNames,6);
nonlinvars = table2cell(specs(:, n... |
function data = getdata(this)
data = this.data;
end |
function y = logdet(A)
% log(det(A)) where A is positive-definite.
% This is faster and more stable than using log(det(A)).
% Written by Tom Minka
% (c) Microsoft Corporation. All rights reserved.
U = chol(A);
y = 2*sum(log(diag(U)));
|
%--------------------------------------------------------------------------
% This function computes the potential and the kinectic energy during the
% simulation of the triple pendulum
%--------------------------------------------------------------------------
function [PE, KE] = postprocess_energy(z,param)
l1 = para... |
function [LH, probSpike, V, mean_predictedSpikes, RPE] = ott_RW_V_mean(startValues, spikeCounts, rewards, timeLocked)
probSpike = poisspdf(spikeCounts, mean(spikeCounts)); % mask rateParam to exclude trials where the animal didn't lick fast enough
mean_predictedSpikes = mean(spikeCounts);
if any(isinf(log(prob... |
% Micol Marchetti-Bowick
% CMU School of Computer Science
% Adapted from Ankur Parikh
% generates Gaussian samples
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function sampleMatrix = GenerateData(precisionMatrix,NUM_SAMPLES)
[V ~] = size(precisionMatrix);
meanVector = zeros(1,V)... |
function [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V)
%DSBUS_DV Computes partial derivatives of power injection w.r.t. voltage.
% [DSBUS_DVM, DSBUS_DVA] = DSBUS_DV(YBUS, V) returns two matrices containing
% partial derivatives of the complex bus power injections w.r.t voltage
% magnitude and voltage angle respect... |
function draw_API = defaultCircle(h_group)
%
% DRAW_API.setColor
% DRAW_API.updateView
% DRAW_API.getBoundingBox
%
% initialize variables needing function scope
bounding_box = [];
%h_axes = iptancestor(h_group,'axes');
% The line objects should have a width of o... |
clc, clear
close all
bandwidth = 10 * 2 * pi;
%% Object
K = 1.56 * 180 / pi;
taue = 0.0039035;
taum = 0.984871194396488;
G = tf(K, [taue * taum, taum, 1, 0]);
%% 加入惯性环节
T = 1 / (bandwidth / 2 / pi) / 15;
Inertial = tf(1, [T, 1]);
G = G * Inertial;
%% 给定频率点
fre = logspace(-1, 2.3) * 2 * pi; %% 1 - 100
[mag, phi] = ... |
% matrice réponse DQ/ Dx sur dispersion
% on cherche M tel que dX = M dQ par famille
pourcentage=0.01;
wait=2;
M = [];
fprintf('***************************\n')
for k= [1 2 3 4 5 6 7 8 9 10]
x0=getx;
quad_name = strcat('Q',num2str(k));
val = getsp(quad_name);
valplus=val(1)*(1+pourcentage);
... |
sys_open=tf([1],[1 2 1 0]);
sys_closed=feedback(sys_open,1,-1)
figure(1)
margin(sys_open)
[Gm,P,,Wcg,Wcp]=margin(sys_open)
figure(2)
step(sys_closed)
S=stepinfo(sys_closed) |
function [calc_arr,q_bg] = plot_spagetti_vol_Kun(varargin)
% Script is used to build spagetty plot of Kun's DFT calculations
%
% It can also be used to plot and verify various interpolation formulas,
% used for volume interpolations
% 8 ACSII data files with high symmetry Kun calculations must be located
% in the same ... |
function res = spsolu(solu1, solu2, N, d, grid)
temp = 0;
for k=1:grid.n
for i=1:N+2
if i==N+2
temp = temp + solu1(i, 1, k, 1)*solu2(i, 1, k, 1);
else
for j=1:d
temp = temp + solu1(i, j, k, 1)*solu2(i, j, k, 1);
end
end
end
end
r... |
clc
clear
close all
% other works have been done on paper
% syms m1 m2 m3 l2 L2 l3 J2 J3 g
m1 = 0.4;
m2 = 7.7
m3 = 25.1
l2 = 0.61 % 0.3466 %0.2050 %0.61
L2 = 0.88 % 0.5 %0.3 %0.88
l3 = 0.2
J2 = 0.2761 %0.2761
J3 = 2% 0.3108
g = 9.8
syms th1 th1d th1dd
syms th2 th2d th2dd
syms x1 x1d
syms x2 x2d
syms T
x... |
% THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION IS RELEASED "AS IS." THE U.S. GOVERNMENT MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, CONCERNING THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT ... |
function SymbLine=symbline(Length,Symbol)
SymbLine='';
for Index=1:Length
SymbLine=[SymbLine Symbol];
end
disp(SymbLine) |
function varargout = blkalignment(varargin)
%
% The Simulink Alignment is used to Align blocks in Simulink
%
% version 1.0
% Po.Hu@bhtc.com
% 15.11.2006
%
%BLKALIGNMENT M-file for blkalignment.fig
% BLKALIGNMENT, by itself, creates a new BLKALIGNMENT or raises the existing
% singleton*.
%
% H = BLKALIG... |
function rawdata_save(T,Y,data_dir,data_id,data_type,pumpstep,opt_checkpoint)
if nargin == 6
filename = rawdata_getFileName(data_dir,data_id,data_type,pumpstep);
elseif nargin == 7
filename = rawdata_getFileName(data_dir,data_id,data_type,pumpstep,opt_checkpoint);
end
save(filename,'T','... |
%% Leitura da imagem
RGB = imread('arara_azul.png');
HSV = rgb2hsv(RGB);
H = HSV(:,:,1); % Matiz
S = HSV(:,:,2); % Saturação
V = HSV(:,:,3); % Intensidade
%% Criar máscara com a saturação
% Limiar de 10% do maior valor de saturação
limiar = .1*max(max(S));
s_mask = S>limiar;
%% Produto da Máscara com a Matiz
prod = ... |
function ContrastExp(exp_id,subject_id,ExpNum)
ExpBlock1st = ExpOrder(exp_id,subject_id,ExpNum);
if strfind(exp_id,'4pos')
for n = 1: ExpNum
if n == 1
NEXT(ExpBlock1st(n).Sequence{1},subject_id);
end
for m = 1: 4
PsyExp(ExpBlock1st(n).Sequence{m},subject_... |
function pr = predictionStage( XvPrev, YvPrev, THvPrev, deltaT, currTurnRate, currVel )
%Prediction Function given previous values
XvPred = XvPrev + deltaT*currVel*cos(THvPrev);
YvPred = YvPrev + deltaT*currVel*sin(THvPrev);
THvPred = THvPrev + deltaT*currTurnRate;
pr = [XvPred, YvPred, THvPred];
end |
classdef Convolution2DLayer < nnet.cnn.layer.Layer
% Convolution2DLayer 2-D convolution layer
%
% To create a convolution layer, use convolution2dLayer
%
% Convolution2DLayer properties:
% Name - A name for the layer.
% FilterSize - T... |
classdef MetaCon < casadi.IndexAbstraction
%METACON
%
% = METACON()
%
%
methods
function v = original(self)
v = casadiMEX(1169, self);
end
function v = canon(self)
v = casadiMEX(1170, self);
end
function v = type(self)
v = casadiMEX(1171, self);
end
... |
function [y] = filter_with_change(h1, h2, x)
%FILTER_WITH_CHANGE filter one input signal with two different systems.
%
%
% It computes the output y corresponding to filtering signal x with system h1
% for half of the simulation and h2 the rest.
%
%
% INPUT h1: System to filter in the first half of the simul... |
function myArray = MakeByteArray(myPattern, info)
% myArray will be of type uint8
% info is a struct
if mod(info.npix, 8)
error('Number of pixels must be divisible by 8 for byte-writing')
end
numBytes = info.npix/8;
myPattern = string(myPattern*1.0).';
myPattern = reshape(myPattern, [8, numBytes]).';
myArray = s... |
clc;
clear;
temp=load('diabetes.mat');
xtrain=temp.x_train;
ytrain=temp.y_train;
xtest=temp.x_test;
ytest=temp.y_test;
%%
lambda=[1e-5,1e-4,1e-3,1e-2,1e-1,1,10];
for i=1:length(lambda)
w=Ridge(xtrain,ytrain,lambda(i));
trainerror(i)=calMSE(xtrain*w,ytrain);
testerror(i)=calMSE(xtest*w,ytest);
end
%%
sizev=... |
%% For Green Buoy
filePath = '../../Images/TrainingSet/CroppedBuoys/G_';
bins = (0:1:255)';
RedCount = zeros(256,1);
GreenCount = zeros(256,1);
BlueCount = zeros(256,1);
OutputPath = sprintf('../../Output/Part0');
for i = 1 :23
CroppedFileName = sprintf('%03d.jpg',i);
fullCroppedFileName = strcat(filePath, CroppedFile... |
clear all;
format long;
%% Load file
fid = load('../dat/taylorVortexError.dat','-ascii');
time = fid(:,1);
error = fid(:,2);
f=8;
plt1 = plot(time(1:end-f),error(1:end-f),'k');
xlim([-0.1 2.8])
ylim([1.5e-3 9e-3])
set(plt1,'linewidth',2.0);
GCA1 = gca;
set(GCA1,'XGrid','on','YGrid','on','TickDir','out','Units','centi... |
function [ hash_vector ] = CalculateHashVector( img, blocking, row_cut, column_cut, Q )
% calculate the hash vector by the blocking. The vector is encoded.
%
len = max(max(blocking));
sum = double(zeros(1, len));
cnt = double(zeros(1, len));
[n, m] = size(img);
for i = 1 : length(row_cut)
for j = 1 : length(col... |
function abundancesAsFeaturesToSVM()
avgAccVec = [];
iter = 100;
for a = 1:iter
[obj,nObj,svmObj,sunObj] = setExperimentParameters();
cObj = CombineClass;
obj.load_Indian_Pines();
obj.selectXPixPerClass_IncludeXNeighbours(nObj);
trainData = obj.trainData;
... |
c = zeros(8,4);
for i = 1:4
file = ['s0_',int2str(i),'.mat'];
load(file);
ARRAY = zeros(40*32,19);
count = 1;
elabel = zeros(40*32,1);
for k=1:40
W = getFeatures(data,k);
for z = 1:32
ARRAY(count,:) = W(z,:);
elabel(count,1)= getEmotion(labels(ceil(count/32),:));
count = count+1;
end
end
ARRAY = ... |
% img = imread('lenna.png');
% img = imread('images/disk.jpg');
% img = imread('images/giraffe.jpg');
% img = imread('images/plane.jpg');
% img = imread('images/rubberband_cap.png');
% img = imread('images/castle.jpg');
img = imread('images/leaf.jpg');
% edge = mycanny(img,13,2,0.4,0.5);
edge = mycanny(img,13,2,0.04,0... |
function ICA_Options = icatb_sbica_options(ICA_Options, dewhiteM)
% Add some more options to use semi-blind ICA
% Time dimension
tdim = size(dewhiteM, 1);
whiteM = pinv(dewhiteM);
% Number of Independent Comp.
numOfIC = size(dewhiteM, 2);
%tar and nov are SPM time courses
RA = randn(tdim, numOfIC)/.05;
ind = strma... |
for i=100
a=input('input','s');
if strcmp(a,'1')
break
end
11
end |
function XXtYZ = prodTransMat(XtY,XtZ)
% product transition matrix
% the size multiplies in each dimension
% Y and Z should have the same cardinality
% XtY and XtZ can be multi-D, say 4-D [m1 m2 m3 m4] and [n1 n2 n3 n4]
% then XXtYZ is 4-D [m1*n1, m2*n2, m3*n3, m4*n4]
% when XtY is 2-d, this is actually
% ... |
clc
clear
V=100;
rad2deg(kinem(850));
i = 1;
for x = 50:10:850
angles = kinem(x);
fk = fop(angles(1), V);
A(i,1) = x;
alpha(i) = angles(1);
A(i,2) = fa(x,V);
i = i+1;
end
plot(A(:,1),A(:,2))
i=1;
j=1;
for x=50:10:850
for V=50:5:100
F(i,j)=fa(x, V);
i=i+1;
end
i=1;... |
function [q] = Euler_to_Quaternion(ypr)
% Function to compute the quaternion from Euler angles (RzRyRx)
q = Angles.Rotation_to_Quaternion(Angles.Euler_to_Rotation(ypr));
end |
function [Eout,u,dbg,nodes] = solvebound(r,Ein,ops,opt)
%% Parse arguments
if nargin<4
opt = boundoptions;
elseif ~isa(opt,'boundoptions')
error('Options argument ''opt'' must be of type boundoptions');
end
opt2 = opt;
opt2.output = false;
E = sort(Ein);
Enew = E(1);
match = [calcBoundSolution(r,E(1),ops,opt... |
clc;
clear;
% Test della rete ma con soli dati binari del tipo: ordina, non ordina
% Ottenimento dataset da file Excel
anno1 = xlsread('Fiorenzuola.xlsx','2016','A2:E43580');
anno2 = xlsread('Fiorenzuola.xlsx','2017','A2:E45668');
anno3 = xlsread('Fiorenzuola.xlsx','2018','A2:E15074');
dati = cat(1,anno1,anno2,anno3... |
function [isModulated,modulated_signal_cells] = modulate_signals(information_signal,carrier_signal)
% MODULATE_SIGNAL modulates an information signal with a cosine
% carrier signal
indexer=size(information_signal);
indexer=indexer(1);
signal_cells=cell(indexer,1);
for c=1:indexer
carrier_transpose=carrier_signal{... |
function [ relativeDegree ] = degreeRel( Amatrix, Bmatrix, Cmatrix )
%DEGREEREL function generates the relative degree of the given system
% determined by input A, B and C matrices of state-space model. The relative
% degree is the maximum of the lengths of all geodesic paths between each
% driver node - sensor node p... |
function Callbacks_composite_vocal_tract_GUI25(f,C)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=C{1,1};
y=C{1,2};
a=C{1,3};
b=C{1,4};
u=C{1,5};
v=C{1,6};
m=C{1,7};
n=C{1,8};
lengthbutton=C{1,9};
widthbutton=C{1,10};
enterType=C{1,11};
enterString=C{1,12};
enterLabel=C{1,1... |
function bin_loss = binLoss(y, y_pred)
% 1/0 loss error calculation
n = size(y_pred,1);
I = zeros(n,1);
for i = 1:n
if y(i) ~= y_pred(i)
I(i,1) = 1;
end
end
bin_loss = 1/n * sum(I);
end
|
function [ ] = plot_1D_system(DGsolution,tnow,data)
% Plots the DG solution at the current time
% written by Pierson Guthrey
% -------------------------------------------------
% INPUTS x,y : cell centers (these should be %loaded)
% DGpast : coefficients from the previous timestep
% OUTPUTS ... |
% Aula 01 - exercicio 05
N = 100;
r = rand(1, N);
plot(r); |
function [back,x]=double1(x)
back=2*x;%function |
function [NPS2D,frequency]=Xu2DNPSwGaussDetrend(Roi,DeltaX,gaussian_radius,offset)
if nargin==3
offset =0;
else
end
Roi = Roi+offset;
RoiSize=size(Roi,1);
Zdim = size(Roi,3);
roi_mean = mean(mean(mean(Roi)));
Roi = Roi./mean(Roi,3)*roi_mean;
if gaussian_radius<=0
else
for idx = 1:size(Roi,3)
temp = Ro... |
function [y, opty] = colwavelift(x, optx, L, direction, mode)
%COLWAVELIFT performs a single-level one-dimensional wavelet
%decomposition/construction based on lifting method.
%
% x, optx: 1-D column array or 2-D matrix.
% If 2-D matrix is used, the computation is carried on every COLUMNs.
% optx can be om... |
function [dist, proj] = distancePointMesh(points, vertices, faces, varargin)
%DISTANCEPOINTMESH Shortest distance between a (3D) point and a triangle mesh.
%
% DIST = distancePointMesh(POINTS, VERTICES, FACES)
% Returns the shortest distance between the query point(s) POINTS and the
% triangular mesh defined by t... |
function [ x_new, T ] = lab3_1_3_func( x, K)
X = fft(x);
N = length(X);
% for part 1.2 with partial DFT
Xpart = X(1:K,1);
[x_new,T] = lab3_1_2(Xpart, 44100, N);
end
|
function params = load_params()
params.controlHandle = @lqrcontrol;
params.dynamicsHandle = @dynamics;
% Safety
params.maxAngle = 45*pi()/180;
%% Quadrotor Properties
% The angle of the gripper relative to the quadrotor
params.gripperangle = pi/2;
params.armlength = .175;
params.g = 9.81;
params.m = .70... |
clear all; clc; tic;
load('crossValidationIndices.mat')
measurementdata = 'database_10k_op_loaddirection1and3_meas.csv';
measurement = csvread(measurementdata);
total_controlCombination = 63;
controlCombination = 1;
labeldata = strcat('database_10k_op_loaddirection1and3_load_control_',int2str(controlCombination),'... |
function [v_sp, A]=p_game_space_red(v,x,slc,smc,method)
% P_GAME_SPACE_RED computes the game space which replicates x as a pre-kernel element.
% Same as the function p_game_space() but with less output arguments to save memory.
% Using Matlab's PCT.
%
% Usage: [v_sp A]=p_game_space(v,x,slc,smc)
% Define variables:
% ou... |
function Ei400_uvw100_at110TPmod2Peaks(varargin)
root = fileparts(pwd);
data_source= fullfile(root ,'sqw','Data','Fe_ei401.sqw');
bragg = [1,1,0];
dE = 10;
dK = 0.05;
repPoints1= [-0.3375,-0.175,0,0.175,0.375;
135,30,0,30,190];
repPoints2 = [-0.325,-0.125,0,0.175,0.425;
130,30,0,30,190];
repPoints3 = [-0.3... |
%% Physical optics example
% Created by: Lee A. Harrison
% On: 1/15/2019
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part of Introduction to Radar Using Python and MATLAB
% and can not be copied and/or distributed without the express permission of Artech House.
clear, clc
% Set the par... |
clear all; close all; clc;
w=2*pi*10^4;
disp(w);
z1 = j*w*1.2*10^-3; z2 = 9.5*10^3; z3 = 1/(j*w*2*10^-9); z4 = j*w*2.2*10^-3; z5 = 12*10^3;
z11 = z1+z2; z12 = -z2; z13 = 0; z21 = -z2; z22 = z2+z3+z4; z23 = -z4; z31 = 0; z32 = -z4; z33 = z4+z5;
Z = [z11 z12 z13;z21 z22 z23;z31 z32 z33];
e1 = 1.15*exp(j*pi/5);e2 =... |
function BootSOFB;
%do list
%check orbit read out of range
%check correctors out of range (cycle, total)
%write data to log file (one log per program launch)
%remove DC component of correctors
%rf frequency correction
%photon beamline steering
[handles,SYS,BPM,BL,COR,RSP]=sofblib('GetStructures');
%SYS Structure
SYS... |
function [z,Q_cost_terminal_error]=func_cost(ii,params)
%evaluate cost function for the current control (before updating):
% if ii==1 : alpha is alpha_0 (or w/e the initial guess was)
% if ii==2 : alpha comes from sol_upate_0
% if ii==4,6,7 : alpha comes from sol_update_b
% if ii==3,5,7... : a... |
% sample = '../Audio/sample_pshift.wav';
% suspect = '../Audio/audio_w_sample_pshift.wav';
function [result] = pitch_shift_exp(sample, suspect)
[data_orig,fs] = audioread(sample);
[data_copy,fs] = audioread(suspect);
% data_orig = bsxfun(@rdivide, data_orig, rms(data_orig,1));
% data_copy = bsxfun(@rdivide, data_copy, ... |
function [par,ode]=param4(V1,t_duration,V2,t_delay,V0)
%excersise 4
%parameters for HH voltage clamp experiment
%
%function [par,ode]=param4(V1,t_duration,V2,t_delay,V0)
%
%you can pass up to 4 parameters: pulse voltage and duration
%postpulse voltage, delay between the starts of the two pulses
%and the resting potent... |
function y = decision (x, constellation)
%decision: Die Methode geht jeden Abtastewert durch und
%entscheidet, welchem Symbol ursprünglich eingegangen war, indem er den
%kleinsten Abstand zwischen dem Symbol und jedem möglichen
%Konstellationspunkt berechnet und holt den Konstellationspunkt, zu dem das
%Symbol den klei... |
function [winners,final_indexes] = binary_tournament(fight_pool)
%BINARY_TOURNAMENT
N = length(fight_pool);
%final_indexes stores the initial indexes of the sources
final_indexes = 1:N;
perms = randperm(N);
winners(N) = source;
for i=1:N
if dominates(fight_pool(i),fight_pool(perms(i)))
winners(i) = fight_p... |
function seg = chanvese(I,mask,num_iter,mu, EQ_M, hybrid_b, prior_phis, kernel_sigma, Epsilon)
no_ex = size(prior_phis,3);
method = 'chan';
[m,n] = size(I);
%% Preprocessing
% Resize
s = 200./min(size(I,1),size(I,2)); % resize scale
if s<1
I = imresize(I,s);
end
% Some more preprocessing
%if size(I,3)== 3
% ... |
function points = three_body_problem(mass_A, mass_B, mass_C, init_A, init_B, init_C, N, h)
vec = [init_A(1:3);init_B(1:3);init_C(1:3);init_A(4:6);init_B(4:6);init_C(4:6)];
kutta_steps = 4;
four = kutta_4th_order_three_body(mass_A, mass_B, mass_C, vec, kutta_steps, h);
points = three_body_ab(mass_A, mas... |
close all
figure(1)
figure(2)
disp('ubique bien las figuras antes de comenzar animacion, y presione Enter...');
pause
disp('cambio de posicion del bloque en el espacio no altera |F(w)|...')
for i=1:2:60
I = zeros(256,256); I(70+i:75+i,70+i:75+i) = 1;
J = fft2(I);
figure(2)
mesh(abs(fftshift(J)))
ti... |
clear all;
close all;
vib=textread('E:\bishe实验数据\25600数据\REC3939_ch3.txt','','headerlines',16);
pul=textread('E:\bishe实验数据\25600数据\REC3939_ch2.txt','','headerlines',16);
pluse1=vib(:,1);
vdata=vib(:,2);
% pul=pul(:,2);pul=-pul;
threshold=abs(1)/3;
fs=25600;
figure;
plot(pluse1,vdata)
xlabel('t/s');ylabel('amplitude');t... |
function [h_best, points] = u2h_optim(u1, u2)
v = 1:10;
C = nchoosek(v, 4);
min_error = Inf;
h_best = [];
points = [];
for i=1:size(C,1)
H = u2H(u1(:, C(i,:)),u2(:, C(i,:)));
if isempty(H)
continue;
end
u_hat = H*u1;
u_hat(1, :) = u_hat(1, :)./u_hat(3, :);
u_hat(2, :) = u_hat(2, :)./u... |
function isEnd=isStairEnd(tracks, ageThreshold, visibleThreshold)
activeID=([tracks(:).isActive]==1);
activeTracks=tracks(activeID);
activeLength=length(activeTracks);
stability=0;
visibility=0;
ages = [activeTracks(:).age];
totalVisibleCounts = [activeTracks(:).totalVisibleCount];
for h=1:activeLength
visibil... |
function dy = backpropReverse(dx,x,y,settings)
%MAPMINMAX.BACKPROPREVERSE Backpropagate reverse function derivatives
% Copyright 2012-2015 The MathWorks, Inc.
dy = bsxfun(@rdivide,dx,settings.gain);
end |
function plotMovementsOverTime()
% T = [1; -1]; % 1 attractor
% T = [1 -1; -1 1]; % 2 attractors
% T = [1 1; 1 -1]; % 2 attractors
% T = [1 1 -1; -1 1 -1]; % 3 attractors
T = [1 1 -1 -1; -1 1 -1 1]; % 4 attractors
for xi = 1:size(T, 2)
plot(T(1, xi), T(2, xi), 'o', 'MarkerSize', 10);
hold on;
end
xlim([-1.2, 1.... |
clear all; close all;
addpath('utils');
%% Depth upsampling demo
opt.application = 'depth';
opt.dataset = 'books'; % 'art', 'books', 'moebius'
opt.upsampleRate = 8; % 2, 4, 8
opt.layerNum = log2(opt.upsampleRate);
opt.param.FGS1_SIGMA = 0.005;
opt.param.FGS1_LAMDA = 30;
opt.param.FGS2_SIGMA = 0.005;
opt.param.FGS2... |
function [S] = im2segment(im)
im = imbinarize(im,0.8);
% colormap(gray);
% figure
% imagesc(im)
[L, n] = bwlabel(im)
S = cell(1, n);
for i=0:n
[row, col] = find(L==i);
seg = zeros(size(im));
seg(row', col') = 1;
S{i+1} = seg;
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% %%%
%%% FACE RECOGNITION %%%
%%% %%%
%%% main.m: ... |
clc;
clear;
%% Task 2, script
%echo on
ts =0.001; % sample period
fs =1/ts;
t = [0:ts:10]; %time variable
x=0.8*cos(2*pi*200*t)+1.2*cos(2*pi*300*t); % signal with two frequencies
pwr = sum(x.*x)/length(t) %average power in signal
xd = fft(x,1024); %discrete transform
psd = ts*abs(xd).^2; %power spectral d... |
% línea a--b con puntos cada r unidades
function l = lineab(a,b,r)
lengthl = abs(a-b);
pts = floor(lengthl/r);
for i=1:pts
l(i) = r*i;
end
end |
% scrip to generate roi maps
% split concenus partition between hemisphere
clear
in = '/media/database3/twins_study/stability_fir_exp1/stability_group/sci440_scg484_scf451/brain_partition_consensus_group_sci440_scg484_scf451.mnc.gz';
out = '/media/database3/twins_study/stability_fir_exp1/stability_group/sci440_scg48... |
classdef RobotController < handle
%ROBOTCONTROLLER Summary of this class goes here
% Detailed explanation goes here
properties(SetAccess = public)
% Dt Time step of the robot
Dt = 0.10;
% RobotRadius Physical radius of the robot
RobotRadius = 0.17;
... |
function [b, bint] = uncertainty_byErrorCorrect(field, nbins)
% This code reproduces the analyses in the paper
% Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven
% by decision uncertainty and alters serial choice bias.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy ... |
function [muPost, sigmaPost] = slicesampling(s, muPrior, sigmaPrior) % Define a function proportional to a multi-modal density
% function handle for the exact postrior unnormalized
f = @(x) poisspdf( s, exp(x) ) .* normpdf(x, muPrior, sigmaPrior);
% Generate a sample based on this density
N = 1000;
x = slices... |
%-------------------------
% create codebooks
%-------------------------
for c=1:n_clusters
% find parts of this cluster
indexes = find ( idx== c );
c_parts = filtered_features( indexes, : );
c_features = c_parts(:, 1:end-6);
% parts
codebook(c).parts = c_parts;
... |
function res = process_single_IWI(dir)
% process data for a single IDT-waveguide-IDT device
%
% dir: file path, e.g., dir = '191015_IDT_control01';
%
% WTJ, 20191018
%
%% load all data files
fns = filefun([dir '/*.mat']);
data_all = {};
for ii = 1:length(fns)
fn_tmp = fns{ii};
fprintf('lo... |
function [mintab] = ML_tleFindNeighbours(DTW,tvwin,P,stdAcceptance,smoothSize)
% ML_tleFindNeighbours - finds repetition neighbours for each point
% Author : Michal Lewandowski
% Kingston University of London
% Digital Imaging Research Centre
% m.lewandowski@kingston.ac.uk
... |
% asks user their: name,
% favourite food, and if they could win a food eating competition with it
% formats this information at the end
name = input('What''s your name?','s');
favouritefood = input('What''s your favourite food?','s');
likeit = input('Do you really like it?','s');
reallylikeit = input ('D... |
clear all
close all
% expansion analysis
% redimensions XY coords to polar (r, phi) and makes a histogram of density with
% respect to r. Identify the point at which expansion becomes exponential
% ks and gs define the properties of the substratum on which the bacteria
% are moving. ks is how quickly the substratum... |
function errorCode = errorChecker(~,Dataset)
%ERRORCHECKER controlla che il dataset abbia il formato desiderato
% ERRORCODE = ERRORCHECKER(APP,DATASET)la funzione si occupa di analizzare
% il dataset per restituire in ERRORCODE l'eventuale codice dell' errore trovato
% Input Argument:
% APP appdes... |
%pick the datas;
k=1;
for i=1:length(price)
if price(i)<=75.001
reprice(k)=price(i);
retask_lat(k)=task_lat(i);
retask_long(k)=task_long(i);
relat_long_distance(k,:)=lat_long_distance(i,:);
k=k+1;
end
end
renumberofmember_distance_it15=zeros(length(retask_lat),1);
for i=1... |
function [v] = zad25()
v=HornersMethod([1,7,3,6,-2], 3.6769);
disp(v);
w=HornersMethod (v',-0.1494);
disp(w);
v=HornersMethod (w',-0.2637 - 0.9168i);
disp(v);
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.