text stringlengths 8 6.12M |
|---|
%% Load sample frames
% subplot(3, 1, 1);
% imshow(frame);
%% Video thresholding
% Convert RGB image to chosen color space
I = rgb2hsv(frame);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.986;
channel1Max = 0.026;
% Define thresholds for channel 2 based on histogram settings
channel2... |
function Classifier = TrainRF( TrainingData, TrainingLabels, TrainingArgs )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TrainRF: Trains a Random Forest Classifier.
%
%
% Input:
% TrainingData - An nx4 matrix of training data.
% TrainingLabels - An nx1 vector of training labe... |
load WF_est;
sigma_0=0.5*diff(wf_percentile(WF.t, WF.p, [0.16 0.84]));
W_pulse=sigma_0*1.5e8+[0 0.025 0.05:.05:2];
HW_vals=3+([0:0.1:1, 2:18]);
SNR_vals=logspace(0, 3, 16);
% the minimum SNR is 10 PE /( 10 MHz * 20 m /1.5e8 m/s * 57 pulses) =
% 1.3
% need a quick test of robust_peak_width_from_hist
%SNR_vals=500;
... |
function [ f, a0, a1, a2, x_star, h_x_star, f_x_star, conv_test ] = q52( x )
% This function automates the quadratic interpolation method calculations for
% Q5.2 from the Engineering Optimization - S.S. Rao textbook.
f = [0, 0, 0];
for i = 1:size(x, 2)
f(i) = 0.65 - (0.75 / (1 + x(i)^2)) - 0.65*x(i)*atan(1 / x(i))... |
function m_TRM_sel_opt=m_optimize(Diff_Ts,mask,...
dTs_dswd_TRM_ref,dTs_drld_TRM_ref,dTs_dTa_TRM_ref,dTs_dqa_TRM_ref,dTs_dalpha_TRM_ref,dTs_demis_TRM_ref,dTs_dra_TRM_ref,dTs_drs_TRM_ref,dTs_dGrnd_TRM_ref,...
dTs_dswd_TRM_sel,dTs_drld_TRM_sel,dTs_dTa_TRM_sel,dTs_dqa_TRM_sel,dTs... |
close all;
clear;
clc;
%%
%Define the file consisting of n bytes data
packetsize = 5;
%link quality
LQ = 0.5;
%%
table = [];
% 0, continue; 1, finish!
decodestatus = 0;
% number of times for transmission
ntr = 0;
% Generate n bytes data randomly to construct the source file.
sourcefile = gensourcefile(packetsize... |
%connect to zaber stages
function zaberConnect
global zaber
import zaber.motion.Library;
import zaber.motion.ascii.Connection;
%import zaber.motion.Units;
%import zaber.motion.ascii.AxisSettings;
import zaber.motion.ascii.AllAxes;
import zaber.motion.ascii.Axis;
Library.enableDeviceDbStore();
%establish connection... |
load AlSigEpsEleiche0001s70F.dat
load AlSigEpsEleiche0001s300F.dat
load AlSigEpsEleiche0001s400F.dat
load AlSigEpsEleiche0001s550F.dat
load AlSigEpsEleiche1000s70F.dat
load AlSigEpsEleiche1000s300F.dat
load AlSigEpsEleiche1000s400F.dat
load AlSigEpsEleiche1000s550F.dat
sig10 = AlSigEpsEleiche0001s70F;
sig11 ... |
%% Homework 7
% Author Minhyuk Nam
% Date 06/04/2018
%% Polynomial
clear
clc
syms x
f(x) = 1/7 * x^4 + 3 * x^2 + 1.4 * x + 3;
ezplot(f)
[x_min, y_min] = fminsearch(f, -2)
subs(diff(f(x),x), x_min)
f = @(x) x^4 + 3 * x^2 + 1.4 * x + 153;
[x_min, y_min] = fminbnd(f, -2, 2)
%% Triangular
clear
... |
% comparison between labeting schemes
r1a = 1/1.65;
bat = 1.4;
f = 50/6000 ; % ml/s*g
Disp = 100;
T1gm = 1.3;
dt = 1e-3; % the time steps are 1 ms.
ttmp = linspace(0,10, 10/dt)';
decay = ones(size(ttmp));
decay = exp(- ttmp *r1a);
input = zeros(size(ttmp));
% arterial dispersion for pulsed input
p_art_kernel =... |
function batchCol(self, plotNum, colset)
cols = self.Colors;
if (length(colset) == 1)
colToSet = cols{colset};
else
colToSet = colset;
end
for i = 1:length(plotNum)
cols{plotNum(i)} = colToSet;
end
self.Colors = cols;
end |
function visualAngle = pixelToAngle(pixelDistance, screenPixelSize, ...
distanceAcrossScreen, distanceToScreen)
visualAngle = NaN;
if ~isnan(pixelDistance)
visualAngle = ...
(2 * atan( ...
(pixelDistance / screenPixelSize * distanceAcrossScree... |
function [min_result,orien]=fitting_ellipse_manual(x,y)
% This function is used to fit the gain of different axis into an ellipse
% model, which comes from a paper of Dora Angelaki, 1993
% In the model,
% c is the orientation of the Smax vector,
% a is the gain of the Smax vector,
% b is the gain of the Smin vecotr.
... |
function [ linked_sequence ] = link2Seq( seq1, seq2, flag )
%LINK2SEQ 先定基,再连接两个sequences
% 首尾相接的地方视flag而定
% flag = 0 (default) 用乘法, i.e. seq2 = seq2 * seq1(end)
% flag = 1 用平移,i.e. seq2 = seq2 - ( seq2(1)- seq1(end))
% ver1.0; Cheng,Gang; 20130411
%% pre-process
% flag默认为0
% if nargin ... |
function [tau1, tau2] = calcLoopCoef(LBW, zeta, k)
%Function finds loop coefficients. The coefficients are used then in PLL-s
%and DLL-s.
%
%[tau1, tau2] = calcLoopCoef(LBW, zeta, k)
%
% Inputs:
% LBW - Loop noise bandwidth
% zeta - Damping ratio
% k - Loop gain
%
% ... |
function PLS_calculate_stats(response_var_file, predictor_var_file, output_dir)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define the PLS calculate stats function with the following arguments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [out]= objectiveCoilSquareCalc3D(currentPandO, sys, fluxReal)
x = currentPandO(1);
y = currentPandO(2);
z = currentPandO(3);
theta = currentPandO(4);
phi = currentPandO(5);
[Hx,Hy,Hz]= spiralCoilFieldCalcMatrix(1,sys.xcoil,sys.ycoil,sys.zcoil,x,y,z); %calculates magnetic field componenets
Bx=sys.u0.*Hx;... |
function f = ground_energy_leading_term(xi, bits, n, tol)
%ground_energy_leading_term If the ground energy is const + a/N^2 + higher
%order term, then the function returns a.
% Detailed explanation goes here
if nargin < 4
tol = 10^(-6);
end
a = lowest_energies(xi, bits, n, 3, 'sr', tol);
b = lowest_e... |
function eda_plot_wm
% Plots online wm s_zt_scls for wavepain paper
% Settings
SAMPLE = 'behav'; % can be 'behav' or 'fMRI'
DONT_PLOT_OBSERVED_RESPONSE = 0;
XVAR = 't';
DETREND_SCL = 'no'; % can be 'yes' or 'no'
LEGEND_OFF = 'legend_off'; % 'legend_off' turns it off else on
YVAR ... |
function [PSNR] = calcPSNR(varargin)
p = inputParser;
addRequired(p,'im1');
addRequired(p,'im2');
addOptional(p,'peak',255);
parse(p,varargin{:});
pv = p.Results.peak;
im1 = p.Results.im1;
im2 = p.Results.im2;
im1 = double(im1);
im2 = double(im2);
pv = double(pv);
PSNR = 10*log10(pv^2/calcMSE(im1,im2));
end
%% Calula... |
function output = get_co_membership_distribution(BIRDS_DATABASE,PEDIGREE,C,plot_out,IM)
%N = size(C,1);
C = decompress_adjacency_matrix(C);
year = BIRDS_DATABASE.timestamp+1;
new_pairs = PEDIGREE.get_recorded_new_pairs(BIRDS_DATABASE,year);
old_pairs = PEDIGREE.get_recorded_old_pairs(BIRDS_DATABASE,year);
divorced_... |
function [ gridMaps ] = generateMiniMaps( )
%GENERATEMAP Creates the 8 Road basis image as given in Fig 2. of Rosman &
%Ramamoorthy 2010 (the paper referenced in the homework) Each map is
%defined by a grid-map, starting and target locations.
% gridMap is a $GridMap$ object, which has properties:
% Grid -... |
function PlotDisplacement(D,U,Sc,plotDisplacement,plotTubeThicknesses)
%Arguments are Frame(D), Displacement(U) and Scale Factor(Sc)
U = U(1:3, :);
C=[D.Coord;D.Coord+Sc*U];
e=D.Con(1,:);
f=D.Con(2,:);
%Requires Thickness to Compare to
RD5x35 = .051129; % 1
RD5x49 = .0694261;% 2
R75x35 = .078618; % 3
R75x49 = .107910... |
function SN = p2cg(ndim)
% input is the dimension (number of variables)
% variables are binary
% output will be the change of basis matrix
S = [1 1; 1 0]; % change of basis matrix for two vars
SN = kpow(S, ndim);
end |
%{
# spike train of a particular cell on a trial
-> tutorial.Cell
-> tutorial.Trial
-----
spk_train: longblob # spike times of a cell during a trial
%}
classdef SpkTrain < dj.Imported
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for key here
self.insert(key)
end
e... |
function [positionArray, ret] = queryPositions(self, code)
% 查询持仓
% [positionArray, ret] = queryPositions(code)
% 当code为空时,查询所有持仓。
% 当code为某合约代码时,查询该合约上的持仓。
% --------------------------
% 朱江,20160712
if ~exist('code', 'var')
code = '';
end
[positionArray, ret] = rh_counter_getpositions(self.counterId, code);
if ... |
% Function that adds all the folders in the current directory to the path.
function AddFoldersInCurrentDirToPath()
% warning('off', 'MATLAB:mpath:nameNonexistentOrNotADirectory');
% files = dir(pwd);
% for i = 1:length(files)
% addpath(files(i).name);
% end
% warning('on', 'MATLAB:mpath:nam... |
% Replace atom which isn't used
function [d] = rep_atom(Y)
temp = sqrt(diag(Y'*Y)); % Calculating norm2 of all vectors in Y
[a,b] = sort(temp,1,'descend');
d = normc(Y(:,b(1)));
end |
imshow(uint8(curImage));
fullImage = curImage;
fullImage(1:680,:,:) = 1;
fullImage(1080:-1:710,:,:) = 1;
fullImage(:,1:940,:) = 1;
fullImage(:,1920:-1:972,:) = 1;
pingPongBall = fullImage(680:710,940:972,:);
% Blacking out top left corner
pingPongBall(1:5,1:5,:) = 1;
pingPongBall(2,1:9,:) = 1;
pingPon... |
function [ communities ] = my_ga(Adj,pc,pm,elitism,generations,chrom,fit_max_unchanged,order_for_fitness_function)
%my genetic algorithm for communities detection
%%INPUT
%Adj : adjacency matrix
%pc : crossover probability
%pm : mutation probability
%elitism : number of conquering first chromosomes for the ... |
% ==================================
% Compute strain
% ----------------------------------
% switch MethodToComputeStrain
% case 0: finite element Gauss points;
% case 1: central finite difference;
% case 2: plane fitting method;
% ==================================
switch DICpara.MethodToComputeStrain
... |
function H = bandfilter3(type, M, N, Radii, Width, Order)
%巴特沃斯带阻、带通滤波器
% TYPE: 'reject'(带阻)、'pass'(带通)
% M, N: the number of rows and columns in the filter
% Radii: 表示每个频带中心的D0,1*k数组
% Width: 表示每个频带的宽度,1*k数组
% Order: 表示每个频带的阶数,1*k数组
[U, V] = dftuv(M, N);
D = hypot(U, V);
k = numel(Radi... |
function newp = AffineComposition( p,deltap )
%UPDATE composition of 2 affine warps
% input: two affine warps
newp = zeros(6,1);
newp(1) = p(1) + deltap(1) + p(1)*deltap(1) + p(3)*deltap(2);
newp(2) = p(2) + deltap(2) + p(2)*deltap(1) + p(4)*deltap(2);
newp(3) = p(3) + deltap(3) + p(1)*deltap(3) + p(3)*deltap(4);
new... |
clc
clear
close all
syms w n
freq = pi;
h(w) = 1/3*(exp(-1i*w*0) + exp(-1i*w*1) + exp(-1i*w*2));
Amp = abs(h(freq));
Phase = angle(h(freq));
func = Amp*cos(pi*n + Phase); |
clear
dates={'Aug_05_11' 'Aug_05_11' 'Aug_18_11'};
cellnum={'B' 'C' 'B'};
conc_propofol='100'; % Concentration of propofol in uM
start_current=10; % Starting current in pA
finish_current=150; % Finishing current in pA
increments=15;
celldata=zeros(numel(dates),6,increments);
matrixnames={'control_all_' 'control_i... |
%% initialise_supporting_structs.m
% Initialises the supporting structures (Not optimal but only called once)
%% Input:
% output_array: Assumed to be sorted by machine_num, (then movable)
% rows - a job allocated to a position in a machine
% columns - job_cost, machine_num, unique job_id, (m... |
%% Initialization
clear; clc;
rosshutdown;
rosinit;
%% Define node
node = robotics.ros.Node('grid_downsampling_matlab');
sub = robotics.ros.Subscriber(node, '/points_raw', 'sensor_msgs/PointCloud2', @grid_downsampling_callback);
function grid_downsampling_callback(~, msg)
ptCloud = pointCloud(readXYZ(msg), 'intensit... |
function f = frequency(Lam,M44);
[peaks,locs]=findpeaks(squeeze(M44));
a = numel(peaks)-1;
if a > 0
v = zeros(1,numel(peaks));
for x = 1:a
v(x) = (locs(x+1)-locs(x));
end
v(a+1)=v(a);
f = interp1(Lam(locs),v,Lam,'linear','extrap');
else
f = 800;
% plot(Lam,f,'green');
% plot(Lam(locs),v... |
function [ ] = plotEffectOfStaticvsDynamic( input )
%________________________________________________________________________________________________________________________
% Written by W. Davis Haselden
% M.D./Ph.D. Candidate, Department of Neuroscience
% The Pennsylvania State University & Herhsey College of Med... |
function [ t1, t2 ] = pq_formula( p, q )
p_half = p*0.5;
p2 = p_half*p_half;
t1 = -p_half - sqrt(p2-q);
t2 = -p_half + sqrt(p2-q);
end
|
function zfbShow(txt, type,long)
data = importdata(txt);
data = data.textdata;
N = length(data);
y1 = [];
y2 = [];
t = [];
if (long == 1)
date = data(1:6:N,3);
date = str2double(date);
date_max = max(date);
end
for i = 1: floor(N/6)
tmp = data((i-1)*6 + 1,:);
day = str2double(tmp{3});
if(long ==... |
function y=zfunf09(x)
%*****************************
% funzione test y=x^3-8 per
% la ricerca degli zeri [-2,2]
%*****************************
if (nargin==0)
y(1)=0;
y(2)=3;
else
y=x.^3-8;
end
|
folder = 'I:\1_MR\1_HQMR\R&D\SYS_APPL\TeamMitglieder\Werkstudenten\Ruben\RespatoryFiles\copy';
searchname = 'result';
destinationfolder = 'test';
copy_and_number_files(folder,searchname, destinationfolder); |
function plot_lapbylap_PFC_all(label,laptype)
%across laps get for each PFC cell:
%spatial information
%FR
%theta locking mrv
%theta phase preference
%theta preceission correlation x dir
%theta preceission slope x dir
%and across each arm and heading arm
... |
function v = Gen_v(h, noise_power, u)
conj_h = conj(fliplr(h)); % Generating h*(-n)
x = conv(h, conj_h); % x(n)=h(n)*(h*(-n))
syms z;
len = length(x); % Calculating the length of the convolutional sum x
for i = 1:len
... |
img = imread('01.jpg');
img(:,:,2) = 0;
figure, imshow(img);
imwrite(img, 'green.jpg');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
img = imread('01.jpg');
img = (0.299*img(:,:,1)) + (0.587 * img(:,:,2)) + (0.114 * img(:,:,3));
figure, imshow(img);
imwrite(img, 'gray.jpg');
%%%%%%%%%%%%%%%%%%%%%%%%... |
function [MM] = fGMBeamShapeIntegrals(gzf,Psi,Upsilon_kl,Sigma_kl,sigma_kl,sigma,Mass,ImomX,I_Jxx,GM_Jxx,bOrth,bAxialCorr,M1)
% NOTATIONS:
% r or x : 3 first translation dof
% t or theta : 3 Rotational DOFS
% f or g : 3 flexible dofs
%
% AUTHOR: E. Branlard
nf=size(Psi,2); % number of modes
% --- Opti... |
function [ZIe ZIn] = verifytin(ZI,R,x,y,z)
% Create the grid
[xi yi] = ir2xiyi(ZI,R);
[XI YI] = meshgrid(xi,yi);
% [yp xp] = map2pix(R,XI(:),YI(:));
% Interpolate
TRI = TriScatteredInterp(x,y,z,'linear');
ZIn = TRI(XI(:),YI(:));
ZIn = reshape(ZIn,size(ZI));
ZIe = ZI - ZIn;
end
... |
%% SVC METAMODELLING: VARIOUS METHODS
% This example showcases how to perform SVC metamodelling
% for a simple 2D function, using various hyperparameter estimation and
% optimization methods. The selected kernel is the anisotropic Matérn 5/2 kernel.
%% 1 - CLEAR THE WORKSPACE AND INITIALIZE THE UQLAB FRAMEWORK
clear... |
%% --------------------------- Missile Parameters ------------------------- %
clc; clear all; close all; set(0,'defaultfigurecolor',[1 1 1]);
global rho_v tF M_d T_m rho_w Vc tau N K K_dth dt tout resolution
% ---------------------- Initialize Simulation --------------------- %
MP = 1; NMP = -1;
tF = 6; ... |
function [ handle ] = varplot( varargin )
%VARPLOT: Plot data with variance indicators, in pretty Nature figure
%style. Supports NaN values in data (treated as missing data). Can be used
%and customized just like the standard "plot" function - for example:
%varplot(data,'r','linewidth',2) etc.. Can plot confidence i... |
function [cij,flag] = makerandCIJdegreesfixed(in,out)
%MAKERANDCIJDEGREESFIXED Synthetic directed random network
%
% CIJ = makerandCIJdegreesfixed(N,K);
%
% This function generates a directed random network with a specified
% in-degree and out-degree sequence. The function returns a flag,
% denoting wh... |
function rs = test5(test,like_spline)
%test5
close all
cone_slope = 10;
fire_cone = @(x,y) cone_slope*sqrt(( x.^2 + y.^2));
% if ~exist('like_spline')
% load spline_data.mat;
% [ls,fit1] = createFit(t,log_like);
% end
g = 100;
grid_size =2*g+1;
position = linspace(-10,10,grid_size);
[x,y]= meshgrid(position,p... |
%% Stelling 18
%
% De element-wise OR-operator kan niet worden toegepast
% op vectoren.
%
Antwoord = 0;
|
clear all;
clc
data=xlsread('12-28GEI数据.xlsx');
V50_1=data(:,1);
V50_2=data(:,3);
V50_3=data(:,5);
V50_pre1=data(:,2);
V50_pre2=data(:,4);
V50_pre3=data(:,6);
V100_1=data(:,7);
V100_2=data(:,9);
V100_3=data(:,11);
V100_pre1=data(:,8);
V100_pre2=data(:,10);
V100_pre3=data(:,12);
V150_1=data(:,13... |
function [dc_power_after, G] = min_peak_shaving_gen(grid_load_data, ...
dc_power, gen_power_cap, ramp_time_generator, gen_budget, gen_price)
T = length(dc_power);
ramp_rate = gen_power_cap/ramp_time_generator;
%% Optimize the violation frequency
cvx_begin
variables G(T);
v... |
function outImg = imgReg(inImg)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Image Registration for VSFP data
%
% function outImg = imgReg(inImg)
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[sX, sY, sZ] = size(inImg);
newImg(bs-1:(bs-1+99),bs-1:(bs-1+99),:) = inImg;
change = zeros(3);
shifts = 0;
diff = [0... |
% MATLAB main program for neural network training and pruning
%
% The network is initially trained using gradient methode.
%
clear
Ni = 4; % Number of external inputs
Nh = 5; % Number of hidden units
No = 1; % Number of output units
alpha_i = 0.0; % In... |
classdef FastDetector < handle
properties
BGR = [] % if static background
B = []
im0 = []
im00 = []
im000 = []
noise = 5/255
max_allowed_exp = 1.5
max_size = 300
Size = []
Size_r = []
scale_factor = 1
score_th = 0.4
corr_th = 0.95
hs_th = 0.6
min_f_th = -0.1
min_radius = 3
do_stabiliz... |
function r = GGLQ(sub, x, a, b, c, d, Alp, Bet, ww, C)
% GGLQ.m
% Global Gauss-Legendre Quadrature
%
% Input: sub, 4 subscripts of the 4th order tensor T, 1*4 matrix;
% x, 3 semi-axes of an inclusion, 3*1 matrix;
% a,b, the integrating range of theta;
% c,... |
% Image Selection
clc;
clear all;
close all;
imSelect = 1;
M = 4;
K = zeros(36, 1, 'uint32');
color_img_pathname = 'E:\Image Processing\Cyclone detection\new_cropped_db_code\output\';
initial_frame_number = 1;
final_frame_number = 36;
for i = initial_frame_number : final_frame_number
c = imread(strcat(color_img_pat... |
function wz = max(wx,wy)
if isa(wx, 'wavelet')&&isa(wy, 'wavelet') % max on two wavelet objects
if any(wx.size~=wy.size)||any(wx.depth~=wy.depth)
error('incompatible sizes: wavelet coefficients cannot be multiplied!');
else
if wx.fourier % operation makes sense for the spatial coeffs
... |
function hs = ExtractHistogramDescriptor(im, bins)
%EXTRACTHISTOGRAMDESCRIPTOR Summary of this function goes here
% Detailed explanation goes here
[hs, xx] = hist(im(:), bins);
hs = hs(:)/sum(hs);
end
|
% general sources on macbook air
% time period over which to take averages
% total length is 26281 hours
% 1200 hours is 50 days
ts=1200;
te=26281;
% -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
source='/Users/silvers/data/CAM/';
source_cam6=strcat(source,'CAM6_GCM_RCE/');
source_c... |
function [train, test]= t(vow_n)
vowels;
n = find(vowel_code==vow_n);
set = zeros(139, 14);
for i = n(1):n(size(n,2))
set(i-(n(1)-1),:) = all_data(i,:);
end
train = set(1:70, :);
test = set(71:139, :);
end
|
function [E_CO2, E_CO, E_CH4, E_PM25] = FEMIS(fgi, burn_rate, U_F, V_F, RH4, mode)
%FEMIS function computing emission rates of CO2, CO, CH4 and particlate matter
%based on:
% fgi - fuel load [kg/m2]
% burn_rate [kg/s] - mass of the fuel burnt in unit time.
% U_F, V_F [m/s] mid-flame wind speed components (used for com... |
function A=rstEVEN(qA,delta)
qA=double(qA);
sn=sign(qA); absqA=abs(qA);
clear qA
absA=(absqA-1)*delta;
absA = absA +0.5*delta; %restore at center
A = absA.*sn;
|
function extract_improvedfeatures(videofile, outfile)
% TODO: Change the paths and improved trajectory binary paths if necessary
if ispc
videofile = strrep(videofile, '&', '^&'); outfile = strrep(outfile, '&', '^&');
videofile = strrep(videofile, '(', '^('); outfile = strrep(outfile, '(', '^(');
... |
function cities = generate_cities(n)
cities = rand([2 n]);
save('cities.mat', 'cities')
end |
function outM = spindex(inM,varargin)
%function outM = spindex(inM,varargin)
%
%returns a matrix indexed from inM via index variables contained in varargin
%useful for retreiving multiple values from a large multidimensional matrix
%
%
%inM is an N-d matrix
%the index variables stored in varargin must be as numerous as... |
%pass in adjoint_matrix, opposite_face_mat)
opposite_point=zeros(nv,4);
for i =1:nv
j_now = uint8(opposite_face_mat(i));
n_vector = inv([x(v(j_now,1),:).'-x(i,:).',x(v(j_now,2),:).'-x(i,:).',x(v(j_now,3),:).'-x(i,:).' ])*normal_matrix(i,:).';
n1= n_vector(1);
n2= n_vector(2);
n3= n_vector(3);... |
%% Stelling 9
%
% Een Matlab functie heeft altijd:
% - een naam
% - een body
%
Antwoord = 1;
|
function valid_edges = collision_check_edges(car, obstacles, ...
waypoints, waypoint_traj_indices, x_trajectory, plotting_on)
if nargin < 6
plotting_on = false;
end
num_waypoints = size(waypoints, 2);
valid_edges = zeros(1, num_waypoints - 1)... |
clear all; clc;
% set parameters
lambda = 0.5; % sparsity regularization
overlap = 4; % the more overlap the better (patch size 5x5)
up_scale = 2; % scaling factor, depending on the trained dictionary
maxIter = 20; % if 0, do not use backprojecti... |
function fPE = photoElectric(E)
% fPE = photoElectric(E)
% returns the value of Andreas Keil's approximation to the
% energy-dependence of the photoelectric effect (which is often said to
% be E^(-3) but more closely approximated by E^(-2.6)).
%
% E photon energy (in keV)
% fPE value of the Klein-Nishina functi... |
function [characteristics] = getComponentCharacteristics(componentSWT, componentInfo)
% Function to get the characteristics of a component given its SWT
% that is used as the probability distribution
%
% Usage :
% characteristics = getComponentCharacteristics(componentSWT, compInformation)
%
... |
function s = spatialize(y,p)
% SPATIALIZE binaurally spatialize the vector y so its apparent location
% becomes p
%
% SYNOPSIS: s = spatialize(y,p)
%
% INPUT y: an audio vector sampled at 2^16 Hz
% p: a location in spherical coordinates (azimuth, elevation, distance)
%
% OUTPUT s: a binaural version of y
%
% REMA... |
function Tree_ordered = order_tree(Tree)
% Function to order a Tree branches in ascending depth and branching angle.
% Root branches (depth = 1), are defined as branches whose Parent ID=0.
% Input
% Tree = Input tree structure that.
% Output
% Tree_ordered = Order tree structure.
%% Determine field names of sibling a... |
figure(101);
clf;
x=[1 ,1 ; 2, 2; 3,3];
Gains = [0.72, 0.90; 0.74, 1.00; 0.62,0.83];
%error = [0.90; 0.09; 0.11; 0.07; 0.12; 0.05; 0.11; 0.09 ];
interval_lower= [0.10, 0.10; 0.05, 0.05; 0, 0];
interval_upper=[0.10, 0.09; 0.05, 0.04; 0,0];
width=0.8;
bar(x,Gains,width,'FaceColor',[1.0,1.0,1.0],'EdgeColor',[0 .01 .01],'L... |
% clear all
% close all
% clc
data = xlsread('Human twtiches frequencies.xlsx','Sheet1','A2:S902');
dataSim = xlsread('simfreq.xlsx');
%% Normal frequency dependency
figure(1); clf;
axes('position',[0.10,0.40,0.25,0.25]); box on; hold on;
plot(data(:,1),data(:,2),'r-','linewidth',3);
% plot(data(:,1),dat... |
function [node,nodeL,nodeR, ig_best] = splitNode(data,node,param)
% Split node
visualise = 0;
% Initilise child nodes
iter = param.splitNum;
nodeL = struct('idx',[],'t',nan,'dim',0,'prob',[]);
nodeR = struct('idx',[],'t',nan,'dim',0,'prob',[]);
if length(node.idx) <= 5 % make this node a leaf if has less than 5 dat... |
function [D,D_vec,Cd] = compute_DRAG(L_vec,alpha_ind,alpha,rho,U,S,M)
% This function computes the induced drag of a 3D wing
% After have computed the distribution of lift over the wing and the
% induced velocity/angle, one can compute the variation of the LIFT vector
% that produce the induced drag of the wing.
% The... |
%--------------------------------------------------------------------------
%------------ Metody Systemowe i Decyzyjne w Informatyce ----------------
%--------------------------------------------------------------------------
% Zadanie 2: KNN i Naiwny Bayes
% autorzy: M. Zięba, A. Gonczarek, J.M. Tomczak, S. Zaręba
%... |
function [ output ] = localseeding(trees,bests,input,label,tp,sv)
[m,n]=size(trees);
[a,b]=size(bests);
for i=1:a
for k=1:m
trees1=trees(k,:);
r=randi(n-3);
for j=1:r
trees1(1,randi(n-3))=bests(i,randi(n-3));
end
trees1=score(trees1,input,label,tp,sv);
... |
classdef Path < handle
%PATH Summary of this class goes here
% Detailed explanation goes here
properties
nodes = [];
end
methods
% This constructor takes the start node as an argument
function PathObj = Path(node) % constructor
PathObj.nodes = node;
... |
function [t_env,env] = envelope(a,d,s,sd,r,fs)
% Attack: amplitude linearly increases from 0 to 1 in ‘a’ seconds
tattack = 0:1/fs:a;
env =(1/a)*tattack;
t_env = tattack;
% Decay: amplitude linearly decreases from 1 to ‘s’ in ‘d’ seconds
tdecay = a+1/fs:1/fs:a+d;
t_env = [t_env, tdecay];
env = [env, 1-((1-s)/d)*(tdec... |
function [drhodRACPs, dPdRACPs] = generatew1(opt1D,VNew,DNew,zshift,zweight,Vcg)
Npole = opt1D.Npole;
hs = opt1D.hs;
NsGrid = opt1D.NsGrid;
NsCell = opt1D.atom.NsCell;
dPdRACPs = zeros(NsGrid,NsGrid,size(Vcg,2));
Ntot = length(DNew);
if nargout ==2
dPdRACPs = zeros(NsGrid,NsGrid,size(Vcg,2));
... |
% [merged] = merge_cell_structs(in, concat_2d, concat_dim)
% in : cell array of structures
% concat_2d : if 0 (default), this routine combines 1d vectors to make a long
% 1d vector
% if 1, this routine combines 1d vectors to yield a 2d array
function [merged] = merge_cell_stru... |
function [Z] = HDR_radi_map(num, folder)
Z = zeros(256, num, 3);
B = zeros(num, 1);
for color=1:3
for i=1:num
if(i < 10)
path = strcat(folder, 'img0', num2str(i), '.jpg');
else
path = strcat(folder, 'img', num2str(i), '.jpg');
end
... |
function [x_Final] = WTOptimisation()
% OPTIMISATION - use fminsearchbnd to optimise theta0, thetatw, and cgrad for
%maximum AEP.
% Initial, Lb & Ub are both arrays of 3 numbers with Initial being the
% initial guesses for Theta0, ThetaTwist and ChordGrad. Lb are the
% lower bounds for the optimisation... |
classdef F_Pic_Ssd < F_Pic
%F_Pic_Ssd Summary of this class goes here
% Detailed explanation goes here
methods
function obj = F_Pic_Ssd(f)
obj = obj@F_Pic(f);
end
end
end
|
%% Assignment 3 Q4
clear all; close all;
%Right most image = 00, Left most image = 07, 07->00 L->R
img = single(imread('hotel/hotel-00.png'))/255;
img = cat(3,img,single(imread('hotel/hotel-01.png'))/255);
img = cat(3,img,single(imread('hotel/hotel-02.png'))/255);
img = cat(3,img,single(imread('hotel/hotel-03.png'))/25... |
function S = profileHO(par)
% Generate a number of realisations of the linear gradient with additive,
% spatially correlated noise.
% Noise is simulated based on the stochastic harmonic oscillator model.
%
% M ddx1 + B dx1 + K x1 = xi Phi,
%
% where Phi is the unit white noise process. Equivalently,
%
% dx1 = x... |
num_players = 10000;
variable_test = 25;
num_iter = 999;
start_money = 25;
money = zeros(num_players,num_iter);
money(:,1) = start_money*ones(num_players,1);
for n=1:num_iter
players_in_game = money(:,n)>0;
num_players_in_game = sum(players_in_game);
money(players_in_game,n+1) = ...
money(players_in_game,... |
function answer = rp_plot(image)
%%%The function will plot the parameter of translation%%
%%%and rotation of the subject's head-movement directly.%%
%%%Writed by Wang Shilei,School of Physics,Peking University%%
%%%Beijing,December 18th,2020%%
data = load(image); %%Load the rp_*.txt%%
set(0,'defaultfigurecolor','w');... |
function LibDataArray = readLibData(libFolder,fileType)
%readLibData 读取Lib类型文本数据
% 输入
% libFolder 存放读取文本的目录名
% fileType 待读取文件类型
% 输出
% LibDataArray Lib文件结构体
%% function readLibData(libFolder,fileType)
% Nested Functions:
% # getPathNames
% # getLibDates
% Local Functions:
%... |
function cos_se = cos_se( A )
%% cos(x)= 1 - x^2/2! + x^4/4! 使用泰勒级数计算cos函数
x = (A/180)*pi;%把输入的角度转换为弧度
%%
symbol=1;
sum=0;
my_eps=10^-8;
temp_sum=1;
power=0;
while abs(temp_sum)>my_eps
sum=sum+temp_sum;
symbol=-symbol;
power=power+2;
temp_sum=symbol*x^power/factorial(power);
end
... |
function TRAN_IM = vuResampleImage(X, transformation, varargin)
% vuResampleImage(...) resamples image X according to the transformation
% specified by transformation (Matrix/Offset OR Centered).
% Note: Transformations are defined from the output image space to the
% input image space.
%
% TRANSFORM STRUCTURE:
% ... |
function [pathways, perturbationScores, universal_ssScore] = universalDb(model,ssScore, data_matched, listCond,parsedGPR,corrRxn, numPerms)
% this function permits to map expression data of the condition of interest
% (expr1) against the second condition in the universal database. It
% returns pathways: predicted set ... |
%% This code plot three MI(pos, abs, speed) in same picture
%Position is red
%Speed is blue
%Absolute is black
close all;
clear all;
code_folder = pwd;
exp_folder = 'D:\GoogleDrive\retina\Exps\2020\0708';
cd(exp_folder)
sorted =0;
%Load calculated MI first(Need to run Calculate_MI.m first to get)
if sorted
cd MI\so... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.