text stringlengths 8 6.12M |
|---|
function cc = clustCo_loc(G, i)
n = neighbors(G, i);
if isempty(n)
cc = 0;
return
end
c = 0;
for i = 1:length(n)
nn = neighbors(G, n(i));
for j = 1:length(nn)
if any(n(i+1:end) == nn(j))
c = c + 1;
end
end
end
c... |
function [poz]=movesc3(poz,vs,mpart,tabs,deltat,deltatbrown)
%
% functia schimba pozitiile centrilor de imprastiere considerand vitezele
% medii vs calculate dupa legea lui Stokes
% versiunea 3 considera miscarea browniana dar nu cu pasul de timp deltat ci in pasi de deltatbrown.
% var. de intrare: poz=matrice(nsc... |
function sharp_turn_mask = FindSharpTurns(track, fps)
% Output is relative to velocity vector origins.
% So, if there are N steps, the output length will be N-1 steps, with the
% first value always being zero (as the turn state is undefined for the
% first velocity vector).
% Points at which a sharp turn are detected w... |
% This function runs the VocalTract ROI Toolbox. This is the only function you
% need to explicitly call in the MATLAB command line.
function vttoolbox()
close all force;
clear;
warning on backtrace;
warning on all;
warning on verbose;
s = warning('error', 'MATLAB:callback:error');
warning('error', 'MATLAB:c... |
points=[0 1 1 0 -1 -1 0 0; 0 0 1 2 1 0 -1 0];
pp=cscvn(points);
fnplt(pp);
hold on
plot(points(1,:),points(2,:),'o')
hold off |
%NANANANA
x1=-10:.1:-5;
y1=2+sin(x1);
x2=-5:.1:2;
y2=exp(x2);
x3=2:.1:10;
y3=log(x3.^2+1);
plot(x1,y1,x2,y2,x3,y3)
title('Problema 2')
|
%create a fast ring from ESRF lattice
ring=atradoff(atsetcavity(esrf(),8e6,1,992));
%Now generate fast ring and add impedance element
[fastring,fastringrad]=atfastring(ring);
%generate a Broad Band Resonator Impedance
impedance_elem = makeBBR(findspos(ring, length(ring)+1) , 0.005);
%add to fast ring
fastringBBR=[fa... |
function [Cv] = MvToCv(nu, mvs, coeffs, mus)
% Author: John Tobiasson
% Date: 07/28/2016
% Purpose: This function will take in a wavenumber (cm^-1) and an Mv and
% convert the Mv to a Cv, with the intent of then converting the Mv to an
% intensity with units of W/m^2/sr/um. This is done rather than converting
... |
function output = readFromGeom_PoseStamped(obj,father)
try
bag=rosbag(father.fileName+".bag");
bsel=select(bag,"topic",obj.topicName);
msg=readMessages(bsel,'DataFormat','struct');
obj.t=timeseries(bsel).Time;
obj.t=obj.t.';
if father.t0==0
father.t0=obj.t... |
function p56=p56(h)
sldata;
limitpoints;
slopes;
T56=270.5;
p2=p1*(T2/T1)^(-g/(m12*R));
p3=p2*exp(-g*(h3-h2)/(R*T2));
p4=p3*(T4/T3)^(-g/(m34*R));
p5=p4*(T5/T4)^(-g/(m45*R));
p56=p5*exp(-g*(h-h5)/(R*T5)); |
solve=feat_implicit(20,0.5,256);
function y = u0(x)
y=sin(pi*x);
end
function y = feat_implicit(N,T,M)
h=1/N;
tau=T/M;
mu=tau/(2*h^2);
U=zeros(N+1,M+1);
A=zeros(N-1,N-1);
F=zeros(N-1,1);
for m=1:N+1
U(m,1)=u0((m-1)*h);
end
for m=1:N-1
if (m==1)
A(m,m)=1+2*mu;
A(m,m+... |
function ode = modelODEP2XInact2(ton,toff)
global k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 k13 k14 k15 k16 k17 k18 k19 k20 k21 k22 k23 k24 L11 L12 L13 L14 L21 L22 L23 L24 L31 L32 L33 L34 L41 L42 L43 L44 L51 L52 L53 L54 L61 L62 L63 L64 W2 H0 H5 kd1 kd2 kd3 kd4 ks1 ks2 ks3 ks4 H3 H3D H4 g1 g2 E1 E2 delta epsilon mu A A V A... |
%将二月份的都花在同一张图上!!???
%figure(1);
%time=1:1440;
%for i=1:28
% plot(time,Febob(1+1440*(i-1):1440*i)');
% hold on;
%end
%grid on;
%好像这么多条曲线没什么区别!!!
figure(2)
time=1:1440;
for i=1:28
plot(time,Febpercent(1+1440*(i-1):1440*i));
hold on;
end
grid on;
title('2月份时间和成功率关系图');
xlabel('时间轴(单位:分钟)');
ylabel('成功率(百分之)'... |
%
clear all
%Genere lance de
lance1 = floor(rand()*6+1);
lance2 = randi(6);
%Variable de Bernoulli
nGenere = 10000;
p = 0.2;
bernoulliG = mybernoulli(p, nGenere);
esperanceBer = mean(bernoulliG);
varianceBer = var(bernoulliG);
%Variable binomiale
n = 10;
binomiale = zeros(1, nGenere);
for i = 1:nGenere
binomiale(... |
function Adj = create_ADJ(data_markers,marker_conns)
Adj=zeros(size(marker_conns,1),size(marker_conns,1));
for i=1:size(marker_conns,1)
for j=1:size(marker_conns,1)
if strcmp(marker_conns(i,1),data_markers(j))
indr=j;
break;
end
end
for j=1:size(marker_conn... |
%@(#) getdisfil.m 1.3 99/11/22 15:35:43
%
%function getdisfil
function getdisfil
[fil,pathname]=uigetfile('*.dat');
if isstr(fil)
file=[pathname fil];
h=get(gcf,'userdata');
set(h(1),'string',file);
opfile;
end
|
%Predictive Analysis on COVID-19 outbreak in Sri Lanka%
%%%%%%%%%System of Non-Linear ODEs%%%%%%%%%
%Author : Ranitha Mataraarachchi [ranitha@ieee.org | github.com/ran1tha]
%Date : 25.03.2020
%%
function ydot = sys(t,y,theta)
%Parameters
c = theta(1);
beta = theta(2);
q = theta(3);
m = theta(4);
b = theta(5);
... |
function [start_face,end_face] = flowing(Sections,Theta,V)
% function [start_face,end_face] = flowing(Sections,Theta,V)
%
% INPUT
% Sections vector with list of visited sections
% Theta threshold
% V sinks
% OUTPUT
% start_face random point on the initial face that got until the end of
% th... |
function dcm = quaternion2dcm(q_BI)
%#codegen
dcm = zeros(3);
dcm(1,1) = q_BI(1)^2 + q_BI(2)^2 - q_BI(3)^2 - q_BI(4)^2;
dcm(1,2) = 2 * (q_BI(2) * q_BI(3) + q_BI(1) * q_BI(4));
dcm(1,3) = 2 * (q_BI(2) * q_BI(4) - q_BI(1) * q_BI(3));
dcm(2,1) = 2 * (q_BI(2) * q_BI(3) - q_BI(1) * q_BI(4));
dcm(2,2) = q_BI(1)^2 - q_BI(2)... |
function [J, grad] = Function_Cost_Perceptron(W1,Z1, x, y)
% [J, grad] = FUNCTION_COST_PERCEPTRON(W1,Z1, x, y) calculates the cost
% and the updated parameters
%
% W1: The parameters
% Z1: The output of the perceptron, the activation function of the
% weigthed sum
% x : In... |
%本文件ancheng完成了两个功能:
%(1)用SMOTE算法将轨迹的长度设置为最长轨迹数目个数
%(2)用MAX-MIN将数据归一化处理
file=dir('./weather_info/');
numfile=length(file);
path2='./weather_info/new2004IVAN.dat';
[b1,b2,b3,b4]=textread(path2,'%f%f%d%d','delimiter',',');
B=[b1,b2,b3,b4];
label2=ones(size(B,1),1);
E=[];
for k=3:numfile
filename=file(k).name;
... |
function u = solvep(K, B, BC)
n = size(K,1)
Ks = K
bc_N = BC(:,1)
bc_u = BC(:,2)
uf = zeros(n,1)
uf(bc_N) = bc_u
B_s = B - K*uf
used = 1:n
used(bc_N) = []
B_s = B_s(used,:)
Ks = K(used,used)
u_s = Ks\B_s
u = zeros(n,1)
u(used) = u_s
u(bc_N) = bc_u |
function s = dimsum(X, dims)
% Sums X along multiple dimensions.
%
% Arguments:
% X - array to sum.
% dims - dims to sum along.
%
% Returns:
% A ndims(X)-length(dims) array with every entry corresponding to the
% summation over all dimensions in dims.
%
% Examples:
% >> X = cat(3, 2*ones(4,2),4*ones(4,2));
% >> d... |
function h=irf_pl_ebsp(cl_id,xyzGSE,varargin)
%IRF_PL_EBSP Plot E wavelet spectra, B wavelet spectra, Poynting flux,
% E/B, ellipticity, polarization, wave vector direction
%
% h=irf_pl_ebsp(e,b,pos,arguments)
% modified from irf_pl_ebs
%
% Plots parameters calculated with irf_ebsp routine
%
% Examples:
% h=irf_pl_... |
<<<<<<< HEAD
function create_stimulus_file
% Generate stimulus files for SNT experiment
% YBS 3/2017
%%%%%%%%%%%%%%%%%
N_blocks = 3; % Number of blocks to calculate
% EXP_TYPE = 'exp_1'; %
EXP_TYPE = 'exp_2'; %
% Define the stimuli in each experiment - In each block (of the N_blocks)
% we will have each stimulus o... |
%% clean up
clear
clc
close all
%% setup
addpath('ABRdata')
load('abr_signal3.mat');
fs = 100*1000; % [Hz]
low_cut_fq = 0.3*1000; % [Hz]
high_cut_fq = 3*1000; % [Hz]
filter_order = 25;
amplitudeThreshold = 1;
%% main task
% indices of waves with higher intensity
higherIntensityWaves = [0, 0, 0];
figu... |
function MX = KITLLER_Algorithm( img )
I = unique(img);
N = frequence(img, I);
seuil = 0;
erreur = Inf;
for i = 2 : size(I, 1)
%classe 1
u1 = moyenne(I, N, 1, i-1);
v1 = variance(I, N, 1, i-1, u1);
p1 = prob(img, I, 1, i-1);
%classe 2
u2 = moyenne(I... |
clear all; clf;
lambda_DG = 0.4;
%lambda_DG = 0;
%lambda_DG = 0.242;
lambda_LF = 0.21;
%lambda_LF = 0;
%lambda_LF = 0.532;
%gamma_dg = 0;
gamma_dg = -1.28;
%%%%%%%%%%%%%%
% LIF values %
%%%%%%%%%%%%%%
gamma=-60.25;
%gamma=-61.1;
E0=gamma; % DC current
%tau_m=5; % membrane time constant
tau_m=17; % membrane time const... |
% testSimFunctions.m
%
% Description:
% Tests the simulator functions in a controlled environment
% Essentially runs one loop of the main program and displays the result.
%
clear;
% for initial testing, use same random numbers
s = RandStream('mt19937ar','Seed',1);
RandStream.setGlobalStream(s);
%
SF=S... |
% function sol = fn_SS_ode(t,X,Xm,WaveParam,FloeParam,Coeff,Mooring,Trans)
%
% LJ YIEW
% Created on Jul 2013
% Last edited Oct 2016
%
% Sets up the ODEs for the Rumer/Marchenko model (Grotmaack & Meylan, 2006)
%
% INPUTS:
% t = time
% X = displacement
% Xm = equilibrium position of mooring
% Wav... |
function [Iext, Gs, Gg, Gc, C, B, arr, ad, Ec, Ej, vth] = get_params()
global Iext1 Gs1 Gg1 Gc1 C1 B1 arr1 ad1 Ec1 Ej1 vth1
Iext = Iext1;
Gs = Gs1;
Gg = Gg1;
Gc = Gc1;
C = C1;
B = B1;
arr = arr1;
ad = ad1;
Ec = Ec1;
Ej = Ej1;
vth = vth1;
end |
%%in barnamei baraye BUTTERWORTH NOTCH REJECT FILTER ast,BARAYE
%EJRAYE BARNAME HAME BARNAME RA ENTEKHAB KARDE(Ctrl+A & Ctrl+C)VA DAR Command
%Window MATLAB PASTE KONID.
clc;
clear all;
close all;
IMG_In=imread('1.jpg');
FFT = fft2(double(IMG_In));
FFT1=fftshift(FFT);
[M N]=size(FFT);
figure;
imshow(log(1+abs(FFT1)),[... |
clc; clear all;close all;
clc;clear; close all;
clc;clear;close all;
addpath L1_tools
load Features_MNIST_New;
% load MNISTfull.mat
% Xfull = [F(1:1000,:);S(1:500,:);N(1:500,:)];
Y = [ones(1000,1);ones(1000,1)*2];
clear F S N
N=0.1;
IND1=sort(randperm(sum(Y==1),round(N*sum(Y==1))));
IND2=sort(randperm(su... |
if (strcmp(data.problem, 'Least_sqr') == 1) || (strcmp(data.problem, 'Reg') == 1)
%% Non-convex Regression
Data_generation;
GR = 2*(dot(z, x)-y)*x'+ data.lambda*p*z.*(z.^2+ep^2*ones(d,1)).^(p/2-1);
elseif (strcmp(data.problem, 'SVM') == 1)
%% Non-convex SVM PROBLEM
Data_generation;
GR... |
%Se obtiene la matriz de costos
C = CalcularCostos();
% El vector de demanda D
% Santafe - Andino - Unicentro - Salitre PLaza - Centro Mayor
D = [1040,814,1269,620,943];
%El vector de oferta
B = [2500,900,1700];
Capacidad_Almacenamiento = 100; %La capacidad de cada almacen
fprintf('Excedente: %d \n', sum(B) - sum(D)... |
function [ result ] = canny( varargin )
%CANNY Our own canny implementation
%
% Nutzung:
% canny(image);
% canny(image, [threshLow, threshHigh]);
% canny(image, [threshLow, threshHigh], sigma);
%
% Die folgenden Ressourcen wurden bei der Implementierung als Hilfes... |
clear; clc; close all;
%% Carregando os dados e separando um conjunto para validacao
data=readtable('dados_tarefa5.txt', 'ReadVariableNames', false);
data.Properties.VariableNames = {'t', 'u', 'y'};
t = data.t;
u = data.u - mean(data.u);
y = data.y - mean(data.y);
% Dados de identificacao
t_id = t(1:3000);
u_id = u(1... |
function [ corners3d ] = getCorners( quadPts )
% This function gets the corners of a quad given a list of points. It finds
% the point which is further away from the centroid, and then removes all
% the points which are closer to that corner than to the centroid. Then it
% repeats this three more times.
corners3d = ze... |
function dy = dtwocycles(varargin)
%D2CYCLES Toy model for sleep-wake cycles
%% Parse input
% Default values taken from the paper mentioned above
default = genPars('twocycles');
% Flexible parsing
p = inputParser;
p.addParameter('a', default.a);
p.addParameter('b', default.b);
p.addParameter('c', default.c);
p.addPar... |
sumTiming = zeros(visualData.imagesLoaded, 1,'single');
for It = 1 : visualData.imagesLoaded
sumTiming(It, 1) = timer.featuresDetection(It, 1) + timer.featuresDescription(It, 1) + timer.trackingPoints(It, 1) + timer.guidedFeatureSelection(It, 1) + timer.databaseSearch(It, 1) + ...
timer.binomialScori... |
function [F21Ord1, eetaTG] = vm_mult_bp(F,J,Hor,eeta,U,T,n,p,GDPRATIO)
%---------------------------
%Compute spending multiplier
%---------------------------
gres = U(:,2);
macrores = U(:, 3:end);
gshock = gres - macrores*eeta(:,2);
L0gSig1 = (gshock'*gshock)\(gshock'*U);
S1S1 = (gshock'*gshock)/(T-n*p-1);
SS1 = ch... |
%FILLTMPRESULTS -- re-save old version of *_tmp_* results in *_results_* format
%
% fillTmpResults(exp_id, exppath_short)
%
% Traverses through directory [exppath_short '/' exp_id'], loads each file
% ${EXP_ID}_tmp_[0-9]+\.mat
% and saves into
% ${EXP_ID}_tmp_${FUN}_${DIM}D_[0-9]+\.mat
% also the bbParams, surroga... |
function layer = fullyConnectedLayer( varargin )
% fullyConnectedLayer Fully connected layer
%
% layer = fullyConnectedLayer(outputSize) creates a fully connected
% layer. outputSize specifies the size of the output for the layer. A
% fully connected layer will multiply the input by a matrix and then add
% a ... |
function[x] = PruebaGCP(G, b, c)
m = length(b);
n = length(G);
A = G(1:m,:);
b = ones(m,1);
K = [G A'; A zeros(m,m)];
[L,D,P,S,neg,ran] = ldl(K);
sol = P' * S * [-c; b];
sol = L \ sol;
sol = D \ sol;
sol = L' \ sol;
sol = S*P*sol;
x = sol(1:n,:);
end |
cp.NP = 100;
cp.D = 1000;
cp.xmin = -100;
cp.xmax = 100;
cp.gen_max = 1000;
cp.max_fes = 3000000;
cp.fl = 0.5;
cp.fs = 0.15;
cp.cr = 0.9;
cp.B = 1.5;
cp.fbias = -450;
cp.HMCR = 0.9;
cp.PAR = 0.3;
cp.bw = 0.01 * 200;
restoredefaultpath
path(path,'../cec2010');
path(path,'../cec2010/datafiles');
fh = fopen('results2010.... |
%% The task of the program is to interact with the user: ask for the time
%% point when catartrophy happens and for the exact position of the bundle
%% tip at that moment.
%% Then the function tracking the position of MT tip in 3D is called, results are saved
clear;
close all;
%---------------------------------... |
% Exercise 2
% Histogram Equalization
clc; clear; close all;
% Input image pixel values.
A = [52 55 61 59 79 61 76 61;
62 59 55 104 94 85 59 71;
63 65 66 113 144 104 63 72;
64 70 70 126 154 109 71 69;
67 73 68 106 122 88 68 68;
68 79 60 70 77 66 58 75;
69 85 64 58 55 61 65 83;
7... |
function resultImg = reconstructImg(indexes, red, green, blue, targetImg)
%% Enter Your Code Here
[colInd,rowInd]=find(indexes'>0);%find col and row indexes of interest pixels in indexes
numPixel=size(rowInd ,1);%find number of interest pixels
for i=1:numPixel%pasting calcualated pixel colors back into target imag... |
function [greenPos redPos greenStartZ] = pixelCountPerZ(greenSegStack, redSegStack, numROIZ)
greenStart = 0;
greenPos = zeros(numROIZ,1);
redPos = zeros(numROIZ,1);
for thisROIZ = 1:numROIZ
greenThisZLinear = reshape(greenSegStack(:,:,thisROIZ), [], 1);
greenPos(thisROIZ) = sum(greenThisZLinear);
if greenS... |
clc; clear all; close all;
jpg_pattern = '.jpg';
i=0;
webcamlist
cam = webcam(1);
while true
i=i+1
k = snapshot(cam);
%k=imread('2017.04.29(17-42-51).jpg');
[rozmiar_y,rozmiar_x,kolor] = size(k);
x=rozmiar_x/2%;%%wsp x analizowanego punktu max 3120 srodek x=1560
... |
function output = main_process_tf(network_name, module_name, revigo_name, temp_file, revigo_cutoff, species)
poolobj = parpool(30);
%% Import network
network = import_tfs_network(network_name);
%% Import modules
modulesgotermfinder = import_modules(module_name);
%% Keep significant GO Terms
significant_go_terms = impo... |
function [classified]=naive_bayes_classifier(S_hat, m_hat, array)
% Calculate the pdf for each element and for each class, sum the results
% and pick the index of the max value (where the index refers to the class
% to pick)
perFeature=[];
naive_probs=[];
for i=1:5
for j=1:204
perFeature(i,j,:)=normpdf(arr... |
% ALGORITHM
%
% - do a first coarse segmentation dividing into sets of raw data events
% that are separated by 1 minute of 'no raw data events'
%
% - take each of these 'super-occupancy-events' and perform a merge of the
% 'door open - close - open / close - open - close' tripletes that are
% 'too fast', ... |
% Time Lapse code
d_per_pix = 1/12;
%% %experiemnt 1
T_sec = TL1_data(:,1).*(60*60) + TL1_data(:,1).*(60) + TL1_data(:,2) ;
T_hour = T_sec./(60*60);
pix_offset = 3;
pix_disp = TL1_data(:,4) - pix_offset;
d = pix_disp.*d_per_pix;
x_error = 0.5/(60*60);
y_error = 0.5*d_per_pix*1000;
x = T_hour;
y = d.*1000;
%... |
clc; clear all; close all;
x=input('Enter output, for 1x enter, [1 0], i:');
y=input('Enter input, for 2x+5 enter, [2 5], j:');
G=tf(i,j);
subplot(2,1,1)
pzmap(G) %pole-zero plot
subplot(2,1,2)
%time response
step(G) %linearSystemAnalyzer('step',G)
stepinfo(G)
|
function [Qtil, Htil,counter]= mergeIEP(Q1,Q2,H1,H2,w1,w2)
% Merges two solutions to a Hessenberg IEP to form solution to a larger Hess IEP
% INPUT:
% Q1,Q2 = unitary matrix of solution of some Hess IEP
% H1,H2 = Hessenberg matrix of solution of some Hess IEP
% w1,w2 = weigths of the Hess IEPs, these ... |
function histdis = plotter(num,x)
diseases = num(:,4)
if x==1
hist(diseases)
elseif x==2
bar(diseases)
elseif x==3
pie(diseases)
end
xlabel('Number of Diseases')
ylabel('Number of People')
title('Amount of Diseases Caught') |
function plotBbox( bbox, col,facealpha,ecol )
% plots a semi transparent bbox
% INPUT
% bbox 3x2 or 2x3 matrix describing start end end points of bbox
% col string or 1x3 vector to apply a color on the bbox patch. default is
% red
if ~exist('col','var') || isempty(col)
col = [1 0 0];
end
if ~exist('ecol',... |
% Övning 3-5 samt övning Simpel Models 1-4
%% Övning 3-5
% Övning 3
% Lös dy/dt = -y + u numeriskt med Euler framåt i tidsintervallet [0,20],
% där u = sin(t) och y(0) = 0. Bestäm förstärkning och fasförskjutning.
clear all;
h = 0.01; %tidssteg
t = 0:h:20; %t... |
%% PROBLEM 1
close all
Fs = 1000;
L = 256;
Lfft = L;
evenL = L-mod(L,2);
% part 1 a
t = (0:L-1)*1/Fs;
% part 1 b
x = sin(2*pi*100*t);
subplot(3,2,[1,2]);
plot(t,x);
xlabel("Time (s)");
title("Signal in Time Domain");
xlim([min(t),max(t)]);
ylim([min(x),max(x)]);
% part 1 c
P2 = fftshift(abs(fft(x, Lfft))/L);
... |
function Xhat = worldcords (x1,x2,P1,P2,homogeneous)
%this function finds world coordinates using triagulation as described
%Reference : Andrew Zisserman's Multiple View Geometry pg312
%Xhat is homogenous too
Xhat = ones(4,size(x1,2));
for i = 1 : size(x1,2)
if homogeneous
A =[x1(1,i)*P1(3,:) - P1(1,:);
... |
clear;clc;
num=8;
for j=1:num
theta=j*(2*pi/num);
x1array(1)=real(1*exp(1i*theta));
x2array(1)=imag(1*exp(1i*theta));
for i=1:10000
x(1)=x1array(i); x(2)=x2array(i);
u=((4*x(1)*x(1)+x(2)*x(2)-4)-1);
x1dot=x(2)-(4*x(1)*x(1)+x(2)*x(2)-4)*x(1)+u*x(1);
x2dot=-x(1)-(4*x(1)*x... |
function [A] = pa(B)
A = (1/2) * (B - B'); |
function [cct, ta1, ta2] = srcint(la, k2, ct4, pp1, pp2, ctc0, nprimtilt, lmax, K, stfname, logstep)
% srcpint.m integrates the source including polarisation over conformal time using the approach of Seljak :
% integration over the photon past light cone, see M Zaldarriaga et al., ApJ nr 494, 491 (1998)
% the func... |
function [x,omeganew,domeganew]=ProjMapping(xi,domain);
% computes x=argmin [\langle \xi,x\rangle + \omega(x)]
% and omeganew=\omega(x), domeganew=\omega'(x)
domeganew=xi.*domain.axes;
if (domain.type(1)=='e')|(domain.type(1)=='b')
if domain.type(1)=='e',
if domain.type(2)=='p',
domeganew... |
%% RUN STATISTICS: EVALUATES THE SYSTEM OUTPUT ERRORS WHILE VARYING THE ERROR PROBABILITY
mean_e1_array = [];
mean_e2_array = [];
mean_e3_array = [];
pe_vector = [];
for pe = 0:0.04:0.8
error_probability = pe;
%% CALLING FRAMEWORKS
main_PSO;
main_FT;
%% COMPARISONS
... |
function Setup_CT()
if exist('integral')
disp('* mex function integral already exists...');
else
disp('* buiding mex function integral ...');
mex('-O', 'integral.cpp');
end
if exist('FtrVal')
disp('* mex function FtrVal already exists...');
else
disp('* buiding mex function FtrVal ...');
mex('-O', 'FtrVa... |
function [ w_matrix, b_matrix, error] = neural_network(num_neuron_layers, training_data, test_data, epochs, eta)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
num_layers = length(num_neuron_layers);
error = zeros(epochs, 1); %for storing average error for every epoch.
%i... |
close all;
clear;
clc;
load message;
% Add Cover
datacover = {};
for run=1:200
path = strcat('CoverRGB/',int2str(run),'.jpg');
I = imread(path);
% % add noise (incidental attack)
% I = imnoise(I,'salt & pepper', 0.01);
% scaling (intentional attack)
I = imresize(I, 0.5);
datacover(ru... |
classdef expBarsDS < expStim
properties
NumReps
StimInfo
end
properties (Hidden = true)
scaleBarFraction = 6;
defaultIndex = 1; % 1st column is stim direction
end
methods
function obj = expBarsDS(R,acqNum,acqMethod)
obj@expStim(R,acqNum,a... |
function bdip = t2(I)
%this function is used to calculate the bdip of the image.
%this will give us the feature extraction for the texture.
clc;
I = rgb2gray(I);
s=size(I);
w=1;
bs=2;
k = 0;
for i=w: bs : (s(1)-w)
for j=w : bs : (s(2)-w)
k =k +1;
bl(:,:,k)=I((i):(i+1),(j):(j... |
% Function that interpolates time-series for x1 and calculates MSE
function statSet = getStatsMSE(Tset, xset, T, x, Tevent)
% Assumptions and modifications
% - samples will be uniformly spaced in time between events but not totally
% - there will have duplicate times due to jumps but unimportant for samples
% - true x... |
% toon workflow
%
% % set session information
% baseDir='/Users/kalanit/Courses/psych224/data/'
baseDir='/biac2/kgs/projects/Toonotopy/data/'
expt = 'TestSubject';
session ='TestSubject_190725';
paramPath =fullfile('Stimuli','8bars_params.mat');
imgPath = fullfile('Stimuli','8bars_images.mat');
%
% baseDir='/... |
%%%%%%%%%%%%% The main.m file %%%%%%%%%%%%%%%
clear all;close all; clc;
% The algorithm parameters:
% 1. Parameters of edge detecting filters:
% X-axis direction filter:
Nx1=10;Sigmax1=1;Nx2=10;Sigmax2=1;Theta1=pi/2;
% Y-axis direction filter:
Ny1=10;Sigmay1=1;Ny2=10;Sigmay2=1;Theta2=0;
% 2. The thresh... |
%% Cell Arrays
% Initialisering
a=cell(3,10)
% Med data
pt={'Kaj',82,[122 78]}
% Tilgang til data
s=pt{3}(1)
pt{2}=88;
n=pt{1}
%% Structs
s.navn = 'Jack Bauer';
s.alder = 34;
s.score = [95 98 97];
ppl=struct('name', {'John','Mary','Leo'}, ...
'age',{32,27,18}, ...
'childAge',{[2;4],1,[]})
... |
function rewrite_aligned_audio(inputname, outputname, offset, skew, maxdur)
% rewrite_audio(inputname, outputname, offset, skew, maxdur)
% Read in a waveform; write out a new version such that the
% output is the original *advanced* by <offset> (so -ve offset
% introduces silence at the start of the output), a... |
clear
vi = input('Enter initial velocity ');
degrees = input('Enter degrees ');
vxi = cos(degrees) * vi;
vyi = sin(degrees) * vi;
xi = 0;
yi = 0;
t= 0.01;
xf = 0;
yf = 0;
vyf = 0;
index = 1;
while yi(index) >= 0
xi(index + 1) = xi(index) + vxi(index)*t ;
yi(index + 1) = yi(index) + ... |
function [ H_EST ] = WiFi_channel_estimation_PS_Third(tx,rx,sampUtil,no_OFDM_blocks)
H_EST_ML_PILOT_SPLINE = zeros(sampUtil,no_OFDM_blocks);
for i = 1:no_OFDM_blocks
rx_pilots = [rx(6,i);rx(20,i);rx(34,i);rx(48,i)];
tx_pilots = [tx(6,i);tx(20,i);tx(34,i);tx(48,i)];
H_PILOTS = rx_pil... |
function [ f, A, b ] = createBIP( W )
% Creates a Binary Integer Program for a given correlation matrix
%
% Input
% W - correlation matrix
%
% Output
% f - objective function
% A, b - constraints of type Ax <= b
%
% Ergys Ristani
% Duke University
% constraintsTime = tic;
N = size(W,1);
% f is the objective f... |
function [infectious, t] = SEKI_simulate(transmission_rate, exposure_rate, N, e1, Tmax, nclasses)
% Nclasses can be 1 to 3
switch nclasses
case 1
i=1;
t(1)=0;
infectious(1)=0;
s=N-e1;
while (t(i)<=Tmax && (N-e1-s)<N)
% Rate of leav... |
function [] = plotsPerVideo(data, videoNum)
bandsName = ["theta", "alfa", "SMR", "beta 1", "beta 2"];
for i = 1:5
figure
v = zeros(19,16);
for channel = 1:19
for person = 1:16
v(channel,person) = data{person}{channel,i}{1};
... |
% Calculate the prox-mapping under entropy distance generating functions:
% Find z on the simplex that minimizes
% <g, z> + sum_i z_i*log(z_i/x_i).
function z = funProxMapEntropy(x, g)
g = g - min(g); % To avoid Inf after taking exp()
z = x .* exp(-g);
s = sum(z);
if s > 0
z = z/s;
... |
%% Segundo Modelo Adaline, para predicción
clear all;
close all;
clc;
%% Carga de datos
res=downloadValues('CMG','03/10/2015','03/10/2016','d','history');
precios=res.AdjClose;
%% Rezagos
nrez=20;
X=[];
for k=0:nrez
X = [X, precios(nrez+1-k:end-k)];
end
Y = X(:,1);
Xa = [ones(size(X,1),1) X(:,2:end)];
ntrain = roun... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GTSAM Copyright 2010, Georgia Tech Research Corporation,
% Atlanta, Georgia 30332-0415
% All Rights Reserved
% Authors: Frank Dellaert, et al. (see THANKS for the full author list)
%
% See LICENSE for the license information
%
% @brief Exam... |
function [Q,R,best,GB,iters,time, St_array]=pso_lqr_diag_general_no_delay(Ac,Bc,Cc,Dc,h,m,Cp,Cg,w,iter,Sett,max_x,max_u)
% pso_lqr_diag uses PSO to find the diagonal of Q and R that minimizes the
% settling time the system Ac, Bc, Cc, Dc.
% Ac,Bc,Cc,Dc= continous time state and input matrices
% m=swarm size
% Cp,C... |
function model = gppwInitModel(pairT, T, testT, conf)
%GPPWINITMODEL model = gppwInitModel(pairT, T, testT, conf)
%
% Init a ggpw pairwise preference model for training.
%
% INPUT
% - pairT : training paired comparison matrix
% - T : item-based training matrix (required for prediction)
% - testT : testing matrix... |
%% TREINO DO CLASSIFICADOR E DECIS√O
%% treino
% Get the same results every time we run the code.
rng default
% Matrix of features and respective labels
matrix = sleep('excerpt7.txt','Hypnogram_excerpt7.txt',200);
features = matrix(:,(1:5));
classLabels = matrix(:,6);
% Number of trees in the forest
nTrees = 43;
... |
classdef expFlash < expStim
properties
radius
delayTime
upTime
downTime
end
methods
function obj = expFlash(R,acqNum,acqMethod,radius,delayTime,...
upTime,downTime)
%%% Construct expStim / expFlash object %%%
obj@expStim(R,... |
% reproduce Adult communities through pipetting, when six phenotypes could
% mutate
% comm_select: Adults to be reproduced
% const_struct: a structure to pass constants
% dil_factor: dilution factor
% rep_counter: current number of Newborn communities.
% parentnum: the rank of the Adult community
function comm_rep = p... |
function [t,w]=eulers(a, b, alpha, f, h)
% MA 3457 / CS 4033 (B-Term 2018)
% Student: Vandana Anand
% Homework 6
% Problem 2A
%
% Function to
%
%
% Input: a - the lower bound of t
% b - the upper bound of t
% alpha - y(a)
% f - the function to be evaluated
% h - the step sizes
%
% Output... |
%% Select which mat file to plot
load('imu_static.mat')
%% Plot
imu_color = [lines(3); lines(3)];
imu_seq = [1:2:6 2:2:6];
imu_name = {'xddot [m/s^2]', 'yddot [m/s^2]', 'zddot [m/s^2]', ...
'rollddot [rad/s]', 'pitchddot [rad/s]', 'yawddot [rad/s]'};
for i = 1:6
i_plot = imu_seq(i);
subplot(3,2, i_plot);
... |
centers_map = containers.Map();
radii_map = containers.Map();
%% Pinky
centers_map('pinky_top') = [0.706; 2.57; -0.186];
radii_map('pinky_top') = 0.18;
centers_map('pinky_middle') = [0.71; 2.449; -0.689];
radii_map('pinky_middle') = 0.2;
centers_map('pinky_bottom') = [0.702; 1.933; -0.965];
radii_map('pinky_bottom'... |
function [Atmp, sigma, chi, CX, D] = Cleanup_pass_decode(Atmp, CX, D, sigma, chi, eta, bit_plane, mx)
n = size(sigma,2);
p = 1;
%Atmp = zeros(4,n);
for j = 1:n
clear idx;
i = 1;
Cj = Atmp(:,j);
while(i<=4)
if((sigma(mx+i-1,j)==0)&&(eta(mx+i-1,j)==0)) % Decode the current position if s... |
classdef ArrayAntenna < handle
% ArrayAntenna is a class to simulate the behavior or an antenna
% array
properties
Element % the antenna model of the element
ElementPosition % a vector of the position of each element, as a multiplier of the wavelength
NumElements... |
function hints = dataHints(net,data,hints)
% Simulation Info
hints.doDelayedInputs = ~isfield(data,'Pd') || (sum(size(data.Pd))==0);
hints.doProcessInputs = (~isfield(data,'Pc') || (sum(size(data.Pc))==0)) && hints.doDelayedInputs;
% Performance Info
if isfield(data,'T')
doEW = any(any(cell2mat(data.EW) ~= 1));
[... |
function y = gskewness(x,n)
%GSKEWNESS Skewness of a grouped sample.
% In some scientific works, once the data have been gathered from a
% population of interest, it is often difficult to get a sense of what
% the data indicate when they are presented in an unorganized fashion.
% Assembling the raw data int... |
params_for_wrapper = 'Parameters/file_for_wrapper.mat';
Temperature_in_Kelvin = 77;
[t_scale, B, ~]= inv_cm_unit_sys(Temperature_in_Kelvin); %time scaling and beta
t1_coh =[]; om2_coh=[]; om3_coh = []; %no coherence shit
clear beam_param_set
use_HEOM = true;
inc_UD_mode = false;
% contributions to th... |
%Bitcoin Treasury Bill Tradeoff Model using a Bootstrap Markov Chain(Including Simulation Code)
clear; close all; clc;
%Parameters
beta= .95; %Depreciation
gamma=.5;%Risk Aversion
rb=1.0225; %Bond Return
Y = 1; %An initial endowment
%Import Markov Chain
importmarkovdata;
importmarkovstates;
stockstates=exp(stocksta... |
%@(#) cr2core.m 1.2 94/08/12 12:10:00
%
%function core=cr2core(dist,mminj)
%Blow up control rod value vector to full core map
%Example: konrod is 169 by 1, mminj 30 by 1 => core 30 by 30 (F3)
function core=cr2core(konrod,mminj)
[map,mpos]=cr2map(konrod,mminj);
ll=length(konrod);
core=zeros(size(mminj,1));
for i=... |
function f = flip_faces(f,sizeI)
%Flip faces given size of the image
f(:,1) = sizeI(2)-f(:,1);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.