text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu % ... |
clc
C = (1:100)' ;
R = (2/sqrt(3))*C + 0.5*(sqrt(3)-1) ;
sortrows( [ round(R) , C , mod(R,1) ] , [3,1,2] ) |
% This script creates the model workspace &
% sets parameters that define the geometry of the robot
Nsegs = 8; % Number of links before tailfin
L_tot = 50.0; % (cm)
L = L_tot/Nsegs; % (cm) Segment length
R = 0.05; % (cm) Radius of joints
W = 0.8; % (cm) Width scale factor, scales body width
% In... |
% Code developped on MATLAB 2019_b by Group 61
% Based on the initial code for course SC42050's practical assignment
clc
clearvars
close all
% MAKE SURE TO CD THE PARENT FOLDER OF ANN
addpath(genpath(pwd))
%% GENERATE TRAINING DATA
% Train on rotational velocitites from 70 to 80 deg/s
rot_vel = [70:1:80];
% For b... |
function [pts2 tri2 mindist] = closestPoint(Filename1, Filename2)
[pts1, tri1] = VTKPolyDataReader(Filename1);
pts1 = pts1.';
[pts2, tri2] = VTKPolyDataReader(Filename2);
pts2 = pts2.';
tri1 = zeros(size(pts2,2),2);
tri1(:,1) = (1:size(pts2,2)).';
ptsClosestPoint = zeros(3,size(pts2,2)*2);
ptsClosestPoi... |
function [nx,index] = dc_ordering(y,x)
[n,p]=size(x);
for i=1:p
[temp,dc(i)]=DistCorrVec(x(:,i),y);
end
[a,index]=sort(dc);
nx=x(:,index);
|
function listenDispSecFreqs(src,~,main_figure)
curr_disp=get_esp3_prop('curr_disp');
layer=get_current_layer();
if isempty(layer)
return;
end
switch curr_disp.DispSecFreqs
case 1
switch src.Name
case 'DispSecFreqsOr'
load_secondary_freq_win(main_figure,1);
othe... |
clear all;
net = newff([-10 10],[4 1],{'tansig','purelin'}); %创建一个BP网络
p = [-10 -5 0 5 10];
t = [0 0 1 1 1];
disp('网络仿真值:')
y = sim(net,p)
disp('绝对误差值:')
e = t-y
disp('均方误差性能:')
perf = mse(e)
|
function [s, residual] = OLS(A, y, m, err)
% Orthogonal Least Squares [1] for Sparse Signal Reconstruction
% Input
% A = N X d dimensional measurment matrix
% y = N dimensional observation vector
% m = sparsity of the underlying signal
% Output
% s = estimated sparse signal
% r = residual
% [1] T. Blu... |
function imgflat = getbraincontour_lat
% Default
[~,img,~,~,p,fname] = getdefimg;
%% Data
pa_datadir;
load('petancova')
% [roi,uroi,nroi] = getroi(data);
%% Get roi
roifiles = [data.roi];
nroi = numel(roifiles);
img = roicolourise(p,fname,roifiles,zeros(size(img)));
%%
[m1,m2,m3] = size(img);
i... |
function bankstr = gs3bank(banknum)
if nargin ~= 1
error('gs3bank: invalid input argument');
end
if ~between(banknum, 1, 24)
error('gs3bank: bank number out of bounds (1-24)');
end
if banknum < 10
bankstr = sprintf('0%d', banknum);
else
bankstr = sprintf('%d', banknum);
end
|
% Construct Sparse-Coding Based Prior of Natural Color Images
%% Sample from the ILSVRC image dataset
% Path to the dataset
dropbox = false;
if dropbox
dataBaseDir = getpref('ISETImagePipeline', 'dataDir');
files = dir(fullfile(dataBaseDir, 'ILSVRC_train', '*.JPEG'));
else
% Special case for the Simons ser... |
%Andrew Brown Homework 2 Problem 1
clc
clear
clf
%Practice plotting arrays with function.
t=-10:0.004:7;
y=(4*t.^3)+(3*t.^2)+(5*t)+5;
plot(t,y,'b')
xlabel('Time (seconds)')
ylabel('Distance (meters)')
title('Self-Check: Time vs. Distance')
fprintf('Minimum occurs at y = %0.3f, maximum occurs at y = %0.3f\n', min(... |
function twinkle(handle, times, interval)
NumArgIn = nargin;
if NumArgIn < 2
times = 3;
interval = 0.2;
elseif NumArgIn < 3
interval = 0.2;
end
for ii = 1 : times
set(handle, 'Visible', 'off');
pause(interval / 2);
set(handle, 'Visible', 'on');
pause(interval / 2);
end |
function [tout, yout, abw, schrittw, Erhaltung] = RKeing(fun,tspan,t0,y0,h0,epsilon,Steuerung)
N = (tspan(2)-tspan(1))/h0;
sec = 0.9;
a = 10;
h = h0;
y(1,:) = y0;
abw(1) = 0;
n = 1;
t(n) = t0 + h * (n-1);
schrittw(1)=h0;
Erhaltung(1)=y(1,1) + a*y(1,2) + log(y(1,1)) + a*log(y(1,2));
while (t(n) < tspan(2))
akzeptie... |
inputLayer = imageInputLayer([64 64 1]);
filterSize = [5 5];
numFilters = 32;
middleLayers = [
convolution2dLayer(filterSize,numFilters,'Padding',2)
reluLayer()
maxPooling2dLayer(3,'Stride',2)
convolution2dLayer(filterSize,numFilters,'Padding',2)
reluLayer()
averagePooling2dLayer(3, 'Stride',2)
convolution2d... |
clear all;
clc;
C = imread("Density100.png");
imshow(C)
BW = rgb2gray(C)
figure,imshow(BW) |
function plotCI(data, m1, s1, ci1, m2, s2, ci2)
% plotCI(data, m1, s1, mci1, m2, s2, mci2)
% Plot profiles, average profiles, and confidence intervals
%
% Input:
% data - historical energy usage data
% m1 - mean daily profile
% s1 - standard deviation of daily profile
% ci1 - 95% confidence interv... |
function [s,parm] = chaosSequence(N, stype)
%CHAOSSEQUENCE 混沌置乱序列生成器
if(nargin < 2)
stype = 'cheby';
end
s = zeros(N,1);
if(strcmpi(stype, 'cheby'))
s(1) = rand(1) * 2 - 1;
parm = {5};
for iter = 2:N
s(iter) = cos(parm{1} * acos(s(iter-1)));
end
end
end |
function create_xor(fname_out, n)
%creates dataset (Xtrain/Xtest/...) with xor problem;
% n is number of datapoints per quadrant
Xtrain = normrnd(1, 0.1, 4*n, 2);
Xtrain(n+1:2*n, :) = - Xtrain(n+1:2*n, :);
Xtrain(2*n+1:3*n, 1) = - Xtrain(2*n+1:3*n, 1);
Xtrain(3*n+1:4*n, 2) = - Xtrain(3*n+1:4*n, 2);
Ytrain = ones(n*... |
function varargout = gui(varargin)
% GUI MATLAB code for gui.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
clc; clear; close all
pkg load image
A = imread('files/linea1.jpg');
% Convertirla a Binaria
B = im2double(A);
B(B < 0.5) = 0; B(B >= 0.5) = 1;
imshow(B);
% Calsular la discretizacion angulo y p
h1 = 1; % Paso entre los angulos
angulos = deg2rad(0:h1:180);
[m, n] = size(B);
d = sqrt(m^2 + n^2);
h2 = 1; % Paso entre... |
function [ xnew, iter, error, energy ] = recall_update_energy_allowerror( w, xtest, patterns, sequential )
iter = 0;
curr_error = 999;
error = [];
energy = [];
maxIter=500;
xnew = xtest;
N = size(xtest,2);
numPattern = size(patterns,1);
while(curr_error > 0 && iter < maxIter)
... |
%% Node object
% Represents discretized 2D space control volume
% Nodes are updated each time step of the simulation
classdef Node < handle
properties
P % 2x1 (x,y)' coordinates: m
T % temperature: C
E % stored energy: J
Material % mater... |
function [metric, output_log] = train_mcml(images, labels, parms)
%
%
%
[mcml_trw,parms] = take_from_struct(parms,'mcml_trw', 0);
[mcml_ini_fact,parms] = take_from_struct(parms,'mcml_ini_fact', 1e-5);
[mcml_b_sqrt,parms] = take_from_struct(parms,'mcml_b_sqrt', 0);
[mcml_b_norm_grad,parms] = take_from_stru... |
%@(#) savesubset.m 1.3 97/10/31 10:50:19
%
%function savesubset(infil,utfil,ifilt);
function savesubset(infil,utfil,ifilt);
load(infil)
kinf=kinf(ifilt);
lastcyc=lastcyc(ifilt);
burnup=burnup(ifilt);
BUSYM=BUSYM(ifilt,:);
BUNTYP=BUNTYP(ifilt,:);
OLDTYP=OLDTYP(ifilt,:);
CHTYP=CHTYP(ifilt);
NCHTYP=NCHTYP(ifilt);... |
% positionsPath - path containing the position hemicube images
% luminarePath - path containing the luminarie .matlab files
%function [emision selectedLuminary positionsAux res totalTime] = optimizeLuminariesN(cantIter, problemObj, restrictionObj, luminarieObj)
res = ones(1, 4 + (problemObj.nvars - 1) * problemOb... |
%Script for generating a polynomial for training the net.
x = linspace(-4*pi, 4*pi, 500);
y = x.^3 + 150*randn(size(x)); %cubic polynomial with gaussian noise.
% y = sin(x) +0.2*randn(size(x));
%scale between 0-1
x = data_scale(x, 0, 1.0);
y = data_scale(y, 0, 1.0);
% plot(x, y);
data = cell(length(x), 2);
for i=... |
%%% TESTES ESTIMADOR DFT-PRONY
clc
clear all
close all
set(0, 'defaultAxesFontSize',12);
set(0, 'defaultAxesFontName','times');
% ---------------------------------------------------------------------
% INICIALIZAÇÕES
N = 256; % número de amostras
m = 256; % passo de janelamento
Fs = 12800; % Taxa... |
% PHY.m - Main layer 1 code
%
% Copyright (C) 2013 Integrated System Laboratory ETHZ (SharperEDGE Team)
%
% 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 ... |
function [x1, fmin]=cplex_modiclus(v,tol)
% CPLEX_MODICLUS computes the modiclus of game v using cplexmex.
%
% http://www-01.ibm.com/software/websphere/ilog/
% (compatible with CPLEX Version 12.10.0 and higher)
%
% Source: H. I. Meinhardt. The Modiclus Reconsidered. Technical report, Karlsruhe Institute of Technology... |
function [A, wg] = GenerateConsistentMatrix(dimension)
A = ones(dimension);
wg = rand([dimension, 1]);
wg = wg./sum(wg);
for i = 1:1:dimension
% for j = 1:1:dimension
% A(i, j) = v(i)/v(j);
% end
% TODO: Consider another method
for j = (i + 1):1:dimension
... |
function output = CCA_OUT(CCA_Result)
% Translate CCA result to CCA detection output
switch length(size(CCA_Result))
case 1
[~, output] = max(CCA_Result);
case 2
[~, output] = max(CCA_Result,[], 2);
otherwise
error("Expected vector or 2D matrix");
... |
function dx = highway_mid(tdummy,in2,udummy)
%HIGHWAY_MID
% DX = HIGHWAY_MID(TDUMMY,IN2,UDUMMY)
% This function was generated by the Symbolic Math Toolbox version 8.5.
% 27-Jul-2020 12:15:03
k_pk = in2(3,:);
kh = in2(5,:);
kv = in2(4,:);
ky = in2(6,:);
t2 = in2(7,:);
t3 = sin(kh);
t4 = t2+2.0;
dx = [k_pk-k_p... |
function process_tex(output_path, file_name)
% Finds and processes the requested tex file in the output path.
%
% example: process_tex(output_path, file_name)
old_path = pwd;
cd(output_path)
fprintf(['Processing latex file. ', output_path, '/',file_name])
latex_cmd = 'latex -etex -interaction nonstopmode -halt-on-error... |
function XYZ=i_luv2xyz(Luv,IllObs)
%I_LUV2XYZ Convert from Luv to XYZ.
% XYZ=I_LUV2XYZ(LUV,CWF) with size(LUV)=[M 3] returns
% matrix XYZ with same size.
%
% CWF is a color weighting function specification. It can be a
% string, e.g. 'D50/2', or a struct, see MAKECWF. If empty, the
% the default cwf, O... |
% Computes motion vectors using Diamond Search method
%
% Based on the paper by Shan Zhu, and Kai-Kuang Ma
% IEEE Trans. on Image Processing
% Volume 9, Number 2, February 2000 : Pages 287:290
%
% Input
% imgP : The image for which we want to find motion vectors
% imgI : The reference image
% mbSize : Size of th... |
function plot_fdEITmodel(img_diff, title_, save_fig,name,fname)
% img(hp_num).show_phase_contour_slice.abs_clim = 0.1;
% img(hp_num).show_phase_contour_slice.abs_ref = 0.1;
% %img(hp_num).show_phase_contour_slice.abs_clim = 100;
% %img(hp_num).show_phase_contour_slice.abs_ref = 50;
% img(hp_num... |
function [lindata, varargout] = atlinopt(RING,dp,varargin)
%ATLINOPT Performs 4D linear analysis of the COUPLED lattices
%
%ATLINOPT only works for CONSTANT energy. So no PassMethod should:
% 1. change the longitudinal momentum dP (cavities, magnets with radiation)
% 2. have any time dependence (localized impedance... |
function [r,inds_k] = inrad_hull_k_sat(x_np,K,c_p,t_kp)
x_np = bsxfun(@minus,x_np,c_p);
dots_nk = x_np * t_kp';
[inds_k,r] = mysfo_saturate(@(inds) max(dots_nk(inds,:),[],1),1:size(x_np,1),K);
|
function rot_mat = rot_y(ang)
rot_mat = [cos(ang) 0 -sin(ang);0 1 0; sin(ang) 0 cos(ang)];
end |
classdef agent2048 < handle
%UNTITLED3 Summary of this class goes here
% Detailed explanation goes here
properties
isModelBased
valueNet
valueNetTrainOptions
valueNetType
modelNet
modelNetTrainOptions
modelNetType
nStateVars
nAct... |
function SIE = enthalpyToSIE(enthalpy)
SIE = -enthalpy(1,:) - 18; % only transform the first component!
|
function lightshow(cs)
% turn all off
writeDigitalPin(cs.a, cs.bulb.red, 0);
writeDigitalPin(cs.a, cs.bulb.green, 0);
writeDigitalPin(cs.a, cs.bulb.blue, 0);
% test
writeDigitalPin(cs.a, cs.bulb.red, 1);
pause(0.1);
writeDigitalPin(cs.a, cs.bulb.green, 1);
pause(0.1);
writeDigitalPin(cs.a, cs.bulb.blue, 1);
pause(0.1... |
function searchstructure_instance = compute_feature_structure(searchstructure_instance,session_instance,knowledge_instance)
feature_structure.names = {};
feature_structure.positions = [];
feature_structure.matrix = [];
feature_structure.neutral_element = NaN;
feature_structure.knowledge_indices = [];
feature_structure... |
function [a, w, alist, wlist, confusion, failurerate] = main(C, x, y, algo)
% MAIN Trains/tests SVM on data
% [a, w, alist, wlist, confusion, failurerate] = main(C, x, y,
% algo)
% Returns dual and primal solutions for data x, y.
% algo = 0 : uses Newton's method
% algo = 1 : uses Coordinate Descent
% algo = 2 : uses ... |
% Daniel Runcie
%
% Gibbs sampler for genetic covariance estimation based on mixed effects
% model, with missing data
%
% Modified for Mark Blows to add another hierarchical level with
% transcripts nested within probes, and all covariances modeled at the
% transcript level.
%
% Based on:
%
% Runcie and Muk... |
function showDOETable(Table,colheads)
%SHOWDOETABLE Display a DOE Table.
% SHOWDOETABLE displays a DOE Table in the Figure Window.
%
% SHOWDOETABLE(Table,colheads) displays a table with column names in cell
% array COLHEADS.
%
% See also statdisptable
% Create cell array version of table
atab = num2cel... |
%*******************************************************************************
%* Program: init_RJ3a.m
%* Description: Inititialization file for problem 3a [1].
%* Author: Andrew Kercher
%* References:
%* [1] Ryu, D. and Jones, T. W., "Numerical Magnetohydrodynamics in
%* Astrophysics: Algorith... |
function [y,x] = f_Runge_kutta_3(f,a,b,yin,N)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
h = (b-a)/N;
x = a:h:b;
y(1) = yin;
for i = 1:length(x)-1
k1 = f( x(i), y(i) );
k2 = f( x(i)+(h/2), y(i)+(h/2)*k1 );
k3 = f( x(i)+ h, y(i)- h*k1 + 2*h*k2 );
y(i+1) = y(i)+ (h*(k... |
% Load splat which adds y and Fs to the workspace
load splat
% Call echo_gen to create the new audio data
output = echo_gen(y, Fs, 0.25, 0.6);
% Create a time axis. The time between points is 1/Fs;
dt = 1/Fs;
t = 0:dt:dt*(length(output)-1);
% Plot the new data to see visualize the echo
plot(t, output)
% sound (output... |
function num = match3(im1, im2,des1,des2,loc1,loc2,method,neigh,need)
distRatio = 0.3;
% For each descriptor in the first image, select its match to second image.
if method =='lowe'
des2t = des2'; % Precompute matrix transpose
for i = 1 : size(des1,1)
dotprods = des1(i,:) * des2t; ... |
%% triMeshEquilateral
% Below is a demonstration of the features of the |triMeshEquilateral| function
%%
clear; close all; clc;
%%
% PLOT SETTINGS
fig_color='w'; fig_colordef='white';
font_size=20;
cmap=gray(250);
falpha=1;
patch_types={'sx','sy','sz','v'};
ptype=3;
no_slices=4;
mark_siz1=25;
mark_si... |
% Autores: Jorgeluis Guerra
% Luis Braga
% Saulo Alves
% Funcao wrapper que insere o algoritmo do A estrela dentro do modelo do
% robo
function [x, y] = wrapper_a_star(grid, start, goal)
% Valor 'infinito'
INF = 100000;
% Limites do grid de celulas
GRID_MIN = 1;
GRID_MAX = 5;
sta... |
close all;
clear;
clc;
pkg load signal;
Np = 1e5; % numero de pulsos
%data = [-1 -1 1 1 1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 1];
%Np = numel(data);
%en_db = 15; % Ruido em db
data = round(round(rand(1, Np))-0.5);
fs = 10e3; % freq amostragem em Hz
Tb = 10e-3; % tempo de bit em segundo
k = 4; % duracao do pulso g... |
function [ str_cell ] = cutby( str,intv )
%to cut a string by intv cutby(str,intv);
l=length(str);m=length(intv);str_cell=cell(0,0);count=0;pre=1;
for i=1:l-m+1
if strcmp(intv,str(i:i+m-1))
if pre<=i-1
count=count+1;
str_cell{count,1}=str(pre:i-1);
end
... |
function DupdateK=Bayesian_Clement_2(hypps,N,clfx,clfy,...
oldfolder,ytrue,alpha,suni,model)
parfor i=1:N
aa=(hypps(:,i));
aa=reshape(aa,[],suni)
spit=abs((Forwarding(aa,clfx,clfy,oldfolder,model)));
spit=reshape(spit,[],1);
Sim(:,i)=spit;
end
[DupdateK] = ESMDA (hypps,reshape(ytrue,[],1), N, Sim,al... |
function [ outT, outX, outVal, outGr, evalNumbers] = MoreThuente(functionName, params)
% ------------------ ******************* ------------------
% * *
% * ************************************* *
% * ... |
function [iS, i0, i0Threshold] = batchScatteredRayleigh_iZero(np,iThreshold,iZero,theta,R,lambda,indref,d,iMin,iMax,iStep,dispMode,saveMode)
figNum = 1;
d=d*1.e-9;
lambda=lambda*1.e-9;
theta=theta*pi/180;
maxSteps = int64((iMax-iMin)/iStep+1);
iS=zeros(1,maxSteps);
i0=iMin:iStep:iMax;
for i=1:maxSteps
iS(i)=scatte... |
function m = SymmetricRandMatrix(n)
%SYMMETRICRANDMATRIX Summary of this function goes here
% Detailed explanation goes here
mDir = triu(rand(n));
m = mDir + tril(mDir',-1);
end
|
% 15.7.02
%
% Unscented Kalman Filter (UKF) applied to FitzHugh-Nagumo neuron dynamics.
% Voltage observed, currents and inputs estimated.
%
% FitzHughNagumo() is the main program and calls the other programs.
%
% A detailed description is provided in
% H.U. Voss, J. Timmer & J. Kurths, Nonlinear dynamical system id... |
function [neigh_fractureID, neigh_matrixID] = fracture_matrix_fracture(ID_fracture, line_ID, pairs, tri_nodes)
% Find neighbor of fracture: matrices and fractures
ifmf = find(line_ID==ID_fracture);
a = pairs(ifmf,:);
% Fracture-matrix
ab1 = find(tri_nodes(:,1)==a(1));
ab2 = find(tri_nodes(:,2)==a(1));
ab3 = find(tri_... |
% BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
% FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
% OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
% PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
% OR IMPLIED, INCLUDING,... |
function allHotspotCircles(hotspotmapList)
% analyze inhibition is circule around the hotspot for all maps
% extract the lp structure for a subset of experiments
allChange=[];
removeSpots=[];
for i=1:length(hotspotmapList) %[1 3 6 10 13 14 16:27]
lp=hotspotmapList{i}.lp;
[allChange(end+1).percentOfR... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
function J = CB6r2_J(Met,Jmethod)
% function J = CB6r2_J(Met,Jmethod)
% Calculates photolysis frequencies for CB06r2.
%
% INPUTS:
% Met: structure containing required meteorological constraints. Required vars depend on Jmethod.
% Met.SZA: solar zenith angle in degrees
% Met.ALT: altitude, meters
% ... |
function [speedLimit] = dp_preveh(tbl,vect,pre,egv,ns)
% [speedLimit] = DP_PREVEH(tbl,vect,pre,egv,ns)
%
% This function makes the EGV stay behind a preceding vehicle.
%
%
% -------------------------------------------------------------------------
% ------------------------------- INPUTS -------------------------------... |
%% Preference 1 F78 Repeat 1 with restart
%Composite2_MCcrop
%First ROI : makeOval(57, 125, 55, 52);
window_baseline=21;
window_smooth=7;
Pref1=[];
Pref1b=[];
Prev1c=[];
DF=DeltaF2(Pref1(:,2:3)',window_baseline,window_smooth);
DF_norm=DF;
for i=1:size(DF,1)
DF_norm(i,:)=DF(i,:)/max(abs(DF(i,:)));
end
%figure;plot... |
function plotEdgelets(edgelets,color)
for i=1:length(edgelets)
%if abs(edgelets(i).theta)>10, continue;end;
vPts = [edgelets(i).vPts_un];
if isempty(vPts), continue; end;
plot(vPts(1,:), vPts(2,:), 'Color', color, 'Line... |
classdef (Hidden, Sealed) AggregationStrategyLimited < amg.coarse.AggregationStrategyStagewise
%ABSTRACTAGGREGATOR Aggregation up to a prescribed coarsening ratio.
% This implementation selects the coarse level by constructing a set
% of increasingly-dense tentative coarse sets, gradually decreasing
... |
function [f0,f1,f2,f3,allf0,allf1,allf2,allf3] = feature_extraction(x, fs)
%% Inisialisasi
len_sig = length(x);
N = 30;
M = 20;
nsampel = round(N * fs / 1000); % merubah dari milidetik ke nomor segmen
noverlap = round(M * fs / 1000); % merubah dari milidetik ke nomor segmen
%% Melakukan Fra... |
% Multioutput SVR
% We have m labeled examples, d dimensions and k outputs to predict.
% inputs: - x : training patterns (m x d),
% - y : training targets (m x k),
% - ker : kernel type ('lin', 'poly', 'rbf'),
% - C : cost parameter,
% - par : kernel parameter (see func... |
stims = {'rat','male','toy','USS','tone'};
labels = 1:length(stims);
nstim = length(stims);
exset = [1 3 4 5 7];
nTr = 6;
decodeFromPeak = 0;
clear guess;
for ex = exset
disp(ex)
means = [];rMat=[];
clear resps;
% for each mouse, compute stim-evoked responses for each trial on each
% da... |
function res = BK_4OrientMincut(posWeights, north, northwest, west, southwest)
%% Normalize the unary weights
posWeights = posWeights - min(posWeights(:));
posWeights = posWeights ./ max(posWeights(:));
%% The unary background weights are just the inverse
negWeights = max(0, 1-posWeights);
%% Reshape the unary... |
function ...
[ aafTrainingFeatures, aiTrainingClasses, ...
aafTestFeatures, aiTestClasses ] = ...
GetTrainingAndTestSets( ...
tSVMTrainer, ...
fTrainingVsTestSetDimensionsRatio )
%
% for readability
iNumberOfEvents = numel( tSVMTrainer.atEvents );
%
% return if... |
function [autocorr_val, shiftedMeanModel, meanModel] = plotPlaceFields_V1CA1(model, thres)
EV = nanmean(model.EV,1);
if nargin<2
cellList = true(size(nanmean(model.EV,1)));
else
cellList = EV>thres;
end
sortOrNot = 1;
cellIDs = 1:length(cellList);
cellIDs = cellIDs(cellList);
meanModel = model.meanModel;
mea... |
% world to use. comment out to use loaded one
world = world2();
%params.R_func = @(R, theta)(R + min(0,sigmf(mean(abs(theta),2), [20 0.35])*0.3-0.5));
params.R_func = @(R, theta)(R + min(0,sigmf(mean(abs(theta),2), [10 0.3])*1-0.5));
pvals = 0:0.005:0.2;
realRcurv1 = zeros(length(pvals),1);
... |
function p_test=palmprint_com(img)
figure;imshow(imread(img))
im=imread(img);
p_test=palmprint(im);
end |
function [U eigVectors eigValues] = spectrum(A,k)
for i=1:size(A,1)
D(i,i) = sum(A(i,:));
end
for i=1:size(A,1)
for j=1:size(A,2)
L(i,j) = A(i,j) / (sqrt(D(i,i)) * sqrt(D(j,j)));
end
end
L(isnan(L))=0; L(isinf(L))=0;
[eigVectors,eigValues] = eig(L);
nEigVec = eigVectors(:,(size(eigVectors,1)-(k... |
function ds = pca_der( x, p)
%PCA_DER - Papadopulos-Cooper Derivative in Laplace domain in the aquifer
%
% Syntax: ds = pca_der( x, p)
%
% x(1) = Cd
% x(2) = dimensionless radius
% p = Laplace parameter
%
% See also: pca_lap
%
cd=x(1);
rd=x(2);
sp=sqrt(p);
spr=rd.*sp;
cds=cd.*sp;
k0=besselk(0,sp);
pk0=p.*k0;
k... |
x = dlmread('.VFunctionEjeX.txt');
y = dlmread('.VFunctionEjeY.txt');
h = plot(x,y,"k-.");
waitfor(h);
|
clear all
close all
clc
cd('~/Dropbox/School/Spring/ENERGY 294/HW4/Data/')
header = 'Experimental Data Sets-3/NMC_Cell_H1_T23_';
name = strcat(header, '0.025C_CTID.xlsx');
curr = xlsread(name, 1);
discharge025 = curr;
curr = xlsread(name, 2);
discharge025 = [discharge025; curr];
curr = xlsread(name, 3);
discharge025... |
function linearODESSEP2X4stacksub(T,I)
global d1 d2 d3 d4 d5 d6 d7 d8 k1 k2 k3 k4 k5 k6 H11 H21 H3 H4 g1 g2 E1 E2 A J V Acell p0 err Q;
%#codegen
generatorMatrixP2X4stacksub();
Nt=length(T);
for i=1:Nt
p0=p0*expm(Q*T(i));
err=err+abs(Acell*10^12*g1*(p0(3)+p0(4))*(V-E1)-I(i))^2;
end
end |
function y=parzen(x)
% PARZEN - Ventana de Parzen
% Copyright (c) Pedro L. Galindo (1998)
x=abs(x)-0.5;
x=(x>0);
y=(sum(x)==0);
|
% For MATLAB > 2017a
%% Fuzzy Systems 2019 - Group 4
% Manousaridis Ioannis 8855
% Classification with TSK models
% Grid Search - Isolet dataset from UCI repository
% TSK model Ser07
%% Clear all
close all; clc;
fprintf('Cleared everything\n\n');
%% Initializations
NF = [5 10 15 20]; % Number of Features
NR = [4... |
xEMA_Percents_all;
xEMA_Percents('000300.SH');
xEMA_Percents('000905.SH');
xEMA_Percents('000001.SH');
xEMA_Percents('399106.SZ');
xEMA_Percents('399101.SZ');
xEMA_Percents('399102.SZ'); |
function showCorresFunc(meshX,meshY, corIdx1,corIdx2, offset)
N = length(corIdx1);
cmap = hsv(max(N,1));
meshX.vertices = meshX.vertices - repmat(offset,length(meshX.vertices),1);
figure; trisurf(meshX.faces,meshX.vertices(:,1),meshX.vertices(:,2),meshX.vertices(:,3)); axis equal; axis image; shading interp; lig... |
D=[];
for k=1:20
a=XM(:,:,k);
D=[D a(:)];
end
clear XM
ISize=size(a);
X1 = D(:,1:(end-1));
X2 = D(:,2:end);
%%
load networks/sce_data_smallest.mat
g=sce.g;
a=string(ls('networks/A*.mat'));
a=strtrim(natsortfiles(a));
D=[];
cd networks
for k=1:length(a)
k
load(a(k));
A=A(1:500,1:500);
A=ten... |
function [eigFac,avg] = computeEigenFaces()
[A, avg] = getNormalizedImages();
A = double(A);
ss = size(A);
m = ss(2); % number of images
n = ss(1); % dimension of image space
L = A' * A;
[eigVec, eigVal] = eig(L);
U = [];
for l = 1:m
u = zeros(n,1);
for k = 1:m
... |
function P = crank_nicholson(Psy)
global A C
% a=1+1i*dt/(dx^2)+1i*dt*V/2;
% b=ones(1,length(x)-1)*(-1i*dt/(2*dx^2));
% g=1-1i*dt/(dx^2)-1i*dt*V/2;
%% Construction de C et c
% C=sparse( full( gallery('tridiag',-b,g,-b)));
% C=sparse( full( gallery('tridiag',length(x),-b,g,-b)));
% c=zeros(1,length(x));
% c(1)=-2*b... |
function [xopt,P_bl,P_opt] = optimizeControlSettingsSimpleGS(...
florisRunner, ~, yawOpt, ~, pitchOpt, ~, axialOpt, ...
turbIdxsToOptimize,optVerbose)
%OPTIMIZECONTROLSETTINGS Turbine control optimization algorithm
%
% This function is an example case of how to optimize the yaw and/or
% blade pitch angles/a... |
ques_eight
% The function ques_eight runs the all implemented taks.
%it runs the RPG function for 30 iterations for both T1 (1) and T2 (2) for
% n=5:5:100. the function also generates the graphs.
|
function cost = rectobjfn(im, X, Y, rect)
rect
inside = points_in_rectangle(X, Y, rect);
sample = im(inside);
cost = numel(sample) - nnz(sample);
im(inside) = im(inside) + 1;
figure(1); sc(im);
drawnow;
1
|
classdef AlazarATS9870 < hgsetget
% Class driver file for Alazar Tech ATS9870 PCI digitizer
%
% Author(s): Rob McGurrin
% Code started: 02 December 2015
properties (Access = public)
%Assume un-synced boards so that address = 1
systemId = 1
address = 1
%The singl... |
%% DIGITAL IMAGE PROCESSING
% Assignment 1 - Summer Semester 2020/2021
% Kavelidis Frantzis Dimitrios - AEM 9351 - kavelids@ece.auth.gr - ECE AUTH
function q = myquant(x, w)
%% Mid Riser / Quantizer
% https://en.wikipedia.org/wiki/Quantization_(signal_processing)
q = floor(x./w);
end |
function det_pq = pq_relaxed_small_step(euler_angle)
strain_external = [1 0 0;0 0 0;0 0 -1];
g_mat = Euler_to_gmat(euler_angle);
s_in= g_mat*strain_external*g_mat';
for counter1=1:1:56 % Calculating m using bishop-hill table and picking max m as taylor factor
m(counter1) = sqrt(6)*( (bisho... |
% Run Example 1
%
% clear all
% clc
disp('SYNBAD_Design_SO(''Example1'')')
pause(5)
SYNBAD_Design_SO('Example1')
disp('Optimization finished. Results of the optimization are stored in RESULTS_DESIGN.mat')
pause(5)
close all
disp('For simulation of the obtained result, you can:')
disp('1. set i... |
function [ Pxj ] = CountPxj( X, Y )
maxC = max(Y);
maxX = max(X);
Pxj = zeros(maxC,maxX);
for j = 1:maxC
k = 1;
M = zeros(1,nnz(Y == j));
for i = 1:length(Y)
if(Y(i) == j)
M(k) = X(i);
k = k+1;
end
end
for x = 1:maxX
Pxj(j,x) = nnz(M == x)... |
addpath RWTHMindstormsNXT;
%establish memory map to status.txt.
fstatus = memmapfile('status.txt', 'Writable', true, 'Format', 'int8');
fstatus.Data(7) = 49;
%open config file and save variable names and values column 1 and 2 respectively.
cd ../
config = fopen('config.txt','rt');
cd([pwd,filesep,'Local_Control']);
o... |
function [DI] = DunnIndex(image_weights, member_matrix, Kcentroids,...
clusterCount, sampleCount)
%this function is to calculate Dunn's Index for the clusters
%this is for internal validity of clusters for different no of PCs
minDelta = Inf;
for i=1:(clusterCount - 1)
for j=(i+1):clusterCount
d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.