text stringlengths 8 6.12M |
|---|
function [orderedPolls]=interface_get_pollutant_list(commonDataInfo)
orderedPolls=commonDataInfo.extraInfo.pollutantList;
end
|
%% Prescription of Velocity Field
% Input required:
% veloc_testcase: specify which velocity field to use
% Pe: Peclet Number, to determine the scale of velocity field
% Output:
% u(x, y): velocity field
function veloc_fldStruct = Prescribed_VelocityField(Profile, param)
Pe = param.Pe;
kappa_scale = param.kappa_scale... |
% One Hot Code output for use with a 9 MHz BW reference signal at an
% LTE BW of 10 MHz.
function [offset, netOut] = NN3_10MHz_9PRN_main(rxSig, refSig, fs, range)
% First, perform Conventional Correlation to get an initial estimate
[ccOff, ccorr, ~] = convCorr(rxSig, refSig, fs, 'Modified', 0);
... |
function [] = print_figure(name)
% Wyjdz z folderu scripts
folder = pwd();
cd('../')
cd('../')
% Stwórz folder na wykresy jeœli jeszcze nie istnieje
if(exist('figures', 'dir') == 0)
mkdir('figures');
end
cd('figures')
if(exist('stat', 'dir') == 0)
mkdir('st... |
function [speed,dir,other] = get_tfcondition_stuff(tfexps,tf)
% [STUFF] = GET_TFCONDITION_STUFF(TFEXPS,EPOCH) -
%
% INPUTS:
% tfexps -
% tf -
%
% OUTPUTS:
% stuff - structure containing condition level information for given
% tf.
%
% NOTES:
%
%
%
numexps = length(tfexps);
speed = struct(); %... |
% SPAM CLASSIFICATION - SCRIPT
% Extract Features from text file
file_contents = readFile('emailSample1.txt');
% go through eMail, match words with vocabulary list and add matched words into word_indices
word_indices = processEmail(file_contents);
% Print Stats
disp(word_indices)
% Extract features from eMail: cr... |
%% Images
mkdir kitData
% read images
im_male = readFaceImages(fullfile('..','..','images','[Best Friends] Male Cropped'));
im_male = cat(4,readFaceImages(fullfile('..','..','images','[Adopt A Pet] Male Cropped')), im_male);
im_female = readFaceImages(fullfile('..','..','images','[Best Friends] Female Cropped'));
im_fe... |
function p = classifieurKPPV(img, n, m, k)
%detect and recognize one number
img = imbinarize(img);
img = 1 - img;
%extract the class' centers
centers_density = csvread('KPPVcenters.csv', 0, 0);
s = size(img);
%density of the number
density = get_density(img, s(2), s(1), n, m)... |
% height = GetHeight(myobj)
%
% Returns the height of the Open GL window in pixels.
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyrig... |
function lx = qx_to_lx(qx,radix,ca)
if nargin < 3
ca = 0; % Current age. zero = just born
end
cai = ca+1; % Current age index (assuming age starts at zero)
lx = ones(size(qx));
lx(ca+1,:)= 1; % 100% survival at currrent age
lx(ca+2:end,:) = [ lx(c... |
function [cKey] = ComputeKey(cAudioFilePath,blockSize,hopSize)
% Input:
% Please use relative path here to import audio file
% Output:
% cKey: int, correspond to the labels in KeyEnumeration.txt (in ref2 Github)
%% Please write your code here
t_pc = [6.35 2.23 3.48 2.33 4.38 4.09 2.52 5.19 2.39 3.66 2.29 2.88 %maj... |
function y_Call_bet(InputFilename, OutputFilename, Option, WorkingDir)
% function y_Call_bet(InputFilename, OutputFilename, Option)
% Call FSL's bet under Linux or Mac OS
% Call Chris Rorden's revised bet (distributed with MRIcroN) under Windows. ('eval' is not suitable for 'parfor')
% Input:
% InputFilename - The ... |
clear, clc, close all
%addpath('C:\Users\Joe\Dropbox\research\codes\f')
k = 1:4;
ck = 0.95*exp(1j*(0.15*pi+0.02*pi*k));
z = [0.98*exp(1j*0.8*pi) 0.98*exp(-1j*0.8*pi) 1./ck 1./ck 1./conj(ck) 1./conj(ck)].';
p = [0.8*exp(1j*0.4*pi) 0.8*exp(-1j*0.4*pi) ck ck conj(ck) conj(ck)].';
zplane(z, p)
%m = matlab2tikz(gca, tru... |
%This function will predict the category for every test image by finding
%the training image with most similar features.
function predicted_categories = nearest_neighbor_classify(train_image_feats, train_labels, test_image_feats)
% image_feats is an N x d matrix, where d is the dimensionality of the feature representa... |
function ComputeLastAnalysis(datadir)
%PlotHipDistanceinMap valuta distanza tra marker in fase di esercizio
% Detailed explanation goes here
% markers = {'hipc','spine','shc','head','shl','elbl','wristl','handl','shr','elbr','wristr','handr','hipl','kneel','anklel','footl','hipr','kneer','ankler','footr'};
listsubj ... |
function [corners, adj, bnd] = meshtopo(quads)
[adj,bnd]=faces_to_edges(quads);
% This sorts the interface numbering such that we get minimum fill in the
% Schur complement.
[x11,y11]=ndgrid(adj(:,2), adj(:,2));
[x12,y12]=ndgrid(adj(:,2), adj(:,4));
[x22,y22]=ndgrid(adj(:,4), adj(:,4));
mask=(x11==y11)+(x12==y12)+(x12=... |
%% Challenge 1
% Make a variable called 'age_2015' and set it equal to your current age.
% Make another variable called 'age_2025', set this variable to Age_2015
% plus 10.
% Make another variable (Choose a name) and set it equal to half your age.
age_2015 = 26;
age_2025 = age_2015 + 10;
age_half = age_2015 / 2;
%% C... |
function [data] = plotting_makegif_2Dto1D(DGsolution,tnow,data,nstep)
% Plots the DG solution at the current time
% written by Pierson Guthrey
font = 16;
if nstep == 0
delay = 1;
elseif tnow == data.Tfinal
delay = 1;
else
delay = 0.1;
end
% disp(['making image , nstep is ' num2str(nstep)])
if nstep == 0
... |
close all;
prabowo_img = imread('C:\Users\ignatha\Documents\MATLAB\1.jpg');
% Gambar + Histogram gambar asli
figure(1);
set(gcf, 'Position', [100, 100, 1240, 500]);
subplot(1,2,1); imshow(prabowo_img);
subplot(1,2,2); histo(prabowo_img);
%Kecerahan ditambah 63
prabowo_img2 = prabowo_img + 63;
% Gambar +... |
function ForceRolling = RollingPower(weight, b, radius)
ForceRolling = weight * b / radius
end |
function [S] = pulse(Is,Ts)
%PULSE Creates a pulse
% [S] = pulse(Is,Ts)
S = [0 Is Ts 0 0 0 0]; |
function [core_vert,crst,cr_vol,P]=CddCoreVertices(clv,idx,tol)
% CDDCOREVERTICES computes all core vertices of game v,
% whenever the core exits. The cdd-library by Komei Fukuda is needed.
% It is recommended to install the cdd-library that accompanies
% the Multi-Parametric Toolbox 3.
% http://people.ee.ethz.ch/~mpt... |
function [ waveFeatures ] = waveletFeatures( signal, win)
%waveletFeatures produces a wavelet decomposition of a signal
% waveFeatures = [mean std mean(diff) std(diff)]
FeatureLen = floor(length(signal)/win);
buf = buffer(signal,win)';
waveFeatures = zeros(FeatureLen,4);
for n = 1:FeatureLen
[C, L] = wavedec(bu... |
%% ANN learning of R star
close all
clear
clc
% adding paths
addpaths;
addpath('C:\Users\famig\Documents\Alessandro\POLIMI\Numerical Analysis adv-EDP\Progetto NAAPDE\model-learning-master_new\model-learning-master\examples\R_estimate')
addpath('C:\Users\famig\Documents\Alessandro\POLIMI\Numerical Analysis ad... |
function s=getWatchedStatespotentP2X4(y)
s=[y(:,17),y(:,18)];
end |
Predictedvalue=[48 131 37.0135 34.3402 31.1207 39.4906 7.5166];
Classvalue=[101];
doublegap = min(abs(Predictedvalue-Classvalue(1)))
clc;
% Sample data
numberOfRows = 5;
Classvalue = rand(numberOfRows, 1)
Predictedvalue = rand(numberOfRows, 1)
% Find min distance
minDistance = inf;
for ni = 1 : numberOfRo... |
function [predict] = linearRegressionFminunc(fileName)
[X, y] = readXyFromFile(fileName);
% Set options for fminunc
options = optimset('GradObj', 'on', 'MaxIter', 400);
theta = zeros(size(X, 2), 1); % initialize fitting parameters
% Run fminunc to obtain the optimal theta
[theta, cost] = fminu... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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:/... |
function [t,j,xi] = noise(s)
global r
params(s);
TSPAN = [0 10];
JSPAN = [0 10];
rule = 1;
p0 = zeros(3,1);
v0 = zeros(3,1);
R0 = eye(3);
q01= 1;
q02 = -r;
z10 = [p0;v0;R0(:);q01;zeros(3,1);0];
z20 = [p0;v0;R0(:);q02;zeros(3,1);0];
options = odeset('maxstep',0.1);
... |
function [flt,data,header] = flt_traj_read(varargin)
% Reads the float_trajectories files.
%
% flts=flt_traj_read(File_Names,[Worldlength],[FloatList]);
%
% inputs: File_Names is a file name
% Worldlength (= 4 or 8) is optional
% FloatList (= a subset of [1:n] where n is the number of floats) is the sec... |
d=zeros(2,27);
for y = 1:2
for x = 1:27
x1=x*5-4;
x2=x*5;
y1=y*5-4;
y2=y*5;
d(y,x) = mean(mean( a(y1:y2,x1:x2) ));
end
end |
% 脉冲响应不变法设计巴特沃斯低通滤波器
% 技术要求:
% 通带截止频率:analog_wp = 200*pi, 通带最大衰减:rp = 3db
% 阻带截止频率:analog_ws = 600*pi, 阻带最小衰减:rs = 12db
% 采样频率:fs = 1000hz
%
clear;
clf;
wp = 200 * pi;
ws = 600 * pi;
rp = 3;
rs = 12;
[n, wn] = buttord(wp, ws, rp, rs,'s');
[b, a] = butter(n, wn, 's');
[db, ~, ~, w] = freqs_m(b, a, 500*2*pi);
plot(w/(2*... |
function collection=interactive_export(max_plots, export_path, raw_data)
%%
%data export, if user selected subplots
%Default Location for Exports: (pwd/data_exports)
%%
%Subplot selection dialog
tf=1;
collection=struct;
while tf==1
A = 1:1:max_plots;
List = sprintfc('%g... |
function a = directionfeatures( inputImg )
%directionfeature 方向特征
% 方向0,1,2,3,7上的数目
% 求图象大小
[rows, columns] = size(inputImg);
% 各个方向初始化
dir10 = 0; dir11 = 0; dir12 = 0; dir13 = 0; dir17 = 0;
dir20 = 0; dir21 = 0; dir22 = 0; dir23 = 0; dir27 = 0;
dir30 = 0; dir31 = 0; dir32 = 0; dir33 = 0; dir37 = 0;
dir4... |
function [ S ] = DataGeneratorGeneral(states, covs, pop_sizes, states_seq, mixture_weights, min_weight, dim, anomaly_rate, rounds, with_transition, save_to_file, iter, num_of_underlying_dists)
%DATAGENERATOR3 Summary of this function goes here
% Detailed explanation goes here
% range default
fileN... |
function test
global screen
InitScreen(0);
Add2StimLogList();
Screen closeAll
framesN = 6000;
objRects = ones(4,32);
oneRect = SetRect(0,0, 32, 1)*PIXELS_PER_100_MICRONS;
for i=0:31
objRects(:,i+1) = CenterRect(oneRect, screen.rect-(16-i)*PIXELS_PER_100_MICRONS)';
end
... |
clc;clear all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reading data from a file
%Note that time is in micro seconds and packetsize is in Bytes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[seqNo, send, receive] = textread('output_3.txt', '%f %f %f');
figure(1);
plot... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%SCRIPT: DEVIANCE GRAPH
%Plot the mean scaled deviance (gamma) vs ratio of value/prediction
%
%y-axis: linear scale
%x-axis: log scale
clearvars;
close all;
xPlot = linspace(-1,1,100);
ratio = 10.^(xPlot);
yPlot = 2*(ratio - 1 - log(ratio));
fig = LatexFigure.sub();
plot(... |
function [final_SR_tot,final_reSR_tot,final_SR_Sum] = SR_reconstruction(Recon_ksp, params)
rawData_reshape = reshape(Recon_ksp,[params.Nx, params.Nz*params.Ny*params.Nc*params.Nr*params.Nset*params.Ns*params.Na]);
Im_odd = zeros(size(rawData_reshape));
Im_even = zeros(size(rawData_reshape));
Im_odd(:,1:2:end)... |
%November 11,2019
%__________________________________________________________________________
clc;
clearvars;
close all;
%VARIABLES
n=10; % # of nodes
rho = 2; % Density
gamma = 0.5;
L = 2; %Length
u = 4; %Velocity
delx = L/n; %Distance between each node
phi_A = 0; ... |
clf;clc;clear;
y=@(x) sin(2*x);
fplot(y,[0,2*pi]) |
function [seplist] = edge_separate_iter(edgelist, nsize, curvature_dev);
iter_prev = 0;
iter = iter_prev+1;
while(iter > iter_prev)
iter_prev = iter;
edgelist = edge_separate(edgelist, nsize, curvature_dev);
iter = length(edgelist);
end
seplist = edgelist; |
function [D,S,Q] = perform_fast_marching(W, start_points, options)
% perform_fast_marching - launch the Fast Marching algorithm, in 2D or 3D.
%
% [D,S,Q] = perform_fast_marching(W, start_points, options)
%
% W is an (n,n) (for 2D, d=2) or (n,n,n) (for 3D, d=3)
% weight matrix. The geodesics will follow regi... |
function [final] = Scrambler(entree, initialcond)
hSCR = comm.Scrambler(2, [0 -18 -23], 'InitialConditions', initialcond);
final = step(hSCR, entree);
end
|
function bolus = calculate_pulsed_ASL_bolus(t, F, lambda, m0, alpha0, T1b, t_labeling, TDs, TWs, labeling_on)
% calculate_pulsed_ASL_bolus -- Calculate the pulsed ASL bolus signal
% Usage
% bolus = calculate_pulsed_ASL_bolus(t, F, lambda, m0, alpha, T1b, t_labeling, TDs, TWs, labeling_on)
% Inputs
% t ... |
%% 用高斯消去法、Jacobi 迭代、G-S 迭代求解以下线性方程组。
clear;clc;
precision = 0.001;
%% 第一问
% 2x - 2y - z = ?2
% 4x + y - 2z = 1
% -2x + y - z = ?3
disp('第一问:');
% 系数矩阵cm
cm = [2, -2, -1;4, 1, -2;-2, 1, -1];
% 常数项矩阵
bm = [-2;1;-3];
% 高斯消去法
gauss_res = gauss_elimination(cm, bm);
disp('高斯消去法结果:');
disp(gauss_res);
% Jacobi迭代
[converge... |
function [XfftBand,freqBand] = findFft(fs,fl,fh,signal)
Nyquist = fs/2;
l= length(signal); %find length of the signal
samplePerHertz = l/fs; %find number of samples per 1 hz
freqBand = [fl :1/samplePerHertz: fh-1/samplePerHertz]; % find frequency band
Xfft = abs(fft(signal)); % fft for the whole signal
... |
% Linear model for the inverted pendulum, partial observation with noise
% Solving the coupled estimation and control problem
% Time integration using BDF scheme
clear all
%close all
parameters;
[A,B] = get_system_matrices();
Q = eye(4);
Ru = 1/3^2;
[K,X] = lqr(A, B, Q, Ru);
disp('Eigenvalues of A-B*K')
eig(A-B*K)
... |
function varargout = to_slice(varargin)
%TO_SLICE Construct from an index vector (requires is_slice(v) to be true)
%
% Slice = TO_SLICE([int] v, bool ind1)
%
%
%
%
[varargout{1:nargout}] = casadiMEX(201, varargin{:});
end
|
clc
intrinsic_matrix = [616.3681640625, 0.0, 319.93463134765625;
0.0, 616.7451171875, 243.6385955810547;
0.0, 0.0, 1.0];
Good_dataset = 11;
Good_transorm_r = 82.0122;
Good_transorm_p = -0.0192 ;
Good_transorm_h = 87.7953;
Good_transform_T = [0.0228
-0.207... |
function [ mean ] = avg( x )
%avg Calculates mean of vector/matrix x
% None needed
[rows cols] = size(x);
mean = sum(x)/cols;
end
|
function [rankTopTenlncRNADisease] =ten_percent_of_predictive_result(lncRNA,disease,prediction)
%% 返回预测结果中, 每个lncRNA关联的前10个疾病。
ten_pairs_of_predictive_result=zeros(size(lncRNA,1)*10,3);
for i=1:size(lncRNA,1)
ten_pairs_of_predictive_result(10*(i-1)+1:10*(i-1)+10,:)=prediction(376*(i-1)+1:376*(i-1)+10,:);
end
... |
function [sobelEdge, sobelArea] = calculateSobelEdge(bwImage)
sobelEdge = edge(bwImage, 'sobel', 0.05);
sobelArea = bwarea(sobelEdge) / 10; |
% This script uses the generated segmented model data from launchModel.m
% for each county and plots them altogether for visual comparison
% the y values generated are in percentages, to allow direct comparison
% between counties
% plot casts every county's timeline to the NYC timeline, as NYC has had
% the earliest o... |
xx = reshape(x, [n*n, 1]);
yy = reshape(y, [n*n, 1]);
zz = reshape(z, [n*n, 1]);
xxs = reshape(xs, [ns*ns, 1]);
yys = reshape(ys, [ns*ns, 1]);
zzs = reshape(zs, [ns*ns, 1]);
pcs = [xxs, zzs*1.2, yys];
pc = [xx, zz, yy];
colors = zeros(size(pcs, 1), 3);
colors(:, 3) = 1.0;
colors(:, 2) = 0.5;
save_povray2(pcs, '../pc.i... |
MDIR_DIRECTORY_NAME = FP_ANALYSIS_OUTDIR;
make_directory
fs = 120; % Sampling frequency of 120
timescale = [-5 10]; % measurements taken from 5 seconds before spike to 10 seconds after
% If there's more than one .mat file in this directory, this will read the
% first one by default so be careful!
fpcompileoutputs = ... |
function [mean_overfolds, std_overfolds, ...
mean_precAll_overfolds, std_precAll_overfolds,...
runtime_mean_overfolds, runtime_std_overfolds,...
rescrit_names, resmat, mat_precAll] = ...
post_process_final_experiment_results(final_results)
MinutesPerDay = 24*60;
Kfolds = length(final_results.fnames);
... |
% endogeneous grid method for consumption problem
% process for earnings
wage = 4.0;
rho = 0.95;
sig = 0.03;
ne = 10;
[prob,eps,z]=tauchen(ne,0.0,rho,sig);
z = exp(z - 0.5*sig^2);
% other parameters
r = 0.03;
R = 1+r;
sigma = 3.0;
beta = 1/R;
% grid for wealth (future wealth)
wmin = 0.0;
wmax = 50.0;
nw = 50;
gapw =... |
%% SYS800 - Reconnaissance de formes et inspection
% M'Hand Kedjar - December 2016
% Course Project on Age and Gender Classification
clear,clc,close all
load('datasets/sys800/foldfrontaldata.mat')
load('datasets/sys800/list_of_images.mat')
targetNames = cell(size(foldfrontal0data , 1),1);
sourceNames = cell... |
function plot_FRonLFP
% check whether firing rate modulated by contrast stimulus affects stLFP
% ampltude
%
% Test whether the magnitude of the spike triggered LFP is depending on the
% spiking activity. We use the data recorded with a 2s stimulus, to avoid
% dominant slow fluctuations.
%
%
% 04.04.18 Katsuhisa wrote ... |
% tool to display figures inline in terminal
run('~/coding/src/zvision/matlab/zv_setup') ;
% supress figure creation
set(0,'DefaultFigureVisible','off') ;
|
function [T,Y] = integratorThreeP2X7SS(ton,toff,Ttot,amp,dt,y0)
global R k3 g12 E12;
%#codegen
T=(0:dt:Ttot).';
nT=floor(Ttot)/dt;
Y=zeros(nT,1);
Y(1,:)=y0;
for j=1:nT-1
A=amp*(heavi(T(j)-ton)-heavi(T(j)-toff));
Y(j+1,1)=(Y(j,1)+dt*(2*k4*A*1/(1+k1/3*k2*A)))/(1+dt*(2*k3));%O1
end
end |
function [obs_all,pred_all,srcind,trgind,rowV1inds,rowV2inds,rowV3inds,colV1inds,colV2inds,colV3inds] = create_template_matrices(session_dir,pRF_dir,template,hemi,func,runs,templateSize)
% Creates the observed and predicted the cross-correlation matrices which
% result from the retinotopic template fitting pipeline.... |
function[edop]=dop2edop(dop)
%% GENERATE EDOP FORM DOP
edop=[];
[r1,c1]=size(dop);
for j=1:r1
x=dop(j,:);
r=length(x);
y=[];
for i=1:r-1
if i==1
y=x;
x=circshift(x',-1)';
end
if i>1
y(i,:)=y(i-1,:)+x;
x=circshift(x',-1)';
en... |
function [y_aprox, t] = get_euler_fixed_aprox_f(func_s, h, max_time)
t = 0:h:max_time;
y_aprox = zeros(size(t)); % allocate the result y
y_aprox(1) = 0; % the initial y value
n = numel(y_aprox);
derived_fun = matlabFunction( diff(func_s)); % the expression for y'
secon... |
function [hog] = getHog(im)
grayim = single(rgb2gray(im));
[w, h] = size(grayim);
ihog = vl_hog(grayim,8,'variant','dalaltriggs','numOrientations',8);
[m,n,d] = size(ihog);
hog(1,:) = mean(reshape(ihog,[m*n,d]));
s1 = [1, w/2, 1, h/2];
s2 = [w/2+1, w, 1, h/2];
s3 = [1, w/2, h/2+1, h];
s4 = [w/2+1, w, h/2+1, h];
sn = ... |
classdef PulseTrainRIB2ABR < PulseTrainRIB2
% PulseTrainRIB2ABR < PulseTrainRIB2
%
% Variation of PulsTrainMedel designed for eABR (jittered pulse train
% and alternated polarity).
% A 20 ms (20000 us) jitter is recommended for removing 50 Hz line
% noise in eABR recordings.
... |
MI=csvread('CSV/MInitial.csv');
MC=csvread('CSV/MCompletion.csv');
MI2=reshape(MI,1,[]);
MC=reshape(MC,1,[]);
figure(4)
plot(MI2,'--','LineWidth',3)
hold on;
plot(MC,'-o','LineWidth',1,'MarkerSize',2)
hold off;
legend({'Initial timeseries','Matrix completion'},'FontSize',14)
|
function [arc_length] = arcLength(q, a)
% Calculate the length of the arc
y_prime = @(x) -0.3 * sin(sqrt(q)*x) * sqrt(q);
y_arc = @(x) sqrt(1+y_prime(x).^2);
arc_length = integral(y_arc, 0, a);
end |
%%%% Load data %%%%
data = load('Iris.csv');
%% variable
fn = size(data,2);
m = size(data,1);
input_layer_num = fn-1;
hidden_layer_num = 15;
output_layer_num = 3;
lambda = 1;
%% seperate X y
X = [ones(m,1) data(:,1:fn-1)];
y = data(:,fn);
%% train data and test data
r = randperm(m);
trainX = X(r(1:round(m * 0.7))... |
clc
clear
%% DBの実装
c = 20; % クラス総数
n = 10; % 1クラス当たりの学習パターン数
% DBの画像ファイル場所
path = 'M:\project\dataset2\DB\jpeg\';
path2= 'M:\project\dataset2\DB\canny\';
%H = fspecial('disk', 20); %フィルターの作成(ぼかし)
for i=1:c
for j=1:n
str = strcat(path, num2str(n*(i-1)+j-1, '%03d'), '.jpg');
img = imread(str);
... |
function GaussianVaR = GaussVaR(logreturns, alpha)
z = norminv(1-alpha);
mu = mean(logreturns);
sd = std(logreturns);
Gaussian = -(mu + z*sd);
ExpectedShortfall = -(mu - (sd/(1-alpha))*normpdf(z));
GaussianVaR = [Gaussian ExpectedShortfall];
end |
function [metadata_out] = RemoveBadTrials(cfg_in,metadata_in,ExpKeys)
%REMOVEBADTRIALS send out identical copy of metadata, except that bad
%trials have been removed from the taskvars
%
%*** does not do anything with rest periods, so the outgoing sequence can't
%be used with the rest periods.
%
% Do not use GetMatchedT... |
clc; clear all; close all;
%% initializing best aircraft specs
Ebest = 0;
Rbest = 0;
valid_aircrafts = 0; %will tally valid aircraft
validWeights = []; %will record all valid weights
unstable = 0; %tally unstable models
invalid_endurance=0; %tally short endurance aircraft
rng(1);
iterations = 1000;
% figur... |
classdef Input % value class
% NB time (dt,T) in ms, freq in Hz, maar qon en qoff in MHz
% always first 50 ms silent, then 50 ms noise, then rest
properties
% for all
dt % in ms
T % in ms
fHandle % type input
seed % for seeding the random... |
% This code is the implementation of the WLMNC distance learning method in the remote stage
%
% Refrence code: LMNN implementation package provided by Kilian Q. Weinberger at http://www.cs.cornell.edu/~kilian/code/code.html
%
% Copyright by Meiyu Huang, 2018
% Qian Xuesen Laboratory of Space Technology,
% China A... |
function [output1] = Jp_LeftKneeSpringJoint(var1)
if coder.target('MATLAB')
[output1] = Jp_LeftKneeSpringJoint_mex(var1);
else
coder.cinclude('Jp_LeftKneeSpringJoint_src.h');
output1 = zeros(3, 20);
coder.ceval('Jp_LeftKneeSpringJoint_src' ...
,code... |
clear;
rng(6);
b1 = 300;
time_matrix = ["matrix size","original method", "block method","optimal block method","triplet method","block triplet method"];
time_matrix = [time_matrix;"block size",b1,b1,b1,b1,b1];
for i = 1:10
% create a random distance matrix that is symmetric with diagonal elements
% equal to zeros
n = ... |
function converted_env = convertPNGtoEnv(PNGname)
%% converts PNG file created in illustrator to fly VR env
% requires
%PNGname = 'train_to_7pm.png'
% load file into memory
[img] = imread([PNGname], 'BackgroundColor', [1 1 1]);
% find first x,y ~= 0 (because importer pads with black)
r_vals = (img(:,:, 1));
g_va... |
function cmyk = rgb2cmyk(rgb)
cmyk = applycform(rgb,makecform('srgb2cmyk'));
end
|
function mph = mps2mph(mps)
%MPS2MPH Convert speed from meters per second to miles per hour
%
% ftps = MPS2FTPS(mps) convert speed from meters per second to miles per
% hour.
%
% See also MPS2KMPH, MPS2KTS, MPS2FTPS, MPH2MPS.
% Jonathan Sullivan
% Original: May 2011
% jonathan.sullivan@ll.mit.edu
mph... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GIANMARCO PINTON
% WRITTEN: NOV 13, 2013
% LAST MODIFIED: NOV 13, 2013
% ultrasound imaging in human tissue
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Basic variables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; close all; cl... |
clc
clear
close all
DataPath = uigetdir('F:\PesticideResidueData\MatData\FiledApples_Jul01', 'Select data path');
DataInfo=dir(fullfile(DataPath,'*.mat'));
SpectralData=[];
Label={};
for i=1:length(DataInfo)
disp(['Loading ' DataInfo(i).name]);
s=whos('-file',[DataPath '\' DataInfo(i).name]);
load([Data... |
%Imports smallperiodictable.txt into Matlab
SPT = readtable('smallperiodictable.txt');
%Name each column in SPT
SPT.Properties.VariableNames = {'AtomicNum' 'Element' 'Symbol' 'AtomicWeight' 'Density' 'Isotopes' 'DiscYear'};
%Turns SPT into a structure
SPTS = table2struct(SPT);
%1)
%Define a variable for all the elemen... |
%Make a map showing the locations of the forest regions used.
%
%Dependencies:
% - hansen_forested_frac_1deg_thres50.nc4 (calculated using hansen_forest_frac_calc.m)
% - esa_forest_9regions_new_1deg_func.m
%
%T. Pugh
%14.12.17
fmask=ncread('/media/pughtam/rds-2017-pughtam-01/Disturbance/hansen_forested_frac_1deg_thres... |
function dst = projectToO3(src)
% PROJECTTOO3 Computes the matrix in O(3) which is the closest to mat.
%
% Syntax: dst = projectToSO3(src)
%
% Inputs:
% src - 3 x 3 matrix
%
% Outputs:
% dst - 3D rotation matrix closest to src (min ||dst - src||_F)
%
% Other m-files required: none
% Subfunctions: none
% MAT-f... |
%%
clear all; close all; clc;
scanfolders={'L:\basic\divi\Projects\cosart\fluor\fluor\scans\6phantoms_1231\JS_6phantoms_new2.R61\30',...
'L:\basic\divi\Projects\cosart\fluor\fluor\scans\6phantoms_1231\JS_6phantoms_new2.R61\31'};
R=FluorRecon(scanfolders);
R.P.Seq.Sequential=0
R=R.loadBrukerFiles;
R.P.visualizatio... |
function [ realImage, phaseImage ] = logremap_cvip( inputImage, band)
% LOGREMAP_CVIP - Logarithmic remapping of an image data.
% The function performs the logarithmic remapping of an input image.
% The input image can be either real image or complex image.If complex,
% the function computes real image and phas... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [pars_opt, ncoefs, value, gradient] = ...
outeropt(times, data, coefs, allpars, lik, proc, active, ...
in_method, options_in, out_method, options_out)
% The multivariate data = argment data are observati... |
function java_calc_maxbtf_tab(cn,tab)
global cs;
cs.calc_maxbtf_tab(tab);
end
|
function dTdt = rhsSteelHeat(t,T,flag,mc,QV,tcool,htc,As,Ta,emiss)
% rhsSteelHeat Right hand side of first order ODE for heat treating simulation
%
% Synopsis dTdt = rhsSteelHeat(t,T,flag,mc,QV,tcool,htc,As,Ta,emiss)
%
% Input: t = time (sec)
% T = current estimate of bar temperature (K)
% ... |
%Calculates the center of the gut, first by morphological thinning of the
%gut (As a result this code should only be used for "cigar" shaped objects,
%and will likely give junk results for mor spherical shapes). The resulting
%line is then extrapolated to intersect with the boundary of the gut. The
%function returns x... |
clc
n = (0:20 * pi);
x1 = exp(1i * pi/6 .* n);
whos; % will print information about variables
% stem: will draw discrete-time plot
subplot(2, 1, 1);
stem(n, real(x1)) % real: get real part of complex number.
title('Real part');
xlabel('n');
subplot(2,1,2);
stem(n, imag(x1)); % real: get imaginary part of complex nu... |
function [phi] = calcPhi(M, gamma)
phi = M^2*(1+((gamma-1)/2)*M^2)/(1+gamma*M^2)^2;
end |
function []=detect_face(I)
ImageHeight=size(I,1);
ImageWidth=size(I,2);
R=I(:,:,1);
G=I(:,:,2);
B=I(:,:,3);
%%%%%%%%%%%%%%%%%% LIGHTING COMPENSATION %%%%%%%%%%%%%%%
%%%% Normalise Luminance by its data range
%%%% The Y image is essentially a greyscale copy of the main image.
%%%% Remark : The Hue domain from HSV ... |
% plot warmup data
% WTJ, 20190527
%% load
fns = filefun('./warmup_sweep/znb_wide_*.mat');
%%
figure;
hold all;
ind_dev = 1;
shft = 1;
n_skip = 5;
for ii = 1:length(fns)
ii
load(fns{ii});
data = data_alldev{ind_dev};
n = length(data.f);
ind_start = 1;
ind_stop = round(n/2);
% ind_start =... |
function e = scrp_sim(N,alpha,lambda)
% Simulate sticky Chinese restaurant process.
%
% USAGE: e = scrp_sim(N,alpha,lambda)
%
% INPUTS:
% N - number of timepoints
% alpha - concentration parameter
% lambda - stickiness
%
% OUTPUTS:
% e - [1 x N] event assignments... |
function [trainPerf,valPerf,testPerf,JE,JJ,trainN,valN,testN] = perfsJEJJ(net,data,hints)
% nnMATLAB.perfsJEJJ Jacobian and performance computed by nnMATLAB
% Copyright 2012-2014 The MathWorks, Inc.
% Which Jacobian function should we use for the direction of computation?
direction = iDirection( hints, net );
jacob... |
function [ r, c ] = imgCircle( d )
d = round(d);
if (round(d/2)*2==d)
dh = ((d-1)/2);
r = (-dh:dh)';
r = r(:,ones(1,length(r)));
r = r(:);
c = (-dh:dh);
c = c(ones(length(c),1),:);
c = c(:);
idx = find( (r.*r+c.*c) <= (dh+0.5)^2);
r = r(idx)+0.5;
c = c(idx)+0.5;
e... |
close all;
F = [0 51 3 65 7 3 15 13.5 55 70 85 30];
%% read xlsfile
fname = 'E:\Backup\PET\Misc\Protocol\Phoneme.xls'; % location of xls-file containing phonemescores
[num,txt,raw] = xlsread(fname);
n = size(num,2)-1; % number of subjects
col = gray(n+6); % color map
T = [];
P = [];
id = num(1,2:end... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.