text stringlengths 8 6.12M |
|---|
function [J, grad] = linearRegCostFunction(X, y, theta, lambda)
%LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear
%regression with multiple variables
% [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the
% cost of using theta as the parameter for linear regression to fit the ... |
%% a)
lados=6;
dados=1;
N=1e6;
%px = floor(rand(dados, N)*(lados+1));
px = randi(6, 1, N);
% funcao prob massa
prob = [sum(px == 1)/N, sum(px == 2)/N, sum(px == 3)/N, sum(px == 4)/N, sum(px == 5)/N, sum(px == 6)/N];
stem(1:6,prob)
% funcao distribuicao acumulada
acum = [0, cumsum(prob), 0];
stairs(0:7, acum) |
function Gs = mk_all_ugs(N, use_file)
% Generate all undirected graphs on N variables
% eg for N=4, there are 4*3/2 = 6 edges
% We reshape the bit vector as follows
% . . . .
% 1 . . .
% 2 3 . .
% 4 5 6 .
if nargin < 2, use_file = false; end
fname = sprintf('UGS%d.mat', N);
if use_file && exist(fname, '... |
clc
clear all
% генерирование случайных значений по равномерному закону распределения
xdata=rand(300,1).*10;
% по нормальному закону распределения
% шум (отклонения)
noise=randn(300,1).*20;
% генерирование значений в соответствии с заданной функцией
ydata=2.*sin(xdata)+4.*cos(xdata)+7.*(xdata)+2.*xdata.^2+noise... |
% get led ymaze data
[pooldat,labelNames]=extractField_multiFile({'LightChoice';'Turns'});
%%
pData = NaN(length(pooldat(1).LightChoice.pBias),length(pooldat));
active = false(length(pooldat(1).LightChoice.pBias),length(pooldat));
for i = 1:length(pooldat)
active(:,i) = pooldat(i).LightChoice.active;
pData(ac... |
% ===============================================================================
% This demo is about meanshift tracking
% Author: Shuo Chang
% E-mail: changshuo@bupt.edu.cn
% ===============================================================================
clear; close all; clc
% Load video
mov = VideoReader('./data... |
function [t, f0, avgF0, en] = F0Estimation(x, fs)
%This function uses the Autocorrelation method to return the Fundamental
%frequency of the input speech, based on the method proposed by Philipos C. Loizou
ns = length(x);
mu = mean(x);
x = x - mu;
fRate = floor(120*fs/1000);
updRate = floor(110*fs/... |
function c = cat3(d, a,b)
% cat3 - synonymous with cat
c = cat(d,a,b);
|
classdef GridGener < handle
properties (SetAccess = protected)
gridsize;
bnd;
discr_bnd;
V;
ind2sub;
ind2ind;
numV;
numVfull;
withCons;
end
methods
% Generate uniform grid of set A given the boundaries and grid size [A]_u
function Mesh = G... |
function y=zfunf12(x)
%*************************************************
% funzione test per la ricerca degli zeri
% y=(x-1)*exp(-n*x)+x^n per n=1,5,10 def. in [0,1]
%*************************************************
if (nargin==0)
y(1)=0;
y(2)=1;
else
n=5;
y=(x-1).*exp(-n.*x)+x.^n;
end
|
function outputs = readBinary(fileName)
fid = fopen(fileName);
outputs = fread(fid, 'single');
fclose(fid);
|
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/OPT_solvers/eSS/ssmgo_test.m 770 2013-08-06 09:41:45Z attila $
function ssmgo_test(solver,nproblem,noptim,pnames,lb,ub,prob,options,test,param);
% Function : testssm
% Written by : Process Engineering Group IIM-CSIC (jegea@iim.csic.es)
% Created on : 20/04/2007
% Last Up... |
function [res] = evalPreds(groundTruth, preds, metric)
% EVALPREDS Evaluate predictions under a given error metric.
%
% Usage:
% [res] = evalPreds(groundTruth, preds, metric)
%
% Inputs:
% groundTruth - True values
% preds - Predicted values
% metric - Name of error metric to apply
% ... |
clear all
% load
direc='/Volumes/TOSHIBA/Seņales suizos tercero, cuarto, quinto y sexto escenario/Datos/Datos_raw/datos3.mat';
load(direc);
% a=C3{1};
% b=C3{49};
c=C3{97};
% d=C3{145};
% e=C3{193};
% f=C3{241};
emd(c,'Interpolation','pchip'); |
function coef=dyadic_symmetric_decom(a,lev)
coef=zeros(size(a));
[x,y]=decm26(a);
len=size(a,1); len1=len/2; len2=len1/2; len3=len2/2; len4=len3/2; len5=len4/2;
coef(len1+1:len,:)=y;
[x,y]=decm26(x);
coef(len2+1:len1,:)=y;
[x,y]=decm26(x);
coef(len3+1:len2,:)=y;
[x,y]=decm26(x);
coef(len4+1:len3,:)=y;
coef(1:len4... |
function showData(x,t)
x_pos = x(:,1);
y_pos = x(:,2);
z_pos = x(:,3);
Vx = x(:,4);
Vy = x(:,5);
Vz = x(:,6);
phi = x(:,7);
theta = x(:,8);
psi = x(:,9);
p_rot = x(:,10);
q_rot = x(:,11);
r_rot = x(:,12);
% Create a figure window
figure('Name', 'State over Time', ... |
function MICE_scr_overview(task)
%%% A MICE Raw SCR Data Overview %%%
% harcoded parameters
datadir = '/Volumes/memolab/MICE/MICE_fMRI/data';
datadirs = cellstr(spm_select('FPList', datadir, 'dir', '^sub-s0(?!15|21|23|29|31)'));
names = regexp(datadirs, 'sub-s...', 'match');
names = unNest_cell_array(names);
out... |
%% Create the Plots for complex RMPC demo
close all
myfig = figure
daspect ([1 1 1]);
% Draw the nodes
max_a = max(nodes(:,1));
hold on,
plot3(nodes (:,1), nodes(:,2), 0*nodes(:,2)+.5, 'g.')
% Draw the edges
for i = 1 : length (edges)
hold on, plot3( [edges(i,1), edges(i,3)], [edges(i,2), edges(i,4)],[.5,... |
function []=Eulplotter(fname,options)
%% A Plotter for Eulerian mean streamfunction
%input file name and options
%%option 1 = area of interest plotted in standard plot
cd /noc/altix/scratch/hb1g13/MITgcm/nchannel/grid
lm=ncread('grid.nc','HFacS');
cd /noc/altix/scratch/hb1g13/MITgcm/nchannel/EulPsi/
if options == 1
Y=... |
close all;clc;
%flightData = xlsread('myData.xls');
[~,~,PUCK] = xlsread('datarev.xlsx');
[~,~,TICKET] = xlsread('InputData.xlsx','Tickets');
[~,~,GATE] = xlsread('InputData.xlsx','Gates');
[flightData,~,GATE] = datasetPreprocessing(PUCK,TICKET,GATE);
%Test:100 samples
%flightData = flightData(1:300,:);
GLO... |
function [ cache, model ] = cache_initilize_model( param, max_cache_size, cache, model, lambda )
% [ cache, model ] = cache_initilize_model( param, max_cache_size, cache, model, lambda )
%
% cache_initilize_model creates model and cache data structures.
% The function either creates a new model with default initializat... |
###############################################################################
# Find similar users on twitter
###############################################################################
# Author:
# --> Catarina Silva
#
###############################################################################
# Plots the rat... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 9.9: Clasificación: redes neuronales y máquinas de vectores
% soporte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 9.9.3 Mapas Autoorganizativ... |
% The function to generate monotone non-sparse eigenvector. Equal jump with
% dimension p. Unit vector.
function v = mnt_cone_eigenvec_nonsparse(p)
v = reshape(linspace(1,p,p), p, 1);
v = v / sum(v.^2)^0.5;
% This shuffle is used for pos cone.
v = v(randperm(length(v)));
end
% test
% mnt_cone_eigenvec2(9) |
function varargout = sawGUI(varargin)
% SAWGUI MATLAB code for sawGUI.fig
% SAWGUI, by itself, creates a new SAWGUI or raises the existing
% singleton*.
%
% H = SAWGUI returns the handle to a new SAWGUI or the handle to
% the existing singleton*.
%
% SAWGUI('CALLBACK',hObject,eventData,handles,... |
function [L,g] = gplvmlikelihoodgradientpoint(x_i, i, A, invK, activeX, Y, D, theta, activeSet)
% GPLVMLIKELIHOODPOINT Compute gradient of data-point likelihood wrt x.
kbold = kernel(x_i, activeX, theta)';
f = A*kbold;
sigma2 = theta(2) +1/theta(end) - kbold'*invK*kbold;
if sigma2 < 1e-6;
sigma2 = 1e-6;
end
yHat... |
function is_consistent = cache_check_consistency_full( cache )
% is_consistent = cache_check_consistency_full( cache )
%
% cache_check_consistency_full checks cache data structure of one object for consistency.
% This functions performs full check but is quite slow. If you
% are not suspecting a cache bug use cache_che... |
function score = ringObjectiveFunction(x, ray, nRays, nPoints)
rowSub = round(x(3) + x(1)*cos(x(2)+linspace(0, 2*pi, nRays)));
rowSub(rowSub<1) = 1;
rowSub(rowSub>nPoints) = nPoints;
ind = sub2ind([nPoints, nRays], rowSub, 1:nRays);
score = -mean(ray(ind));
|
function [cost] = calcCost( theta, data, params )
if params.GPU == true
allImgs = gpuArray(data.imgs);
cat_id = gpuArray(data.cat_id);
else
allImgs = [ data.imgs ];
cat_id = data.cat_id;
end
[ W, b ] = stack2param(theta, params.decodeInfo);
ty = (cat_id == data.categories)';
lambda_penalty = para... |
function [ out ] = q516( lambda )
% This function computes the output to the function defined in
% Q5.16 of the Engineering Optimization - S.S. Rao textbook.
out = lambda^5 - (5*lambda^3) - (20*lambda) + 5;
end
|
function [v, om, omp_v]=fComputeVelAndRotAcc(J,gxp);
% Computes velocities at point P in the P system using the J matrix: J * GXP
% The translation velocities are obtained from the first three lines of J
% The rotational velocities are obtained from the last three lines of J
% using the recursive for... |
%************ clear all and get screen size *******************************
clear all; close all;
scrsz = get(0,'ScreenSize');
%**************************************************************************
%******** call read_all_speakers for making matrices with mfccs ***********
C1 = read_all_speakers(4);
C2 = read_al... |
%> @brief Here we have a brief description of the class.
%
%> And here we can put some more detailed informations about the class.
% ======================================================================
%> This class is part of the NDG-FEM software.
%> @author li12242, Tianjin University, li12242@tju.edu.cn
% =======... |
%%
clear; clc;
time_span = [0 2];
initial_condition = [1 0];
[T, X] = ode45(@(t, x) mathieu(t, x), time_span, initial_condition);
plot(T,X(:,1),'-');
title('Plot of x as a function of time. Delta = -30 and Epsilon = 1');
xlabel('Time'); ylabel('x(t)');
grid on;
%%
ft = linspace(0,5,25); % Generate t for f
f = ft.^2 - ... |
clear all
close all
dx=.5e-6;dy=.5e-6;
length=30e-6; breadth=30e-6;
N=round(length/dx);M=round(breadth/dy);
L_core=5e-6;B_core=5e-6;
x=(1:N)*dx;
y=(1:M)*dy;
a=dx^-2;b=dy^-2;
lambda=1.550e-6;
k=2*pi/lambda;
n0=1.4;
p0=k^2*n0^2-2*a;
n1=3;
p1=k^2*n1^2-2*a;
A=zeros(N*M);
for i=1:N*M
A(i,i)=p0;
end
for j=1:(M... |
function varargout = homepage(varargin)
% HOMEPAGE MATLAB code for homepage.fig
% HOMEPAGE, by itself, creates a new HOMEPAGE or raises the existing
% singleton*.
%
% H = HOMEPAGE returns the handle to a new HOMEPAGE or the handle to
% the existing singleton*.
%
% HOMEPAGE('CALLBACK',hObjec t,e... |
A=[4,8;2 1; 1 1];
f=[5 5];
[ff,cf]=size(f);
[z,c]=size(A);
I=eye(z);
b=[32,10,2];
AB = horzcat(A,I,b')
[zzz sss]=size(AB)
for cf=cf:sss-1
f=horzcat(f,0)
[ff,cf]=size(f)
display(f);
end
ABB=vertcat(AB,f)
H=[];
P=[];
s=0;
r=0;
[n,m] = size(ABB); % n = (Zeilen,fila), m = (Spalten,columna)
if m<n
... |
function w = LevbgMaqdt_alg(x,y)
m = height(y);
w = 3*ones(1,16);
lemda_k = 1;
lemda = 1e-5;
fi = get_resi(x,y,w);
l_w_norm = norm(fi)^2 + lemda*(norm(w))^2;
i = 0;
%l_w_norm >0.01 &&
while l_w_norm > 1 && i < 50
i = i +1;
fi = get_resi(x,y,w);
l_w_norm = norm(fi)^2 + lemda*(norm(w))^2;
... |
%% Convex Hull demo
% This sample program demonstrates the use of the |cv.convexHull| function.
%
% <https://github.com/opencv/opencv/blob/3.1.0/samples/cpp/convexhull.cpp>
%
%% Points
% create black image
img = zeros([500 500 3], 'uint8');
[h,w,~] = size(img);
% random 2D points
count = randi([10 100]);
points = [r... |
function [mdam,mdam2,mdam3,mdam4]=small_window(freq2,w,win_size)
%Compute mean power value of window for different frequency bands
dam=((squeeze(mean(squeeze(freq2.powspctrm(:,w,:,1+win_size:end-win_size)),1)))); %Average all events.
mdam=mean(dam(:)); %Mean value
freqs=freq2.freq;
%100 to 150 Hz
n1=sum(freqs<=150... |
function F = fisher_score(d1, d2)
% d2 [samples x dimensions]
% d2 [samples x dimensions]
%
m1 = mean(d1, 1);
m2 = mean(d2, 1);
s1 = std(d1, [], 1);
s2 = std(d2, [], 1);
F = abs(m2 - m1) ./ sqrt(s1.^2 + s2.^2);
end |
function [testClassPredicted,sparsity,otherOutput]=src(trainSet,trainClass,testSet,option)
% sparse representation classification approach (SRC1)
% trainSet, matrix, each column is a training sample
% trainClass: column vector, the class labels for the training samples
% testSet: matrix, each column is a new or tes... |
% plots the scatter plot with a heatmap so that overlapping points will
% have a larger value
function scatterPlotHeatmap(I,J,colmap,ms)
if nargin < 4, ms = 15; end
if length(unique(I))<=2 || length(unique(J))<=2, return; end
scatres = scatplot(I,J,'squares',[],[],[],[],3,0); % 5
ind = fix((scatres.dd-min(scatres.dd... |
function g_u = kmeans_clustering(X,K,SPACE)
%u=kmeans_clustering(X,K,SPACE)
%X
% Each vector in row
%
%K
% Number of clusters
%
%SPACE
% The algorithm chooses initial values of u
% randomly. Hence to know where to choose from
% the input space is required. [lower_limit upper_limit]
%
%written by
%tariqul isl... |
function [ tp,fp ] = calc_sroc( smap,fixes,fixes_shuffle )
smap=uint8(floor(mat2gray(smap)*255));
thres=1:256;
sfixes=zeros(size(smap));
sfixes_shuffle=zeros(size(smap));
for j=1:size(fixes,1)
valSAL_XY=smap(fixes(j,2)+1,fixes(j,1)+1)+1;
sfixes(valSAL_XY)=sfixes(valSAL_XY)+1;
end
for j=1:size(fixes_shuffle... |
% STATEMACHINEEXAMPLE computes robot state and references of the EXAMPLE_STATEMACHINE demo.
%
% USAGE: please note that this function has been designed for being inserted
% in a Simulink model.
%
% FORMAT: [state, references_CoM, references_LFoot, references_RFoot, references_rot_task, feetIn... |
function [new_1, new_2] = match(ind_1, ind_2, fm, f)
% Cross the chromosomes of different individuals
% Improved by self-adaptive probability of cross according to individual fitness
f_avg = mean(f);
f_max = max(f);
% Self-adaptive probability of cross
if fm < f_avg
p_match = 1;
else
... |
clear,close all
clc
%% Define geometry
Lx = 10;
Ly = 1;
Lz = 20;
Nex = 10;
Ney = 1;
Nez = 30;
[XYZ, ELEM ] = hex_mesh_3D( [Lx Ly Lz], [Nex Ney Nez], 1);
[NN,NDOF] = size(XYZ);
%% Assemble system matrices
mat.rho = 2700;
mat.E = 1.0e3;
mat.nu = 0.0;
[M, K] = assemble_system_matrices(ELEM, XYZ,... |
function l = calculateLength(Normals,Origins,p)
% calculate lengths of vessels in sphere
a = sum(Normals.^2,2);
b = 2*sum(Origins.*Normals,2);
c = sum(Origins.^2,2)-p.universeSize.^2;
delta = b.*b-4*a.*c;
u1 = (-b-sqrt(delta))./2./a;
u2 = (-b+sqrt(delta))./2./a;
p1 = Origins+re... |
function [ Y ] = blocktranspose( X, m, n, p, q )
%BLOCKTRANSPOSE Block transpose a matrix X
Y = reshape(X, [ p m/p q n/q ]);
Y = permute(Y, [ 1 4 3 2 ]);
Y = reshape(Y, [ p*n/q q*m/p]);
end
|
classdef LogRegFitEng < CondModelFitEng
properties
diagnostics;
optMethod;
end
methods
function [model,output] = fit(eng,model,D)
X = D.X; y = D.y;
[X, model.transformer] = trainAndApply(model.transformer, X);
... |
load('training_3');
%训练数据集
figure;
subplot(2,2,1);
gamma=1;
[~,b,alpha]=train(x,y,0.1,[],gamma);
draw(x,y,alpha,gamma,b);
subplot(2,2,2);
gamma=10;
[~,b,alpha]=train(x,y,0.1,[],gamma);
draw(x,y,alpha,gamma,b);
subplot(2,2,3);
gamma=100;
[~,b,alpha]=train(x,y,0.1,[],gamma);
draw(x,y,alpha,gamma,b);
subplot(2,2,4);
gamma... |
%% input parameters
clear all;
close all;
dims.dh=10;
lp=30;
load('trueModel.mat');
v0=ones(size(trueModel))*2500;
v0(25:35,30:40)=1700;
dims.dt=10^-3; % [s]
dims.nz0=size(v0,1); % Cells in z-direction
dims.nx0=size(v0,2); % Cells in x-direction
dims.nt=1000; % Amount of time steps
dims.ns=dims.nt;
%% exte... |
function y=toFouReal(Fs,x)
n=0:1/Fs:1;
N=2^nextpow2(length(x));
m=(-N/2):(N/2)-1;
w=2*pi*m*Fs/N;
yall=(1/N)*x*exp(1i*w'*n);
y=real(yall);
%plot(n,y) |
% small_electric_STEP_in.m ADVISOR 2003-00-r0116 input file created: 17-Apr-2015 20:09:09
global vinf
vinf.name='small_electric_STEP_in';
vinf.drivetrain.name='ev';
vinf.motor_controller.name='MC_PM100_UQM';
vinf.motor_controller.ver='';
vinf.motor_controller.type='';
vinf.energy_storage.name='ESS_LI7_temp';
vinf.e... |
function [k,NP,K,kGrid,ShotNumber,EchoNumber]=samplingDISORDER(k,U,SegmentOrder,SampleOrder,K)
%SAMPLINGDISORDER is a template to compute the motion-sensitive sampling
%orders in [1] L Cordero-Grande et al, "Motion corrected magnetic resonance
%imaging %with DISORDER: Distributed and Incoherent Sample Orders for
%R... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 7.15: Extracción de bordes, regiones y puntos de interés
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 7.7.10 Regiones: umbrales
%%%%%%%%%%%%%%... |
% --- Executes on selection change in popupmenuColorMap.
function popupmenuColorMap_Callback(hObject, eventdata, handles)
handles.data.cmapName = get(handles.popupmenuColorMap, 'String');
handles.data.cmapName = handles.data.cmapName(get(handles.popupmenuColorMap, 'Value'));
handles.data.cmap = feval(handle... |
function [xy,uv_vec] = Compute_Wuv(obj,ann,res)
%Compute_Wuv Summary of this function goes here
% Detailed explanation goes here
U = obj.GetWeights(ann);
xy = obj.k * U;
list = xy(:,1) > 0 & ...
xy(:,1)<= res(2) & ...
xy(:,2) > 0 & ...
xy(:,2)<= res(1);
xy = xy(list,:);
... |
clc
clear all
close all
cam = im2double(imread('cameraman.tif'));
house = im2double(imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week7/house.tif'));
subplot(1,2,1)
imshow(cam)
colormap(gray(256))
title('cameraman')
subplot(1,2,2)
imshow(house)
title('house')
cf = abs(fft2(cam)).^2;
hf = abs(fft2(house))... |
function y = convjb(x,h)
n = size(x,2);
m = size(h,2);
if(rem(n,2) ~= 0)
l = ceil(log2(n));
x = [x zeros(1,(2^l)-n)];
h = [h zeros(1,(2^l)-n)];
end
X = fftjb(x);
H = fftjb(h);
Y = H .* X;
y_ = abs(ifft(Y));
y = y_(... |
eps_i=200e-6; % m-rad (normalized)
gamma_b=40000;
sigma_r=30e-6; % m
beta_i=(sigma_r^2)/(eps_i/gamma_b);
gamma_i=1/beta_i;
z=linspace(.001,1.539,5000); % m
n=ones(1,5000);
n(z<.12)=z(z<.12)/.12;
n(z>1.42)=(z(z>1.42)-1.54)/-.12;
n=n*8e16; % 1/cm^3
B=3.01*n/1e11; % T/m
beta_f=sqrt(gamma_b*9.11e-31*3e8/1.6e-19./B); % m... |
function sctm = sctm
global sctm
a =cos(2*pi/3)+j*sin(2*pi/3);
sctm = [1 1 1; 1 a^2 a; 1 a a^2];
|
clc
clearvars
MUESTRAS=load('raray.txt');
ESPACIO = [-10 15; -20 10];
BITS=2;
K=10;
MUESTRAS_BR=0;
RESOLUCION=400;
x1=linspace(-10,15,RESOLUCION);
x2=linspace(-20,10,RESOLUCION);
[esp1,esp2]=meshgrid(x1,x2);
%centroides=[esp1(randi(100,1,2)),esp2(randi(100,1,2));
% esp1(randi(100,1,2)),esp2(randi(100,1,2));
%... |
data = load('C:\Tornado2.2\FineData.txt');
%%
ilcSignal = data(:,31);
figure;
plot(ilcSignal * 0.00001);
%%
accSignal = data(:,52);
figure;
plot(accSignal);
%%
fbSignal = feedbackControlSignalData(:,end);
figure;plot(fbSignal);
figure;pwelch(fbSignal,[],[],[],5000);
%%
tempFilter = designfilt('lowpassiir', 'FilterOrder... |
function [ varargout ] = cat_sat_data( filepath, datafields, varargin )
%CAT_SAT_DATA( FILEPATH, DATAFIELDS ) Concatenates data from OMI .mat files
% In some cases, one might wish to use satellite data from multiple days,
% but we import OMI data and process BEHR data into daily files. This
% function will load a... |
% TrainSLP Train the single layer perceptron model
%
% [w, b] = TrainSLP(mini_batch_x, mini_batch_y) computes the
% weight w and bias b by performing stochastic mini batch gradient
% descent.
%
% Input:
% mini_batch_x = kx1 array of cells where each cell is a batch of
% images
... |
function arc_axis = discretized_arc_axes( fan, axis_number )
% this function generates the testing axis for the Separating Axis
% Theorem-based test by discretizing the arc of the fan and finds the
% normal of every segment.
% fan is shape data of the fan shape, and axis_number is
% the number of ... |
function [AE, params] = Nozomi_init()
path = 'C:\Users\Nozomi\Dropbox\Nozomi - Dani\RBES SMAP for IEEEAero14';
cd(path);
javaaddpath('.\java\jess.jar');
javaaddpath('.\java\jxl.jar');
javaaddpath('./java/combinatoricslib-2.0.jar');
javaaddpath('./java/commons-lang3-3.1.jar');
javaaddpath... |
%% README %%
%Creator: Douglas Peters, PhD
%Created: August 31st, 2020 (this version)
%Organization: Garcea Laboratory in the MCDB Department and
% BioFrontiers Institute, University of Colorado Boulder
%Purpose: This script was created to analyze changes in the localization of
% fluorescent signal intensity... |
%test_projectors
close all;
n= 128;
I = zeros(n,n);
ix = 1:n;
ix = ix + 0.5;
iix = ones(n,1) * ix;
iiy = iix';
r1 = round(n/12);
r2 = round(n/32);
r3 = round(n/3);
c1x = round(n*2/3);
c1y = round(n/2);
c2x = round(n/2);
c2y = round(n/3);
c3x = round(n/2);
c3y = round(n/2);
I( sqrt((iix-c3x).^2+(iiy-c3y).^2) < ... |
function LinDiattenuationMM(mmVecs,LambdaList,nLambda,Label)
for n = 1:nLambda
M_00(n,:,:)= squeeze(mmVecs(n,1,:,:));
M_01(n,:,:)= squeeze(mmVecs(n,2,:,:));
M_02(n,:,:)= squeeze(mmVecs(n,3,:,:));
M_03(n,:,:)= squeeze(mmVecs(n,4,:,:));
M_10(n,:,:)= squeeze(mmVecs(n,5,:,:));
M_11(n,:,:)= sque... |
% Load data
load basisData.mat
Xtest = [min(X):.1:max(X)]';
T = size(Xtest,1);
% Plot data
figure(1);
title('Training Data');
hold on
for j = 0:8
Xpoly = polyBasis(X,j);
% Fit least-squares estimator
w = fitL2(Xpoly,y);
yHat = zeros(T,1);
for i = 1:T
% Draw model prediction
... |
function [Cost, grad] = getCostLgR(theta, X, y)
# getCostLgR computes the cost and gradient for logistic regression WITHOUT regularization (lambda =0)
# [Cost, grad] = getCostLgR(theta, X, y) computes the cost of using theta as the
# parameter for logistic regression, and the gradient of the cost.
Cost = 0;
gra... |
function MDC = min_depth_comparison(manual_file, DISPLAY)
close all;
load('SS190\trackdata_SS190_11-02-27.mat');
load(manual_file);
load('Zpavimento.mat');
%% compute new xyz using zpavimento depth
pedestrians = size(manual_trackdata.I,2);
%replace zeros with NaNs so that it's possible to find the minima
md_trackda... |
function P=poisson_pdf(x, lambda)
% originally: P=lambda^k.*exp(-lambda)/factorial(k). This blows up!
% take the log:
% log(P) = k*log(lambda)-lambda -log(factorial(x))
% and factorial(x) = gamma(x+1)
P=exp(-lambda+x.*log(lambda)-gammaln(x+1)); |
function F = Ausgleichsprobleme(x)
P=[ 0 0 0;0 0 10; 20 0 0;20 20 0;0 20 0;20 0 10; 20 20 10]; %x/y/z koordinaten der sender 1-7
P_1=[5 5 10];
p_2=[1 2 3];
p_3=[10.5 15.5 2.5];
c_w=1480; %Schallgeschwindigkeit in Wasser [m/s]
%time=[ 0.00828 0.00478 0.01264 0.01585 0.01264 0.01068 0.01433];%time kreuzkorelati... |
hold on
fx=0.04;
fy=0.10;
px=[0.99*exp(j*2*pi*fx) 0.99*exp(-j*2*pi*fx)]';
py=[0.99*exp(j*2*pi*fy) 0.99*exp(-j*2*pi*fy)]';
z=[-1 1]';
subplot(2,1,1);
zplane(z,px)
grid
title('H_x(z)')
subplot(2,1,2);
zplane(z,py)
grid
title('H_y(z)')
%%
%Frekvensrespons:
[Hx,w]=freqz(poly(z),poly(px));
[Hy,w]=freqz(poly(z),poly(py)... |
function SpectEn_value = SpectEn(data,fs)
%% 计算频谱熵 注意如果 传入的数据 是多维度的矩阵,以下函数需要变动
[Pf,f] = pwelch(data,[],[],[],fs);
Pf = ((Pf));
% figure, plot(Pf);
Qf = Pf./sum(Pf); %归一化
Hf = Qf.*log(1./Qf);
SpectEn_value = sum(Hf)./log(size(f,1));
% disp(['------->> 频谱熵: ',num2str(SpectEn_value)])
% disp(SpectEn_val... |
function this = alter(this, n)
% alter Expand or reduce number of model variants.
%
% Syntax
% =======
%
% m = alter(m, n)
%
%
% Input arguments
% ================
%
% * `m` [ model ] - Model object in which the number of model variants
% will be changed.
%
% * `n` [ numeric ] - New number of model ... |
classdef RecurrentUnit < Unit & Evolvable
methods
function varargout = forward(obj, varargin)
obj.pkginfo = RecurrentAP.initPackageInfo();
% clear hidden state
for i = 1 : numel(obj.S)
obj.S{i}.clear();
end
% extract frames from pac... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2018 Crypto4a Technologies Inc.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction,... |
%% Question 2 d)
a = affine_matrix(1); b = affine_matrix(2); c = affine_matrix(3);
d = affine_matrix(4); e = affine_matrix(5); f = affine_matrix(6);
aff = [a,b,e;c,d,f];
%append row of ones to a_keys (x,y,1)
a_keys = cat(1,a_keys,ones(1,length(a_keys)));
transformed_book = zeros(size(findBook,1),size(findBook,2));
f... |
function [y_interferance] = sum_Y_interferance(num_unwanted_users,N,H_other_users,z_data)
y_interferance = zeros(N,N);
for i = 1:num_unwanted_users
HjFj_Zj = H_other_users{i}*transpose(z_data{i+1});
y_interferance = y_interferance + HjFj_Zj;
end
end |
classdef StandardizeTransformer < Transformer
properties
mu; sigma;
saveParams;
end
%% Main methods
methods
function obj = StandardizeTransformer(saveParams)
% if saveParams = true, we standardize the test set using
% the parameters computed on ... |
%% Description
%
% TODO
%
% Fabien Boux - 11/2020
Init
disp(['Running experiment ' mfilename '.m'])
%% Setting
% Execution settings
verbose = 1;
backup = 1;
% Experiment settings
nb_test_signals = 5e4;
nb_signals = [2e3 1e4];
K = 3:3:200;
constraints = {'d*', 'i*'};
% Regression settings
Model.Lw = 0;
Parame... |
function rampOffOn = makeOnOffRamp(rampDur,sampleLength,sampRate)
% ----------------------------------------------------------------------
% rampOffOn = makeOnOffRamp(rampDur,sampleLength,sampRate)
% ----------------------------------------------------------------------
% Goal of the function :
% Add on-off ramp t... |
figure;
semilogx(lambdas, sweep.nu, 'LineWidth', 1);
set(gca, 'xdir', 'reverse');
prepare_figure('sweep_nu.pdf', [8 6], '\lambda', '\nu')
stable = min(find(sweep.nu <0));
J = sweep.objval - sweep.norm;
Jstar = min(J);
figure;
semilogx(lambdas, (J-Jstar)/Jstar, 'LineWidth', 1);
set(gca, 'xdir', 'reverse');
a = axis(... |
% Written by Patrick Strassmann
function [stimMatrixOn, stimMatrixOff,stimMatrixDur] = findStimPatches(trialStartTimes, trialEndTimes,stimTimesOn, stimTimesOff, boutStartTimes, wantPatchPlot)
if nargin<6
wantPatchPlot=1;
end
if nargin<5 || isempty(boutStartTimes)==1
boutStartTimes = zeros(1,numel(t... |
function VNFs = genVNFs(n)
%n:VNF的总数
%生成部署VNF的计算资源成本-均匀分布
MinResourcesCost = 200;
MaxResourcesCost = 250;
rc = randi([MinResourcesCost, MaxResourcesCost], 1, n);
%生成部署VNF的时间成本-均匀分布
MinTimeCost = 1;
MaxTimeCost = 2;
tc = randi([MinTimeCost, MaxTimeCost], 1, n);
for i = 1 : n
... |
%Let Z be the impedance matrix such that [v.',zeros].' = Z [it.', ir.'], where v is the TX voltage vector,
%it is the transmittng current vector and ir is the receiving current vector. This function calculates a
%possible dv such that [(v+dv).',zeros].' = Z [(it+dit).', (ir+dir).'].' and:
% * abs(it+dit)<=It,
% * abs(... |
function [ ] = plotPCA(U, V, num, dirName, numOfSec, numOfSample)
if U(1,1)>=0
U = -U;
V = -V;
end
index = ['一','二','三','四','五','六','七','八','九','十'];
if exist(dirName, 'dir')~=7
mkdir(dirName);
end
for i = 1:num
%% Plot
markerStyle = ['o';'+';'d'];
... |
clear;
verbose = false;
% for i=1:20
%% ---------- Circuit parameters --------------
% number_of_bits = 1+i;
number_of_bits = 6;
input_BW=256;
V_thermal = 25.27*10^-3;
k = 1.38064852e-23;
F_per_M = 0.001025;
T = 293;
sine_amplitude = .001;
sine_bias = 0;
Vref = 2;
noise_quantization = sqrt(Vref^2/12*2^(-2*number_o... |
clc;%clear command window
clear all;%clear workspace
close all;%close all current figures
a = imread('brain3.jpeg');%reading the image
figure, imshow(a); %new figure %displaying the image
title('Input image'); %title of image
%loop to check if image is gray scale,
%if not then converting from RGB to GRAY
try
Dimg... |
function [x] = simpson(f,a,b,n)
h = (b-a)/n;
X = (a:h:b);
Y = zeros(n+1);
for i = (1:n+1)
Y(i) = f(X(i));
end
x = Y(1) + Y(n+1) + 4*sum(Y(2:2:n)) + 2*sum(Y(3:2:n));
x = x * (h/3)
end
|
function h=horizon(MAP)
h=find_ele(MAP,0);
end |
%Jouke van der Maas, 10186883
%file: main.m
%created: 15.01.2013
%last edited: 15.01.2013
function [AppendedData, header] = mainBuild_gpsdata_extended(gps)
if nargin < 1
gps = read_gps_data();
end
[AppendedData header traj_lookup] = build_all_attributes(gps);
WriteNestedCells(traj_lookup, '../.... |
clear;
clc;
format long;
gbest_all_val ={[] [] []};
gbest_all_pos ={[] [] []};
cg_curve_all = {[] [] []};
NP=50;
% Max_FES=100;
Max_FES=100000;
runs=30;
fun_num=1;
func= @evaluate_normal_fitness;
funslope=zeros(50,1);
Algorithm_name={'HSDEMFO'};
% for k=1:size(Algorithm_name,2)
for k=1:1
fprintf('Algorithm =\t %... |
function AutoClustering(fbasename,elec,varargin)
% USAGE:
% clu = AutoClustering(fbasename,elec)
%
% AutoClustering automtically cleans the clu file defined by fbasename and
% electrode numbers. The program will look for the files
% fbasename.fet/res/spk.elec in the current folder.
%
% INPUT:
% fbasename: ch... |
cd /auto/k6/julie/matfile
resultsDirectory='/auto/k6/julie/matfile';
addpath('/auto/k1/queued');
input_dir=pwd;
Subjects = dir(input_dir);
%cmd = 'Cal_MIperarea_ConfVoice(''%s'');';
cmd = 'Cal_MIperarea_RandVoice(''%s'');';
for ss=1:length(Subjects)
Indiv=Subjects(ss).name;
if length(Indiv)==11
% if strcm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.