text stringlengths 8 6.12M |
|---|
function [check,maxerr,yfit] = cvxfitfeas(U,y,err)
% Checks if a data set can be approximated with a convex function subject
% to a maximum residual constraint.
%
% Notation:
%
% U - matrix of input data points, with rows denoting the different points
% y - outputs corresponding to the inputs (row vector)
% e... |
function p = normcdf(x,m,s)
%NORMCDF Normal Cumulative Density Function.
% P = NORMCDF(X) returns the probability that a standard normal variate will
% be less than X.
%
% P = NORMCDF(X,M,S) returns the probability that a normal variate with
% mean M and standard deviation S will be less than x.
if nargin > 1
if n... |
% Test script for EPTOOLS_EPUPDATE_PARALLEL:
% Construct potential manager with Laplace, Probit and Gaussian
% potentials. We test against GPML code.
%
% See EPT.TEST_EPUPDATE_SINGLE for details.
num_it = 500;
% Create potential manager and cavity marginals. This is done in
% the same way as in EPT.TEST_EPUPDATE_SING... |
function movievalue = importCsv()
%% Import data from text file.
% Script for importing data from the following text file:
%
% X:\My Documents\MATLAB\DataScience\Assignment1\movievalue.csv
%
% To extend the code to different selected data or a different text file,
% generate a ... |
function HPDI=HPDI_nlrm_ncp(results,pdi)
% vypocet intervalu najvyssej posteriornej hustoty na zaklade posteriornych
% vysledkov
% results ... posteriorne vysledky
% pdi ... nastavenie parametru HPDI (pre 95% HPDI, pdi=0.95)
k = length(results.b1);
HPDI=zeros(k,2);
for i = 1:k
HPDI(i,1) = results.b1(i)-tinv(1-(1-... |
function psth = showPSTH(spikeTimes,bounds,sigma)
%function psth = showPSTH(spikeTimes,bounds,sigma)
%
%spikeTimes is a list of spikeTimes (in s)
% if spikeTimes is a cell array, all values inside will be pooled
%
%sigma, if included, is the standard deviation of the gaussian smoothing
% window
sampling = .001;
... |
clc
clear all
close all
%%% Set parameters
RecSig= load('ReceivedSignal.dat');
CA=load('CACode.dat');
t=0:dt:0.001;
figure; plot(RecSig(1:60));
figure; plot(t(1:60),CRshifted(t(1:60),0,0), t(1:60),CRshifted(t(1:60),L/3,0));
figure; plot(t(1:60),CAshifted(t(1:60),0,0), t(1:60),CAshifted(t(1:60),1.5*L,0)... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script iterates through possible combinations of x2 and beta to find
% the optimal operating point that consumes the least total current.
%
% Analog IC Design --- EE 382M-14
% Written by Thomas Plantin
% Tuesday November 27th, 2018
%%%... |
function readWriteTest
import io.*;
[~,~] = mkdir('Test');
[~,~] = mkdir('Test/readWrite');
outfile = sprintf('Test/readWrite/frames_%s.y', datestr(now,'yy-mm-dd(HH;MM)'));
frameDim = [144 176 5];
blk = readFrameBlock('foreman_qcif.y', frameDim, 1);
writeFrames(blk, outfile);
blk = readFrameBlock(outfile, frameDi... |
function [out] = suitcaseCoordinates2(suitcases, stadiums)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
out = zeros(5, length(suitcases(1,:)));
out(1:2,:) = suitcases(1:2,:);
for q = 1:length(suitcases(1,:))
rotationSt = [cos(stadiums(5,q)), -sin(stadiums(5,q)); sin(stadiums(5,... |
function [ wynik ] = cztery( A,b,x0 )
diagonalna=diag(A)
diagonalna1=diag(A,-1)
diagonalna2=diag(A,1)
B = diag(diagonalna,0)+diag(diagonalna1,-1)+diag(diagonalna2,1)
%maxiter=1000;
%dokl = 1e-8;
n=size(A,1)
%resJ(1) = norm(b);
%roznica=999
%xJ = zeros(n,1)
xJ=x0;
jed=eye(n)
k=2
%while ((k < maxiter)... |
%% This function is to modify the read function of the image datastore when required
function output = readImage(filename)
%read image
I = double(imread(filename));
I = I/255;
%resizing the image
I= imresize(I,[200 200]);
output = I;
end |
function ret = myfcn(varargin)
ret = 'function';
if nargin > 0
switch varargin{1}
case myclass.s
ret = myclass.static_function(varargin{2:end});
case myclass.s2
ret = myclass.static2_function(varargin{2:end});
case myclass.hs
... |
function[y] = convert_char(x)
if( x > 0 && x < 27)
y = char(x + toascii('a') - 1);
end
if(x == 0)
y = ' ';
end
if(x == 27)
y = '.';
end
if(x == 28)
y = "'";
end
end |
function [J,grad] = prop(theta, X, y,rate = 0)
m = length(y);
J = 0;
grad = zeros(size(theta));
H = sigmoid(X'*theta);
T = y.*log(H) + (1 - y).*log(1 - H);
J = -1/m*sum(T) + rate/(2*m)*sum(theta(2:end).^2);
for i = 1 : m,
grad = grad + (H(i) - y(i)) * X(:,i);
end
ta = [0;theta(2:end)];
grad = 1/m*gr... |
function median=TwoArrayMid2(X,Y)
% X与Y为两个长度为n,排序好的数组;
% 函数功能:求得这2n个数的中位数;
% 算法导论 9.3-8 P223
% T(n)=O(lgn)
n=length(X);
median=FindMid(X,Y,n,1,n);
if ( isempty(median) )
median=FindMid(Y,X,n,1,n);
end |
%Demo of a two coil Helmholtz setup using the magnetic field function.
%This is simpply two coils placed a radius distance apart, both carrying
%the same current which results in a uniform field in the centre of the
%coils.
%Kilian O'Donoghue
%30th July 2013
clc
clear
close all
%Define global variables
... |
% panel calcs for xi in MixedLogitDemand
function R = computeResults(obj, delta)
[beta, xi] = obj.lpart(delta);
obj.beta = beta;
obj.alpha = obj.beta(strcmp(obj.getPriceName(), obj.vars));
if strcmpi(obj.settings.paneltype, 'fe')
index = obj.... |
function IJ = jitterImage( I, varargin )
% Creates multiple, slightly jittered versions of an image.
%
% Takes an image I, and generates a number of images that are copies of the
% original image with slight translation, rotation and scaling applied. If
% the input image is actually an MxNxK stack of images then applie... |
Duration = 3;
BitDepth = 16;
SamplingFrequency = 22050;
Recording = audiorecorder(SamplingFrequency, BitDepth, 1);
recordblocking(Recording, Duration);
Audio = getaudiodata(Recording, 'single').';
%% NOTE(nox): Frequency reversal
Audio1 = (-1).^[0:length(Audio)-1] .* Audio;
%% NOTE(nox): Interpolation
Interpolatio... |
% m = 2
clc
clf
close all
clearvars
%% Window to angle
M = 16;
m = 2;
N = 2*m*M-1;
L = N+1;
%
% idx = 1;
% for alpha = 100:1:140
% if alpha > 50
% beta = 0.1102*(alpha-8.7);
% elseif alpha >= 21
% beta = 0.5842*(alpha-21)^0.4+0.07886*(alpha-21);
% end
%
% p0 = kaiser(L,beta);
% ... |
clc;
clear all;
load 'D:\cccv_demo\data\experiment_data.mat'
tic
clear test_images
train_traige=[];
wc=zeros(256,256)+255;
bc=zeros(256,256);
c=[];
for i=1:train_itr
ti=[];
for j=1:total_per_itr
if(any(train_idx==(total_per_itr*(i-1)+j))>0)
c=[c total_per_itr*(i-1)+j];
ti=[ti i... |
function [x,y] = Euler(f,a,b,y0,N,varargin)
% euler method
h = (b-a)/N;
x= a:h:b;
y = zeros(1,N+1);
y(1) = y0;
for m=1:N
y(m+1) = y(m) + h* f(x(m),y(m),varargin{:});
end
|
% Script to regroup variables within the SummTable
%
PathOfFilesAndPrefix=readtable('C:\Users\rcardot\Documents\Hydrologie\TOPKAPI_ETHZ\Simulation Results\ComputedQr_Mar2018_v3\PathOfFilesForPCA_v3_WithWeeks.xls');
load(PathOfFilesAndPrefix.PathOfDataSet{1})
if exist('RegroupSummTable','var')
clear Regro... |
% MJLSLPC.M
% For semilog plots
% Called by mjljm
mjlslpv = get(mjluislp,'Value') ;
if mjlslpv == 1 ;
if mjlmexv == 1 ;
set(mjluislp, 'BackGroundColor', 'white') ;
end ;
else ;
set(mjluislp, 'BackgroundColor', [0.501961 0.501961 0.501961]);
end ; |
clear
clc
% This script compares the manipulator dynamics between Python and Matlab
% to see if I've properly implemented them in Python
x = 3.0;
y = 1.0;
theta = 0.0;
theta_1 = 0;
theta_2 = 0;
theta_3 = 0;
x_dot= 0;
y_dot = 0;
theta_dot = 0;
theta_1_dot = 0.0;
theta_2_dot = 0;
theta_3_dot = 0.0;
control_effort = [0... |
%CUIDADO: mirar donde debemos meter la posicion del nuevo vortice
%vortice, que no se si es en iteracion o (iteracion +/- 1)
function [posiciones_estela_global]=actualizador_estela(iteracion,posiciones_estela_global,posiciones_local,x_oo,z_oo,theta_inst,pos_paneles,coord_vor,coord_control,normales,dt,gammas... |
function [avgStruct,counts] = avgFilterWP(allPiData)
% Script to filter the RSSI Scan Files of the waypoints
% Takes input nested struct
% First ouput is the same struct but with avg RSSI values now
% Secount output is the same struct but containing RSSI event counts
global sampleWithAvg
numPis = length(allPi... |
function Hd = baselineWanderHamm
%BASELINEWANDERHAMM Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.3 and DSP System Toolbox 9.5.
% Generated on: 01-Dec-2017 15:20:53
% FIR Window Highpass filter designed using the FIR1 function.
% All frequency values are in Hz.
Fs = 100; ... |
%---- Collect Data -------
train_data=kps(4:131,1:100000);
tic;
[lables, centroid]=k_means(train_data',3);
fprintf('k_means in %.3f s\n', toc) ;
tic;
[lables]=kmeans(train_data',3);
fprintf('kmeans in %.3f s\n', toc) ;
[S,H] = silhouette(train_data', lables);
silA(3)=mean(S);
%Plot the results
clf %clear the figure... |
%
% makedoc.m
%
%
% Copyright 2012 The MathWorks, Inc.
%
opts.evalCode=false;
opts.outputDir='.';
publish('slpcv.m',opts);
|
function [] = plot_C(Fun,string)
%
%
% Copyright (c) Shuhua Li, JJCAO 2013
% Index = abs(C)<0.11;C1=C;C1(Index)=0;
% Id = C'*C;
% Index = abs(Id)<0.11;
% Id1=Id;Id1(Index)=0;
figure('name',string);
n = length(Fun);
for i=1:n
subplot(1,n,i); imshow(Fun{i},[]);colormap(jet);%title(Fun{i,2});
end |
% Zusammenführungsscript
% Neue Geräteprofile in bestehende Haushaltsdateien einfügen
% Speicherort der der neuen Haushaltsdateien mit den neuen Geräteprofilen
path_profils_new = 'D:\Projekte\aDSM\6_Lastprofile_bearbeiten\aDSM_HH_Daten_aufbereitet_4\';
% Speicherort der "alten" Profile, die ugedated werden sollen:
pa... |
function [pilot_mapping,data_mapping] = encoder (data_in,codeRS,template,n_mod_type,encode)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %
%% Name: encoder.m ... |
function wbar = trans(w)
wbar = [0,-w(3),w(2);
w(3),0,-w(1);
-w(2),w(1),0];
end |
function turns = calc_turns(path)
turns = 0;
lim = size(path,1);
for i = 2:lim-1
if isequal(path(i,:)-path(i-1,:),path(i+1,:)-path(i,:))
turns = turns + 1;
end
end
end |
function varargout = correction_tour1_v2(varargin)
% CORRECTION_TOUR1_V2 M-file for correction_tour1_v2.fig
% CORRECTION_TOUR1_V2, by itself, creates a new CORRECTION_TOUR1_V2 or raises the existing
% singleton*.
%
% H = CORRECTION_TOUR1_V2 returns the handle to a new CORRECTION_TOUR1_V2 or the handle to... |
function [] = vlav()
vlad_vocabulary = load('64_VLAD_vocab.mat');
vlad_vocabulary = double(vlad_vocabulary.centers);
vlad_kdtree = vl_kdtreebuild(vlad_vocabulary);
size(vlad_vocabulary)
INPUT_PATH = '../PROCESSED_DATA/';
d = dir(INPUT_PATH);
isub = [d(:).isdir];
main_folds = {d(isub).name}';
main_folds(ismem... |
function [f,c]=hotell2_partition(X,Y)
% http://users.mct.open.ac.uk/paul.garthwaite/HotTwoSamples.html
% The contributions of each variable to Hotelling's T2 statistic. The sum of these contributions equals T2.
%
% F - The contributions of each variable expressed as percentages.
% C - The correlation between each varia... |
function [dist] = point_line_dist(x, y, coeff)
dist = (coeff(2)*x - y + coeff(1))/sqrt(coeff(2)^2 + 1);
end
|
answer=123; % this is where we'll store the user's answer
arduino=serial('COM5','BaudRate',9600); % create serial communication object on port COM5
fopen(arduino); % initiate arduino communication
while answer
fprintf(arduino,'%s',answer); % send answer variable content to arduino
answer=input('ENTER... |
function result = mijcs( x, m)
%MIJCS Return inverse of Jacobi elliptic function CS.
% Result:
% mijcs(x,m) -- real scalar or NaN if either argument is invalid
% or convergenece failed.
%
% Arguments:
% x -- real scalar
% m -- real scalar, parameter (m = k^2)
% Functions cal... |
%@(#) antkan.m 1.3 97/11/05 12:31:23
%
function kkan=antkan(mminj);
nx=length(mminj);
kkan=sum(nx+2-2*mminj);
|
function [X, f] = Espetro(x, Ta, fig, w)
N = length(x);
if w == 0
X = fftshift(fft(x)/N);
else
X = fftshift(fft(x.*blackman(N))) / N;
endif
X = fftshift(fft(x)/N);
fa = 1/Ta;
df = 1 / (N*Ta);
f = [0:(N-1)]'*df - fa/2;
figure(fig);
plot(f, abs(X));
xlabel('Frequency (Hz)');
ylabel(... |
function [IDtot, validity, lengths, widths] = beta_x2_function(nch, pch, beta_coeff, x2)
%----------------------------INITIAL SPECS--------------------------------%
% Technology --> 0.18um
% Temperature --> 25degC
% Power Dissipation --> MINIMIZE
Vdd = 1.8; %Supply voltage
Av = 2; %Cl... |
% WORKS FOR 1D row, 2D 3*3
function [H] = Convolution(image,kernel)
[h,w]=size(image);
[ker_h,ker_w]=size(kernel);
H=zeros(h,w);
H1=zeros(h,w);
for i=1:h
for j=1:w
sum=0;
for k=1:ker_h
for m=1:ker_w
offset_i=-1*floor(ker_h/2)+k... |
%% User-fiendly code based on the following article:
%$£
%$£ M. Oneto, L. Scipioni, M.J. Sarmento, I. Cainero, S. Pelicci, L. Furia, P.G. Pelicci,
%$£ G.I. Dellino, P. Bianchini, M. Faretta, E. Gratton, A. Diaspro and L. Lanzanò
%$£ Nanoscale distribution of nuclear sites analyzed by superresolution STED-I... |
syms k a_k a_kbis serie t
T = 2;
serie = 0;
for k = 1:50
a_k = 1/T*(int(...,0,1) + int(...,1,2));
a_kbis = ... ;
serie = serie + a_k * exp(j*2*pi/T*k*t) + ...
a_kbis * exp(-j*2*pi/T*k*t);
serie = simple(serie); % Note the effect of simplifying
if rem(k,5) == 0;
ezpl... |
function swarm
warning off MATLAB:divideByZero
%%% Script Particle Swarm Optimization
%%% Author: Ivan Candelas del Toro
%%% e-mail: ivanct@gmail.com
%%%%%
% Control variables
%%%%%
global numberOfParticles;
numberOfParticles = 40;
global numberOfNeighbors;
numberOfNeighbors = 4;
maxIterations = 1000;
... |
function [ handles ] = filtering( hObject, eventdata, handles )
default_order=2;
if handles.Edata==0;
handles=read_sac( hObject, eventdata, handles );
end
if handles.Edata==0;return;end
orderStr=get(handles.filterOrder,'String');
if isempty(orderStr)==0
order=str2num(orderStr);
if length(order)==1
d... |
function PPly=PartitionPlySet(th,w_vec)
% PartitionPlySet partitions the set of players of the weighted majority game into
% character Sum, Step, and Null-Player.
%
% Source: J. Rosenmueller, Homogeneous Games: Recursive Structure and Computation,
% Mathematics of Operations Research, Vol. 12, No. 2 (May, 1... |
function [res,InfoFeatures,ActiveFeat,logF] = mc_mlr_as_deep3(xapp,yapp,InfoFeatures,options)
res = {};
loop = 1;
iter = 1;
nbloop = 1; %total number of loops
numEmptyXviol = 1;%number of times a given set of features has not given any interesting feature
counterAdded = 0; % number of features added form a single mi... |
function stan_fig_nervecut_drift()
% REQUIRES plotSpread for beeswarm plot
%
%
%
[options,dirs]=stan_preflight;
load custom_colormaps;
load(fullfile(dirs.agg_dir,dirs.datastore_dir,'ephys_baseline_stats.mat'),'BASELINE_STATS');
load(fullfile(dirs.agg_dir,dirs.datastore_dir,'ephys_nervecut_stats.mat'),'NERVECUT_STATS')... |
y=[1;2;3;5;0.7;1.5];
X=[];
load('NO31.mat', 'feature_data');
X(1,:)=feature_data(4,:);
load('NO32.mat', 'feature_data');
X(2,:)=feature_data(4,:);
load('NO33.mat', 'feature_data');
X(3,:)=feature_data(4,:);
load('NO35.mat', 'feature_data');
X(4,:)=feature_data(4,:);
load('NO307.mat', 'feature_data');
X(5,:)=feature_dat... |
function commander(train_file,test_file)
fid=fopen('result_KL.txt','wt');
ranges=0.01:0.01:5;
for i=1:length(ranges),
[sparse,reconstructError,testAccuracy]=stlExercise(ranges(i),train_file,test_file)
fprintf(fid,'beta:\t%f\t sparse:\t%f\t reconstructError:\t%f\t testAccuracy:\t%f\n',ranges(i),sparse,reconstruc... |
function boxes2d(varargin)
%BOXES2D Description of functions operating on bounding boxes.
%
% A box is represented as a set of limits in each direction:
% BOX = [XMIN XMAX YMIN YMAX].
%
% Boxes are used as result of computation for bounding boxes, and to clip
% shapes.
%
% See also
% boundingBox,... |
function line_no_jump(x, y, marker, thre)
% thre is in percentage of the range of y
hold on;
if nargin < 4
thre = 0.6;
end
y_diff = abs(diff(y));
jumps = [false y_diff > thre*range(y) true];
a = 1;
for i = 1:length(jumps)
if jumps(i)
b = i-1;
plot(x(a:b), y(a:b), marker);
a = i;
e... |
function [ objectIndex ] = getScenario_formation_twoAgentsTwoObstacles(varargin)
% This function generates the two agent, two obstacle example, termed
% scenario A in the formation control/ collision avoidance study.
fprintf('[SCENARIO]\tGetting the two agent, two obstacle formation control example.\n');
%% SCENARIO ... |
function local_ind = get_local_ind(global_ind, ind)
%function local_ind = get_local_ind(grid, global_ind, ind)
%GET_LOCAL_IND Returns a cell array of local indices given an array of
% global indices on the current processor and an array of global indices
% that are being referenced.
% GET_LOCAL_IND(GLOBAL_I... |
classdef NetworkLineData
properties
fromNode
toNode
nominalvoltage
length
resistance0
reactance0
conductance0
susceptance0
impedance
admittance
isDouble
end
methods
function obj = NetworkLineData(f... |
% Amir kabir University of Technology (Tehran Polytechnic)
% Computer & Information Technology Engineering Department
% Resource Allocation in Wireless Networks
% DTPC Simulation using MATLAB
% Programmer: SeyedHedayat Hosseini
% Date: December, 2015
% Matlab Version: R2014b
% ***********************************... |
% ========================================================================
%
% Estiamte AR(1) coefficient by simulation of a MA(1) model
%
% ========================================================================
clear all;
clc;
RandStream.setDefaultStream( RandStream('mt19937ar','seed',123) );
theta = 0.5; ... |
function [Vec1] = NormalizeVecFun(Vec0)
n = size(Vec0, 2);
tmpDist = zeros(1, n);
for i = 1 : 1 : size(Vec0, 1)
tmpDist = tmpDist + Vec0(i, :).^2;
end
tmpDist = sqrt(tmpDist);
Vec1 = Vec0;
for i = 1 : 1 : size(Vec0, 1)
Vec1(i, :) = Vec1(i, :) ./ tmpDist;
end
end
|
## Copyright (C) 2021 Robertson
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is dist... |
function show_detection_in_class(dataset, data, clsName)
clsName_2_sample = containers.Map;
for i = 1:length(dataset.classes)
clsName_2_sample(dataset.classes{i}) = find(strcmp(dataset.video_cls, dataset.classes{i}));
end
v_idx = clsName_2_sample(clsName);
for i = 1:length(v_idx)
display_human_bb_video(dataset,... |
function [ ] = plotPooledScore(record, ps)
% Assess the model's performance over the time course of learning
% it pools neighbouring 100 trials together when measures the performance
%% initialization
global p plots;
p = record.p;
%% compute some summary statistics
correlation = corr(ps.stepsUsed,ps.completeRate);
%... |
clear all;
close all;
clc;
%%%%%%%%%% check controllability and observability
A=[-3/2 1/2;1/2 -3/2];B=[1/2;1/2];C=[1 -1];D=0;
%% we need to check the rank of the observability grammian
G=ss(A,B,C,D); %% convert and store as a state space model
gram(G,'o')
rank(gram(G,'o'))
% for observability, we should have t... |
function result = optimumpoints(x, choice, epsilon)
point_list = [x];
index = 1;
switch choice
case 1
while 1
grad = -grad_func(x(1), x(2));
if norm(grad) <= epsilon || index == 100
break
end
x = x + rootfinder(x(1), x(2), grad(1), grad(2))*gra... |
function a = alphan(v)
a = 0.01 .* (v + 55) ./ (1 - exp(-(v + 55) / 10));
end |
function [] = ManyPieces()
%MANYPIECES Produce a photomosiac from an image and a directory of images
% Given an image and a directory of images create a photomosaic
% Paramets may be modified within m file
% Written by Justin Dailey
% dailejl@auburn.edu
%Mosaic Parameters
%Number of thumbs spanning width of ... |
%THis runs the specrum with a silver core fixed.
%spect(1:5:501,1)./(3*lambda.lambda)*2*pi
function spectrum = scatter_0_generate_spectrum(r)
lambda = linspace(400, 800, 401)';
omega = 2*pi./lambda;
data = load('data.mat');
%eps_silver = interp1(data.omega_silver,data.epsilon_silver,omega);
%eps_gold = interp1(data.o... |
function [cov] = update_cov_dj_k(fdcomm,radar,cov,radar_comm,P_dj_k_old,jj,k)
%% Update UL related covs
Mc = fdcomm.BSTx;% Number of BS TX antennas
J = fdcomm.DL_num; % Number of DL UEs
H_DL = fdcomm.DLchannels;
D_DL = fdcomm.DLsymbols;
P_dJ = fdcomm.DLprecoders; % cell(J,K*N)
n_Bm = radar_comm.n_Bm;
P_dj_k = P_dJ{jj,... |
classdef ConnectomeEvaluate < Gridjob
% ConnectomeEvaluate: class to get plots and statistics
% from post-simulation evaluation
properties
end
methods
%% Subclass Constructor: initialize standard parameters:
function this = ConnectomeEvaluate(varargin)
... |
function run_ccnl_fmri_con(glmodels, subjs)
if ~exist('subjs', 'var')
[subjs,~,~,~] = vgdl_getSubjectsDirsAndRuns();
end
for i = 1:length(glmodels)
glmodel = glmodels(i)
switch (glmodel)
case 3
ccnl_fmri_con(vgdl_expt(), 3, ...
{'theory_change_flag'}, ...
... |
%player1 and player 2 are function handles to players' tactics
%parameter list : Adjacency matrix : LxL (NxMxNxM), Nodelist with types : Lx3, Position-Orientation-Healtpoint 2x Kx3 matrix)
%returns: N1/N2x1 size action-matrix
function [] = simulator(player1,player2)
%platform init
%[G,TR,N,M]=platform_template... |
% Process mutation data from a MAF into a table
function mutationTable = processMAF(MAFfile)
% get the CCLE ids and the genes in the table
caseIDs = unique(MAFfile.Tumor_Sample_Barcode) ;
allGenes = unique(MAFfile.Hugo_Symbol)' ;
for ii = 1:length(caseIDs)
% get all the mutated genes for that sample id
curMut... |
function [] = LoopNhAndL(hidden1, hidden2, alpha, Trainfile, Testfile)
nhidden1 = length(hidden1)
nhidden2 = length(hidden2)
nalpha = length(alpha)
for i = 1:nhidden1 % loop over all combinations of number of hidden units and alpha values
for k = 1:nhidden2
for j = 1:nalpha
% disp(hidden(i))
... |
function [a_r a_p a_f avg_matrix]=EVALUATION(predicted, actual)
% [a_r a_p a_f]=EVALUATION(predicted, actual)
% Function that computes the average recall, precision and F measures of the cross validation process.
% INPUT : predicted - matrix containing all predicted classifications of cross validation process.... |
clear;clc;
A=[0 1;-1 9];
B=[0;1];
Q=[1 0;0 1];
R=1;
[K_optimal,P]=lqr(A,B,Q,R);
A_=A-B*K_optimal;
num=8;theta=0; %total of the different kind of initial condition
datasize=10000;
for j=1:num
theta=j*(2*pi/num);
x1array(1)=real(datasize*exp(1i*theta));
x2array(1)=imag(datasize*exp(1i*theta));
for ... |
function [IND_mask]=maskfind(M,IND,MASK_I,MASK_J,MASK_K)
% function [IND_mask]=maskfind(M,IND,I,J,K)
% ------------------------------------------------------------------------
% This function finds the indices of the elements found inside the mask
% defined by MASK_I, MASK_J and MASK_K. The matrix IND_mask is num... |
classdef DenoisingTypes
%DENOISINGTYPES enumeration of the methods for denoising the
%high-pass residual band of the wavelet transform
% --------------------------------------------------------------------------
%
% Part of the Generalized Riesz-wavelet toolbox
%
% Author: Nicolas Chenouard. Ecole Polytechnique Federal... |
clc;
clear;
load('PPGdata/APdata7.mat');
% n is the index of chunk from 1 to 10.
n = 4;
% Extracts the nth chunk into sample data.
sampleData = dataraw(1,12000*(n-1)+1:12000*(n));
Fs= 200; % Sample frequency
t = linspace(0,60,12000); % Convert sample count into second
t2 = 1:12000; % Sample count
lowpassSampleData ... |
% UNDER CONSTRUCTION
%
% object=Curve2D(model,param,domain)
% Model function is evalutated in the specified domain (xmin/xmax and
% ymin/ymax)
%
% This class describes curves as a sequence of line segments between points
% on a two-dimensional plane. These points are specified in a two-column
% table ([x y]). Each ... |
function z=capacity_plot_main(output)
% use capacity_plot_main('out') to run get outage capacity
% use capacity_plot_main('erg') to run ergodic capacity
% Dependencies
% Intstall CVX from cvxr.com/cvx/download/
% use cvx_setup to run the Convex optimization based AS
%varies SNR through 20 dB
SNR=0:1:20;%SNR is sign... |
function [ index ] = find_index( level, tileNum, nRegions )
%% FIND_INDEX finds continuous index
% This function finds the continuous index given the level and
% tile as inputs
%
% index is "continuous" in the sense that it takes all integer values from
% 1 to totalRegions
%
% Input: level, tileNum, nRegions
%
... |
function [ translated ] = Brown_Conrady( a, imPoints )
%BROWN_CONRADY Apply transformation 2nd order in r (only even powers)
% a = [xp yp T1 T2 R1 R2]
% Define x and y and r
x = imPoints(:,1); % Nx1
y = imPoints(:,2); % Nx1
r = (x-a(1)).^2 + (y-a(2)).^2; % Nx1
% Calculate radial distortion
a(3) = a(3)/1e9;
a(4) =... |
function [ res ] = peakTransform(val,targ )
%Scales val to 1.0 at targ and to 0 at both 1 and 0.
% val and targ are in range [0,1]
if targ==1.0
res=val;
return
end
if targ==0.0
res=1.0-val;
return
end
if val<targ
res=val*(1.0/targ);
elseif val>targ
res=(1.0-val)*(1.0/(1.0-targ));
else
res... |
%% My Music Player using Matlab
% You can Listen to your favorite music while working with your matlab. It doen't require any music player pre-installed.
% You all need to add your favorite tracks to this folder. Run the program to select your fovorite song.
% If you want :
% to pause use pause(p)
% to resume -- resum... |
function [A] = indexer(a)
A = zeros(size(a));
u = unique(a);
for i = 1:size(u)
A(a == u(i)) = i;
end
end |
%--------------------------------------------------------------------------
% Function aiming at identifying the shift in between the universal
% pattern's output and the actual spectrum.
%
% Principle: the function selects a range around each theoretical l=0 modes
% and interpolates each chunk on a regular grid to the... |
function yd=ord1(t,y)
global kp tp u;
yd=(-y+kp*u)/tp; |
% MGLGVCC.M
% Slider control for coarse control ...
% of gradient refocussing
% Called by MGLGM
mglgvcv = get(mgluigvc,'Value') ;
mglgvfv = get(mgluigvf,'Value') ;
mglgvcw = mglgvcv + mglgvfv;
mglgvcvs = num2str(mglgvcv,4);
set(mgluigtxt,'String',mglgvcvs);
set(mgluigvf, 'Value', 0) ;
% *** See if "continuous plott... |
%% modify param
param.net_def_dir = 'model/ResNet_3b_s16_fm2fm_pool2_deep';
param.gpu_id = 0;
param.init_model = fullfile(pwd, 'output/ResNet_3b_s16_fm2fm_pool2_deep/65w');
%% init caffe solver
caffe.reset_all;
caffe_solver = caffe.get_solver(fullfile(param.net_def_dir, param.solverfile), param.gpu_id);
if ~isempty(pa... |
clear
close all
clc
%% Code for plano-convex lens
n = 1.46; %Index of refraction of lens
radius = 20; %Radius of spherical surface
thickness = 5; %Central thickness of lens
dz = 0.01; %Step size for computation purposes
aperture = 8;
number_rays = 30;
dy = (2*aperture + 1)/num... |
function start = backward_flow_projection(y,sink, index, theta)
% function start = backward_flow_projection(y,sink, index, theta)
%
% letting the flow starting at start and flowing linearly to sink
% intersect the hyperplane defined by x(index) = theta
% INPUT
% y element of R^N+
% sink sink of the... |
%%
clc;
clear;
close all;
disp('@author: Dr Clement Etienam')
%%
oldfolder=cd;
cd(oldfolder);
Resultss = 'Results_Sequential';
mkdir(Resultss);
addpath('Miscellaneous');
addpath('LSTM_machine');
disp('SELECT OPTION FOR OPTMSATION')
disp('1:LBFGS')
disp('2:I-ES')
%disp('3 :ES-MDA')
clement=input('Enter t... |
%
% Funcion que calcula la integral usando la regla trapezoidal
%
function res = trapezoidal(fun, a, b, n_pts, flag_periodic)
% Si el problema es periodico, quitamos el ultimo punto
if flag_periodic == 1
x_i = linspace(a, b, n_pts+1);
x_i = x_i(1:end-1);
% Evaluar la funcion en los n... |
function []=analysis()
data=xlsread('output');
y1=data(:,4); %计算的数据
y2=data(:,6); %给的标准数据
deltay=y2-y1; %计算差值
volume=max(size(y1));
y1(volume)=[];y2(volume)=[];deltay(volume)=[];
%读入文件
fileID = fopen('C:\Users\dushenda\Desktop\new.txt');
C = textscan(fileID,'%f %1s %f ... |
function s1_low = F_conv_interp(w1,s1,fwhm,common_grid)
% This function convolves s1 with a Gaussian fwhm, resample it to
% common_grid
% Made by Kang Sun on 2016/08/02
slit = fwhm/1.66511;% half width at 1e
dw0 = median(diff(w1));
ndx = ceil(slit*2.7/dw0);
xx = (0:ndx*2)*dw0-ndx*dw0;
kernel = exp(-(xx/slit).^2);
ke... |
function MQ = computeQuantMatrixFlow(M, bins)
% Compute the quantization matrix based on the 3-dimensional matrix imgLAB.
%
% k = cumprod(bins)
%
% Input
% M - input image, h x w x nC
% bins - #bin, 1 x nBin
%
% Output
% MQ - quantized image, h x w
% the range of each pixel values is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.