text stringlengths 8 6.12M |
|---|
function [ varargout ] = imsf( varargin )
% ISCF macro for imagesc with figure
% type 'help imagesc' for more information
figure;
if(nargout == 0)
imshow(varargin{:});
else
varargout{:} = imshow(varargin{:});
end
end
|
function params=read_params_xstruct(xstruct)
Channels=xstruct.Parameter.Channel;
for i=1:length(Channels)
if length(Channels)>1
Channel=Channels{i};
else
Channel=Channels;
end
params_temp=Channel.Attributes;
params = structfun(@read_params,params_temp,'un',0);
end
end
func... |
clear;
type compact;
%initialization
a = [10 7 8 7;7 5 6 5;8 6 10 9;7 5 9 10];
b = [32 23 33 31]';
%gauss
x = mygauss(a,b);
disp(x); |
clear all
clc
re=rand(5,3)
pr=re+0.1*randn(5,3)
thred=0.1;
[ er_rat,ind ] = fun_find_err_big( re,pr,thred )
|
function [Xnew,acc,qbar,delalpha_flag]=runge_kutta_4(X,Xdot,U,DT)
%%%% Function to implement 4th order Runge-Kutta integration scheme
%%%% Call a function 'deriv' that implements xdot = Ax + Bu
%%%% via a call like Xdot = deriv(X,U,A,B);
%% First approximation to the derivative
[Xdot1,acc,qbar,delalpha_... |
function f = fos( N, fs )
deltaf = fs/N;
if mod(N,2)==0
f=linspace(-fs/2, fs/2 - deltaf, N);
else
f=linspace(-(fs-deltaf)/2, (fs-deltaf)/2, N);
end
end
|
function [fFG,phi] = getFGOuter(formula, args, k)
global x u Z zLoop ZLoop bigM epsilon;
if length(args)>1
disp('GF takes a single argument')
return
end
% number of agents
N = length(x);
% number of states
I = size(x{1},1);
% time horizon
h = size(x{1},2)-1;
z = [];
fFG = [];
formulaOr = strcat('Or(', ...
... |
% Author: Xinshuo Weng
% Email: xinshuo.weng@gmail.com
function visualizeReprojection(mergedGraph, frames)
color_set = ['r', 'g', 'b', 'k', 'y', 'm', 'c', 'w'];
marker_set = ['o', '+', '*', '.', 'x', 's', 'd', '<', '>', 'p', 'h', 'none'];
color_index = 1;
vis_radius = 5;
marker_index = 1;
% marker_tmp
Str = m... |
function [vecRSSI,meanRSSI] = oneMeterCal()
% Method to calibrate the average RSSI signal from 1 meter distance
% Note: this loop is run everytime but it should be saved as a .mat file
% and just loaded as a single value
ourPath = 'C:\Users\cj836\Dropbox\MATLAB_DB\Scanned_Data\Pi_One\one_Meter_Data\';
%ourPath =... |
function [jtmargpot jtmess]=ShaferShenoy(jtpot,infostruct)
%SHAFERSHENOY Perform full round of Shafer Shenoy messages on a Junction Tree
% [jtmargpot jtmess]=ShaferShenoy(jtpot,infostruct)
%
% Perform (sum) messages for a JT specified with potentials jtpot. The distribution marginals are contained in
% the returned jtm... |
function [ H, inlier_ind ] = ransac_est_homography( y1, x1, y2, x2, thresh )
%RANSAC Summary of this function goes here
% Detailed explanation goes here
l = length(y1); %find number of features to match
some_ind = 1:l;
inlier_count_old = 0;
for i = 1:8000
rand_inds = ceil(rand(1, 4)*l);
y1_fit = y1(rand_in... |
function [] = plotPonceShettyIndices3DAridity(K_H,K_B,K_V,K_R,...
P_rescaled,V_p_rescaled,K,ID)
%PLOTPONCSHETTYINDICES3D
%
% INPUT
% K_H: Horton index
% K_B: baseflow fraction
% K_V: vaporisation fraction
% K_R: runoff fraction
% P_rescaled: rescaled precip
% V_rescaled: rescaled vaporisation limit
% K... |
%% Metadata
info = make_info(depid,'D4',depid(1:2),'jd')
info.dephist_deploy_method = 'suction cups' ; % or 'suction cups' if on a whal
info.dephist_deploy_locality = 'Massachusetts, USA' ;
info.project_name = 'SBNMS2019' ;
info = make_info(depid,'D4',depid(1:2),'bp');
info.project_name = 'ONR Tag Design';... |
function [] = Test_D_Gen_S(block,signal)
% Callback processing function for mask parameter
% - number of <Requirement name> used in the System
set_param(block, 'LinkStatus', 'none');
load_system('Simulink'); % Load Simulink library (background)
load_system('MIL_Test');
if signal < 0
No = str2double(get_param(... |
% integral from negative infinitiy to positive infinity
% Gaussian function: a*e^(-(x-b)^2)/(2c^2)
% parameters a, b, c are real constants, c>0
% a = alpha
% b = mu (expected value)
% c = sigma (variance)
var_s = 3;
alpha = 1/(var_s*sqrt(2*pi));
mu = 0;
sigma = sqrt(var_s);
dx = .1;
mux = -5;
muy = 5;
... |
function drawTarget(p, xy, bufferIdx)
% function drawTarget(p, x, y)
% draw simple calibration target (PLDAPS version)
%
% USAGE: pds.eyelink.cal.drawTarget(p, x, y)
% (previously pdsEyelinkDrawCalTarget.m)
% p: Pldaps structure/object
% x,y: position at which it should be drawn
%
% simple, standard eyelink versio... |
function [crop_descr] = random_crop(descr, crop_type, crop_ratio)
% return double
sampleAll_num = size(descr, 2);
sample_height = 32;
sample_width = 32;
% baboon = rgb2gray(imread('baboon.tif'));
panda = rgb2gray(imread('Panda.jpg'));
crop_descr = zeros(size(descr));
% descr = descr .* 255;
for i =... |
%% Class Definion of the Non-Negative Sparse AutoEncoder (NNSAE)
% The class defines fields that store model parameters and implements methods of the
% NNSAE. The NNSAE uses shared weights. The class is designed to be used with
% non-negative data distributions.
%
% HowTo use this class:
% - Preparations:
% 1) creat... |
clc,clear
interval_num=7;
overlapping_size=0;
folder_number=39;
for fnum=1:folder_number
if fnum<10
mkdir(strcat('YaleB_NRI_lbp\yaleB0',num2str(fnum)));
infolder_pathname=strcat('YaleB_NRI\yaleB0',num2str(fnum),'\');
else
mkdir(strcat('YaleB_NRI_lbp\yaleB',num2str(fnum)));
info... |
function s = SwigType(varargin)
s = strjoin(cellfun(@swig_typename_convertor_matlab2cpp,varargin,'UniformOutput',false),', ');
end
|
%% INIT
close all;
clear;
clc;
fig = 1;
load('wave.mat');
%% PROBLEM 5.2a Calculate estimate of PSD
s_freq = 10; %Hz
window = 4096;
noverlap = [];
nfft = [];
%Find estimated PSD. Converting input from deg to rad
[pxx, f] = pwelch(psi_w(2,:).*(pi/180), window, noverlap, nfft, s_freq);
%Converting re... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Name : <Sunny Patel>
% GT Email : <sunnypatel18@gmail.com>
% Homework : hw11
% Section : <B05>
% Collaboration: <place here one of the following:
% "I worked on the homework assignment alone, using
%... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2017 ROBOTIS CO., LTD.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.o... |
function c = mtimes(a,b)
% * Matrix multiply.
% C = MTIMES(A, B) or C = A*B multiples two matrices together.
% Mtimes is an inner product matrix multiply and assumes that A is row mapped and B is column mapped.
% If B is row mapped, it is remapped in order to perform the matrix multiplication.
%
% ... |
%/**
% Скрипт отрисовки графики для межсистемных помех
%*/
clear
close all
clc
path_to_ro = [pwd '/ro'];
path_to_results = [pwd '/results/back_intersystem_L3'];
path_to_pics = [pwd '/k_intersys/L3/BackGPS'];
load([path_to_results '/BackInterSysJam_BoCsin_L3_BoC_0_10.mat']);
load([path_to_results '/BackInterSysJam_B... |
function dz_dw = forwardstart(w,p,z,param)
%GAMPROD.FORWARDSTART Propagate derivative from weight to weighted input
% Copyright 2012-2015 The MathWorks, Inc.
[S,R] = size(w);
Q = size(p,2);
dz_dw = zeros(S,Q,S,R,'like',w);
pt = reshape(param.beta*p',1,Q,1,R);
for i=1:S
dz_dw(i,:,i,:) = pt;
end
end
|
function env=findenv(data,Fs,f)
start=find(data==max(data));
env=[];
env(1)=a(start);
i=start;
n=2;
per=floor(Fs/f);
while i<=length(t)-per
envi(n)=find(data==max(data(i:i+per)));
env(n)=a(envi(n));
n=n+1;
i=i+per;
end
env=10*log10(env);
end
|
%% -- ALGORITHM 6 -- %%
% - This algorithm calls the algo2 and algo5 for each image of the bank of images and extract his binary image and the number of fingers - %
%% -- DECLARATION OF VARIABLES -- %%
path_dataset1 = strcat(path_code,'/Dataset I/Images');
path_dataset2 = strcat(path_code,'/Dataset II/Images');
path_m... |
function saveData(fig,dig,BoxName,fontsize)
box=SMASH.MUI.Dialog('FontSize',fontsize);
box.Hidden=true;
box.Name=BoxName;
choices={'Digitizer file (*.h5)' 'Sandia Data Archive (*.sda)'};
format=addblock(box,'popup','Save format:',choices,20);
set(format(1),'Fontweight','bold');
set(format(2),'Callback',@changeFormat... |
function rgb = coral
rgb = [1.0, 0.49803, 0.31372];
end |
function [beta,signal_AF] = AF(CH_sr,POW_S,POW_N,signal_sr)
beta = sqrt( POW_S) / ( (abs(CH_sr))^2 * POW_S + POW_N ); % amplification factor保证中继节点功率受限
signal_AF = beta * signal_sr; % Relay transmit the AF signal 'signal_AF' |
classdef GroupConv < nnet.layer.Layer & nnet.layer.Formattable %(Optional)
properties %Proprietà del layer
OriginalLayer;
end
properties (Learnable) %Parametri learnable del layer
Net1;
Net2;
end
methods
%Costruttore
function self = GroupC... |
function rho_Diferencia = deltaDensidades(rho_aceite, rho_agua)
% deltaDensidades - Calcula la diferencia de densidades entre la densidad del agua y la densidad del aceite en gr/cm^3
%
% Syntax: rho_Diferencia = deltaDensidades(rho_aceite, rho_agua)
%
% rho_aceite se trata de la densidad del aceite y rho_agua se trata ... |
function isEqual = isFloatEqual(floatA, floatB, tolerance)
% Compares two floating point values to see if they are equal within the
% specified tolerance
if abs(floatA) > abs(floatB)
localMax = floatA;
localMin = floatB;
else
localMax = floatB;
localMin = floatA;
end
if nargin == 2
maxDif... |
function app = hist2Pix(app)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%unit 1
for i = 1:app.lenDay
if max(h) == 0
app.actoHistPix(i, :) = app.actoHist(i, :); % Pixel wise
else
app.actoHistPix(i, :) = ceil(app.actoHist(i, :) * app.BHP... |
function [m LoadGenMatch]=SeperateGenAndLoad(mpc1)
define_constants;
% Find the number of each component
NumGens=length(mpc1.gen(:,1));
LoadGenMatch=zeros(NumGens,2);
count=0; % keep track of number of generators
for i=1:length(mpc1.bus(:,1))
if(mpc1.... |
%Section 1.2
%Problem 7
%Define function
f= @(x) 2*x^5-7*x^4-3*x^3+25*x^2-23*x+6;
df= @(x) 10*x^4-28*x^3-9*x^2;+50*x-23;
%Newton
fprintf('Newton:\n')
%first solution
fprintf('first solution\n')
[xbest,~,nitr,~]=Newton(f,df,-2.1,10e-6,1000,0);
fprintf('Itr:%d x:%f \n', nitr, xbest)
%second solution
fprintf('second s... |
%% STEP1: load files
close all;clc;clear all;
addpath('toolbox');
addpath('tensorlab_2016-03-28');
% load mask, B0 map, T1 map, origin image: Slice 10,offsets
load('amidedata.mat');
% display T1 map
h1=figure(1);
set(gca,'Position',[0.05 0.05 0.9 0.9]);
T1_map(~mask)=0;
imagesc(T1_map,[0,1.5]);
title('T1 map (s)')... |
%% DEMO
clear all; clc; close all;
%% Consider all possible hypotheses
% define possible theta values for hypothesis
theta = 0:0.05:1;
%% Compute the likelihood term P(D|h) for each possible hypothesis
% define data
Nh = 3; % arbitrary, based on lecture
Nt = 2;
% define likelihood
likelihood = (the... |
function [sendData, receiveData] = parseSlaveLogs(slaveLogFilenames, totalNumFlows)
% constants
NUM_FIELDS = 3; % coflowID, hostID (aka slaveID), timestamp
% SendData : each row is coflowID, hostID (aka slaveID), timestamp
sendData = zeros(totalNumFlows, NUM_FIELDS);
sendnum = 1;
% ReceiveData : each row ... |
%Jake Tully 100904392
%
% TE Modes optical waveguide
% Nano particals on core
%Parameters
c = 299792458; % m/s
lambda = 1550*10^-9;
f = c/lambda;
up = lambda*f;
n1 = 1.45;
n2 = 1.44;
nm = 0.5 - 11i;
DelNeff = 10^-5;
Bo = (2*pi*1.447)/lambda;
epsilon1 = (8.8541878176*10^-12)*n1^2;
a =4.1*10^-6;
k = sqrt((up^2)/((n1^2-... |
#!/usr/bin/octave -qf
# Parameter processing
if (nargin != 1)
printf("Usage: multinomial.m <data_filename>");
exit(1)
end
load(argv(){1});
# Split data: 90% training, 10% test
[nrows, ncols] = size(data);
rand("seed", 23);
perm = randperm(nrows);
pdata = data(perm,:);
trper = 0.9;
ntr = floor(nrows * trper);
... |
filedirt1 = '/Users/chenrui/Desktop/BRATS2015/BRATS2015_Training/HGG_n4_slice/T1';
filedirt1c = '/Users/chenrui/Desktop/BRATS2015/BRATS2015_Training/HGG_n4_slice/T1c';
filedirt2 = '/Users/chenrui/Desktop/BRATS2015/BRATS2015_Training/HGG_n4_slice/T2';
filedirflair = '/Users/chenrui/Desktop/BRATS2015/BRATS2015_Training/H... |
function [xnoise] = AddNoise(x,noise, bias)
% Adds noise and bias to variable (can be vector)
% x = variable to add noise to (can be vector)
% noise = std deviation of noise to be added
% bias = std of bias to be added
%
% xnoise = new noisy signal
xnoise = zeros(1,length(x));
for k = 1:length(x)
xnoise(k)... |
function results = process_power_sweep(CAL, fn_pattern, whichT, etas, k_mode)
% plot atten sweep data
% CAL: optical data
% fn_pattern: atten sweep mat file name pattern
% etas: efficiencies
% whichT: 'roomT' or 'lowT'
% k_mode: which mechanical mode
% Modified from plot_atten_sweep
% WTJ, 20180907
if nargin < 4 || is... |
function [node, p]=discrete_sigmoid(netinput, temperature)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
E=exp(-2*netinput/temperature);
p=(E-1)/(E+1);
j=random('uniform', -1, 1);
if j> p
node=1;
else
node=-1;
end
end
|
function runSomethingAllFour(todo)
dirs = {'aviI';'aviII';'pop7II';'p2aII'};
for dd=1:numel(dirs)
DOIT(['../' dirs{dd}],todo);
end
end
function DOIT(dr,todo)
cd(dr);
addpath(genpath('./'));
eval(todo)
end
|
function demoDisplay
% This demo displays the generation of heart and also the possible re-shape and movement
% by Xin Zhao
% Feb 14, 2008
close all;
[x,y,z] = heart;
bottomZ = min(z(:));
radius = abs(bottomZ);
axis vis3d
axis off
daspect([1.6, 1, 1.875]);
hold on;
markerColor = [0.5, 0.5, 0.5];
line... |
function im_ = preprocess_image(filename, net_meta)
% preprocess image for ImageNet network
im = imread(filename) ;
% if grayscale, convert to RGB
if size(im,3) == 1
im = gray2rgb(im);
end
% resize image to size expected by network and convert to single
im_ = imresize(single(im), net_meta.normalizat... |
function [] = plotBivariateAuxiliaryVariable(x,y,x_str,y_str,...
z,z_str,ID,doPlot)
%PLOTBIVARIATEAUXILIARYVARIABLE Plots scatter plot of two variables and
% adds a third dimension by colouring the dots according to a third
% variable (could be extended to variable pairs...)
%
% INPUT
% x: variable 1
% y: ... |
%% handle 9 and 12 rules
clear all; clc;
load('almostAllRules.mat');
load('rawRules.mat');
n = 0;
while 1
n = n+1
for i=[9 12 1]
[lengthPart1,lengthPart2] = getLengthIndex(i,A);
tempLen = 0;
if lengthPart1 == 1
index1 = str2num(A(i,1));
... |
clear all; clc;
disp('Wczytywanie danych');
file_path = 'śmieci\Dawid-Durlak.wav';
size1 = wavread(file_path,'size')
[x,Fp]=wavread(file_path);
[Syg,Fp] = wavread(file_path,[1, 1]);
i=0;
poczatek=i*0.01*Fp +1;
koniec = (i+1)*0.01*Fp;
size2=0;
Syg2=[];
while koniec<size1(1)
Syg =wavread(file_path,[poczat... |
function [ model ] = Game4MDP(varrewards)
%%GAME4MDP Creates a model of the Game 4 from Kesh's second experiments
% if g is the gamma value and r is the variable reward (varrewards( then we ask matlab to solve:
% Long policy =>
% V(1) = 0 + g*V(2) - best action : pol(1)=1
% V(2) = 0 + g*V(3) - best action : pol(2)=... |
%% Add paths
%
addpath 'C:\Users\T Sikkens\Documents\MATLAB\fieldtrip-20160222';
% addpath(genpath('/home/lklaver1/scripts'));
addpath 'C:\Users\T Sikkens\Documents\MATLAB';
ft_defaults
%%
animalIDs = {'\1.31\'};
for iAnimal = 1:length(animalIDs)
%% config
% General settings for saving p... |
%% Introduction to Genetic Algorithms
% Oren Rosen
% The MathWorks
% 11/7/2007
%
% This script is for a brief introduction to the MATLAB environment
% and to introduce the concept of Genetic Algorithms using Rastrigin's
% function.
%% Intro to MATLAB 1
x = 2;
y = 3;
z = ras([x,y])
%% Intro to MATLAB 2
... |
function showCalibration(dig,fontsize)
%%
box=SMASH.MUI.Dialog('FontSize',fontsize);
box.Name='Digitizer calibration';
box.Hidden=true;
%%
N=numel(dig);
choice=cell(N,1);
for n=1:N
choice{n}=dig(n).Name;
end
Digitizer=addblock(box,'popup_button',{'Digitizer' ' Refresh '},choice,20);
set(Digitizer([1 end]),'Callba... |
function [neighbors, bCoords] = chooseConvHull(agentsIndex, agLoc)
% agentsIndex - index of agent in convex hull
% agLoc - array of all agents and anchors
search = 1;
cAgent = agLoc(:,agentsIndex);
while search
q = randi(length(agLoc),[1 3])
% q = [1 1 7]
% ~sum(diff([q q(1)]) == 0) || sum(q == ... |
%%
% This file contains an explanation of the difference between implicit and
% explicit time integration schemes. The content is intended for those who
% want to learn a bit more than what the ForwardandBackwardEulerExplorer
% GUI can offer.This file contains an explanation of the difference between
% implicit a... |
% HW06 Q1a Hermite Interpolation with monomial Basis------------------------------------------------------
clc;
clear;
set(0, 'defaultaxesfontsize',15,'defaultaxeslinewidth',1.5,...
'defaultlinelinewidth',1.5,'defaultpatchlinewidth',1.5,...
'defaulttextfontsize',15)
% calculate the coeff a_1...a_2n
V = ... |
% In response to neuron reviewer 1, comment about learning
function show_figure(figure_name)
switch figure_name
case 'corr_theory_HRR_theory_update__subj_1'
load(fullfile(get_mat_dir(false), 'corr_theory_HRR_theory_update.mat'));
EXPT = vgdl_expt;
glmodel = 102;
subj_id = 1;
... |
% function [obj2, trian_ch, trian_pr] = refine_mesh3(obj)
% Refone mesh obj
%
% New triangles:
% Tn, where n is the position within the parent triangle
% T1 replaces local vertex 3 =
% T2 replaces local vertex 1
% T3 replaces local vertex 2
function [obj2, trian_ch, trian_pr] = refine_mesh3(obj)
Nt = size(obj.trian... |
data_source= fullfile(pwd,'sqw','Data','Fe_ei200.sqw');
no_chkpnts='True';
pause on
Imax = 0.2;
peP1 = parWithCorrections([-0.325,-0.075,0,0.125,0.425;
137,15,0,15,155]);
peP1.cut_direction=[1,1,1];
peP1.dE =2;
peP1.dk =0.05;
peP2 = parWithCorrections([-0.3125,-0.0875,0,0.1375,0.3875;
131,15,0,15,153]);
peP... |
function [LH, probSpike, V, mean_predictedSpikes, RPE] = ott_RW_RPE_curr(startValues, spikeCounts, rewards, timeLocked)
% firing rate only correlates with current reward; no real learning happens
% reward is 0: mal, 1: suc, 2: water
slope = startValues(1);
intercept = startValues(2);
rho = startValues(3); % ho... |
function logP =...
logCPDSS2Step(dataset, nClusters, ClusterIDs, ClusterMembers,...
logparahat,diffusePrior)
%logCPDSS2Step returns the leave-one log conditional probability
% using dynamic state space model, see Guo and Landis (2017)
%Input:
% -dataset is subj-by-time data matrix.
% -nCluste... |
S = test_q;
[score(1),ind(1)] = max(sum(S));
for nn = 2:size(test_q)
S(ind(nn-1),:)=0;
S(:,ind(nn-1))=0;
[score(nn),ind(nn)] = max(sum(S));
end
for nn = 1:length(score)
S = zeros(size(test_q));
S(:,ind(1:nn)) = test_q(:,ind(1:nn));
S = S | S';
all_score(nn) = sum(sum(S))/sum(sum(test_q));
e... |
% Last Modified by GUIDE v2.5 23-Jan-2012 13:43:13
% Franz Zeilinger 23.01.2012
function varargout = Configuration_PV_Parameters(varargin)
% Beginn Initializationscode - NICHT EDITIEREN!
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
... |
function FAST_Features( Image )
imshow(Image);
hold on;
corners = detectFASTFeatures(rgb2gray(Image));
plot(corners);
end
|
time = 0:0.001:50;
[x,approx_x,a_hat,b_hat,Lyapunov] = parallel_multi;
figure('Name','Compare outputs','NumberTitle','off')
subplot(2,2,1)
plot(time,x(:,1),time,approx_x(:,1))
title('Comparison between $$x_1$$ and $$\hat{x_1}$$','Interpreter','Latex')
legend('Real Value','Estimated Value');
xlabel('Time [sec]');
subplo... |
function [ newCov,iW ] = TruncateAndRegularizeCovariance( Cov )
% needed method for wMNE computing
% This code was originally developped by Sahar Yassine and Ahmad Mheich based on the brainstorm toolbox codes
% (Tadel, F., Baillet, S., Mosher, J.C., Pantazis, D., Leahy, R.M., 2011.
% Brainstorm: A user-friendly appl... |
% Examples of Canonical Analysis of Principal Coordinates
%
% by David L. Jones, Feb-2011
%
% This file is part of the FATHOM Toolbox for Matlab and
% is released under the GNU General Public License, version 2.
%
% Apr-2011: updated
% Nov-2012: added Fisher's Iris data example
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%% Chirped transform
close all
N = 64;
L = 64;
w0 = 0.3*pi;
w1 = 0.35*pi;
n = (0:L-1).';
x = 2*cos(w0*n) + 2*cos(w1*n + pi/4);
x = x + sqrt(0)*randn(size(x));
dw = 2*pi/L;
w = -pi:dw:pi-dw;
y = x;
figure, box on, hold on
plot(w/pi, abs(fftshift(fft(y, N))).^2)
%
X = chirped_z_transform(x, exp(1j*pi*0.25), exp(-1... |
function linearODESSEP2X4Inactsub(T,I)
global d1 d2 d3 d4 d5 d6 k1 k2 k3 k4 k5 k6 H0 H1 H2 H3 H4 H5 g1 g2 E1 E2 delta epsilon mu A J V Acell p0 err Q;
%#codegen
generatorMatrixP2X4Inactsub();
Nt=length(T);
for i=1:Nt
p0=p0*expm(Q*T(i));
err=err+abs(Acell*10^12*(g1*(p0(4)+p0(5))*(V-E1))-I(i))^2;
end
end |
function [decoded] = ottendorf(pass,rowpos,colpos)
[row,col] = size(pass);
%finds the number of rows and columns of the given array
colpos1 = (colpos-1).*row;
%colpos1 is the actual value in the array minus row position is always
%increments of the number of rows. so what i did was take the column
%position and subtra... |
%cria um conjunto de bobinas sobre um sistema magmimo e mantem a distância
%constante
%savefile = salvar depois da execução?
%plotAnimation = mostrar a animação?
%evalMutualCoupling = calcular as interações das bobinas? (operação custosa)
%file = arquivo .mat para onde irão os ambientes
%d = distância
%M0 = matriz de ... |
%% same sfam
%
proteinARGs = cell(0);
proteinARGs{end+1} = GenerateProteinARG('test2-protein/test9/1aipD03.csv');
proteinARGs{end+1} = GenerateProteinARG('test2-protein/test9/1g3iU02.csv');
proteinARGs{end+1} = GenerateProteinARG('test2-protein/test9/1g4aF02.csv');
proteinARGs{end+1} = GenerateProteinARG('test2-protei... |
classdef Autoencoder < Gridjob
%AUTOENCODER This class implements a tiled convolutional denoising AE
% It inherits from Gridjob which lets it run on the sge cluster...
properties
tempsavepath
forwardRfSize
backwardRfSize
dimW1
dimW2
nghMat
randstreamStateBeforeEval
randst... |
function VE=tetVol(E,V)
X=V(:,1); Y=V(:,2); Z=V(:,3);
XE=X(E); YE=Y(E); ZE=Z(E);
A=[XE(:,1) YE(:,1) ZE(:,1)];
B=[XE(:,2) YE(:,2) ZE(:,2)];
C=[XE(:,3) YE(:,3) ZE(:,3)];
D=[XE(:,4) YE(:,4) ZE(:,4)];
VE=abs(dot((A-D),cross((B-D),(C-D),2),2))./6;
|
function [valid_update, poses, radii, change_indices] = apply_update(poses, blocks, radii, delta, D)
valid_update = false;
num_poses = length(poses);
num_centers = length(poses{1}.centers);
count = 0;
while (valid_update == false && count < 1)
%% Update
count = count + 1;
[poses, new_radii] = update(poses,... |
function WriteFile(object,fileID)
%fprintf(fileID,'%8s %8s\n','x','exp(x)');
%fprintf(fileID,'%8.8f %8.8f\n',A);
fprintf(fileID,' Root is %f\r\n',object.root);
fprintf(fileID,'\r\n');
fprintf(fileID,' Time is : %f\r\n',object.ExTime);
fprintf(fileID,'\r\n');
fprintf(file... |
function [XC,YC,R,fm] = circCentSteerable(X,Y,S,SO,niters)
xc = zeros(niters,1);
yc = zeros(niters,1);
w = zeros(niters,1);
npts = numel(S);
iters = 0;
while iters<niters
%for j=1:niters
randidx = randperm(npts);
m1 = tan(SO(randidx(1)));
m2 = tan(SO(randidx(2)));
if (m1~=m2)
ite... |
% Map each pixel in the image to its closest word in the dictionary
function [wordMap] = getVisualWords(I, filterBank, dictionary)
[m, n, ~] = size(I);
I = im2double(I); % 320*214*3
[filterResponses] = extractFilterResponses(I, filterBank);
filterResponses = reshape(filterResponses, [], 3*size(filterBank,1)); % 68484*6... |
%% Read File
%
mdf = AWRLPmdf;
% mdf.debug = true;
if ~mdf.load("LP_Data_L1_Dev.mdf")
displ("ERROR: ", mdf.msg)
return;
end
%% Show some data
%
displ(mdf.str());
mdf.showBlock(1);
b1 = mdf.bdata{1};
%% Plot Harmonics
%
a2s = [];
b2s = [];
for idx = 1:length(mdf.bdata)
aidx = mdf.bdataIndex("a2(3)");
bidx =... |
function tls_bts
% TLS BTS transfer line
% Created by F.H. Tseng 2010/09/30
global FAMLIST THERING GLOBVAL
GLOBVAL.E0 = 1.5e9; % Energy = 0.15e9;
FAMLIST = cell(0);
TB1L = rbend('BM', 0.5655, -0.078539816, 0, 0, 0.0, 'BendLinearPass');
TB1R = rbend('BM', 0.5655, -0.078539816, 0, 0, 0.0, 'BendLinearPass');
TB2L = rbe... |
clear all
close all; close all hidden;
clc
%% Raw data loading
timestamps_struct = load('timestamps.mat');
%file_data = uigetfile('*.txt')
surp_data = dlmread('../output/surprisal_data_prob2020-03-12.txt');
timestamps = timestamps_struct.timestamps;
durations = timestamps_struct.durations;
freq = timestamps_struct.... |
%
% En passant à Octave, les Énumération ne sont pas supportées
% Temporairement, nous utiliserons ces classes pour contourner cette lacune.
%
classdef CEOnOffOctave < CETypeLogical
%--------------------------------------------------------------
% Comme on a pas d'énumération, on aura une classe "ordinaire"
% av... |
%限定完成时间求最低感知度(在不超过时间T)
global D C W Y
load('data.mat')
D = d; C = c; W = w;
n = size(D,1) + size(C,1) - 1;
YY = [];
for Y =400:20:580
options = optimoptions('ga','PopulationSize',100,'MaxGenerations',100);%,'MaxStallGenerations',100);
[x,y] = ga(@f12,n,[],[],[],[],zeros(1,n),ones(1,n),[],options);
YY ... |
% This is the original func using ADMM_TV method to generate the correlation matrix
% Y : the data with missing entries
% data_orig : the original data
% idx_known : the idx of the known entries
% opts : the parameters
function out = ADMM_TV_v0(Y,data_orig,idx_known,opts)
tol_thr = opts.tol;
maxiter = opts.maxiter;... |
function active_plot(handles)
val(1) = get(handles.popupmenu2,'Value');
val(2) = get(handles.popupmenu3,'Value');
data_val = val;
cla(handles.axes1)
if val(1) ~= 1 && val(2) ==1
% Plot A Histogram of the Data
hist(handles.axes1,[handles.to_plot{:,data_val(1)}]');
temp = get(handles.popupmenu3,'String')... |
clc;
clear;
close all;
%% set arguments
N = 8; %set number of quantization bits
n = 7;
k = 4;
snr_array = [-20:20];
snr = 10;
%% command create
[cmd, fs] = commandCreate();
%% quantize
[q_out, q] = quantize(cmd, fs, N);
%% souce encode with Huffman code
[senc_out, dict] = source_encode(q_out, N);
... |
%% Project arbeit "Model Order Reduction of LPV systems"
% Author:Sandeep Parameshwara, MSc. Mechatronics
% Mentor: Lennart Heeren, Institute of Control Systems, TUHH
clear;
thisdate = datestr(now, 'yyyy-mm-dd_HH-MM');
%% define system parameters and form the PSS object.
k0=0.5; krho=0.3;
% Assumption: all parameters... |
% ----------------------------------------------------------------------
% input: in_height x in_width x num_channels x batch_size
% output: out_height x out_width x num_filters x batch_size
% hyper parameters: (stride, padding for further work)
% params.W: filter_height x filter_width x filter_depth x num_filters
% pa... |
function [x, y] = polynomial_interpolate(x, wartosci, n, wezly)
n = n+1;
A = [];
for i=1:length(wezly)
for j=1:n
A(i,j) = sum(wezly.^(i+j-2));
end
end
B = [];
for i=1:length(wezly)
B(i) = sum((wartosci) .* (wezly.^(i-1)));
end
X = A\(B');
... |
% Hook function:
function stop = SDisp(sol,fit,pop,fits)
% Display the number of bits:
disp(sprintf('Actual max bits: %d',fit));
% Returning:
stop = fit==32;
|
%==============================================================
% Copyright(c) 2015, Lei Wu lei_wu@fudan.edu.cn
% Shape Based Object Representation and Detection Algorithm
%==============================================================
% 搜集当前物体检测假设下模板线段的证据线段
function [index_cell, total_dist] = proofs(tmpt_lines, test_... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty:... |
function [ dNdt ] = propagatemodel( bangtime, temperature , t, options)
%
% Inputs: bangtime - estimated neutron bangtime in seconds
% temperature - ion temperature in keV
% options - structure containing various other information
% Detector - label determining which nTOF location to... |
%function for plotting the flow and the velocity of the flow at different
%points
function [] = plot_animate(paout,vaout,uout,tout)
global l
%work out heigts of the flow along
pmin=min(min(paout));
pmax=max(max(paout));
x=[pmin-10:0.01:pmax+10];
[e,~]=size(paout);
figure;
for i=1:e
pall1=paout(i,:);
pal... |
% 2018.09.22 - set path for the BirdVox-Imitations project
function [dir_data] = BVI_path()
dir_code='C:\Users\User\Documents\MATLAB\Projects\birdsongQBH';
dir_data='F:\0.birdsongQBH\audio\Zenodo-data-release\BirdVox-imitation_mat-audio'; %external harddrive
addpath(genpath(dir_data))
addpath(genpath(dir_code))
end
|
classdef gmlLinearReg < gmlModel
%GMLLINEARREG Summary of this class goes here
% Detailed explanation goes here
%% properties
% basic information
properties (SetAccess = protected)
name = 'Linear Regression';
nameAbb = 'gmlLinearReg';
end
% static flag
properties (SetAcc... |
function [ps_k,ks,as_k,bs_k,f_a,f_b,f_pks,p_k,f_pk] = localizacion_raiz(f,a,b,N,Tol)
%Vectores para la tabla
ps_k = []; %Vector con los valores de P_k
ks = []; %Vector con el número de las iteraciones
as_k = []; %vector de los valores de a en cada iteración
bs_k = []; % vector de los valores de b en cada iterac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.