text stringlengths 8 6.12M |
|---|
function init_prob_switch
global exp;
%% Configure Cogent
exp.numb_of_buffers = 15;
% Add cogent to the path
addpath(genpath('C:\Users\maria\Dropbox\NSFSLCN\Tasks\butterflytask\Cogent2000v1.32'))
addpath(genpath('C:\Cogent2000v1.33'));
% Configure display & keyboard
config_display(1, 3, [1 1 1], [0 0 0], 'Helvetica',... |
function [fsig,fitx,y,itd_thresh,beta,MSE] = fitSigmoid(x,y,DPT,pflg)
%This function fits a sigmoid through a set of anchor points [x,y], and
%returns a threshold corresponding to DPT
%x: should be in units of log(ITD), ex. x = log([10 20 40 80 160 320])
%y: the corresponding d-prime estimate for x
%DPT: target d-pri... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Train an adaptive LDA
%
% Inputs: data, - Training data arranged in columns
% target - Target classes arranged in columns
% (assumes targets are in range 1:nClasses)
% Outputs: alda.dataMean ... |
x = -2:0.01:2;
y = -2:0.01:2;
r = zeros(length(x),length(y));
%BDF3 Values:
%a = [1 -18/11 9/11 -2/11];
%b = [6/11 0 0 0];
%s = 3;
%AB3 Values
%b = [0 23/12 -4/3 5/12];
%a = [1 -1 0 0];
%s = 3;
%AB4 values
b = [0 55/24 -59/24 37/24 -3/8];
a = [1 -1 0 0 0];
s = 4;
... |
function afm = loadafm(fnam)
% LOADAFM -- Load a Quesant AFM file into MATLAB
% Based (loosely) on quesant.c from Gwyddion source code.
% example:
% [Z,R] = loadspe('data.spe');
% imagesc(Z)
% Fileinfo structure from Gwyddion:
%typedef struct {
% guint32 desc_offset; // offset of description (unused)
% ... |
function visualizeCellVectorsRadial2D(phi_cell)
%VISUALIZECELLS plots the values of cell variable phi
%
% SYNOPSIS:
% visualizeGradsRadial2D(phi)
%
% PARAMETERS:
% phi_cell: A CellVector variable
%
% RETURNS:
% None
%
% EXAMPLE:
%
% SEE ALSO:
%
% Written by Ali A. Eftekhari
% See the license file
% phi_cell=gradie... |
function [xi,w] = univariateTrapezoidalRule(l)
% abscissas and weights for the nested open trapezoidal rule, I=[-1,1]
% the weight is normalized (probability measure)
% l is the quadrature level
wRef = [0.5 0.5];
xiRef = [1/3 2/3];
tau = @(x,l,i) 2^(1-l)*(x+i);
n = 2^l;
if n == 1
% midpointrule for the first Le... |
%rot_x
%generates rotation matrix about x axis
%Scott Barnes
%MAe 3184
function R = rot_x(theta)
R = [1 0 0; 0 cos(theta) -sin(theta); 0 sin(theta) cos(theta)];
end |
function p = getParams(p)
% Two-dimensional turbulence
p.nVars = 1;
% Domain wave number
k1 = 2*pi/p.Lx;
l1 = 2*pi/p.Ly;
% x-grid from 0 to L-dx, centered on L/2.
dx = p.Lx/p.nx;
p.xx = 0:dx:p.Lx-dx; p.xx=p.xx-p.Lx/2;
p.dx = p.xx(2)-p.xx(1);
dy = p.Ly/p.ny;
p.yy = (0:... |
% Jing Guo, UFL
function [Ektp xp vp Ne_bias,Id, jS, jD, Emesh]=mc(XI,E1,Vd_bias);
%%%%%% Numerical specification, inpute Em in the node grid, but output Ne,
%%%%%% Fn on the element grid
global q kBT
global vF Egh1
% global set by inp_mc.m
global n t_step qsup Ntran Nstdy Degflag Balflag % MC simulation parameter... |
%% Measument of Distance from Direct and Reverberant Energy
% Audio files should be saved in "audio" folder, and named "d_room_trial.m4a", where d
% is the source distance in meters, room is the room ID, and trial is the trial number.
close all;
clear all;
clc;
%% Create variables
len = 44100*.8; %Total length
pre... |
function [theta, delta] = dcbm_theta_update_cham_pock(d,tau,varargin)
%function [theta, delta] = dcbm_theta_update_cham_pock(d,tau,alpha,r,sig,VERBOSE)
parser = inputParser;
parser.KeepUnmatched = true;
addOptional(parser,'alpha',1)
addOptional(parser,'r',1)
addOptional(parser,'sig',1)
addOptional(parser,'VERBOSE',0)
... |
%%% Creates the load vector used in FEM
%%% Code obtained from instructions to Lab1 in the
%%% course "Applied Finite Element methods" @ Uppsala University
function B=load_vect(x,RHS)
N = length(x);
B = zeros(N, 1);
for i = 1:N-1
h = x(i+1) - x(i);
n = [i i+1];
B(n) = B(n) + [RHS(i); RHS(i+1)]*h/... |
% Format existing plot and write out:
function [] = WriteImg(Img, Name, Lims, Scale, ColourBar)
disp('Starting WriteImg...');
if CountEnv({'OutDir'}) < 1;
disp('Missing environment variables');
return
end
% Scale:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%... |
clear all
clc
% Plot of spatial concentration neurotransmitters after different time
Nx = 10;
Nt = 200;
x = linspace(0,1,Nx);
xx = linspace(0,1,Nx*10);
fileID = fopen('ExplForwEuler.dat','r');
sol_EFE = fscanf(fileID,'%f %f',[Nt Nx])';
fclose(fileID);
fileID = fopen('ImplBackEuler.dat','r');
sol_IBE = fscanf(file... |
%% System Numeric State-Space Model
% ########################################################################
% Calculate numeric state matrix of a multi-inverter system
% Input:
% - [obj] inverter parameter
% - [obj] control parameter
% - [obj] grid parameter
% Output:
% - [obj] state-space ... |
function signals = dsp__generate_fake_data(signals)
tests.window = 21; % t = 0;
tests.f = 1e2;
tests.fs = 1e3;
tests.time = 1:length(signals.data{1});
tests.sine = 3 .* sin(2 * pi * tests.f/tests.fs * tests.time);
tests.noise_amplitude = 1.5;
tests.modified_data = signals.data(:,tests.window);
for i = 1:numel(test... |
clear
load pretest.mat
fs = 30;
shift = 0.2;
t = ((1:24)/fs)'+shift;
xx = tall_pretest(:,4) == 0;tall_pretest(xx,4) = 2;
idx1 = ~isnan(tall_pretest(:,4)) & (tall_pretest(:,4) == tall_pretest(:,2));
idx2 = ~isnan(tall_pretest(:,4)) & (tall_pretest(:,4) ~= tall_pretest(:,2));
tall_pretest(idx1,4) = 1; tall_pretest(idx2... |
function result = avoidcopies_operators
% AVOIDCOPIES_OPERATORS
% Compares the time of code segment 1, which does not use in-place function calling, to
% the time for code segment 2, which does. It returns a structure with the
% fields:
%
% timeSegment1= time for code segment 1
% timeSegment2= time for code ... |
home = pwd;
if ispc
% setup the path
addpath( strcat( home, '\turboUtils'), ...
strcat( home, '\turboUtils\freeDistance' ), ...
strcat( home, '\turboUtils\EXIT' ));
else
% setup the path
addpath( strcat( home, '/turboUtils'), ...
strcat( home, '/turboUtils/freeDistance' ),... |
% RANSAC - Robustly fits a model to data with the RANSAC algorithm
%
% Usage:
%
% [M, inliers] = ransac(x, fittingfn, distfn, degenfn s, t, feedback, ...
% maxDataTrials, maxTrials)
%
% Arguments:
% x - Data sets to which we are seeking to fit a model M
% It is assumed ... |
function num = SngBinToNum(bit)
%num = s.*2.^(c-127).*(1+f)
%find the number is positive or negative
if bit(1)==0
s = 1;
else
s = -1;
end
c = 0;
for i=2:1:9
c = c + bit(i).*(2.^(9-i));
end
f = 0;
for i=10:1:32
f = f + bit(i).*((1./2).^(i-9));
e... |
function RHOHAT = mc(rho0, sigma2, T, B)
% stephane.adjemian@univ-lemans.fr, 2014
RHOHAT = NaN(B,1);
for i=1:B
y = simulate_ar1(T, rho0, sigma2);
RHOHAT(i) = estimate_ar1(y);
end |
function output = evalGalPathway_GAL234( param, trait, G2level, G3level, G4level, fit_type )
% this function is modified from 'evalGalPathway'
% it's called by 'mcmc_for_GAL234' and 'param_fitting_plot_GAL234'
% the function calculates the objective function value of GAL1, GAL3, GAL4
% separately, then sum up them toge... |
% The MIT License (MIT)
%
% Copyright (c) 2016 Paul Watkins, National Institutes of Health / NINDS
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including wit... |
% This program tests heading discrimination for flow fields made of
% plaids. The envelopes are stationary, the patterns move. We're using
% up/down staircases to find observers' subjective forwards. Start
% values are randomly selected from the range of legal values.
%
%
% DMG
% Last Edited: 04/07/2015
clear all;clos... |
%% Load/build whisking structures
data_directory = 'C:\Users\jacheung\Dropbox\LocationCode\DataStructs\';
load([data_directory 'excitatory_clean.mat']);
feature_list = {'angle','phase','midpoint','amplitude','velocity'};
whisk_struct = CompileWStruct(data_directory, feature_list);
%% Main Figures 2
% Figure 2A: whiski... |
function mb_newton(searchMode, mode, n)
fprintf(['\n N = ' num2str(n) '\n' ...
'Using ' mode ' method update\n'...
'Using ' searchMode ' method update\n']);
epslon = 20;
x = zeros(n, 1);
X = sym('x', [n, 1]);
func = target(n, X);
dFunc = jacobian(func, X);
objFunc = @(x) target(n, x);
objFuncVal... |
clear
% sva=importdata('/home/ywh/work2/git/emc2/build/tests/motion_test/sva.txt');
% figure (1);
% plot(sva(:,1),sva(:,2),'-r');
% hold on;
% plot(sva(:,1),sva(:,3),'-k');
% hold on;
% plot(sva(:,1),sva(:,4),'-b');
% hold on;
% plot(sva(:,1),sva(:,5),'-g');
% hold on;
% grid on;
pose=importdata('/home/ywh/work2/git/e... |
% Dark frame calibration
darkcal = 'DARK10M.mat'
darkdata = load(darkcal);
% Light frame calibration
lightcal = 'LIGHT10M.mat'
lightdata = load(lightcal);
norms = cellfun(@minus,darkdata.frame, lightdata.frame, 'UniformOutput', false);
% assume data is stored in variable frames, a 1D vector of cell arrays,
% each entr... |
function [X,normXweights,original_order] = outnormalizeDataX(X,normXweights,options);
%function [X,normXweights,original_order] = outnormalizeDataX(X,normXweights,options);
if nargin>1
default_options.useExternalWeights = ~isempty(normXweights);
else
default_options.useExternalWeights = 0;
end
defa... |
load evals50.mat
d1 = D;
load evals100.mat
d2 = D;
plot(real(d1),imag(d1),'o',real(d2),imag(d2),'*','LineWidth',1.5)
legend('50x50','100x100')
grid on
xlabel('real(\lambda)','FontSize',14)
ylabel('imag(\lambda)')
set(gca,'FontSize',16)
|
function [U,Ud,data] = linear_elasticity(V,F,b,bc,varargin)
% LINEAR_ELASTICITY Compute the deformation of a 2D solid object according to
% a linear model of elasticity, assuming a linear isotropic material.
%
% U = linear_elasticity(V,F,b,bc)
% [U,Ud,K] = linear_elasticity(V,F,b,bc,'ParameterName',Parameter... |
function score=MDPPI(x,dim,numit,weighted)
% MDPPI Multi-dimensional PPI
%
% Input: x: [d,N] input data set containing N points of dimension d
% dim: positive integer, dimensionality of the projections
% numit: positive integer, number of iterations
% weighted: logical. Indic... |
function ofdmSeq = ofdm_mod(qamSeq, qamNo, cpr)
P = length(qamSeq)/qamNo;
% cfr. figure 2: M-ary QAM OFDM frames and packet
% frame: 0 QAM_i 0 QAM_i*
% Explain the necessity of the `mirror operation' in each frame from a signal processing point of view.
% The mirror operation insures that when the IDFT is applied to... |
% Aug_GARCH_1_1_calibration.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code: GARCH_1_1_calibration.m %
% Student Name: Jonathan Nolan %
% Student Number: 16071514 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function op_params = GARCH_1_1_cali... |
%%% START PROGRAM %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Clear Workspace variables
clear;
% Enter debugging mode if an error occurs
%dbstop if error
%dbclear all
% Determine Operating System
c = computer();
% Add paths
switch computer
case 'GLNXA64' %Linux
addpa... |
% pSetModelSpecificCutoffs sets model-specific cutoffs using data from alignments and randomly-generated data
% Each sequence is represented by a structured variable whose fields are:
% .Deficit
% .CoreEdit
% .FullEdit
% .Conserved
% .NumInstances
% .MLPS
% .Length
% .Source = 1 for alignment, = 2 for random but wh... |
function [e, varargout] = neterr(w, net, x, t)
%NETERR Evaluate network error function for generic optimizers
errstr = [net.type, 'err'];
net = netunpak(net, w);
[s{1:nargout}] = feval(errstr, net, x, t);
e = s{1};
if nargout > 1
for i = 2:nargout
varargout{i-1} = s{i};
end
end
|
function prob = P_1(i, m,lambda ,T)
prob=0 ;
for k = 1:i
prob = prob +(1/(m-k)) /SumNormalize(0,m-1,lambda,tmStar(m,lambda,T)) * exp( -lambda* tmStar(m,lambda,T) ) * ( lambda* tmStar(m,lambda,T) )^(m-k-1) /factx(m-k-1) ;
end
end
%prob = prob + (1/(k))*exp( -lambda * tmStar(m,lambda,T) ) * (lambda*... |
classdef LinearTransformationBase < handle & matlab.mixin.Copyable
%TRAJECTORY Encapsulates trajectory functionality
% Detailed explanation goes here
properties
% The matrix form of the transformation
% Dependant on the other data members and updated through
% updateTransforma... |
clearvars;
close all;
OriginalImg = imread('Original.png'); % Original.png 영상 읽기
figure('Name','Original image','NumberTitle','off'), imshow(OriginalImg); % Original 영상 보여주기
InputImg = imread('Input.png'); % input.png 영상 읽기
figure('Name','... |
function varargout = VScope_start(varargin)
% VSCOPE_START M-file for VScope_start.fig
% VSCOPE_START, by itself, creates a new VSCOPE_START or raises the existing
% singleton*.
%
% H = VSCOPE_START returns the handle to a new VSCOPE_START or the handle to
% the existing singleton*.
%
% ... |
% Reads 3 Numbers a, b, and c, and prints c only if c is within a and b
a = input('Enter integer a.');
b = input('Enter integer b.');
c = input('Enter integer c.');
if ( a > c & b < c)
fprintf('The number %d is within %d and %d.', c, a, b)
else
fprintf('Error: c is not within a and b. Please try agai... |
% Copyright (c) 2012, Michael Mallon
% All rights reserved.
% Redistribution and use in source and binary forms, with or without modification,
% are permitted provided that the following conditions are met:
% Redistributions of source code must retain the above copyright notice, this list
% of conditions and t... |
function [Z_global,X_global] = PSO(omega,alpha,beta,xmin,xmax,ymin,ymax,itermax,N_part,fonction)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
X = xmin + (xmax-xmin).*rand(2,N_part);
VX = zeros(2,N_part);
X_local = X;
X_global = X(:,1);
scatter(X_local(1,:),X_local(2,:));
xlim([xmi... |
%DigImg Final Project
%04-26-2020
%Joshua Snider
%Use result from detectTennisBall to getBallCenter and return that point.
function dataPoint = getBallCenter(bwImg)
%test img passed in is binary, assume true
binaryCheck=1;
for y=1:size(bwImg,1)
for x=1:size(bwImg,2)
if (bw... |
[x,fs]= audioread('sample.wav');
x = mean(x, 2); % mono
x = x/max(abs(x));
x_hf=filter([1 -0.9375],1,x);
[A,G,Err]= my_encode(x_hf,fs,48);
F=pitchdetect(Err,G);
%F = zeros(size(F));
est_x=decode(A,[G F], fs,0/(fs));
f = fcombine(F,fs);
%est_x=filter(1,[1 -0.9375],est_x);
est_x = est_x/max(abs(est_x));
esxf = fft(est_... |
%% LineMesh_p1.m
% REFERENCE: http://www.cs.rpi.edu/~flaherje/FEM/index4.html
% REFERENCE: http://www.math.chalmers.se/~mohammad/teaching/PDEbok/draft_FEM_version4.pdf
xmin = 0; xmax = 1;
N = 5;
xvals = linspace(xmin, xmax, N+1);
verts = zeros(N+1,1);
for i=1:N+1
% How do we create a list of vertex points?
ver... |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clc;close;clear
addpath([pwd,'/utility/'])
load('data.mat')
whos
% Name Size Bytes Class Attributes
% alphas ... |
function IRC = Construct_IRC()
%CONSTRUCT_IRC Summary of this function goes here
% Detailed explanation goes here
IRC.turn_rps = 0; % turning velocity rad/s
IRC.motor_power = 0; % related to STO button SA
IRC.step_time = 0;
IRC.ds = 0;
IRC.Vx_tgd = 0;
IRC.Vy_tgd_avg = 0;
IRC.H = 0;
IRC.desired_com2stToe_lateral = 0... |
% This class creates and manages axes insets, which are useful for
% highlighting details in a plot.
%
% Insets are generated from a bounded region of a source axes. A rectangle
% is drawn on the source axes to indicate the inset bounds, and all
% graphical content in these bounds is reproduced in a separte (inset) ax... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Elad Gilboa
% 2013
%
% gpr_cov_grid_predict_parallel()
%
% Fast perallel prediction for GP-grid by using alpha which is the vector
% equivalence of (K^-1)y calculated by gpr_cov_grid_dn
%
% Usage: [mu_f, std_f] = gpr_cov_grid_predict... |
function [vf, vdot] = diffEst_adrc(t, v,r,dlt_r)
% ================================================
% differential estimation algorithm based on Active Disturbance Rejection
% Control Technique (ADRC) developed by Jing-Qing Han (2008)
% <<自抗干扰控制技术-估计补偿不确定因素的控制技术>>
% Jing-Qing Han, Active Disturbance Rejectio... |
function [f, gradients] = jacobian_convtriangle_attachment(p, tangent_gradient, gradients, mode)
D = length(p);
switch mode
case 'v'
v1 = tangent_gradient.v1;
v2 = tangent_gradient.v2;
v3 = tangent_gradient.v3;
case 'u'
v1 = tangent_gradient.u1;
v2 = tangent_gradient.u2... |
%make movie
clear all;
screen_all = [];
warning('off','all')
load mean_Neo0
screen_all = [screen_all; mean_Neo0];
load mean_Neo1
screen_all = [screen_all; mean_Neo1];
load mean_Neo2
screen_all = [screen_all; mean_Neo2];
load mean_Neo3
screen_all = [screen_all; mean_Neo3];
load mean_Neo4
screen_all = [screen_all; mean_N... |
function h = dsfig(f)
% DSFIG Creates or switches to a figure window.
%
% function dsfig(f)
%
% Creates or switches to a figure window. When switching to an
% existing figure window, prevents that window taking the focus.
% If given a string, finds the figure with that name.
% If none exists, creates a figure with ... |
% %FE_BOUNDARY Solver
% UI - 12x1 - column of u and it's derivatives
% nvx and nvy - components of normal vector at chosen region
% Ca, Cb - elastic moduli tensor
% rho(i+ii,j+jj),rho(i,j) - densities A0ove and below the interface
% dx,dz - grid step
% eta0x, eta1x -sum=1, show where interface intersects vertical grid ... |
% written by professor Jay McClelland
function [] = initParamsEtc( )
%
global p d a
p.wf = .15;
% p.handTime = 5; % the amount of time needed to move hand
p.eyeTime = 1; % the amount of time needed to move eye
p.learner = 1; %
p.lrate = .1; % alpha
p.runs = 4096; % epochs
p.gamma ... |
function H = GLPfilter(D0,P,Q)
%GLPfilter 高斯低通滤波器
% 此处显示详细说明
H = zeros(P,Q);
for i=1:1:P
for j=1:1:Q
d=((i-P/2)^2+(j-Q/2)^2)^(0.5);
H(i,j)=exp(-d^2/2/D0/D0);
end
end
end
|
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
%
% Step response of discrete time system
% H(z)=(0.1z-0.1)/(z^2-1.5z+0.7)
num=[.1 .1];
den=[1 -1.5 0.7];
dimpulse(num,den)
figure
h=dimpulse(num,den);
stairs(0:length(h)-1,h)
legend('Impulse r... |
%% Estimate grid spacing
% Matlab Colony Analyzer Toolkit
% Gordon Bean, December 2012
%
% Estimate the grid spacing from an plate image
%
% Future improvements(?) under construction. Hard hats recommended.
function win = estimate_grid_spacing( plate, varargin )
params = default_param( varargin, ...
'bo... |
resolution_steps = 10;
max_N = 100000;
D = 500;
n_k_1 = 100;
n_k_2 = 1000;
ssc_exact = zeros(resolution_steps + 1, 1);
ssc_relaxed = zeros(resolution_steps + 1, 1);
kssc_exact_1 = zeros(resolution_steps + 1, 1);
kssc_relaxed_1 = zeros(resolution_steps + 1, 1);
kssc_exact_2 = zeros(resolution_steps + 1, 1);
kssc_rel... |
function [ M_integer, nRegionsFinest, M_estimate, nRegions, totalRegions ] = find_num_levels_suggested( NUM_DATA_POINTS_n, NUM_KNOTS_r, NUM_PARTITIONS_J )
%% FIND_NUM_LEVELS_SUGGESTED is a stand-alone function that estimates number of levels
% Finds the number of levels for a given number of observations, number
% ... |
function [residual, g1, g2, g3] = BC_19March2019_RBC_with_K_N_dynamic(y, x, params, steady_state, it_)
%
% Status : Computes dynamic model for Dynare
%
% Inputs :
% y [#dynamic variables by 1] double vector of endogenous variables in the order stored
% in M_.... |
clear
W = 133;
n = 256;
m = 31;
esp = 0.11;
eps_d = 0.06;
bw = chebwin(W-m+1,100);
shift = @(x) [zeros(x,W-x),eye(x);eye(W-x),zeros(W-x,x)];
BW = zeros(W,m);
BW((m+1)/2:(m+1)/2+W-m,1) = bw;
for i = 1:(m-1)/2
BW(:,2*i) = BW((W+1)/2+i,1)*shift(i)*BW(:,1);
BW(:,2*i+1) = BW((W+1)/2-i,1)*shift(W-i)*BW(:,1);
e... |
function rotation = EXPCR(X)
% X is a 3x1 vector represent rotation axis n and angle theta
theta = norm(X);
% if X is a zero vector rotation should be an identity matrix
if theta == 0
rotation = eye(3,3);
else
n = X / theta;
% compute exp(n_hat * theta)
n_hat = SKEW3(n);
rotation = expm(n_hat * ... |
function [ IRF_plot, F ] = BS_IRF( data,p,constant,reps,level,model,horizon,H )
%% DOCSTRTING
%
%This function will generate the bootstrap confidence intervals for the
%impulse response function. The output is a tensor with all the shocks'
%IRF and the upper and lower confidence bands based on the indicated
%confidence... |
function [ choice ] = chooseMax(strengths)
% find the index of the largest element in the input vector
choice = find(strengths == max(strengths));
if numel(choice) > 1
idx = randperm(numel(choice),1);
choice = choice(idx);
end
end
|
% Academic License
% Engineering 006 Homework
%
% These programs, solves the 4 problems in homework 2 prompt.
%
% Eng 6, Spring 2016
% Name: <Chengeng Xiao>
% Student ID: <913186040>
% Lab Section: <A07>
%% Problem 1:
start = 0;
stop = 50;
stepSize = 1;
timeIncrement = start:stepSize:stop;
lambda = 1... |
filename=strcat(DATA_FOLDER,'flux_geometry.mat');
load(filename);
filename=strcat(DATA_FOLDER,'tokamak_PR_map.mat');
load(filename);
filename=strcat(DATA_FOLDER,'B_fields.mat');
load(filename);
filename=strcat(DATA_FOLDER,'q_profile.mat');
load(filename);
filename=strcat(DATA_FOLDER,'pressure_profile.mat');
load(filena... |
%function curve = skewgaussian2(x,A,FWHM,Offset,Skew)
function curve = skewgaussian2(bb,x)
A=bb(1); FWHM=bb(2); Offset=bb(3); Skew=bb(4);
%
%Usage: curve = skewgaussian([A,FWHM,Offset,Skew],x);
%
if Skew==0
curve=gaussian(x,A,FWHM,Offset);
else
sigma=FWHM*sqrt(log(2))*exp(-Skew/2);
g=sqrt(log(2))*(1-exp(-... |
% Copyright [2021] [Adam Berrington]
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by appli... |
# Script for image analysis of turbity current video frames
# Required external functions:
# useful_functions script file video grab functions
#
###########################################################################
# MANUAL INPUT PARAMETERS
pkg load image
FONTSIZE = 24; # this seems about OK for the si... |
function Y = f_diag(X,A)
% - replace diagonals of a square matrix
%
% USAGE: Y = f_diag(X,A)
%
% X = square input matrix
% A = scalar value to replace diagonals of X matrix with
%
% Y = new matrix with A's along the diagonal
% -----Author:-----
% by David L. Jones, Feb-2011
%
% This file is part of the FATHOM Toolb... |
function dq = linevel2dq(v,r,vp,rp)
% LINEVEL2DQ Transforms a line velocity expressed in vector notation
% into its dual quaternion representation.
%
% DQ = LINE2DQ(V,R,VP,RP) transforms the line position, specified by:
% - the line orientation V
% - the position of an... |
data = load('boat_variables');
plot(data.ans(1,:), data.ans(2,:),'blue'); % desired course angle
hold on;
plot(data.ans(1,:), data.ans(3,:),'red'); % rudder
hold on;
plot(data.ans(1,:), data.ans(4,:),'magenta'); % compass
hold on;
title('Autopilot with measurement noise & wave disturbance');... |
function dispHelp(hfig,evnt) %#ok
gd=guidata(hfig);
str0=strjust(char(['Version',sprintf(' %0.2f',gd.version)],...
' written by Andrew Stevens',...
['Last Modified ',gd.modified],' '),'left');
str1=strjust(char('If you have questions',...
'or want to report a bug, contact me:',' '),'left');
str2=strjust(ch... |
clear
close all
color_order = [ 0 0.4470 0.7410
0.8500 0.3250 0.0980
0.9290 0.6940 0.1250
0.4940 0.1840 0.5560
0.4660 0.6740 0.1880
0.3010 0.7450 0.9330
0.6350 0.0780 0.1840];
folder = uigetdir();
listing = dir(folder);
int_array = false(length(list... |
clear;
load('G:\无源感知研究\数据采集\2019_07_18\会议室(3t3r)(1).mat');
sample_num = size(csi_train,1);
for i=1:sample_num
csi_train1{i, 1} = csi_train{i, 1}(:,181:270);%对序列进行转置
end
clear csi_train sample_num i
csi_train = csi_train1;
clear csi_train1
save('G:\无源感知研究\数据采集\2019_07_18\改变天线数据\会议室(3t3r)(1)_t3') |
function [A,A_hist,loss] = OnlineItml(C,X,A_0,params)
disp('Running Online ITML....');
eta = params.eta;
A = A_0;
[c,t] = size(C);
A_hist = cell(1,99);
cell_index = 1;
loss = zeros(1,size(C,1));
for i = 1:c
i1 = C(i,1);
i2 = C(i,2);
target_dis = C(i,4);
z = X(i1,:) - X(i2,:);
current_dis = z*A*z';
a... |
classdef PolarisationSpectrum < Modules.Experiment
% PolarisationSpectrum Measures spectra at specified rotations of a motorised HWP or polariser to
% give polarisation dependent spectra
% Data structure for Nangles polarisation angles measured:
% data: angle - 1 x Nangles struct arr... |
classdef spindle < handle
properties
% These are properties that can be accessed from outside the
% spindle class
spindle_length;
spindle_force = 0;
%static_fiber
static_force = 0;
static_hs_length;
static_series_length;
... |
%%MK II PI GAIN
clc
%%longitudinal
CD_o=
CD_u=
CL_u=
CL_o=
CD_a=
Cm_u=
Cm_a=
Cl_a=
%%lateral
Cy_b=
Cy_p=
Cn_b=
Cn_p=
Cn_r=
Cl_b=
Cl_p=
Cl_r=
%% Physical parameter
V=
Sref=
Mac_w=
p=
Q=
lw=
lt=
lv=
M=
bw=
Ixx=
Iyy=
Izz=
Ixz=
da=
Uo=
%%
Xu=(-(Q*S)*(CD_u+2*CD_o))/M*Uo |
function [f,e1,e2] = fundmatrix(x)
%computes the fundamental matrix from 8 or more points in a stereo pair of images.
%The normalized 8 point algorithm has accurate results with 12 or more points.
if size(x,1) ~= 6
error('x must be 6 by N');
else
x1 = x(1:3,:);
x2 = x(4:6,:);
end
npts = size(x,2)
if np... |
clc
clear
close all
tf = 10;
base_length = .4;
base_width = .4;
base_height = .01;
foot_length = .03;
leg1_base = .1;
leg1_top_length = .05;
leg1_top_width = .01;
leg1_top_height = .01;
leg1_top_thickness = .005;
foot_h = .05;
foot_l = .15;
foot_w = .08;
foot_p = 150/(foot_h*foot_l*foot_w)/2;
% Kinematic para... |
function pcurr_out = pcurr_sa01_fit(ac_vmec, xx)
pcurr_out = pcurr(xx, [0 1 ac_vmec(1:end)], [], [], 'sum_atan');
|
function [stim_onset,stim_offset] = StimOnsetExceptions(sbj_name,bn,stim_onset,stim_offset)
% handles exception cases with missing photodiode pulses, etc.
switch sbj_name
case 'S16_99_CJ'
if strcmp(bn ,'E16-1107_0005')
stim_onset = [stim_onset(1:97) NaN stim_onset(98:189) NaN stim_onset(190:end... |
function[]= graphe_surc(sc,sd)
C=(1/9)*[0 7 8 6 7;
2 0 6 6 7;
3 3 0 3 7;
3 6 6 0 7;
3 3 8 2 0];
D=(1/10)*[10 2.4 0.8 2.4 1.2;
1.2 10 1.2 3.6 0.6;
3 2.4 10 3 1.2;
1.8 4.2 1.8 10 3;
3 2 0.8 3 10];
vect = ['a' 'b' 'd' 'e' 'h'];
fid = fopen('graph.dot','w');
fp... |
function [new_matches,desc1,desc2] = matching(img1,img2,peak_thresh, n_iterations, epsilon)
%% Steps 1 and 2
[frames1, desc1] = vl_sift(img1,'PeakThresh', peak_thresh);
[frames2, desc2] = vl_sift(img2,'PeakThresh', peak_thresh);
%% Step 3
[matches, ~] = vl_ubcmatch(desc1,desc2,3);
desc1 = desc1(... |
function X = fevalImages( fHandle, prms, srcDir, name, ext, ...
nStr, nEnd, nDigits )
% Used to apply the same operation to all images in given directory.
%
% For each image in srcDir, loads the image, applies the function in
% fHandle and stores the result. The result x=fHandle(I,prms{:}) on the
% ith image is sto... |
%%% channel_sounder_matlab %%%
% This file is used to set up a ADALM-Pluto radio to transmit. After the
% file is finished running the transmitter will begin transmitting.
% Additionally, if there is an external power source for the radio, it may
% be disconnected from the computer and it will continue to transmit.
%... |
function compile_pascal_data(cls,year)
startup;
[pos, neg, impos] = pascal_data(cls,year);
save(pos,'pos.m');
save(neg,'neg.m');
save(impos,'impos.m');
end
|
Peru_Infected_All =[];
Peru_Recovered_All = [];
Peru_Dead_All = [];
str1 = "Peru"
str2 = "Peru"
str3 = "Peru"
for i = 26:31
fname = strcat ( '03-', num2str(i), '-2020.csv' );
P = readtable(fname);
A = P.Combined_Key;
Array = strings(1, length(A));
for j = 1:length(A)
Array(j) = A{j};
end
index = fin... |
function calibration = calibrate(channel, rewardController, scales, tMin, tMax)
%HW.CALIBRATE Performs measured reward deliveries for calibration
% This function is used by srv.expServer to return a water calibration. It still requires some scales to be attached to
% the computer. TODO: Sanitize and integrate int... |
function [obsStruc, time_ref, time, week, date, rxPos0, interval, antoff, ...
antmod, rxmod, obsColumns] = readCompObsFile(filename,constellations,settings)
% function to open and read a compressed observation file
if nargin < 3
settings = [];
end
% check if this is fully uncompressed observation file.
[dirP... |
addpath('..');
addpath('../../utils');
number_of_samples = 1000;
mean_rx = 3.8;
mean_ry = 3.5;
mean_Xo = 0.4;
mean_Yo = 0.2;
var_rx = 0.05;
var_ry = 0.05;
var_Xo = 0.1;
var_Yo = 0.1;
Matlabdata = zeros(number_of_samples,2);
Matlabtimes = zeros(number_of_samples,1);
Cdata = zeros(number_of_samples,2);
tic;
fileID = f... |
%* Revised Sum-Product Algorithm
%*
%* References:
%* [1] S.J. Johnson, "Low-Density Parity-Check Codes: Design and Decoding",
%* Wiley Encyclopedia of Telecommunications, Wiley, Apr. 2003
%*
%* Author: T.J. Cheng, 2016
%*
%* 2016-11-30: It works fine for Example 2.6 in [1].
%*
clc
clear all;
... |
clc;clear; close all;
load mini_mnist.mat
% y and X
rand('seed', 1);
randn('seed', 1);
% Data dimensions
[N,D] = size(X);
%Params
%Clasifier options
options = optimset('GradObj','on','MaxIter',100);
lambda = 0.01;
% number of classes, indexed from 1 to Nclasses
Nclasses = 10;
% Tran test splitting
[index_tra... |
%Whale Group
function rxp = ratioxp( betax, muj, mux, k )
rxp = ( betax * mux * muj^10 + mux ) / ( 1 - mux * k ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.