text stringlengths 8 6.12M |
|---|
function [ y,A,B,C,D ] = blindDeconvSS( u, N )
%% Blind Deconvolution using State Space Approach
% Given observations {u(k)} where k=1,2,...,T
% The demixing model: x(k+1) = Ax(k) + Bu(k) + noise(k)
% y(k) = Cx(k) + Du(k)
% y(k) - output (estimate sources), x(k) - state variabl... |
function [row,col] = pipjtorowcol(pi,pj)
%% convert the pi pj index output by compute_Atraj_neighbour
%% to rows and cols
row = double(pi + 1);
col = zeros(length(row),1);
for id = 1: (length(pj)-1)
col([(pj(id)+1): pj(id+1)]) = id;
end
|
function testmeasures
load graphdata_subjlist_pli
randgraph = load('graphdata_subjlist_rand_pli');
weiorbin = 3;
trange = [0.5 0.025];
fontsize = 12;
bands = {
'delta'
'theta'
'alpha'
'beta'
'gamma'
};
graphmeasures = {
'small-worldness index'
'modularity'
'participation coeffici... |
function [g, gTh, itn] = solve_for_g(work, data, h, n, m, k, rho_y, use_indirect, extra_verbose)
[g, itn] = solve_lin_sys(work, data, h, n, m, k, zeros(m,1), rho_y, use_indirect, extra_verbose);
g(m+1:end) = -g(m+1:end);
gTh = g'*h;
end |
function Ht = observationFunction(X,Z,t)
%X: the state
%Z: observed value
%t: time
% To = zeros(NUMBER_ROW,NUMBER_COLUMN,Ns); %TESTINGCYCLE_DATA(jN,iN).To(n(jN,iN));
% Ta = zeros(NUMBER_ROW,NUMBER_COLUMN,Ns); %TESTINGCYCLE_DATA(jN,iN).Ta(n(jN,iN));
% tm = zeros(NUMBER_ROW,NUMBER_COLUMN,Ns); %TESTINGCYCLE_DATA(j... |
//
// LQToolKit.m
// LeQu
//
// Created by apple on 16/6/12.
// Copyright © 2016年 Apple. All rights reserved.
//
|
function [p0,theta] = win2Prototype(w,M,m)
if m == 1
c = w(1:M/2); % The "cosine" terms
s = flipud(w(M/2+1:M)); % The "sine" terms
theta = atan2(s,c); % Estimate the angles based on the cosines and sines
% Compute a new set of coefficients
p0(1:M/2) = cos(theta);
if isrow(p0)
p0 = p0.';
... |
clear all;
load symexc_5thmode_3V
figure;
plot(outputvalues(:,1)/3); hold all;
load symexc_5thmode_5V
plot(outputvalues(:,1)/5);
load symexc_5thmode_10V
plot(outputvalues(:,1)/10);
load symexc_5thmode_15V
plot(outputvalues(:,1)/15);
legend('3 V', '5 V', '10 V', '15 V'); |
function loadedData = loadData_ott(task)
master_root = ottBari2020_root();
switch task
case 'intBlocks'
load(fullfile(master_root, 'Data', 'Modeling', 'DataForModeling', 'ModData_intBlocks.mat'), 'CS')
loadedData = CS;
case 'threeOutcomes'
load(fullfile(master_root, 'Data', 'Mod... |
clc; clear; close all;
semantics_path = '_my_hand/semantics/';
load([semantics_path, 'fitting/names_map.mat']);
input_path = 'C:\Developer\hmodel-cpp\data\models\anastasia\';
output_path = 'C:\Developer\data\MATLAB\convolution_feel\';
[centers, radii, blocks, theta, mean_centers] = read_cpp_model(input_path);
shift... |
substrate = 'EX_glc(e)';
aerobicString = 'aerobic';
target = 'EX_ala-L(e)';
filename = '3-swap-ala-design.csv';
kos = {'ACKr';'ALCD2x';'LDH_D';'RPE'};
swaps = [];
model = setupModel('iJO',substrate,aerobicString,'nothko');
model = changeRxnBounds(model, kos, 0, 'b');
if ~isempty(swaps)
model = modelSwap(model,swap... |
clear;close all;clc
%{
Author: Sydney Sroka
This script calculates the enthalpy flux and spray CK for a specified set
of environmental conditions
> relative humidity RH [%]
> air-sea temperature differnce DT [K]
> 10-m wind speed U10 [m/s]
Usage:
The user can specify the inpu... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This function computes the gradient of our proposed %%
%% autoencoder loss function. %%
%% Inputs: %%
%% W ... |
% Configuration parameter to decide if we use division to calculate the slip rate
% 1 means to use division to calculate the slip ratio
% 0 means to use Stateflow to search the integer slip ratio from 0 to 100.
use_division = 0;
% The sampling period of Brak_Torq_Calculation
T_brake_pedal = 0.01;
% The sampling... |
function [ info ] = genSampleAccelData( tempTotal, dt, distance )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
d1 = 0.0;
d2 = distance;
t1 = 0.0;
t2 = tempTotal;
numSample = tempTotal / dt;
ds = distance / numSample;
info = zeros(numSample, 4);
info(1, 1) = 0;%acce... |
function h = figureSimFrequencyResponse(filePath,y,varargin)
%绘制直管模拟频率响应
pp = varargin;
varargin = {};
fs = 200;
type = 'contourf';%contourf
while length(pp)>=2
prop =pp{1};
val=pp{2};
pp=pp(3:end);
switch lower(prop)
case 'fs' %绘图类型可选'line'和'bar'
fs = val;
case 'type'
type = val;
otherwis... |
function p = draw_boxes(BN,BX,varargin)
% DRAW_BOXES Draw a list of boxes given minimum corners and maximum corners
%
% p = draw_boxes(BN,BX)
%
% Inputs:
% BN #B by dim list of minimum corners
% BX #B by dim list of maximum corners
% Outputs:
% p plot handle
%
dim = size(BN,2);
m = s... |
function [ERR_X, ERR_Y] = err(X, Y)
%funkcja obliczajaca blad miedzy przyblizeniem metoda zmodyfikowana Eulera
%a funkcja srodowiska MATLAB
% X,Y - tablice z wartosciami przyblizen
%bład:
ERR_X = abs( X(1,:) - X(2,:) );
ERR_Y = abs( Y(1,:) - Y(2,:) );
end
|
function y = myun(x)
y = eye();
end |
function [u,du,x,idx,nodeCount] = numerov(x,ui,W,direction,options)
if nargin<5 || ~isfield(options,'stopAtRoot')
options.stopAtRoot = 0;
end
if nargin<5 || ~isfield(options,'stopAtMax')
options.stopAtMax = 0;
end
if nargin<5 || ~isfield(options,'maxTol')
options.maxTol = 1e-3;
end
if nargin<5 || ~isfield(... |
function computeStressStrain
global elements u nel coordinates stress strain MAT
stress = zeros(nel,1);
strain = zeros(nel,1);
ue = zeros(4,1);
for i=1:nel
xe = coordinates(elements(i,2:3),1:2);
de = u(:,elements(i,2:3));
E = MAT(elements(i,1),1);
%
x1 = xe(1,1);
x2 = xe(2,1);
... |
function out_img = marr_hildreth_ed_cvip( input_image, sigma, threshold )
% MARR_HILDRETH_ED_CVIP - performs a Marr Hildreth edge detection on the image.
%
% Syntax :
% ------
% out = marr_hildreth_ed_cvip( input_image, sigma, threshold )
%
% Input Parameters include :
% ------------------------
% 'input... |
function obj = init( obj, mopt, varargin )
%INIT Initialize the class MOPSO
% Detailed explanation goes here
if nargin > 1
obj.CostFunction = mopt.CostFunction; % Cost Function
obj.nVar = mopt.nVar; % Number of Decision Variables
obj.VarSize = mopt.VarSize; % Size of Decision Va... |
% x = jll(x0,epsilon)
% Johnson-Lindenstrauss lemma projection
function x = jll(x0,epsilon,K)
[H,n] = size(x0);
if (nargin < 3)
K = 4/(epsilon^2)*log(n);
end
Phi = (1/sqrt(K))*randn(K,H);
x = Phi*x0;
end |
function params(varargin)
global K m r g ell M Pi Mi1 Mi2 ee k1 B alpha rho_max k2 gg kr c1 c2 c3 delta max_w motor_pole A n_flips t0
t0 = 1;
max_w = 18.5;
motor_pole = 6;
Qlqr = diag([ones(1,3) 0.01*ones(1,3)]);
Rlqr = eye(3);
A = [zeros(3),eye(3);zeros(3), zeros(3)];
B = [zeros(3... |
%% Control Definition
% ########################################################################
% Define the object of an inverter controller
% Input:
% - [obj] grid parameter
% - [obj] inverter parameter
% Output:
% - [obj] control parameter
% Establishment: 24.02.2021 Liu Yu, Tianxiao Chen, PGS,... |
% Vision Code Peer Review
clear;
clc;
a = arduino;
s = servo(a,'D3','MaxPulseDuration',2e-3,'MinPulseDuration',1e-3);
writePosition(s, processVisionData());
canFire = true;
while (canFire)
writeDigitalPin(a, 'D11', 1)
if (readDigitalPin(a, 'D8'))
canFire = false;
disp("Fire")
e... |
function N = lognormat(A, dims)
%LOGNORMAT normalize A to 1 along dims, in log space (no loss of precision).
%
% Arguments:
% A - An array to normalize (in log space!).
% dims - Dimensions along which to normalize to 1. default is 2 (column).
%
% Example:
% x = -rand(1000,1)*1000;
% n1 = log(exp(x) ./ sum(exp(x)));... |
function [err, sp, obsv] = gensim_perfect_adaptation(n,params)
%%
t = linspace(0,5,n)';
% run simulation
sp = [0,1,0];
obsv = [];
for i = 1:2
sp(1) = i;
[err, ~, sp, obsv_tmp] = perfect_adaptation( t, sp, params, 1 );
sp = sp(end,:);
if isempty(obsv)
obsv = obsv_tmp;
else
obsv = [obs... |
%最小二乘问题 min|Ax-b| 解为inv(A'A)A' b
%设置A*x_correct=b,和迭代初值x0
A = randn(1000);
B = A'*A; %对称正定
x_correct = ones(1000,1);
b = A*x_correct;
x0 = rand(1000,1);
Q = []; %正交矩阵,1000*k
r = []; %残差,每一列代表一次迭代的残差
H = []; %上Hessenburg阵,(k+1)*k
x = []; %每一步计算出来的x,1000*k
y = []; %每一步的更新y
r0 = b-A*x0; %初始残差,1000*1
H10 = norm(r0);
resn... |
function [U_prime,S_prime] = iqsvd(U,S, y_prime)
p = size(S,1);
%y_prime = y-x_bar;
clear y;
g = qmatrix_mul(qhermitian_trans(U), y_prime);
h = y_prime-qmatrix_mul(U, g);
h_norm = sqrt(sum(sum(h.*h)));
h_hat = zeros(size(h));
if (h_norm > 0.0000000001)
h_hat = h.*(1/h_norm);
end
gamma = qmatri... |
%--------------------------------------------------------------------------
% Author: Akira Nagamori
% Last update: 9/25/2018
% Descriptions:
% Plot 1) coherence spectrum between EMGs of wrist flexors and extensors
% 2) boxplot for average coherence between 8-15 Hz
% Used to generaste Fig.1
%----------------... |
function BIC = GetBIC_(logPxMax,N,nStates,nChannels,fitChannelType,trainA,trainE,noHops)
freeParams = 0;
if trainA,
freeParams = freeParams + nStates^2 - nStates;
end
if trainE,
for i = 1:nChannels,
if strcmp(fitChannelType{i},'exp'),
freeParams = freeParams + nStates;
elseif strcmp(... |
% This code pertains to Figures 2.5 and 2.6 in thesis manuscript
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input:
% None
%
% Output:
% 1) Toy image with labeled locations where wavelet coefficients
% are computed
% 2) Several evaluations of $|Sf|$ with varying parameter $\alpha$
%
% Notes:
% Requires yellowSquare.m
... |
%9*9 patches
%~25*25 window
%spatial,main
%barbara: 0.8, 9: 5.0->3.0
%grass: 1,15: 12->7.4
%honeycomb: 1,15: 12.7->7.4
function [im_filtered] = myPatchBasedFiltering(im_noise,spatial_sd,main_sd)
[r,c]=size(im_noise);
im_padded=(-100)*ones(r+8,c+8);
im_padded(5:5+r-1,5:5+c-1)=im_noise;
im_filtered=zeros... |
function [ posePredicted ] = posePrediction( scan_lines, robotPose, map )
% [ posePredicted ] = posePrediction( scan_lines, robotPose, map )
% Predict a pose based on the laser scan and map.
% NOTE: Assumes only rectangular wall-structures !!
% To get a match between the laserscan and the map the difference is max:
r... |
clc
clear
numRetainedTracts=45;
travelData=table2array(readtable("seattle_travel_numbers.csv"));
gisData=readtable("seattle_GIS_data.csv");
uVData=table2array(readtable("seattle_UV_coordinates.csv"));
fortyFiveTractIndices=table2array(readtable("seattle_45_sameArea_indices.csv"));
travelData45(numRetainedTracts,numReta... |
function [ result ] = mainScript( image,R,sigma )
%MAINSCRIPT Summary of this function goes here
% Detailed explanation goes here
windowFilter = getGaussianFilter(size(image,1),size(image,2),sigma);
all_waves = getAllWaves(image,R,windowFilter);
down_scaled_waves= Remap(all_waves,R);
realigned_waves = Realign(all_wa... |
% Inference methods: Compute the (approximate) posterior for a Gaussian process.
% Methods currently implemented include:
%
% infGaussLik Exact inference (only possible with Gaussian likelihood)
% infLaplace Laplace's Approximation
% infEP Expectation Propagation
% infVB Variati... |
function p = paramsGP(nInputs)
%paramsGP - Creates Gaussian Process parameter struct
%Optional file header info (to give more details about the function than in the H1 line)
%Optional file header info (to give more details about the function than in the H1 line)
%Optional file header info (to give more details about th... |
%Josephson performance study
%Monte Carlo run until 3,000 iterations
% we report
% final time,
% total goal samples
tic
%%
clc;
clear;
config=generateConfig();
%%
dummy.x = 0;
dummy.y= 0 ;
mc(config.iterations)=dummy;
root.x = config.initX ;
root.y= config.initY ;
mc(1)=root;
%%
mcSim=1000;
mcSamplePerSimulation = ... |
% Splits a training data set randomly into two.
% 0 < frac < 1 of the rows are assigned to train_D, and the rest to test_D.
function [train_D, test_D] = random_split(D, frac)
n_rows = size(D,1);
cutoff = floor(frac*n_rows);
rand_rows = randperm(n_rows);
train_D = D(rand_rows(1:cutoff),:);
test_D = ... |
function []=Al1(varargin)
%函数调用:
%1.输入一个句柄函数是Al1(handle)
%2.输入数组和方位函数是Al1(data,signNS,addEW)
narginchk(1,3);
if nargin==1
h1 = varargin{1};
[y,m,d,h,min,sec,lon,lat,pre,tem]=getPara(h1);
elseif nargin==3
data = varargin{1};
addEW = varargin{2};
signNS = varargin{3};
[y,m,d,h,min,sec,lon,lat,pre,tem]=readFil... |
%========================================================================
%
% Estimate a Structural VAR based on long-run restrictions
%
%========================================================================
function svar_longrun( )
clear all;
clc;
% U.S.zero coupon yields Dec 1946 - Feb 2002 (0,1,3,... |
% Absolute variables (altitude,temperature, pressure and density),
% generated in vectors h() T() p() and rho().
h=A(:,1);
T=A(:,2);
p=A(:,3);
rho=A(:,4); |
function [biplot,Rsq] = f_biplotEnv3(crds,env,special,iter,scale,offset,sLabels,plotflag,minP);
% - create environmental vectors for 3-d nMDS ordination distance biplot
%
% Usage: [biplot,Rsq] = f_biplotEnv3(crds,env,{special},{iter},{scale},{offset},{sLabels},{plotflag},{minP});
%
% ----- Input: -----
% crds = matri... |
function[] = playSoundBit(song, bitlength)
load([song(1:end-4) '.mat']); load('fs.mat');
start = floor(rand*length(song));
range = start:start+bitlength*fs;
soundsc(song(range),fs);
end |
function [ HRT, ratio, diff] = hrtdetector2(fdata,fs0,d1,d2,hrt_treshold,speaker_mean)
%HRTDETECTOR Determines whether an utterance has a High Rising Terminal
d1 = d1*fs0/1000;
d2 = d2*fs0/1000;
if(length(fdata)<=d2)
ratio = [];
HRT = [];
diff = [];
else
peak = max(fdata(end-d1:end));
ratio ... |
function [discrete_points,buffered_polygon_vertices] = discretize_polygon_obstacles(P_vertices,buffer,boundary_point_spacing,interior_point_spacing)
if nargin < 4
interior_point_spacing = Inf;
if nargin < 3
boundary_point_spacing = Inf;
if nargin < 2
buffer = 0;
end
end... |
%% HMDGazeOrigin
%
% Provides properties for the HMD gaze origin.
%
% hmd_gaze_origin = HMDGazeDirection(position_in_hmd_coordinates,...
% validity)
%
%%
classdef HMDGazeOrigin
properties (SetAccess = protected)
%% PositionInHMDCoordinates
% Gets the 3D coordinates th... |
%px_SPM_MixANOVA2 (op,ip,pre,num1,num2)
clear
clc
% op = {'/Volumes/Data/data/rsfMRI/07_0699/DPARSF_S8V2_test_0108/ResultsVOIs_ANOVA/FC_92_PCC_R_FAnova/'};
% ip = {'/Volumes/Data/data/rsfMRI/07_0699/DPARSF_S8V2_test_0108/ResultsVOIsBefore/FC_92_PCC_R/';...
% '/Volumes/Data/data/rsfMRI/07_0699/DPARSF_S8V2_test_0108/... |
function boxPlots(datasets,featureLabels,labelAngle,colors,axisType,showGrid,fontSize,outliers,Legend,curvature,xLb,yLb)
% boxPlots: plots boxplots.
%
% Arguments
% datasets: cell array containing datasets.
% FeatureLabels: feature labels.
% labelAngle: angle of xlabel.
% Colors: arr... |
function jdDpxExpHalfDomeRdk
E=dpxCoreExperiment;
E.paradigm='jdDpxExpHalfDomeRdk';
E.outputFolder='/data/vanwezeldata/dpxData';
E.window.skipSyncTests=0;
E.window.verbosity0min5max=1;
E.window.backRGBA=[.5 .5 .5 1];
E.window.distMm=600;
if IsLinux
E.window.rectPx=[1920 0 1920+19... |
% moment_inequalities - Simulation estimator for entry without
% assumptions on order of entry. Procedure based on Ciliberto and Tamer
% (2009).
function obj = moment_inequalities(theta, mu, markets,firms, entry, u)
% model parameters
MU = mu;
ALPHA = theta(1); BETA = theta(2); DELTA = theta(3); SIGMA = thet... |
function ErrorMessage=genPosNegtxtLR(newName,tmpSeq,position,LenLeft,LenRight)
if(length(position)>0)
ModSeq=tmpSeq(position(1));
for i=1:LenLeft
ModSeq=['X',ModSeq];
end
for i=1:LenRight
ModSeq=[ModSeq,'X'];
end
%输出正类点
fidout=fopen('pos.txt','a');
for i=1:length(position)
outputSeq=Mo... |
%% CSE200 Final Project
% Part I of the project is to be completed in the template below.
%% Group Information
% Number in Group: 1
%
% Member 1 (use THIS repository):
% Name: Kai Banks
% WUSTL key: kai.banks
%
% Member 2:
% Name: Nikki Wines
% WUSTL key: catherinewines
%
%
% Project Choice: Mechanical ... |
function d2fdx2val = exp_d2fdx2(t,x,pars,more)
n = size(x,2);
[l,m] = size(x);
g = zeros(l,m,n,n);
for i = 1:n
g(:,i,i,i) = exp(x(:,i));
end
d2fdx2val = g;
end
|
function line=atsplitelem(baseelem,varargin)
%ATSPLITELEM Creates a line by inserting one or more elements into a base element
%
%LINE=ATSPLITELEM(BASEELEM,FRAC1,ELEM1[,FRAC2,ELEM2...])
% Each inserted element is associated with a location given by 0<=FRAC<=1
% LINE is a cell array containing the sequence of result... |
%% Program Estimasi Kontur Bidang Tanah DCM
% kalo mau simpen nilai ke .mat, jangan lupa ganti nama variablenya
% tergantung pengukuran ke berapa.
clear all; clc; close all;
% pathnya harus disesuaikan
addpath('/home/dennis/Documents/MATLAB/estimasi-kontur-bidang-tanah/complementary-filter-adaptation/quaternion_libra... |
% Parametric: open global simscape settings (Home->Preferences),
% and tick 'show run-time parameter settings'
clear all
close all
clc
addpath('/home/jgillis/programs/casadi/matlab_install/casadi')
import casadi.*
warning('off','symbolic:sym:sym:DeprecateExpressions')
warning('off','symbolic:generate:FunctionNotVer... |
% integrate the log likelihood ratio, marginalization
% Yan Wang, April 25, 2013.
%clear all;
%clc;
tic; % Measure performance using stopwatch timer
disp('criterion.m, starting the calculation ... ');
%global Np alphaP deltaP kp N timingResiduals sd yr stdTrueCoord
% set up the parameters and function handles
Ns... |
function [ retM ] = EMA( M, alpha, init )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
retM = M;
[m,n] = size(M);
for i = 1:n
filt = init;
for j = 1:m
filt = (1 - alpha)*filt + alpha*M(j,i);
retM(j,i) = filt;
end
end
end
|
function printTable(allresults)
datasets = {'AthR' 'XGraph' 'BbCrypt' 'CR' 'IMDB' 'MPQA' 'RT-2k' 'RTs' 'subj'};
methods = {'MNB' 'SVM' 'NBSVM'};
ngrams = {'Uni', 'Bi'};
fprintf('%s\t', datasets{:});
fprintf('\n');
for i=1:6
result = zeros(1, length(datasets));
... |
ax = all_data(:,2) * 9.81 / 100.;
ay = all_data(:,3) * 9.81 / 100.;
r = all_data(:,4) * pi / 180;
wl = all_data(:,5);
wr = all_data(:,6);
vx_actual = all_data(:,11);
vy_actual = all_data(:,10);
T = 0.004;
t = (1:length(all_data))' * T;
x_hat = zeros(2,length(t) + 1);
Q = [0.001 0; 0 0.001];
R = [0.1 0; 0 0.1];
w_k = d... |
function varargout = MP285(varargin)
% MP285 MATLAB code for MP285.fig
% MP285, by itself, creates a new MP285 or raises the existing
% singleton*.
%
% H = MP285 returns the handle to a new MP285 or the handle to
% the existing singleton*.
%
% MP285('CALLBACK',hObject,eventData,handles,...) cal... |
clear all
close all
format long
MXYZ = [0.412453 0.357580 0.180423;
0.212671 0.715160 0.072169;
0.019334 0.119193 0.950227];
a = dlmread('rgb_lab.txt');
rgb = flipud(rot90(a(:,1:3)));
rgb = rgb(:,2:end);
lab = flipud(rot90(a(:,4:6)));
lab = lab(:,13:end);
xyz_mentor = flipud(rot90(a(:,7:9)));
xyz_men... |
function AppendixG1
% Appendix G-1. Single-Stage Extraction, page 480 Text .
% Uses the function fsolve from the Optimization Toolbox
% and the M-function appendixG_1 supplied by the user.
% Data are from Example 7.2, p.393 Text.
[X]=fsolve(@appendixG_1,[50 50 0.1],optimset('fsolve'));
E=X(1)
R=X(2)
xCR=X(3)
... |
function phase_unwrapped = unwrap_phase_laplacian(phase_im)
dims_vol=size(phase_im);
[ky,kx,kz] = meshgrid(-dims_vol(2)/2:dims_vol(2)/2-1,...
-dims_vol(1)/2:dims_vol(1)/2-1,...
-dims_vol(3)/2:dims_vol(3)/2-1);
kx = fftshift(kx);
ky = fftshift(ky);
kz = fftshift(kz);
k_sq = kx.^2 + ky.^2 + kz.^2;
% Unwrap phas... |
% Cell Arrays and Indexing
% ========================================
clc
clear all
x = cell(3,1);
x{1} = 'foo';
x{2} = 'bar';
x{3} = 'bar2'
%% adding dissimilar data to cell array (no problem)
x{4} = 1:5
%% Indexing cell arrays
clc
x(4)
x{4}
%% Concatenating cell arrays
clc
x
y = cell(3,1)
z = [x;y]
%% Str... |
b = @(x) (1./(1+25.*(x.^2)));
c =eval_C(b, 2);
d =eval_C(b, 4);
e =eval_C(b, 6);
f =eval_C(b, 8);
a = -1:.05:1;
figure
subplot(2,1,1)
plot(a,b(a),a,c(a),'--',a,d(a), ':',a,e(a),'-.', a, f(a),'-')
legend('Actual val','P0','P1','P2','P3')
title('Eval c command')
xlabel('x')
ylabel('y')
subplot(2,1,2)
plot(a,(c(a)-b(a))... |
function xdot = noisy_model(t, x, A, B, sigma, bias)
u = input_fun(t);
n = sigma^2 * randn(1) + bias;
xdot = A * x + B * (u + n); |
%% ISyE 6414 Summer 2017 HW#2 Solutions
%%%% Problem 1 Paddy %%%%
load paddy.dat
x = paddy(:,1);
y = paddy(:,2);
n = length(x);
vecones=ones(n,1);
X=[vecones x];
p = size(X,2); %p=2 number of parameters (beta0, beta1)
%% Part (a)
% estimators of coefficients beta1 and beta0
betas = inv(X'*X)*X'*y;
b0 =betas(1); % 0.397... |
function truthMatrix=equation3(i_c,m_c,T_c)
truthMatrix=zeros(size(m_c));
[r,c]=find(abs(i_c-m_c)>T_c);
truthMatrix(r,c)=1;
endfunction
|
%%% Variable types %%%%%
% Varaibles will be use to store data, or number, or character than you
% will need after. I advise you to put a comprehansive name for each of
% your variables. For exemple if you want to store your name :
myName='Laura';
% It's pretty usefull because you can change what the variable containes... |
% This script generates c code required to calculate the variance of the
% TAS, AoA and AoS estimates calculated from the vehicle quaternions, NED
% velocity and NED wind velocity. Uncertainty in the quaternions is
% ignored. Variance in vehicle velocity and wind velocity is accounted for.
%% calculate TAS error ... |
function popup_Callback(hObject, eventdata, handles)
ud = get(hObject,'UserData');
popupVal = hObject.Value;
%options = hObject.String;
if (popupVal == 1)
cla;
axesHandlesToChildObjects = findobj('Tag', '50States');
delete(axesHandlesToChildObjects);
h = findobj('Tag', 'slider_zt');
dele... |
function px_plot3(x,y,z)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FORMAT px_plot3(x,y,z)
%
% ALL OF x, y, z are one-dimensional array.
%
% Pengfei Xu @ QCCUNY, 12/21/2011
% Copyright 2011-2011 Pengfei Xu Beijing Normal University
% Revision: 1.0 Date: 12/21/2011 00:00:00
%%%%%%%%%%%%... |
function K = initexpcone(K,pars)
K.expc.idx.x2x3 = [K.expc.idx.x2';K.expc.idx.x3']; |
function [vnodes,t,nb_vertex,nb_dof,nb_cubes,X,Y,Z] = mesh_3D(Lx,Ly,Lz,Nx,Ny,Nz)
%**************************************************************************
% Build 3D mesh of the rectangular cuboid [0,Lx] x [0,Ly] x [0,Lz]
% with respectively NX, Ny and Nz discrete points in each corresponding
% direction.
%
% vno... |
function [ agg_dist ] = dtw_batch(filelist, chroma_midi, annot_midi,...
fftlen, outdir, param )
% dtw_batch
%
if nargin < 5
param = {};
end
addpath('./chroma-ansyn/');
fid = fopen(filelist);
fileNameList = '';
fileIndex = 1;
curfile = fgetl(fid);
while ischar(curfile)
fileNameList{fileIndex} = curfile;
... |
function ICC_table=ICC_original_non_texture(features_table_file)
mod='PET';
% mod='CT';
ROI_origin='new';
% ROI_origin='original';
constraint='_constrained_volume';
% constraint='';
load(features_table_file);
non_texture_table=all_rois_all_lesions_features_table(all_rois_all_lesions_features_table.feature_type~='textur... |
function saverd3(fname,A,timewindow,timeinterval,antennasep)
% saverd3(fname,A,timewindow,timeinterval,antennasep)
%
% timewindow: [ns]
% timeinterval: seconds between traces
%
% Aslak Grinsted feb 2004
fname=strrep(lower(fname),'.rd3','');
fid=fopen([fname '.rd3'],'w');
A=(A-mean(mean(A)));
A=A*32767./ma... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% demo code for the quasi-BnB algorithm for the bijective rigid alignment
% problem as described in the paper "Linearly Converging Quasi Branch and
% Bound Algorithms... |
%{
In this demo:
Computing all pairwise geodesic distances of a 50K vertices mesh
Preprocessing time: 2-3 seconds.
Query time: < 1 milisecond.
If using these ideas please cite:
[1] Gil Shamai, Michael Zibulevsky, and Ron Kimmel. "Efficient
Inter-Geodesic Distance Computation an... |
function res = PB_FH_residual(xkrylov)
global L; global dx; global NG;
global DT;
global N;
global WP; global QM; global Q;
global rho_back e_over_kT lde;
global x0; global v0;
global E0 dphi phi0;
global xc xv t k gamma
global Debye
% calculate the x at n+1/2 time level
x_average = x0 + xkrylov(1:N)*DT/2;
out=(x_a... |
% ***************************************************************************
% Initialize all profiles and closure parameters
% Call once before time loop
% Sets all forcing: pressure gradients, stresses, etc.
% Should be used to adjust initial temperature/salinity profiles
% Velocity initialized... |
function [ind,Tasks,numPerTask] = break_up_matrix(matrixLength,numTasks)
% Breaks up a matrix into smaller sub-matrices, specified by 'numTasks'.
% Useful for running matrix calculations within a for loop.
%
% Usage:
% [vals,Tasks,numPerTask] = break_up_matrix(matrixLength,numTasks)
%
% Written by Andr... |
function total_nf = cascade_noise_figure(gain, noise_figure)
%% Calculate the total noise figure for a cascaded network.
% :param gain: The gain of each component (dB).
% :param noise_figure: The noise figure of each component (dB).
% :return: The total noise figure (dB).
%
% Created by: Lee A. Harrison... |
function [] = HelmProlate(f, a, m, n, k, mode)
% Solves Helmoholtz in a elliptical domain as a two-parameter eigenproblem.
% Semi-focal distance
a0=acosh(a/f);
% Kept and removed degrees of freedom
kd1=2:m-1;
kd2=2:n-1;
rd1=[1,m];
rd2=[1,n];
% Differential operators and Jacobian
[Dx,x]=chebD(m);
x=a0/2*(x+1);
Dx=2/a... |
function [ indices, curvatures ] = find_indices( path )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
% initialize indices to return
indices = zeros(17,1);
curvatures = zeros(17,1);
%start on a straight
indices(1) = 1;
curvatures(1) = 0;
index = 2;
N = length(path.k_1pm);
%path.k_... |
function [state_new] = updatepart(state, weights, update)
state_new = zeros(size(state));
% Select particles with largest weights
% Numbr of particles to update according to weight
num_part_weight = size(state, 2) - update;
% First order weights and compute normalized cumsum
[sorted_weights, sorted_indice... |
function bpm_setenv(Prefix, RFAttn, InjectionFlag, AttnOnlyFlag)
% Info for SIOC
% #!/bin/csh
% module load libevent
% module load gsl
% cd /vxboot/siocbpm/head/iocBoot/iocbpmsr01c_008
% exec ./st.cmd
% If not locked:
%
% Terminal setup
% Baud 115200
% Parity None
% (Linux device something like /dev/tty50)
%
% NSLS-... |
function [GR, ScopeTypeCell] = als_waveforms_setup(ScopeType)
%ALS_WAVEFORM_SETUP - Setup function for Ztec scopes and other waveforms
%
% Ztec Info
% 1. Max Sample Rates - 500 MHz for the ZT4210 series
% 400 MHz for the ZT4440 series
% 2. ZT4441 has 14-bit ADC
% 8 range settings per impedance... |
classdef hist_pba < platebrowseraction
properties (SetAccess = private)
n_histograms = 0;
current_histogram_axes = []
current_boxplot_axes = []
end
properties
default_draw_options = struct(...
'FaceAlpha'... |
function [dist] = bmCompareReconFDiv(mMembership1, mMembership2, mImageMat1, mImageMat2, sDiv)
%
% mMembership1 - matrix of memberships of each vertex
% mMembership2 - matrix of memberships of each vertex
% mImageMat1 - image matrix
% mImageMat2 - image matrix
%
% Compares the blockmodels represented by cPosition1 and ... |
function [dF,rotA] = Tilting(L1s, L2s)
if nargin < 2
L1s = 10;
L2s = 10.02;
end
if length(L1s) ~= length(L2s)
error('Input vectors must be of same length');
end
dF = zeros(length(L1s),1);
rotA = zeros(length(L1s),1);
for i=1:length(L1s)
%%
% Tilting
% Start with coordinate system where ce... |
% function BallRestartRoutine(cs)
%BallRestartRoutine Roll Ball Back to Pins
% for k = 1:2
% pause(0.1)
% writePosition(cs.s,0.49);
% end
% for k = 1:2
% pause(0.1)
% writePosition(cs.s,0.47);
% end
%
% for K = 1:3
% for k = 1:4
% pause(0.1)
% writePosition(cs.s,0.48);
% end
% ... |
%initfnc initializes the variables
clc
clear all
% BEAM
% PARAMETERS---------------------------------------------------------------
global E %young´s modulus
global p %mass density
global lmax % max length of wave to be visualised
global f %frequency of vibration
global c ... |
function errVal = calcErrorY(Vp,T_out,T_in,rhoH2O,cP_H2O,VpSens)
% define Errorspans
dErrT_in = 2;
dErrT_out = 2;
if VpSens == 0 %Vortex Sensor
dErrVp = 18; % 1% v.E bei Vp_max = 900l/h (Wert immer kleiner als 50% FS)
elseif VpSens == 1 %MID Sensor
dErrVp = 0.03*Vp*2;
else
error('Input invalid!')
end
% c... |
function rhs=nls_rhs(t,ut,dummy,k)
u = ifft(ut);
rhs = -(i/2)*(k.^2).*ut + i*fft((abs(u).^2).*u);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.