text stringlengths 8 6.12M |
|---|
clear all
close all
clear java
% add file paths
addpath(pwd);
addpath(genpath(fullfile(pwd, 'bin')));
addpath(genpath(fullfile(pwd, 'img')));
addpath(genpath(fullfile(pwd, 'lib')));
addpath(genpath(fullfile(pwd, 'src')));
% add dynamic java paths
javaaddpath(fullfile(pwd, 'bin'));
libpaths = genpath(fullfile(pwd, 'li... |
function InfoStr=GetTestInfoStr(handles)
InfoStr='Preprocess: ';
%Preprocess
PreprocessTestStruct=handles.TestStruct{1};
if ~isempty(PreprocessTestStruct)
for i=1:length(PreprocessTestStruct)
InfoStr=[InfoStr, num2str(i), '. ', PreprocessTestStruct(i).Name, ', '];
end
InfoStr(end-1:end)=[]... |
function res = sig_freq(dstr, xfile, pars)
% Frocess signals with frequency modulaton.
% Parameters:
% - same as for sig_read, sig_trace
pp_read = sigproc.sig_read_pars(pars); % cache read parameters
pp.fmin = sigproc.par_get('fmin', pars, 10 );
pp.fmax = sigproc.par_get('fmax', pars, 3000 );
pp.fmin = si... |
clc; close all; clear all;
set(0,'defaultAxesFontSize',18)
% traj1 = [0,0; 0.03,0.01; 0.05,0.18; 0.14,0.24; 0.2,0.3]';
% traj2 = [0,0; 0.09,0.01; 0.14,0.02; 0.07,0.05; 0.1, 0.1]';
traj1 = [0,0; 0.3,0.5; 1.2,1; 3,1.9; 5,2.1]';
traj2 = [0,0; -1,-0.5; 0.5,-1; 1.2, -2; 2, -0.1]';
figure; hold on;
scatter(traj1(1... |
clear all
close all
load('Complex.mat');
load('Smooth.mat');
Smooth_C.x = 150;
Smooth_C.y = 142;
Complex_C.x = 149;
Complex_C.y = 140;
num_comp = length(complexparticle);
num_smooth = length(Smoothparticle);
for i = 1:num_comp
complexparticle(i).x = complexparticle(i).x - Complex_C.x;
complexparticle(i).y ... |
function spc_makepolyLines
global spc;
global gui;
delete(findobj('Tag', 'poly'));
radius = spc.switches.polyline_radius;
[x, y] = getline;
gui.spc.figure.polyRoi = {};
% xx = [x(1):0.25:x(end)];
% yy = spline(x, y, xx);
[xx, yy] = spc_spline(x', y');
axes(gui.spc.figure.projectAxes);
gui.spc.figure.polyLine = line... |
% Main entry for solving linear system using HyGA in MPETSc as a standalone
% solver or a preconditioner. |
clear; clc; close all;
% K = 6; % Number of cluster centers, for kMeans
% n_a = importdata(fullfile('../dhmm/data/handwriting/features/n_test_a.ldf'));
% x_a = importdata(fullfile('../dhmm/data/handwriting/features/x_test_a.ldf'));
% y_a = importdata(fullfile('../dhmm/data/handwriting/features/y_test_a.ldf'));
... |
function [t, d] = continuousimpulse(varargin)
%CONTINUOUSIMPULSE Creates a unit step function with various parameters.
% Creates a continuous time impulse function d of variable t. Both t
% and d have product and summation variables for operations on
% the impulse function output.
% Function default arguments.
i... |
function [case_struct] = new_case_struct(sim_func)
cases = [];
class_weights = ones(6,45);
mean_active = ones(6,45);
%class_entropies = ones(6,45)
if nargin == 0
sim_func = 'similarity_mean';
end
case_struct = struct('cases', cases, 'class_count', zeros(6,1), 'class_weights', class_weights, 'active_count',... |
function CreateTrajectories_exp4(expInfo)
%CreateTrajectories - generate files with trajectories
%
% Syntax: GenerateRandomTrajectories(count,nPoints,nFrames,positionGrid,pixelsPerFrame,objectPixels,fieldRect)
%
% Inputs:
% expInfo - struct with experiment parameters
%
% Example:
% confFilePath='./shared... |
% Code Notes:
% - recon code provided by Sang-woo Lee and Brad Sutton
% - field map correction not implemented
% Pfile Notes:
% Pfile is organized as follows:
% coil 1:
% slice 1: baseline interleaves time1, interleaves time 2, etc...
% slice 2: baseline interleaves time1, interleaves time 2, etc...
% etc...
... |
function [wo_sorted, wod_sorted, wocorr_sorted, wocorrd_sorted, wo, wocorr, ind] = getML_RLFig3OptimalWSortedByTh(Monk, NSEN, NTUNE, ELN, DIRS, SIMNUM, THBINS, NORMSCALE, recompute)
% Get optimal weights, sorted by thresholds
% the optimal weights is computed as the normalized fisher linear discriminant,
% with and wit... |
I=imread('white_house256.jpg');
[m n]=size(I);
figure(1):imshow(I),title('origin-image');
H(1:256)=0;
for i=1:m
for j=1:n
H(I(i,j)+1)=H(I(i,j)+1)+1;
end
end
figure(2):plot(H,'.'),title('origin-histogram');
I=double(I);
w=15;
for i=1:m-w+1
for j=1:n-w+1
H(1:256)=0;
for ii=0:w-1
... |
function [r_val xt_all]=runSeedingNDM(eig_val,V,time,beta,atropy,lh_seed,rh_seed)
% A function to run seeding analysis for bilateeral seeds specified in
% lh_seed and rh-seed
r_val=[];
xt_all=[];
atr_all=[];
ns=1:length(atropy);
for i=1:length(atropy)/2;
xt=[];
C0=zeros(1,length(eig_val))';
C0(lh_seed(i))=... |
function [H] = shannon_entropy(X,bins)
XH = histc(X,bins);
p = XH/sum(XH);
h = zeros(size(p));
ind = find(p~=0);
h(ind) = -(p(ind)).*log2(p(ind));
H = sum(h);
end
|
function [v] = fmg(f, mask, vsz, opts)
%FMG Full multigrid for solving Poisson's equation with homogenous Dirichlet BCs.
%
% -Delta u = f, for x in mask
% u(~mask) = 0
%
% [v] = FMG(f, mask, vsz, [opts]);
%
% Inputs
% ------
% f right hand si... |
function Io = BilateralFilter(I,sigmad,sigmar)
x = size(I,1);
y = size(I,2);
%How do we decide the neighborhood?
start = 3*sigmad;
Io = zeros(size(I));
I = MirrorPad(I,start);
% compute closeness/distance once
for i = 1:2*start+1
for j = 1:2*start+1
% kt = sqrt((i-start)^2+(j-start)^2);
kt1 = (i-start)^2... |
clear
clc
original = imread('open_sub/1.JPG');
mark = imread('open_mark/1.JPG');
mark = rgb2gray(mark);
[height width] = size(original);
count = (height-4)*(width-4) %mask = 5*5
train = [train; original];
while (count)
for i = 1:(height-4)
for j = 1:(width-4)
for k = 1:5
if... |
function Results = run_bayesian_PK_model_inference(DCE_MRI_Struct, voxel_idx, PK_Params_Prior, PK_Params_Proposal_Dstr, ...
T10_Prior, Noise_Prior, Options)
PK_Params_Posterior = [];
% Check input arguments
if nargin <= 2
disp(sprintf('%s(DCE_MRI_Struct, v... |
addpath /home/data/asl/mfiles
firstLevelBatch
normalize_apply_all
pairedTtest_spmJr
|
function [bus_spec1,Ain,pq,lpq,Vmag,pv,l]=Q_check(bus_spec,Vmag,Ang,n,Ybus,pv,pq)
Vmag1=Vmag;l=[];bus_spec1=bus_spec;
for ct=1:n
if (bus_spec(ct,2)==1)
Vmag(ct)=bus_spec(ct,3);
[E,F]=pol2cart(Ang,Vmag);
V=E+F*j;
S=V.*conj(Ybus*V);
Qmax=bus_spec(ct,8);
... |
function varargout = drawEdge3d(varargin)
%DRAWEDGE3D Draw 3D edge in the current axes
%
% DRAWEDGE3D(EDGE) draws the edge EDGE on the current axis.
% EDGE has the form: [x1 y1 z1 x2 y2 z2]. No clipping is performed.
%
% DRAWEDGE3D(AX,...) plots into AX instead of GCA.
%
% H = DRAWEDGE3D(...) returns a hand... |
% function [uah,vah]=u_v_at_h(z0,u,v,altw,heights)
% [uah,vah]=u_v_at_h(z0,u,v,altw,heights)
% interpolate wind on staggered grid to given
%
% in:
% z0 2D roughness length at cell centers (under w points)
% u 3D wind, staggered in x direction
% v 3D wind, staggered in y direction
% altw 3D ... |
function out = plot_curtain(alt,lims,varargin)
if (nargin>2)
colos = varargin{1};
if (nargin==4)
colom = varargin{2};
end
else
colos = [0.6 0.6 0.6];
end
np = size(lims,1);
nn = (np+1)/2; % median
h = fill_curtain(alt,lims(1,:),lims(2*nn-1,:),colos);
hold on
for k=2:(nn-1)
h(n... |
% this module should be run after SMARTeCDFs.m to have all the data related
% to any individual preloaded to Matlab, it also uses CDFcomparitor.m
% function to calculate emperical CDF of any three combination of commands
% with the same basis. It will generate plot to make comparision for
% individuals selected by j
... |
function Result = MWND( data1,k )
%此算法主要执行所提出的的xinsuanf
%data: 输入的数据,每一行为一个样本 k:聚类的类簇数目
lambda=5.5;%初始化参数
tt=2;
data=cell(1,4);%保存每一个特征的数据
no_dims=round(3/4*size(data1,2));%确定降维的维数
data{1}= pca(data1,no_dims);%PCA算法降维算法降维算法
data{2}=(lle(data1',8*k,no_dims))';%LLE算法降维算法
data{3} = Laplacianf(data1, 8*k, no_dim... |
%16-71
omegaAB = input("Angular Velocity at A: ");
dtop = input("distance from point B - D in mm: ");
rtop = dtop /2;
rarm = input("distance of small arm AB in mm: ");
rleg = input("distance of leg of T to point P in mm: ");
vb = rarm * omegaAB;
omegaBD = vb /dtop;
%distance from Instantenous Center to P
distanceICt... |
function outdir = guru_getOutPath(dirtype)
%
% Points us to specific output paths, given
% an assumed directory structure
%
% dirtype: 'cache' or 'datasets'
%
% outdir: full local path
%
switch (dirtype)
case {'cache'},
outdir = fullfile('~', '_cache');
case {'datasets'}
outdir = fullfile(... |
%{
Kevin Shebek
February 5, 2017
Use the Moore-Penrose pseudo-inverse to calculate the gain.
This approach is from the Huang Paper
gain = inv((B*B.'))B*A.'
%}
%% Create the necessary matricies A and B
%A = [(v_i,1 - var_i)...]
A = var_values(:, :, 1:end-1) - var_values(:, :, end);
%B = [(D_i,1 - o_i... |
clc
clear all
close all
a=zeros(256)
[m n]=size(a);
for i=1:m
for j=1:n
a(40,j)=255;
a(80,j)=255;
a(124,j)=255;
a(150,j)=255;
end
end
theta=0:180;
[p q]=radon(a,theta);
imshow(a),title('Input image')
figure,imshow(p,[],'Xdata',theta,'Ydata',q,'InitialMagnification... |
function Assignment4_SIFT_Robustness()
clc, clear all, close all
% Load VLFEAT
run vlfeat-0.9.16/toolbox/vl_setup;
% Load image
im = imread('Oxford_VGG_Graffiti_img1.ppm');
img = single(rgb2gray(im));
% Extract SIFT keypoints & descriptors for image-1
%[frames,descrs] = vl_sift(img,'PeakThresh',... |
function de_castelSurfice(p1,p2,p3)
n = 3;
m = 3;
%Punti di controllo
%p1= [0 0 0; 1 1 1; 2 2 2];
%p2= [1 2 3; 2 3 4; 3 4 5];
%p3= [9 8 7; 9 7 1; 3 3 3];
P = zeros (n,m ,3);
P(: ,: ,1) = p1; %lungo u
P(: ,: ,2) = p2; %lungo v
P(: ,: ,3) = p3; %
plot3 (P(: ,: ,1) , P(: ,: ,2) , P(: ,: ,3) , 'k--o'); hold on... |
%%%write the clean code
%%%
%%%
clear
addpath(genpath('../../../../Useful Functions/'));
addpath(('../../../../Toolboxes/FAM_Biclustering'));
addpath(('../../../../Toolboxes/cvap3.7'));
%data path
%path_d = 'C:/Users/dlmg4/Dropbox/data/uci dataset/auscredit/';
path_d = '~/Dropbox/data/uci dataset/auscredit... |
function [idx_union, idx_intersect] = unionIntersectIdx(varargin)
if nargin < 2
disp('Please input more than two sets of indices')
return
end
idx_union = union(varargin{1}, varargin{2});
idx_intersect = intersect(varargin{1}, varargin{2});
if nargin == 2
return
end
for i = 3:nargin
idx_union = union... |
function table_data = TableData(obj,name,parentName)
%
% Copyright 2017 Yulin Wu, USTC
% mail4ywu@gmail.com/mail4ywu@icloud.com
switch parentName
case 'hardware settings'
s = obj.qs.loadHwSettings(name);
anno = struct();
if isfield(obj.keyAnnotation.hardware,'comm'... |
function playerStatus = checkPlayerStatus(hPlayerButton, textStatus)
if strcmp(textStatus, 'toStart') || ...
strcmp(textStatus, 'Finished') || ...
strcmp(textStatus, 'Terminated')
playerStatus = (1 == getappdata(hPlayerButton, 'status'));
elseif strcmp(textStatus, 'toContinue') |... |
% SB1_EXAMPLEREGRESS Example of Sparse Bayes Regression
%
% SB1_EXAMPLEREGRESS(N,NOISE,KERNEL,WIDTH,MAXITS)
%
% INPUT ARGUMENTS:
%
% N Number of training points
% NOISE Noise standard deviation to be added
% KERNEL Kernel function to use (see SB1_KERNELFUNCTION)
% WIDTH Kernel lengt... |
tbUse vistadisp
% runme for bar wedge ring (NEI core grant)
% 300TRs
Screen('Preference', 'TextRenderer', 0); % For draw formatted text
%%
params = retCreateDefaultGUIParams;
params.fixation = 'dot with grid';
params.tr = 1;
params.skipSyncTests = 0;
params.c... |
function data=importData(filename,moments,delay_distributions)
%read file as text
text=fileread(filename);
if not(exist('moments','var'))
%moments of the delay distributions
load moments
%rows: delay distribution type (bus_order +1)
%columns: mean, std, skewness, kurtosis
end
if not(exist... |
function [D,Cc,unit_pair_id] = get_jointcost(param_path,curr_uid,prev_uid,ext,K)
% Note : All parameter files must be row vectors
% Purpose: Compute the joint/concatenation cost between u_i and u_{i-1}
% Inputs:
% param_path - path of parameters for computing joint cost
% curr_uid - candidate list of current t... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This script is used to plot the test profile.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all
clear all
%%Generate the test profile: for each wind speed and solar irradiance, 5
%%Qsetpoints ar... |
X_train = load('../digit/digit.txt');
y_train = load('../digit/labels.txt');
% ============ Q - 2.5.1, 2.5.2 ============ %
K = [2, 4, 6];
maxIt = 20;
for k = K
C = X_train(1:k,:);
[y_pred, ~, ss, it] = kmeans.train(X_train, k, C, maxIt);
p = kmeans.calcP(y_train, y_pred);
fprintf("For K: [%d] SS: [%f... |
function output = renameAMPAO(FileName,PathName,handles)
if FileName(end-2:end) == 'vol'
[header, BScanHeader, slo, BScans, ThicknessGrid] = open_vol (strcat(PathName,FileName));
BScans(BScans>1e+38)=0;
% output.BScan = BScans.^.25;
output.BScan = BScans;
output.slo = slo;
output.ScaleX= hea... |
% P_PARAM
%
% Sluzi na vypocet parametrov P regulatora pomocou vybranej experimentalnej
% metody
% Copyright is with the following author(s):
%
% (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava,
% juraj.oravec@stuba.sk
% (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava,
... |
clc
clear
addpath(genpath('F:\Matlab_Home_HonsLab_sync'));
%% START LOOP
noc = 5; e=1;
IMG{noc} = [];
REFs{noc} = [];
CURs{noc} = [];
DIFF{noc} = [];
SURF{noc} = [];
FIG_LOOP = figure;
Wk5_demo_Pipeline_Part1;
IMG{e} = I;
SURF{e} = ref;
for e = 2:noc
Wk5_demo_Pipeline_Part2;
dev = abs(ref_... |
function [beta] = getglmSensitivityFunction(X,y,condIdx)
nChannel = size(X,2);
nObservation = size(X,1);
assert(nObservation == length(y));
X = X(condIdx==1,:);
y = y(condIdx==1,:);
beta = nan(1,nChannel);
for i = 1:nChannel;
[b,~,~] = glmfit(X(:,i),y,'binomial','link','probit');
beta(i) = b(2);
end |
function u = controller(params, t, X)
kp = 1000;
kd = 4;
% 1. write out the forward kinematics, such that p = FK(theta1, theta2)
p = [0,0]';
l = params.l;
theta1 = X(1); theta2 = X(2);
dtheta1 = X(3); dtheta2 = X(4);
p(1) = l*cos(theta1) + l*cos(theta1+theta2);
p(2) = l*sin(thet... |
function [final,file2,group2,idx] = detAvgSpectra(X,file,group,method)
%detAvgSpectra - determine mean/median spectrum for each group in each file
if nargin == 3
method = 'mean';
end
% Convert file and group to a single class
allClass = classMany2One([file group]);
% Determine unique files
[unqC,~,indC] = unique... |
function [Deployment_roomcat_save_temp, num_out_of_range] = PM_exposurefiltering(Deployment_roomcat_save, bname, flagmode, particle_coefficient, HAPEx_LOQ, num_out_of_range)
%Flagging and filtering of CO exposure data
% By Evan Coffey
%% Settings
defaultPC=1; %temporary setting to just use the default PC for al... |
x = [0:0.15:15];
y = f(x);
[ymin, Imin] = min(y)
xmin=x(Imin)
|
function FeatureInfo=cumIntensityHistogram_Feature(ParentInfo, FeatureInfo, Mode)
%Purpose: To implement a feature, two files are needed.
%*CategoryName*_Category.m: to calculate the ParentInfo from DateItemInfo to be used in *CategoryName*_Feature.m.
%*CategoryName*_Feature.m: to calcuate the features using ... |
function springP(x,y,angle)
m = .2;
xx=[0,1]*.15;
yy=m*xx;
d = sum(abs(yy));
P = rotate([0,0;0,-d],angle);
plot(P(:,1)+x,P(:,2)+y,'k')
P = rotate([xx',-d-yy'],angle);
plot(P(:,1)+x,P(:,2)+y,'k')
xx = [-1,1]*.15;
yy = m*xx;
d = sum(abs(yy));
for i = 1 : 2
P = rotate([xx', yy'+d/2-2*d*i],angle);
... |
function [ node_layer_2,node_layer_3,node_layer_4,node_layer_5,node_layer_6,node_layer_7 ] = generate_node_layer( hc , NODES )
%Function generates layers of nodes from weights
%Starts at node_layer_2 because node_layer_1 = inputs
if (hc == 3) %Creating node_layer matrices with nodes
node_layer_2 = zeros(1,NODE... |
% This code belongs to the paper
%
% M. Bačák, J. Hertrich, S. Neumayer and G. Steidl.
% Minimal Lipschitz and ∞-Harmonic Extensions of Vector-Valued Functions on Finite Graphs.
% Information and Inference: A Journal of the IMA, vol 9, pp. 935–959, 2020.
%
% Please cite the paper, if you use this code.
%
% Computes th... |
function bool_num = prompt(msg_str,default_choice)
% shortcut of the request unprocessed text input example
% in input page of MATLAB doc
bool_num=false;
str = input([msg_str, ' Y/N [',default_choice,'] : '],'s');
if isempty(str)
str = default_choice;
end
if str(1)==... |
function KPart = kernelDiffX(X, theta, q, K);
% KERNELDIFFX Compute the gradient of the kernel with respect to X.
% Since the result is all zeros apart from one row/column combination,
% and the result is symetric, here we return a matrix whose rows are the
% vectors which give the row/column combinations
theta = ... |
clear all; clc; close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gaussian copula transform
% QiangLI
% University of Valencia
% Nov,8, 2021
% @copyriht
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ns = 1000;
aux_X = randn(1,Ns);
X(1,:) = cos(aux_X);
X(2,:) = sinc(aux_X);
X = X + 0.2*randn(size(X));
X = [0.5 0.5... |
function [fRate, signfRate] = getRateLoop( f, Ax )
%GETRATELOOP Rate of change for periodic functions.
% [fRate, signfRate] = getRateLoop( f, Ax ) computes the second order
% rate of change of the function vector f on the independent variable
% whose inner step is Ax. The derivated function must be periodic a... |
%===================================================================================================================================
% Killer Whale Optimization Algorithm
% Author : Totok Ruki Biyanto (TRB)
% Email : trb@ep.its.ac.id; trbiyanto@gmail.com;
%============================================... |
classdef Coordinate < Vector
properties
end
methods (Access = public)
function crd = Coordinate(varargin)
if nargin == 1 && ~is_Coordinate(varargin{1})
error('Wrong arguments to Coordinate... |
clear all; close all; clc;
x = linspace(-5,5);
y = linspace(-5,5);
[X, Y] = meshgrid(x, y);
Z = log(0.01 +(X.^2 + Y - 11).^2 + (X + Y.^2 - 7).^2);
[M, c] = contour(X, Y, Z);
c.LineWidth = 2;
colormap winter;
colorbar; |
%% Multiple Catalog Comparison
clear
close all
% Load Nepal Catalog
% pathname1 = 'Data/recentNSC.csv'; %% This is a hardcoded directory that must be changed based on the user
% catname1 = 'National Seismic Centre - Nepal Events'; %% Also must be changed based on the user
% cat1 = loadNepal(pathname1,catname1);
% L... |
function f = img(y,c)% Syntax f = img(y,c). Use to display grayscale image w/ WinLev Sliders.
% "y" is the real or cmplx array to be displayed in 256-grayscale.
% "c" is an optional argument to choose type of display:
% c=1 to display abs(y)
% c=2 to display real(y)
% c=3 to display imag(y) (i.e. imaginary part... |
%%%%% Parte VI Lab 4 DSP
function X = DFTdc(x)
N = length(x);
W = exp(-1j*2*pi/N);
Wk = W.^(0:(N/2-1));
x0 = zeros(1,N/2);
x1 = zeros(1,N/2);
for i = 1:N/2
x0(i) = x(2*i-1); %OBS "par" 1,3,5,... en MATLAB
x1(i) = x(2*i); %OBS "impar" 2,4,6,... en MATLAB
... |
function [frmat, frtrls] = updateRFMapSac(frmat, frtrls, randXpos, randYpos, numtrigs, subpnum)
global xdiv
xdiv = 40;
xrng = [150 850]; % try to keep the ratio of 1048x768 ~~ 4:3
yrng = [50 650];
hbins = linspace(xrng(1), xrng(2), xdiv);
vbins = linspace(yrng(1), yrng(2), xdiv);
for i = 1:length(randXpos)
ro... |
%% Script to estimate m and sigma at each site
% use each individual well
all_names = {'A1', 'C1', 'dpnmr_leque_east', 'dpnmr_leque_west', ...
'dpnmr_larned_east', 'dpnmr_larned_west', 'dpnmr_larned_lwph'};
% use each site
% all_names = {'dpnmr_larned_all', 'dpnmr_leque_all', 'gems_all'};
% use all da... |
global saveProcess
%% Epoching for each target
timeBeforeEventMIT = 4;
timeAfterEventMIT = 4;
alignEvent1 = spectrogramData{1}.state.ST_STOP;
alignEvent2 = spectrogramData{1}.state.ST_HOLD;
alignEvent3 = spectrogramData{1}.state.ST_STOP;
epochs = extract_epochs_runs(spectrogramData,...
alignEvent1,...
timeBe... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% updateSY.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function [point] = updateSY(point)
% update both S and Y
%
% for details of input and output struc... |
z(:,1) = conv_map(:,1);
z(:,2) = conv_map(:,2);
z(:,3) = 1 - z(:,1) - z(:,2);
n = conv_map(:,3);
tersurf(z(:,1),z(:,2),z(:,3),n+1);
%ternaryc(z(:,1),z(:,2),z(:,3),n+1,'.');
axis off
% text(-.05,0,'C_{1}');
% text(0.46,0.9,'H_{2}O');
% text(1,0,'C_{10}');
%colorbar
caxis([1 7]) |
%%%% fit gabors from grid of statistics given by A on XY grid of X %%%%%
% fit is an additive model of simple + complex cell
% or a simple + complex divisive normalized cell
% X: grid of y and x points
% A: npixels x ngabors <- different gabors that are being tested
% yp,xp: possible receptive field centers for each ce... |
clear;
clf;
P=40; %perioada
D=11; %durata semnalelor
duty=(D/P)*100;
N = 50;
wo = (2*pi)/P;
c0 = 0; ... |
function [ber, numBits] = test_bertool(EbNo, maxNumErrs, maxNumBits)
import com.mathworks.toolbox.comm.BERTool;
totErr = 0;
numBits = 0;
M = 16;
k = log2(M);
n = 1000;
nsamp = 1;
while((totErr < maxNumErrs) && (numBits < maxNumBits))
if (BERTool.getSimulationStop)
break;
end
totErr = totErr +... |
function CompareNonoverlapping( p, m, k )
%COMPAREOVERLAPPING compares computational time in overlapping and
%nonoverlapping to get equivalent variance reduction
if nargin < 3
k = 30;
if nargin < 2
m = 1000;
end
end
plot_options = {'MarkerSize',8, 'LineWidth',2};
label_options = {'FontSize', 16};
... |
function[alpha] = cub_int(x, a0, a1,p)
%al0 needs to be an initial guess of al0.
c1 = 1e-5;
c2 = 0.9;
sufdec = fi(x+a0*fi_(x));
newvalue = fi(x)+c1*a0*fi_(x)'*p;
% if sufdec <= newvalue; %
% alpha = al0;
% return
% end
a1 = (fi_(x+0*p)'*p*a0^2)/(2*(fi(x+a0*p)-fi(x)-fi_(x+0*p)'*p*a0) );
if f... |
function [P, A, Q] = fmcPAQ(E, s, t)
[p, q] = size(E);
x = zeros(1,s*t+p*s+q*t);
Aeq = sparse(s+t+1, s*t+p*s+q*t);
for i = 1 : s
Aeq(i, (i-1)*p+(1:p)) = 1;
end;
for i = 1 : t
Aeq(i+s, p*s+s*t+(i-1)*q+(1:q)) = 1;
end;
Aeq(s+t+1, p*s+(1:s*t)) = 1;
beq = ones(s+t+1,1);
x = fmincon(@(x)myfr(x, p, q, s, t, E), x, []... |
function loglog_scatter_diagonal_histogram(xs,ys,axmin, axmax)
% Histogram
dists = 1/sqrt(2) * 1/log(axmax/axmin) * (log(xs ./ ys));
xtick = 1/sqrt(2) * 1/log(axmax/axmin) * (log([1/100, 1/90, 1/80, 1/70, 1/60, 1/50, 1/40, 1/30, 1/20, 1/10, ...
1/9, 1/8, 1/7, 1/6, 1/5, ... |
function out=isonebyone(i,start,finish);
declare_globals
%try
temp1=makeMATLABcallstring(1,{funstr{i}(start:finish)},[],[start finish],i,inf);
% catch
% funstr{i},funstr{i}(start:finish),kb
% end
if any(strcmp(temp1,typs{5}))
out=1;
else
out=0;
end
% goon=1;
% out=1;
% temp=(findstr('[',funstr{i}));
% temp1=(findstr... |
% hygge mcstas
close all
clear all
NuN=NaN;
%addpath(genpath('/Users/TummasN/Documents/GitHub/specialkursus-ckt-2018/Matlab')) %replace with own path
addpath(genpath('C:\Users\kedde\Documents\GitHub\specialkursus-ckt-2018\Matlab'))
%path = '/Users/TummasN/Documents/GitHub/specialkursus-ckt-2018/Krystal_sim/Anal... |
N = 100; % length of signal in time domain
data = randn(1,N); % simulated data
DATA = fft(data); % FFT of data
% % % % % % % % % % %
% Construct Filter
hf_gain = 0; % can be set independently
atten_factor = 0.1;
LTF = [ hf_gain ...
linspace(atten_factor, 1, 30) .... |
% % rows = 3;
% % cols = 3;
% % imageArray = zeros(rows,cols,:);
%
% % script to generate a small 100 x 100 Julia set
% grid100 = CreateComplexGrid(100);
% points = JuliaSetPoints(grid100,-0.79+0.15i,10); % note cutoff of 10
% J1 = ColourJulia(points,jet(10)); % use the jet colour map with 10 rows
% J2 = Colou... |
t=0:0.0001:1/2/60;
k=0.001;
s=220*sin(2*pi*60*t);
S=220*cos(2*pi*60*t)*2*pi*60;
hold on
N=k*S-s+400;
d=N./400;
for i=1:length(d)
if(d(i)>0.95)
d(i)=0.95;
end
end
%plot(d)
plot(s/220)
ril1=(1/85e-3).*s.*d*(1/2000);%plot(ril1)
ril2=(1/85e-3).*(400-s).*(1-d)*(1/2000);%plot(ril2)
plot((ril1+ril2)/2... |
classdef (Abstract) Hatch
methods (Access = public, Static)
function hatchData = generate(polygon,section,orientation)
hatchData = [];
offset = section.hatchOffset;
distance = section.hatchDistance;
pattern = section.hatchPattern;
Xgenerate = ...
... |
function [] = plot_times(filestr, nRuns, res_root, legend_str)
if ~exist('res_root', 'var')
res_root = '.';
end
u_fieldlist = {};
for indFile = 1:numel(filestr)
finalStruct{indFile} = struct;
for r = 1:nRuns(indFile)
fprintf('Run: %d \n', r);
try
file = ([fi... |
function [ Fz ] = numGrav(z2,z1,nz,y2,y1,ny,x2,x1,nx )
%numGrav will numerically calculate the gravitational attraction of a cube
%by using a point mass approximation. The number of point masses in each
%direction is controlled by nz, ny, nx.
dx = (x2 - x1)/nx;
dy = (y2 - y1)/ny;
dz = (z2 - z1)/nz;
dv = dx*... |
function image = ApplyMorph( image, method, structuringElement, param1, param2 )
% Method = 'dilate' 'erode' 'open' 'close'
% Structuring Elements
% se1 = strel('square',11) % 11-by-11 square
% se2 = strel('line', 10, 45) % length 10, angle 45 degrees
% se3 = strel('disk', 15) % disk, radius 15
% se4... |
function [] = let_mosquito_go( )
% let_mosquito_go - 驱蚊程序
% 默认播放20khz声波,能驱鼠,驱蚊
% Author: heLoman
% 以下为同方知网参考论文得到的参数,为防止人耳听到带来干扰,高频18~20khz左右比较合适,
% 如果能听到可以调高频率.
% 20khz 驱鼠
% 15~20khz引起气流变化使蚊子无法飞翔
% 21~23khz发出雄蚊声音吸引雌蚊,雄性不吸血
% 4~20khz可能也能驱蚊
% 300~500hz可以吸引雄蚊的雌性翅膀振动声
% 30~70khz为蝙蝠超声波驱蚊
fs=48000; %... |
%% ------------------------------------------------------------------------%
% EE 569 Homework #3
% Date: Nov. 1, 2015
% Name: Faiyadh Shahid
% ID: 4054-4699-70
% Email: fshahid@usc.edu
%------------------------------------------------------------------------%
%% Read all the images
row = 200; col =200; BytesPerPixel =... |
clc;
clear;
close all;
I=imread('digit.jpg');
% figure;
imshow(I);
Igray=rgb2gray(I);
% figure;
% imshow(Igray);
level=0.9;
Ibw=im2bw(Igray,level);
%imshow(Ibw);
% invert the imput image
Ifill=~Ibw;
figure;
%imshow(Ifill);
%mophology
%Ifill=imfill(Ifill,'holes' ); %fill hole in input image
S... |
txt = fileread('./get_combos/motor_gb_combos.txt');
f = fopen('combos.txt', 'w');
lines = strsplit(txt, '\n');
num_unknown = 1;
for i = 1:(numel(lines) - 1) % last line empty
cur_line = lines{i};
split = strsplit(cur_line, ';');
if ~isempty(strfind(split{1}, 'unknown'))
split{1} = ['unk... |
function [L2Norm, H1Norm, ElemL2Error, ElemH1Error] = main(nElem = 2, degree = 1, viscosity = 1, toRefine = [])
%*******************main code for the 1D finite element solver*************
%**************************build mesh**************************************
x_0 = 0.25;
xMin=0;
xMax=1;
nEls=nElem;
[nN,nodeCoord... |
function [symbol_cp_s, bit_tx] = SISO_transmitter(flags)
% Simulating the transmitter side for a SISO channel, input the parameter
% group flags, generating a series of bits as the transmitter output
%
% VUB BRUFACE
% Yu Liu, Bohan Zhang, Xianjun Mao
%
bit = randi([0 1],flags.Nbits,1); % generate a length of N bits ... |
function results = SVM(x,y,label)
tt = cputime;
addpath('liblinear-1.51-objective');
addpath('liblinear-1.51-objective\matlab');
labelindex = find(y ~= 0);
x_train = x(labelindex,:);
y_train = y(labelindex);
opt = ['-s 3 -c 1'];
model = train(y_train,x_train, opt);
unlabelindex = find(y == 0);
x_test = x(unlabeli... |
image=imread('alphanumeric_templates .bmp');
image_grey=rgb2gray(image);
image_binary=imbinarize(image_grey);
image_binary=~image_binary;
[r,c]=size(image_binary);
% figure;
% imshow(image_binary);
%% 字母表方法1
temp1=cell(36,1);
temp2=cell(36,1);
se1=cell(36,1);
se2=cell(36,1);
k=1;
for i=1... |
function [ A, Q ] = symtridhh( A )
% SYMTRIDHH brings a symmetric real matrix A in similar tridiagonal form
% using similar householder transformations, T = Q'AQ
% reference: Golub, Van Loan; 3rd ed; ch. 8.3.1 and 5.1.6.
% $Id$
if any(any(A ~= A'))
error('Input must be symmetric!')
end
N = size( A, 1 );
for k = ... |
function [S] = SILENCING(G)
clear S;
% SILENCING CODE:
%
% CITATION:
% Network link prediction by global silencing of indirect correlations
% Baruch Barzel & Albert-Laszlo Barabasi
% Nature Biotechnology 31, 720-725 (2013) doi:10.1038/nbt.2601
%
% CODE DESCRIPTION:
%
% Input: G is a square correlation matrix... |
clear;clc;clf
x1=[13 72 610 963 1829 3087 4111 6096 10010]
y1=[1007.0 1000.0 940.0 902.0 814.3 700.0 617.0 479.2 280.0]
subplot(2,2,1)
plot(x1,y1,'-r+','LineWidth',2)
title('00781035');xlabel('高度(m)');ylabel('氣壓(hPa)')
y2=[23.4 23.2 18.7 17.0 13.9 6.4 1.2 -11.6 -38.5]
y3=[22.7 20.1 17.4 12.9 -5.1 -10.6 -15.8 -16.2 -43... |
function Q = merge(geometry,P,rho_0)
% I. Initialization
Demand_1 = geometry(1).Demand;
Demand_2 = geometry(2).Demand;
Supply_3 = geometry(3).Supply;
% ------------------ Optional ------------------
% (only if one wants to compute the densities and not the flows)
% rho = NaN(size(rho_0));
% flow_1 = geometry(1).flow... |
function [f_est, out_ach_bits] = SISO_estimate_CFO(ach_bits, flags)
%SISO_estimate_CFO
% try to estimate CFO by preambles
% intputs:
% -ach_bits: the bit seires coming out from the transmitter
% -flags:
% outputs:
% -f_est: [N_sub] preamble in frequency domain
% -out_ach_bits: after the sim... |
cla, close all;
clear all;
ts = 0.01;
r = 5;
t = [0:ts:100];
N = length(t);
y = zeros(N,2);
delayFactor = 10;
x =[0;0];
kpp =1;
kdi = 1.5;
kpi = 0.07;
% kpp = 0.1;
% kdi = 1.0;
% kpi = 0.0005;
positionIntegral = 0;
previousError = 0;
noDelay = 0;
delayCounter = 0;
u(1) = 0;
for i = 1:N
positionError = r- x(1);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.