text stringlengths 8 6.12M |
|---|
source('functions.m');
% nastavenie parametrov
d = 3;
data = dlmread('Concrete_Data.csv', ';');
% vybratie trenovacej a testovacej mnoziny (poduloha a)
[rows, cols] = size(data);
randOrder = randperm(rows);
Ttrain = data(randOrder(1:800), :);
Ttest = data(randOrder(801:end), :);
% spocitanie trenovacej a testovacej chy... |
function centroids = computeCentroids(X, idx, K)
[m n] = size(X);
centroids = zeros(K, n);
% ----- %
counts = zeros(K,1);
for i = 1:m,
for j = 1:K,
if idx(i) == j,
centroids(j,:) = (centroids(j,:) + X(i,:));
counts(j) = counts(j) + 1;
end
end
end
centroids = centroids./counts;
% ----- %... |
% debugging canopy interpolation
step=2
file='wrfout_d05_2012-11-11_12:00:00'
long=-86.73
lat=30.53
p=wrfatm2struct(file,step);
pp=nc2struct(file,{'CAN_TOP','CUF','CVF','FWH','FZ0','UF','VF','UAH','VAH'},{},step);
p.can_top=pp.can_top;
p.cuf=pp.cuf;
p.cvf=pp.cvf;
p.fwh=pp.fwh;
p.fz0=pp.fz0;
p.uf=pp.uf;
p.v... |
filename = 'transition.xlsx';
files = dir('*.wav');
audio = cell(1,1579);
A = zeros(1579,161);
for k = 1:1579
% Reading an audio file
audio{k} = audioread(files(k).name);
[Y, Fs] = audioread(files(k).name);
A(k, 1) = k;
for j = 2:161
A(k,j) = Y(j-1);
end
end
xlswrite(filename,... |
%% Perspectiva
%% Entradas
%% I - imagen
%% K - Constante de perspectiva (cercano a cero)
%% IBand con bandera con indicador de valor (1-existe valor)
function [G,Bandera] = perspectiva(I,k)
nCoord=zeros((size(I,1)),(size(I,2)));
for i =1:size(I,1)
for j =1:size(I,2)
nX=j*(i*k);
... |
clear
close all
clc
lmbda = 0.5;
thetaF=[60;240];
delta_t = 0.001;
k=1;
l1=1;
l2=1;
[Oe0, Ri0, Oi0] = practical9_forkin(thetaF);
[pc,u,v,sd] = practical9_perspective(Ri0,Oe0);
% sd=s;
t = 0;
theta = [0;0];
e=1;
i=1;
while norm(e)>=0.003
[Oe0, Ri0, Oi0] = practical9_forkin(theta);
[pc,u,v,s... |
function [out1] = katy_trojkata_f4(wsp)
a = sqrt((wsp(2,1)-wsp(1,1))^2 + (wsp(2,2)-wsp(1,2))^2); %dlugosc boku AB
b = sqrt((wsp(3,1)-wsp(1,1))^2 + (wsp(3,2)-wsp(1,2))^2); %dlugosc boku AC
c = sqrt((wsp(3,1)-wsp(2,1))^2 + (wsp(3,2)-wsp(2,2))^2); %dlugosc boku CB
cos_ab = (a^2+b^2-c^2)/(2*a*b);
cos_ac = (a^2+c^2-b... |
function [ aciertos ] = verificacion( P,Q,a3 ) %P Matriz con los numeros, Q cantidad de numeros manuscritos,a3 respuesta de la red neuronal
% Verificación
for q=1:Q
[a iwin(q)] = max(a3(q,:));
end
iwin=iwin-1;
y = zeros(1,50);
y = [y ones(1,50)];
aciertos = sum(y==iwin);
%Rutina aleatoria para ver imagen y el reco... |
function [processedSig,reconArtifact] = single_trial_ica(raw_sig,varargin)
%USAGE:
% This function will perform an interpolation scheme for artifacts on a
% trial by trial, channel by channel basis, implementing either a linear
% interpolation scheme, or a pchip interpolation scheme
%
% raw_sig = samples x channels x t... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Extract beats and annotations from mitdb dataset centered on R-peaks
% and size (window_l - window_t).
%
% Author: Mondejar Guerra, Victor M
% VARPA
% University of A Coruña
% April 2017
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
R=20:96:500;
Rd = 5:5:100;
bandwidth = 180000;
NPowerdB = -174+10*log10(bandwidth);
NPower = 10^(NPowerdB/10);
freq = 3.4;
BSPower = 20000;
BSPowerdB = 10*log10(BSPower);
power = 200;
powerdB = 10*log10(power);
C0 = zeros(6,20);
SINR = 0;
for j = 1:6
for i=1:20
pathlossBSdB = BSPowerdB+121-pa... |
camList = webcamlist;
cam = webcam(1);
preview(cam);
f = figure;
w = waitforbuttonpress;
while w ~= 1
disp('Button click')
w = waitforbuttonpress;
end
disp('Key press')
clear cam
close(f); |
%{
# neuron pixel masks
-> pni.Segmentation
mask_id : int # unique mask id for this segmentation
-----
pixels : blob # pixel indexes of mask
weights : blob # weights of each pixel in mask
%}
classdef SegmentationMask < dj.Part
properties(SetAccess=protected)
master= pni.Segmentation
end
end |
function [fname,fnameStimulus] = vaFname(params)
% Return the filename for storing basis and stimulus in the va analysis.
%
% BW, ISETBIO Team, 2017
% Stored imageBasis filename with the same parameters as this. Originally, I
% used these parameters and counted them. But in fact, they should not count.
% We can use ... |
x = [1,2,0.5,1]
n1 = 0
h = [1,2,1,-1]
n2 = -1
N1 = size(x,2);
N2 = size(h,2);
N = N1+N2-1;
h2 = flip(h);
n3 = -(N2+n2-1);
ni = n1 + n2;
nf = ni + N - 1;
mstart = n3+ni;
mend = mstart+N-1;
rows = 4+N;
columns = abs(mstart)+mend+N2;
t = zeros(rows, columns);
for i = 1:columns
t(1,i) = mstart+i-1;
end
fo... |
function [ H] = strong_classifier( alpha,ht,X )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
h = (ht(2,:).*alpha')*(ht(:,:)'*[ones(1,size(X,2)); zeros(1,size(X,2));X]);
H = sign(h);
%H = sign(h'*alpha);
end
|
clear; % Clears old variables.
clc; % Clears command window.
clf; % Clears figures.
%close all; % Closes any open windows.
%% LaTeX stuff.
set(groot, 'defaultAxesTickLabelInterpreter','latex');
set(groot, 'defaultTextInterpreter','latex');
set(groot, 'defaultLegendInterpreter','latex');
%prefix = '';
%prefix = 'autom... |
% Calculates the max speed of the vehicle in m/s
% Returns -1's is vehicle cannot sustain lift
% Returns current value for inputs that don't not converge after 1000
% iterations
% weight is the weight of the vehicle in N
% topArea and frontArea are the lateral areas of the vehicle from the top
% and front respe... |
% Tamar Bacalu, Mark Koszykowski, Henry Son
clc; clear; close all;
%% Part 1
%{
s[n] = +/-1 i.i.d. with p = .5
d[n] white noise Gaussian with var(d) = 1
c[n] = [1 .2 .4]
Rsr[N] = E[s[n]r[n-N]]
2
= E[s[n](S{c[k]s[n-N-k]} + d[n-N])]
k=0
= E[s[n](s[n-N] + .2s[n-N-1] +... |
function [modelParameters] = positionEstimatorTraining(training_data)
%% Find firing rates
xvel = [];
yvel = [];
spike_rate = [];
firingRate = [];
trainingData = struct([]);
Vel = struct([]);
dt = 10; % bin size
for k = 1:8
for i = 1:98
for n = 1:length(training_data)
for t = 3... |
function out = fnma_m(A, B0, M, opt)
%
% FNMA_m : fast nonnegative matrix approximation with missing values.
% function out = fnma_m(A, B0, M, opt)
%
% Solve a nonnegative matrix approximation problem with missing values,
% min ||A - B*S*C||_F^2
% s.t B, C \ge 0
% Based on Barzila-Borwein Gradient Projection B... |
function indices = getLinkIndices(obj, link_names)
% Returns the indices of links specified by the name string
%
% Parameters:
% link_names: a cell array of strings of the link name
%
% Return values:
% indices: position indices of joints in the obj.joints
all_link_name = {ob... |
function [H, key1, key2] = findtrans(Dot1,Dot2)
% This function finds the projective transform
% %%%ransac
Size=size(Dot1);
max=0;
temp=[];
C1=[];
C2=[];
%% shuffle the dots
for s=Size(1):-1:1
number=unidrnd(s,1,1);
tmp1=Dot1(:,number);
tmp2=Dot2(:,number);
Dot1(:,number)=Dot1(:,s);
Dot2(:,number)=D... |
function P_index = get_P_index(FNA)
N = size(FNA, 2);
K = size(FNA, 1);
k = 2;
n = 1;
P_index = zeros(K, 2);
P_index(1, 1) = 1;
while(n < N)
if k <= K
if FNA(K - k + 1, n + 1) == 1
P_index(k - 1, 2) = n;
P_index(k, 1) = n + 1;
n = n + 1;
k = k +... |
function knn2
[data1tr,text1tr]= xlsread('forest_type_train_1',1,'B2:AC55'); % training set 10% of data
X1= data1tr(1:54, 1:27);
y1= text1tr(1:54, 1);
for i=1:54
Y1(i)= strtrim(y1(i));
end
Y1=Y1'; % just to remove the space after each class letter
obj1 = fitck... |
% Program 7.2 modifiation Finite element solution of linear BVP
% Inputs: interval inter, boundary values bv, m number of intevals
% Output: solution values c
% Example usage c=bvpfem([0 1],[1 3],m);
function [t y]=bvpfem(inter,bv,m)
n = floor(m-1); % the number of steps
a=inter(1);
b=inter(2);
ya=bv(1);
yb=bv(2);
h=(b... |
function result = safeDivideGBVS(arg1,arg2)
% safeDivide - divides two arrays, checking for 0/0.
%
% result = safeDivide(arg1,arg2)
% returns arg1./arg2, where 0/0 is assumed to be 0 instead of NaN.
% This file is part of the SaliencyToolbox - Copyright (C) 2006
% by Dirk Walther and the California Institute of Tec... |
function S = merge_samples( S1, S2, n1, n2 )
%MERGE_SAMPLES Summary of this function goes here
% Detailed explanation goes here
%% Precondition
assert(size(S1,2) == size(S2,2));
assert(size(S1,1)/n1 == size(S2,1)/n2);
%% Preallocation for a merged matrix.
S = zeros(size(S1,1)+size(S2,2),size(S1,2));
for i = 1 : si... |
function [FEVD, VAR, FAVFEVD] = FAVARfevd(VAR,VARopt)
% =======================================================================
% Compute FEVDs for a VAR model estimated with VARmodel. Three
% identification schemes can be specified: zero short-run restrictions,
% zero long run restrictions, and sign restrictions
% ===... |
clear
opengl software
clc
% We know:
p1 = 100;
p4a = 100;
p4b = p4a;
Ro = 8.314;
M = 28.86;
k = 1.4;
T1 = 20 + 273;
T2b = 644.99;
T4b = T2b;
T3 = 1000 + 273;
PI = 10;
% So, for the p,v-diagram:
R = Ro/M;
p2a = p1*PI;
p2b = p2a;
p3 = p2b;
cp = k*R/(k-1);
v1 = R.*T1./p1;
v2a = v1./(PI.^(1./k));
v2b = R.*T2b./p2b;... |
function demoObjRead()
%
% Demonstration that obj and stl loading works.
%
% if this returns error about missing files.. add sampleData to matlab or
% replace all paths to full path to file (i.e. 'D:\myPancakes\matlabVoxelization\sampleData\airboat.obj')
%
[F,V] = fileReader( '\sampleData\airboat.obj');
figu... |
%% AND
close all; clear all; clc;
net=newp([0 1;-2 2], 1);
%tworzymy warstwę perceptronu z jednym elementem
%2-elem.( zakres [0 1] i [-2 2] i jednym neuronem
A=[0 0 1 1];
B=[1 0 1 0];
P=[A;B];
T=[0 0 1 0];
net =train(net,P,T);
Wyj=sim(net,P)
%% NAND
close all; clear all; clc;
net=newp([0 1;-2 2], 1);
A=... |
function [error] = syndromeTableH74(syndrome)
syndIDX=[0 0 0;0 1 1;1 1 0;1 0 1;1 1 1;1 0 0;0 1 0;0 0 1];
idx=0;
for i=1:length(syndIDX)
if(syndIDX(i,:)==syndrome)
idx=i;
end
end
err=[0 0 0 0 0 0 0; 1 0 0 0 0 0 0; 0 1 0 0 0 0 0; 0 0 1 0 0 0 0;
0 0 0 1 0 0 0; 0 ... |
fluid1 = thermo('umr',273.15+55, 25.0);
fluid1.addComponent('nitrogen', 2.4526);
fluid1.addComponent('CO2', 1.6318);
fluid1.addComponent('methane', 5.221);
fluid1.addComponent('ethane', 7.4681);
fluid1.addComponent('propane', 7.2278);
fluid1.addComponent('i-butane', 1.9121);
fluid1.addComponent('n-butane', 2.7229);
flu... |
function ACOMs = fastCOMsA(A, siz)
% ACOMs = fastCOMsA(A, siz)
%
% Compute the center of mass (COM) of each neuron in A. siz should be the
% size of the un-reshaped image (e.g., size(medImage{2})). ACOMs uses the
% standard image convention for dimension order, so rows are [y x].
% The COM is the first momen... |
global MPI_COMM_WORLD;
load 'MatMPI/MPI_COMM_WORLD.mat';
MPI_COMM_WORLD.rank = 72;
Alluxio_Row_mv_version3;
|
function [Xfinal,disparity,I,X,Xfinal_ini] = function_BELHUMER(imgPath,Xinit,display,verbose)
% turns /net/isi-backup/restricted/face/FFE/LPFuCE/v1_1.m into a function
%--------------------------------------------------------------------------
% INPUTS:
% imgPath: path to the image
% Xinit: rough position of the 36 l... |
function s = divideMask(imfolder, exfolder)
% Import mask images (-m.png) from one folder and save divided masks to another folder.
% find all files whose names end with '-m.png'
filePattern = sprintf('%s/*-m.png', imfolder);
list = dir(filePattern);
% disp(list(1).name)
numOfMask = length(list);
numOfS = 0;
for ... |
function Yout = subspaceMethod(X, NOISE, num)
%%
%% subspaceMethod: Noise reduction based on subspace method
%%
%% coded by K. Yamaoka (yamaoka@mmlab.cs.tsukuba.ac.jp) on 7 June 2017
%%
%% [syntax]
%% Y = subspaceMethod(X, NOISE, num)
%%
%% [inputs]
%% X: Obserbed signal
%% size -> (# of channel, # o... |
function superboxplot(varargin)
% function superboxplot(x,y,gp, opts...)
%
% Does a standard statistical box plot (like boxplot) but includes the x
% position. x and y can be the same size, or x can be a column and y can be
% a matrix with the same number of rows as x. gp must be the same size as y
% and indicates va... |
indicator_raw = fts2mat(spreadTS.spread) > 5;
indicator_smooth = indicator_raw;
for ii=1:length(spreadTS)
if sum(indicator_raw(max(ii-5,1):ii-1)) > 0
indicator_smooth(ii) = 0 ;
end
end
% losedays = spreadTS.dates(indicator_smooth);
% chk = fts_window(RANGE(indicator_smooth));
% losedays == chk.dates
... |
function [R]=return_csma_one(D,L,pb,pc)
tic;
% P=csma_p_transmit_3D(L,D,pb,pc); %%%%%%给出一个状态转移矩阵p
% P =xlsread('D:\csma_data\rough_csma.xlsx');
% diff=P-P1
P=csma_p_transmit_3D_lei( L,D ,pb,pc );
pi = zeros(1,size(P,1)); %initial pi
matrix = zeros(1,3);... |
function r = readGratingSequence(filename,varargin)
%readGratingSequence Converts grating sequence into velocity
% R = readGratingSequence(FILENAME,VARARGIN) converts the grating
% sequence stored in FILENAME and returns the temporal frequency.
% FILENAME is assumed to be a text file containing a few lines of
... |
clear
results = load('results_sample6.mat');
%results = struct();
%results.results = res;
sx = size(results.results);
%for sample5
hrs = 960;
samp = 961;
plottime = [0:.25:samp/4-.25];
plottime2 = [0:.25:hrs/4-.25];
%for sample4
% hrs = 401;
% samp = 401;
% plottime = [1:1:hrs];
Tsamp = 1;
slt = .84;
Ce = zeros(s... |
function out1 = six_J_hip(q1,q2,q3,q4,q5,q6)
%SIX_J_HIP
% OUT1 = SIX_J_HIP(Q1,Q2,Q3,Q4,Q5,Q6)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 12-Jun-2020 14:26:55
t2 = q1+q2;
t3 = cos(t2);
t4 = sin(t2);
t5 = t3.*4.38012e-1;
t6 = t4.*4.38012e-1;
t7 = -t6;
out1 = reshape([t7-sin(q1).*... |
%Written by Patrick Strassmann
function [boutStartXs, boutStartYs, boutEndXs, boutEndYs] = markBoutBounderies(boutStartTimes, boutEndTimes,markerSize)
scaleFactor = 1;
if nargin<3
markerSize = 4;
end
if nanmean(boutEndTimes)>1000
boutEndTimes = boutEndTimes/100;
boutStartTimes = boutStartTim... |
function [PenaltyModel] = modifiedSIMP
PenaltyModel.evaluate=...
@(material_index,cell_index,controls)evaluate(material_index,cell_index,controls);
PenaltyModel.sensitivity=...
@(material_index,cell_index,controls)sensitivity(material_index,cell_index,controls);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
clear all; close all; clc;
thresh_min=10^(-6);
S=60;
adir='./output_simulation/SV_same_temp/';
allfiles=dir(adir);
fileNames = {allfiles(~[allfiles.isdir]).name};
f=7;
load(strcat([adir,fileNames{f}]));
mask=youtbis(end,:)<thresh_min;
sbis=1:S;
sbis=sbis(~mask);
load(strcat('./output_simulation/KO/simu',num2str(f),... |
%Spektrum.M
%
%Darstellung des Amplitudenspektrums
%
function spektrum=spektrum(x,fT);
%
%x ist ein Zeitsignal
%fT ist die Abtastfrequenz
%
D=size(x);
if D(1) ~= 1 & D(2) ~= 1, return, end;
xm=x;
if D(2) == 1, xm=xm.'; end;
N=length(xm);
k=0:N-1;
%
%Fast Fourier Transform (Darstellung 0 <= f < fT)
%
f... |
function obj = viewCellExtractionOnMovie(obj,varargin)
% Creates outlines of the cell extraction outputs on the movie.
% Biafra Ahanonu
% started: 2019.06.14 [09:08:08]
% inputs
%
% outputs
%
% changelog
% 2019.10.29 [16:31:37] - Added a check for already loaded files
% 2021.06.18 [21:41:07] - added mode... |
% Curve fit to SSN data using "least square fit" (LSF).
clear all
close all
% Set time interval for SSN data.
tint=[irf_time([1992 01 01 0 0 0]) irf_time([2014 01 01 0 0 0])];
% Load SSN data for specified time interval.
fa=irf_get_data_omni(tint,'ssn');
% Convert omni time format into Matlab datenum format and store ... |
% Code to load in results from rCPM and identify features selected on more
% than npct of iterations + calculate their contributions
% written by Abby Greene, 2019
homedir = '/data17/mri_group/abby_data/ppi_paper/'; % where is the parent directory for inputs and outputs?
dataset = 'hcp'; % dataset?
taskname = {'wm','la... |
% Diese Datei dient nur zum Auffinden dieses Ordners mit dem Befehl
% `which('hybrdyn_path_init.m')` und zum Hinzufügen des Hauptverzeichnisses
% des Repos
this_tb_path = fileparts( mfilename('fullpath') );
addpath(this_tb_path); |
% sq_dist - a function to compute a matrix of all pairwise squared distances
% between two sets of vectors, stored in the columns of the two matrices, a
% (of size D by n) and b (of size D by m). If only a single argument is given
% or the second matrix is empty, the missing matrix is taken to be identical
% to the fir... |
function [Population,FrontNo,KneePoints] = EnvironmentalSelection(Population,FrontNo,MaxFNo,KneePoints,Distance,K)
% The environmental selection of KnEA
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEM... |
% This section of code randomly generates and
% visualize a graph.
clear;
noOfNodes = 60;
rand('state', 0);
figure(1);
clf;
hold on;
L = 1000;
R = 200; % maximum range;
netXloc = rand(1,noOfNodes)*L;
netYloc = rand(1,noOfNodes)*L;
for i = 1:noOfNodes
plot(netXloc(i), netYloc(i), '.');
text(netXloc(i), net... |
clc
clear all
close all
%% Definir coordeandas de los ejes de las calles
%--------------------------------------------------%
node = 1:1:39;
node = node';
X = zeros(length(node),1);
Y = zeros(length(node),1);
street_coords = [table(node) table(X) table(Y)];
street_coords.X(1) = 3821.5579;
street_coords.Y(1) = 936... |
%create a block diagonal matrix with the given array of elements
function f = blockDiagonalMatrix(A)
f = diag(A); |
%Generates spectrograms and table values.
close all
clear variables
%Rat numbers
rats=[26 27 24 21];
%Variables used for different segments of time.
DUR{1}='1sec';
DUR{2}='10sec';
Block{1}='complete';
Block{2}='block1';
Block{3}='block2';
%Calls GUI to select analysis and parameters. Description of GUI on github.... |
function [idx_, dim, t] = nonlinearLearn(D, data)
% y = a*x^2 + b*x + c
% Pick random dimensions for x and y
dim = randsample(D-1,2);
t = zeros(1,3);
t(3) = (2*rand - 1);
t(2) = (2*rand - 1);
cRange = data(:,dim(2))-t(2).*(data(:,dim(1))).^2-t(3).*data(:,dim(1));
cMin = min(cRange);
... |
function [Q,R] = qr_BlockHouseholder_Recursive(A, n, nb)
[~,n] = size(A);
if n <= nb
% Compute a thin QR factorization!
[Q,R] = qr_Householder(A, 'thin');
else
% Recursive calls!
n1 = floor(n/2);
TEMP = A(:,1:n1);
[Q1,R11] = qr_BlockHouseholder_Recursive(TEMP, n1, nb);
clear TEMP
R12 = Q1' * A(:,(n1+1):n);... |
function cubehelix_view(start,rotations,hue,gamma,rng)
% Create an interactive figure for Cubehelix colormap parameter selection.
%
% (c) 2013 Stephen Cobeldick
%
% Syntax:
% cubehelix_view
% cubehelix_view(start,rotations,hue,gamma)
% cubehelix_view(start,rotations,hue,gamma,rng)
%
% View any of Dave Gree... |
function call_combine(input_dir, input_files, output_dir, output_file, input_parameters)
% these are now defined above and passed through:
% input_parameters.intended_triggers = 14;
% input_parameters.actual_triggers = 14;
% input_parameters.channels_to_remove = {};
output_prefs.output_dir = output_dir;
output_prefs.... |
function Active_Set = OD_Safe_Screen(X, Active_Set, y_lambda, residual, beta, R_)
% function Active_Set = OD_Safe_Screen(X, Active_Set, y_lambda, residual, beta, R_)
a = abs(X'*residual); b = norm(residual, 2)^2; c = residual'*y_lambda; d = norm(y_lambda, 2)^2 - R_^2;
v = 1/max(a);
alpha = min(max(-v, y_lam... |
function output = string( input )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
output = input;
end
|
function [League,nEval]=WinnerFunctionResrve3(League,Winner,nEval)
global ProblemSettings;
global SCASettings;
VarSize=ProblemSettings.VarSize;
VarMin=ProblemSettings.VarMin;
VarMax=ProblemSettings.VarMax;
nMainPlayer=SCASettings.nMainPlayer;
nReservePlayer=SCASettings.nReserve... |
function s1 = trapzd(func,a,b,s,n)
%
% function s1 = trapzd(func,a,b,s,n)
%
% This routine uses the trapezoidal rule to evaluate
% the integral between a and b of the integrand defined
% by the function func. n is the number of times the interval is subdivided.
%
% The new approximation (s1) is adjusted from the previ... |
function mpfn = pseudopf(mpfn)
[~,M] = size(mpfn.smat);
for i = 1:M
mpopt = mpoption('verbose',0,'out.all',0);
mpf = runpf(mpfn.q(i),mpopt); % run AC power flow calcation
mpf.bus(:,8) = mpfn.vmat(:,i);
mpfn.q(i) = mpf; % renew q(i)
mpfn.thetamat(:... |
% function Io = BicubicInterp(I)
X = meshgrid(1:256);
X = double(X);
I = X;
for x = 1:2*size(I,1)+1
for y = 1:2*size(I,2)+1
if mod(x,2)==0 && mod(y,2)==0
Io(x,y) = I(x/2,y/2);
else
Io(x,y) = 0;
end
end
end
Io(:,1) = Io(:,2);Io(:,end) = Io(:,end-1);
Io(1,:) = Io(2,:);Io(end,:) = Io(end-1... |
function [ A, b ] = BTenvelope_for_xy( indices, varbounds, dims )
%returns sparse matrix and structure with vectors of lower and upper bounds
%for linear envelopes of z=xy function. Each envelope is represented as
%z=a1*x+a2*y+b, l<b<u
%matrix
ind_rows=repmat((1:dims.nrows)',2,1);
ind_cols=[indices.x; indic... |
% Description: generate reference by combining cross-run averaging and a one-sample t-test
% Usage:
% smm = tRef(St,tcS,mask_ind, alpha, V)
% Input:
% St: cross-run averaging spatial maps with dimension 1 x V
% tcS: t values of one-sample t-test with dimension 1 x V
% mask_ind: mask for in-brain vo... |
%vaje 3 18.12.2018
C = [1 2 3; 2 9 0; 3 0 7];
A1 = -[1 0 1; 0 3 7; 1 7 5];
A2 = -[0 2 8 ; 2 6 0; 8 0 4];
b = [11;9];
c = C(:);
A = zeros(2,9);
A(1,:) = A1(:)';
A(2,:) = A2(:)';
K.s = 3; % povemo nad gledamo nad stozcem psd matrik dimenzije 3x3
%pars.fid = 0;
[x,y,info] = sedumi(A,-b,c,K);
%podal smo v dualni obliki ... |
plot(X50o(2:52,1),X50o(2:52,2))
hold()
plot(X206(2:52,1),X206(2:52,2))
plot(X470o(2:52,1),X470o(2:52,2))
title('Resistor test')
xlabel('Frequency /Hz')
ylabel('Impedance /ohm')
legend('50ohm','260ohm','470ohm')
%%
yyaxis left
plot(rinima(:,1),rinima(:,2));
hold()
ylabel('Gain /dB')
yyaxis right
plot(rinima(:,1),rinima(... |
%--------------------------------------------------------------------------
%------------ Metody Systemowe i Decyzyjne w Informatyce ----------------
%--------------------------------------------------------------------------
% Zadanie 3: Detekcja twarzy
% autorzy: A. Gonczarek, J.M. Tomczak, S. Zaręba, M. Zięba
% 20... |
close;
clear;
clc;
%% read image
filename = 'image.jpg';
I = imread(filename);
figure('name', 'source image');
imshow(I);
%% ----- pre-lab ----- %%
% output = function(input1, input2, ...);
% grey_scale function
I2 = grey_scale(I);
%% ----- homework lab ----- %%
% flip function
I3 = flip(I,0);
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CTD: Fast, Accurate, and Interpretable Method for Static and Dynamic Tensor Decompositions
% Author: Jungwoo Lee, Dongjin Choi, and Sael Lee
%
% Version: 1.0
% Date: August 21, 2017
% Main Contact:... |
function [t,u] = dif_cent(f, t, x0)
N = length(t);
h = (t(N) - t(1))/N;
u = zeros(length(x0), N);
u(:, 1) = x0;
% Iniciar con Euler (hallar x1)
u(:, 2) = u(:, 1) + h*feval(f, t(1), u(:, 1));
n = 2;
while n < N
u(:, n+1) = u(:, n-1) + 2*h*feval(f, t(n), ... |
function e_VarEst = f_eVarEstInic(c_Field,e_DatSet,e_VG,varargin)
%Inicializa la estructuras de variable de estado
nSet = e_VG.nSet;
nField = length(c_Field);
c_StructDef = cat(1,c_Field,repmat({[]},1,nField));
%e_VarEst(1:nSet,1) = struct(c_StructDef{:});
%Si son estructuras vacías también se... |
%% Regulérní výrazy
% TEORIE
% Regulérní výraz dokáže podchytit hodně podmínky (příklad výběr pacientu se začátečním písmenem S)
% atd. v jednom výrazu
% v R grep; v Matlabu regexp
% Na elearningu je odkaz (vyukový materiál) na stránky + shrnutí v pdf
% V podstatě je regulérní výraz řetězec, a v tom řetězci jsou... |
function [SNR Pr Noise] = SNR_calculation(cir,distance,lambda,Type_Environment,d_0,sigma,Num_sensors,Time_samples,Pt,NF,n,BW,layoutpar)
% Calculate the large scale path loss for each link (because wim.m is not
% doing it).
% This option for the simplest calculation using the Friis... |
function varargout = USARTM(varargin)
% USARTM MATLAB code for USARTM.fig
% USARTM, by itself, creates a new USARTM or raises the existing
% singleton*.
%
% H = USARTM returns the handle to a new USARTM or the handle to
% the existing singleton*.
%
% USARTM('CALLBACK',hObject,eventData,handles,... |
function D = delsq2D(G, varargin)
%DELSQ2D Construct 5-point finite difference Laplacian.
% delsq2D(G) or delsq2D(G,[hx,hy])
% is the sparse form of the two-dimensional,
% 5-point discrete negative Laplacian on the grid G.
% The grid G can be generated by NUMGRID or NESTED.
% [hx,hy] is the optional pa... |
function importCsv2(path2zip,opt)
% IMPORTCSV Imports WRDS .csv with TAQ prices
%
% IMPORTCSV(PATH2ZIP) Imports zipped .CSVs from the PATH2ZIP directory
% and saves them into .mat files under
% $PATH2ZIP$\mat\T####.mat.
%
%
% The .CSVs should be downloaded from WRDS wit... |
% int = trapeziComposita(f, a, b, n)
% Formula dei trapezi composita per l'approssimazione dell'integrale
% definito di una funzione.
%
% Input:
% -f: la funzione di cui si vuol calcolare l'integrale;
% -a: estremo sinistro dell'intervallo di integrazione;
% -b: estremo destro dell'intervallo di integrazione;
% ... |
function [Alpha1, Alpha2, Z, p, BCaCI] = CalculateBCaLimitsOneValue(JackKnifeData,PointEstimate, BootStrapData,alpha)
N = size(JackKnifeData,1); % NUMBER OF SUBJECTS
Nboot = size(BootStrapData,1);
zA = norminv(alpha/2);
z1mA = norminv(1 - alpha/2);
testValue = 0;
if PointEstimate ~= 0%{1}(i,j) ~= 0
% For diag... |
path='F:\\graduation-project\\codes\\feature_extractor\\data\\';
test_set=0;
acc=zeros(7,10);
th=0.95;
p=zeros(20*10,7);
for i=1:10
id=sprintf('chi2%03d',i*5);
s=load([path,id,'.mat']);
test_set=s.chi2test_set;
label_t=sign(test_set(:,5)-th);
label_t=label_t-(label_t==0);
[p(:,1),tmp,~]=svmpredi... |
files = dir('*_DispV.jpg'); ImgGrayScaleMax = 255;
im = cell(length(files),1);
for i = 1:length(files)
im{i} = files(i).name;
end
v = VideoWriter('frac_heter_dispv.mp4');
open(v);
figure,
for tempk = 1 : length(files)
clf
%imshow(imread(im{tempk},1),'DisplayRange',[0,ImgGrayScaleMax]);
imsh... |
function [m_Be,m_DetJe] = f_MatBe_bbar_q1(coord_n,e_DatElemSet,e_VG)
%xg = e_VG.xg;
ntens = e_VG.ntens;
%dofpe = e_VG.dofpe;
%npg = e_VG.npg;
struhyp = e_VG.struhyp;
dofpe = e_DatElemSet.dofpe;
xg = e_DatElemSet.xg;
npg = e_DatElemSet.npg;
m_Be = zeros(ntens,dofpe,npg);
... |
% load data from start high and start low simulations
loopDataFolder = 'U:\Data\Analysis\2020-04-23_JordanLoopSims\'; % update for your save path
load([loopDataFolder,'loopRatesVsExpStoch.mat'],'acVals2'); % start low
load([loopDataFolder,'loopRatesVsExpStoch_startON.mat'],'acVals3'); % start high
numLoops = length(... |
% =========================================================================
%
% Coded by Wentao Xie - xiewt86@gmail.com
%
% =========================================================================
%% I. Constants & data preparation
clear
fs = 48000; % sampling rante of a smartphone
T_frame ... |
% Script to compute head positions in the first frames
% Isabelle Guyon -- isabelle@clopinet.com -- February 2012
droot='/Users/isabelle/Documents/Projects/DARPA/';
datadir=[droot 'DistributedChallengeData'];
% Path where to find data and code
codedir=[droot 'Software/Recognizer/'];
addpath(codedir);
this_dir=pw... |
a = zeros(1,10);
for n = 1:10
a(n) = n-1;
end
input = a + 0i;
output = fft(input);
|
classdef ePuck < DifferentialDrive
% Epuck: is an Epuck simulation object
% This class handles the interface to the V-REP simulator and
% low-level object handle operations for the Epuck mobile robot
%
% A Epuck object holds all information related to
% the robot kinematics and dynam... |
clear;clc,close all;
%% 建立机器人DH参数,初始状态为竖直状态
L1=Link('d',144,'a',0,'alpha',0,'modified');
L2=Link('d',0,'a',0,'alpha',pi/2,'offset',-pi/2,'modified');
L3=Link('d',0,'a',-264,'alpha',0,'modified');
L4=Link('d',106,'a',-236,'alpha',0,'offset',-pi/2,'modified');
L5=Link('d',114,'a',0,'alpha',pi/2,'modified');
L6=Link('d',... |
function y = massFraction(r, species)
% MASSFRACTION - Mass fraction of species with name 'species'.
%
k = speciesIndex(r.contents, species) - 1;
y = reactormethods(30, reactor_hndl(r), k);
|
clear;clc
addpath ..
%% Problem 1.1
syms o_x o_y o_theta l_s l_w m g q1 q2 q3 q4 l1 l2 real
Bc1 = eye(6,2);
Bc2 = eye(6,2);
g_wo = [cos(o_theta), -sin(o_theta), 0,o_x
sin(o_theta), cos(o_theta), 0, o_y
0, 0, 1, 0
0, 0, 0, 1];
g_wc1 = [0 1 0 -l_w/2
-1 0 0 0
0 0 1 0;
0 0 0 1];
g_wc2 = [0 -1 0... |
function FixMarker = StereoFixation(Display, Fix, Stim)
%========================== StereoFixation.m ==============================
% Generates nonius line crosshair fixation markers and retuns an array of
% Psychtoolbox texture pointers.
%
% INPUTS:
% Display: stucture generated by DisplaySett... |
function [histo_acc]=ibobDataHist(fn)
%------------------------------------------------------------------------------------------------
% Plot histogram from data consisting of 12/16-bit samples with two or four channels
%
% The two-channel format is [ch1 samp1 | ch2 samp1 | ch1 samp2 | ch2 samp2 | ch1 samp3 ... ]
% Th... |
% Author: Eseoghene Okonofua <EseO@Eseoghenes-MacBook-Pro.local>
% Created: 2017-09-25
%Helper function get random point on a sphere surface with given centre and radius
function coordinates = GetRandomPointOnSphere(centre, radius, hemisphere)
% default
theta = 2*pi*rand;
phi = acos(2*rand - 1);
if strcmp(he... |
function [stAlgo] = prctile_snr()
%PRCTILE_SNR Percentile-based signal-to-noise ratio estimator
% Implementation of an algorithm, using signal amplitude percentiles to estimate
% the (frequency-weighted, segmental) signal-to-noise ratio (SNR). The algorithm
% was developed as part of the Bachelor Thesis of Jan Wil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.