text stringlengths 8 6.12M |
|---|
% check specs
clear all; close all; clc;
addpath(genpath('D:\git\psgGeneactivActiwatch\'));
PSG_INPUT_FOLDER = '/Users/me/Data/vici/psg/';
OUTPUT_FOLDER = '/Users/me/Data/vici/results/';
% List all files in the folder.
files = dir([PSG_INPUT_FOLDER '*.csv']);
fid = fopen([OUTPUT_FOLDER 'viciPsgFiles... |
function x = chebyshev(x0, n, v)
x(1) = x0;
for i = 1 : n - 1
x(i + 1) = x(i) - f(x(i)) / f_dx(x(i), v) - f_dx_dx(x(i), v) * power(f(x(i)), 2) / (2 * power(f_dx(x(i), v), 3));
end
|
function t = weightedLeastSquaresMultilateration(t, weights)
%t = weightedLeastSquaresMultilateration(t, weights)
%
%This function ignores all distances except those to anchor nodes and, if
%there are enough, will create a system of equations to solve for the unique xy
%coordinates of each mobile node. Mobile no... |
close all;
clear all;
clc;
x=input('enter the value of first input sequence');
disp('1st i/p sequence is');
disp(x);
h=input('enter the values of 2nd dft sequence');
disp('2nd i/p sequence is');
disp(h);
lx=length(x);
lh=length(h);
N=max(lx,lh);
xx=[x zeros(N-lx)];
HH=[h zeros(N-lh)];
W=zeros(N,N);
for n... |
function corespondencesEdge = matchingEdge(edgePoints_1,...
edgePoints_2,...
barycenterMap_1, barycenterMap_2,...
eigenEdge_1, eigenEdge_2,...
barycenterThreshold)
% matching the edges and creating the weight array
corespondencesEdge = [];
% idenx list to prevent from double match
idxList = [];
for i... |
function [r,az,el,x,y,z,full_vector_set]= difference_analysis2(session,run)
% Run from file above new_rois
% Don't worry about this function so much, was updated by later function
% anyway.
map = [zeros(1,50), linspace(0,1,50);
zeros(1,100);linspace(1,0,50),zeros(1,50)]';
% lists subjects in NH and Tin categories... |
function dA = dg_differential_area_on_sphere(lat,dlat,dlon)
% this function calculates the differential area of a patch on Earth
% 2015-03-02
% input: lat in degrees
% dlat and dlon in degrees as well
if nargin == 1
display('assuming 30 arcseconds for both dlon and dlat')
dlat = 1/120; % 30 arc second
dlon = 1/1... |
function [J, grad] = CostoLogistica(theta, X, y)
m = length(y);
X = [ones(m, 1) X];
J = (1 / m) * sum( -y'*log(FuncionSigmoide(X*theta)) - (1-y)'*log( 1 - FuncionSigmoide(X*theta)) );
grad = (1 / m) * sum( X .* repmat((FuncionSigmoide(X*theta) - y), 1, size(X,2)) );
end |
function ShowParlettReid(A)
% function ShowParlettReid(A)
% Illustrates the Partlett-Reid factorization for a symmetric matrix A.
% A call of the form ShowParlettReid() generates a random 7x7 example.
if nargin==0
n = 7;
A = randn(n,n);
A = A + A';
end
[L,T,P] = ParlettReid(A);
clc
fprintf('Par... |
function [Psrc,UsedImageFileNames] = FindingPoints_InCheckerboard(imageFileNames,outFileName)
%%
% 函数作用: 从棋盘格图像中提取角点
% 刘健冉 2014年4月
% 依赖项: 函数 detectCheckerboardPoints , vision工具箱
%
%输入
% imageFileNames 输入图像的文件名称列表, 例如imageFileNames = {expriment image1.bmp} 或
% imageF... |
function [homogeneousPlane, covMatrix] = ReconPlane( listOfPoints )
% Reconstruct the plane and its covariance matrix from the sampled points
% listOfPoints: Matrix containing a 3D point in each column
% homogeneousPlane: Plane in homogenous representation
% covMatrix: Covariance matrix corresponding to the plane
... |
inpath=('watermarked_video.avi');
myVid1 = VideoReader(inpath);
numFrames= myVid1.NumberOfFrames;
i= 1;
while i <= numFrames
currentFrame= read(myVid1,i);
combinedString=strcat('D:/code_video_watermarking/',int2str(i-1),'.jpg');
currentFrame=uint8(rgb2ycbcr(currentFrame));
image = currentFrame(:,:,1);
imwrite(... |
function x = TLS(A,b,d,t)
% function x = TLS(A,b,d,t)
% Total least squares.
% A is mxn with m>n,b is mx1, d is mx1 and positive, and t is (n+1)x1
% and positive.
% x is nx1 and satisfies (A+E)x = b +r subject to the constraint
% that || diag(d)*[A b]*diag(t) ||_{F} is minimized.
% Assumes that a solution exis... |
%% dof numbering 1st order
clear
% save dofNmb1st
load dofNmb1st;
dof = lnDebugES.';
dof = dof(:)+1;
pnt = -ones(size(dof));
k = 1;
for i = 1:length(dof)
idx = find(dof == dof(i) & pnt ~= -1);
if idx
pnt(i) = pnt(idx(1));
else
pnt(i) = k;
k = k + 1;
end
end
pnt... |
classdef SYResponder < SYObject
properties
end
methods
function obj = SYResponder
end
end
end
|
push 1
push 2
push 3
pint
|
function [N,R,P] = kongzhidingdian(M,n,p,t,ui,d)
%KONGZHIDINGDIAN 此处显示有关此函数的摘要
% 此处显示详细说明
R=zeros(1,2);
for i=1:M+1
for j = 1 : n+1
% j = 1 : n+1;
N(i, j) = Njp(j, p , t(i), ui);%Nij存储Njp(ti) i=1~M+1,j=0~n
end
R(i,:)=d(i,:)-Njp(1,p,t(i),ui)*d(1,:)-Njp(n+1,p,t(i),ui)*d(M,:);% R(i)=d(i)-N... |
function [d,edge] = downsamplefilt(x,n,dim,op)
% function [d,edge] = downsamplefilt(x,n,dim,op)
if (nargin == 4),
isdim = true;
elseif (nargin == 3),
if (ischar(dim) || isa(dim,'function_handle')),
op = dim;
dim = 1;
isdim = false;
else
isdim = true;
op = @max;
e... |
clc;
clear all;
T_0 = pi;
N = 100;
w_0 = 2 * pi / T_0;
w = [-N:N] * w_0;
t = [-4 * pi:0.1:4 * pi];
x = exp(-t/2);
fun = @(x) |
function m_interfere = trace_interference(weights,learn_rate)
global EXPT CONDITION STIM_SET SIMULATION NUM_ROWS NUM_COLS NUM_INPUT_DIMS TEST_PARADIGM NUM_ENCODING_CYCLES
global NUM_INTERFERENCE_CYCLES PHASE SINGLE_SESSION
global NUM_ROWS NUM_COLS NUM_INPUT_DIMS unique_counter
global A_samp B_samp cycle ACT_FIG ETA G
... |
% tf taken from wikipedia's sallen-key filter design
R1 = 150;
C1 = 4.7e-6;
R2 = 2*R1;
C2 = C1;
Rb = 20000;
Ra = 15000;
Rf = 3000;
num = [(1+Rb/Ra)/(R1*C1), 0];
den = [1, (1/(R1*C1) + 1/(R2*C1) + 1/(R2*C2) - Rb/(Ra*Rf*C1)), (R1+Rf)/(R1*Rf*R2*C1*C2)];
sys = tf(conv(num,num),conv(den,den));
frequencies = log... |
function connect(p,poso,B,n)
for i = 1:n
if B(i,1) > 0
line([p(i,1),poso(i,1)],[p(i,2),poso(i,2)],'color','blue');
hold on;
end
end
end |
function M = getMatrixM(Nbubbles, posBubbles, fs, G0)
% function M = getMatrixM(Nbubbles, posBubbles, fs, G0) returns the
% matrix M (see between equation (2) and (3))
%
% INPUTS:
% Nbubbles : the number of bubbles in the system
% posBubbles : the locations of the bubbles
% fs : the scattering function
% G0 : the free... |
close all
els = [];
Fs = [];pots=[];adds = [];
Fs1 = [];pots1=[];adds1 = [];
Fs2 = [];pots2=[];adds2=[];
cols = [];cols1=[];cols2=[];
alpha=-1;
names=cell(17,1);
names{1} = 'cage3';names{2} = 'cage4';names{3} = 'cage5';names{4} = 'cage7';
names{5} = 'cage8';names{6} = 'cage9';names{7} = 'cage10';names{8} = 'cage12';
n... |
%% Task 1
% Generate UE-Specific Reference Symbols and map them on the DL LTE
% resource grid for any two different chosen enb configuration.
% Take antenna ports as port5 and port8.
% Explain the differences observed on the grid.
enb1 = lteRMCDL('R.0'); % change with 'R.4'
enb1.PDSCH.TxScheme = 'Port5'; % change with ... |
function make_smaller_roms_file(input_filename, new_filename, xi, eta)
%MAKE_SMALLER_ROMS_FILE subset history file for given xi and eta range
% make_smaller_roms_file(input_filename, new_filename, xi, eta)
%
% variables: 'temp','salt','u_eastward','v_northward','zeta'
%
% - using constant z (not time-dependent vertic... |
function [ utmXyBoundary ] ...
= generateUtmXyBoundaryOfLidarDataset(dirToLidarFiles, simConfigs)
%GENERATEUTMXYBOUNDARYOFLIDARDATASET Generate the UTM (x, y) boundary
%polygon matrix for the input LiDAR dataset.
%
% Inputs:
% - dirToLidarFiles
% The absolute path to the LiDAR data set.
% - simConfigs
% ... |
%% Full Analysis on Decimation, Interpolation, Upsampling & Downsampling Process to DSP
%% Original Function Definition
sample_space=linspace(-25,25,101);x_value = zeros(size(sample_space));
for i= 1:length(sample_space)
x_value(i)= ((2/sample_space(i))*sin(sample_space(i)*pi/8))^2;
end
x_value(sample_space... |
% wah_wah.m state variable band pass
% written by Ronan O'Malley
% October 2nd 2005
%
% BP filter with narrow pass band, Fc oscillates up and down the spectrum
% Difference equation taken from DAFX chapter 2
%
% Changing this from a BP to a BS (notch instead of a bandpass) converts this effect to a phaser
%
% yl(n) ... |
function C=getRelationMatrix(ind)
% ind, logical matrix
% C, numerical matrix
% Yifeng Li
% May 04, 2011
[numCluster,numSample]=size(ind);
C=zeros(numSample,numSample);
for c=1:numCluster
C(ind(c,:),ind(c,:))=1;
end
end |
function start = drawJustifiedText(window, string, alignment, size, style, line_height, text_block_width, font_ratio, font_family, color, flip)
if nargin < 11
flip = 1;
end
gray = [103, 103, 103];
screenWidth = 1920;
screenHeight = 1080... |
%Display normalized trial tables.
function data=trials_show(trial,style,chs)
%trials_show(trial,style,chs)
% Display trial tables. "trial" is a 3D matrix with dimensions
% n_samples x n_time x n_channels. "Style" can be 1 or 3.
%
%Y.Mishchenko (c) 2015
if(nargin<2 || isempty(style)) style=3; end
if(nargin<3 || isemp... |
%This program is fiber simulation for the I-randomness uniform continuous
clear all %clearing program
close all
clc
kx=64;
[x]=linspace(0,1, kx+1); %linespaceing for x
[y]=linspace(0,1, kx+1); %linespacing for y
n=200; %sample siz... |
function [bregman_div, A] = ITML(y, X, task)
cf = cd('./ITML_code'); setpaths3(); cd(cf)
[bregman_div, A] = MetricLearningAutotune(@ItmlAlg, y, X,[], task);
|
function y=exp2(beta0, x)
y=exp(-x/beta0(2))*beta0(1)+beta0(3);
%w=max(x);
%square1 = rectpuls(x-beta0(3)-w/2, w);
%y =y.*square1;
|
% Kalman
clear;
t=0.01;
N=32;
A=[1 -t;0 1]; % 状态转移矩阵 Φ(k)
B=[-0.5*t.^2;1];
H=[1 0]; % 观测矩阵 H(k)
g=9.81;
X=zeros(2,N);
X(:,1)=[50000;0]; % 目标的状态向量 X(k)
Z=zeros(1,N);
Z(1)=H*X(:,1); %观测量Z(k)
P=zeros(... |
function [ indUpSeparating ] = isUpSeparating(obj, bars )
%%
% 《日本蜡烛图技术》,1998年5月第一版,P153
%% Parameters
errorLimit = 0.001*obj.zoomFactor;
%%
ind1 = bars.yinYang(1:end-1)==-1;
ind2 = bars.yinYang(2:end)==1;
indOpen = abs(bars.open(2:end)-bars.open(1:end-1))./bars.open(1:end-1)<errorLimit;
indBeltHold = obj.isBeltHoldUp(... |
%% BEGIN
%%Clearing all the variables used and delete any Serial Port Objects
clear
clc
close all
% Add path to the kinect 2.0 interface by Juan and Diana
addpath('D:\MatLab\Kin2')
addpath('D:\MatLab\Kin2\Mex');
%%
% Create Kinect 2 object and initialize it
% Available sources: 'color', 'depth', 'infrared', 'body_ind... |
close all
clear
%set parameters
sigma = 1;
alpha = 0;
beta = 0.995;
eta = 1;
theta = 3/4;
epsilon = 10;
rho_a = 0.9;
rho_z = 0.8;
rho_R = 0.8;
rho_nu = 0.8;
psi = 1;
%monetary policy
phi_pi = 1.5;
phi_y=0.125;
save param_nk sigma alpha beta eta theta epsilon rho_a rho_z rho_R rho_nu psi phi_pi phi_y;
dynare ne... |
% Gives the coefficients of the first N hermit polynomilas
% column i corresponts to the coefficients of hermit polynomial of degree i-1, [ a0 a1 ... ai 0 ... 0 ]'
function [coef] = legendre_pol_coef(N)
coef = zeros(N+1,N+1);
coef(1,1) = 1;
coef(2,2) = 1;
for i = 3 : N + 1
n = i - 2;
coef(:,i) = circshift... |
z = 0.045 + j*.4; y = j*4.0/1000000; Length = 250;
gamma = sqrt(z*y); Zc = sqrt(z/y);
A = cosh(gamma*Length); B = Zc*sinh(gamma*Length);
C = 1/Zc * sinh(gamma*Length); D = A;
ABCD = [A B; C D]
Z = Zc * sinh(gamma*Length)
Y = 2/Zc * tanh(gamma*Length/2)
|
function s0 = EPR_fitfnc_rhombic(p,b0,opt)
% System variables
Sys.S=1/2;
Sys.g=[p(1) p(2) p(3)];
Sys.gStrain =abs([p(4) p(5) p(6)]);
Sys.HStrain =abs([p(7) p(8) p(9)]);
% Simulation
Exp = struct('Range',[b0(1) b0(end)],'mwFreq',opt.mw, 'Harmonic',opt.Harmonic,'nPoints',length(b0));
[bs,s0]=pepper(Sys,Exp); ... |
function [dM] = M_derivative(q,dq,M)
dim = size(M);
dM = sym(ones(dim(1),dim(2)));
for i = 1:length(M)
for j = 1:length(M)
dM(i,j) = jacobian(M(i,j),q)*dq;
end
end
dM = simplify(dM,'IgnoreAnalyticConstraints',true);
end |
function texture = makeAlphaTexture(filename, alphaColor,wPtr)
%loads the stimuli from the given experiment.stimuli.folder as textures
%into experiment.screen.wPtr
%Read image from file:
image=readAlphaImage(filename,alphaColor);
%convert to integer imaging
image = image*255;
%calculate the texture from t... |
function D = mtxdya(N);
% Generating dyadic(Paley) ordered HADAMARD matrix,
% N must be a power of 2.
warning off
q = log2(N);
if sum(ismember(char(cellstr(num2str(q))),'.'))~=0
disp(' Warning!... ');
disp('The size of Vector must be in the shape of 2^N ..');
return
e... |
function y = maxk(x, k)
y = sort(x, 'descend');
y = y(1:k); |
%% accuracyTest
%delete('result3.mat');
endd =1;
c= 0;
while(1)
if(endd < 0.2)
break;
end
start = 0.1;
while(1)
c=c+1;
if(endd < start)%%if(endd <= start)
break;
end
startEpoch = fix(start*512);
endEpoch = fix(endd*512);
selectUse... |
clc
clear all
close all
load Data_save.mat
load times.mat
t = times;
x = Data_save(1:3,:);
xdot = Data_save(4:6,:);
angles = Data_save(7:9,:);
anglesdot = Data_save(10:12,:);
figure(1)
plot3(x(1,:),x(2,:),x(3,:));
xlabel('时间(s)');
ylabel('位置(m)');
title('位置变化曲线');
grid on
figure(2)
plot(t,xdot(... |
function [fileNameTiger, numFiles, halo, alarmOffset, targetCategoryScore] = ReadTigerConfig(fileName)
fid = fopen(fileName);
halo = fscanf(fid,'%f\n',1);
alarmOffset = fscanf(fid,'%f %f\n',[1 2]);
% confuserScore = fscanf(fid,'%f\n',1);
line = fgets(fid);
targetCategoryScore = tex... |
classdef InputCpd < CondProbDist
%INPUTCPD
properties
dof;
ndimensions;
params;
prior;
end
methods
function model = InputCpd(varargin)
%
end
function computeMapOutput(model,varargin)
%
notYetImplemented('InputCpd.computeMapOutput()');
end
function fit(model,varargin)
%
notYet... |
% Reglereinstellung nach Ziegler-Nichols-Verfahren 2. Möglichkeit
% Funktion gibt Reglerparameter Kr,Tn,Tv zurück
% Kr: Reglerverstärkung
% Tn: Nachstellzeit
% Tv: Vorhaltezeit
% Der Funktion müssen Streckenparameter übergeben werden:
% Ks: Verstärkung K der Strecke
% Ta: Anstiegszeit. Zur Bestimmung von Ta Wendeta... |
function [ mzInterval, spInterval ] = testCoverage( path, file,ppm, interval, mzRange );
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
javaclasspath('packages/imzMLConverter/imzMLConverter.jar')
fullfile = [path file];
imzML = imzMLConverter.ImzMLHandler.parseimzML(fullfile);
% Get t... |
function [ chromosome ] = mutation_multiple_bit( chromosome, k)
%MUTATION_POINT Function is make multiple point mutation in chromosome
% @var integer[] chromosome - array bit
% @var integer k - number point mutation
if (nargin == 1)
k = 5;
end
n = size(chromosome, 2);
rand_indexes = randi([... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 2.4: Transformación del dominio
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2.7.2 Filtrado espacial de imágenes digitales
%%%%%%%%%%%%%%%%%%... |
function [eigval, eigvec] = find_eig(A)
N = size(A); N = N(1); p = [N, 1];
eigval = complex(zeros(N,1),0);
eigvec = complex(zeros(N,N), 0);
in_guess = [complex(0,0); complex(ones(N,1),0)];
options1 = optimoptions('fminunc', 'Display', 'Iter', 'Algorithm', 'quasi-newton', 'StepTolerance', 1e-15);
... |
function out_img = blur_edge(in_img)
%degradation kernel
h = fspecial('gaussian', 60,10);
H = psf2otf(h,size(in_img));% compute the optical transfer functions from the given point spread functions
blurred_img = abs(ifft2(H.*fft2(in_img))); %blurred version of the input with this optical transfer functi... |
function [source_new, dist] = create_echo_source(source, receiver, p1, p2, dist0)
%source <- coordinates of sound source
%receiver <- coordinates of microphone
%p1,p2 <- coordinate vectors corresponding to points of desired wall
%dist0 <- distance traveled so far
pp = p2-p1;
normal = [pp(2); -pp(1)];
normal = normal/no... |
%addImage examples:
%
% %%%extractexamples
%
% %%%runexamples
%
% %%%seealso steno3d.addImage, steno3d.scatter, steno3d.surface, steno3d.trisurf
%
% Example 1: Add a newly created PNG image to a %%%ref[Point](steno3d.core.Point) resource
pngFile = [tempname '.png'];
imwrite(imread('ngc6543a.jpg'), pngFile, 'p... |
function stats = AMIGO_PEPostAnalysis(PEinputs, PEresults,verbose,plotflag)
%% Posteriori Analysis of Parameter estimation.
% computes the folowing statistical tests and scores for each experiment
% separately and in total:
% - R2 and adjusted R2
% - Chi^2 fit test of the sum of squared resudials
% - Pearson Chi^... |
clear all;
close all;
X = load('data3.txt');
scatter(X(:,1),X(:,2));
size = length(X);
hold on;
k = 4;
C = X(1:k,:);
figure;
scatter(C(:,1),C(:,2))
U = zeros(size,2);
Q = 100;
e = 0.0001;
m = 1;
exit = false;
while exit == false
for i = 1:size
d = zeros(k,1);
for j= 1:k
d(j) = pd... |
Met de function 'uigetfile()' kies je een bestand
in Matlab. |
clear all;
w=[1;1];
%X=[1 2 5 4;
% 2 5 1 2];
%Y=[19 26 19 20];
X = textread('d:/ml/q2x.dat')';
X = [X;zeros(1,size(X,2))];
Y = textread('d:/ml/q2y.dat')';
a=0.001;
W=[1;1];
for i =1:20000
j=randperm(size(X,2),1);
x_=X(:,j);
total=(w'* x_-Y(1,j))*x_;
w=w-2*a*total;
W=[W w];
end
plot(1:1:size(W,2)... |
% Written by Patrick Strassmann
function tbtPeakValues = tbtBoutEndFinder(pressStackMatrix, boutEndTimes, slidingWindowSize, alpha, percentOfPeakMax, wantPlots)
if nargin<5
wantPlots = 0;
end
tbtPeakValues = nan(1,size(pressStackMatrix,1));
if wantPlots == 1; figure('position',[680 302 883 675]); end
for i =... |
close all;
clear all;
% % % % % Set up the signal % % % % %
x_k_original = [0.192, 1.682];
t_k_original = [0.329, 0.851]; % Normalised to 1
x_t = zeros(1, 2048);
for i = 1:length(x_k_original),
x_t(round(t_k_original*2048)) = x_k_original;
end
% % % % % Generate noisy moments % % % % %
s_m = gen_noisy_moments(... |
function [ output ] = integrator( input,bits)
output = zeros(1,input.size(2));
output = fi(output,'Signedness','Unsigned','WordLength',55,'FractionLength',0,'RoundingMethod', 'Floor', 'OverflowAction', 'Wrap');
output(1) = 0;
for i=1:input.size(2)-1
output(i+1)=output(i)+input(i);
end
e... |
function stop_multi_record(object, eventdata)
global mouseDown queries genEnv;
mouseDown = false;
clf
queries = [queries;plotRandOriGoalTask()];
end
|
%|--------------------------|%
%| FMAT3888 Tutorial Week 2 |%
%| Author: Vishaal Lingam |%
%| Date: 17-08-2021 |%
%|--------------------------|%
% Q1.
% Evaluating the intergral of sin(x) from zero to pi
n=7; % maximum exponenet and number of trials
J = linspace(1,n,n); % vector of exponents
MU = z... |
% ======================================================================
% Wavelets based on nature image statistcs Version 1.0
% Copyright(c) 2020 Qiang Li
% All Rights Reserved.
% qiang.li@uv.es
% ----------------------------------------------------------------------
% Permission to use, copy, or modify this sof... |
function [theResult] = plotFCONResults(mergedPacketCellArray, dropboxAnalysisDir, myResultsVariable)
subAnalysisDirectory='fitFCONModelToIndividualResponses';
%effectiveContrast_sessxrunxevent = load('~/Dropbox-Aguirre-Brainard-Lab/MELA_analysis/pupilMelanopsinMRIAnalysis/fitFCONModelToIndividualResponses/effectiveC... |
% [H,W] = freqz([1/3 1/3 1/3],1,1024); %Finner frekvensresponsen
% subplot(2,1,1)
% stem(W/(pi), abs(H), 'g'); %Plotter amplituderespons med normalisert frekvens
% axis([0 1 0 60]);
% ylabel('|H(\omega)|')
% xlabel('\omega/\pi')
% grid on
% hold on
%
% subplot(2,1,2)
% stem(W/(pi), angle(H), 'g'); %Plotter amplituder... |
function testSN
% Tests whether the Sensor Network Simulator is reasonable
runThis = input('WARNING: modifies P,E and SN. Continue? (1 or 0)');
if runThis
global P;
global E;
global SN;
global T;
T = 1; % dummy value
load('examples/SNtest_SN');
load('examples/SNtest_PE1');
[delay pack... |
[us,RMSE] = SART_reconstruction(projection);
cd('../result');
save('SART_aic_window150','us','RMSE');
clear
cd('../USCTSim-master/result/kwave_2board_object');
load('rfdata.mat');
rfdata_ob = rfdata;
cd('../kwave_2board_water');
load('rfdata.mat');
load('kgrid.mat');
load('sensor.mat');
rfdata_wa = rfdata;
clear rfdat... |
function [J grad] = cost(X, Y, Theta, lambda)
h = sigmoid(X * Theta'); % column
m = size(X, 1);
J = 1/m*(-sum(log(h(find(Y==1)))) - sum(log(1-h(find(Y==0)))));
grad = (h - Y)' * X/m;
if lambda != 0
ThetaWithoutFirst = Theta(2:end);
J = J + lambda/(2*m) * ThetaWithoutFirst * ThetaWithoutFirst';
gr... |
%% q1- open loop
%Author- Roshan Pradhan
% This script runs the direct collocation for open and closed loop and
% saves to workspace
clc
clear
close all
%% Part a
dt=0.1; N = 100;
u0_des=zeros(1,N); x0_des = zeros(2,N); u_in_des = [u0_des; x0_des];
X_f_des = [-pi; 0]; X_0_des = [0; 0];
lb_des = [-1.5*ones(1,N); -Inf... |
% test WG
clear;
addpath('Lib')
format short;
db = @(x)20*log10(abs(x));
if false
S = mmread('S.mm');
T = mmread('T.mm');
Dir = importdata('DirEdges.dat');
portS1 = importdata('portAWavePort1.dat');
portT1 = importdata('portBWavePort1.dat');
portS2 = importdata('portAWavePort2.dat');
portT2 = importdata('... |
%project sine sweep
Fs = 48000;
Ts = 1/Fs;
t = [0:Ts:10];
x = chirp(t,0,10,Fs/2).';
N = length(x);
%fade in formula
fadeIn = linspace(0,1,Fs/4).';
unityGain = ones(N-Fs/2,1);
fadeOut = linspace(1,0,Fs/4).';
a = [fadeIn; unityGain; fadeOut];
y = zeros(N,1);
for n = 1:N
y(n,1) = x(n,1)* a(n,1);
end
audiowrit... |
function [ W, b ] = InitializeParam( mu, sigma, numOfClasses, imageSize, numOfHiddenNodes )
%UNTITLED2 此处显示有关此函数的摘要
% 此处显示详细说明
% % Initialize W, b
% W1 = normrnd(mu, sigma, numOfHiddenNodes, imageSize);
% b1 = normrnd(mu, sigma, numOfHiddenNodes, 1);
% W2 = normrnd(mu, sigma, numOfClasses, numOfHiddenNodes);
... |
tm = 0.005;
t = 0 : tm / 1000 : tm;
f1 = 1600;
f2 = 1800;
sin1 = sin(2 * pi * f1 * t);
sin2 = sin(2 * pi * f2 * t);
plot(t, sin1);
hold on;
plot(t, sin2);
hold on;
%plot(t, sin1+sin2);
%hold on;
|
clc;
close all;
REPETITION = 100;
ITERATIONS = 400; % more and more
lval = [0.2 0.5 0.8 0.5];
noval = [1 1 1 0];
fnmsd = ['msdl2.fig ';'msdl5.fig ';'msdl8.fig ';'msdl5n.fig ' ];
fnmse = ['msel2.fig ';'msel5.fig ';'msel8.fig ';'msel5n.fig ' ];
fnmsdev = ['msdevl2.fig ';'msdevl5.fig ';'msdevl8.fig ';... |
first_num=randperm(38,6)
second_num=randi(8,1) |
% ----------------------------------------------------------------------- %
%
% Autor: Cleidson dos Santos Souza | Data da última alteração: 16/12/2018
%
% Descrição da função: Rede Neuro Fuzzy - Anfis
%
% Protótipo: function [ys, emq, theta, c, sig, mu_A_x, mu_B_y]
% = anfis(x, y, yt, nfp, nfpr, e... |
%%%%%%%%%%%%%%%%%%%%%
% Naoki Tominaga & Daniel Webber
% u0876779 u0838328
% ME EN 1010 Lab Section #5
% HW#7 and is_color.m
% 3/27/15
% is_color takes in a picture array , a certain row and column , and a
% target color
% inputs - picture (image array)
% - row (a row index)
% - column (a column index)
%... |
function [ ForwardMatrix ] = ForwardMatrix(ObsPoints, paramCoords)
%FORWARDMATRIX takes in the Observation point and the coordinates of the
%parmeters to generate the sensitivity matrix.
% Obs points are: x, y, z
% paramCoors are: in lower x, upper x, lower y, upper y, lower z, upper z
lengthObs = length(ObsPoin... |
function R = calc_orderParameter(relevant_data)
% Calculating general order parameter function
%
% Inputs: relevant_data : node data [mxT]
% Output: R : order parameter calculation
%
% Original: James Pang, QIMR Berghofer, 2019
%% Main code
R = abs(mean(exp(1i*relevant_data)));
|
function p = predict(theta, X)
%PREDICT Predict whether the label is 0 or 1 using learned logistic
%regression parameters theta
% p = PREDICT(theta, X) computes the predictions for X using a
% threshold at 0.5 (i.e., if sigmoid(theta'*x) >= 0.5, predict 1)
m = size(X, 1); % Number of training examples
% You nee... |
%% Calculation and comparison of experimental and theoretical efficiency
%David Leitao (david.leitao@kcl.ac.uk); 23-04-20
%Requires the handles to the SPGR and bSSFP steady-state signal functions
%and its derivatives -> needs path to library folder
clearvars; close all; clc;
%% Load signal functions and its derivat... |
%% Carga de archivos
% carga de archivos mediante funcion handles
carga_archivo = import_data();
SsFi = carga_archivo.SS_FI(); % SsFi contiene los archivos cargados en un cell.
%% Convolucion -> Respuesta al impulso
Ri_conv = conv(SsFi{1},SsFi{2}); % convolucion entre los archivos cargados (Ej. SineSweep g... |
classdef TPA_MultiExperimentLearning
% TPA_MultiExperimentLearning - Collects TwoPhoton dF/F info of all ROIs from multiple experiments
% and performs averaging over the trials in the same day.
% ROIs are mapped and max response is shown
% Inputs:
% BDA_XXX.mat, TPA_YYY.mat - data base
% O... |
% Range intervals:
x_range = 0.4; % m
y_range = 0.4; % m
t_range = 10; % s
% Step intervals:
dx = 0.1; % m
dy = 0.1; % m
dt = 0.001; % s
% Thermic coefficient:
k = 0.23; % W/mm.ºC
% Specific heat:
c = 897; % J/kg.ºC
% Volumetric Density;:
d = 2.7*1e-9; % kg/mm³
% Thermic coefficient:
alpha = ( k /(d * ... |
function f = find_wordcomb(word_combination_index)
%%
fake_group_combination = nchoosek(1:26,2);
[~,a,~] = intersect(fake_group_combination,project.subjects.group_no,'rows');
fake_group_combination(a,:) = [];
a = [W(word_combination_index(1)) W(word_combination_index)];
find(ismember(word_comb(:,1),W(word_combina... |
z_c = zeros(1,length(XP));
for ii = 1:36
temp = loopsol(2,:,ii)*20;
meshes = (0:0.001:1)*1;
z_c(ii) = temp(find(meshes == 0.05, 1));
end |
function [eps, eta, epss] = dissipation_spec(k_in, D_in, eta_in)
%% [eps, eta, epss] = dissipation_spec(k, D, [kmax])
%
% This function calculates epsilon based on the dissipation spectra
% (gradient spectra)
% D(k) = 2*nu*k^2*E(k)
% where E(k) is the Energy spectra of the velocity
%
% INPUT... |
path = '~/Documents/research/AWS/sparse_filtering/saved/';
addpath(genpath(path))
folders = dir([path, '/2015*']);
for folder = 1:numel(folders)
fileNames = dir(...
[...
path, ...
folders(folder).name, ...
'/activation_raw*.mat'...
]...
);
master = [];... |
function [good_grid, nb_iteration, grids, f] = Simulated_Annealing(...
initial_grid, beta_min, beta_max, max_comp_time, max_chain_length)
tic
% generation d'une grille avec sous-carre et colonnes correctes
grid = zeros(9);
for i=1:9
grid(i, [1 4 7]) = mod(i-1, 9) + 1;
grid(i, [2 5 8]) = mod(i+2, 9) + 1;
grid(i, [... |
classdef Units
properties (SetAccess = private)
% Units
UnitNames = ["l/s","l/m","l/h"];
% Unit Scaling Factors
UnitScales = [1/60.0, 1, 60];
% Tags that the corresponding scale equation applies to
Tags = [
"cstr3.o... |
function y = OrdinalRankings(x)
%
% Calculate the ORDINAL RANKINGS of vector x (in ascending order)
%
% For details regarding ranking methodologies: http://en.wikipedia.org/wiki/Ranking
%
%
% INPUT
% The user supplies the data vector x.
%
%
% EXAMPLE 1:
% x = [32 73 46 32 95 73 87 73 22 69 13 57];
... |
function [ f ] = fn_sigma2( sigma, mu, n, G, u, v_eff, z )
f = 0;
for i = 1 : n
ui = u(i, :);
sigma_eff = sigma(ui, ui);
for k = 1 : G
f = f + z(i, k) * (log_det(sigma_eff) + ...
matrix_frac(log(v_eff{i})' - mu(ui, k), sigma_eff));
end
end
end
|
classdef rlDataInstance < handle
properties
modelInstance;
dt;
time;
data; % raw stuff loaded from file
measurement; % modified data to fit EKF usages
measurement_labels;
measurement_sensor; % 1 if part of sensor, 0 if not
segments;
... |
function loglik = loglikelihood(theta, Y, X, Z, return_sum)
beta = theta(1:4)
gamma = theta(5:end)
beta_hat = inv(X.'*X)*X.'*Y;
e_hat = Y - X*beta_hat;
sigma = sqrt(exp(Z*gamma));
if return_sum
loglik = -rows(X)/2 * (log(2*pi) + 2*sum(log(sigma)))-sum(e_hat.^2./(2*sigma.^2));
else
... |
% j = sensor.jointAngles(2, jointInd);
% fprintf(f1, '%d,0,%.6f,%.6f,%.6f\n', n, sensor.jointAngles(2, jointInd));
% fprintf(f2, '%d,0,%.6f,%.6f,%.6f\n', n, sensor.endEffPos(2, :));
% if mod(n, 100) == 0
% fprintf('%d,0,%.6f,%.6f,%.6f\n', n, sensor.endEffPos(2, :));
% end
%
% n = n + 1;
% motor.jointAngles = ze... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.