text stringlengths 8 6.12M |
|---|
function f = constructbutterfilter(res,cutoff,order)
% function f = constructbutterfilter(res,cutoff,order)
%
% <res> is the number of pixels along one side
% <cutoff> is
% A means low-pass filter cutoff (in cycles per field-of-view)
% -B means high-pass filter cutoff (in cycles per field-of-view)
% [A B] means ba... |
CIFAR_DIR = 'alloy_mat';
CIFAR_DIM = [200 200 1];
% if ~exist(CIFAR_DIR, 'dir'),
% system('wget http://www.cs.toronto.edu/~kriz/cifar-10-matlab.tar.gz');
% system('tar -zxvf cifar-10-matlab.tar.gz');
% system('rm cifar-10-matlab.tar.gz');
% end
|
%% initialise_naive.m
% A script which initialises a solution by allocating all jobs to machine
% number 1.
%% Input:
% input_array: n+1 length vector of job costs, and n+1th element is # of
% machines
% num_jobs: the number of jobs
%% Output:
% init_alloc: left two columns of output_array
... |
function [] = testmin()
% test minimization results
for ii = 1:20; fprintf('\n'); end
warning('off','optim:fmincon:SwitchingToMediumScale')
dbg = 0;
% pause time
pse = 5;
np = 1001;
%% test unconstrained
fprintf('Unconstrained test - https://en.wikipedia.org/wiki/Test_functions_for_optimization\n\n\n')
% sphere... |
%This demonstrates "york_fit", showing ability to fit a line to data with
%errors in x and y (including different errors for each point)
%Copyright Travis Wiens 2010 travis.mlfx@nutaksas.com
N = 20;%number of points
X_range=[-1 1];%range of X values
sigma_X_max=0.1;%maximum std error in X
sigma_Y_max=0.1;%maximum st... |
function [X,bndclsn]= refl_bound3d(X,R,bndclsn);
%find norm of vector
nrml=sqrt(sum(abs(X(:,1:3)).^2,2));
%index polymersomes outside radius of petri dish
ind=find((nrml)>R);
if length(ind)>0
%reflect polymersome around boundary, modulus is used instead of
%subtraction incase psome is further out than... |
powerdBm = 0:50;
powerWatts = 10.^(powerdBm/10 - 3);
voltage = sqrt(50*powerWatts);
device1 = voltage/0.25; % 0.25 centimeter gap for stripline
device2 = voltage/0.4; % 0.4 centimeter gap for coax airline
device3 = sqrt(4*401.5*powerWatts/(7.21*3.4)); %WR284 equation in notebook
device4 = sqrt(4*401.5*powerWatts/(10.9*... |
% function to do slow coherency aggregation
while(0)
% generator data vector and angle
e = [1.10; 1.08]; % internal voltage
delta = [30; 50]*pi/180; % rotor angle
m = [7; 5]; % machine inertia (2H)
xdprime = [0.17; 0.21]; % transient reactance
% bus voltage data
v = [1.01; 1.02]; ... |
function param = setRBMParam(use_gpu)
%set Gaussian RBM params
param.image_height = 50;
param.image_width = 50;
param.image_channel = 3;
param.data_size = 5000;
param.batch_size = 100;
param.image_scale = [param.image_height, param.image_width];
%set replicated softmax rbm
param.top_words = 2000;
co... |
function X = X(x)
% operator bold X defined in the appendix of the paper
% -------------------------------------------------------------------------
% x is a matrix (n times r)
[n, r] = size(x);
is = double.empty(2*r*n*n,0);
js = double.empty(2*r*n*n,0);
vs = double.empty(2*r*n*n,0);
l = 1;
% In... |
%
% ISEL - Instituto Superior de Engenharia de Lisboa.
%
% LEIC - Licenciatura em Engenharia Informatica e de Computadores.
%
% Com - Comunicações.
%
%
% time3.m
% Função de teste.
%
function time3()
% Limpar a consola.
clc;
% Mensagem de início
fprintf(' Função time3 \n');
% Dimensões da matriz.
NRows = 8000;
N... |
function [ y, lb, ub,x, M ] = Boha_2d()
addpath('help_functions')
addpath('TPLHD')
n = 2;
lb = [-100;-100]; % lower bound
ub = [100;100];
% Initial samples
x = scaled_TPLHD(6,lb,ub);
M = @(xx) Boha_function(xx);
y = zeros(size(x,1),1);
for i=1:size(x,1)
y(i,1) = M(x(i,:));
end
end
function y = ... |
% Generated through Matlab
% Author: Killian Keller
% E-Mail: killian.keller@ief.ee.ethz.ch
% Organization: ETHZ ITET IEF
function [Es, Ei, Ep, g0] = Propagate(Es, Ei, Ep, z)
% Specification of the Type of Phase Matching
phase = "Perfect";
Estemp = cell(length(z), 1);
... |
function plotWaveforms(w, assignment, varargin)
% parse optional inputs
p = inputParser;
p.addOptional('clusters', ':', @(x) isnumeric(x) || ischar(x) && isequal(x, ':'));
p.addOptional('waveforms', 20, @(x) isnumeric(x) && isscalar(x));
p.addOptional('figure', 4, @(x) isnumeric(x) && isscalar(x));
p.parse(varargin{:}... |
function [T] = Image_Alignment(pA, pB)
% hw1_transform: compute transformation from A to B
% Number of points
N = size(pA,2);
% Initialize transformation matrix T
T = eye(3);
% Compute transformation matrix T (IMPLEMENT HERE!!)
A_ = zeros(2*N,2*(N-1));
B = zeros(2*N,1);
for j=1:N
for i=1:N-1
... |
function [h_theta, grad_h,res,prices,jac] = Goal_F(our_matrix, param_vec, model, w)
%w_m = diag(w);
p = our_matrix(:,1);
g_theta = zeros(length(p),1);
grad_g = zeros(length(param_vec),length(p));
prices = zeros(length(our_matrix),1);
res = zeros(length(our_matrix),1);
parfor i = 1:length(p)
[g_theta(i),grad_... |
% Robotic Arm Control via MATLAB and Arduino
% Note: Make sure to clear all variables in the workspace before running
% this code
function varargout = RoboticArmControl2(varargin)
% ROBOTICARMCONTROL2 MATLAB code for RoboticArmControl2.fig
% ROBOTICARMCONTROL2, by itself, creates a new ROBOTICARMCONTROL2 or raise... |
function tTV_update = compute_tTV_yt(image,weight,beta_square)
if weight~=0
temp_a = diff(image,1,3);
temp_b = temp_a./(sqrt(beta_square+(abs(temp_a).^2)));
temp_c = diff(temp_b,1,3);
tTV_update = weight * cat(3,temp_b(:,:,1,:,:,:),temp_c,-temp_b(:,:,end,:,:,:));
else
tTV_update = 0;
end
end |
%% Prework
clear all;
clc;
load('Measured_vs_Simulated_allDosis_Mask_TK.mat');
CA1=table2cell(MeasuredvsSimulatedallDosisMaskTK);
CountTF=size(CA1,1);
countvalue_pairs= ((size(CA1,2)-1)/2);
%% Calculation of relative procentage difference between mes and sim + plot
%(TF_x_sim-TF_x_mes)/TF_x_mes
differ_mes_vs_sim(Coun... |
addpath('constants')
addpath('controls')
addpath('GUI')
addpath('logic')
addpath('simulink')
addpath('run') |
function [Vertex, Faces] = Plot3DContacts(ctVertex, ctFaces, ctSize, ChanLoc, ChanOrient)
% Apply contact size
ctVertex = bst_bsxfun(@times, ctVertex, ctSize);
% Duplicate this contact
nChan = size(ChanLoc,1);
nVert = size(ctVertex,1);
nFace = size(ctFaces,1);
Vertex = zeros(nChan*nVert, ... |
% Here are the things we want to do
% 1) Average contrast map
% 2) Similarity measure of some of the maps
% 3) Hierarchical clustering of the similarity map to find subject groups
%% Clear
clear;
%% Define the input data
in_path = '/home/surchs/Projects/stability_abstract/full_run/data/stability_maps';
% Search for the... |
%Written by K. Carroll 5/1/2012
a = 0.2;
b = 0.2;
c = 5.7;
top = (c-sqrt(c^2-4*a*b))/2;
x0n = [top, -(top/a),(top/a)];
n = [1,0,0];
th = 2*pi - atan2(n(1:1,1), n(1:1,2))
numofstpos = 10;
numofcrossover = 100;
%number of starting positions on the unstable equilibrium
numofit = 20000;
% define two vectors one... |
classdef Test_ControlsThicknessTerritoriesGlm < matlab.unittest.TestCase
%% TEST_CONTROLSTHICKNESSTERRITORIESGLM
% Usage: >> results = run(mlanalysis_unittest.Test_ControlsThicknessTerritoriesGlm)
% >> result = run(mlanalysis_unittest.Test_ControlsThicknessTerritoriesGlm, 'test_dt')
% See also: ... |
function psdFunction = psdFunction(audio_file)
[y,fs] = audioread('ADha.wav');
ydft = fft(y);
% y to be even length
ydft = ydft(1:length(y)/2+1);
% create a frequency vector
freq = 0:fs/length(y):fs/2;
% plot magnitude
subplot(211);
plot(freq,abs(ydft));
% plot phase
subplot(... |
function [t,x,y] = dsim(sys,timeSpan,state0,input)
%DSIM Simulate a discrete-time POLYSYS model.
%
% [T,X,Y] = DSIM(SYS,TSPAN,X0,U) simulates the discrete-time POLYSYS
% model SYS starting from the initial condition X0. TSPAN is a vector of
% time points at which the solution is computed. The input U is an
% ... |
function [X,y] = reformat(nums,n,d,k, featureType, labelSize)
%% Reformat a sequence of numbers into training set and labels
%nums - randomly generated sequence of numbers
%n - number of inputs
%d - Number of preceeding values used for predictions
%k - Number of classes
%featureType - determines how features for each ... |
function d = mdot(a, b)
% Matrix dot (scalar) product. Like dot, but matrix not elementwise.
% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
% See the file : Copyright.m for further details.
error(nargchk(2, 2, nargin)), error(nargoutchk(0, 1, nargout))
if ~isa(a, 'quaternion') || ~isa(b, 'quaternion')
... |
function plotdata=plotB0curlyh(lindata,ring,dpp,varargin)
spl=299792458;
Brho=1e9/spl*(6.03);
idx=cat(1,lindata.ElemIndex);
H=CurlyHlindata(lindata);
B0=zeros(size(H));
dips=findcells(ring,'BendingAngle');
B0(dips)=Brho*getcellstruct(ring,'BendingAngle',dips)./...
getcellstruct(ring,'Length',dips);
beta=cat(1,l... |
function fixedPoint(x0,g,tol)
% Input: x0 - initial guess
% g - function handle of g(x)
% tol - tolerance
x_old = x0;
k = 1;
root = 2.0945514815423;
while( abs(x_old-root)>tol )
x_next = g(x_old);
fprintf('x = %.16f for k=%d\n',x_next,k);
x_old = x_next;... |
name='aditya';
password='atm98@17';
username=input('enter username','s');
passcode=input('enter password','s');
if(strcmp(username,name) && strcmp(passcode,password))
fprintf('welcome you are authorized to access this site')
elseif(strcmp(username,name) || strcmp(passcode,password))
fprintf('username or ... |
A=xlsread('D:\matlab\work\Mutual_Information\Workdatabases\I_C1','sheet1','G2:AU271');
n=20;%分成的段数
C=Discrete_realdata(A); %对真实表达数据进行离散化:将整个矩阵分成相等的20段,A中每个数据所属的种类,所得矩阵放在C中
[m,k]=size(C);
%求矩阵C每一行向量的自信息,结果存入H_C中
for i=1:1:m
H_C(i)=Entroy_realdata(C(i,:));
end
%求矩阵C中任意两行的联合熵,结果存入H_C2中
for i=1:1:m
for... |
function [status] = proj_linesearch_for_locally_injective(Jp, L, Ngamma, Kappa, epsilon, epsilon2, z, delta, isp, status, max_number_adaptive_sampling, Proj, ls_step_size, gcc)
delta_norm = norm(delta,'fro');
delta = reshape(delta, [], 3);
r1 = epsilon*sqrt(3)/2;
r2 = epsilon2*sqrt(2)/2;
... |
%% Problem Set 4
%% Question 1
%
% The discrete wavelet transform and continuous wavelet transform share
% a similar pattern, the similarity in different scales shows that the
% signal has a self-resemblance or fractal characteristic in the original
% dimension
%
%% Question 2
I2=[5,3,15,19;4,4,13,17;2,5,12,... |
function val=valfun_det(k)
% This program gets the value function for a neoclassical growth model with
% no uncertainty and CRRA utility
global v0 beta delta alpha kmat k0 s
g = interp1(kmat,v0,k,'linear'); % smooths out previous value function
c = k0^alpha - k + (1-delta)*k0; % consumption (This is the constrai... |
clear all
close all
%%
M=50;
eps=2;
x_max = 100;
y_max = 100;
obstacle = [70,20,5,60];
obstacle2 =[10,40,50,20];
EPS = 20;
numNodes = 3000;
q_start.coord = [0 99];
scatter(q_start.coord(1),q_start.coord(2));
q_start.cost = 0;
q_start.parent = 0;
q_goal.coord = [75 10];
scatter(q_goal.coord(... |
function FaceC = compute_facecenter(cell, nodes)
FaceC = zeros(4,2);
% Compute center point of face
for i=1:4
FaceC(i,:) = 0.5 * (nodes(cell(i),:)+nodes(cell(mod(i,4)+1),:));
end
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculate glacier energy balance over UAV survey area of Fountain Glacier
% Read in the AWS data
% Headers are ignored by the matlab function xlsread
clear all % clears matlab memory
data=xlsread('Bylot_AWSdata_nohead.xlsx'); % AWS da... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%(c) Ghassan Hamarneh 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%
function Y=LimitTheJump(X);
%function Y=LimitTheJump(X);
DELTA=1;
DMAX=10;
loc1=find(abs(X)<DELTA);
X(loc1)=0;
loc2=find(abs(X)>DMAX);
% X(loc2)=0.5*DMAX; %this could change the direction of movement completely!
X(loc2)=0.5*DMAX.*sign(X(l... |
function matches = match_corners(im, pts, im2, pts2, dist, pflag)
%
% match corner interest points based on local image patch correlation.
% use Delaunay triangulation to give neighbourhood structure.
% use media flow filter
% images are assumed to be the sime size.
%
% find candidate matches within distance threshol... |
function deleteTrialStructForFinalExperiment(subjectName,iterationNumber, condition)
% This function deletes trial structs.
%
% Vijay Singh wrote this. Jan 04 2019
% Vijay Singh updated this. Feb 21 2019
% Vijay Singh updated this. Jan 03 2020
% Vijay Singh updated this. Oct 7 2021
nameOfTrialStruct = [subjectName,'... |
function resetLocalization(varargin)
%resetLocalization(varargin)
%
%this function starts characterization all over again.
%If you don't pass any moteIDs it resets all motes
global LOCALIZATION
global MAX_NETWORK_DIMENSION
MAX_NETWORK_DIMENSION=2;
if length(varargin) > 0
moteIDs = varargin{1};
else
moteIDs = ... |
clc
clear
im2 = (imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week5/stan.jpg'));
% imshow(im2);
h = (1/8 )*ones(3,3);
h(3,3)=0;
z = fftshift(fft2(h,256,256));
z1 = abs(z);
z7 = mat2gray((z1));
k1 = 1:1:256;
k2 = 1:1:256;
[k1,k2] = meshgrid(k1,k2);
l1 = h.';
vector_h = l1(:);
vector_h = vector_h';... |
mu = mean(XTrain3,2);
sg = std(XTrain3,[],2);
XTrain2SD = XTrain2;
XTrain2SD = cellfun(@(x)(x-mu)./sg,XTrain2SD,'UniformOutput',false);
XTest2SD = XTest2;
XTest2SD = cellfun(@(x)(x-mu)./sg,XTest2SD,'UniformOutput',false);
XTrain3SD=(XTrain3-mu)./sg;
XTest3SD=(XTest3-mu)./sg;
YTrain3=YTrain2';
YTest3=YTest2'; |
clc; clear;
load 'heuristic_threshold.mat'
figure1=figure(1); clf
subplot1 = subplot(2,2,1,'Parent',figure1); hold on;
plot(cur_cur_v, cur_cur_i);
title('Current Threshold, Current Driven')
plot([0, 0.25], [0.48, 0.48], '--', 'color', 'red'); plot([-0.03, 0.03], [0.48, 0.48], 'color', 'black')
plot([0, -0.7], [-0.48, ... |
function msRamp_prs(obj, evt, stage)
hndl = get(gcf, 'Userdata');
hndl = get(hndl.mainFig, 'Userdata');
switch stage
case 1
hndl.setting.Pre.duration.msRamp = str2double(get(obj, 'String'));
set(obj, 'String', hndl.setting.Pre.duration.msRamp);
if hndl.setting.Pre.duration.msRamp ... |
% PIA Adattivo
% Lin H. - Adaptive data fitting by the progressive-iterative approximation
%
% parametri da impostare prima della chiamata a pia_bspline_adapt_body:
% x, y <- vettori dei punti di interpolazione
% tt <- parametri dei punti di interpolazione
% x_real, y_real <- ... |
function [h,zTOT]=plot_ged_cfc(X,hicomps,locomp,evecs,epochs,zTOT)
for ci=1:length(hicomps)
% recompute hicomps to use for plotting
for i=1:length(hicomps{ci});
if i==1;
hicomp = X(:,:)' * evecs(:,hicomps{ci}(i));
if ~isreal(hicomp(1,1)); hicomp=abs(hicomp)-mean(abs(hicomp(:,1))... |
%read a data file and create the data frame as defined
[filename, pathname,filterindex]=uigetfile('*.*','pick a file');
str=[pathname,filename];
fid=fopen(str);
data=fread(fid);
y=dec2bin(filename,8)-'0';
x=dec2bin(data,8)-'0';
a=dec2bin(size(y,1))-'0';
b=dec2bin(size(x,1))-'0';
a2=dec2bin(length(a),4)-'0';
b... |
% 连续函数
X1 = (0:12)*pi/6;
Y1 = cos(3*X1);
X2 = (0:360)*pi/180;
Y2 = cos(3*X2);
figure(1)
subplot(2, 2, 1);
plot(X1, Y1, 'o', 'MarkerSize', 3);
xlim([0 2*pi]); % xlim(limits)设置当前坐标区或图的x轴范围。将 limits 指定为 [xmin xmax] 形式的二元素向量,其中 xmax 大于 xmin。
subplot(2, 2, 2);
plot(X1, Y1, 'o', 'LineWidth', 2); % 线宽为2
xlim([0 2*pi]);
su... |
function [Lwopti] = FindOptimalLw(Xtrain, Ytrain, K, Lw, maxiter, cstr, verb)
if ~exist('Kmax','var'), K = 30; end
if ~exist('Lw','var'), Lw = 0:1:10; end
if ~exist('maxiter','var'), maxiter = 200; end
if ~exist('cstr','var'), cstr.Sigma = 'i';
cstr.Gammat = '';
... |
%% Process the 20 newsgroup data from
% http://www.cs.toronto.edu/~roweis/data.html
load newsgroups % documents, wordlist, newsgroups
X = documents'; % 16,642 documents by 100 words (sparse logical matrix)
y = newsgroups; % class label, 1..4
%{
% Let us filter out all documents with less than 5 words
nwords = sum(X... |
function [A] = FEMGRAPHADJ(Nds,Quad_Els,Tri_Els)
%FEMGRAPHADJ Returns the adjacency matrix of the 2D mesh by having
%the element edges as node paths
% USAGE:
% [A] = FEMGRAPHADJ(Nds,Quad_Els,Tri_Els);
% INPUTS:
% Nds : Nnx2 node locations
% Tri_Els : Ntx4 ordered list of nodes in Tri Elements
% [Elid n1 n2 n3]
... |
log_location = 'DAL/inactive_20150614.csv';
log = importdata(log_location);
index = log.data(:,1);
left_energy = log.data(:,3);
right_energy = log.data(:,4);
phone_energy = log.data(:,5);
left_energy=left_energy- phone_energy;
right_energy= right_energy- phone_energy;
left_energy(left_energy<0) = 0;
right_energy(ri... |
function Io = MirrorIm(I,n)
% I = double(I);
% I = randi(10,10); n = 3;
for i=1:n
I = [I(:,1),I];
I = [I,I(:,end)];
I = [I; I(end,:)];
I = [I(1,:);I];
end
% n = 3*n;
% I = [I,I(:,1:n)];
% I = [I(:,end-n:end),I];
% I = [I; I(end-n:end,:)];
% I = [I(1:n,:);I];
Io = I; |
function thispdf = f_rt(RT,Alpha,Beta,MuC,SigmaCab,Lambda,SigmaCba,SOA)
% PDF(s) of overall RTs (con or inc) for a given set of parameter values.
% Based on Formula A.6 in the manuscript
% SigmaCab is sigma of stage C when a finishes before b, and SigmaCba with ba finishing order.
% Lambda should be pos... |
function str = StringArraytoStringWithSpaces(array)
%% StringArraytoStringWithSpaces.m
% Usage: str = StringArraytoStringWithSpaces(params.instrument_list(diff==-1));
n = length(array);
str = char(array(1));
for j = 2:n
str = [str ' ' char(array(j))];
end
end |
%Problem 8
clc;clear;close all;
Ts=0.002;
t=0:Ts/10:Ts;
P=@(t)rect((t-Ts/2)/Ts);
x=P(t);
h=P(Ts-t);
y=conv(x,h);
ty=0:Ts/10:2*Ts;
figure(1)
stem(t,x,'fill','k-.');title('p(t-Ts)');xlabel('t');ylabel('p(t)');grid on;
figure(2)
stem(t,h,'fill','k-.');title('h(t)');xlabel('t');ylabel('h(t)');grid on;
figure(... |
function etl_append(varargin)
% Vstupné argumenty funkcie:
% OLD_DATA_PATH = cesta k priečinku, v ktorom sa nachádzajú *.csv súbory
% alebo cesta ku konkrétnemu *.csv súboru.
% STEP = interval krokovania meracieho prístroja v sekundách.
% UNITS = jednotky meraných veličín.
% TOL... |
% test the effect of whiten
f_SM = @(x) real(mean(x.*conj(x),3));
D = [1.0, 0.4; 0.4, 0.7];
%D = [1.0, 0.0; 0.0, 0.7];
A2d = [-0.9 , 0.6, 0.5, 0.1;
-0.16, -0.8, 0.2, 0.5];
%A2d = [-0.9 , 0.0, 0.5, 0.0;
%-0.016, -0.8, 0.02, 0.5];
%D = eye(2);
%A2d = [-0.9 , 0.0, 0.5, 0.0;
%-0.016, -0.8, 0.002,... |
function [sma_val] = sma(Price,period)
% Function to calculate the simple moving average of a data set
% This is based on the Matlab toolbox
% http://kr.mathworks.com/help/finance/tsmovavg.html#zmw57dd0e188829
% Example:
% sma = sma(Price,period)%
[n m]=size(Price);
if n>m % If Price is column-oriented, tra... |
function LE_plot_TT(mappedX,bin_mov)
xmin=min(mappedX(1,:));
xmax=max(mappedX(1,:));
ymin=min(mappedX(2,:));
ymax=max(mappedX(2,:));
zmin=min(mappedX(3,:));
zmax=max(mappedX(3,:));
figure(1);
hold on;
axis([xmin,xmax,ymin,ymax,zmin,zmax]);
title('Laplacian Eigenmaps','FontSize',28);
set(gca,'FontSize',22)
v... |
function [probes] = writeInputsProbes(filesIO,probes)
%writeInputs writes the input files for STAR-CCM+
% Detailed explanation goes here
% construct the cell array
probes_vars = {'ProbeName','x', 'y','z'};
probes_data = horzcat(probes.names, num2cell(probes.xyz));
P = vertcat(probes_vars, probes_data);
% ... |
function [Q] = rotateImage(Q)
% Dividing the image in two halves for better detection
% To see why , see this: https://www.mathworks.com/matlabcentral/answers/155126-how-does-the-vision-cascadeobjectdetector-detect-left-and-right-eyes-separately-it-is-constantly-de
n = fix(size(Q,2)/2);
lefthalf = Q(:,1... |
function p = findzero(f, a, b, tol)
% Solve f(p) = 0 using the bisection and secant method.
% Printing a convergence table.
% Print header
%fprintf(' n a b p abs(b-a) \n');
%fprintf(' n a b p f(p) \n');
fprintf(' n p... |
function uval = hubbard(x, t)
pp = length(x);
uval = ones(pp,1);
%for i=1:pp
xc = 0.30 +t;
ds = 0.5;
ds = 0.25;
ds = 0.1;
ds2 = ds*0.5;
% second front
xl = xc - ds2;
xr = xc + ds2;
% first front
xll = xc - 5.0*ds2;
xrr = xc - 3.0*ds2... |
function music(Fs,freq,time)
%%% Fs: sampling frequency, freq: frequency of sign wave, time: duration of
%%% run
y = sin(linspace(0, 2*pi*freq*time, Fs*time));
sound(y,Fs);
end |
function [ stim ] = initStimulus( info, pos, task, runNum )
% % INITSTIMULUS.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage: [ stim ] = initStimulus( info , pos , coinFile , task )
%
% harvest info from .txt files, initialize stimuli PTB-3 task
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function H = gen_rayleigh(r,t,N_0)
% H_ij ~ CN(0,sigma2) %% N_0= sigma^2
% that is Re(H_ij) and Im(H_ij) are iid with
% Re(H_ij) ~ N(0,sigma^2/2)
% Im(H_ij) ~ N(0,sigma^2/2)
%
% r: number of receive antennas
% t: number of transmit antennas
%
% to be used in y=Hx+n
%
sigmareal=sqrt(N_0/2);
H=sigmareal.*ra... |
function GFMedia = f_GFMedia(volTotal,e_DatSet,e_VG)
%% Media de la energía de fractura de la microcelda.
c_GF = cell(nSet,1);
for iSet = 1:nSet
e_DatMatSet = e_DatSet(iSet).e_DatMat;
e_DatElemSet = e_DatSet(iSet).e_DatElem;
nPG = e_DatElemSet.npg;
switch conshyp
... |
function [C, elementData, a_status] ...
= mapindex_centroidsProcess(C, astr_mapIndex, elementData)
%
% NAME
%
% function [C, elementData, a_status]
% = mapindex_centroidsProcess(C, astr_mapIndex, elementData)
%
% ARGUMENTS
% INPUT
% C class curvature_analyze class
% astr_mapIndex string ... |
function vars = ki_data(validate_data, visualize_data)
%
if ~exist('validate_data', 'var'), validate_data = true; end;
if ~exist('visualize_data', 'var'), visualize_data = false; end;
%% Gather data
ki_tab1_age = {'N0' 'N0' 'N0' 'N0' 'adult' 'adult' 'adult'};
ki_tab1_cca = [9.96 9.447 10.028 7.191... |
%% Input data
N = 20; % number of cells
method = 1; % method = 1 : exact at t(n+1)
% method = 2 : exact at t(n+1/2)
% method = 3 : DGCL
k = 0;
timesteps = 0.1*2.^( -1* [ 0 1 2 3 4 5 6 ] ) ;
for dt = timesteps
tend = 10; % total simulation time
if dt == 0.1... |
/*
* Base64Transcoder.c
* Base64Test
*
* Created by Jonathan Wight on Tue Mar 18 2003.
* Copyright (c) 2003 Toxic Software. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
... |
De Matrix A = [3 1 9 1; 32 91 23 10; 29 1 2 10]
heeft 12 elementen. |
% finds the first instance of a string in a file called
% filename and returns the line containing that string.
% returns '' if str does not appear in filename
function [line lineno] = findInFile(filename, str)
fid = fopen(filename);
tline = fgetl(fid);
line = [];
lineno = 1;
while ischar(tline)
if ~isempty(rege... |
cell_id = 147;
%Input
weekend = 0;
numdays = 13;
trainDays = 10;
numZones = 1;
traj = [];
time = [];
traj2 = [];
time2 = [];
dow = [];
% Construct distance matrix between cells
% columns are cellid, centroid_x, centroid_y, etc
celldata = csvread('cell_info_2.0km_priority.csv',2,0);
numCells = length(celldata);
distan... |
function mat = NMG(theta1, phi1, theta2, phi2, r, a_vec, b_vec, nu, a)
% R - the Euclidean distance between two locations (theta1, phi1) and
% (theta2, phi2)
phi = phi1-phi2;
mat = zeros(2);
h_sqrt = a*r;
M_nu_minus_2 = fun_M(h_sqrt, nu-2);
M_nu_minus_1 = fun_M(h_sqrt, nu-1);
for i = 1:2
for j = 1:2
... |
classdef total_parameters
%TOTAL_PARAMETERS Summary of this class goes here
% Detailed explanation goes here
properties (Access = public)
exp_num;
exp_names;
sub_nums;
timestamps;
t0_values;
diff_coefs;
weights;
voxel_size;
... |
function [] = compactTest(funObj,x,options,varargin)
nVars = length(x);
[f,g] = funObj(x,varargin{:});
funEvals = 1;
B0 = .01*eye(nVars);
S = zeros(nVars,0);
Y = zeros(nVars,0);
B0i = B0^-1;
B = B0;
for iter = 1:250
d = -B\g;
if iter > 1
%B0i-B0i*N*(M + N'*B0i*N)^-1*N'*B0i;... |
% Object representation of the sphere
%
% Author : Jonathan EDEN
% Created : 2015
% Description :
classdef Hypersphere < handle
properties (SetAccess = protected)
radius
origin
end
methods
% Constructor for a spherical wrench set.
function id = H... |
cfg=[];
cfg.channel='all';
cfg.elec=elec64;
cfg.headmodel=Standard2;
cfg.inwardshift=20;
cfg.moveinward=20;
cfg.grid.unit='mm';
sourcemodel=ft_prepare_sourcemodel(cfg); |
function linelaser_calibration_part(linelaser_file_no,Opt)
%linelaser_calibration_part 自分でCalibrationする平面を決められる
%
%.matファイルから変数群の呼び出し
load fishparams.mat fisheyeParams
load setup.mat linelaser_folder laser_step squareSize laser_time_margin ...
margin bright_thr ref_circle_radi ref_thr ref_arc... |
function adapt_data()
%Reference: http://in.mathworks.com/matlabcentral/newsreader/view_thread/246113
fin = fopen('iris.data');
fout = fopen('iris2.data','w');
while ~feof(fin)
s = fgetl(fin);
s = strrep(s, 'Iris-setosa', '1');
s = strrep(s, 'Iris-versicolor', '2');
s = strrep(s, 'Iris-virginica'... |
% Local Feature Stencil Code
% CS 4495 / 6476: Computer Vision, Georgia Tech
% Written by James Hays
% Returns a set of interest points for the input image
% 'image' can be grayscale or color, your choice.
% 'feature_width', in pixels, is the local feature width. It might be
% useful in this function in ord... |
clear;clc;close all
tic
dates_all={'Mar_19_13' 'Mar_21_13' 'Mar_21_13' 'Apr_12_13' 'May_30_13' 'May_31_13'... don't include for threshold measurements: 'May_31_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'... |
function [cost] = img_ssd(img1, img2)
[height, width, channel] = size(img1);
[~, ~, channel2] = size(img2);
if (channel ~= channel2)
error('Color channel mismatch');
end
if (channel == 1)
cost = (img1 - img2) .^ 2;
end
if (channel == 3)
cost = abs(img1(:,:,1) - img2(:... |
function h = addColorbarIPL(axHandle)
% ADDCOLORBARIPL
%
% Description:
% Add IPL depth colormap colorbar
%
% Syntax:
% h = addColorbarIPL(axHandle)
%
% Inputs:
% axHandle Axes handle (default = gca)
% Outputs:
% h Colorbar handle
%
% ... |
classdef enumSWEWind < int8
enumeration
None (1)
UV (2)
Stress (3)
%File (4)
end
end
|
rtpset='full';
data_path='/asl/s3/schou/cris_v33b_02/';
src='_cspp_dev';
data_str='v33b_02';
rtp_core
|
wax=[0 6 0.5 1];
figure,hold on
plot(mean(Cgaverage_nirsAMf),'r-.'),plot(mean(Cgaverage_eegAM),'g-.'),plot(mean(Cgaverage_combAMf),'b-.')
plot(mean(Ccaverage_nirsAMf),'r'),plot(mean(Ccaverage_eegAM),'g'),plot(mean(Ccaverage_combAMf),'b')
set(gca,'XTick',[1 2 3 4 5])
xlabel('window'),ylabel('accuracy')
title('Classifier... |
function [imgout] = filtimg(imgin,v,varargin)
% FILTIMG Filter an image pixelwise by colour values.
% Stopped pixels are set to black by default.
%
% F = FILTIMG(I,V) returns uint8 image F filtered from uint8 image I
% by vector V of lower and upper limits of red, green, and blue colour
% val... |
function [pHonestArray,lies,truths] = pHonestyAdjust(bets,dice,pHonestArray,lies,truths)
[height, length] = size(bets);
identityBS = bets(2,length-1);
for i = 1:length-1
betIdentity = bets(2,i);
if betIdentity == identityBS
playerNumber = bets(3,i);
diceOfPlayer = dice(1,playerNumber);
... |
function femwind_run_fortran_rate_test
disp('femwind_fortran_rate_test')
disp('run fortran version only')
p.run_fortran=1;
p.run_matlab=0;
femwind_rate_test(p)
end
|
% Edit the graph of the function to insert an x-label, y-label, title, mark the zero and
% the value of the integral. Then generate the M-file which corresponds to the new
% figure and include it here:
function createfigure(X1, Y1)
%CREATEFIGURE(X1, Y1)
% X1: vector of x data
% Y1: vector of y data
% Auto-gene... |
function [res] = blk_amp_spec_slope_eo_toy(blk)
persistent N;
persistent wnd;
if (nargin == 0)
N = [];
wnd = [];
return;
end
if (nargin == 2 || isempty(N))
N = size(blk, 1);
wnd = hanning(N);
wnd = wnd * wnd';
end
if (~isa(blk, 'double'))
blk = double(blk);
end
blk_wnd_prod = blk .* wnd;
% blk_wnd_pr... |
function SetFigure_MultAxes(Hcf, Hca, varargin)
% 10/01/2017 add figure format opertion
% 12/08/2016 set some parameters of given figure with multiple axes;
% Hcf : the handle to the figure.
% Hca : the handle to the current asis.
% varargin{1}: FigPosition: figure position and size, e.g., [0 100 320 200]);
%... |
function [ output_args ] = calcDb( input_args )
%CALCDB Summary of this function goes here
% Detailed explanation goes here
end
|
function [ Y ] = BFGS(f,x0 )
%%----------------------------------------------------------------------------------------------
% Author: Hemanth Manjunatha
% Date: Oct-13-2015
%
% Function : ModNewton.
%
% Purpose : BFGS algorithm to find the minima.
%
% Parameters : f-> function of interest, x0-> Innitial... |
%% Res_FEVD Function
% Goal:
% Given identified result, compute FEVD.
% Input:
% Input 1: VAR estimation results.
% Input 2: Identified columns (one or multiple) of B matrix.
% Output:
% Output 1: FEVD(t,j,i): matrix with 't' steps, the FEVD due to 'j' shock for 'i' va... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.