text stringlengths 8 6.12M |
|---|
x = [1 2 3 4]
y = [2 1 -2 3]
%x*y %cannot multiply 2 vectors using matrix multiplication
x.*y
x./y
x.^y
x+y
x-y |
function [X,Y,R,T,MAT]=ReadFromMatFile(sfile)
%--------------------------------------------------------------------------
% All copyrights reserved @ 2014-2020 Dr. Gaofeng Zhao
% TIANJIN UNIVERSITY (China), UNSW (Australia)
% Email: zhaodlsm@gamil.com
%--------------------------------------------------------------... |
function h1 = fitpanelguide_export()
% This is the machine-generated representation of a Handle Graphics object
% and its children. Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object wa... |
% clear;
close all
global DMBufferSizePV
data_length=2^24;
compare_length=2^14;
N=data_length;
tsamp=1/614.4e6; %current sample rate
fs=1/tsamp;
fif=450e6;
tif=1/fif;
Band=3;
%% Name for saving data
ctime=ctimeForFile();
dataFileName=[num2str(ctime),'_lb','.dat'];
dataFileDir=dataDirFromCtime(ctime);
%% Whether or... |
function xtrack(x, g, l, u, init)
%XTRACK display graph
%
% xtrack(x, g, l, u)
%
% Output display showing the components of g
% and the components of x, relative to the bounds l,u
%
% Copyright (c) 1990-98 by The MathWorks, Inc.
% $Revision: 1.5 $ $Date: 1998/07/09 16:30:09 $
set(gcf,'doublebuf... |
function edfhdr=edf_hdr_reader(filename)
% edfhdr=edf_hdr_reader(filename)
%
% Opens and reads the header to .edf (European Data Format) files. The file
% definition can be found here: http://www.edfplus.info/specs/edf.html.
%
% Inputs: filename: full path and name of file to open.
%
% Outputs: edfhdr: structure con... |
function playRipple_timer_stopfcn(obj,event,handles)
RX6 = getappdata(handles.playRipple,'RX6');
RX6.Halt;
playRipple_reset_atten(handles);
hMat = getappdata(handles.playRipple,'hMat');
nStimPlayed = getappdata(handles.playRipple,'nStimPlayed');
if nStimPlayed == 0
delete(fullfile(getappdata(handles.playRi... |
function out_img = an_andr_gray(I,in_thresh)
%AN_GRAY returns graythresholded img
% Detailed explanation goes here
out_img=im2bw(I,in_thresh);
end
|
function verify(handles,t)
%inserisco i dati nella struttura
handles.dati.property=get(handles.popupmenu2,'Value');
handles.dati.type_property=get(handles.popupmenu3,'Value');
handles.dati.alpha=str2double(get(handles.edit9,'String'));
handles.dati.d=str2double(get(handles.edit16,'String'));
handles.dati.s=str2do... |
function [Mu_theoretical]=Mu_t_construction(Psi,a,C_P)
u_i = floor(size(C_P,1)/2);
Mu_theoretical = Psi*(a.*(C_P(u_i,:)'));
end |
N = 5;
A=zeros(N,1);
for k=1:N
A(k)=1/k^2; %amplitude vector
end
fs = 10000; %sampling frequency
F_notes1=2*[87.31 98.00 116.54 98.00 87.31 98.00 116.54 98.00]; %storing the frequencies o... |
%% This function runs the HIDEN algorithm locally based on given dynamic set.
% Gp[in]: NxN adjacent matrix where N is the number of vertices (modified network).
% T[in]: Nx1 vector where T(n) is the hierarchy assignment of the n-th vertex.
% D[in]: Kx1 vector where D(k) is the vertices in the "dynamic set".
% M[in... |
clc;clear;
% 选择需要参与计算的电极 gamma('P4') high(CP4 P4)
Chan = {'P4'};
Freq_band = {'gamma'};
% Chan = {'P4' 'CP4'};
% Freq_band = {'high'};
% Freq_band = {'alpha' 'beta' 'theta' 'gamma' 'high' 'low'};
% 获取当前工作路径下以_EEG_FA_final.mat结尾的文件,保存在MatFiles结构体中
All_final_path = 'G:\GU第三次\02-data_analysis\gamma&high alpha\';
MatFile... |
function X=Gauss_Seidel(A,b,N,delta,P)
%Input -A n*n非奇异矩阵
% -b n*1矩阵
% -N 最大迭代次数
% -delta 精确度
% -P n*1矩阵,初始值
%Output -X n*1使用Gauss-Seidel(分量形式)方法得到的方程组AX=b的解
%求维数
n=length(b);
%初始化X
X=zeros(n,1);
%k记录迭代次数
k=1;
while (k<=N)
for i=1:n
%计算新的值,注意与Jacobi的X(i)=( b(i)- A(i,[1:i-1,i+1:n]) *... |
function raiz = mullernewton (xl, xu, es, ni)
% xl = limite inferior -> a
% xu = limite superior -> b
% [xl, xu] = [a, b]
% es = precisão da raiz (se a raiz encontrada for menor ou igual a precisão, satisfaz a equação)
% ni = numero de iterações, se não encontrar uma raiz até esse numero sai do algoritimo
... |
function p = fhpkg_cvpr06_base_params(q)
% P = fhpkg_cvpr06_base_params(Q) returns a parameter set defining the "base"
% model used in [Mutch & Lowe 2006]. Pass this parameter set to fhpkg_model (as
% illustrated in fhpkg_cvpr06_run) to generate the corresponding CNS network
% model.
%
% Q.bufSize - Size of buffer... |
function scrambledImage = wordScrambleImage(image, rows, columns)
% scrambledImage = wordScrambleImage(image, rows, columns)
%
% Purpose
% Given a particular image, break it up into a given amount of columns and
% rows and scramble their order.
%
% Input
% image - 2D matrix of numbers
% rows - Number of rows y... |
function [ array_spike_count_per_bin ...
array_mean_spike_count_per_bin ...
array_mean_spike_count_per_bin_std ...
array_mean_spike_count_per_bin_sem ...
elec_spike_counts_per_bin ...
elec_spike_counts_per_bin_mean ...
elec_spike_counts_per_bin_mea... |
function [ xMMAE, probabilities ] = performMMAE( location, KalmanBank )
%performMMAE Performs Multiple Model Adaptive Estimation
% Given a bank of Kalman Filters, performs MMAE returning the weighted
% states and the probability associated with each model
%DEBUG
%For each kalman filter in the bank, predict and u... |
function map = mynorm(map,param)
if ( param.subtractMin )
map = mat2gray(map);
else
map = map / max(map(:));
end |
function [ROCcurve] = ROC(G, S, Network, TranscriptionFactors, res)
clear ROCcurve;
[N cols] = size(Network);
[T cols] = size(TranscriptionFactors);
GLinks(N*T - T,4) = 0;
SLinks(N*T - T,4) = 0;
c = 1;
for i = 1:T
for j = 1:N
TF = TranscriptionFactors(i,1);
if j ~= TF
GLinks(c,:) = [TF,... |
function [Dex] = Dex_Analysis(Dex,N,QS,Limitation)
QUpL = Limitation(:,2);
QDownL = Limitation(:,1);
qUp = libpointer('doublePtr',QUpL);
qDown = libpointer('doublePtr',QDownL);
%%
ND = N;
R = zeros(ND,1);
for i = 1:1:ND
Y = calcu_jacobian(QS(i,:));
qPtr=libpointer('doublePtr',QS(i,:));
[U S V] =... |
clear all
close all
M=100;
eps=0.1;
x_max = 100;
y_max = 100;
obstacle = [70,20,5,60];
obstacle2 =[10,40,50,20];
epsilon=1;
numNodes =3000;
q_start.coord = [0 99];
scatter(q_start.coord(1),q_start.coord(2));
hold on
q_start.cost = 0;
q_start.parent = 0;
q_goal.coord = [75 10];
q_goal.son=0;
s... |
%{
In the log files: Yaw Rate is g_mpu_2_ -- col 36 (or N-1)
Winch cmds -- cols 46 & 47 (or N-1)
Winch (or motor) commands represent the change in dynamic line length
leading to changes in yaw and yaw rate. What relationships exist in the
scale (canopy area, mass and weight,...) ... |
function [amp, f0 ] = integrate_peak(tx,xx, df, f0)
% [amp, f0 ] = integrate_peak(tx,xx, df, f0)
%
% Integrates signal inside the +/-df band around main peak
% in the f0+/-df region.
% Returns amplitude and peak position (w/o smoothing)
N = length(tx);
ddt = (tx(N)-tx(1))/(N-1);
ddf = 1/ddt/N; % frequency ... |
classdef SVM_BestOfBreedMulticlassHierarchy < SVMClassifier
properties
classifier_tree;
result_labels_per_seq;
end
methods
function obj = SVM_BestOfBreedMulticlassHierarchy()
obj.classmap = {'Walking',1; ...
'Driving',2; ...
... |
function colonyState = specifyCircularColony(initialState, colonyRadius, quadrantCut)
%% returns a binary matrix, with colony pixels as 1.
colonyState = false(size(initialState,1), size(initialState,2));
colonyCenter = [floor(size(initialState,2)/2), floor(size(initialState,1)/2)]; %[center_x, center_y];
colonyState(c... |
% Copyright [2017] [Proteek Chandan Roy]
%
% 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://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or... |
%a = [5 10 15 25 50 75 100 125 150 175 200 225 250];
a = [5 10 25 50 75 100 250];
x = importtab('P:\Stealth KeysTest2i (fixed service nodes)\Global.tab');
HopsNoReply = ((x.DHT_Hops_Avg .* x.DHT_MsgRecv_Count)-x.DHT_GetReplyMessage_Count)./(x.DHT_MsgRecv_Count-x.DHT_GetReplyMessage_Count);
ans = [];
for i = 1:le... |
function [] = menuHyper(self)
%menuHyper lets the user change hyperparameter options
%
fprintf('\n* * * * * * * * * * * * * * *\n');
fprintf( '* Hyper Parameter Tuning *');
fprintf('\n* * * * * * * * * * * * * * *\n');
finished = false;
while (finished == false)
fprintf('\nMake a selection from the ... |
function gcd = ZpEuclidAlg(ax,bx,p)
% gcd = ZpEuclidAlg(ax,bx,p)
if bx(1) == 0;
gcd = ax; return
end
if ax(1) == 0;
gcd = bx; return
end
%So we now assume both polynomials ax and bx are nonzero.
Rem_m1 = ax; Rem = bx;
[Quot NewRem] = ZpDivAlg(Rem_m1,Rem,p);
while NewRem(1) ~= 0
Rem_m1 = Rem; Rem = NewRem;... |
function f_PostProcMECohesivo(iStep,m_NumElemMacro,m_DefMacro,e_DatMatSetMacro,hvar_newMacro,...
e_VarAuxPGMacro,e_VGMacro)
%Se recupera variables micro
xx = e_DatMatSetMacro.xx;
in = e_DatMatSetMacro.in;
e_VG = e_DatMatSetMacro.e_VG;
m_ElemPGImpr = e_DatMatSetMacro.m_ElemPGImpr;
e_D... |
%% Stelling 19
%
% De logische NOT en de logische OR kunnen worden
% gecombineerd.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
function lsf(im)
im=rgb2gray(im);
im=im2double(im);
figure('Name', 'Origin edge')
imshow(im);
diffim=diff(im,1,2);
absdiff=abs(diffim);
%Find the position of the edge
[~,x]=max(absdiff,[],2);
hold on;
plot(x,1:size(x));
%Fitting the edge then find the new edge position
... |
function Output_Image = VSMS_LoadFile( file_name )
img_dir_path = 'C:\Users\Surafel Nigussie\Documents\MATLAB\Images\';
img_URL = strcat(img_dir_path, file_name{1});
if ~exist(img_URL, 'file')
% Didn't find it there. Check the search path for it.
path_str = file_name{1}; % No path this... |
dataFilename = '~/workspace/DeepCNNData/cifar/out/testEst_time6400.txt';
dataFile = fopen(dataFilename, 'r');
if(dataFilename< 0)
disp(['Cost file ', dataFilename, ' does not exist']);
fflush(stdout);
keyboard
end
exampleIdx = [];
gt = [];
est = [];
conf = [];
line = fgetl(dataFile);
while(ischar(line))
... |
% compute undistorted location from distorted location
% WARNING: BE AWARE OF PIXEL INDEING STARTING AT 1 OR 0
function [x,y] = undst_point(xp,yp,px,py,px2,py2,good_points)
% (xp,yp) are the point coordinates in the distorted frame found by image
% tracking/feature recognition
% px2 and py2 are the locations of pixel... |
clear; close all;
%Toy Example for Augmented Lagrangian
H=[5 -2 -1; -2 4 3; -1 3 5];
c=[2; -35; -47];
Aeq = [1 1 1];
beq = 19;
lb = [6; 6; 6];
ub = [8; 8; 8];
options = optimoptions('quadprog',...
'Algorithm','interior-point-convex','Display','final-detailed');
x_ref = quadprog(H,c,[],[],Aeq, beq, lb,ub, [], option... |
function fun_bode_plot( wout,mag,nameModel,figureNumber )
load('simulation_data_3.mat');
load('bodedata.mat');
delay = 15;
for k = 1:numel(freq)
preprocessed_data = fun_preprocessing(iddata( y_mut_sine(:,k), ...
u_mut_sine(:,k), 1 ),[], delay, 20, 0 );
z(:,k) = fft(pre... |
function [ras, psth_x, psth_y, psth_ts] = getFIRA_rasterPSTH(trials, Lsb, spikei, ...
raster_begin, raster_end, raster_wrt, bin_size, sortras)
% function [raster, xs, ys, yd] = getFIRA_rasterPSTH(fname, trials, Lsb, spikei, ...
% raster_begin, raster_end, bin_size)
%
% Returns:
% ras: mx1 cell array, raste... |
%gui_threshold_ripples
%% Find location
close all
dname=uigetdir([],'Select folder with Matlab data of trial');
cd(dname)
%%
%Band pass filter design:
fn=1000; % New sampling frequency.
Wn1=[100/(fn/2) 300/(fn/2)]; % Cutoff=100-300 Hz
% Wn1=[50/(fn/2) 80/(fn/2)];
[b1,a1] = butter(3,Wn1,'bandpass'); %Filter coefficie... |
function [featureVector] = featureExtractor(x,plotStream)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
[m,n]=size(x);
lvl=6;
THon=0.1;
THoff=-0.1;
xdiff=diff(x,1,2);
xdiff=[xdiff xdiff(:,end)];
xd=xdiff;
for i=1:m
[swa... |
%% connectVNA_1
%
%% Description
%
% |connectVNA_1()| creates and returns a COM object to a PicoVNA device.
%
% *Output Arguments:*
%
% * |obj| - the VNA COM object corresponding to the PicoVNA device
%
% See also <disconnectVNA_1.html disconnectVNA_1> .
function [obj] = connectVNA_1()
% Create VNA ... |
clc
clear all
x = input('Enter 1 for entering the matrix manually, or 2 for generating random matrix :')
if x == 1
A = input('Enter the square matrix (make sure that it is non-singular):')
M = zeros(length(A))
C = zeros(length(A))
elseif x == 2
m = input('Enter dimension of the random square... |
falls_list = [6,2;7,3;8,1;9,2;10,3;11,2;12,2;13,3;14,1;15,1;16,1;17,1;18,1;19,1;20,3;21,2;22,1;23,1;24,1;25,1;26,2;27,1;28,1;29,1;30,1;31,1;32,1;33,1;34,1;35,1;36,1;37,1;38,1;39,1;40,1;41,1;42,1;43,1;44,1;45,1;46,1;47,1;48,1;49,1;50,1;51,2;52,1;53,1;54,2];
label_lab2_cha = {'bendpick1';'bendpick2';'bendpick3';
'b... |
%% Preprocessing SBS2 data
clear all
close all
clc
%%
addpath('/Users/margretsveinsdottir/Documents/MATLAB/eeglab14_1_1b')
addpath('/Users/margretsveinsdottir/Documents/DTU/Vor 2018/THESIS/Code/Lauras code/IC_MARC_current')
addpath('/Users/margretsveinsdottir/Dropbox/Master thesis/Data/First_run_pre')
addpath('/Users/... |
classdef MHyProReset < handle
properties (SetAccess = public, GetAccess = public)
ObjectHandle
end
methods (Access = private)
% Destructor
function delete(obj)
MHyPro(11, 1, obj.ObjectHandle);
end
end
methods (Access = public)
... |
% Preprocess color RGB image with local histogram equalization (global or local=CLAHE)
% Process each channel separately.
function I = preprocessHistogramEq(I,method,colorMode)
% RGB - image [H x W x 3]
% method - 'global', 'local', or 'none'
if ~exist('method','var') || isempty(method)
method.type = 'none';
end
... |
function varargout = gui_videobbox(varargin)
% GUI_VIDEOBBOX MATLAB code for gui_videobbox.fig
% GUI_VIDEOBBOX, by itself, creates a new GUI_VIDEOBBOX or raises the existing
% singleton*.
%
% H = GUI_VIDEOBBOX returns the handle to a new GUI_VIDEOBBOX or the handle to
% the existing singleton*.
%
% ... |
function [wd, whd] = rebuilt(wd, whd, par, criteria)
% par = 'Time';
[index, ~] = detect(par);
[indsource, ~] = detect('Reference');
indsn = detecthp('setnumber');
setsarray = [];
k = 0;
i = 0;
ind1 = i + 2;
while i <= size(wd(2:end,:),1)-1
i = i + 1;
sheetnumber = whd{i+1,indsn}(1,1);
setnumber = whd{i+1,i... |
yalmip('clear')
clear all;
close all; clc;
syms U_c eta A_c rho_c c_c V_c
syms A_t U_t rho c V_ct V_t
syms Tcout Tcin Toa Fc I
syms Ttout Ttin Ft
C_c = rho*c*V_c;
C_t = rho*c*V_t;
C_ct = rho_c*c_c*V_ct;
% differential equations for solar collector and heat exchager
state_1... |
%%
% Machine Vision Project
%
% Author: Colin Power
% Email: cp1372@mun.ca
%
% Script for slicing an image into evenly segmented strips
% Select a bar of sheet music and half the whitespace to the closest lines
% above and below to evenly segment the sheet music.
clear all
close all
I=imread('twinkle.png');
info = im... |
function varargout = BarPlotBreak(varargin)
% BarBreakPlot(y,y_break_start,y_break_end,break_type,scale)
% Produces a plot who's y-axis skips to avoid unecessary blank space
%
% INPUT
%
% 'y_break_range'
% y_break_end
% break_type
% if break_type='RPatch' the plot will look torn
% in the broken s... |
clear all
close all
% Take user input
% n = input('Value for number of data points n: ');
% m = input('Value for the order of the polynomial m: ');
% coeffA = input('Value for coeffitients [a_0, a_1, ..., a_m]: ');
% e = input('Value for experimental rms value e: ');
n = 100;
m = 1;
coeffA = [1, 2];
e = 1;
% Produce ... |
close all;
clear all;
clc;
format long g;
POPULATION_SIZE = 50;
HIDDEN_NEURONS = 3;
CROSSOVER_PROBABILITY = 0;
TOURNAMENT_SELECTION_PARAMETER = 0.75;
NUMBER_OF_GENERATIONS = 2000;
NUMBER_INPUTS = 3;
NUMBER_OUTPUTS = 2;
NUMBER_SETS = [10 5];
TOURNAMENT_SIZE = 2;
VARIABLE_RANGE = 1;
LENGTH_CHROMOSOME = NUMBER_INPUTS*H... |
% Calculate Gram
clear;
load data1.mat;
N = size(TrainingX, 1);
% Compute variance of kernel
squared_distance = zeros(N, N);
for i = 1:N
for j = 1:N
squared_distance(i, j) = norm(TrainingX(i, :) - TrainingX(j, :));
end
end
kernel_variance = sum(sum(squared_distance)) / N^2;
% Compute the Gram Matri... |
% m202x.m
% help file for m202x.dll
%
% returns -1 on error
% accepts six commands
% (defined in globals_mii.m as strutures C_ and M_)
% C_.INIT
%
% C_.MODE sets memory, channel and trig modes
% 2nd arg should be one of:
% M_.MEMORY (followed by M_.MANUAL or M_.AUTO)
% M_.INPUT (followed by M_.AUTOSTEP or... |
function [B] = int2bin(N,b)
%INT2BIN converts a vector N of non-negative integers to a matrix B whose columns represent the binary values of elements of N
% takes in N (a row vector of integers), b is the min number of bits used to
% represent N in binary form. B is an array of the binary forms of N
if nargin==1 ... |
function [array] = insertion_sort(array)
for i = 2:array.size()
tmp = array[i];
j = i - 1;
while (j => 1 && array[j] > tmp)
array[j+1] = array[j];
j = j-1;
end
array[j+1] = tmp;
end
end
|
classdef L2Infgradient < basicGradient & L2InfProxDual
properties
end
methods
function obj = L2Infgradient(alpha,dims,varargin)
obj = obj@basicGradient(alpha,dims,varargin);
end
end
end
|
function B_infer_p(id)
addpath('../../util');init
load /data/vision/billf/manifold-learning/DL/Data/BSD/dn_ucb_pb2
load ../bd_st2
addpath(genpath('/data/vision/billf/stereo-vision/VisionLib/Donglai/Opt/spams-matlab'))
start_spams;
psz = 31;
algo_id = 1;
ssz = 0;
rr=cell(2,2);
for gid = 1:2;
switch gid
case 1
sub... |
%% Laplace-Op.
function [A] = Num_1_Wirbelstroemung_GUI_Laplace(nx,ny)
A = zeros(nx*ny,nx*ny);
for m = 1:1:nx*ny
A(m,m) = -4;
if mod(m,ny) == 1
A(m,m+1) = 1;
A(m+1,m) = 1;
elseif mod(m,ny) == 0
A(m,m-1) = 1;
A(m-1,m) = 1;
else
A(m,m-1) = 1;
A(m,m+1) = 1;
... |
classdef ModelRL_Jumping_KW < ModelRL
properties
end
methods
function loadModel(obj, xmlPath, trialInfo)
obj.model = createJumpModel_ioc_2D_modForIOC(trialInfo.path, trialInfo.targNum, trialInfo.jumpNum, xmlPath);
% obj.modelJointNameRemap = {model_old.joints.n... |
function I = fn_smooth3(I,sigma)
% function I = fn_smooth3(I,sigma)
%---
% 3D smoothing with gaussian kernel convolution
% filter half-width is sigma
% window length is 2*ceil(sigma)+1
% Thomas Deneux
% Copyright 2005-2012
n = 2*ceil(sigma)+1;
filt = fspecial('gaussian',[n 1],sigma);
filt3 = repmat(filt*filt',[1 1 n]... |
function f = MLS_energy(t, number_of_neighbor, gaussian_param, source, normal, neighbor_pnts, weight)
% Calculate the energy value of a given point
%
% [out_a] = MLS_curvature_computing (in_1, in_2 in_3, in_4, in_5, in_6, in_7)
%
% Parameters [IN ]:
% in_1 : optimization variable
% in_2 : number of neighbor po... |
function [sumrsp, sumref, Dsmp, cyc, NBlocks, durCyc, durSmp] = getPhaseblockedBlock(fnms, fnmr, mf, Fs, dur)
if nargin < 4
Fs = 24414.0625*4/20;
end
if nargin < 5
dur = 20;
end
if mf > 40
cyc = round(250/1000*mf);
else
cyc = 10;
end
refa = PreadDAT(fnmr);
rspa = PreadDAT(fnms);
sm... |
%% Problem 3
%Author - Roshan Pradhan
clc
clear
close all
%% Declare parameters and initialise
Q = eye(2); R = 1; N=20;
u = -2:0.5:2; x = -pi:pi/6:2*pi; x_dot = -3*pi/2:pi/6:3*pi/2;
dt = 0.05; x_d = [-pi, pi;0, 0];
J_init = zeros(length(x),length(x_dot)); J_whole = zeros(length(x),length(x_dot),1); policy_whole = zer... |
function On = GetOnOff(obj)
% query instrument output status
% adcmt 6166: 6161-compatible mode must be set to ON (set by using the instrument front panel)
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
TYP = lower(obj.drivertype);
... |
function T = drawT(X, width, length, height, upright, arena)
T(1) = drawBox(X - 360/96*(length - width)/2, width, length, height, arena);
if (upright == 1)
T(2) = drawBox(X, length, width, height + (length - width), arena);
else
T(2) = drawBox(X, length, width, height, arena);
e... |
% Lithophane-generator
% main.m
%
% © Jacob Peroutek, 2020
% All rights reserved.
clc;
clear;
tic;
addpath('generators');
addpath('utils');
%% Image loading and processing
% Load the image
fprintf('Loading image...\n');
img_data = imread('samples/Disney_Train_Photo.jpg');
% Convert to grayscale if necessary
if ndi... |
function [res,arc] = RBES_top_archs_in_metric(results,archs,metric,type,pct,PLOT)
global params
values = results.(metric);
if strcmp(type,'LIB')
mode = 'descend';
else
mode = 'ascend';
end
[~,order] = sort(values,mode);
res = RBES_subset_results(results,order(1:round(pct*size(archs,1)/100)));
arc = archs(order(... |
function dxdt = Derivatives(xstate,t,ustate)
%%%%Extract all the states and controls from the input variables
x = xstate(1);
z = xstate(2);
theta = xstate(3);
u = xstate(4);
w = xstate(5);
q = xstate(6);
dt = ustate(1); %%%thrust
de = ustate(2); %%%elevator
%%%Compute the Total thrust
%%%Compute vi which is induced f... |
function [ki_up, dki_up] =Ed_2d(k,ffo,fmo,rho,Dissimilarity,Spacing,delta,ZU_diff)
% k-update 把k看成一个向量来计算,求出一个点的位移场更新
% 对一个向量进行位移场更新...返回找到最小值的点...即最小 f 对应的 k..
%
% 输入最好是一维列向量...输出也是一维列向量
% k 是 n*L行 1列...一共3维/
% Dk、u、z 是 n2列 L行
v=prod(delta);
[m,n]=size(fmo);
[x,y]=ndgrid(0:m-1,0:n-1); %... |
function B = BporNorma(I,n,a)
% Función creada para calcular el campo B en el eje Z según la norma IEEE
% 644-2019:
mu_0 = 4*pi*1e-7; % Permeabilidad magnética del aire.
B = ((-1*mu_0*I*n*sqrt(2))/(pi*a))*1e6;
end
|
function [x, k] = Gaussmethod(A, b, x0, N, emg)
%A 是线性方程组的左端矩阵
%b 是右端向量
%x0 是迭代初始值
%N 表示迭代次数上限,若迭代次数大于 N,则迭代失败
%emg 表示控制精度
%用 Gauss-Seidel迭代法求线性方程组 A*x=b 的解
%k 表示迭代次数
%x 表示用迭代法求得的线性方程组的近似解
n = length(A);
% x1 = zeros(n, 1);
x2 = zeros(n, 1);
x1 = x0;
r =... |
function mv(source, dest)
% A version of movefile that raises an error on failure
[ok,msg] = movefile(source, dest);
if ~ok
error('Failed moving "%s" to "%s": %s', source, dest, msg);
end
end |
cndl = fopen('Canon_Doyle.txt');
jnat = fopen('Jane_Austin.txt');
samples_cd = textscan(cndl,'%s',10000);
samples_ja = textscan(cndl,'%s',10000);
stpwrd= fopen('english.stop');
Stop_words = textscan(stpwrd,'%s',1000);
stemmed_cd = text_preprocessing(samples_cd,Stop_words,10);
stemmed_ja = text_preprocessing(samples_ja... |
function [trials markers]=trials_make2(eegdata,marker,dt1,dt2)
%[trials markers]=trials_make2(eegdata,marker,dt1,dt2)
% Produce trials for EEG data described by EEG data 'eegdata' and marker
% data 'marker'. This function operates on EEG data represented in the
% form of {time x channels} matrix (may be merged from di... |
%%% This example compare the GLLiM algorithm using Lw=0 or Lw=1 on the
%%% Stanford face dataset (isomap.stanford.edu/datasets.html)
%%%
%%% The function gllim_face_test learn a mapping from face poses to images
%%% using all except 8 random test images. Two algorithms are tested,
%%% namely hGLLiM-0 and hGLLiM-1, with... |
function [ y, lb, ub,x, M ] = Two_humps_function_1d()
addpath('help_functions')
addpath('TPLHD')
n = 1;
lb = -0.5*ones(n,1); % lower bound
ub = 5.0*ones(n,1);
% Initial samples
% x = scaled_TPLHD(n*8,lb,ub);
% x = [0.0;0.92;1.56250000000000;2.25000000000000;2.93750000000000;3.62500000000000;4.312500000000... |
% This function uses given stereo camera to reconstruct 3-D points from
% left and right pictures
% C1 - 3x4 Camera Matrix 1
% p1 - Nx2 set of points
% C2 - 3x4 Camera Matrix 2
% p2 - Nx2 set of points
% P - Nx3 matrix of 3D coordinates
% err - scalar of the reprojection error
funct... |
function RVD = computeResidualViscOperator_LogPLogTh(REFS, RHS)
%% Set the dimensions
OPS = REFS.NX * REFS.NZ;
%% Set the characteristic length scales (Nyquist length at the given order)
DX = 2.0 * min(diff(REFS.XL(1,:)));
DZ = 2.0 * min(diff(REFS.ZTL(:,1)));
%% Fetch the derivative ma... |
function [breakFlag,Wfuel,We_Wto,CruiseAlt] = WeightSizing(WtoGuess,CruiseMach,CruiseAltIn,...
CruiseReserve,WoverS,ToverW,engType,AR,DesignRange,DesignPayload,span,Sweep,ClCruise)
%% Weight Sizing Iteration Script
% Bryan Schmidt
% clear all;
% close all;
% clc;
format compact
global PlaneChoice CruiseClimb
%% ... |
% krig_optim_mcmc
% CALL :
% [V_new,be_acc,L_acc,par2,nugfrac_acc,V_acc,options]=krig_optim_mcmc(pos_known,val_known,V,options)
%
function [V_new,be_acc,L_acc,par2,nugfrac_acc,V_acc,options]=krig_optim_mcmc(pos_known,val_known,V,options);
be_acc=0;
V_new=V;
if ischar(V),
V=deformat_variogram(V);
end
options.i... |
function opts = opts_adapted(maxit,rel_res_tol,rel_res_change_tol,...
verbosity,saveiterates)
% maximun number of iteration
opts.maxit = maxit;%5000;
% Tolerance on the relative l_2 error
% on the sampling set Omega (i.e., residual)
opts.rel_res_tol = rel_res_tol;%1e-5;
% Tolerance for detection of stagnation. ... |
clear all;
j = 0;
volt = 0:0.003:3.3;
for i= 0.0:0.003:3.3;
file_name=['./measures/DC_FullTest/offset_' num2str(i) '.mat'];
%file_name=['/home/ariel/git/vhdl-adc/Testing/measures/DCv2/offset_' num2str(i) '.mat'];
m = load(file_name);
j=j+1;
lin(j) = median(m.measures);
v(j) = mad(m.measures);
... |
function [rho, self_t, log_like, fm, T, rho_er, v, v_er, ...
initial_dist, mean_pause, mean_inchunk, ...
mean_pause_er, mean_inchunk_er, ...
chunks, cor_chunks, gamma] = ...
chunk_hmm_learn_param(mt_seq, er_seq, varargin)
% function [rho, self_t, log_like, fm, T, rho_er, v, v_er, ...
% initial_dist,... |
function [ result ] = UsedInCol( a,col,i )
for row = 1:9
if a(row,col)==i
result = true;
return;
end
end
result = false;
return;
end
|
function gaussPeakFit_1p()
% gaussPeakFit_1p fits a gaussian curve to the data provided. Only one peak
% must be present.
%
% Gaussian function:
% f(x) = a * exp( -(x-b)^2 / (2*c^2) ) where,
% a is the max height of the peak,
% b is the position of the center of the peak (mean), and
% c controls the width of ... |
% sayac = 0
a.pinMode(2,'output');
a.pinMode(11,'output');
a.pinMode(13, 'output');
a.digitalWrite(13, 1);
while(1)
sayac = sayac + 1;
int siddet;
siddet = 140;
a.analogWrite(9, siddet);
if mod(sayac,2) == 0
liste(sayac) = siddet / 10
else
liste(sayac) = -1... |
function gauss=GaussMask2D(sigma,fSze,cent,cnorm,absCenter)
% GaussMask2D create a gaussian 2D mask
%
% SYNOPSIS gauss =GaussMask3D(sigma,fSze,cent,cnorm,absCenter);
%
% INPUT: sigma of gauss mask [sigmaX sigmaY] or [sigma].
% If scalar, sigma will be the same for all dimensions
% fSz... |
function initPawMask = find_initPawMask_tattooPaw( video, BGimg_ud, sr_ratInfo, session_mp, boxCalibration, boxRegions, triggerTime, varargin )
h = video.Height;
w = video.Width;
maxFrontPanelSep = 20;
pawHSVrange = [1 .1 .5 1.5 .98 1.5]; %this is to pick of red from the image
targetMean = [0.5,0.2,0.5
... |
% This script is to generate the catalogue for the proposed idea to prevent
clear all;
clc;
%% Initialize camera parameter
img_height = 1024;
img_width = 1024;
pixelsize= 13.3/1024;
FOV =15;
angle = 45;
test = 0;
% Max_N = 15;
file_path='..\simulate\SKY2000_Magnitude6_doublestars_0.12.txt';
[SKYMAP_No... |
function [latents] = LCM_sim(alpha,beta,data,opts)
% Simple simulation of data under the latent cause model.
%
% USAGE: [lik, latents] = LCM_sim(alpha,beta,data,[opts])
%
% INPUTS:
% alpha - concentration parameter
% beta - scaling parameter parameter mapping model CR to output CR
... |
classdef GlobalOptimization
methods(Static=true)
function [objMin, xBest, otherReturnValsBest] = exhaustiveSearchScalarFn(domain, objFn, bOtherReturnVals)
% For documentation, see DescentMethods.
objMin = +Inf;
if(~exist('bOtherReturnVals'))
bOtherReturnVals = false;
end
otherReturnValsBest... |
function rmdir2(dir, varargin)
% A version of rmdir that raises errors on failure
fancyclip.internal.util.rmdir2(dir, varargin{:});
end |
function cmd_inspect(args)
% Got to fix the *.fits bug here.
Fits = FITS(args.fileName{1});
mtalk('\n ');
mtalk([num2str(length(Fits)),' FITS files to inspect...\n\n']);
mtalk('[NAME|MEAN|MEDIAN|STD]\n\n');
for Fit = Fits
mtalk([Fit.FileObject.Name,'\t\t',num2str(Fit.PrimaryImageMean),'\t',num2str(Fit.Primary... |
function [x, P] = nonLinKFupdate_HA_4(x, P, y, s, h, R, SP_func, type)
%nonLinKFupdate_HA_4(x_temp, P_temp, Y(:,k), S, h, R, SP_func, type);
%NONLINKFUPDATE calculates mean and covariance of predicted state
% density using a non-linear Gaussian model.
%
%Input:
% x [n x 1] Prior mean
% P [n x ... |
%ÖZGÜR KAN
%15011702
%13.05.2020
%Benim yazdığım Variance Fonksiyonu
function [V] = myVarianceFunction(incomingSamples)
sum2=0;
M=myMeanFunction(incomingSamples);
for i=1:length(incomingSamples)
sum2=sum2+ power((incomingSamples(i)-M),2);
end
V=sum2/length(incomingSamples); %Vara... |
function ManageListsAuxLoadsFigControl(option1,option2,option3);
% function ManageListsAuxLoadsFigControl(option1,option2,option3);
% This function controls the ManageListFig.fig
global vinf % need for vinf.tmppath
if isempty(findobj('tag','ManageList'))
LoadName=option1;
ListDir=option2;
CurrentL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.