text stringlengths 8 6.12M |
|---|
function [ms, significant, m1, m2, oracle ] = crossValFunc(trainX2,trainY2,testX,testY)
%CRITERIAFUN Summary of this function goes here
% Detailed explanation goes here
LabelsY=categorical(trainY2(:,3));
%Mdl = fitcknn(trainX2,categorical(trainY2(:,3)),'NumNeighbors',10,'Standardize',1,'Distance','minkowski');
%Mdl... |
function [mImage] = updateCoordDescImageExact(mAdj, mImage, mMembership, fObjective)
%
% Updates mImage according to a coordinate descent update rule, with exact step
% size calculated (no need for line search).
% Should only be used for the euclidean distance.
%
%
% @author: Jeffrey Chan, 2013
%
% mUnitBasis ... |
% user_plot_radpat3d(J, OG_data, EM_data)
% Draws normalized radiation pattern in 3D
% User post-processing function
%
% OG_data = struct containing Object Geometry data
% EM_data = struct containing ElectroMagnetic data
%
% Juan M. Rius, AntennaLab, Universitat Politecnica de Catalunya (Spain), v1.0, Augu... |
function [Ts,Tma] = MA_decomp(T,m)
% [Tsignal,Tnoise]=MA_decomposition(T,m)
%
% T = Tsignal + Tnoise
%
% where Tnoise corresponding to a MA(m) process
% with spectrum Q0+2*Q1*cos(theta)+...+2*Qm*cos(m*theta)
% i.e., with m+1 coefficients.
%
% T,Tsignal,Tnoise are all Toeplitz covariance matrices.
% The routine uses co... |
function probs = getSegToSpineHeadProbMap(param)
% probs = getSegToSpineHeadProbMap(param)
%
% Written by
% Alessandro Motta <alessandro.motta@brain.mpg.de>
maxSegId = Seg.Global.getMaxSegId(param);
probs = zeros(maxSegId, 1);
preds = load(fullfile(param.saveFolder, 'segmentPredi... |
function rho = correlacao(g, x,Dt)
rho = sum(g.*conj(x)) *Dt/sqrt(energia(g,Dt)*energia(x,Dt));
end |
function evts_out = AMPX_get_random_evts(data, evts, ExpKeys)
%% AMPX_get_random_evts: samples random events of the same length as the
%actual gamma events and ensures they are not overlapping.
%
% Inputs:
% - data: in the AMPX structure
% - evts: [struct] output from AMPX_Julien_DetectEvents
%
% Outputs... |
load('myparams.mat');
mylist = ls ('testim\*.bmp');
for k=1:size(mylist,1)
a=imread(['testim\' mylist(k,:)]);
a=double(a);
b=(a-mean(a(:)))/std(a(:));
b=b(:)';
imshow(reshape(b,size(a,1),size(a,2)));
pred=predict(Theta1,Theta2,b)
fprintf('Program paused. Press enter to continue.\n');
pause;
end
% lo... |
function [qdx qdy]=seterror(dx,dy)
% seterror(dx,dy)
% set random dx dy errorrs
global THERING;
global THERING;
BENDINDEX_nR = findcells(THERING, 'PassMethod', 'BndMPoleSymplectic4Pass');
QUADSEXTINDEX_nR = findcells(THERING,'PassMethod','StrMPoleSymplectic4Pass');
BENDINDEX_R = findcells(THERING, 'PassMethod', 'Bnd... |
function I = percentile2i(h, P)
%PERCENTILE21 Computes an intensity value given a percentile.
% I = PERCENTILE2I(H, P) Given a percentile, P, and a histogram,
% H, this function computes an intensity, I, representing the
% Pth percentile and returns the value in I. P must be in the
% range [0, 1] and I is returned... |
function [ h1,h2 ] = plotCmp( X1,Y1,X2,Y2,markCell,lineStyleCell,clrData)
%论文绘图-绘制对比图
% 绘制两个对比图,用同样的颜色但不同的标记
h1 = plot(X1,Y1,'LineWidth',1.5,'color',clrData,'Marker',markCell{1},'LineStyle',lineStyleCell{1});
hold on;
h2 = plot(X2,Y2,'LineWidth',1.5,'color',clrData,'Marker',markCell{2},'LineStyle',lineStyleCell{2});
... |
function [ log_q ] = calc_log_q( recs,samples )
nb_recs = size(recs,1);
vol = zeros(nb_recs,1);
nb_samples = zeros(nb_recs,1);
alpha = zeros(nb_recs,1);
for i = 1 : nb_recs
temp_rec = recs(i,:);
vol(i) = calc_vol(temp_rec);
nb_samples(i) = size(samples{i},1);
alpha(i) = max(min(nb_samples(i) / 200, 0.... |
CodeP='/home/a/Documents/DUSTER_Nii';
cd(CodeP);
DCEInit;
%%
DataP='/home/a/Documents/sample_data/28/';
WorkingP=DataP;
T1MapFN=[WorkingP 'rT1map_brain_28-2.nii'];
DCE4DFN=[WorkingP 'rDCE_brain_28-2.nii'];
B1MapFN=[WorkingP 'rB1_map_28-2.nii']; % leave as '' is not available. Will use uniform 1
B1MapFactor=100;
cd(Wor... |
%Obtaining the boundary operator of P(I)
function [borderOperator] = BorderOperator(complejo)
borde = sparse( length(complejo),length(complejo));
sumedge = 0;
for i =1 :size(complejo,2)
sumedge = sumedge + size(complejo{i},2);
end
indi = 1;
... |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot IAGOS postprocessed metadata - time distribution
%
%Corwin Wright, c.wright@bath.ac.uk, 2020/05/14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [history,x,fval,algoptions] = algorithm_bayesopt(algo,algoset,probstruct)
MaxIters = 300; % Maximum number of BO iterations
algoptions.ExplorationRatio = 0.5;
algoptions.NumSeedPoints = 4;
algoptions.MaxObjectiveEvaluations = min(probstruct.MaxFunEvals, MaxIters);
algoptions.MaxTime = Inf;
% External const... |
function repP=Ei200_uvw100_at10m1TpMod2P(varargin)
root = fileparts(pwd);
data_source= fullfile(root ,'sqw','Data','Fe_ei200.sqw');
bragg = [1,0,-1];
dE = 5;
dK = 0.05;
repPoints1 = [-0.23,-0.09,0,0.1,0.31;
50,15,0,15,90];
repPoints2= [-0.26,-0.11,0,0.11,0.28;
75,20,0,15,80];
repPoints3 = [-0.23,-0.11,0,0.11... |
function mouseClickCallBack(hObject,eventdata)
global xPos yPos numClicks
notInside = 'Point not inside image';
clickedPt = get(gca,'CurrentPoint');
% disp(clickedPt)
xPos = clickedPt(1,1)
yPos = clickedPt(1,2)
% If statement to check if clicked point is within image
if (ro... |
function r = test_function_scope(r)
r = 5;
end
|
clear all
close all
global phi alpha mu_M p r u tu
% set parameter values
phi = 52/12;
mu_H = 0;
mu_M= 1/12;
u=20;
alpha=0.002;
% set mean clump size
M = 0.5;
% set dispersion parameter
dx=@(t,x)isham(t,x);
r=0.5;
% fin variance in clump sizes
init=[25,45];
V = (M.^2+r*M)/r;
%find p par... |
% the isomap method
function [x] = isomap(P,K)
x = pca(floydwarshall(P),K);
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
%运算使用弧度制
%问题:数据中存在NaN于inf
%% %数据初始化
load('data_preprocessed.mat')
EL_deg=EL;AZ_deg=AZ;
EL=deg2rad(EL);%水平测量角点
AZ=deg2rad(AZ);%俯仰测量角点
Phase_cleaned=deg2rad(Phase_cleaned);%幅度测量值(处理数据预误差后的)
phi_idg=deg2rad(10);%目标位置的水平角索引值
theta_idg=deg2rad(5);%目标位置的俯仰角索引值
G=zeros(5,32);%评估函数
sum_E=zeros(73,37,32,5);%累加电场,73... |
function Zl1=Zliq(beta,epsilon,sigma,q)
Zl1=beta+(beta+epsilon.*beta).*(beta+sigma.*beta).*(1./q./beta);
err=1;
while err>eps
Zl2=beta+(Zl1+epsilon.*beta).*(Zl1+sigma.*beta).*((1+beta-Zl1)./(q.*beta));
err=(Zl2-Zl1)./Zl2;
Zl1=Zl2;
end
end
|
%Code the original computer program from the paper
%parameters
tic
n=1; %(1/2)-times dimension of the space
m=16; %Number of subdivisions of the [0:1]-interval
np=2*n;
eps = 1e-8; %tolerance/ exactness
%initial path x0 in M_m (see paper sec. 2.2, "starting point")
e1=[1;0];
e2=[0;1];
x0=[e1;e1;e1;e1;e2;e2;e2;e2;-e1;-... |
function quickCurrents(stimNum,stimDate,exc,showLess,varargin)
if nargin < 4 || isempty(showLess)
showLess = 0;
end
if nargin < 3 || isempty(exc)
exc = 0; %not excitation
end
if nargin < 2 || isempty(stimDate)
quickLoad(stimNum,[],showLess);
else
newDir = sprintf('%s%s','C:\Users\Mathew\Documents\MAT... |
function [ V ] = trackspines( folder, data, ratio, time, maxWidth )
% DESCRIPTION
% main function to track spine velocity in a stack of images (one time series)
% INPUTS
% folder = directory containing one stack of 10 x-ray images. data = centroid coordinates from Neuron Studio. ratio = real distance to image p... |
% Example:
%
% Edge detection examples
%
% Computer Vision Course
% (c) Domingo Mery (2014) - http://dmery.ing.puc.cl
close all
J = imread('../images/flowers.jpg');
I = double(imresize(rgb2gray(J),[512 512]));
figure(1)
imshow(I,[])
title('Original')
% 1: simple
th = 15;
My = [-1 0 1];
Mx = My';
Iy = imfilter(I,My);... |
function [uu] = interpcheb2(u,xx,yy)
% Interpolation from Chebyshev nodes to any other grid [-1,1]^2
n=size(u);
N=2*n-2;
uhat=fftshift(ifft(ifft(u,N(1),1,'symmetric'),N(2),2,'symmetric'));
% Non-equispaced FFT
m=size(xx);
M=2*m-2;
plan=nfft(2,N(:),prod(M));
xx=acos(xx([1:end, end-1:-1:2],[1:end, end-1:-1:2]))/(2*pi);
... |
function color_rgb = fire_brick
color_rgb = {'color', [0.69803, 0.13333, 0.13333]};
end |
function varargout = newRecord(varargin)
% NEWRECORD MATLAB code for newRecord.fig
% NEWRECORD, by itself, creates a new NEWRECORD or raises the existing
% singleton*.
%
% H = NEWRECORD returns the handle to a new NEWRECORD or the handle to
% the existing singleton*.
%
% NEWRECORD('CALLBACK',hO... |
left=rgb2gray(imread('scene_left.png'));
right=rgb2gray(imread('scene_right.png'));
figure;subplot(1,2,1);imshow(left);title('left');subplot(1,2,2);imshow(right);title('right');
%can create single image with cyan
disparityRange = [-6 10];
disparityMap = disparity(left,right,'BlockSize',15,'DisparityRange',disparity... |
close all
clear all
load RMS_DATA_V_HON_16.mat
r = 0.3/312:0.3/312:0.3;
r=repmat(r,1,1,9,8,3);
r=permute(r, [3 1 4 5 2]);
db_data = 20*log10(RMS_DATA_V_HON_16);
G=log(r.*RMS_DATA_V_HON_16);
n = 2:9; %%%sample plot range for dB vs distance graphs
b = 1:8; %%%channel plot range -- change this and firs... |
function [data] = round_extremes_v1(data,lower_value, upper_value)
%%
% Created by Kyle Gorkowski [GORKOWFALCON] on 2019-Jan-19 3:38 PM
% Copyright 2019 Kyle Gorkowski
%%
lower_round=data>lower_value;
data=data.*lower_round+not(lower_round).*lower_value;
% round max to 1
upper_round=data>upper_value;
data=n... |
function [ H_EST ] = WiFi_channel_estimation_LT_LS(fft_tx,fft_rx)
H_EST_ML1 = ( conj(fft_tx(1:26)).*fft_rx(1:26) ) ./ ( conj(fft_tx(1:26)).*fft_tx(1:26) );
H_EST_ML2 = ( conj(fft_tx(28:end)).*fft_rx(28:end) ) ./ ( conj(fft_tx(28:end)).*fft_tx(28:end) );
H_EST = [H_EST_ML1;0;H_EST_ML2];
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Created: 23-Jan-2015 17:04:31
% Computer: GLNX86
% Matlab: 7.9
% Author: NK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% inter-allocate different time steps to determine tracks of eddies
function S05a_correctZeroCrossTemp
%% init
DD=initialise('eddies',mfilename);
%% parall... |
function [f_est, h_est] = FastMotionDeblurring(g, f_size, h_size, iter, iter_shock, dt_shock, sigma1, sigma2, alpha, beta, thresh, thresh_fin)
K = zeros(1, h_size);
L = g;
for i=1:iter
L = L((end-f_size)/2+1:(end+f_size)/2);
L = filter_bilateral(L, sigma1, sigma2);
L = filter_shock(L... |
function res = orthogonalLine(line, point)
%ORTHOGONALLINE Create a line orthogonal to another one through a point.
%
% PERP = orthogonalLine(LINE, POINT);
% Returns the line orthogonal to the line LINE and going through the
% point given by POINT. Directed angle from LINE to PERP is pi/2.
% LINE is given... |
clear
close
clc
%MChiarello
% folderName = 'Data Science';
% method = 'fromKeywords';
% keywords = {'statistics','data'};
% epubFlag = 1;
folderName = 'Computer Science';
method = 'fromKeywords';
keywords = {'computer','algorithms','programming','python'};
epubFlag = 1;
booksDownloader(folderName,method,keywords,epu... |
%% Regions
% Determine which senders are sending within the range of each other
%% Create list of the various senders
senders = Comm(1).sender.ID;
for i = 2 : size(Comm,2)
if (ismember(Comm(i).sender.ID, senders) == 0)
senders = [senders, Comm(i).sender.ID];
end
end
% Prepare regions array
regions = -... |
eig = [-1 + 0.5i; -1 - 0.5i]%; 1i; -1i]
h = [0:0.1:2]
for k = 1:1:length(h)
for l = 1:1:length(eig)
prod(k) = h(k)*eig(l);
plot(real(prod(k)),imag(prod(k)),'*b');
hold on;
end
end |
%% Perform Barnes-Hut t-SNE on mouse gene data
clear variables
close all
addpath('../bh-tsne');
%% Load data (currently for a single brain)
% id = '9861';
% id = '10021';
id = 'all';
ids = {'9861','10021'};
if strcmp(id,'all')
X = [];
ontologycolor = [];
for inr = 1:length(ids)
datadir = ['/home/... |
A=imread('expt 2.jpg');
B=rgb2gray(A);
imshow(B);
title('Original Image(8 bit)');
Q1=B/2;
subplot(2,2,1);
imshow(Q1,[0,127]);
title('Quantized by 2(7bit)');
Q2=B/4;
subplot(2,2,2);
imshow(Q2,[0,63]);
title('Quantized by 4(6bit)');
Q2=B/8;
subplot(2,2,3);
imshow(Q2,[0,31]);
title('Quantized by 8(5 bit)');
Q3=B/6... |
clear all
close all
fil='*.mat';
fs=500;
n_bands=5;
dt=fs*8;
n_epochs=6;
tstart=6*fs+1; % I primi 6s e gli ultimi 6s non considerati
inDir='D:\Ricerca\Ricerca3_Comparison\Sources_mat\';
outDir_o='D:\Ricerca\Ricerca3_Comparison\FOOOF\offset_Sources\';
outDir_e='D:\Ricerca\Ricerca3_Comparison\FOOOF\exp_... |
function PlotArrow(a,b)
%vector
vec=[b(1)-a(1);b(2)-a(2)];
angle=pi/15;
%rotation determinant
rot=[[cos(angle) -sin(angle)];
[sin(angle) cos(angle)]];
rot90=[[cos(-angle) -sin(-angle)];
[sin(-angle) cos(-angle)]];
%make the line short and rotate
R1=rot*vec/5;
R2=rot90*vec/5;
for i=... |
function [ EdgeBin ] = EF_EdgeDetectionLab( LABImage, interval_number )
%Membentuk 18 orientasi sudut hasil edge detection citra dimensi L*a*b yang
%memiliki pengaruh kuat dalam persepsi citra manusia.
% Masukan: Citra dimensi warna L*a*b*
% Luaran: 18 matriks orientasi sudut dengan ukuran lebar x tinggi citra
% ... |
function Wji = covariance( Ri, Rj )
% Ri responses of Ni neurons i, to K stimuli, size [ K Ni ]
% Rj responses of Nj neurons j, to the same K stimuli, size [K Nj]
% Wji matrix of response covariances for all neuron pairs j, i
[K, Ni] = size( Ri );
[K, Nj] = size( Rj );
% product of responses for all pairs j, i, summ... |
function ElemS = L_Elem1_3d26(mateprop,ul,xl,ElemFlag,hr,nh1,nh2,nh3,ndf,ndm,nst,nel,nen,nestr,ma,ieFEAP)
PatchE = mateprop(1);
Patchv = mateprop(2);
Bcol1 = [1; 4; 6];
Bcol2 = [2; 4; 5];
Bcol3 = [3; 5; 6];
col1 = [1; 2; 3];
col2 = [2; 1; 3];
col3 = [3; 2; 1];
iemat = ieFEAP(1:ndf,ma);
ElemS =... |
% w poniższej metodzie wykorzystano filtr Wienera do usunięcia zakłóceń.
% Metoda ta może być zastosowana, gdy funkcja rozmycia punktu i poziom
% zaszumienia jest znany
clc
clear all
%wczytanie obrazu
K=imread('jon-tang512.jpg');
I=rgb2gray(K);
imshow(I);
title('a) Obraz orginalny');
N=512;
%zmiana formatu... |
syms c(x) t(x)
ode1 = (1/96)*diff(diff(c)) - diff(c) - 3.817*c*c == 0;
ode2 = (1/96)*diff(diff(t)) - diff(t) + 0.056*3.817*c*c == 0;
odes = [ode1; ode2];
S = dsolve(odes);
cSol(x) = S.c;
tSol(x) = S.t;
[cSol(t), tSol(t)] = dsolve(odes);
cond1 = -(1/96)*diff(c(0)) == 1 - c(0);
cond2 = diff(c(1)) == 0;
cond3 = -(1/... |
function output = ReadNeedle(highloc, highvalue, lowloc, lowvalue, pinloc, imdata)
unitsperradian = GetUnitsPerRadian(highloc, highvalue, lowloc, lowvalue, pinloc);
blackwhite = GetEdges(imdata);
needletip = GetNeedleTip(blackwhite);
plot(needletip(1), needletip(2), 'rx', 'MarkerSize', 20, 'LineWidth', ... |
function [odstep_QT_AVR]=fun_QT(Q_start_index,T_stop_index)
% odstÍp QT
fs=1000;
for i=1:min(length(Q_start_index),length(T_stop_index))
if(Q_start_index(i)~=0 & T_stop_index(i)~=0)
odstep_QT(i)=(abs((T_stop_index(i)-Q_start_index(i))))/fs;
end
end
odstep_QT_AVR=mean(odstep_QT)
end |
# Date created: June 27, 2018
# References:
% https://www.gnu.org/software/octave/
% https://pages.mtu.edu/~suits/notefreqs.html
# HAIL TO THE KING OF PHONES!
% Note Assignment
PAUSE = 0;
CS5 = 554.37;
D5 = 587.33;
E5 = 659.25;
FS5 = 739.99;
GS5 = 830.61;
A5 = 880.00;
B5 = 987.77;... |
% Tim Truster
% 09/07/2019
%
truncsectors = 1;
if nelL == 3 || nelL == 6
xlintL = zeros(2,3);
nelLB = 3;
else
xlintL = zeros(2,4);
nelLB = 4;
end
% Determine bounds of integration, left
if nelLB == 4
... |
%Author : Yi Tang u5877586
%Date: 3 June 2017
%This function is used to generate the OFDM symbol with continuous pilots,
%which will be used in IFS using two OFDM Symbols.
function [x_cp, Xp] = SymGen_ContinuousPilot(M)
%"M" is the number of the symbols we want to generate. 1*1 double.
%"x_cp" is the time domain seque... |
%{
This code is used to reproduce the particle observation from RBSP during 20170913 event.
Zefan
2021-03-18
%}
% load the satellite's location
filename = 'data\rbspb_def_MagEphem_TS04D_20170912_v1.0.0.h5';
fileinfo = h5info(filename);
rgsm = h5read(filename,'/Rsm'); rgsm = rgsm(:,1:end-1);
utc = h5read(file... |
while(1)
inner_flag = (rand() > 0.5) + 0.0;
n = 5 + randi(10);
time_points = randi(10);
while(1)
T = zeros(n);
for i = 2:n
T(randi(n),i) = 1;
end
adj = T + T';
if (graphisspantree(sparse(adj)) == 1)
break;
end
end
U = inv... |
function [vardec, ub1_vardec, lb1_vardec, ub2_vardec, lb2_vardec] = ...
gen_vardec_boot(gamma,gamma_boot,chol,chol_boot,B,B_boot,H,sig1,sig2)
% Tools
nvar = size(gamma,1);
nshocks = nvar;
nsimul = size(B_boot,3);
perc_up1 = ceil(nsimul*sig1); % the upper percentile of bootstrapped resp... |
function varargout = OptCtrl_bts(varargin)
% OPTCTRL_BTS MATLAB code for OptCtrl_bts.fig
% OPTCTRL_BTS, by itself, creates a new OPTCTRL_BTS or raises the existing
% singleton*.
%
% H = OPTCTRL_BTS returns the handle to a new OPTCTRL_BTS or the handle to
% the existing singleton*.
%
% OPTCTRL_B... |
function f_y_matrix = f_y(y,t,mu,h,N)
f_y_matrix = zeros(N,N);
for n = 1:N
f_y_matrix(n,n) = -1/h - exp(t + y(n));
end
for n = 1:(N - 1)
f_y_matrix(n,n + 1) = 1/h;
end
end
|
% tosecs.m: converts times to seconds
% GUISDAP v.1.60 96-05-27 Copyright Asko Huuskonen and Markku Lehtinen
%
% function to convert time in form
% [Year Month Day Hour Min Sec]
% or in form [YYMM DDHH MMSS] (this is the EISCAT style)
% to seconds from the beginning of year
%
% See also: toYMDHMS
function [secs,year... |
% Alberto Ramirez
% logit Problem, Problem 1 in PS1 and PS2
%
% This is the GMM estimation continuation of the PS1 problem now using the
% moment conditions.
%
%% Problem Set 1
clc
clear all
%
% Define the variables and the data set:
variable.n=10;
variable.y=[0 0 0 1 1 1 1 1 1 1]'; % nx1 vector
variable.x=[... |
classdef (Abstract) FeatureExtractor < pipeline.AtomicPipelineStep
%FEATUREEXTRACTOR Superclass of all feature extractors in pipeline
methods
function obj = FeatureExtractor(varargin)
obj = obj@pipeline.AtomicPipelineStep(varargin{:});
end
end
end
|
clc;
clear all;
% close all;
load AlternansData.mat; % ecg_h , ecg_p1, ecg_p2, t_h, t_p1, t_p2
F_s = 1000;
T = 1 / F_s;
leads = ecg_p1;
t_beat = t_p1;
%% Ahuba
signal = leads(9,:);
pairs = 5;
offset = 315;
figure;
for i=1:(pairs)
k = 2*i - 1;
range1 = (t_beat(k + offset):t_beat(k + offset + 1));
range2 = (... |
%@(#) prestep7.m 1.2 04/11/03 12:50:40
%
function prestep7(step)
load sim/simfile;
hval=get(gcf,'userdata');
s=size(filenames);
efph=str2num(get(hval(21),'string'));
point=find(efph==blist);
if strcmp(step,'fwd') & point<s(1)
point=point+1;
else if strcmp(step,'bwd') & point>1,point=point-1;end
end
efph=blist(... |
classdef expStim < handle
properties (SetAccess = private)
AcqNum
Type
Method
Neurons
Retina
end
methods
function obj = expStim(R,acqNum,acqMethod,stimType)
%%% Check inputs match expected types %%%
assert(ischar(acqNum),'acqNum mu... |
function [Hs,dUds] = Hamiltonian(Br,hs,Ax,Ay,As,Uc)
%function [Hs,dUds] = Hamiltonian(Br,hs,Ax,Ay,As,Uc)
% Br: p = q*Br
% TPS: Hs,Ax,Ay,As
% double array: dUds(1:2*OSIP.CanonicalDimensions), Uc(1:OSIP.NumberOfVariables)
% Purpose: Obtain the Hamiltonian data of ID at location s with reference orbit Uc.
%---------------... |
latticeWidth=10;
latticeHeight=10;
basisVector1=0.5e-9*[1;0];
basisVector2=0.5e-9*[0;1];
unitCellHeight=1;
unitCellWidth=1;
azimuthalResolution=361;
polarResolution=91;
squareEPerDipoleOutputMatrix=zeros(azimuthalResolution,polarResolution);
k=0;
for k=1:azimuthalResolution
f=0;
for f=1:polarResolution
... |
function result = ex_driftchoice(e)
% ex file: ex_driftchoice
%
%
%
% Modified:
%
global params codes behav allCodes;
e = e(1); %in case more than one 'trial' is passed at a time...
%initialize behavior-related stuff:
if ~isfield(behav,'score')||~isfield(behav,'targAmp')||~isfield... |
function BaBscatter(dataTable,aes)
%% Scatter Position verus Controller Input
h = figure();
h.Tag = 'ScatterPos';
docked = 1;
subplot(1,3,1)
for trial = 1:max(dataTable.trial)
G = groupfilter(dataTable,'trial',@(x) all(x == trial),'trial');
scatter(G.inputDeg(G.inactiveController),G.pos(G.inactiveController),.... |
function [uf, up] = add_freestream(uf, up, ENV)
% velocity field
uf{1} = uf{1} + ENV.velFree(1);
uf{2} = uf{2} + ENV.velFree(2);
uf{3} = uf{3} + ENV.velFree(3);
% particle velocity
up(1,:) = up(1,:) + ENV.velFree(1);
up(2,:) = up(2,:) + ENV.velFree(2);
up(3,:) = up(3,:) + ENV.velFree(3);
end
|
function d_b = deriv_bt(I,L,C, bt)
% Compute the time derivation of bt
% The sizes of the inputs should be :
% - I : m
% - L : m x m
% - C : m x m x m
% - bt : N x m
% The result has the size : N x m
%
N = size(bt,1);
bt = permute(bt,[2 3 4 1]); % m x 1 x 1 x N
C = bsxfun(@times,bt,C); % m x m x m x N
C = squeeze(s... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Analysis Greedy Like Algorithms (AGLA)
% Version 1.0
%
% Copyright 2012 Raja Giryes, Sangnam Nam, Michael Elad, Remi Gribonval, and Mike. E. Davies
%
% For all details please r... |
%% generating glcms 4 directions and 10 pixs distances
glcm = zeros(256,256,10,4);
for j=1:4
for i= 1:10
offset=[0,i;-i,i;-i,0;-i,-i];
glcm(:,:,i,j)=graycomatrix(I,'NumLevels',256,'Offset',offset(j,:),'Symmetric',false);
end
end
%% ¼ÆË㣨¼ÆËã22¸öÌØÕ÷£©
% stats=zeros(4,10);
uc(1... |
function trames = decodage_buffer(buffer, T_e, f_se)
% Variables
s_p = [1 1 0 0 1 1 zeros(1,8) 1 1 0 0 1 1 zeros(1,12)];
N_bits = 112;
p = [-ones(1,f_se/2) ones(1,f_se/2)]/2;
p = p / norm(p);
n_trame = 120 * f_se;
[dt_hat, df_hat] = estimation(buffer, s_p, n_trame, T_e);
% Déco... |
function [ info_rate ] = bit_rate( Input_Size , VarEyAns , PR_Trellis , TRANS , Trellis_Index_io )
format long;
sigma = abs(sqrt(VarEyAns));
%% Channel Simulation
[~,~,tx_waveform] = JSCgenerate(Input_Size,TRANS,PR_Trellis,Trellis_Index_io);
rx_waveform=tx_waveform+normrnd(0,sigma,1,length(tx_waveform));
%%... |
function [ind]=closeto(x,number)
%[ind]=closeto(x,number)
%Find the index of the 1D vector x whose value is nearest the search value
%'number'. If x is a matrix, it is treated as x(:). If there are
%multiple matches, closeto() returns the first match. If 'number' is
%non-finite or imaginary, closeto() returns NaN. Also... |
% x = [theta1,theta1_dot]
A= [0,1;0,0]
eig(A)
B = [0;1]
cm = ctrb(A,B)
rank(cm)
'----------------'
% find characteristic equation
syms x k1 k2
A = sym([0,1;-k1,-k2])
polyA = charpoly(A,x)
|
clear all ; close all ;
cd c:/shared/resmerged ;
subs=dir('*') ; subs(1:2) = [] ;
goodcs = {[20,7,26,15],[13,3,16,23],[12,7,3,11,9],[13,19,6,14],[13,11],[26,22,17,8,42],[14,27,23],[17,16,7,4],[20,7,12],[13,10,11,21],[7,16],[16,11,9,7],...
[8,12,28,39,50,51],[8,16,19,33,40],[20,22,27],[13,7,12,27],[7,3,2,42... |
clear
clc
prefix_name = {'/home/pzhang/chen/move-bed/'};
file_name = {'test_move1_0020.h5'};
kkx = 200:600;
kky = 500:1600;
name = strcat(prefix_name,file_name);
vel = h5read(char(name),char('/Velocity_0'));
nx = h5read(char(name),char('/Nx'));
ny = h5read(char(name),char('/Ny'));
U = vel(1:3:end-2);
V = vel(3:3... |
% ------------------------------------------------------------
% This function uses two simple noise filtering methods
% applied similarly to Femtosoft FROG
% ------------------------------------------------------------
function [cleanFROG, header] = denoise(FROG)
header = FROG(1:5,1);
FROG(1:5,:) = [];
clean... |
%%
[xTrain, tTrain, xValid, tValid, xTest, tTest] = LoadMNIST(1);
%%
%settings
outputsize = 10;
inputsize = 784;
learning_rate = 0.3;
batchsize = 10;
numberOfEpochs = 30;
%%
%training
[thresholds, weights, C_T_net1, C_V_net1, meanToShift, epochForMinimumValid_net1, minimumValid_net1] = train(tTrain, xTrain, xValid, tV... |
clear;
clc;
close all;
%%
k=0.9; % modulation index
f_o=50; % output frequcency(fundamental)
f_c=4e4; % carrier frequency (switching)
The_o=0; % output phase
The_c=-0.125; % carrier phase
m_max=8; % maximum harmonics of carrier
n_max=20; % The number of sidebands
[f, Mag, Phase] = SwitchingFunction(k,f_o... |
atp={'k1','k2','k3','k4','k5','k6','k7','k8','k9','k10','k11','k12','k13','k14','k15','k16','k17','k18','k19','k20','k21','k22','k23','k24'};
tbl1=makeParamTable(P2X4Inact1,atp,'ATP binding and unbinding rates in current producing rows.');
datp={'d1','d2','d3','d4','d5','d6'};
tbl2=makeParamTable(P2X4Inact1,datp,'... |
% 对图像进行均值滤波
A=imread('cameraman.tif');
D=zeros(256);
D(1,1:256)=A(1,1:256);
D(256, 1:256)=A(256,1:256);
D(1:256, 1)=A(1:256,1);
D(1:256, 256)=A(1:256,256);
for i=[2:255]
for j = [2:255]
sum = uint32(0);
for k1=[i-1:i+1]
for k2=[j-1:j+1]
sum = sum+uint32(A(k1,k2));
end
end
D(i,j) = ... |
function phase = XuPhaseRetrieval(phase_step_data)
%phase = XuPhaseRetrieval(phase_step_data)
%phase_step_data is a 3D matrix with dimension M x N x phase_steps
fft_data=fft(phase_step_data,[],3);
phase=angle(fft_data(:,:,2)); |
function r = MgSetFigureTheme(theme)
% Set the theme of figure, such as "dark"
% theme: string, the name of theme, i.e. "dark"
if theme == "dark"
colors = [255, 233, 0;
127, 237, 54;
255, 0, 59;
0, 208, 255;
161, 0, 255;
255, 153, 0;
0, 255, 237;
0, 255, 161;... |
clear all; clc;
load OED_shepp.mat
nImg = [64 64];
idk = randperm(size(A,1));
idk = idk(1:768);
A = sparse(A(idk,:));
% A = sprandn(prod(nImg),prod(nImg),9/prod(nImg));
% A = A + 10*speye(size(A));
%% manipualte last image
figure(1); clf;
xt =reshape(x_true(:,end),nImg);
xt(45:50,40:41) = 1;
xt(47:48,40:45) = 1;
i... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function [ MOV ] = RDF_Calc( Model_Ref, Model_Test, Pro_Test )
%[ MOV ] = RDF_Calc( Model_Ref, Model_Test, Pro_Test )
% As described by ITU-R BS.1387-1 Section 4.6
global debug_var
if debug_var
disp(' Relative Disturbed Frames')
end
MOV.RelDistFramesB = RelDistFramesB( Model_Ref, Model_Test, Pro_Test );
end |
function [acc] = get_accel(mass, vec_source, vec_target)
% gravitational constant with scaling for AU and days units
G = 6.67384*10^-11*86400*86400/(149597870700^3);
dir_vec = vec_source-vec_target;
scalar = G*mass/(norm(dir_vec)^3);
%{
earth_x = (vec_A(1)-vec_T(1))*scalar_A
earth_y = (... |
function[mix] = interweave(vec1, vec2)
% Inputs (2): vec1 = (double) A 1xN vector of numbers
% vec2 = (double) A 1xN vector of numbers
% Outputs (1): mix = (double) A vector of the two vectors mixed together
len1 = length(vec1);%finds the length of vector 1
len2 = length(vec2);%finds the length of ... |
i=imread('C:\Users\Sem Lab\Desktop\tiger.jpg');
red=i(:,:,1);
green=i(:,:,2);
blue=i(:,:,3);
greyimage1=(0.3*red)+(0.59*green)+(0.11*blue);
greyimage2=(red+blue+green)/3;
subplot(2,2,1)
imshow(greyimage)
subplot(2,2,2)
imshow(i)
subplot(2,2,3)
imshow(greyimage2)
|
function create_template_unfold_gifti(out_folder)
arguments
out_folder string
end
n_steps_unfold = [256 128 16];
%get path to reference nifti relative to this script
unfold_ref_nii = [getenv('AUTOTOP_DIR') '/misc/unfold_ref_256x128x16.nii.gz'];
unfold_info = niftiinfo(unfold_ref_nii);
unfold_info.ImageSize =... |
function run_medii_psd_exp5(nume, text, dmin, pas, dmax, ngrup, extgraf,optprel, optgraf)
%
% functia mediaza fisierul .fps pe ngrup intervale
% considera fisier obtinut in experiment
%
i=0;
for diam=dmin:pas:dmax
i=i+1;
d(i)=diam;
numefis=[nume,int2str(diam),text];
% [medii]=medii_psd4(numefis... |
function h = h1(x,theta)
z = theta(1)+theta(2)*x(:,1)+theta(3)*x(:,2);
h = 1/(1+exp(-z));
end |
clear all
clc;
%% Radar Specifications
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Frequency of operation = 77GHz
% Max Range = 200m
% Range Resolution = 1 m
% Max Velocity = 100 m/s
%%%%%%%%%%%%%%%%%%%%%%%%%%%
c = 3e8; %Speed of light (m/s)
fc = 77e9; %frequency (Hz = 1/s)
Rres = 1; %range resolution (m)... |
function modifyAdjacencyMatrix()
%% Add bridge connections to adjacency matrix
%% Load old
inp = load('data/adjacencyMatrix.mat');
spar_adjacency_matrix = inp.spar_adjacency_matrix;
%% Define connections (zoneIndexFrom, zoneIndexTo)
% Lillebælt
%736 -> 2020
% Storebælt
% 638 -> 1929
% Limfjorden
% 1251 -> 1256
% 1... |
function dist = computeDistance(histPath, histFiles, hist, type)
% Computes the distance from a histogram to all histograms split across
% several files
dist = [];
p = progressbar;
p = setMessage(p, sprintf('Computing %s distance to all instances in the database...', type));
for i_file = 1:length(histFiles)
p = se... |
function [B] = EckhardtFilter(Q, BFImax, a)
%ECKHARDTFILTER RDF as shown in Eckhardt, 2005.
% With BFImax = 0.5 we obtain Chapman filter. Equal to Boughton filter,
% which uses C = (1-a)*BFImax/(1-BFImax).
%
% INPUT
% Q: streamflow
% BFImax: "maximum BFI that can be modelled by the algorithm"
% a: recessi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.