text stringlengths 8 6.12M |
|---|
%% SET PATHS
clear variables
restoredefaultpath; %% set a clean path
home_dir = '/home/lau/'; %% change according to your path
analysis_dir = 'analyses/omission_frontiers_BIDS-FieldTrip/';
matlab_dir = fullfile(home_dir, 'matlab'); % change according to your path
data_dir = fullfile(home_dir, analysis_dir, '/data');
... |
function mask = tri_window(nx,ny,type)
% Given nx and ny, generate a 2D window (triangle or hanning).
if nargin < 3
type = 1;
end
if type == 1
mx = [zeros(ceil(nx/4)*2,1);triang(2*floor(nx/4))];
mx = wshift('1D',mx,ceil(nx/4));
my = [zeros(ceil(ny/4)*2,1);triang(2*floor(ny/4))];
my = wshift('1D',my,ceil(ny/4));
... |
%% bayes3classes.m
% David Dobor [2dave@temple.com]
% Computes and plots class-conditional distributions for a Bayes classifier
clear all; close all;
load bc_data
% Plot the data
labels = unique(t);
markers = {'ko','kd','ks'} %appearance of a point on the plot
color = {[1 0 0],[0 1 0],[0 0 1]}; %color of a poi... |
clc;
clear;
%Image file reading
X = imread('8_1.jpg');
X = rgb2gray(X);
X = im2double(X);
% X = imresize(X,0.4);
q = 100;
[W,sigma,M,mean,x_t] = PPCA(X,q);
rec_image = W*inv(W'*W)*M*x_t; % See x_t construction in PPCA function
% Here M*X_t -> M*inv(M)*W'*x_t, which
% i... |
function show_qcoef_zone(coef,Nbands)
N=size(coef);
coef=abs(sign(coef));
for ia=1:N(1)/Nbands
for ib=1:N(2)/Nbands
coef((ia-1)*Nbands+1, (ib-1)*Nbands+1)=0.5;
end
end
figure; imshow(coef); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
in_folder = pwd();
project = 'iNetworks';
subID = 'INET003';
ses = '2'; %Number only
current_folder = [in_folder '/' subID '_' ses '/SCANS']; %Folder format INET999_1
%Starting scans
AAHead_Scout = [1 2 3 4]; %List in order: AAHead_Scout, sag, cor, tra
gre = [5 6]; %List in order: gre_1, gre_2
%Funcitonal scans
... |
%Question 1
clc; clear;
mu_e = 3.986e5;
mu_s = 1.327e11;
mu_m = 4.283e4;
h = 350;
Re = 6371;
r1 = Re + h;
Rm = 3389.5;
r2 = Rm + h;
R1 = 1.496e8;
R2 = 2.279e8;
vinf = sqrt(mu_s/R1)*(sqrt((2*R2)/(R1+R2))-1);
vp = sqrt(vinf^2 + 2*mu_e/r1);
vc1 = sqrt(mu_e/r1);
dVesc = vp - vc1;
e = 1 + (r1*vinf^... |
function [ResultStruct, ResultStructBW]=Threshold_Mask(CDataSetInfo, Param)
%%%Doc Starts%%%
%-Description:
%This method is to modify mask only by applying image intensity threshold and 2D binary mask erosion.
%-Parameters:
%1. ThresholdLow: Lower threshold of image intensity.
%2. ThresholdHigh: Upper thres... |
% [x1, i] = gaussSeidel(A, b, x0, tol)
% Risoluzione iterativa di sistemi lineari tramite il metodo di
% Gauss-Seidel.
%
% Input:
% -A: la matrice dei coefficienti;
% -b: vettore dei termini noti;
% -x0: approssimazione iniziale della soluzione;
% -tol: la tolleranza richiesta.
% Output:
% -x1: l'approssimazi... |
function[filtered_image] = avg_filter(image,filter_size)
%implementing the filter
h=ones(filter_size(1),filter_size(2));
h=double(h); %changing the class
image=double(image);
filtered_image = (1/(size(h,1)*size(h,2))).*conv2(image,h,'same');
%displaying the filtered_image
filtered_image(:)=round(filtered_image(:))... |
function [precision, completeness] = runLMFAM(numFactors, linkWt, reg, socialNet, A, targetEdgeSet, UserFactors, GroupFactors, L1, L2, numPredictions)
[UserFactors, GroupFactors, L1, L2] = MatFactLBFGSAM(double(socialNet.userUser), A, UserFactors, GroupFactors, L1, L2, linkWt, reg);
scoreMatrix = UserFactors * L1 * G... |
function [valid_matrix] = calc_valid_matrix(sigmas)
% DEPRICATED
% input: sigmas - calculateds sigma values
% output: valid_matrix - contains valid or not valid bit for every sigma
% value
[sort_sig, ~] = sort(sigmas,2);
[sample_amount,sub_amount]=size(sigmas);
% initial all sigmas are valid
valid_matrix = ones... |
x = 0:0.5:20;
names = cell(length(x),1);
for i = 1:41
names(i) = cellstr(strcat('Endpoints_Rerun_ATM_KO_',num2str(x(i),'%3.2f')));
end
ATM_fnc = @(x) (0.0429 + 45.4628.*x - 62.0548.*x.^2 + 30.6344.*x.^3)/200; % derived in ATM_IR.m
ATR_fnc = @(x) (0.02914286*x+0.02);
% knockout vector - 0 if KO 1 if non-KO
knockout... |
function [rayField, BR] = computeRayleighEllipse(prs,nu,depth,width,X,Z)
% Computes the static Rayleigh strength layers using cosine ramp
% Layer boundary curve parameters (4th order Ellipse)
ae = prs.l2 - width;
be = prs.zH - depth;
% Compute Euclidean distance from the origin of all poin... |
function [mx, my, mz] = vox2mm( hdr, vxyz)
% function [mx, my, mz] = vox2mm( hdr, [vx, vy, vz])
%
% convert from voxels to mm using the AVW header information
% accounting for the origin. in AVW, the origin is in voxels?
%
%
% (c) 2005 Luis Hernandez-Garcia
% University of Michigan
% report bugs to: hernan@umich.edu... |
function BS = beziersub (B,t,k)
% Opis : beziersub izvede k subdivizij Bezierjeve krivulje
%%Definicija :
% BS = beziersub (B,t)
%%Vhodni podatki :
% B matrika kontrolnih tock Bezierjeve krivulje , v
% kateri vsaka vrstica predstavlja eno kontrolno
% tocko ,
% t parameter subdivizije Bezierjeve krivulje
%%Izhodni podat... |
%Oppgave 1 - Practice 10.3
function prtthis(inp)
x = 1:0.25:6;
conv=str2func(inp);
y = conv(x)
plot(x,y,'ko')
xlabel('x');
ylabel('y');
title(inp)
end
|
clc
clear all
close all
g=9.8;
m=2; %mass of object kg
h=1/60; %time-step
Jxx=1;
Jyy=1;
Jzz=1;
Jxy=0;
Jxz=0;
Jyz=0;
J=[Jxx Jxy Jxz;
Jxy Jyy Jyz;
Jxz Jyz Jzz];
M=[diag([m m m]) zeros(3);
zeros(3) J];
nf=7;
cone_divs=[0:2*pi/(nf-1):2*pi];
Gf=[cos(cone_divs);sin(cone_divs);zeros(4,length(cone_divs))];
U=0.1;... |
function out = rhsPsi(t, x, u, param)
% % wyliczanie prawej strony rownan w postaci kanonicznej
xm = x(1) - param.D * cos(param.omega * t);
ym = x(2) - param.D * sin(param.omega * t);
xm2 = xm * xm;
ym2 = ym * ym;
x12 = x(1) * x(1);
x22 = x(2) * x(2);
rE = realsqrt(x12 + x22);
rM = realsqrt(xm2 + ym2);
rE2 = rE * rE... |
function [eingangs_sig, ausgangs_sig, resolver_sig] = loadadaptData(k, measurement_nr, start_zeit, end_zeit, strecke_ges, R, ue)
% lade Daten, schneide Bereich aus und passe Vektor an Identification
% Toolbox an
% Eingangssignal
file_name = strcat('mess',num2str(measurement_nr(k)), '_3');
s = load(strcat(file_name, '.... |
clear
%% The issue of multiple acceptable solutions need to be addressed
%% Different pairs of betaT and KE may produce comparable results
% fit2 and func*2 use only two degrees of freedom (dE and kT)
global texp Texp Km
load('Analysis_Background_AFG2_SizeExclusion_Pseudo_AFG2_12112019.mat','T_BG')
%% set 1
... |
function hist = histogramme( image )
[m,n]=size(image);
hist = zeros(1,256);
for i=1:m
for j= 1:n
hist(image(i, j)+1)= hist(image(i, j)+1)+1 ;
end
end
figure;plot(hist);
title('histogramme des niveaux de gris');
xlim([0 256]);
end
|
function locateBuildings
%identify what subNet node of electrical heating and cooling the building is on, and if there are chillers/heaters connected, disengage the internal HVAC
global Plant
build = [];
if isfield(Plant,'Building') && ~isempty(Plant.Building)
nB = length(Plant.Building);
buildLocation = cell(n... |
% ======================================
% Cycle-slip detection
%
% zhen.dai@dlr.de
%
% last modified: 2011.Oct
% ======================================
% cycle-slip detection using Doppler
function Method_Doppler(freq) % freq=1 or 2 to identify L1 or L2
% cycle-slip detection by comparing the doppler data with t... |
function varargout = eyeGUI(varargin)
% EYEGUI MATLAB code for eyeGUI.fig
% EYEGUI, by itself, creates a new EYEGUI or raises the existing
% singleton*.
%
% H = EYEGUI returns the handle to a new EYEGUI or the handle to
% the existing singleton*.
%
% EYEGUI('CALLBACK',hObject,eventData,handles,... |
function D = newton_cd_explicit(A,B,W,Q,R,lambda,K,L,P,gradK,Z,params)
% Find the regularized Newton direction using coordinate descent
% Compute the penalty term on K by looking at the minimum eigenvalue of H
% TODO(mwytock): Calculate the Hessian efficiently and restrict it just to
% the terms in the active set.
G =... |
function [absamp] = fft_sl_remconst(amp, sm)
% Remove costant lines ftom signal.
% Returns abs value!
for j=1:length(amp(:,1))
% the best method is to use 'rloess' smooth, but it is too slow...
% absamp(j,:)=abs(abs(amp(j,:))-min(smooth(abs(amp(j,:)), 0.6, 'rloess')));
absamp(j,:)=abs(abs(amp(j,:))-min(smooth... |
files = dir('IM/*mat');
files={files.name}
load('Mesh_16.mat');
cnts = (Mesh.Nodes(Mesh.Tetra(:,1),:) +Mesh.Nodes(Mesh.Tetra(:,2),:) + Mesh.Nodes(Mesh.Tetra(:,3),:) + Mesh.Nodes(Mesh.Tetra(:,4),:) )/4;
sel=cnts(:,3)<0.05 & cnts(:,3)>-0.05;
Mesh1.Nodes=Mesh.Nodes;
Mesh1.Tetra=Mesh.Tetra(sel,:);
... |
function ROut = ScaledDownDESRoundKeyFunction(RIn,RoundKey)
% ROut = ScaledDownDESRoundKeyFunctionDESRoundKeyFunction(RIn,Key)
% Inputs: RIn = a length 4 binary vector , and RoundKey = a length 8 binary round key vector
% Output: ROut = the length 4 binary vector that corresponds to the output of the scaled-down DES ... |
clear;
im_l=imread('teddyL.pgm');
im_r=imread('teddyR.pgm');
[aa,bb] = size(im_l);
rankTranImagel=ones(aa,bb);
rankTranImager=ones(aa,bb);
for i=1:aa
for j=1:bb
wndw_l=zeros(5,5);
wndw_r=zeros(5,5);
for k=i-2:i+2
for l=j-2:j+2
if k>0 && k<=aa && l>0 && l<=bb
... |
function bounds = GetBounds(model, vel_lb, vel_ub, T, x0, xf)
if nargin < 2
vel_lb = [0.0,0];
vel_ub = [0.0,0];
end
if nargin < 4
T = 0.4;
end
if nargin < 5
x0 = zeros(model.numState*2,1);
end
if nargin < 6
xf = zeros(model.num... |
function [txt] = txtRead(fp)
% jiangjian@ion.ac.cn
% 2019-05-23
% read txt from a file: txt, html
fid=fopen(fp);
txt='';
while ~feof(fid) % 判断是否为文件末尾
tline=fgetl(fid); % 从文件读行
txt=[txt,tline];
end
fclose(fid);
end
|
%//#############################################################################
%//! \file /2837x_WindowedRFFT/matlab/RFFTWindowedforC28x.m
%//!
%//! \brief MATLAB code for the Real Fast Fourier Transform (Windowed)
%//! \author Vishal Coelho
%//! \date 03/08/2015
%//
%// Group: C2000
%// Target Famil... |
function adjmat = somethinglinear()
n = 25;
adjmat = zeros(n);
connectaffinities = repmat((1:n)/n,n,1);
randmat = rand(n);
adjmat = randmat > connectaffinities;
adjmat = adjmat .* (adjmat');
adjmat = adjmat .* (ones(n) - eye(n));
end |
function uprim=dudx(x,u)
uprim=[u(2); -250*exp(-(x-3.5/2).^2)-(1/6)*u(2)];
end |
function slices = spmimg(spmtype)
%
% function slices = spmimg(spmtype)
%
% Luis Hernandez
% last edit 1-9-98
%
% slices = data structure with image slices
% spmtype = 'F' ot 't' (type of ststistical map)
%
% In its present state, this function generates an array of slices
% (see makslice.m) from the SPM*.mat ... |
load data2
close all;
theta = 0.1;
% Z = [S(:, 2), S(:, 1)];
% S = Z;
[dmodel, perf] =dacefit(S, Y, @regpoly0, @corrlin, theta);
m = 80;
n = 601;
X = gridsamp([1 1; 601 80], [n m]);
[YX MSE] = predictor(X, dmodel);
X1 = reshape(X(:,1),m, n); X2 = reshape(X(:,2), m, n);
YX = reshape(YX, size(X1));
figure(1);
... |
% make_all_windows : Compiles VISIM for Windows using gfortran
%
% Gfortran for winXP can be downloaded from :
% http://www.equation.com/servlet/equation.cmd?call=fortran
delete('visim.inc');
d=dir('*.inc');
for i=1:length(d);
[p,f]=fileparts(d(i).name);
dos(sprintf('copy %s visim.inc',d(i).name));
... |
d=APLO2.d1.default.c1420;
e=d.rfe.excluded;
i=numel(e);
F=ones(64,64);
figure
for i=1:i
a=find(F>0);
b=a(e{i});
F(b)=0;
imagesc(F)
%pause
end
|
function alpha3=get_apha(t)
alpha3=0;
if t<pi/4
alpha3=pi/3*sin(t*2);
end
if t>pi/4 && t<pi*2/4
alpha3=pi/3*cos((t-pi/4)*2);
end
if t>pi*2/4 && t<pi*3/4
alpha3=3*pi/4*cos((t-pi/4)*2);
end
if t>pi*3/4 && t<pi*4/4
alpha3=-3*pi/4;
end
if t>pi*4/4 && t<pi*5/4
alpha3=-3*pi/4+pi/4*sin((t-p... |
function Gaussian( )
Im = imread('lena.jpg');
Im =rgb2gray(Im);
figure(1)
imshow(Im)
p3 = 0;%density
p4 = 0.05;
Im = im2double(Im);
Im = Im + sqrt(p4)*randn(size(Im)) + p3;
figure(2)
imshow(Im)
end
|
clear all
close all
clc
format long;
% gradients (T/m)
Gxx = -4;
Gyy = 0;
Gzz = 4;
diameter = 30;
Bp = 15e-3; % Drive field (T)
f_drive = 10e3; % drive field frequency
mu0=1.256637*10^-6; % permaebility of vacuum
Hp=Bp/mu0; % magnetization moment
G=Gzz/mu0; % gradient
driveMag=Hp/G; % extent of the ... |
function [EEG_averaged,EEG_bandpassed] = BME772ProjectDenoise(EEG_noisy, M, time, fs, x)
% This function is used to denoise the signal by bandpassing it and sync
% averaging it
% Sync Averaging the signal
%Define a matrix of zeroes
y_bar=0;
%Create for loop to add all signals into the matrix (inetgral of all signal r... |
clear all;close all;
bnd = [-10,10;
-10,10];
gridsize = [5,5];
gnd = Ground(bnd,gridsize,1);
[X,Y,V]=gnd.ground_gen_rand(0.1);
% mesh(X,Y,V)
% surf(X,Y,V,'EdgeColor','None');
%%
for i = -2:2
gnd.add_hole(rand(1)*0.3,'circle',[1;2*i]);
end
gnd.visual_holes();
%%
gnd.visual_ground();
axis equal;
r_list = zero... |
function [uflag, btall, btsub, nall, nsub, stdall, stdsub]=imager_uniform2(...
IASI_Image, drnoise, dbtmaxall, dbtmaxsub, nminall, nminsub, stdmaxall, ...
stdmaxsub);
%function [uflag, btall, btsub, nall, nsub, stdall, stdsub]=imager_uniform2(...
% IASI_Image, drnoise, dbtmaxall, dbtmaxsub, nminall, nminsub, s... |
function [w,fEvals] = L1General(optMethod, gradFunc,w,lambda,params,varargin)
%
% computes argmin_w: gradFunc(w,varargin) + sum lambda.*abs(w)
switch lower(optMethod)
case 'iteratedridge'
optfunc = @L1GeneralIteratedRidge;
case 'projection'
options.order = -1;
optfunc = @L1GeneralProjection;
... |
FluxQuantum = 2.067833636e-15;
PlanksConst = 6.626068E-34;
ee = 1.602176e-19;
% 0.280 uA -> junction resistance 1kOhm
KRI = 0.280e-6;
R0 = 9.8e3;
dR = 2e3;
R = R0-dR:0.025e3:R0+dR;
C0 = 60e-15;
dC = 15e-15;
C = C0-dC:0.5e-15:C0+dC;
Ic = KRI./(R/1e3);
f01 = NaN*ones(numel(R),numel(C));
ah = NaN*ones(numel(R),numel(... |
function [ J ] = Jacobian( x, y, anchors)
%JACOBIAN Summary of this function goes here
% Detailed explanation goes here
dfbx1 = 0.5*((2*x-2*anchors(1,1))/(sqrt((x-anchors(1,1)).^2+(y-anchors(1,2)).^2)));
dfbx2 = 0.5*((2*x-2*anchors(2,1))/(sqrt((x-anchors(2,1)).^2+(y-anchors(2,2)).^2)));
dfbx3 = 0.5*((2*x-2*anchors(3,... |
function calvo_model
%Produce the symbolic first- order approximation to the equilibrium
%conditions of the Calvo model with staggered price setting in the nontraded sector as developed in the chapter entitled ``Nominal Rigidity, Exchange Rates, And Unemployment''
%of the book ``Open Economy Macroeconomics,'' b... |
%EARTH Black-green-white colormap
%
% Examples:
% map = earth;
% map = earth(len);
% B = earth(A);
% B = earth(A, lims);
%
% A black to white colormap with several distinct shades, most of which
% have a green or brown tint. This colormap converts linearly to grayscale
% when printed in black & white.
%
% The ... |
% Numerical experiments with E-optimal design problems comparing alfonso,
% Mosek 9.2.6 and SCS 2.1.7
% -------------------------------------------------------------------------
% Copyright (C) 2018-2020 David Papp and Sercan Yildiz.
%
% Redistribution and use of this software are subject to the terms of the
% 2-Clause... |
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/OPT_solvers/NGPM_v1.4/nsga2_options.m 2214 2015-09-28 10:50:20Z evabalsa $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SSM OPTIONS ... |
%load rend05
load memorial
%load Valley
%load Tree
%load MtTamWest
%load SpheronNice
%load SpheronPriceWestern
%load belgium
%load synagogue
figure; idx=1; plot(memorial{idx}(1,:), memorial{idx}(2,:),'b.-'); hold on; grid on;
for ia=2:17
plot(memorial{ia}(1,:), memorial{ia}(2,:),'.-')
end
figure; idx=1; plot(memori... |
function Kj = reinf(t, y)
for j = 1:1:T-1
Pj(:,:,2) = transpose(A - B*Kj)*Pj(:,:,1)*(A - B*Kj) + Q + transpose(Kj)*R*Kj;
Kj = pinv(R + transpose(B)*Pj(:,:,2)*B)*transpose(B)*P(:,:,2)*A;
Pj(:,:,2) = Pj(:,:,1);
end
end |
function [gaussian_weight, param] = initGaussianWeight(param)
%init gaussian rbm weight
param.visible_number = param.image_height * param.image_width * param.image_channel;
param.hidden_number = 2048;
param.epoch = 100;
param.sparity = 0;
param.epsilon_w = 0.05;
param.epsilon_v_bias = 0.05;
param.epsilon_... |
function y = cleanUp(x)
for k=1:length(x)
if(x(k)<0 || x(k)>10)
x(k)=NaN;
end
end
y=x;
end
|
function x = bisect(f,a,b,n,tol)
% mètode de la biseccio de Cleve Moler
s = '%5.0f %19.15f %19.15f %19.15f\n';
fprintf('%5s %10.5s %19.5s %19.5s\n','k','x','f','l')
fprintf(s,[],a,f(a),[])
fprintf(s,[],b,f(b),[])
k = 0; l = b-a;
while (k < n) && (l > tol)
x = (a + b)/2;
if sign(f(... |
function A = unpickle( strIn )
% parse the header
sepInd = find( ':' == strIn );
if ~isempty(sepInd) && (length(sepInd) == 2) && (sepInd(2) < length(strIn)-1)
classStr = strIn(1:sepInd(1)-1);
sizeStr = strIn(sepInd(1)+1:sepInd(2)-1);
dataStr = strIn(sepInd(2)+1:end-1);
else
error( 'This string cannot ... |
function [] = quiverc(ax,x,y,u,v,cmap,clim,crefx,crefy,crefz,lw,sw)
% [] = quiverc(ax,x,y,u,v,cmap,clim,crefx,crefy,crefz,lw,sw)
% if sw=1 black and wight arrows
%function to color quiver refering some backgroundfield
cvec=clim(1):(clim(2)-clim(1))/63:clim(2);
for k=1:length(x)
cx=find(crefx==x(k));
cy=find(c... |
function R = autoCorr(y,par)
%% parameters
sigma = par{1};
dx = par{2};
num = par{3};
taumax = par{4};
%% compute empirical autocorrelation function
m = size(y,1); R = zeros(taumax/dx,num);
for j = 2:num+1
% Subtract mean from signal
y(:,j) = y(:,j) - y(:,1);
% R(i) = sum_k y_k*conj(y_{k-i})... |
function [a,boards,channels,start,int,len,headers,names]= ...
dam_read(prefix,directory)
%DAM_READ Read trykinetics activity file
%
% This function is not usually called directly,
% use dam_load.
%
% [a,board,channel,start,int,len,headers,names]=dam_read(prefix)
% reads all dam files whose name begins with prefix... |
% Crea la matrice di crop di una immagine
%
% A = MATRIX_CROP_IMAGE( OR, OC, DR, DC, M, N )
%
% OR = offset riga
% OC = offset colonna
% DR = numero righe da selezionare
% DC = numero colonne da selezionare
% M = numero di righe della matrice da ritagliare
% N = numero di colonne della matrice da ritagliare
%
% A = mat... |
function plot_fista_reconstruct(filename)
S=load(filename);
if isfield(S,'data_pad')
data_pad=S.data_pad;
elseif isfield(S,'Data')
data_pad=S.Data(:,1);
end
clust_num=max(S.fista.X1_clust);
map=colormap(jet(clust_num));
figure;
subplot(5,1,1)
hold on;
Y1_data=conv... |
function [img, phis] = reconPwlsMetalArtifactReduction( sino, spectrum, geom, weights, sinoMapUnknown, beta, delta, itnlim )
% Penalized-Weight-Least-Squares recosntruction for single energy sinograms.
% input:
% sino - photon counts sinogram
% spectrum - X-ray spectrum infomation
% geom - syst... |
clear all
close all
clc
nr_training_bits=100;
nr_data=1000;
Q=4;
sigma_noise=2;
training=randn(1,nr_training_bits);
data=qpsk(sign(randn(1,nr_data)));
seq=[training data'];
seq_up=upfirdn(seq,ones(Q,1),Q,1);
training_up=upfirdn(training,ones(Q,1),Q,1);
pre_seq=upfirdn(qpsk(sign(randn(1,nr_training_bits))),ones(1,Q),Q,1... |
function [ final_error ] = printError( estm,truth )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
final_error = sum(abs(estm-truth)./truth)/length(truth);
fprintf('error: %.2f%%\n',final_error*100);
end
|
function spawn_object=SpawnMotionModel(object)
% Function used create and propogate spawned estimates
%
% Inputs:
% object - object consisting of parent state estimate
%
% Outputs:
% spwan_object - object consisting of a spawned... |
function [Tup,w,flagw,winic]=directionDISORDER(dt,ddt,w,flagw,winic)
%DIRECTIONDISORDER Computes the motion update for the motion parameters
% [TUP,W,DTP,STP]=DIRECTIONDISORDER(DT,DDT,W,DTP,STP)
% * DT is the gradient direction
% * DDT is the Hessian
% * W is the update weight
% * FLAGW flags current energ... |
clear
myFolder = 'ss'; %Specify Directory
filePattern = fullfile(myFolder, '*.jpg') %identify jpg files
jpegFiles = dir(filePattern) %use dir to list jpg files
size = length(jpegFiles); % length of the size of the file
outputVideo = VideoWriter(fullfile(myFolder,'video1.avi'));
outputVideo.FrameRate = 30;
open... |
function [fitresult, gof] = ErrorThreshold_vs_Sigma(Error, MFPT2)
%CREATEFIT(ERROR,MFPT2)
% Create a fit.
%
% Data for 'untitled fit 2' fit:
% X Input : Error
% Y Output: MFPT2
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% ... |
function preprocessing_meanepis
% Take care of hosts
hostname = char(getHostName(java.net.InetAddress.getLocalHost));
switch hostname
case 'DESKTOP-3UBJ04S'
base_dir = 'C:\Users\hipp\projects\WavePain\data\fmri\fmri_temp\';
n_proc = 2;
case 'revelations'
base_dir ... |
x = linspace(-10, 10);
y = x;
plot(x, y);
legend('y=x');
|
% IS_FIELD test membership in a struct
%
% IS_FIELD(s, 'field_name') returns `true` if `field_name` is the name of a
% field present in `s`, and `false` otherwise.
%
% IS_FIELD(s, {'field1', 'sub_field1', 'sub_sub_field1'}) returns `true` if
% `field1` is present in `s`, `sub_field` is present in s.field1, and
... |
function d = Domain1D(a, b, c, d, e)
% DOMAIN1D - Create a new one-dimensional domain.
%
d.dom_id = -1;
if nargin == 1
d.dom_id = domain_methods(0, a);
elseif nargin == 2
% a stagnation flow
if a == 1
if isa(b,'Solution')
d.dom_id = domain_methods(0, 1, thermo_hndl(b), kinetics_hndl(b), ...
trans_... |
classdef (Abstract) Meta
%META (Abstract) class that represents Meta properties.
% This class is used as an abstract Interface.
% A Meta-Parameter in this context is either the Focus, Speed or
% Power property.
% Each Meta-Parameter can have different values for their properties.
%% D... |
function [ userNum,offloadDecision,duplicationInid,scheduleTable ] = DuplicationOffloadAlg( taskDAG,userNum,nodeCount,MaxNodeCount,localComPower, serverComList,serverCount, transRate,delta)
% Duplication based offloading algorithm1
% serverComList 服务器计算能力列表(GHZ)
% transRate (用户,服务器)的通信速率矩阵()
% 输出:对于用户i 1. 哪个处理器执行o... |
function [ converge ] = isconvergence(change, cost, NEAR_ZERO)
%% check if the size of derivatives/gradient is close to zero
converge = 0;
SUM = 0;
sq_change = change.^2;
SUM = sum(sq_change);
SUM = sqrt(SUM);
if (SUM < (NEAR_ZERO * abs(cost)))
converge = 1;
end
end
|
%% CREATE HYPERELLIPSOIDS/CUBOIDS FOR MW AND HC RATIO CONSTRAINTS
% AUTHOR : G. PAVAN BHARADWAJ
% REFER TO LICENSE.pdf ON REPOSITORY FOR USAGE RESTRICTIONS
% clear all;
clc; clearvars; close all; yalmip('clear');cvx_clear;
%% INPUTS
% SURROGATE NAME
surr = 'dooley';
shape = 'cuboid';
save_output = 0;
no_graph = 0;
... |
clc;
clear all;
close all;
%--------Inputs-------------------------------------------------
N=1e6; %Number of data samples to send across the Rician Channel
EbN0dB=-5:2:15; %Eb/N0 in dB overwhich the performance has to be simulated
%--------------------------------------------------------------
tx_data = randi([0 3],1,... |
function experimentProperties=extract_experimentProperties(TTL_TimeStamps,TTLS)
%%% Create one matrix with timestamps and decoded TTL triggers
M=[TTL_TimeStamps(:) convertTTL(TTLS)];
trial_start_vector=find(M(:,2)==254);
trial_start_vector(trial_start_vector>size(M,1)-8)=[];
%%% Detect experiment labels an... |
outerdir = 'H:\SIGNALS\raw';
subdirs = shared_utils.io.find( outerdir, 'folders' );
py_script_path = 'C:\Users\changLab\Repositories\dsp2\misc\offset.py';
py_script_path = strrep( py_script_path, '\', '/' );
for i = 1:numel(subdirs)
full_subdir = subdirs{i};
full_subdir = strrep( full_subdir, '\', '/' );
cmd = ... |
classdef deltahedging_backtest < handle
% Delta对冲方法的回测类函数
% -----------------------------------------------
% 黄勉,20160125 (请沈杰检查)
%
properties
% 数据存放
underling_data = [];
data_len = [];
data_time = [];
data_call = [];
data_put = [];
% 资金设置
... |
% Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
% Giacomo Mazzamuto (LENS)
% 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 ... |
%BIFURCATIONPLOT plots the region where there are 3 fixed points for the
% model as of January 2019.
%% Constants
gammaSteps = 100;
gammaRange = [0 gammawt+.004];
%% Grid
x = zeros(gammaSteps+1,1);
for i=1:gammaSteps+1
x(i) = (i-1)*(gammaRange(2)-gammaRange(1))/(gammaSteps);
end
y = zeros(gammaSteps+1,1);
... |
% exm10_tf2zp_zp2tf.m
% 例10,系统表示方法示例
% 北京邮电大学,尹霄丽
% 2018年12月
[z p k]=tf2zp([1 0 0],[1 -1 0.24])
[B,A]=zp2tf(z,p,k)
[B,A]=eqtflength([1],[1 -1 0.24])
impz(B,A,11)
|
close all
clear all
clc
% this is for 2016 fmi data with GC-MS
% and 2017 data for monoterpenes with PTR-MS
% reading data sequentially for each month
% cs_data_2016 = [];
% for k = 1:12 ;
%
% BaseName = 'M0' ;
% fold = ['CS2016','/',BaseName,num2str(k)];
% CS_file = load(['/home/carltonx/Documen... |
%Lecture 6
temps=csvread('tempdata.csv');
temps=temps(:,2);
%Read electricity demand data
data_2014 = csvread('hourly-day-ahead-bid-data-2014.csv',5,1);
%Started reading data in the 6th row, 2nd column in excel
vector = mat2vec(data_2014);
peak = zeros(365,1);
%peak
for i=1:365
peak(i) = max(data_2014(i,:));
end... |
function [F_filt, L_win] = finestra_forza (Forze, window_F, fs)
%Function che esegue la finestrature delle colonne delle matrici Forza e Accelerazioni,
%permettendo di scegliere diverse tra varie finestre.
%Prende in Input:
%I1) la matrice delle Forze (F);
%I2) il tipo di finestra selezionata per le Forze (window_F=nu... |
classdef ModSchemes
properties(Constant)
% chipping code length for data rates 1 and 2 Mbps
% = static PN (Pseudo Noise) sequence for DSSS
BarkerSequence = [1 -1 1 1 -1 1 1 1 -1 -1 -1]';
end
methods(Static)
% == DSSS Modulation ==
fu... |
function [trainedClassifier, validationAccuracy, partitionedModel] = REMWAKEtrainClassifier(trainingData)
inputTable = trainingData;
predictorNames = {'FpzDelta', 'FpzTheta', 'FpzAlpha', 'FpzBeta', 'OzDelta', 'OzTheta', 'OzAlpha', 'OzBeta', 'EOGPower', 'EMGPower'};
predictors = inputTable(:, predictorNames);
resp... |
function value_out = roundPartial(value, resolution)
value_out = round(value / resolution) .* resolution;
end |
function Core=ComputeCore(X,NumSeed,Subset,UpLimit)
KK2=max(10,ceil(sqrt(UpLimit)));
% KK3=ceil(sqrt(UpLimit));
Core=cell(NumSeed,3);
for ii=1:NumSeed
% The k-nearest neighborhood (KNN)
data_ii=find(Subset(ii,:)==1);
data=X(data_ii,:);
n=size(data,1);
if n>KK2
DD=pdist2(data,data);
... |
% subplt.m ----------------------------------------------------------
%
% - The 'SubPlot' argument is used to create 3 axes. plt puts a single
% trace on each axes except for the main (lower) axis which gets
% all the remaining traces. In this case, since there are 5 traces
% defined, the main axis has 3 traces. Note t... |
%% Assignment 3 Q4
clear all; close all;
%Right most image = 00, Left most image = 07, 07->00 L->R
img = single(imread('hotel/hotel-00.png'))/255;
img = cat(3,img,single(imread('hotel/hotel-01.png'))/255);
img = cat(3,img,single(imread('hotel/hotel-02.png'))/255);
img = cat(3,img,single(imread('hotel/hotel-03.png'))/25... |
function [con, con_e]=con_STEP(x)
% % Define Constraints
% c_L=[-0.005; -2; 0; 0; 0; 5];
% c_U=[0.005; 2; 11.2; 4.4; 20; 6];
% delta_soc delta_trace vinf.accel_test.results.time(1) vinf.accel_test.results.time(2) vinf.accel_test.results.time(3) vinf.grade_test.results.grade
%c_L=[ 0; 0; ... |
% Générateur de poids
% *******************
%
% Génère une matrice m X n où un élément prend sa valeur dans le
% vecteur poids avec la probabilité associée dans proba.
function W = genPoids(poids,proba,m,n)
%% 1 - Initialisation
if sum(proba) ~= 1
error('Les probabilités ne sommes pas à 1.');
end
P = length(pr... |
function [v,I,C,d,gd,M,m,f,sgd,fsimilar,T]=dendqual5(t,x,metric,method,r,strains,filename)
[H,PE,norm,ind,nmi,H_clust,H_class,w,c,PC,sgv,v,I,C,d,gd,M,m,f,sgd,fsimilar]=deal(0);
t = x.*t;
t(isnan(t))=0;
notempty = cellfun(@any, strains);
t=t(notempty,:);
genes = strains(notempty)';
u = unique(genes);
num_of_clusters=le... |
function [Idiff_orig,Ident_mat_orig,Idiff_recon,Idiff_opt,recon_matrix_opt,Ident_mat_recon_opt,PCA_comps_range,m_star, latent] = f_PCA_identifiability_old(orig_matrix,Test_index,Retest_index,configs)
%% Compute Identifiability matrix, original FCs
orig_matrix_test = orig_matrix(:,Test_index);
orig_matrix_retest = orig... |
function X = DFTmatrix(x)
N = length(x);
A = genAmatrix(N);
X = sum(A'.*x');
end
|
function [d, v_p, s_stats, M_T] = manova_calc( astr_curvFile, varargin)
%
% NAME
% function [] = manova_calc( astr_curvFile, varargin)
%
%
% ARGUMENTS
%
% INPUT
% astr_mris string filename of surface file to load
%
% OPTIONAL
% astr_title string title of plo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.