text stringlengths 8 6.12M |
|---|
% Input : m x m matrix L, rhs vector b
% Output : Vector b overwritten by the solution y
% of Ly = b
for k = 2 : m
b(k) = b(k) - L(k,1:k-1) * b(1:k-1); % DOT
end
|
classdef Battery < handle
properties (SetAccess = immutable)
param_A % [V]
param_B % [Ah^-1]
param_K % [V]
voltage_full % [V]
voltage_exp % [V]
voltage_nom % [V]
q_full ... |
% Нейронные сети
% Лабораторная работа 1
% Программа вычисления ДПФ гармонического сигнала
close all; clear all;
disp('*** Программа вычислениЯ ДПФ гармонического сигнала ***');
A = input('Введите амплитуду сигнала, ед.: ');
f0 = input('Введите частоту сигнала, Гц: ');
fdn = 2*f0; % Частота дискре... |
function c = mcross(a, b)
% Matrix cross (vector) product of two pure quaternions. Like cross but matrix
% not elementwise.
% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
% See the file : Copyright.m for further details.
error(nargchk(2, 2, nargin)), error(nargoutchk(0, 1, nargout))
if ~isa(a, 'quatern... |
function [X, flag, iter] = NewtonInverse(A, tol, maxIter)
% NewtonInverse pseudo inverse estimated by Newton iteration.
% X = NewtonInverse(A) attempts to fine the pseudo inverse of matrix A
% using Newton method. If A is of size M-by-N, then X is N-by-M;
%
% X = NewtonInverse(A, TOL) specifies the toleranc... |
function [textrema]=trendextrema(data,mu1,mu2)
%data为输入的时间序列
%mu1为对应的谷值阈值, mu2为对应的峰值阈值
%data为数据
%返回的数值 trendsig 1,0,-1 分别表示上升、振荡、下降
%version 1.00 by zhangyan 2013-4-2
if nargin<3
mu1=0.02;
mu2=0.02;
end
pv=zeros(length(data-1),1);
for i=2:length(data-1)
pv(i)=peakvalley(data,i,mu1,mu2);
end
if ~nnz(pv)
... |
classdef GrainPack < handle
% A class to contain all the grains of a grain pack. You can use it to
% binarize a grain pack and do some simple visualizations and calculate
% prosotiy
properties
nGrains
grains
boxDimensions
resolution
labeledImage
fullLabeledImage
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%% identifyDir.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% identify kind of direction
%
% for details of input and output structures see VRBBO.m
%
function [p... |
function p = ptest(str,i)
% Tests the contents of polygons inside gds data struct in AWG.
if nargin > 1
p = display(str.gds,1,i);
else
p = display(str.gds,1);
end
|
function [startIter, endIter, samplesPerIter] = linearRasteredIteration(MPIparams, Physicsparams)
f_drive = MPIparams.f_drive;
fs = Physicsparams.fs;
FOV_z = MPIparams.FOV_z;
time = MPIparams.time;
traversedFOVz = MPIparams.traversedFOVz;
robotSpeed = FOV_z/time; % robot ar... |
function data
close all;
ydata = [1 3 5 7 9];
xdata = [-2 0 2];
for i = 1:5
Title = strcat('WaveTransformOverAnEllipticalShoal\','section',num2str(i),'.fig');
h = open(Title); % open figure
[ measuredX, simulatedX, measuredY, simulatedY ]=getdata(gca);
close(h);
newh = plotdata(measuredX, simulatedX, measuredY, simula... |
clear all;
close all;
f = ballw(10)
% image(f.cdata)
%仅演示实时动画的调试格式为ballw(K)
%既演示实时动画又拍摄照片的调试格式为f = ballw(K,ki)
%K红球运动的循环次数(不小于1)
%ki指定拍摄照片的瞬间,取1到1034之间的任意整数
%f存储拍摄的照片数据,可用image(f.cdata)观察照片
%产生封闭的运动轨迹
function f = ballw( K,ki )
data = importdata('test.csv');
frame_no = data(:,1);
x = data(:, 2);
y = ... |
%GET_LIMITS obtains the maximum and minimum values to use when plotting
%simulated data.
%
% Syntax
% ------
% lims = ui.get_limits( x, factor )
%
% Details
% -------
% This function returns a 1x2 matrix containing the minimum and maximum
% to use as limits on the x- and y-axis. x is a vector of varied values and
% fa... |
clear;close all;clc;
% signal length
N = 2450;
% number of sp ikes in the signal
T = 147;
% number of observations to make
K = 441;
%生成x向量
x=zeros(N,1); %生成0矩阵
p = randperm(N); %随机打乱序列
x1=unidrnd(1,T,1); %产生从1到N所指定的最大数数之间的离散均匀随机整数
x(p(1:T))=x1;
%[x]=xlsread('C:\MATLAB7\work\X矩阵2500.xlsx... |
function Css=ProbabilityORF(N,Nx)
Rxx=[];
%Rxx is an array that will be used to store the possibility values
for xxx=3:N
a=0;
for i=1:1000
s=randi(4,1,xxx);
d='';
for ii=1:xxx
if s(ii)==1
d(ii)='A';
elsei... |
function plot(Lfd)
m = Lfd.nderiv;
wfdcell = Lfd.wfdcell;
afdcell = Lfd.afdcell;
k = length(afdcell);
nplot = m + k;
for j=1:m
subplot(nplot,1,j)
plot(wfdcell{j})
ylabel(['w_',num2str(j-1),'(t)'])
end
for j=1:k
subplot(nplot,1,m+j)
plot(afdcell{j})
ylabel(['a_',num2str(j-1),'(t)'])... |
%% Initialization section
clear all; close all;clc;
prompt1 = 'Please enter the subject ID given for the user: ';
SUBJECTID = input(prompt1);
markers = ["lef","lbd","lelb","lelb1","lie","ref","rbd","relb","relb1","rie"];
%Kinect initialization script
addpath('F:\github\wearable-jacket\matlab\KInectProject\Kin2');
ad... |
%产生一个20X5的随机二维矩阵
A = randn(20,5)
%提取任意指定的元素
B = A(2,3)
%求该矩阵的第一列的数据分布图(直方图)
hist(A(:,1));
%求平均值
a = mean(mean(A))
%求最大值
b = max(max(A))
%求最小值
c = min(min(A))
%求每一列元素的标准差
d = std(A)
%每一列元素的和的绝对值形成的行向量
e = abs(sum(A))
|
function PLPA(sluk,mm,std,Wtt,bbeta,Yem)
L = length(Yem);
ls = length(sluk);
figure
for i = 1:length(Yem(:,1))
subplot(4,1,i)
yyaxis right
plot(1:L,bbeta*sluk(i)),hold on
ylabel('Position','FontSize',12,'Rotation',90);
yyaxis left
plot(1:L,Yem(i,:));
xlabel('Time','FontSize',12)
ylabel... |
function [rmseIni] = rmse(yE,y,NumMSE,M)
% yE: source estimate; y: true location
AllComb=perms([1:M]); % all possible permutation
rmse=zeros(NumMSE,1);
for idxMSE=1:NumMSE
for mm=1:M
rmse(idxMSE)=rmse(idxMSE)+norm(yE(:,AllComb(idxMSE,mm))-y(:,mm))^2;
end
end
rmseIni=min(rmse);
end |
KbName('UnifyKeyNames');
%% PARAMETERS
params = struct();
% PSYCHTOOLBOX
params.psych_background_black = [127 127 127];
params.psych_background_white = [255 255 255];
params.psych_text_color = [255 255 255];
if ~exist('rect','var')
params.rect = [0 0 1920 1028];... |
clc;
clear all;
close all;x=[1,2,3,4];
%finding FFT of x(n);
fX=fft(x);
disp('FFT of x(n)= ');
disp(fX);
%finding DFT of x(n)
dX=zeros(1,4);
for k=0:3
for n=0:3
dX(k+1)=dX(k+1)+x(n+1).*exp(((-i).*2.*pi.*k.*n)./4);
end;
end;
disp('DFT of x(n)= ');
disp(dX); |
function [CRP,NWV,MPS,LPH,LPHp,XYZ] = f_coord_tform(PHL, Ang, ...
fold_over_dir, fat_shift_dir, slice_orientation, ...
patient_orientation, patient_position)
%[f_coord_tform] transform scanner coordinate from PHL to all the other.
%
% USAGE:
% [CRP,NWV,MPS,LPH,LPHp,XYZ] = f_coord_tform(PHL, Ang, ...
% ... |
function mask = gen_mask(feat)
% mask = ones(241,241);
% mask = mask*0.3;
%
% mask(bbox(2)-29:bbox(2)+bbox(4)+29,...
% bbox(1)-29:bbox(1)+bbox(3)+29) = 0.8;
%
% mask(bbox(2):bbox(2)+bbox(4),...
% bbox(1):bbox(1)+bbox(3)) = 1.0;
bw = im2bw(feat/255,0.7);
SE=strel('square'... |
m = 100;
n = 10;
A = randn(m,n);
xtrue = ones(n,1);
b = A*xtrue;
S = diag([1:m]);
lambda = 1e1;
xp = (A'*S*A + lambda*eye(n))\(A'*S*b);
x0 = xt + randn(n,1);
niter = 500;
rho = 1e1;
%% steepest descent
% f(x) = 0.5*|A*x - b|_S^2 + 0.5*lambda*|x|^2
M = 1/norm(A'*S*A);
xk = x0;
e1 = zeros(niter,1);
fprintf(1,'k, |g... |
% Denice heeft een Matlab code geschreven, echter had ze niet veel tijd en
% heeft daardoor enkele fouten gemaakt. Ze heeft onbewust 'Quick n Dirty'
% geprogrammeerd en heeft daardoor niet goed op zitten letten.
% Als het programma wordt gerunt, gebeurd niet hetgeen wat zij voor ogen had.
% Verbeter de fouten van Den... |
function [ rad_min, rad_max ] = rad_minmax( coeffp , toll, max_iter)
% RADICE MINIMA E MASSIMA
% Calcola la radice reale minima e massima con una tolleranza 'toll' entro
% un determinato numero di iterazioni di un polinomio i cui coefficienti
% sono 'coeffp' con il metodo di newton.
%------------------INPUT
% coef... |
%Nithilam Subbaian
%Matlab Assignment 6
%Question 1
b = [3/7 2/3 1/2];
a = [1/2 0 1/3 2];
[z,p,k] = tf2zp(b,a);
zplane(z,p)
title('Pole Zero Plot')
figure;
impz(b,a, 50)
figure;
[h, k] = impz(b,a, 50);
subplot(2,1,1);
n = 0:49;
x = (-1/2).^n;
y = filter(b,a,x);
stem(y)
title('Filter with Digit... |
function [U,V,Calls] = perform_Aniso_Eikonal_Solver_mesh(Calls, vertex, faces, T, start_points, options)
% perform_Aniso_Eikonal_Solver_mesh - launch the Gauss-Seidel Iterations
% to compute anisotropic geodesic distances on mesh
%
% [U,V,Calls] = perform_Aniso_Eikonal_Solver_mesh(C... |
function [V,c] = roavstep(f,p,x,z,beta,gamma,s1,s2,L1,L2,opts)
% function [V,c] = roavstep(f,p,x,z,beta,gamma,s1,s2,L1,L2,opts)
%
% DESCRIPTION
% This function solves the V step of the ROA iteration. Specifically,
% the ROA estimation problem can be formulated as:
% max beta
% subject to:
% V-... |
% Derive Contact model for the foot
%
% For each angle of the foot, compute the place where it is expected to
% contact the ground.
%
%
figure(1); clf; hold on;
nData = 151;
qFoot = linspace(-pi,pi,nData); %MUST BE ODD!
color = [0.1, 0.6, 0.2];
origin = [0;0];
%%% for debugging:
for i=1:length(qFoot)
clf;
... |
close all;
clear;
clc;
% Randomly picks 30% of dates from cycle 1 and cycle 2 for testing.
% Cycle 1: 23 days, 30% = 7 days, Others = 16
% Cycle 2: 27 days, 30% = 8 days, Others = 19
% Cycle 1
cyc_one_dates = readtable("dates_cycle1.csv");
cyc_one_shuffle = cyc_one_dates(randperm(size(cyc_one_dates,1)),... |
% updates the grid by finding the cell with minimum splitTime, moving
% time forward by that amount of splitTime, then split the cell t is the
% universal time. If minimum was 0 already from the last splitting, then
% split before finding next splitTime.
function cells = updategrid(cells, splitTimeBounds)
A = cells... |
function [graph,faxis,taxis] = showSpect(spectrogram,fs,shiftSize)
%
% Show spectrogram from time-frequency matrix
% This function supports both complex and nonnegative input and both
% monaural and multichannel spectrograms.
% For a multichannel spectrogram, the order of its indexes must be
% [nfreqs x nframes ... |
classdef NN1Hidden
properties
net
testMSE
trainMSE
x
y
xtest
ytest
xtrain
ytrain
epochs
time
end
methods
function obj = NN1Hidden(nHidden, learnAlg, maxEpochs, x, y, checkOverfit, window)
%... |
function phi = rbf(c,p,sigma)
l = norm(c - p);
a = (l/(sqrt(2)*sigma))^2;
phi = exp(-a);
end |
% Syntax
% err = PS_SetPeriod(StimN, ChN, Period)
% Description
% Set period for a channel in milliseconds
% Default value is 5 ms.
% StimN - stimulator number to configure (starts from 1)
% ChN - channel number to configure (starts from 1)
% Period - period value in milliseconds, valid... |
% Denoising an MRI image of the brain
clc;
clear all;
close all;
%% Loading the data
load('../data/assignmentImageDenoisingBrainNoisy.mat');
%% A) Estimation of the noise level
% We are extracting the top left patch of the noisy image as the background
% and then finding the noise level using that
patchSize = 54;
bac... |
% This script runs the estimation of the KMatrix %
%
% 1. Constructs a camera model loosely based on an iPhone6
% 2. Constructs a calibration grid 1m on a side with 10mm grid spacing.
% 3. Positions the grid somewhere in space.
%
% Perform the following actions on each image, repeating an image
% if the homography esti... |
% ctafft Cross-term averaged FFT
%
% FD = ctafft(TD,Averages)
% FD = ctafft(TD,Averages,N)
%
% Similar to a magnitude FFT, but removes
% dead-time artefacts using cross-term
% averging.
% TD: Time-domain data. For matrices
% TD, ctafft works along columns.
% Averages: Starting indices for the FFTs
... |
% generates an ASL signal and estiamtes the perfusion from it
% can be used to iterate over regularization params.... noise...
%
% Used for first draft of modeling papaer
% Does not estimate the baseline separately
%
global rpenalty
% Typical values:
Ttag =0.8 % seconds
del = 0.02; %seconds
crushers=1;
R1t = 1/1... |
syms L_a L_k 'syms';
syms th_l_a th_l_k th_l_h 'real';
syms th_r_a th_r_k th_r_h 'real';
J_l = [-L_a*sin(th_l_a)-L_k*sin(th_l_a+th_l_k) -L_k*sin(th_l_a+th_l_k) 0;
L_a*cos(th_l_a)+L_k*cos(th_l_a+th_l_k) L_k*cos(th_l_a+th_l_k) 0;
1 1 1];
J_r = ... |
%SAMPLE_SPARSE_ATA: gram matrix A^t*A of sparse sampling operator A.
% Zeros-out the rows of the matrix corresponding to zeros
% in the mask given.
%
% X = sample_sparse_AtA(X_in, mask)
%
% equivalent to (but cheaper than)
% X = sample_sparse_t(sample_sparse(X_in, mask), mask)
%
% ... |
function [Xprime] = inverseGlobalTransform (xprime,transform)
c = transform.c;
T = transform.T;
b = transform.b;
Xprime = 1/b.*(xprime - c)/T;
end |
function [handles] = initializeHandles(handles, hObject)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
handles.output = hObject;
handles.V=InitializeCamera;
handles.DAQ = InitializeDAQ;
handles.V.videoParms.areathresh = 0.001; % total pixels above thr
nX = 576;
nY = 480;
handles.V.Widt... |
a1=1.676; a0=0.6966; b1=0.05029; b0=0.04458;
s(1:12)=0;
u(1:250)=1;
y(1:12)=0;
D=120;
N=120;
Nu=119;
Yzad(1:N)=5;
% wyznaczenie wektora s
deltau(1)=1
for i=2 : 250;
deltau(i)=u(i)-u(i-1);
end
for i=13 : 250;
y(i)=b1*u(i-11)+b0*u(i-12)+a1*y(i-1)- a0*y(i-2);
Usum=0;
for k=1 : i-1
Usum=Usum+s(... |
function updateFields(source,~,fieldname)
parent = source;
gui = guidata(source);
% change the active channel if needed
if(~strcmpi(source.String{source.Value},'add new...'))
if(~strcmpi(fieldname,'channel'))
return;
else
gui = guidata(source);
gui = readoutAnnot(gui);
... |
z = gdp(:,1);
v = [0 1000 4000 10000 22000]; % this is intervals
for k=1:4; f = find(z>=v(k) & z<v(k + 1));disp(length(f));p(f)=k;end;
for k=1:4; f = find(p == k); m(k) = mean(z(f)); s(k)=std(z(f)); end; |
%{
dla n=2 wykreślić zbiór
Sₚ = {x ∈ ℝ^n: ‖x‖ₚ=1}
p ∈ (0,∞)
%}
clc;
clear;
%poziomy wektor niektórych wartości p, dla których będzie obliczanie norm
p = [0.01:0.03:0.99, 1:0.01:2.5, 2.6:0.5:10, 11:1:80];
%np. od 1 do 2 będzie więcej klatek czyli dokładniejsza animacja
%przedstawienie przestrzeni we współrzędnych bieg... |
function [ cost ] = period_to_cost_map(period, x, y)
%Summary of this function goes here
% Detailed explanation goes here
cost = y(abs(x - period)<1e-4);
end
|
function Hd = band_pass_filter(Fs,Fstop1,Fpass1,Fpass2,Fstop2)
%BAND_PASS_FILTER Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.8 and DSP System Toolbox 9.10.
% Generated on: 21-Feb-2021 14:38:12
% Equiripple Bandpass filter designed using the FIRPM function.
% All frequency values a... |
function m_VecVoigt = f_Vec2Voigt2DVect(m_Vector,e_VG)
% Vector en formato matricial, asumiendo notación de Voigt con el que el tensor Sigma y
% Deformaciones teniendo la siguiente forma [Sxx;Syy;Szz;Sxy] (caso 2D, de tensión y deformación
% plana).
%Esta función está vectorizada, donde en dim=2 de m... |
% 计算不同SNR下训练的模型使用范围,给出正确率随着SNR变化的图
accurancy=0:200;
svm_train(1);
load SVMModel_2PSK.mat
load SVMModel_QPSK.mat
load SVMModel_8PSK.mat
load SVMModel_8QAM.mat
load SVMModel_16QAM.mat
load SVMModel_32QAM.mat
for snr=0:200
quantity = 100;
testData = dataset_generatation('random',snr/10,quantity);% generate test data
train... |
function [Svv,Nf,Ns,PSD] = xspectrum_thomson(data,Fs,Fm,deltaf,properties)
% xspectrum estimates the Cross Spectrum of the input M/EEG data
% Inputs:
% data = M/EEG data matrix, in which every row is a channel
% Fs = sampling frequency (in Hz)
% Fm = maximun frequency (in Hz) in the estimated s... |
function Y = coder(x)
% Trasformata DCT (conservo solo la componente DC)
mask = zeros(8); mask(1,1) = 1;
fun = @(x) dct2(x).*mask;
x_dct = blkproc(x,[8 8],fun);
[M N] = size(x_dct);
% Stima basata sul valore DC precedente
err = x_dct(1:M,9:N) - x_dct(1:M,1:N-8);
... |
function theta_exact = exact_solution_theta(time,theta_0,I)
theta_exact = real(1 - cos( 2*atan( sqrt(I)*tan(sqrt(I)*time + atan((1/sqrt(I))*tan(theta_0/2)))) )) ; |
function penaltymatrix = polypen(basisobj, Lfd)
% POLYPEN Computes the monomial penalty matrix.
% Arguments:
% BASISFD ... a basis.fd object
% Lfd ... either the order of derivative or a
% linear differential operator to be penalized.
% Returns a list the first element of which is the basis mat... |
function c = fconv(a, b, shape)
%% Fast convolution of long arrays, exploiting NEXTPOW2 and built-in FFTW wrappers
%
% C = FCONV(A, B, SHAPE) convolves vectors A and B. The length of the resulting
% vector is determined by the optional SHAPE tag.
%
% 'full' - (default) returns the full c... |
function val = clab_smoothDE(val,n,space,dEmode)
if nargin<3 || isempty(space)
space = 'lab';
end
if nargin<4 || isempty(dEmode)
dEmode = 'cie2000';
end
switch lower(space)
case 'lab'
lab = val;
case 'lch'
lab = lch2lab(val);
otherwise
lab = clab_colorspace([space '->lab'],... |
% ======================================
% Cycle-slip detection in measurement domain
%
% zhen.dai@dlr.de
%
% last modified: 2011.Oct
% ======================================
% announcement
anno_text{1}='This software package was developed by the author using time off work and only reflects his personal understanding... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%This function is used to generate the reactive power boundaries for the
%%WTG and PVG strings as a function of the windspeed and the irradiance.
%%Furthermore it updates the casefile with the corresponding active power
%%outpu... |
classdef Combiner_AND<handle
%UNTITLED12 此处显示有关此类的摘要
% 此处显示详细说明
properties
aN
bN
S_L
B
P
K_a
kd_SL
kg_SL
kd_P
kd_B
k1
k2
k3
k_RFU2mol
end
methods
... |
function C=getFullC(k)
C=zeros(2^k,k);
for i=0:2^k-1
binStr=dec2bin(i);
for j=strlength(binStr):-1:1
C(i+1,k-length(binStr)+j)=str2double(binStr(j));
end
end
end |
function affinity_sparse = build_graph(video, cur_idx, cross_num, sigma, ratio)
affinity_sparse=[];
%last frame don't seg CT(i,i+1)
if(cur_idx==video.numFrame)
return;
end
N = video.X * video.Y;
%% Compute spatial color affinity
% disp('computing spatial pixel adjacencies based on color & pixel flow...');
new_ed... |
%Andrew Logue 10/10/19
function [outVec] = bubbleSort(inVec)
%create counter variable count twith starting value equal to
%the length of inVec
countln = length(inVec);
%while loop runs until countln is eqaul to zero, meaning that the
%program has looped through the entire length of inVec
while (countln > 0)
%inte... |
%In this program the plot of only using Raso is generated.
mkdir('Plots','8_Raso');
close(gcf)
Evaluation_1_calc %This is needed
%%
%Pie Plot in percentages
%XP(1)=Anz_Nan/Anz_nonNan;
XP(2)=Anz_0cloud/Anz_nonNan;
XP(3)=Anz_1cloud/An... |
clear all
load ('edgesRatio.mat')
nbins = 50;
sigmax = std(list_edges_ratio);
mx = mean (list_edges_ratio);
binloc=(-20:100)*sigmax/10+mx;
% binloc2=(-1:10)*sigmax+mx;
figure (1)
hist(list_edges_ratio,binloc)
title('Histogram of edges ratio')
xlabel ('Edge ratio')
ylabel ('Number of triangle')
% figure (2)
% hist(... |
function samplerPlots()
%user setup parameters:
allSky = true; %if true: all-sky. If false: clear-sky
nSamples = 5000;
nSimulations = 500;
lwHiRes = 1;
swFile = 'b30.042a.cam2.h0.2000-01.nc.procs1024.r96.out.nc';
lwFile = 'b30.042a.cam2.h0.2000-01.nc.procs512.r110.out.nc';
savePath = '/Users/paigejo/git/Feldman/spect... |
%%
clc
clear all
close all
%% load data (single image stack contains 3 channel images sequentially)
[Lck_wt TCR_CY2 pCD3]=load_all_channels('filename.tif');
frame_number=size(Lck_wt,3);
%% multithresholding to set threshold to later to select pixels that
% contains TCR and Lck channel
for m=1:frame_number
... |
%{
Oblicza sume wartosci piskeli znajdujacych sie wewnatrz prostokata
przy zachowaniu zlozonosci O(1) w oparciu o macierz zawierajaca
calke zdjecia.
Parametry:
- integralImage - macierz calki
- point1, point2 - wektory wspolrzednych przeciwleglych rogow
prostokata
Zwraca:... |
function index=bi_tournament_select(N)
index=zeros(N,1);
for i=1:N
k=tournoment_binary(N);
index(i,:)=k;
end
function j=tournoment_binary(N)
%%% binary tournoment selection
j1=randi([1 N]);
j2=randi([1 N]);
if j1<j2
j=j1;
elseif j1<j2
j=j2;
else
if rand<0.5
j=j1;
else
j=j2;
... |
function [u, v] = mth_cart2affine(xy, a, b, theta)
% MTH_CART2_AFFINE computes 2D affine coordinates given 2D Cartesian
% coordinates.
%
%-----------------------------------------------------------------------
% Copyright 2020 Kurt Motekew
%
% This Source Code Form is subject to the terms of the Mozilla Public
% Licens... |
function y = sphJ(n, x)
% >> y = sphJ(n,x). A function which returns the spherical Bessel function
% of order n at x, where x is a non-dimensional argument. It is used in
% separation of variables solutions.
x = x + eps*(x == 0);
y = besselj(n+1/2, x).*sqrt(pi./(2*x)); |
function UpdateStats(n,choice)
mkfld();
Student_number = evalin('base','Student_number');
data2 = fopen('C:\Multibody Dynamics Generator\SN.txt','r');
log = fscanf(data2,'%s');
data1 = fopen('C:\Multibody Dynamics Generator\SN.txt','wt');
%ln = length(log);
%temp = string(zeros(13,1))... |
function [dWi,dWo,ddWi,ddWo] = nr_pseuhess(Wi, Wo, alpha_i, alpha_o, ...
Inputs, Targets)
%NR_PSEUHESS Pseudo Hessian elements and the partial derivatives.
% [dWi,dWo,ddWi,ddWo] = NR_PSEUHESS(Wi,Wo,alpha_i,alpha_o,Inputs,Targets)
% calculates the pseudo Hessian elements AND the partial derivatives
% of the... |
function varargout = preprocOptionsDialog(varargin)
% PREPROCOPTIONSDIALOG MATLAB code for preprocOptionsDialog.fig
% PREPROCOPTIONSDIALOG by itself, creates a new PREPROCOPTIONSDIALOG or raises the
% existing singleton*.
%
% H = PREPROCOPTIONSDIALOG returns the handle to a new PREPROCOPTIONSDIALOG or th... |
function [ eigval, eigvec ] = SMult( M )
%1 alg
y = ones(size(M,1),1);
epsilon = 0.001;
lambda_prev = ones(size(M,1),1);
lambda = 1;
s = y' * y;
p = norm(y);
% z_prev = [1 1 1 1 1];
z = y ./ p;
for k = 1:inf
y = M * z;
s = y' * y;
t = norm(y * z');
p = norm(y);
lambda_prev = lambda;
lambda = ... |
function gauss_mat = multigauss_uncentred(variances,amplitudes,center,size_x,size_y)
%input: variances vector,their proportion
%output: total sum of the gausse curves with the given variances and the
%gauss curves themselves
[grid_x,grid_y]=meshgrid(1:size_x,1:size_y);
gauss_mat = 0;
for sub = 1:length(variances)... |
function [label_1,max_p] = find_max_P_1(dis_range,angle_range,x1,y1,x,y,x3,y3)
label_1 = 0;max_p = -20;
for j = 1:length(x)
[theta_all, dis_all, x3, y3] = calculate_theta_all(dis_range, angle_range, x1,x(j),x3,y1,y(j),y3);
P1 = calculate_P(dis_range, angle_range, dis_all, theta_all);
if max(P1) > max_p
... |
function feature = text_feature(image)
image1 = uint8(squeeze(image));
com = graycomatrix(image1);
com = com / max(max(com));
%% Energy
Energy = sumsqr(com);
%% Contrast
Contrast = 0;
for i=1:length(com(1,:))
for j=1:length(com(:,1))
Contrast = Contrast + (i-j)^2*com(i,j);
... |
function [top_genes] = getGeneRank(MimID,Top_Number,remove_prior,lamda,gamma,eta) %If need count only, replace results into cnt
% cnt = abInitio(0.5,0.7,0.5)
load Mim5NN_Seman
% clear MimM
load PPIM_Seman
load BridgeM_Seman
Ng = length(genes);
Nd = size(MimIDs_5080,1);
% to get the transition matrix for gene network... |
function psi = hog_encodeImage( im,cache )
if ~iscell(im), im = {im} ; end
psi = cell(1,numel(im)) ;
if numel(im) > 1
parfor i = 1:numel(im)
psi{i} = processOne(im{i}, cache) ;
end
elseif numel(im) == 1
psi{1} = processOne(im{1}, cache) ;
end
psi = cat(2, psi{:}) ;
% ---------------------------------------... |
% extract the position of the center of the relaxed activity pattern in a
% population using population vector decoding
function x_star = compute_c(population)
sum_pop_vect = 0.0;
for idx = 1:population.lsize
sum_pop_vect = sum_pop_vect + population.a(idx)*exp(2*1i*idx/population.lsize);
end
x_s... |
function sentence = CS4300_Make_Percept_Sentence(percept,x,y)
%Tell the knowledge base what the agent perceives
%Simply add percept to knowledge base?
%not used in psuedo code it seems?
% convert percept into a sentence
% (1): Stench
% (2): Breeze
% (3): Glitters
% (4): Bumped
% (5): Screame... |
function expt_cfl_plot(cfl_mat_file)
if nargin<1
cfl_mat_file = 'CFL.mat';
end % if nargin
load(cfl_mat_file,'CFL_vec','bigNx','bigC','bigEps')
% Set linecolor to default black
set(groot,'defaultAxesColorOrder',[0 0 0]);
% Set lines to cycle these styles
myLines = {'-','--','-.'};
set(groot,'defaultAxesL... |
clear
close all
clc
% 1000
[time,x,y,t,xEst,yEst,~,xV,yV,xyV] = SimKSLimportfile('Sim_KRP1000.txt');
rho = sqrt((x-xEst).^2 + (y-yEst).^2);
lambdas = sqrt(getLambdas(xV,yV,xyV));
hf = figure(2);
set(hf,'PaperUnits','Points');
set(hf,'PaperPosition',[650,550,350,300]);
set(hf,'Units','Points');
set(hf,'Position',[650... |
function color = getColor( ii, colors )
sz_col = size(colors,1);
curr_idx = mod(ii-1, sz_col)+1;
color = colors(curr_idx, :);
end
|
function out = string_pad(string_in, desired_length)
%function out = string_pad(string_in, desired_length)
% pads to the front of a stirng with zeros until length of string is desired.
%: ex: string_pad('5', 6)
out = string_in;
while length(out) < desired_length
out = ['0' out];
end
end
|
function [avZ,range] = averageZ(rect)
z1 = rect(:,3); % get all z
avZ = mean(z1,1); % average z
range = max(z1) - min(z1); % range of z |
function [xI, yI] = getInterceptPoints(box, circle)
%disp('inter');
[mc , pc] = getSlopeAndP(circle);
[mMatrix , pMatrix] = getSlopeAndPMatrix(box);
[rows, colunms] = size(box.sideMatrix);
for i = 1:1:colunms
if(isnan(mMatrix(1, i)))
if isnan(mc)
xI(1, i) = NaN;
yI(1, i) = NaN;
... |
function [duvidb] = Compute_duvidb(obj)
%Compute_duidb Summary of this function goes here
% Detailed explanation goes here
aux = repmat(obj.mu([2*obj.n_vert+1:end,1:end/2],1),1,obj.n_b) .* ...
obj.pc(:,1:obj.n_b);
aux2 = - aux(1:2*obj.n_vert,:) + aux(2*obj.n_vert+1:end,:);
duvidb = aux2 ./ ...
(rep... |
function apFinalAssDir = copyThesesToCleanSourceAssignment(con,apMCFiles,WeekNames)
%% Copy the theses and programming assignments to clean_source 'bonus_assignment'
% directory and the final 'assignment' folder in the rootfolder.
cd(apMCFiles)
try %BAD PROGRAMMING: not a clean function due to exams vs. bonus assignme... |
function [ dx ] = rk4( f,h,x )
%RK4 4th-order Runge-Kutta
k1 = h*f(x);
k2 = h*f(x+k1/2.);
k3 = h*f(x+k2/2.);
k4 = h*f(x+k3);
dx = (k1+2*k2+2*k3+k4)/6.;
end |
%% Equation used for Gaussian fitting
function [y] = GaussianDerivativeFunction(b,c,height,Hpp,Hfmr,x)
x = x';
y = zeros(length(x));
y = b + c.*x + -1*((Hpp/2)*exp(.5))*(height*(-x+Hfmr).*exp(-((-x+Hfmr).^2)/(2*(Hpp/2)^2)))/((Hpp/2)^2);
y = y';
end |
% %%%
% % CsgA in WT
% %%%
fnames = {'/Volumes/Scratch/Chris/Paper2_Rippling/Results/Development/csgA in WT/Exp1_35/', ...
'/Volumes/Scratch/Chris/Paper2_Rippling/Results/Development/csgA in WT/DEV_1/', ...
'/Volumes/Scratch/Chris/Paper2_Rippling/Results/Development/csgA in WT/A_30/'};
... |
function z = cellPlus(x, y, f)
%
% function z = cellPlus(x, y, f)
%
% Compute the addition or subtraction of cell matrix
%
% Input -
% x: NxM cell matrix
% y: NxM cell matrix
% f: 1-addition, (-1)-subtraction, default f = 1
%
% Output -
% z: NxM cell matrix
%
% Example -
% >> z = cellPlus(x, y)
% >> z = cellPlus(x, y, ... |
classdef Lasso_ < BaseEstimator
% Linear Model trained with L1 prior as regularizer.
%
% Requires the statistics toolbox
properties (GetAccess = 'public', SetAccess = 'public')
% parameters
alpha = 1E-2; % regularization
end
properties (GetAccess = 'public', SetAccess =... |
% RUN NFKB parameter estimation example
clear all;
NFKB_OED % Calls the script with the inputs:
% Model
% Experimental scheme + data + noise
% PE problem formulation: cost function and unknowns to be estimated
% Numerica... |
function [ phi, theta, muEffective, Phi, Theta ] = attenuationCoefficientDecompose( material, spectrum )
energyBinLabels = spectrum.energyBinLabels;
photonsPerEnergyBin = spectrum.photonsPerEnergyBin * spectrum.DQE;
energyAverage = spectrum.energyAverage;
[ muPoly, muEffective] = materialAttenu... |
function thresh_histo_4reg(file,outdir,T,plane)
%
% Limiriza as imagens segmentadas manualmente e depois cria o volume de mascaras binarias que
% sera deformado
%
%
% FILE: .nii or .mgz MRI volume fullpath
% OUTDIR: dir to place binary files
% T: threshold value
% REFMGZ: full path for reference MGZ file
% PLANE: p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.