text stringlengths 8 6.12M |
|---|
function AssembleVandMatrix( obj )
V = zeros(obj.Np, obj.Np);
tempVCV = zeros(obj.Nph, obj.Np);
for n = 1:obj.Np
fh = obj.EvaluateHorizontalOrthogonalFunc( obj.N, n, obj.r, obj.s );
fv = obj.EvaluateVerticalOrthogonalFunc( n, obj.t );
V(:, n) = fh .* fv;
end% for
for n = 1:obj.Np
fh = obj.EvaluateHori... |
%
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YOEA112
% Project Title: Implementation of Firefly Algorithm (FA) in MATLAB
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
%... |
function [E,varargout] = simpledetection(time,data,window,threshold)
%===============================================================================
% SIMPLEDETECTION
%
%
%
%===============================================================================
%Sample interval
dt = time(2)-time(1);
%Set window according to ... |
function [corrMat,p_values]=decIntraExpCorr_multiFile(interval,field)
% This function calculates the correlation in turn or light choice
% probability over the interval (in minutes) specified in the input
%% Get paths to data files
[fName,fDir,fFilter] = uigetfile('*.txt;*','Open data file',...
'C:\Users\debivort\... |
% Calculate inertia matrix time derivative for
% %RN%
% Use Code from Maple symbolic Code Generation
%
% Input:
% %INPUT_QJ%
% %INPUT_QJD%
% %INPUT_RB%
% %INPUT_PHIB%
% %INPUT_XDB%
% %INPUT_PKIN%
% %INPUT_M%
% %INPUT_MR%
% %INPUT_IF%
%
% Output:
% MD [(6+%NQJ%)x(6+%NQJ%)]
% full time derivative of inertia matrix (f... |
function [s,JL_in] = carin(s,m,m_in,p,vmax)
[a,b]=size(s{1});
s_in=(rand(a,b)<p).*m_in;
s_new=(s{1}==0).*s_in;
JL_in(1)=sum(sum(s_new));%实际进入的
JL_in(2)=sum(sum(s_in));%本该进入的
s{1}=s{1}+s_new;
s{2}=s{2}+(m==1).*s_new.*randi(vmax,a,b);
s{2}=s{2}-(m==2).*s_new.*randi(vmax,a,b);
s{3}=s{3}+(m==3).*s_new.*randi(vmax,a,b);
s{3... |
clear
clc
close all
%%
fullfile(matlabroot,'examples','deeplearning_shared','main','helperCIFAR10Data.m')
addpath(fullfile(matlabroot,'examples','deeplearning_shared','main'))
cifar10Data = cd;
%%
[trainingImages,trainingLabels,testImages,testLabels] = helperCIFAR10Data.load(cifar10Data);
%%
size = [32,32,3]
... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jes�s Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 1.1: Representación de imágenes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1.6.1 Representaci�n de im�genes digitales
%%%%%%%%%%%%%%%%... |
close all;
clc;
clear all;
%{
function regenerator take the distorted signal and clock signal as
and threshold arguments and if the distorted signal value is above
the threshold value ,it make the out bit as 1 else 0;
A buffer holds the value until next clock signal
%}
function out_sig = regenerator(sig,clk,thr_hld)
... |
%% This function finds nearest neighbour of a query from a time series
%% Uses MASS_V2 algorithm to find the nearest neighbor
function rangeNeighborIndex = getRangeNeighbor(timeSeries, queryPosition, queryLength, range)
r = round(queryLength * (10 / 100));
% Extract the exact query
query = timeSeries(quer... |
function y = dirac(x)
% x
eps = 1e-1;
if (abs(x) <= eps)
y = 1 / (2*eps)
else
y = 0;
endif
endfunction |
function [BSs, UEs] = brownian(K, Q, I, locations, outerRadius)
BSs = zeros(K * Q, 1);
UEs = zeros(K * I, 1);
for k = 1 : K
for q = 1 : Q
BSs((k - 1) * Q + q) = locations(k);
end
for i = 1 : I
while true
x = (rand - 0.5) * 2 * outerRadius;
... |
function [wynik] = funkcja(t, x)
a = 2;
b = 0.2;
c = 1;
d = 0.1;
wynik = [ a*x(1) - b*x(1)*x(2); c*x(1)*x(2) - d*x(2)];
end
|
function res = performnn (w)
load bank_NN_Data.mat;
%Change the weights
net.IW{1} = reshape ( w(1:(5*51)), 5, 51 );
net.LW{2} = reshape ( w((5*51+1):(5*51+5)), 1, 5 );
Y_nn_test = net(XtestNN');
Y_nn_test = round(Y_nn_test');
C_nn_test = confusionmat(YtestNN,Y_nn_test);
N = sum(C_nn_test(:));
res = (( N-sum(diag(C... |
function [rpeAuto, rpeMult] = segmentRPELin(bscan, PARAMS, medline)
% SEGMENTRPELIN Segments the RPE from a BScan. Intended for the use on
% linear OCT-B-Scans (e.g. from a volume).
%
% For detailed comments refer to segmentRPECirc(..).
%
% RPEAUTO = segmentRPELINAuto(BSCAN, PARAMS, MEDLINE)
% RPEAUTO: Automated segmen... |
function [x,D]=fourier_matrix(N)
h =2*pi/(N); x = h*(1:N)';
column = [0 0.5*(-1).^(1:N-1).*cot((1:N-1)*h/2)];
D = toeplitz(column,column([1 N:-1:2]));
end
|
%Jan Heimann | 14th July 2017
deg = 0:15:90;
paths = {'./csv_data/rot.csv','./csv_data/rot_#1.csv','./csv_data/rot_#2.csv','./csv_data/rot_#3.csv','./csv_data/rot_#4.csv','./csv_data/rot_#5.csv','./csv_data/rot_#6.csv'};
graphTitle = 'Pegelabfall in Abhänngigkeit der Rotation';
row_offset = 42;
column_offset = 1;
N ... |
clear all
clc
close all
% This is the pipeline that pre-processes the data collected by the AG
% Fanis from 2 Utah Arrays.
% Abhilash Dwarakanath, MPI for biological cybernetics, April 2017.
%% Specify directories
subjectName = 'Anton';
if strcmp(subjectName,'Anton')
directories.recording =... |
function [alpha,nperm,tail,rows,sample,varx,type,m] = decode_varargin(varargin)
%decode_varargin decode input variable arguments
% [PARAM1,PARAM2,...] = DECODE_VARARGIN('PARAM1',VAL1,'PARAM2',VAL2,...)
% decodes the input variable arguments of various functions of the
% PERMUTOOLS statistical toolbox. To define c... |
clear all; close all; clc;
%% first image
Image1 = imread('1.png');
imshow(Image1);
%% Mouse input
xlabel ('Select at most 100 points along the outline', 'FontName', '微軟正黑體', 'FontSize', 14);
[ ctrlPointX, ctrlPointY ] = ginput(100);
ctrlPointList1 = [ctrlPointX ctrlPointY];
clickedN = size(ctrlPointList1,1);
promptS... |
clc; clear; close all;
Fs=1000;
F0 = 0; t0=0; F1 = 300; t1 = 2; fi = 0;
t=[t0:1/Fs:t1];
k=(F1-F0)/t1;
X = cos((2*pi.*F0.*t)+(2*pi.*(k/2).*(t.*t)+fi));
Y = chirp(t,F0,t1,F1,'linear');
X_fft = fft(X);
[H,F] = freqz(X,1,1024,'whole',Fs);
figure
g= plot(F-Fs/2,fftshift(10*log(abs(H))),'b','LineWidth',1)... |
out_dir = 'D:\MaggiesFarm\modeling_05_07_developmental\simulation_data\thompson\4perdim\';
% aggregate_simResults_perHorMAP(out_dir);
plot_correlation_perHor(out_dir);
|
% This demo applies the structured SVM to the HorseSeg dataset collected in this paper:
%
% A. Kolesnikov, M. Guillaumin, V. Ferrari, C. H. Lampert
% Closed-Form Approximate CRF Training for Scalable Image Segmentation
% ECCV 2014
% Project webpage: https://pub.ist.ac.at/~akolesnikov/HDSeg
%
% The data for this scrip... |
% Preface:
% Global settings
bidsOpt.FileExt = 'edf';
bidsOpt.InteralUse = true;
data(1).file = {'./sourcedata/eeg/sub-s01_task-faceFO_eeg.set'};
data(1).session = 1;
data(1).run = 1;
% general information for dataset_description.json file
% -----------------------------------------------------
generalInfo.Name ... |
function [ ResultsFilterMaxima ] = getBoxes( im, PSFsigma, scales )
%filterBoxWrapper: A Wrapper Function to perform Box Finding Fast for me
% Author: PKR UNM June 2016
% get sizes
imsize = size(im);
framesize = imsize(1:2);
if length(imsize) > 2
frameT = imsize(3);
else
frameT = 1;
end
sigmas ... |
function [Spfc_mix, Smd_mix, ZVis, ZAud, first, ErrorFrac] = packageData_BlockSwitch_laser(Z_C1, Smd, Spfc)
[~, ~, goodPFC, goodMD] = cleanData(Spfc, Smd, Z_C1);
Spfc = Spfc(goodPFC == 1);
Smd = Smd(goodMD == 1);
%%
context = Z_C1(:,9);
dC = diff(context);
SwitchTrial = find(dC~=0); % switch occurs after ... |
clear all;
clear;
%----------------------------------------------------------------------
% Generate the Low Rank Approximation of term doc matrix using SVD
%----------------------------------------------------------------------
projDir='E:\\wk\\aptha\\ajdsouza_local\\Google Drive\\education\\gatech\\course\\cse6643... |
function [testInstanceLabel] = PartitionHeldOut (Train_size, k);
%partition random data into k-1 and 1 sets
tmp=Train_size/k;
%initiate the label
label=cat(1,ones(tmp,1),zeros(Train_size-tmp,1));
%shuffling the label
rand('seed',1);
testInstanceLabel=label(randperm(size(label,1)),:);
end
|
syms f x;
f=input('请输入积分函数f=');
A=input('请输入积分区间[a,b]=');
e=input('请输入误差限e=');
x=A(1);
fa=eval(f);
x=A(2);
fb=eval(f);
T(1)=(A(2)-A(1))*(fa+fb)/2;
m=1;
x=(A(1)+A(2));
t=T(1)/2+(A(2)-A(1))*eval(f)/2;
while abs(t-T(1))>e
t=T(1);
new=0;
for i=1:(2^m)
x=A(1)+(2*i-1)*(A(2)-A(1))/(2^(m+1));
new=ne... |
function [Q_new, sgm_new] = argmax_indiv(Q, sgm, size_apple)
%% update mean and variance
Q_new = max(size_apple,Q);
sgm_new = sgm - 1;
end
|
% Create a function to plot points for visualizing a sphere
function plotSpheres(size,pointPosition)
% create a point for visualizing a sphere
[X,Y,Z] = sphere(20);
% Translate to the specified position
X = size*X+ pointPosition(1);
Y = size*Y+ pointPosition(2);
Z = size*Z+ pointPosition(3);
% Add the sphere to the... |
classdef kasse
properties
position;
frik = variation(1,5)
lp = 0;
l0 = 1;
kp = 1;
kpp = 1;
km = 1;
a = 0.75;
end
methods
function obj = kasse()
obj.position = 0;
end
function m = shouldMo... |
function filter_FROG(varargin)
if nargin==1
folder_name=varargin{1};
else
folder_name = [uigetdir '\'];
end
%% load files
FROG=load([folder_name 'FROG.txt']);
delays=load([folder_name 'delays.txt']);
wavelengths=load([folder_name 'wavelengths.txt']);
%% sutract background and threshold
Nbkg1=50;
Nbk... |
function [AmeanAll,Amean,Sb] = computeAmeans(A,P,N,G)
if nargout>2,
Sb=0;
end
% Compute AmeanAll and Amean for each class
AmeanAll=zeros(P,N);
for j=1:N
AmeanAll(:,j)=mean(A(:,j:N:end),2);
end
NG=max(G); % maximum element of G is the number of groups
Amean=zeros(P,N*NG);
for i=1:NG
sGi=find(... |
function flag=isOnTheObs(point_now,obs_circlr_Center,obs_circle_Range)
global dongp
global dongp1
if ((point_now(1)-obs_circlr_Center(1))^2+(point_now(2)-obs_circlr_Center(2))^2-obs_circle_Range^2<0)||...
((point_now(1)-dongp(1))^2+(point_now(2)-dongp(2))^2-dongp(3)^2<0)||...
((point_now(1)-dongp1(1))^2... |
mu = 0; b = 1;
S = randlpl(0,1,2,1e4);
A = rand(2);
X=A*S;
subplot(1,3,1)
plot(S(1,:),S(2,:),'.')
axis square
subplot(1,3,2)
plot(X(1,:),X(2,:),'.')
axis square
%ICA
[Sest, Aest, West] = fastica(X);
subplot(1,3,3)
plot(Sest(1,:),Sest(2,:),'.')
axis square |
function yesno = isContained2(part_pix, box2)
yesno = 0;
total = size(part_pix,1);
mask = zeros(total,1);
mask(find(((part_pix(:,1)>=box2(1)).*(part_pix(:,1)<=box2(1)+box2(3))).*((part_pix(:,2)>=box2(2)).*(part_pix(:,2)<=box2(2)+box2(4))))) = 1;
if sum(mask)/total>2/3
yesno = 1;
end
end
|
% eeg_mktriggers() - Produce EEGLAB fields 'urevent' and 'event'
%
% Usage:
% >> [urevent, event] = eeg_mktriggers( EVTSTRCT, evtype, evtlat, overwrite)
%
% Inputs:
% EVTSTRCT - structured variable containing fields: [.urevent, .event]
% *see EEG structure for subfields
% *if empty "[... |
function [dummy_subject] = SG_draw_dummy_subject(N,restricted,idx)
% =======================================================================
[summary_subjects,results_subjects]=SG_analyse('subjects',restricted,idx);
labeller = results_subjects(1).out.options.inG.phi;
% ================================================... |
% File Name: mainSmileSwitchTesting
% Purpose: Smile detection of pre-loaded testing images within same
% directory
% Note: Prior to using code, need to obtain constant values
% - faceParameters, mouthParameters values from training
% - manually go through testing images and look for a smil... |
%{
vis2p.StatsSimTraces (computed) #
movie_num : varchar(20) # the number of the movie shown
movie_type : varchar(10) # the type of movie shown
sim_traces_opt : smallint unsigned #
---
sim_traces : mediumblob # c) traces from simulated RFs
%}
... |
% CLASSIFYHEARTSOUNDS_SCRIPT classifyHeartSounds から MEX 関数
% classifyHeartSounds_mex を生成します。
%
% プロジェクト 'classifyHeartSounds.prj' から 13-Mar-2019 に生成されたスクリプトです。
%
% CODER、CODER.CONFIG、CODER.TYPEOF、CODEGEN も参照してください。
%Copyright (c) 2016-2019, MathWorks, Inc.
%% クラス 'coder.MexCodeConfig' の構成オブジェクトを作成します。
cfg = coder.... |
%%%% %%%%
function s = logsumexp(X, dim)
if nargin == 1,
dim = find(size(X)~=1,1);
if isempty(dim), dim = 1; end
end
y = max(X,[],dim);
s = y+log(sum(exp(bsxfun(@minus,X,y)),dim));
i = isinf(y);
if any(i(:))
s(i) = y(i);
end |
function varargout = GUI(varargin)
%Change it so that you have the option to only open up some of the figures.
%Change the variables so that it makes sense (Phase KX and Kx)
%Look at the comments on my laptop and take out the "Science" part.
% GUI MATLAB code for GUI.fig
% GUI, by itself, creates a new GUI or rai... |
clc;
clear all
close all
% %accessing Input file
load('Data.mat');
%seperating Input & Output
ip1=data(2:end,1:2:end);
ip2=data(2:end,2:2:end);
op1=[]
cnt=1;
for i=1:2:215
n=data(1,i) ;
if n==1
op1(:,cnt)=[1];
cnt=cnt+1;
end
if n==2
op1(:,cnt)=[2];
... |
imgFiles = dir('fingers_*.png');
%colormap(jet);
% rectangle
x1 = 0; y1 = 0; % top left
x2 = 100; y2 = 0; % top right
x3 = 100; y3 = 40; % bottom right
x4 = 0; y4 = 40; % bottom left
% arbitrary quadrilateral
X1 = 30; Y1 = 80; % top left
X2 = 60; Y2 = 80; % top right
X3 = 80; Y3 = 50; % bottom right
X4 = 1... |
function [labels,scores] = convpredict( convnet )
%PREDICT Summary of this function goes here
% Detailed explanation goes here
imdsTest = imageDatastore('.\test_coarse','IncludeSubfolders', true, 'FileExtensions', '.png', 'LabelSource', 'foldernames');
[labels,scores]=classify(convnet,imdsTest);
% per... |
function [ WSN_PCA_CleanData_Matrix_Training ] = WSN_PCA_DataPreparation_Training( SensorDataMatrixLabelled_Cell, SensorGroup,CleanData_YesNo, FaultyData_CorrectionAlgorithm )
%% Function Input and Output Argument Description:
% Input Arguments:
% SensorDataMatrixLabelled_Cell :
% SensorGroup :
% CleanData_YesNo
% ... |
clear all;
close all;
Dataset_SPATIAL_AUGMENTATION_COLOR_script2;
Dataset_SPATIAL_AUGMENTATION_COLOR_script3;
Dataset_SPATIAL_AUGMENTATION_COLOR_script4;
Dataset_SPATIAL_AUGMENTATION_COLOR_script5;
Dataset_SPATIAL_AUGMENTATION_COLOR_script6;
Dataset_SPATIAL_AUGMENTATION_COLOR_script7;
clear all;
clo... |
function sensorSize = sensorSizeLookup(CameraModel)
% function sensorSize = sensorSizeLookup(CameraModel)
% Simple look-up table for finding sensor size of specific camera models.
% Can be updated with as many cameras as needed.
% *IMPORTANT* Added cameras should use the name provided from EXIF data to
% prevent issue... |
%define the matlab environment that will be used in the NEST demo
%uncommenting the following lines will make sure the output of packets is in hex
%global DISPLAY_HEX
%DISPLAY_HEX=1;
global NETWORK_SCALE
NETWORK_SCALE=300; %this is the ratio of network units to Centimeters
global MAX_NETWORK_DIMENSION
MAX_NETWORK_... |
function [Cr, Ct, b] = generate_rteqs_line_mod(X, proj, is_stereoshift, inds, prime_num)
Cr = zeros(3, 9);
for i = 1:3
Cr(i, inds(:, i)) = X';
end
Cr = proj'*Cr;
Cr = mod(Cr, prime_num);
Ct = proj'*eye(3);
Ct = mod(Ct, prime_num);
b = 0;
if (is_stereoshift)
b = mo... |
%> \brief 2-dimensional non-linear shallow water equations
%> \details
%> This class descripe the conservation equations of the mass and
%> monuments of shallow water equations, written as
%> \f$ \frac{\partial \mathbf{U}}{\partial t} + \nabla \cdot
%> \mathbf{F}(\mathbf{U}) = \mathbf{S}(\mathbf{U}), \f$
%> where \f$ \... |
function [f ,A_f] = my_fft(y,Fs,L)
% Plot single-sided amplitude spectrum.
% A_f为输出频率幅值,f为对应的频率
%只适用于相同采样频率的信号
%y为离散数据向量,以时间为横坐标的数据,fs为采样频率Sampling frequency
% L Length of signal时域上的信号长度,信号个数,采样点数
% L是采样点数,与截取时间长度有关,仅影响频率分辨力。
% 采样频率Fs与频域上的区间长度[-Fs/2 ,Fs/2]有关,需要包括感兴趣的频段。
T = 1/Fs; % Sample t... |
function ACFcheck(x)
for dim=1:size(x,1)
figure
acf=xcorr(x(dim,:),x(dim,:));
acfplot=abs(acf(floor(length(acf)/2):end)./max(acf));
bar(acfplot);
hold on
plot(5/100*ones(size(acfplot)),'r')
hold off
end |
function ret = getENV(X,inFS,window,outFS)
nwindow = round(window*inFS);
ninc = round(inFS/outFS);
lastloc = length(X)-nwindow;
nframes = round(lastloc*outFS/inFS);
ret=zeros(nframes,1);
hh = hamming(nwindow);
hh = hh./sum(hh);
for n=1:nframes
s1 = (n-1)*ninc + 1;
xx = abs(X(s1:(s1+nwindow-1))).... |
function cpmnew = sum1( cpm,X,Xstay )
%{
Sum operation of a cpm (cpm) over given variables (X)
Input:
cpm: a cpm
X: Nx x 1 array of variable
<Xstay>: a scalar of sum option (0-default: X being summed up; 1: other than X being summed up)
Output:
cpmnew: a cpm after sum operation
Ex:
cpm = cpmcond([3 5 ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Sam Feig
% Vladimir Zhdanov
%
% CSCI 4831/5722
% Homework 1
% Instructor: Ioana Fleming
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ outImg ] = luminance_L(inImg)
% Apply lumininance formula to convert output image to grayscale
outImg = .299 * inImg(:, :, 1) + .587 * inImg(:, :, ... |
function varargout = Parameters(varargin)
% PARAMETERS MATLAB code for Parameters.fig
% PARAMETERS, by itself, creates a new PARAMETERS or raises the existing
% singleton*.
%
% H = PARAMETERS returns the handle to a new PARAMETERS or the handle to
% the existing singleton*.
%
% PARAMETERS('CALL... |
function varargout = fitCircle(X)
% FITCIRCLE fits a circle to a three-dimensional set of data.
% cfit = FITCIRCLE(X) fits a circle to set of N three-dimensional points.
%
% X - 3xN array containing points
% cfit - structured array containing the following fields
% cfit.Center - 3x1 center... |
function viewClassTree(directory)
% View a class inheritence hierarchy. All classes residing in the directory
% or any subdirectory are discovered. Parents of these classes are also
% discovered as long as they are in the matlab search path.
% There are a few restrictions:
% (1) classes must be written using the new ... |
%% Wrapper Function for Face Detection Training
%% Code Written by Nitin J. Sanket (nitinsan@seas.upenn.edu) (1)
%% and Adarsh Vakkaleri Sateesh (adarshv@seas.upenn.edu) (2)
%% (1) MSE in Robotics Student, University of Pennsylvania
%% (2) MSE in Computer and Information Science Student, University of Penn... |
function [FSMC] = FSMC_calc(control,SNR_reshaped)
% This function calculates the parameters of the Finite State Markov Chain(s)
% depending on the users input.
% INPUT: 525600x1 SNR_reshaped: Simulated SNR values for every minute of
% the year
%
% OUTPUT: 1x1 or 1x12 struct FSMC... |
% Lec 5.4 : Newton Raphson (Single variable )
% To solve non-linear equations using Newton- Raphson
% f(x) = 2-x+ln(x)
%% Initial conditions
x0 = 1.45;
maxIter = 50;
tolX = 1e-4;
%% Computation using Newton Raphson
x = x0;
xold = x0;
for i = 1:maxIter
f = 2-x+log(x);
df = -1+1/x;
x = x- f/df; % x(n+1) = ... |
function [accuracyinfo,tissuetally]=tissueLevelAccuracySimplified(matches,answers,partlist)
tissuetally={'neuron';'muscle',;'amphid';'hyp';'seam';'gut';'pharynx';'other'};%,unique({partlist{notempt,4}});
for i=1:size(tissuetally,1)
tissuetally{i,2}=0;%cases col
tissuetally{i,3}=0;%cases correct at cell le... |
for i = 1:10
class(i,1) = 1;
class(10+i,1) = 2;
class(20+i,1) = 3;
end
mdl = fitcknn(trainfeat, class, 'NumNeighbors', 5);
%creating mesh range
xrange = [-2 2.2]; yrange = [-2 2];
%specify step for image's resolution
step = 0.001;
[x,y] = meshgrid(-2:step:2.2, -2:step:2);
image_size = size(x);
xy = [x(:)... |
%% Creating the block model
n = 100; % number of nodes
K = 3; % number of communities
X12 = sparse(rand(n/2) < 0.05);
X11 = sparse(rand(n/2) < 0.1); X11 = X11 | X11';
X22 = sparse(rand(n/2) < 0.1); X22 = X22 | X22';
X = [X11, X12; X12', X22]; % Adjacency matrix
figure(1), clf
spy(X)
%%
% options for the init me... |
%DISP DTREE オブジェクトの情報を表示
%
% 参考 GET, READ, SET, WRITE
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 03-Aug-2000.
% Copyright 1995-2004 The MathWorks, Inc.
|
%% Readme: Biopac-Analysis toolkit
% By Roeland Heerema (roelandheerema@hotmail.com)
% last update April 2018
% This toolbox offers a number of functions to help you analyze three data
% types acquired using BIOPAC: heart rate (PPG), skin conductance (EDA),
% and facial musculature (EMG).
% Take a look at the example... |
function validIndiciesForEveryFold = generateCrossValidationFolds(data, k)
idx = find(data.y(:,1));
c=1;
for i = 1:numel(data.y)
idx(i,2)=c;
if c==10
c=1;
else
c=c+1;
end
end
tmp = idx(:,2);
tmp = tmp(randperm(numel(tmp)));
i... |
clear variables;
L=load('../scores_caltech256_LSTM_SISTAparams.mat');
scores=L.scores;
labels_exp=L.labels_exp;
nexp=size(scores,1);
ItersMax=squeeze(max(scores(:,:,5),[],2));
MSE=squeeze(mean(scores(:,:,1),2));
RMSE=sqrt(MSE);
PSNR=squeeze(mean(scores(:,:,2),2));
SSIM=squeeze(mean(scores(:,:,4),2));
T=table(ItersMa... |
close all;
clear all;
pkg load signal;
graphique=1;
#Read the data obtained from the sound card
f = fopen('../Data/GMDT_15s.dat', 'rb');
data = fread(f,inf,'int16'); %int16 pour short
fclose(f);
dcf=data(2:3:end);
clear data;
dcf=dcf(3*192e3:end);
dcf=dcf-mean(dcf);
dcf=hilbert(dcf);
##Characteristic variables
fs=19... |
%p is SUS2
allscreen()
subplot(4,2,1)
plot(timecell{1},P2_SUS(w,:))
xlim([-1,1])
%xlim([-0.8,0.8])
grid minor
narrow_colorbar()
title('Wide Band Event-triggered Average')
subplot(4,2,2)
plot(timecell{1},P1_SUS(w,:))
xlim([-1,1])
%xlim([-0.8,0.8])
grid minor
narrow_colorbar()
title('High Gamma power Event-triggered A... |
function H = lpfilter(type, M, N, D0, n)
%LPFILTER Computes frequency domain lowpass filters.
% h = LPFILTER(TYPE, M, N, D0, n) creates the transfer function of a lowpass filter, H, of the
% specified TYPE and size (M-by-N). To view the filter as an image or mesh plot, it should be cnetered
% using H = fftshi... |
%-----------------------------------------------------------------------
% FUNCTION: aks_diff.m
% PURPOSE: apply differencing to a data matrix
%
% INPUTS: M: nvar x nobs data matrix
%
% OUTPUT: M2: differenced data matrix (nvar x nobs-1)
%
% Written by Anil Seth, ... |
function Corr = getCorr(Image,Filter)
[row_Filter,col_Filter] = size(Filter);
[row_Image,col_Image] = size(Image);
r = (col_Filter-1)/2;
Corr = zeros(row_Image,col_Image);
for i = 1+r:col_Image-r
for j = 1+r:row_Image-r
f_out = Image(i-r:i+r,j-r:j+r);
corr = sum(sum(f_out.*Filter));
... |
function vekanal_subsmesh_demo
%% vekanal_subsmesh_demo
%
% File: vekanal_subsmesh_demo.m
% Directory: 2_demonstrations/lib/matlab
% Author: Peter Polcz (ppolcz@gmail.com)
%
% Created on 2018. July 27.
%
%% Requires
% <script 2_demonstrations/lib/matlab/vekanal_subsmesh.m>
%% Example 1
syms t x1 x2 real
x = ... |
function AMStim()
% Note: Noise1 is lead and Noise2 is lag
% AMStim (Adapted from Caitlin/Brian's head turn exp't)
% Generate stimuli for LDS session
global PDR
PDR.RPs=[];
%//////////////////////////////////////////
% low pass filter design:
fc=150;
fs=PDR.stim_Fs;
order=2;
[Bs,As]=filt_butter(fc,fs,order);
% Make st... |
%% 用V系统特征提取2D平面曲线
close all
clear all
example=1;
switch example
case 1
load fire500.mat
end
P=gpoint;
k=3;
N=floor(log2(length(P)/(k+1)))+1;
t=linspace(0,1,length(P))';
load tlist2.mat
Lambda=LSMatrix_V(k,N,t)\P;
LambdaA=Lambda;
LambdaA(1:length(Lambda)/2,:)=0;
xijie=LSMatrix_V(k,N,t)*Lambda... |
function [An,Bt,Phi] = influence(zc,t,n,del,N)
% -----------------
% E Kanso, 14 april 2004
% -----------------INPUT
%
% zc position of collocation pts
% t components of vectors tangent to panels
% n components of outward normal vectors
% del panel length
%
% zc, t and n are w.r.t inertial frame... |
%% define input patterns
clear;
pict;
p = [p1' p2' p3'];
%% calculate weights and update patterns
% weight symmetric
w = (p*p')/size(p, 1);
% calculate energy
Ep = -diag(p'*w*p)
Ed1 = -diag(p11*w*p11')
Ed2 = -diag(p22*w*p22')
%% recall stored patterns
pd1 = patRecal(p11', w);
pd2 = patRecal(p22', w);
%% plot
figure... |
function[link_path_r] = check_path(link_path,token_matrix,single_flow,small_br,wdm_order)
global c_server
token = ceil(single_flow/small_br);
c_server_1 = c_server(link_path(1));
% if (not(any(token_matrix(link_path,link_path) - token > 0)) | (c_server_1 - single_flow) < 0)
% link_path_r = [];
% return
% en... |
function y = grdf(a,H,x)
stp = 1e-3;
x1p = x + [stp,0]';
x1m = x - [stp,0]';
x2p = x + [0,stp]';
x2m = x - [0,stp]';
y1p = fx(a,H,x1p);
y1m = fx(a,H,x1m);
y2p = fx(a,H,x2p);
y2m = fx(a,H,x2m);
y = [(y1p-y1m)/(2*stp);(y2p-y2m)/(2*stp)];
end |
function Gout = B_field_Slope_loop_z( x,y,z,x0,y0,z0,n0,I,Rin,Rout,H )
%%%% Given a coil at (x0,y0,z0) direct to n0, with current I, inner radius
%%%% Rin, outer radius Rout, and thickness H, calculate dBx/dx, dBy/dy,
%%%% dBz/dz at x,y,z.
%set dx
delta=1e-4;
dx=delta;
%d(Bz)/dz
B_pdz=multi_loop_B_z(x,y,... |
function Def = irisoptim( )
% irisoptim [Not a public function] Default options for irisoptim package.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%---------------------------------------------------------------------... |
function h=ATL11_dumbell_plot(y, h, rep, beam, varargin)
[~, ind]=sort(rep+y/1e6);
ind=reshape(ind, 2, length(y(:))/2);
if nargin > 3
plot(y(ind), h(ind), varargin{:});
else
plot(y_ind, h(ind),'linestyle','-');
end
ht=text(y(:), h(:), num2str(rep(:)));
|
% Calculate Covariance and Correlation Coefficient
stocks = [-50:49; 1:100]';
iX = (stocks(:,1) - mean(stocks(:,1)));
iY = (stocks(:,2) - mean(stocks(:,2)));
difXY = (iX) .* (iY)
covXY = sum(difXY) / (length(difXY)-1)
cov(stocks)
sum(sqrt(difXY))
iX = sum(iX.^2)/length(iX)
iY = sum(iY.^2)/length(iY)
sqrt(iX)
sqrt(iY)... |
function olist = addZerosToCharStringList(list)
% ADDZEROSTOCHARSTRINGLIST <short description>
%
% ------------------------------------------------------------------------
% Copyright (C) 2020 M. Schrauwen (markschrauwen@gmail.com)
%
% This program is free software: you can redistribute it and/or modify
% it ... |
%% Opdracht 7
% Gegeven onderstaande script met een bijzondere vector.
% Vraag m.b.v. een standaard Matlab functie de afmetingen op van de
% vector 'matx'.
%
% Deze functie geeft het aantal rijen ('rijn') en kolommen ('koln') terug
% van de variabele 'matx'.
% Koppel de output van deze 'functie' aan de, door ons aange... |
%% Stereo pair from TL
%
% Used to illustrate the PBRT/RenderToolbox4 stuff we are doing.
%
chdir(fullfile(wltalksRootPath,'FVM'));
%%
ieInit;
%% I chose the crop to center on the pawn
load('rtbBinocular_DOF/rtbBinocular_DOF_Left','oi');
oi = oiSet(oi,'illuminance',oiCalculateIlluminance(oi));
oi = oiSet(oi,'name'... |
close all; clear all;
global FS FM;
global TFILTERGEN TMAPPING TDEMAPPING TRX TGARDNER;
TFILTERGEN = 0;
TRX = 1;
TDEMAPPING = 0;
TMAPPING = 0;
TGARDNER = 1;
%general
NSYM = 2^19;
FM = 1e6; %symbol frequency, also defines the cutoff frequency for the rrc filters
FS = 4*FM;
BPS = 1; %Bits per symbol
NBITS = BPS*NSYM; ... |
function pi = getDensityFrom0ToN(pi_0, Q, N)
%getDensityFrom0ToN compute the probability densities from the initial
%distribution to the Nth iteration
% [pi] = getDensityFrom0ToN(pi_0, Q, N) : if pi_0 is a probability
% distribution of size n, Q a transition matrix of size (n x n), N an
% integer greater than 0, ... |
clear;
warning('off', 'all');
addpath([cd '/Datasets']);
addpath([cd '/Ncut']);
addpath([cd '/Evaluations']);
filename = char('jain','R15','D31','Aggregation','flame',...
'Compound','pathbased','spiral','s1',...
'iris','ionosphere','wine','diabetes','segmentation',...
'glass','wdbc','wpbc');
funcname ... |
function PlotTet(T,X)
figure
tetramesh(T,X,'FaceAlpha',0.4)
hold on
N=unique(T); % all nodes
for i=1:length(N)
text(X(N(i),1),X(N(i),2) ,X(N(i),3),num2str(N(i)),'Color','red')
end
end |
function [ newobj ] = getCopy( obj )
%GETCOPY handle子类通用的copy constructor。因为handle是指针类,所以需要
% 若 obj2 = obj1, 二者是同一个内存空间的两个指针(别名),改变obj2,obj1也变
% 若 obj3 = obj1.getCopy,二者是两个内存空间的不同变量,改变obj3,obj1不变
% ------------------
% 程刚;20140726
% 程刚;20140829,使用这个写法: newobj.(fd) = obj.(fd);
% 程刚,20150515,改成通用方法
%%
% newobj = Cla... |
function algoparams = setAlgoparams (S,sigmaEstimateFromRoi,opt)
% function algoparams = setAlgoparams (S,SNRest,opt)
% Description: Creates a standard set of fitting options
%
% Inputs:
% S - the 1-by-m vector of measured signals for each echo time (used
% to calculate initial value for S0)
%
% SNRest - very rough... |
function [ bboxes ] = clip_boxes(img, bboxes)
%
% This function is used to limit bbox size.
%
% sigma1: std for center of gt_box
% sigma2: std for h and w of gt_box
%
% zhaohj, 2017
%
imgsize = size(img);
h = imgsize(1);
w = imgsize(2);
for i = 1:length(bboxes(:,1))
side_1 = mean(bboxes(i,3),bboxes(i,4));
if bbo... |
function [costval,Dcostval] = costfun(Z,N)
costval = Z(end-1); % VR
% costval = Z(end-1) + norm(Z(16*N+1:17*N)) + norm(Z(17*N+1:18*N)); % VR + |CTx| + |CTx|
if nargout>1
Dcostval = [];
end
end |
function [yd, yI] = imagescaleExpand(X)
yd = imresize(X, 3);
oldSize = size(X);
newSize = max(floor(3.*oldSize(1:2)),1);
newX = ((1:newSize(2)) -0.5)./3+0.5;
newY = ((1:newSize(1)) -0.5)./3+0.5;
y2 = double(X);
y = interp2(y2, newX, newY(:));
yI = uint8(y);
end
|
%************************导波光学-作业2-平板波导*********************************
%*********************************by曹晓峰 ********************************
%总体思路:
%1、导模特征方程左右式相减。在导模解附近的左右两侧,两个相减值异号。
% 两数相乘小于零即为异号。循环数值代入法找到较精确的异号点,其横坐标值即为导模的解
%2、为减少工作时长,采取方法是:
% 1、排除相减值较大的点(0.5);
% 2、初步粗略循环判断两个相近(间隔0.01)的点是否异号。
% ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.