text stringlengths 8 6.12M |
|---|
function [p_f, p_a] = find_peaks(freq,amp)
% [p_f(k), p_a(k)] = find_peaks(freq(n),amp(n))
%
% Select local maximums on fft output, find correct frequencies
% and amplitudes using three nearest points quadratic fit.
%
% -- slazav, feb 2012.
mm=1;
p_f = 0;
p_a = 0;
for (m=2:length(freq)-1)
% fit amp(freq) ... |
%
% Nilsson's sequence score for puzzle T
%
function nilsson = trees_nls(T)
% Picking up puzzle tiles in clockwise order from a given puzzle T
Ns = [T(1,:) T(2,3) T(3,3:-1:1) T(2,1)]; % 1D array for 8 tiles
% The right sequence of tiles in Ns is: 1 2 3 4 5 6 7 8
% That is: Ns(2)-Ns(1) = 1, Ns(3)-Ns(2) = 1, …, Ns(8) - N... |
clear all;
Image=imread('watermarked_image.tif');
% initialization of the watermark sequence to be extracted from each sub-band.
watermark_H3=[];
watermark_V3=[];
watermark_D3=[];
watermark_A3=[];
load key_file; % now Matlab knows a variable named 'key' containing the locations at which the watermark will be embedded
%... |
function sol = mysvmAll()
k=9
%k = 6;
%tag = 'nopartial-';
tag = '';
timefile=[int2str(k),'-features-',tag,'training-time','.txt'];
% for ii=2:2
% myfun = @()mysvm(ii);
% t = timeit(myfun);
% dlmwrite(timefile,[ii, t],'-append','delimiter',' ','precision','%.4f');
% end
for ii=2:8
tic;
display(... |
%m_LU([1 1 -3 4; 6 4 -6 2; 3 -6 4 1; -6 3 3 4],[1;-2;8;4])
% Método de descomposición LU
% A debe ser una matriz cuadrada mxn, o sea m=n (m filas, n columnas)
% Esta función nos devolverá los valores de x, al ingresar una matriz A
% b es un vector columna, que corresponde al resultado del producto Ax
function [x] =... |
function varargout = ManualPick(varargin)
% MANUALPICK MATLAB code for ManualPick.fig
% MANUALPICK, by itself, creates a new MANUALPICK or raises the existing
% singleton*.
%
% H = MANUALPICK returns the handle to a new MANUALPICK or the handle to
% the existing singleton*.
%
% MANUALPICK('CALL... |
function [ qref ] = motionplan_with_rep( q0,qf,t1,t2,myrobot,obs,accur )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
q = q0;
q_temp = q0;
while (norm(q_temp(end,1:5)-qf(end,1:5))>accur)
q_temp = q_temp + 0.01*att(q_temp,qf,myrobot) + 0.01*rep(q_temp,myrobot,obs);
q = vertca... |
% drug_struct = [sch20, sch50, skf20, skf50];
function plot_attend_svm( drug_struct )
figure()
for i = 1:4
ctrl_vec = [1 3 5 7];
drug_vec = [2 4 6 8];
ctrl_unscram = [drug_struct.avg_perc_corr];
ctrl_unscram = ctrl_unscram( ctrl_vec(i) );
ctrl_scram = [dr... |
% openStreamingFile( fileName, open )
% fileName - file name to save data
% open - 1 = open, 0 = close
function openStreamingFile( fileName, open )
global DMBufferSizePV
rootPath = [getSMuRFenv('SMURF_EPICS_ROOT')]
C = strsplit(rootPath, ':');
root = C{1};
C1 = strs... |
% Script: Esfera
% Juan P Aguilera 136078
% Luis M Román 117077
% Madeleine León 125154
%------------------------------------------
clear all; close all; clc;
fname = 'funelectron';
funh = 'funesfera';
%------------------------------------------
% Almacenamos los resultados para la comparación
maxiter ... |
function [Acmm,hG,IG,vG,Acmm_dot,Sys_h,i_V_i,Jc_dot] = DynFun_Centroidal_Momentum_Matrix(RobotLinks,RobotParam,RobotFrame,q,dq)
NB = RobotParam.NB;
O_X_G = STconstructor_SpatialTransform(eye(3),-RobotFrame.O_p_COM);
i_X_G = RobotFrame.i_X_O*O_X_G;
% %Selection Matrix
% Selection = [ones(6) zeros(6) zero... |
function [icl opl ipl] = segmentInnerLayersLin(bscan, Params, onh, rpe, infl, medline, bv)
% SEGMENtONFLAUTO Segments some inner retinal layers from a BScan.
% Intended for use on
% circular OCT B-Scans.
% BSCAN: Unnormed BScan image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PARAMS:... |
%% Stelling 19
%
% De NOT-operator heeft twee vormen:
%
% 1 - Het symbool ~
% 2 - De functie vorm: not()
%
Antwoord = 1;
|
function sub_entrust_checkbox_limitpx(hObject, eventdata, handles)
% 期权交易Table的期权标的选择
% 吴云峰 20170329
global QMS_INSTANCE;
set(hObject, 'Value', true)
% 将代码进行设置
px_infos_ = cell(0, 8);
% 进行代码的扫描
[nT, nK] = size(QMS_INSTANCE.callQuotes_.data);
opt_entrustinfo_ = get(handles.sub_entrust.table_optcode, 'Data');
for t = ... |
function [labels, centroids] = get_hierarchical_result(input_matrix, n)
tic
labels = clusterdata(input_matrix(:,1:2), 'Linkage', 'centroid', 'MaxClust', n);
toc
distances = zeros(n,1);
centroids = zeros(n,2);
for i = 1:n
centroids(i,1) = mean(input_matrix(labels == i,1));
... |
clc;
close all;
clear all;
f=imread('wizardofoznoisesquare.pgm');
% compute FFT of the grey image
A = fft2(double(f));
% frequency scaling
A1=fftshift(A);
% Gaussian Filter Response Calculation
[M,N]=size(A); % image size
R=5; % filter radius parameter
X=0:N-1;
Y=0:M-1;
[X,Y]=meshgrid(X,Y);
Cx=0.5*N;
Cy=0.5*M;
%creat... |
function flagf=oceantidef(blqfile,path)
% Function oceantidef
% ==================
%
%
% Sintaxe
% =======
%
% oceantidef(blqfile)
%
% Input
% =====
%
% blqfile -> BLQ file inputed by the user.
%
%
%
%
% Output
% ======
%
% ... |
function space = send_stimulus(device, Channels, stimulus)
for channel = 0:Channels - 1
space = device.GetDataQueueSpace(channel);
while space > 1000
% Calc Sin-Wave (16 bits) lower bits will be removed according resolution
sinVal = 30000 * sin(2.0 * (1:5000) * pi ... |
% Arnold Lab, University of Michigan
% Melissa Lemke, PhD Candidate
% Last edit: October 5th, 2021
%% make sure you move your results from personal simulations and
%% surface simulation into this folder!
clear
%choose the output complex
com_id = 33;
%Choose which FcR: FcR3aV = 1 FcR3aF = 2 FcR2aH = 3 FcR2... |
function shade(TR, run)
global b f W k
% Dimention of each vector
D = b*f + 1;
% Population size
NP = 50; % Edit here for adjusting the population size.
% Number of generations
Gen = 200; % Edit here for adjusting the number of generations.
% The limiting values of elements of vectors
x_min = 0;
x_max = 1;
% Size... |
%% Stelling 12
%
% Het Command Window is een van de mogelijkheden om een
% functie aan te roepen.
%
Antwoord = 1;
|
function [CPE] = presetCPE(varargin)
% Last Update: 31/03/2019
%% Input Parser
nOptionalArgs = length(varargin);
for n=1:2:nOptionalArgs
varName = varargin{n};
varValue = varargin{n+1};
if any(strncmpi(varName,{'method'},4))
method = varValue;
elseif any(strncmpi(varName,{'decision'},6))
... |
% environment.m
% this program sets the default parameters for the model
clear all;
global alpha beta sigma delta BYbar gamma psi Gbar0 phi0 rhoz0 rhog0 use_uhlig impulse_response;
% Setting parameters:
alpha=0.68; % labor share
beta=1/1.02; % discount factor for quarterly
sigma=2; % risk... |
function [b2v, bdedgs, edgmap, v2b] = extract_border_curv_tri...
(nv, tris, flabel, sibhes, inwards) %#codegen
%EXTRACT_BORDER_CURV_TRI Extract border vertices and edges.
% [B2V,BDEDGS,EDGMAP] = EXTRACT_BORDER_CURV_TRI(NV,TRIS,FLABEL,SIBHES,INWARDS)
% Extract border vertices and edges of triangle mesh. Return list... |
JA=0;JB=0;JC=0;JD=0;JE=0;JF=0;JG=0;
NJA=0;NJB=0;NJC=0;NJD=0;NJE=0;NJF=0;NJG=0;
for i=1:4
JA=JA+X{i}{8};
JB=JA+X{i}{9};
JC=JC+X{i}{10};
JD=JD+X{i}{11};
JE=JE+X{i}{12};
JF=JF+X{i}{13};
JG=JG+X{i}{7};
end
JA=JA/4;JB=JB/4;JC=JC/4;JD=JD/4;JE=JE/4;JF=JF/4;JG=JG/4;
for i=5:10
NJA=NJA... |
% TU-Dresden Institut für Automatisierungstechnik
% 9.12.1997-T.Boge / 4.10.2002-K.Janschek
% EXPERIMENT FRAME: Simulations Control PARAMETER
% === Simulation Control ===================================
% simulation duration [s]
tmax = 1000000000000000000000;
|
% defining relevant parameters
T = 1;
T1 = 1/4;
N = 10;
syms t;
% defining relevant expressions
xt = abs(t);
% function call to fourierCoeff which returns array of fourier coefficients
F = fourierCoeff(N,T,t,xt,-T1,T1);
%displaying all the coefficients
disp(F);
% plotting the FS coeff.
k = -N:N;
figure; stem(k, F);... |
function [ Diff ] = ShapeContextEMDCalcDist( WP1Contour, WP2Contour )
%ShapeContextEMDCalcDist: Takes 2 WordParts Contours and return the
%distance between them using ShapeContext Feature and And Approx EMD as the
%metric.
% Detailed explanation goes here
WPT1FeaureVector= CreateFeatureVectorFromContour(WP1Conto... |
%% Electric
clear all
clc
SetAdvisorPath;
% initiate timer
tic
%Pass the vehicle
input.init.saved_veh_file='ev_small_in';
[error_code,resp]=adv_no_gui('initialize',input);
% % Define the Vehicle
% input.init.comp_files.comp={'vehicle'};
% input.init.comp_files.name= {'VEH_SMCAR'};
% input.init.comp_files.ver={''};
%... |
%% ---- R200e1/3
% Run these one section at a time with the Run Section button. Ensure
% pro3.m and pro5.m are included in the current folder and are on the path.
% Sections are denoted by double percentage signs %%
% For a more accurate analytical solution, change the timestep
% e.g. line 121 t = 0:4:55000; wher... |
function csiMatrixExtract = getElemFromCsiMatrix(csiMatrix,csiMatrixInfo,varargin)
%% Get the elements of the csiMatrix
% ===========================================================================
%% Syntax:
% elem = getElemFromCsiMatrix(csiMatrix) - Default case extracts all csi value
% elem = getElemFromCsiMatrix(... |
function E = tdiffuse(I, N, lambda)
% function TDIFFUSE apply isotropic diffusion filtering on image I
% This function is written by VU Anh Tuan, so it's called tdiffuse
% set default value to lambda
if nargin == 2
lambda = 0.2;
end
% initial
E = double(I);
dims = size(E,3);
switch dims
case 1 % grayscale im... |
function [ feat, featNames ] = extractFeatures_IDGait(rightAcc,leftAcc,sf,windowSize,overlap)
%Reed Gurchiek, 2018
% extract features from left and right anterior thigh accelerometer data.
%
%---------------------------INPUTS-----------------------------------------
%
% rightAcc, leftAcc:
% 3xn accelerometer ... |
function [psth_final,fras] = get_fras(data_root,grid,sorted_root)
start_time_s = 0;
end_time_s = 2100;
chunk_s = 50;
synch_ch = load_synch(data_root,start_time_s,end_time_s,chunk_s);
trig_min_length = 3000; %The minimum length of one trigger in samples
qualityOpt = 'nonoise';
Y = get_spike_times(sorted_root,qualityO... |
function [A,B,C,freq,varargout] = cosFit(t,P,...
A0,ABnd,...
B0,BBnd,...
C0,CBnd,...
freq0,freqBnd)
% SinDecayFit fits curve P = P(t) with a Sinusoidal Decay function:
% P = A*(cos(2*pi*freq*t+B)+C));
%
% varargout{1}: ci, 4 by 2 matrix, ci(4,1) is the lower bound of 'freq'
%
% Yulin Wu, SC5,IoP,CAS. ma... |
function R=MyBTST_V4(LongPrice,ShortPrice,OpenLongPosNum,OpenShortPosNum,Cash,CloseLongPosNum,CloseShortPosNum)
%% Long
% OL = Open long Position Price
% CL = Close long Position Price
% CountLW = Count long win times
% CountLL = Count long lose times
% LPL = long Profit and lost
% LMaxW = long maximum win
% L... |
%%%
%%% Arguments:
%%% reaction - a KeggReaction object
%%% Returns:
%%% the CC estimation for this reaction's untransformed dG0 (i.e.
%%% using the major MS at pH 7 for each of the reactants)
function [dG0_cc, U] = getStandardGibbsEnergyUsingCC(params, reactions)
v_r = params.dG0_cc;
v_g = params.dG0... |
%{
Post=process data
%}
G1 = rmnode(G, top_soc_k);
G2 = rmnode(G, top_kaz);
G3 = rmnode(G, top_deg);
A1 = G1.adjacency;
G1_ = graph(A1);
A2 = G2.adjacency;
G2_ = graph(A2);
A3 = G3.adjacency;
G3_ = graph(A3);
g1map = node_mapping_rmnode(G.numnodes, top_soc_k);
g2map = node_mapping_rmnode(G.numnodes, top_kaz);
g3map = n... |
function [labels,dis_iou] = gen_anchor_labels(bbox_input,anchors,dis)
iou = overlap_ratio(bbox_input,anchors);
labels(iou==0) = -1;
% set pos
labels(iou>max(iou)*0.6) = 1;
labels = reshape(labels,[size(labels,2),1]);
% ignore some neg samples to keep sample balance
temp_where... |
function [M] = constructMean(sampind)
%construct mean aggregation matrix
N = sum(sampind);
regionnum = length(sampind);
meanvector = 1./sampind;
ivec = zeros(N,1);
jvec = zeros(N,1);
vvec = zeros(N,1);
ind = 1;
for i = 1:regionnum;
startpoint = 1 + (i-1)*sampind(i);
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wavelet Compression %
% - Suhong Kim - %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear all; close all;
if isfolder('./output') ~= 1, mkdir('./output'); end
g_img = imread('moon.tif'); ... |
% Logistic regression demo on dummy 2D data
close all
clear
[X_train, X_test, y_train, y_test] = sklearn_data_2clusters();
f1 = figure; hold all
plot(X_train(y_train==0,1),X_train(y_train==0,2),'o')
plot(X_train(y_train==1,1),X_train(y_train==1,2),'o')
title('Training data')
clf = LogisticRegression;
clf.fit(X_tra... |
function [itcz_mx,itcz_cm,imeta] = itcz_lon(pr,lat,lon,lonext)
%ITCZ Compute the latitude of the ITCZ over certain longitudinal range
% [itcz_mx,itcz_cm] = itcz_lon(pr,lat,lon,lonext)
% Input: pr = annual pr field (lat,lon,time)
% lat/lon = (code currently assumes regular lat/lon grid)
% ... |
function [ tFilter, tFilterName ] = GetFilter( varargin )
% [ tFilter tFilterName ] = GetFilter( iF, tNFr, tFilterName, tOrder )
% v.1 = v.0 + ability to handle variable tOrder parameter (and, in general,
% other parameters as well) through the magic of varargin.
tFilters = { ...
'1f1' 'ParseFilterName'; ...
'1f2'... |
% Define parameters
e_max = 0.2;
t_alpha = 1;
alpha_0 = 0.7;
% Get data
train = Y_train_F2{1,2}(1:10,:);
test = Y_test_F2{1,2}(1:10,:);
Seizure_time = seizure{1,2};
% start_seiz = floor(Seizure_time(1)/8);
% end_seiz = ceil(Seizure_time(end)/8);
% Seizure_time = start_seiz:end_seiz;
title_plot{1,2}
tr... |
function [x, P, K] = kfilt(x, P, b, A, F, Sigma_e, Sigma_eps)
% KALMAN FILTER
% [x, P, K] = kfilt(x, P, b, A, F, Sigma_e, Sigma_eps)
% performs a linear kalman filter
%------------
% returns:
% x : the state vector
% P : x's covariance
%------------
% arguments:
% x : the state vector
% ... |
%数据补全
%输入A是需要补全的数据列矢量A,输入k是补全的模式
%输出A1是补全后的数据列矢量
function [A1]=completion(A,k);
A2=A;
A2(isnan(A2(:,1)),:)=[];%补充缺失值
if k==1%平均值补全
amean=mean(A2);
A(isnan(A(:,1)),:)=amean;
elseif k==2 %众数补全
amode=mode(A2);
A(isnan(A(:,1)),:)=amode;
elseif k==3%0补全
A(isnan(A(:,1)),:)=0;
end
A1=A;
... |
fmask = fileread('/media/test5/ComponentsList.txt');
Mlist = strsplit(fmask);
fdata = fileread('/media/test5/MasksFreeWalk.txt');
Dlist = strsplit(fdata);
for idx=1:length(Mlist)
file=Mlist{idx}
file2=strcat(file(1:size(file,2)-4),'thresh3std.nii');
M=MRIread(file2);
Mask=M.vol;
Dlist{idx}
... |
close all;
input = xlsread('Input.xlsx','sheet3','B2:N32');
for i=1:13
year=1999+i;
figure(i)
h=plot(input(1:31,i),'*-');
set(h,'LineWidth',1.5)
hold off
xlabel('Time');
ylabel('TAIEX');
p=sprintf('Dec in %d',year);
legend(p)
end
% figure(1)
% plot(input(1:31,1),'*-');
... |
function fig = viewCtree(varargin)
% INPUTS
% OPTIONAL
% FileName:
% 'ModelTypes':
% 'ClassLabels':
% 'Fields':
% 'SaveDir':
% 'Args':
% OUTPUTS
p=inputParser;
addOptional(p,'ModelName','max_dose.mat' ,@istext);
addParameter(p,'ModelTypes',"treebag", @istext );
add... |
function TwinRasters(stimA,stimB,rastA,rastB,toffset)
blank = zeros(2,2);
blank = {blank,blank};
stim = [stimA,blank,stimB];
blank = cell(1,2);
spike = [rastA,blank,rastB];
PlotValve(stim,spike,length(spike),toffset);
line(get(gca,'XLim'),[1 1]*length(rastA)+1.5,'Color','k');
function PlotValve(stim,spike,stimy,toffse... |
function [basisDecRule,nextBasisId] = selectNextBasis( decOpt_EVsys,decOpt_prox_EVprox,decOpt_prox )
[decOpt_EVsys_sort, decOpt_EVsys_sortId] = sort( decOpt_EVsys );
decOpt_EVsys_prox_sort = decOpt_prox_EVprox( decOpt_EVsys_sortId );
div = -( decOpt_EVsys_prox_sort(2:end) - decOpt_EVsys_prox_sort(1:end-1) + eps )./( d... |
function conf = voc_config_person_grammar()
% Set up configuration variables
% AUTORIGHTS
% -------------------------------------------------------
% Copyright (C) 2011-2012 Ross Girshick
%
% This file is part of the voc-releaseX code
% (http://people.cs.uchicago.edu/~rbg/latent/)
% and is available under th... |
% convert a polynomial from representation as a sum of symbolic terms into
% a matrix representing coefficients and a matrix representing monomials
%
% coeffMat is a single row vector
% monoMat has one row for every term. Rows of monoMat are multi-indices
function [coeffMat , monoMat] = polyStrToCoeffs(poly, allVar... |
clc
clear
load('../Normalize Threshold/result_5tx_SP.mat');
addpath('../../');
import param_vals.*;
monte_carlo = param_vals.monte_carlo;
symbol_no = param_vals.symbol_no;
mod_type = param_vals.mod_type;
snr_value = param_vals.snr;
training_data_no = param_vals.training_data_no;
numfiles = param_vals.numfiles;
pfa... |
dudt = @(t, u) f(t,u);
[t, w] = rk4(dudt, 0, 1/2, [1/3,1/3], 20);
tt = linspace(0, 1/2);
u1 = @(t) 2/3 * t + 2/3 * exp(-t) - 1/3 * exp(-100 * t);
u2 = @(t) -1/3 * t - 1/3 * exp(-t) + 2/3 * exp(-100 * t);
y1 = u1(tt);
y2 = u2(tt);
hold on
plot(tt, y1)
plot(t, w(:,1))
hold off
function du = f(t,u)
... |
function MipButtonMotion( hObject,callbackdata )
global MipAxesHandle MipDragRectangleHandle MipDragLineHandle MipTextHandle
ud = get(MipAxesHandle,'UserData');
if (ud.IsDown)
oldPnt_xy = ud.PointDown_xy;
mousePnt = get(MipAxesHandle,'CurrentPoint');
newPnt_xy = mousePnt(1,:);
dists_xy = newP... |
function y = delta(t)
y = t == 0; |
% imngderx, imgdery = Matrices with derivative values in the x and y directions
% I_P = Intensity Polarity -> +1 looks for white circles on black backgrounds
function centers = hough_disk(fname, imgderx, imgdery, radius, I_P, num_centers, parzen_std)
%Dimensions of Image
dim = size(imgderx,1);
%Magnitude... |
function C = calculate_C(X,h)
N = size(X,1);
C = false(N);
for i = 1:N
C(i,:) = sqrt(sum(bsxfun(@minus,X,X(i,:)).^2,2))'<h;
C(i,i) = 0;
end |
function process_parameter_txt(paramfile,instrumentfile,mapfile )
import java.util.Hashtable;
instrument=Hashtable();
fd=fopen(instrumentfile,'r');
tmp=textscan(fd,'%s %s');
fclose(fd);
size=length(tmp{1});
for i=1:size
instrument.put(upper(tmp{1}{i}),upper(tmp{2}{i}));
end
map=Hashtab... |
%find average of the input signal
function average = findAverage(input)
dataSize = size(input,1);
plus= [];
for i=1:dataSize
if(i==1)
plus = input(i,:);
else
plus = [plus + input(i,:)];
end
end
average = plus/dataSize; |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function to create a pretty simple plot %
% That used frequently in this work %
% %
% Author: Bezborodov Grigoriy %
% Github: somenewacc %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function even_vector = filter_even_positions(arr)
even_vector = [];
for i = 1:length(arr)
if ~rem(i, 2)
even_vector = [even_vector arr(i)];
end
end
end |
clc
clear
close all
% Radial Basis Approximation
% This example uses the NEWRB function to create a radial basis network
% that approximates a function defined by a set of data points.
% Define 21 inputs P and associated targets T.
X = -1:.1:1;
% T = [-.9602 -.5770 -.0729 .3771 .6405 .6600 .4609 ...
% .1336 ... |
%SVD for rectangular and square image
image = imread('24_square.jpg');
image = rgb2gray(image);
A = im2double(image);
%A = im2double(image(:,:,3));
[U,D] = eig(A*A');
Vin = inv(sqrt(D))*inv(U)*A;
[M,N] = size(A);
D1 =zeros(M,N);
Z = zeros(M,N);
eigen_value = zeros(1,M);
error = zeros(1,M);
k=1;
%remove this for ra... |
function pj = pj_calc(fcarrier,freq_spur,power_spur,integ_start,integ_stop)
ind=find(freq_spur>=integ_start);
ind_integ_start=ind(1);
ind=find(freq_spur<=integ_stop);
ind_integ_stop=ind(end);
pnoise_spur_integ=power_spur(ind_integ_start:ind_integ_stop);
power_spur_rad2=10.^(pnoise_spur_integ/10);
pj=sqrt(2*sum(power_s... |
%计算基于最大李雅谱诺夫方法的预测值
function [x_1,x_2]=pre_by_lya(m,lmd,whlsj,whlsl,idx,min_d)
% x_1 - 第一预测值, x_2 - 第二预测值,
% m -嵌入维数,lmd - 最大李雅谱诺夫值,whlsj - 数据数组,whlsl - 数据个数,
%idx - 中心点的最近距离点位置, min_d - 中心点与最近距离点的距离
%相空间重构
LAST_POINT = whlsl-m+1;
for j=1:LAST_POINT
for k=1:m
Y(k,j)=whlsj(k+j-1);
... |
% Reproduces the analysis of Heinzle et al. (2016) deriving the appropriate
% prior density over epsilon given the review of T2* values from Donahue et
% al. 2011
for B0 = [1.5, 3.0, 7.0]
% Range of intra-vascular and extra-vascular T2* relaxation rates per field
% strength, as reviewed by Donahue et al. 2011.... |
%Prob. 4
%let b0 = 1, b1 = 1
b0 = 1;
b1 = -1;
n = 0:49;
%when a1 < -2, e.g. a1 = -3
a1 = -3;
Hz = z*(b0*z+b1)/(z^2+(a1)*z+(a1^2)/4);
hn1 = iztrans(Hz, n);
figure
stem(n, hn1)
title('Growing exponential')
xlabel('n')
ylabel('h[n]')
%when a1 = -2
a1 = -2;
Hz = z*(b0*z+b1)/(z^2+(a1)*z+(a1^2)/4);
hn2 = iztrans(Hz, n);
fi... |
function ct = ctpg_plasJ2(dgamma,norm_s_trial,kp_new,hp_new,N_new,mu,capa,e_VG)
%******************************************************************************************
%* RETTURN-MAPPING PARA COMPUTO DEL TENSOR TANGENTE: PLANE STRAIN - 3D *
%* MODELO DE PLASTICIDAD J2 CON ENDURECIMIENTO ISO... |
function [m I] = fn_max(a)
% function [m I] = fn_max(a)
%---
% find the global max in an array, and give its coordinates
%
% See also fn_min
% Thomas Deneux
% Copyright 2005-2012
if nargin==0, help fn_min, return, end
[m i] = max(a(:));
i = i-1;
s = size(a);
for k=1:length(s)
I(k) = mod(i,s(k))+1;
i = floor(... |
function y=zfunpp02(x)
% derivata seconda funzione test zfunf02 in [-2,6]
y=(6.*(3.*x - 8))./x.^5;
end |
%Fichier contenant la configuration du problème. En opération normale
%seulement ce fichier devrait être modifié.
lambda = 500E-9;
%Échelle du système, correspond à la distance entre la pupille et l'image.
%En mètres. Les résultats sont convertis, l'ensemble des calcul sont fait
%avec une échelle de 1.
echelle_system... |
%% Machine Learning Online Class - Exercise 4 Neural Network Learning
%% Initialization
%clear ; close all; clc
%% Setup the parameters you will use for this exercise
input_layer_size = 784; % 20x20 Input Images of Digits
hidden_layer_size = 25; % 25 hidden units
num_labels = 10; % 10 labels, from 1 to ... |
[FileName,PathName] = uigetfile('*.nii','Select the Nifti file','/home/sophie/Desktop/');
file=strcat(PathName,FileName)
D=MRIread(file);
Temp=squeeze(D.vol);
St=size(Temp);
[FileName,PathName] = uigetfile('*.nii','Select the Nifti file','/home/sophie/Desktop/');
file=strcat(PathName,FileName)
D=MRIread(file);
Data=D.... |
function PSNR=PSNR(u0,u,uni)
% u0: orginal image
% u: noised image
% (nb,na): size
% generalize to image sequence
if nargin<3
uni=0;
end
if ndims(u)<ndims(u0)
error ('Dimesion of second one should be larger or equal to the dimension of the first one');
end
if (uni)
min_=0;
max_=255;
... |
function InitFigure(obj)
%% target figure
obj.TargetHandle = figure();
obj.TargetHandle.Units = 'Normalized';
obj.TargetHandle.Position = [0.05 0.05 0.9 0.85];
set(obj.TargetHandle,'name','TARGET VIEW','numbertitle','off');
obj.TargetHandle.Units = 'pixels';
colormap(obj.TargetHandle,'gray');
cameratoolbar();
obj.Targe... |
close all;clear all;clc;
img_rgb = imread('process/colorcapture.jpg');
video_out = 'A4_2_7.mp4';
[M,N,~] = size(img_rgb);
for img_k = 1:3
img = img_rgb(:,:,img_k);
rows = mean(img,2);
cols = mean(img)';
rows = rows-mean(rows);
cols = cols-mean(cols);
K = 1024;
[~,o,FT,~] = prefourier([0,N... |
function [RegistrationParameter]=Ant_K(M,I1,I2)
%%%%%%%%%%%%%%%%%初始化%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ant=10; %蚂蚁数量
Times=100; %蚂蚁移动次数
Rou=0.5; %信息素挥发系数
P0=0.2; %转移概率常数
Lower_1=0; %设置搜索范围
Upper_1=1;
%}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:Ant
X(i,1)=(Lower_1+(Upper_1-Lower_1)*rand);
... |
function pfl_output = persForLoopSplitSaves( varargin )
% Handle args and setup
if isa(varargin{nargin}, 'char')
identifier = append('__pfl_state__', varargin{nargin});
filename = append(identifier, '.mat');
f = varargin{nargin - 1};
num_iterators = nargin - 2;
else
i... |
function [output] = myCLAHE(input,w_size,clip)
%MYCLAHE Summary of this function goes here
% Detailed explanation goes here
[row,col,numChannels] = size(input);
for k = 1:numChannels
for i = 1:row
for j = 1:col
window = input(max(1,i-w_size):min(row,i+w_size),max(1,j-w_size):min(col,j+w_size)... |
function plotPath(states,waypoints)
% plotPath.m e.anderlini@ucl.ac.uk 15/09/2017
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function is used to plot the path of the ROV.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
plot3(states(:,1... |
function [w] = train(x,yd,nro_epocas,criterio,tasa_ap)
#criterio = nro de 0 a 1
x=[-1*ones(size(x,1),1) x]; #Agrega a x la columna de -1 al inicio
w=rand(size(x,2),1)-0.5;
for epoca=1:nro_epocas
#Corrección de los w
for patron=1:size(x,1)
#funcion de transferencia
z=x(pa... |
function [s, table0, poly0, img0] = saveData( obj, table, poly, img, filename)
% SAVEDATA
%
% DESCRIPTION:
%
%
% SYNTAX:
%
%
% INPUTS:
%
%
% OUTPUTS:
%
%
% COMMENTS:
%
%@
% Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
%
% Permission is hereby granted, free of... |
function mprocessfinish(pid,status)
%MPROCESSFINISH will mark the process as finished.
% MPROCESSFINISH(PID,STATUS) will indicate that the process was completed with the given status.
%
% Example:
% MPROCESSFINISH(PID,1) will mark the process PID as completed sucessfully.
%
% Copyright (C) 2010 James Dalessio ... |
%ATHELP generates the list of Accelerator Toolbox functions
ATROOT = getenv('ATROOT');
if isempty(ATROOT)
ATROOT = atroot;
end
disp('Physics Tools');
disp('');
help(fullfile(ATROOT,'atphysics'))
disp('Touschek Pivinski');
disp('');
help(fullfile(ATROOT,'atphysics', 'TouschekPiwinski'))
disp('Lattice To... |
function net = Classification(XTrain, YTrain, XTest, YTest)
%Train and test classification model
%Input: Train data, Train data label, Test data, Test data label
%Output: Trained neural networks
% numObservations = numel(XTrain);
% for i=1:numObservations
% sequence = XTrain{i};
% seque... |
% [OUTPUT_kfold, CVP_kfold] = feature_variability_impact_kfold;
load OUTPUT_kfold
load Common_feature_type
k_fold = length(OUTPUT_kfold);
nb_features = size(OUTPUT_kfold{1},1);
feature_name_table = cell2table(OUTPUT_kfold{1,1}{:,1});
feature_name_table.Properties.VariableNames{'Var1'} = 'Feature_name';
% Plot histog... |
%% Compactar imagens
% Compacta as imagens de um diretório específico
%%
caminho = '/media/dados/facedatabase/AR_warp_zip/test2/';
outputPath = '/media/dados/facedatabase/ARface_48_56/';
fileFolder = fullfile(caminho);
dirOutput = dir(fullfile(fileFolder,'*.bmp'));
fileNames = {dirOutput.name}';
numFrames = ... |
classdef Cell < handle
%Mesh cell class
properties(SetAccess = private)
vertices %adjacent vertices. Have to be sorted according
%to local vertex number!(counterclockwise
%starting from lower left corner)
edges ... |
% ANALYZING THE CC RESULTS
clear all;close all;
% choose directory of cell to be analyzed
CellPath = uigetdir()
% set the current path to that directory
path = cd(CellPath);
files = dir('*.mat'); %list the .mat files in the cwd
vars = cell(size(files)); %initialize a cell the size of the number of files we have
f... |
function [Rq,Rq_tube]=reachTubeExt(rec,tau,Aq,fq,Dq)
q = rec.getMidpoint';
eta = (rec.xmax-rec.xmin)';
X_q_hat = zonoBox([],eta/2);
X0 = zonoBox(q,eta/2);
e_At = expm(Aq*tau);
% Calculate G
if(rank(Aq) == length(Aq))
G = (-Aq)\(eye(size(Aq))-e_At);
else
f = @(t) expm... |
function check = check_feasibility(node, d)
if(node.index == 1)
index = 1;
n_index = 2;
else
index = 2;
n_index = 1;
end
tol = 0.001; %%tolerance for rounding errors
if (d(node.index) < 0-tol), check = 0; return; end;
if (d(node.index) > 100+... |
function deleteBlockLines(blockName)
% Delete incoming and outgoing lines from a block
%
% deleteBlockLines(blockName)
%
% Delete incoming and outgoing lines from blockName
if blockExists(blockName)
% delete outgoing lines
nPorts = getNumOutPorts(blockName);
for iPort = 1:nPorts
... |
function [lpim] = generateLaplacianPyramid(img,pyram,levels)
g = ([1, 4, 6, 4, 1])/16;
gaussianpyramid = [];
laplacianpyramid = [];
for l = (1:levels-1)
gaussianpyramid = [gaussianpyramid img];
% LP Filter
filter_0 = convn(img, g);
img_filter = convn(filter_0, g)... |
%Export data to file
function wwlln_export(data,filename)
%
% Written By: Michael Hutchins
fid=fopen(filename,'wt');
format='%g/%g/%g,%02g:%02g:%09f, % 08.4f, % 09.4f,% 05.1f, %g, %.2f %.2f %g\n';
if size(data,2)~=13
format=sprintf('%%g/%%g/%%g,%%02g:%%02g:%%09f, %% 08.4f, %% 09.4f,%% 05.1f, %%g%s\n',...
... |
function [onflAuto, additional] = segmentONFLCirc(bscan, Params, rpe, icl, ipl, infl, bv)
% SEGMENTONFLCIRC Segments the ONFL from a BScan. Intended for use on
% circular OCT B-Scans.
%
% ONFLAUTO = segmentINFLAuto(BSCAN)
% ONFLAUTO: Automated segmentation of the ONFL
% ADDITIONAL: May be used for transferring additio... |
function r=yink(p,data)
%function r=yink(p,fileinfo)
% YINK - fundamental frequency estimator
% new version (feb 2003)
%
%
%global jj;
%jj=0;
% process signal a chunk at a time
idx=p.range(1)-1;
%totalhops=round((p.range(2)-p.range(1)+1) / p.hop);
totalhops=floor((p.range(2)-p.range(1)-p.wsize) / p.hop);
r1=nan*zero... |
function [U, mu, eigvals] = mypca(x)
mu= mean(x);
x_cent = bsxfun(@minus, x, mean(x));
[U, p, eigvals] = pca(x_cent);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.