text stringlengths 8 6.12M |
|---|
function [c,ceq] = PsConstraintReserve(Mach,Alt,Sweep,Weight,Sref,TslsMax,AR,engType)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
WoverS = Weight/Sref;
[rho,SoundSpeed] = stdatmo(Alt,0,'US'); %slug/ft^3 / ft/s
V = Mach*SoundSpeed; %ft/s
q = 0.5*rho*V^2; %slug/ft-s^2
Cl = WoverS/(q)... |
%load the training data
load('data/quickanddirty_traindata');
%train the classifier
model = train(Xtr,ytr, 'nsigma', 10, 'nlambda', 10);
%load the test data
load('data/quickanddirty_testdata');
%predict the labels for the test set and asses prediction accuracy
[yhat,acc] = test(model, Xte,yte);
disp(sprintf('\... |
function Options = setup_options_struct
Options = [];
% Get base study dir
default_base_study_dirpath = '~/Data/Avastin_Study';
text_str = sprintf('Please enter base study dir: [%s]', default_base_study_dirpath);
base_study_dirpath = input(text_str, 's');
if isempty(base_study_dirpath)
base_study_dirpath = default... |
intrinsic EmbedNumberField(nu::RngOrdElt, places::SeqEnum) -> SeqEnum
{
Input: nu an element of ZF where F is totally real
Output: A tuple of the real embeddings of nu in RR
}
return [Evaluate(nu, pl) : pl in places];
end intrinsic;
intrinsic Slope_F(alpha::RngOrdElt, places::SeqEnum) -> FldReElt... |
stdSeq = zeros(1,fn);
stdSeq = createStd(stdSeq, 0.194, 1.012,frameTime);
stdVsn = 1;% vocie segment number
|
function [phases,rate,spikeform,length_meanvector,frequency,mean_voltage]=...
hyperpolarized_OU_phase(module,recdate,cellnum,outime,pauset,reps,trials,sample_rate)
% MODULE is the name of the rtxi module used (e.g. 'fi_curves'); RECDATE is
% the date of recording (i.e. 'Jul_19_11'); CELLNUM is the letter of the
% c... |
function opts = CheckInputs(opts, varargin)
% all credit to
% http://stackoverflow.com/questions/2775263/how-to-deal-with-name-value-pairs-of-function-arguments-in-matlab
%# read the acceptable names
opt_names = fieldnames(opts);
%# count arguments
num_args = length(varargin);
if round(num_args/2) ~= num_args/2
e... |
function b = invited( invited,b ,length )
% if '+', then set as 1.
for n = 1: length(1)
if invited(n) == '+'
b(n,1) = 1;
end
end
end
|
clc
clear all;
close all;
%data definition as simulated data
fprintf("Enter inputs for creating simulated train data:\n");
[original_view,original_nv,original_N,original_numROIs]=simulateData;
fprintf("Simulated train data is created.\n\n");
all_views{1} = original_view;
% generates the representative tensors and CB... |
%------------- BEGIN CODE --------------
% ekran ve bellek on temizleme
close all ; clear all ; clc ;
%fx = x^2 - 3 * x + 1;
%gx = (x^2 + 1) / 3;
%gx = sqrt(3 * x - 1);
tol = 0.1;
x0 = 2;
x1 = sqrt(3 * x0 - 1);
iter = 1;
while abs(x1 - x0) > tol
x0 = x1;
x1 = sqrt(3 * x0 - 1);
iter = iter + 1;
end
f... |
function ms = momentumThickness(x,y,q)
global upper_speed lower_speed N splitter_idx delta_U
sumBottom = 0;
sumTop = 0;
for i = 1:200
for j = 51:-1:5
k = q(j,i)/68.6;
sumBottom = sumBottom + k*(1-k)*(y(j+1,1) - y(j,1));
end
for j = 52:98
k = q(j,i)/274.4;
sumTop = sumTop + k*(1-k)*(y(j+1,1) -... |
close all
clear all
n=1.5; % numero de periodes
limit=n*pi;
omega=-limit:0.001:limit;
h=sqrt(1./(1.25-cos(omega)));
f=atan(0.5*sin(omega)./(1-0.5*cos(omega)));
plot(omega,h),figure
plot(omega,f) |
% Bar Charts New
%
% Actively used as of 2019-08-07
%
% Using FABBER data generated on 6 November 2018 (for 2019 ISMRM Abstract)
%
% Changelog:
%
% 2019-01-16 (MTC). Switched the layout of the data matrices so that subjects go
% along the columns, and datasets along the rows. This makes adding new
% dataset... |
function sigma=substrate_ex(row,col,lay,dT,dz,cte,E,nu,nlsub,Mat,NL)
% This function calculates the thermal stress in the top layer of the
% substrate material
% global dz cte E nu nlsub Mat NL
z=-sum(dz(1:nlsub))+sum(dz(1:lay))-dz(lay)/2;
Ebs=E(Mat(row,col,lay))/(1-nu(Mat(row,col,lay)));
dTs=mean(dT(row,col,1:nlsub));... |
function segManSklera(ActDataDescriptors, guiMode)
% segManSklera GUI window for manually segmenting the sklera/choroid
% boundary.
%
% The images are aligned to the RPE. First a segmentation by splines may be
% performed which the is refined by free hand drawing.
%
% This GUI was made for a single evaluation. The code... |
function ptCloudDown = algorithm_downsample(ptCloud)
% 点云目标识别算法:基于欧几里得距离将点云划分为集群
%% 函数主体
gridStep = 0.01;
ptCloudDown = pcdownsample(ptCloud, 'gridAverage', gridStep);
end
|
function setListenAMfilter(AMs)
%setListenAMfilter(AMs)
%
%this function will set the GroupID filter on listen
global LISTEN
LISTEN.AMs=AMs; |
function dDdt=dDdtfn_disc(Db,Dwinter,t)
dDdt=0.5.*(Dfn(Db,Dwinter,t+1)-Dfn(Db,Dwinter,t-1))./86400;
end |
function outcome = flip_coin(heads_probability)
outcome = rand;
if outcome >= heads_probability
outcome = true;
else
outcome = false;
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2018 Crypto4a Technologies Inc.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction,... |
% 7/31/13
% evaluateTraj.m
% evaluates position and higher derivatives of a given polynominal
% trajectory at a given time
% Dependencies: -
%
% inputs:
% t: real value, time to evaluate trajectory at
% n: integer, order of desired trajectory
% m: integer, number of pieces in trajectory
% d: integer, number ... |
function []=SherlockEffect(word)
% word='MONKEYS CAN WRITE HAMLET'; %give a word or a sentence to match
alphabet=['a':'z','A':'Z',num2str(0:9),' ']; %define the English alphabet and add numbers
alphabet=[alphabet(alphabet~=' '),' ']; %get rid of extra spaces, add just 1 space to capture word spacing in sentences
r=ra... |
function [EignVectors] = PCA(InputImages )
EignVectors = pca(InputImages);
ViewMoreImageInTheSameFigure(EignVectors',100,'PCA OUTPUT Images',0);
end
|
function [ ] = make_ace_summed_climatology( gasout_name, varargin )
%A function to create an ACE climatology for a family of gases. The
% function uses .mat ACE climatology files and uses a simple addition of
% the respective climatologies.
%
% *INPUT*
% gasout_name: STRING - the name of the family of gase... |
clc; clear; close all;
%% Project1_QPSK
loaded_data = load('project1.mat');
% parameter setting for image
Height_ = loaded_data.Height;
Width_ = loaded_data.Width;
CH_ = loaded_data.CH;
Level_binary = loaded_data.Level_binary;
h = loaded_data.h; % Rayleigh fading 채널
y = loaded_data.y; % 수신 신호
% channel eq... |
function X_rescaled = uq_beta_invcdf( F, parameters )
% F = UQ_BETA_INVCDF(X, parameters):
% calculates the Inverse Cummulative Density Function values of samples
% X that follow a Beta distribution with parameters specified in the
% vector 'parameters'
%
% Input parameters:
% 'X' The sam... |
%% demo_hankel_levels.m
%
% Gonzalo Rubio July, 2018
% University of Alberta, SAIG & Global Seismology Group
%% demo level-2
% Works. output is same as input, does same as original code
clf ; clear all; clc ; close all ;
% Mine
data = randi([1 10],7,7,8) ; % data(t,x,y)
[nt,nx,ny] = size(data);
DATA_FX_f_mine = ze... |
%Clear and initialize valiables
restoredefaultpath;
clear variables;
clc
csvPath='C:\Users\Adm\Desktop\AutoEncoderVideo\Resultados\Seeds\seed_Diivine+SinnoM\';
for seed = 1:10
for fold = 1:5
%csvFile=strcat('test_',num2str(i),'.csv');
csvFile=strcat('seed',num2str(seed),'Netflix_test',num2str(fol... |
function [x] = xtilde(x1, P)
% Generates P iterations of periodic signal x1
% ---------------------------------------------
% x = xtilde(x1,P)
x = x1' * ones(1,P);
x = x(:)';
end
|
function doMain_Reduced_Resolution( im_tag, sensor, input_file, output_file )
% doMain_Reduced_Resolution generates low resolution PANchromatic
% (PAN) and MultiSpectral (MS) images according to the Wald's protocol for
% one image following the same procedure as Vivone, G. paper.
%
% Input arguments:
% im_tag ... |
function selectAnnot(source,~)
if(strcmpi(class(source),'matlab.ui.Figure')) useSource = source;
else useSource = source.Parent.Parent; end
gui = guidata(useSource);
[fname,pathname] = uigetfile([gui.config.root '*.txt']);
loadAnnot([pathname fname]); |
function [model, gap_vec, frac_pass, cache, data_pass_info] = onePass_BCFW_hybrid(param, options, model, gap_vec, cache, gap_value_for_cache)
% [model, gap_vec, frac_pass, cache, data_pass_info] = onePass_BCFW_hybrid(param, options, model, gap_vec, cache, gap_value_for_cache)
%
% onePass_BCFW_hybrid does one pass over ... |
function [tanstruct_out, TRND] = flag_ace_data(tanstruct_in)
% flags the data and saves individual quality flag fields in the matlab
% structs in DIR.
%% this code has been modified from Patrick's orignial flagging code
%%
DIR = 'C:\Users\ryann\ACE\matdata\flag_testing\';
tanstruct = tanstruct_in;
% tanstruct_out = ta... |
function [t_detect,t_detect_series] = return_detection_time_two_timeseries2(x_1,x_2,t,var_m)
%This function will use Betsy Weatherhead's approach to determine detection
%time to detection of change for a time-series This will contain adaptive
%slope estimation
%
% x_1: first time-series (e.g. predictions by model or 0 ... |
% for aa=1:20
r = randi([1 100000],1,100);
% r = randi([1 100000],1,3);
% ww = randi([415 4641],1,100);
% j1=415+1210;
% j2=415+2112;
% ww = randi([415+1282 415+2084],1,100);
% ww = randi([415+1210 415+2112],1,100);
% ww = randi([77001 78500],1,100);
% ww2 = randi([77001 100000],1,100);
% r=[ww ww2];
% ww... |
N = [0, 1, 0, -1];
y = dft(N)
N = 0:3;
x = [cos((pi/2)*N)];
y = dft(x);
N = 0:7;
x = [5+2*cos((pi/2)*N)];
y = dft(x);
N = 0:11;
x = [1+3*cos((pi/3)*N)+sin((5*pi/6)*N)];
y = dft(x); |
% function eff_scaling(component)
% transforms, in the base workspace, the efficiency and loss maps of the
% designated component. The amount by which the efficiency is scaled is
% determined by the values of the following base workspace variables:
% fc_eff_scale : fuel converter
% gb_eff_scale : gearbox
% mc_eff_scal... |
clc;
clear;
close all;
% Read the original image
Original_Image1 = imread('toy_formatted7.png');
Original_Image2 = imread('toy_formatted8.png');
% Apply smoothening to the original image
filtered_image1 = (gaussian_filter(Original_Image1, 2.0));
filtered_image2 =(gaussian_filter(Original_Image2, 2.0));
% displaying t... |
% A script used to experimentally justify our choice of k for GLS.
% Vary over init method as well
% Desired Output:
% Graphs:
% Varying machines
% Log_10 Time
% Ratio to Initiation
% Ratio to LowerBound
% -> Use these to establish using machine proportion of 0.4
% ... |
% clahe enhancement
I1 = imread('./images/ground_truth1.png');
J1 = clahe(I1(:,:,1));
I2 = imread('./images/reconstructed1.png');
J2 = clahe(I2(:,:,1));
subplot 211
imshowpair(J1,J2,'montage');
% Homomorphic filtering
order=2;
% filter ground truth band
gt=double(imread('./images/ground_truth1.png'... |
close all
clearvars -except dataFolderPre dataFolder dotMatsFolder nodeID deliverablesFolder dtSteps dt dmSteps startDate endDate
%% Main2 - Save Mints Data
% Collecting and Saving GRIMM Time Tables
saveMintsDates(dataFolder,dotMatsFolder,nodeID,"GPSGPRMC",startDate,endDate);
saveMintsDates(dataFolder,dotMatsFol... |
function [ t ] = timeInt2double( raw )
%TIMEINT2NUM Summary of this function goes here
% Detailed explanation goes here
% ÅËÆä³¬£¬20140508£¬V1.0
fff = mod(raw,10);
raw = floor(raw/10);
ss = mod(raw,100);
raw = floor(raw/100);
mm = mod(raw,100);
hh = floor(raw/100);
t = ((hh*3600+mm*60+ss)*1000+fff*500)/86400000;... |
%%
meas_type = 'coherence';
behav_type = 'looks';
% date_dir = '120817';
date_dir = '121417';
epoch = 'targon';
kind = 'complete';
manip = 'standard';
load_p = fullfile( conf.PATHS.analyses, 'spectral_glm', date_dir, meas_type, kind, manip, epoch );
dists = dsp2.util.general.concat( dsp2.util.general.load_mats(load... |
% UNIVERSIDADE FEDERAL DO CEARÁ
% CAMPUS SOBRAL
% CURSO DE ENGENHARIA DE COMPUTAÇÃO
%
% INTELIGENCIA COMPUTACIONAL - TRABALHO 03
%
% ARTHUR SOUSA DE SENA MATRICULA: 345750
% VICTORIA TOME OLIVEIRA MATRICULA: 366333
% VITORIA ALMEIDA BERTAIA MATRICULA: 356741
% PROBLEMA ==================... |
function [ predicted, accuracy, probabilities ] = SVMClassify(trainFeatures, trainLabels, testFeatures, testLabels)
minimums = min(trainFeatures, [], 1);
ranges = max(trainFeatures, [], 1) - minimums;
trainFeatures = (trainFeatures - repmat(minimums, size(trainFeatures, 1), 1)) ./ repmat(ranges, size(t... |
function varargout = GUI3(varargin)
% GUI3 MATLAB code for GUI3.fig
% GUI3, by itself, creates a new GUI3 or raises the existing
% singleton*.
%
% H = GUI3 returns the handle to a new GUI3 or the handle to
% the existing singleton*.
%
% GUI3('CALLBACK',hObject,eventData,handles,...) calls the l... |
clear
clc
close all
load experimentTrials
numSubjects = length(experiment.fileName);
%MVC is the minimum of torque because it PF torque is negative by convention
%frequencyBands = [6 ; 12];
frequencyBands = [1; 5; 6; 12];
frequencyBands = [6 ; 12];
normalize = true;
for i = 1 : numSubjects
torque = flbReadTorque(ex... |
%{
psy.NaturalMovie (manual) # Populated by the stim program$
-> psy.Condition
---
type : enum('nat', 'phs') # natural or phase scrambled
luminance : float # cd/m^2
contrast : float # Michelson's 0-1
m... |
% Comparison of the CVX and ADMM Box Spatial solver accuracy
%
% Copyright, Henryk Blasinski, 2015
close all;
clear variables;
clc;
%% This is a test script to show that the ADMM and cvx solutions are the same
% For this purpose we create random camera, basis function and measurement
% matrices.
% Choose problem s... |
function distance = CalculateDistance( p1, p2 )
x_diff = p1(1)-p2(1);
y_diff = p1(2)-p2(2);
distance = sqrt(x_diff^2+y_diff^2);
end
|
function [x,y,resh] = mysaddle(B,c,d,alg,tol,maxiter)
%
% Solve minimax problem:
% min_x max_y f(x,y) = x'By + c'x + d'y
% Inputs:
% (B,c,d) is the problem data where B is m by n (m <= n) and d is in
% the range of B'. Parameter alg specifies one of the 3 algorithms:
% alg = 1: optimistic gradient descent ascent
% alg ... |
#
#menujogo.m - funcao para receber a quantidade de jogadores, os nomes
#deles e as cores que eles vao usar
#Autor: Lucas Xavier de Morais
# Jun - 2019
#
function [QtdJogadores jogadores cores] = menujogo()
#Primeiro pergunta quantos jogarao
while 1
QtdJogadores = str2num(cell2mat(inputdlg('Numero ... |
% plot for a zoom in EPSC trace
plot_order = [2];
plot_period = {4.3:0.1:4.4};
S=load('Trials_EPSC_accel_ZL170901_fish04a.mat');
figure('Units','normal',...
'Position',[0 0 1 1],...
'Visible', 'on');
h=struct();
n = length(plot_order);
XLIM_range=[0 0.1];
pA_YLIM_range=[-200 40];
g_YLIM_range=[-0.08 0.08];
for ... |
function [Image_Data_Cell, matched_Scan_IDs] = extract_slicewise_image_values_from_ROIs(image_dir, image_filename, image_variables, ...
Scan_IDs, ROIs_Struct)
Image_Data_Cell = [];
matched_Scan_IDs = [];
cell_scan_idx = 1;
% Loop over scans to process
for scan_idx=1:lengt... |
function amp = getAmpCenterIRs(ampName,rowIdx,colIdx)
% this function grabs the centered, unfiltered IRs from the amplifiers
% this function only works after the actual center windows have been found
% using either the findCenters.m file (can handle filtered or unfiltered
% amps)
% choose the correct amp based on the ... |
function mc()
StepSize=linspace(0.1,1.0,10);
NSteps=1000000;
NThermalization=1000;
O=zeros(length(StepSize),1);
C1=zeros(length(StepSize),1);
AcceptanceRatio=zeros(length(StepSize),1);
ErrorEstimate=zeros(length(StepSize),1);
for k=1:length(StepSize) %loop over step sizes
... |
[m,n]=size(error2World);
sumx=0;
sumy=0;
for i = 1:1:m
sumx = sumx + error2World(i,1);
end
sumx = sumx/m;
for i = 1:1:m
sumy = sumy +error2World(i,2);
end
sumy = sumy/m; |
%Question 13
%[x,err,func] = nrndn([1,0],10.^-6,1)
[x,err,func] = nrndn([sqrt(1/3),1],10.^-6,1)
function [x,err,f] = nrndn(x0,tol,iprint)
%
% inputs:
% x0 = initial guess of x, column vector of length n
% tol = RMS tolerance on relative error on x, scalar
% iprint = value of 1 requests iteration information
% f(x) ... |
clear;close all
bird_number = 899;
side_of_brain = 'r';
test_numbers = [79];
hrtf_file = 'out9be';
get_hrtf = 0;
[optimal_ildf_surface] = optimal_ildf(bird_number,side_of_brain,test_numbers,hrtf_file,get_hrtf) |
% this file use pos2.txt,then append at the end of each class.txt,and then
% unique the class.txt
clc,clear;
bpath='H:\Resource\Cnds\VOC\ImageSets\Main\';
txtnames=dir([bpath '*.txt']);
fida=fopen([bpath 'pos2.txt'],'r');
dataA=fread(fida);
for i=1:length(txtnames)
if ~strcmp(txtnames(i).name,'pos2.txt')
... |
classdef TestAtmospheric < TestCase
%TESTATMOSPHERIC Unit tests for the Atmospheric class
%
% SYNTAX:
% TestAtmospheric.all();
%
% NOTES:
% - Tests the basic properties defined by the Atmospheric() constructor.
% - Truth values are determined from direct examination of the detailed
% Netcdf metadata dump, as pr... |
function results = uq_LRA_lars(regressors, Y_ED, MethodOptions)
% This function calls the lar algorithm and returns the respective outputs
results = uq_lar(regressors, Y_ED, MethodOptions.LARS);
end
|
%% Create directory and read raw data
purge;
if exist('params_for_analyze_FE_itx.m')==2
params_for_analyze_FE_itx;
end
if 1
E_fit3 = E_fit2;
end
if exist('params_for_analyze_FE_itx.m')==0
str_files0 = 'spectrum*.itx';
str_files1 = 'spectrum_*.itx';
folder_to_save = 'figures4\';
% Set 'flag_p... |
%E2
a=randn(1,10) %definim vectorul
b=a(a<0) |
function safa()
% entry point of SAFA
Ts=1; % step time in sec
a=initArduino();
meas=[];
while 1
actMeas=readMeasurements( a );
meas=updateHistory( actMeas, meas);
act=evalModels( meas );
writeOutputs( a, act );
writeWeb( meas, act );
pause(Ts);
end
% close arduino communication
fclose(a);
... |
function [array_SVM_face_multi,array_SVM_face_multi_shuf] = fun_SVM(net_rand,num_cell,IND_Face,IMG_cell,idx_mat,layersSet,indLayer,numNeuron)
numIMGtot = 120; idx_class = [1,2,3,5,6,7];
IMG = zeros(227,227,3,numIMGtot);
for cc = 1:6
IMG_mat = IMG_cell{idx_class(cc),1}(:,:,idx_mat{idx_class(cc),2});
IMG_m... |
function saveDicom(imageMatrix, header, outputFolder, fileName, extraHeader, createUID)
%SAVEDICOM Writes DICOM files
% USAGE:
% o SAVEDICOM(imageMatrix, header, ...
% outputFolder, fileName, extraHeader, createUID)
%
% REQUIRED INPUTS:
% o imageMatrix: image data
% o header: header ifo... |
function hough_transform_sobel(img,r_min,r_max)
subplot(2,2,1)
imshow(img)
img=rgb2gray(img);
gaussianFilter = fspecial('gaussian',3, 2);
blur_img=conv2(img,gaussianFilter);
sobelx=[-1, 0, 1;-2, 0, 2;-1, 0, 1];
sobely=[-1, -2, -1;0, 0, 0;1, 2, 1];
Filtx=conv2(blur_img,sobelx);
Filty=conv2(blur_img,sobely);
... |
function full_game_matrix = initGameMatrix()
full_game_matrix = zeros(8);
full_game_matrix(2, 1:8) = 1:8;
full_game_matrix(7, 1:8) = 21:28;
full_game_matrix(1,1:8) = [9,11,13,16,15,14,12,10];
full_game_matrix(8,1:8) = [29,31,33,36,35,34,32,30];
end
|
function result = FSSC(filename)
X = load([strtrim(filename),'.txt']);
C_Label = load([strtrim(filename),'_label.txt']);
K = length(unique(C_Label)); % Number of clusters
N = size(X,1);
tmpW = zeros(N,N);
t = 3;
Nc = 0; ACC = 0; C = zeros(N,1);
for tmpNc = 40:10:80
[~,U] = fcm(X,tmpNc,[2,100,1e-5,false... |
function vars = bi_data(validate_data, visualize_data)
%
% Extract cross-species neuron density from Tower (1954)
% images
if ~exist('validate_data', 'var'), validate_data = true; end;
if ~exist('visualize_data', 'var'), visualize_data = false; end;
BI_dirpath = fileparts(which(mfilename));
BI_dirname... |
% WM = imread('watermark.jpg');
% [images] = im_array();
[imageY,imageCb,imageCr] = video_to_frames();
% [allcA,allcH,allcV,allcD,imw] = embedding(images,WM);
[y2rgb]=ycbtorgb(imageCb,imageCr);
folderwatermarkimages(y2rgb);
% backtoycbcr_rgb(imageCr,imageCb);
% [rW,psnrwmf,msewmf,rate,images1] = extracting(images,... |
clear
[FileName,PathName] = uigetfile('*.nii','Select the Nifti file','MultiSelect','on');
files=strcat(PathName,FileName)
for j=1:size(files,2)
clear D Data S Dkf k25 C out
D=MRIread(files{j});
Data2=D.vol;
S2=size(Data2);
Data=Data2(:,:,:,2:S2(4)-1);
S=size(Data);
parfor i=1:S(3)
C=squeeze(Data(:,:,i,:));
k75=Ka... |
function [output] = corrode(input)%腐蚀函数
row=size(input,1);
col=size(input,2);
output=input;
for i=2:row-1
for j=2:col-1
around=input(i-1,j-1)+input(i-1,j)+input(i-1,j+1)+input(i,j-1)+input(i,j+1)+input(i+1,j-1)+input(i+1,j)+input(i+1,j+1);
if around<=7%八邻域中存在一个点为0
output(i,j)=0;%则该点为0
... |
function [ NUM] = Solver(NUM,PAR,MESH )
while NUM.Solve.number_pic>0
switch NUM.Solve.Solver
case 'Picard'
[ NUM ] = get_globals_picard( NUM,PAR,MESH);
case 'Jacobian'
[ output_args ] = get_globals_Jacobian( input_args )
NUM.Solve.f_res = NUM.Solve.L*NUM.r - NUM.S... |
function kernelvalue = VTD_Landscape_Model_Fitting_v1_EvalKernels(newparticle,particleprevstep,CovMat)
kernelvalue = mvnpdf(newparticle,particleprevstep,CovMat); |
function negsamples = sample_negatives(K,B,ns,batch_idx,Y,flag_mexFile,sampling_weights)
if(nargin<6)
flag_mexFile = 0;
end
if(nargin<7)
sampling_weights = [];
end
% Negative samples
if(~flag_mexFile)
negsamples = zeros(B,ns);
for bb=1:B
zn = Y(batch_idx(bb));
if(isempty(sampling_weigh... |
function fig = ghalhk(varargin);
% ghalhk(...)
% HK
ffig = ne_group(varargin,'HK','phalhks','phalhkt');
if nargout > 0 fig = ffig; end
|
function att = q2att(qnb)
% ΟΘΗσΧΛΜ¬ΎΨΥσ
q11 = qnb(1)*qnb(1); q12 = qnb(1)*qnb(2); q13 = qnb(1)*qnb(3); q14 = qnb(1)*qnb(4);
q22 = qnb(2)*qnb(2); q23 = qnb(2)*qnb(3); q24 = qnb(2)*qnb(4);
q33 = qnb(3)*qnb(3); q34 = qnb(3)*qnb(4);
q44 = qnb(4)*qnb(4);
M = [ q11+q22-q33-q44, 2*(q23-q14), 2*(q24+q1... |
% This code is an implementation of the sum-of-squares optimization approach
% based on non-symmetric conic optimization and polynomial interpolants
% presented in:
%
% D. Papp and S. Yildiz. Sum-of-squares optimization without semidefinite
% programming. SIAM Journal on Optimization 29(1), 2019, pp. 822-851.
% URL:... |
% Defines a struct containing standard information of the road.
function r=roadsegment
%ROADSEGMENT Load parameters for a standard road segment
%
% R = ROADSEGMENT returns a struct R that contains parameters for a
% road segment.
r=struct;
r.numlanes=2; % number of lanes
r.lanewidth=5; ... |
function copy_reprocessed_picto_files(reprocess_dir)
import dsp2.util.general.dirnames;
if ( nargin < 1 )
reprocess_dir = 'H:\Kuro_BHV_Reprocessed';
end
conf = dsp2.config.load();
raw_dir = fullfile( conf.PATHS.signals, 'raw' );
assert( exist(raw_dir, 'dir') == 7, 'Raw directory ''%s'' not found.', raw_dir );
asse... |
function [ nodes, u ] = IDVC_nwili(varargin)
% [ nodes, u ] = IDVC(I0,I1,sSize, vxsize, range);
% I = filterDisplacements(I0,filterSize,z) applies a low-pass convolution
% filter to the displacement field to mitigate divergence based on
%
% F. F. J. Schrijer and F. Scarano. Effect of predictor corrector filtering
% on... |
function [ Avec ] = sym2vec( A )
%SYM2VEC converts a symmetric matrix A [n x n] to a vector Avec which
% contains only the symmetric elements
n = size(A,1);
Avec = [];
vl = n;
for i = 1:n
Avec = [Avec; A(i:end,i)];
end
|
function demix = sepDUET(spec,p,q,ker)
NFFT = size(spec.data,1);
tf1 = [spec.data([2:NFFT - 1],:,1); conj(flipud(spec.data([2:NFFT],:,1)))];
tf2 = [spec.data([2:NFFT - 1],:,2); conj(flipud(spec.data([2:NFFT],:,2)))];
R21 = (tf1 + eps) ./ (tf2 + eps);
freq = [(1 : NFFT - 1) ((-(NFFT... |
function show_minutia(image,end_list,branch_list);
%figure;
colormap(gray);imagesc(image);
hold on;
if ~isempty(end_list)
plot(end_list(:,2),end_list(:,1),'*r');
if size(end_list,2) == 3
hold on
[u,v] = pol2cart(end_list(:,3),10);
quiver(end_list(:,2),end_list(:,1),u,v,0,'g');
end;
end;
if ~ise... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% This script plots the stationary smoothness simulations
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %% 1D
%% Load the data
nsubj = 100; nvox = 100;
global ncfloc
load([ncfloc, 'FWHMe... |
function spm12_dartel(pathtorc1,pathtorc2,singvbm)
spm('defaults', 'PET')
spm_jobman('initcfg'),
% spmpath = './spm12b/';
pathtorc1 = strcat(cellstr(pathtorc1),',1');
pathtorc2 = strcat(cellstr(pathtorc2),',1');
strcat(singvbm,'/dartel_tempalte/jon_dartel_template_ADFTLD_1.nii')
% matlabbatch{1}.spm.tools.dartel.war... |
function [eta_a, dM_da, dM_da0, si_m, dA_da, dA_ddelta, dRHS_ddelta] = Aileron_Efficiency(X,AC,D,Wdes,Alpha,U,Xea,delta_a,DV,DP)
ModeNum = AC.Wing.Airfoils.ModeNum;
nT = AC.Structure.nT;
nAirfoil = AC.Wing.Airfoils.nAirfoil;
nC = AC.Q3D.Grid.DnChord;
% nDOF = AC.FEM.nDOF;
rho = AC.Aero.rho;
Mach =... |
function output = Gaussian_Mixture(Centers_X,Centers_Y)
% return a Gaussian mixture function generated by centers (Centers_X,Centers_Y)
output = @(x,y) sum(exp(-pi*((Centers_X-x).^2+(Centers_Y-y).^2)));
end |
A = [1 2; -1 1]
t = [0: 0.01: 2*pi]
x1 = cos(t)
x2 = sin(t)
x= [x1; x2]
plot(x1,x2)
y = A * x %to find image of each vertex under the map f,we use multiplication by matrix A
hold on % to draw on the same polt window
axis equal % the length scales on both axes to be equal
plot (y(1,:),y(2,:)) |
function [interfered_ch0,interfered_ch1,interfered_ch2,interfered_ch3,interfered_ch4,interfered_ch5,interfered_ch6,SIR] = add_interference_improved_7ch(raw_micinput_location,raw_interinput_location,SNRratio_dB,smooth_window,noise_tolerate)
micinput_file_ch0 = [raw_micinput_location,'ch0.wav'];
micinput_file_ch... |
WP(1,1) = RES(1,1);
WP(1,2) = RES(1,2);
for iter = 1 : length(RES)-1
theta = 0;
if (iter >= 2)
theta = atan2(WP(iter,2)-WP(iter-1,2), WP(iter,1)-WP(iter-1,1));
for i = 1 : length(RES)
RES_1(i,1) = (RES(i,1)-WP(iter,1))*cos(-theta)-(RES(i,2)-WP(iter,2))*sin(-theta);
... |
cfg = [];
cfg.alpha = 0.05;
cfg.parameter = 'stat';
% cfg.zlim = [-4 4];
cfg.layout = 'biosemi64.lay';
for freq = 1:40
stat = within_trial_cluster{1,1}{freq,3};
figure;ft_clusterplot(cfg, stat);
hold on;suptitle(['Frequency ' num2str(freq)]);
end
significance = 0.05;
L=1;S=1;
time1 = [];
c... |
%-------------------------------------------------------------%
% PROBLEMA DE LOCALIZAÇÃO DE MANIFOLDS (DE) %
%-------------------------------------------------------------%
clear all
format compact
D=20; % Dimensões do problema = 20 (10 manifolds com X e Y)
Xmin=-500; ... |
function [ tr_pars ] = cdbn(input, pars,tr_pars)
%% cdbn model
% this function trains one layer of cdbn model
% input parameters:
% input: input data to this layer
% pars: parameters for this layer
% return:
% tr_pars: trained parameters for this layer
assert(isfield(pars, 'num_channels'));
assert(isfield(pars... |
set( figure, 'NumberTitle', 'off', 'name', 'Grid' );
hold on;
nHoles = 0;
for i = -8 : 2 : 8
for j = -8 : 2 : 8
if( sqrt( i^2 + j^2 ) <= 8.45 )
rectangle( 'position', [ i-0.45 j-0.45 0.9 0.9 ], 'Facecolor', 'w', 'Curvature', [1 1] );
nHoles = nHoles + 1;
end
end
end
rectangle( 'position', [ -8.45... |
function varargout = p_APSTV2DataAnalysis(varargin)
%% SUBJECT LISTS
SUBJ_LIST.apstv = get_APSTV_subjIDs('apstv');
SUBJ_LIST.apstv2 = get_APSTV_subjIDs('apstv2');
SUBJ_LIST.apstv2t = get_APSTV_subjIDs('apstv2t');
SUBJ_LIST.apstv2_stut_s_PFS = get_STUT_ST_subjIDs('PFS', 'S');
SUBJ_LIST.apstv2_stut_s... |
function [state, location, values] = tracker_meem_update(state, image, varargin)
values = struct();
state.time = state.time + 1;
[I_scale, ~] = image_convert(image_create(image), 'rgb');
% compute ROI and scale image
if state.config.image_scale ~= 1
I_scale = cv.resize(I_scale, state.config... |
function [ sinoOut, geomOut ] = truncationCorrectionCopyPatch( sinoIn, geomIn, attSoft, edgeWidth, extendWidth )
% function [ sinoOut, geomOut ] = truncationCorrectionCopyPatch( sinoIn, geomIn, attenCoeff, edgeWidth, rho )
%
% attenCoeff - attenuation coefficent of the base material ( usually water)
% edgeWidth - n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.