text stringlengths 8 6.12M |
|---|
%% fn_savemesh
%% Syntax
% fn_savemesh(filename,vertex,faces)
% fn_savemesh(vertex,faces)
% fn_savemesh(filename,{vertex,faces})
% fn_savemesh({vertex,faces})
%% Source
% Thomas Deneux
%
% Copyright 2005-2012
%
|
clc; clear all; close all;
imaqreset;
imaqhwinfo
thetaLeft = 0
depthVid = videoinput('kinect',2)
triggerconfig(depthVid,'manual');
depthVid.FramesPerTrigger = 1;
depthVid.TriggerRepeat = inf;
set(getselectedsource(depthVid),'TrackingMode','Skeleton');
CameraElevationAngle = 0
viewer= vision.DeployableVideoPlayer();
... |
classdef State < handle
methods
function clear(obj)
obj.package = [];
obj.datarcd.init();
end
end
methods
function obj = State(n)
if not(exist('n', 'var'))
obj.datarcd = Queue('capacity', 1, '-dropold');
else
... |
% Author: Yuan SUN
% Email: yuan.sun@rmit.edu.au
% suiyuanpku@gmail.com
%
% ------------
% Description:
% ------------
% INTERACT - This fncction is used to identify the
% interaction between two sets of decision variables.
% feval(fnc,x_prime,caseStudyData, otherParameters);
% Author: Yuan SUN
% Email: yuan.... |
A=0.5; B=0.5; C=2; D=2;
c=1;
a=1;
m=2; n=3;
alpha=zeros(5,5);
alpha(1,:) = [2.4048 5.5201 8.6537 11.7915 14.9309];
alpha(2,:) = [3.8317 7.0156 10.1735 13.3237 16.4706];
alpha(3,:) = [5.1356 8.4172 11.6198 14.7960 17.9598];
alpha(4,:) = [6.3802 9.7610 13.0152 16.2235 19.4094];
alpha(5,:) = [8.7715 12.3386 15.7002 18.98... |
%fprintf('\nTime = %f, iteration: %i\n',t,outerCorr)
if outerCorr <= 1
fprintf('===============================================================================\n')
fprintf(' TIME-STEP NUMBER = %i, FLOW TIME = %f\n',i_t-1,t)
fprintf('---------------------------------------------------------------------------... |
clear
mph2fps = 1.47;
fps2mph = 1/mph2fps;
g = 32.2; % fps2
dt = 0.01; % sec
t_start = 0;
t_stop = 20; % sec
tvec = (0:dt:t_stop-dt)';
n = round((t_stop - t_start)/dt);
%% Ego Vehicle
% intial condition
V0 = 40*mph2fps;
chi0 = 0;
N0 = 0;
E0 = 0;
% control law
Kp_N = 1;
Ki_N = 0;
Kp_E = 1;
Ki_E = 0;
intg_Ki_N = V... |
function [sol] = hsvHistogram(path_to_image, count_bins)
% path_to_image = calea catre imagine
% count_bins = numarul de valori pentru axa orizontala a histogramei
% sol = histograma imaginii in format hsv
% Se citeste matricea imaginii
im = imread(path_to_image);
% Se face conversia imaginii din format rgb in forma... |
function out=fitness_fucn(x)
%%
val = sum(sum(x))/numel(x);
out=val;
end |
function [ mesh ] = makeMesh( v, f, n, u, options )
%[ mesh ] = makeMesh( v, f, n, u )
% initialize mesh data structure from vertex/face/normal/uv-arrays
%
% mesh.v = Nx3 list of vertices
% mesh.n = Nx3 list of vertex normals
% mesh.u = Nx2 list of vertex uv's
% mesh.f = Mx3 list of triangles
% mesh.fn = Mx3 li... |
clc;clear;
% cepath='/Users/baoyangming/Dropbox/gsefm/2015SoSe/Computational Economics/Applied Computational Economics and Finance/compecon/';
% path([cepath 'cetools;' cepath 'cedemos'],path);
% Set domain of interpolation
a = -1;
b = 1;
%% using Chebychev polynomials for n equidistant nodes.
% for some large ... |
function [mask] = removeSkin(RGB)
mask = ones(size(RGB,1),size(RGB,2));
for i = 1:size(RGB,1)
for j = 1:size(RGB,2)
RGBp = reshape(RGB(i,j,:),3,1);
[Cg,Cr] = ycgcrRotated(RGBp);
if(Cg <= 140 && Cg >=125) && (Cr <=217 && Cr >=136)
mask(i,j) = 0;
end
... |
function [path_array, cost] = greedy_algorithm_TSP_all(A,point)
% Author: Joseph Field
% Date: December 2016.
%
% Description:
% This is the same as the greedy algorithm, but uses a specific
% starting point. This algorithm is used to check the greedy algorithm
% for all possi... |
function network = gd_train( X, network, learning_rate, convergence,...
num_of_classes, error_check_iter )
% network = gd_train( X, network, learning_rate, convergence, num_of_classes,
% error_check_iter )
%
We1=network.We1;
S1=network.S1;
theta1=network.theta1;
T1=network.T1;
We2=network.We2;
S... |
%automate simulations and solve for coefficients yielding best results
%stop simulation command:
%set_param(gcs, 'SimulationCommand', 'stop')
%prevent warnings from showing in command window
warning('off','all');
%Set up sim values
addpath('M_Files/Sim_Setup');
run('AWD_Test_W_FUZ_Control.m');
%add paths for sim fil... |
function writeFile(fn, content)
fid = fopen(fn, 'w');
fprintf(fid, content);
fclose(fid); |
dispersions = load ("Dispersion_Values.txt");
display(dispersions)
plot(dispersions)
|
function dq = secondorder(t,q)
% Creates the second order equation for the state space representation of
% the ode
global m c k
% states equation
% dq(1)=q(2);
% dq(2)=1/m*(-k*q(1)-c*q(2));
A = [ 0 1; -k/m -c/m];
B = [ 0; 1/m];
u = function1(t);
dq = A*q + B*u;
end |
function [pi_s, i] = findStationnaryPi(Q, pi_0, tol, max_iter)
%findStationnaryPi compute the stationnary distribution for a transition
%matrix starting with a given ditribution
% [pi_s, i] = findStationnaryPi(Q, pi_0) : if Q is a transition matrix
% and pi_0 the starting distribution, then pi_s is the sationnary
%... |
function [ output_args ] = fun1_bodelc
num=[4 0];
den=[5 1];
[num2,den2]=cloop(num,den);
H=tf(num2,den2);
bode(H);
grid on;
end
|
clear all; home;
% define the data set folder
dataSetFolder = '../../data/set-1/tilt-around-z-pointing-up';
%% Load the data
[accelerometer, gyroscope, magnetometer, temperature] = loadData(dataSetFolder);
%% Plot data
figureHandle = figure('Name', 'Raw sensor data', ...
'NumberTitle', 'off', ...
'Color', [0... |
function uc=restriction_fortran(u,hzc,icl3,X,params);
% call fortran version
% get coarse size
n=size(X{1});
[icl1,icl2]=hzc2icl(hzc,n);
nc = [length(icl1),length(icl2),length(icl3)];
%Writing all arrays to text files for use by fortran tester
uc = rand(nc); ! for sizes only
write_array(swap23(uc),'uc');
write_arra... |
function MatingPool = MatingSelection(PopObj,N,div)
% The mating selection of PESA-II
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEMO for research purposes. All publications which use this
% platform... |
function success = uq_Reliability_test_subsetsim_inout(level)
% SUCCESS = UQ_RELIABILITY_TEST_SUBSETSIM_INOUT(LEVEL):
% Test function to check whether the input arguments are correctly
% passed to the output structure on a simple R-S example
%
% See also UQ_SELFTEST_UQ_RELIABILITY
%% Start test:
uqlab('-nospla... |
function c = d2b(n,m)
% function c = d2b(n,m)
% convert n to an m-bit binary representation
% Copyright 2004 by Todd K. Moon
% Permission is granted to use this program/data
% for educational/research only
mask = 1;
c = zeros(1,m);
for i=1:m
if(bitand(mask,n))
c(i) = 1;
end
mask = mask*2;
end
|
function ax = golgi(neuron, varargin)
% GOLGI
%
% Description:
% Plot a neuron in a golgi-like flatmount
%
% Syntax:
% ax = golgi(neuron, ax)
%
% Inputs:
% neuron Neuron object
% Optional key/value inputs:
% Ax Handle to existing axes (default = new ... |
classdef JointGaussInfEng < InfEng
properties
diagnostics;
end
properties(Access = 'protected')
mu; % let d = numel(domain) mu,Sigma are always of sizes [1,d] and [d,d] respectively -
Sigma; % vis values are plugged into mu, and Sigma entries set to 0 after calls to en... |
function msk = draw3dmask(img);
% function msk = draw3dmask(img);
% free hands a binary mask for a 3D data set one slice at at time
msk = zeros(size(img));
for sl=1:size(img,3)
imagesc(img(:,:,sl));
axis xy
title(sprintf('Slice %d out of %d', sl, size(img,3)));
h=imfreehand();
tmp=createMask(h);
... |
% Argument projection
function [t_proj] = proj(net, t)
t_proj = t;
for i = 1:size(t,1)
if t(i) < net(i,3)
t_proj(i) = net(i,3);
end
end
end |
function [vPrime] = getNewVelocityVector(side, circle) % Fonction pour définir le nouveau vecteur vitesse du cercle effectuant la collision
% Récupération de la pente de la droite et de son ordonnée à l'origine
[m, p] = getSlopeAndP(side);
% Calcul du nouveau vecteur vitesse V'
% Si la droite est verticale
if isnan(m)
... |
function varargout = templateviewer(varargin)
% TEMPLATEVIEWER MATLAB code for templateviewer.fig
% TEMPLATEVIEWER, by itself, creates a new TEMPLATEVIEWER or raises the existing
% singleton*.
%
% H = TEMPLATEVIEWER returns the handle to a new TEMPLATEVIEWER or the handle to
% the existing singleton... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
% calculate_rotation_correction
% Marie Moltubakk 17.6.2013
% Read complete, prepared noraon array + prepared us array
% Produce correction for calcaneus displacement due to ankle rotation
%%%%%%%%%%%%%%%%%%%%%%%%%%
function at_rotation_const = calculate_rotation_correction(noraxon_ro... |
clear;
clc;
load original_image1_hash; % load the hash of the first image
hash1=hash;
load original_image4_hash; % load the hash of the second image
hash2=hash;
% get the hash length
hash_length=length(hash1);
% calculate the normalised manhattan distance
distance=mandist(hash1,hash2')/hash_length;
if distance<0.20,
... |
function printQueryReportMsg_MagLightTrail(address, message, connectionName)
global APPS;
if ((isfield(APPS,'MAGLIGHT') && APPS.MAGLIGHT.rptMsgFlag && message.type == APPS.MAGLIGHT.QUERYMSG)
disp(message)
end |
clear all
close all
dx=.75e-6;dy=.75e-6;
length=25e-6; breadth=25e-6;
N=round(length/dx);M=round(breadth/dy);
R_core=5e-6;
x=(1:N)*dx;
y=(1:M)*dy;
a=dx^-2;b=dy^-2;
lambda=1.550e-6;
k=2*pi/lambda;
n0=1.4038;
p0=k^2*n0^2-2*a;
n1=1.46;
p1=k^2*n1^2-2*a;
A=zeros(N*M);
for i=1:N*M
A(i,i)=p0;
end
for j=1:(M-1)
... |
function [events] = EventsLimits(raster,events,convraster)
% This is the first pass function which takes the raster as an input, then generates
% thresholds and a sliding psth, and will then find the initial event bounderies.
%%%%%%%% Obtain the sliding PSTH %%%%%%%%%%
[PSTH,PSTHBins] = slidingHist(convraster,events.Sl... |
%% Opdracht 5
% Maak een vector genaamd 'tijdas' aan.
% Zorg dat de vector wordt gevuld met de tijd van 0 tot en met 60 seconden.
% Zorg dat de vector met tijdstappen van 0.1 seconde wordt gevuld.
% VB: 0, 0.1, 0.2, 0.3 ...
|
function I7 = mycut(image,rot_theta)
% [filename,pathname]=uigetfile({'plate4.jpg','car1'});
% Filename = [pathname filename];
% image = imread(Filename);
% T = rbg2hsv(image);
% T
I = rgb2gray(image);
I2 = imbinarize(I);
% [x,y] = size(I1);
figure(1)
imshow(I2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function DisFeature = AutEquDisc(Feature)
%=========================================================================%
% 自适应等间隔区间离散化 %
%=========================================================================%
% Description:
% 等间隔离散化的间隔宽度是根据出现值的种类数来确定
%----------... |
close all;
clear all;
clc;
%======================= Data Entry ======================
[y,fs,bits]=wavread('Track 1_005.wav');
NFFT=256;
%====== wideband (More Window Length, Less Overlap) =========
wideHamm=Hamming(NFFT);
wideOverlap=NFFT/16;
%====== narrowband (Less Window Length, More Overlap) ======... |
% function [r2p, dbv, oef, dhb] = ase_qbold_3d(nii_name)
% nii_name: Z-averaged ASE dataset
% start_tau [ms] value of tau for first volume
% delta_tau [ms] tau step size
% set end_tau [ms] ... value of tau for last volume
% nii_out ... output nifti's and save figs? 1=Yes,0=No
clear;
start_tau = -8;
delta_tau = 8;
e... |
clear
close all
%% Parameters
Fs = 10e6; % Sample rate (Hz)
channel_width = 2e6;
freqsep = channel_width/4;
nsamp = Fs/1e6; % Number of samples per symbol
num_syms = 1000;
num_bins = 500;
preamble = [1,0,1,1,0,1,1,1,0];
save gfsk_Parameters.mat
save tools/gfsk_parameters.mat
%% Data
x = zeros(1, num_syms);
for ... |
% projections = projections_from_matrix(W)
%
% W -- 2F x P
% projections -- 2 x P x F
function projections = projections_from_matrix(W)
F = size(W, 1) / 2;
P = size(W, 2);
% [2F, P] -> [2, F, P] -> [2, P, F]
projections = permute(reshape(W, [2, F, P]), [1, 3, 2]);
end
|
function [] = getslicextpsignal_batch%(subj)
% getslicextpsignal_batch
% batches getslicextpsignal to run on multiple subs using multiple masks
%throwaway = subj;
%addpath(genpath(['/Users/vacarr/Desktop/MCI/mciExpt/scripts/kendrick/']));
%Study name
S.exp_name = 'Circmaze'; %change this to flexibly redirect the script... |
function [y, t] = rtrcpuls(a,tau,fs,span)
% This function is a modified version of the one given in the text, Program 2.2-2
% a: Roll off/ Excess bandwidth factor
% tau: Symbol time
% fs: sampling frequency at which the continuous pulse is sampled
% span: Defines width for truncation. Number of tau periods on either s... |
function [X,i] = jacobi(A,B,P,tol,maxi)
% Input - A is an N x N nonsingular matrix
% - B is an N x 1 matrix
% - P is an N x 1 matrix; the initial guess
% - tol is the tolerance for P
% - maxi is the maximum number of iterations allowed
% Output - X is an N x 1 matrix: the jacobi appro... |
function [DRMb,ladB]=Realoptical(Pt,Dt,lambda,Dr,L,gamma,No,Np,la,Nr,s)
%powerdB
PtdB=10*log10(Pt*1000);
%transmitter gain
Gt=10*log10((pi*Dt./lambda).^2); %db
%tranmitter optics efficiency
if No<=0
NodB=0;
else
NodB=10*log10(No);
end
%transmitter pointing efficiency db
if Np<=0
NpdB=... |
close all
clear all
addpath('..\src\Libraries\LAPTracker');
addpath('..\src\Libraries\Utils');
addpath('..\src\Libraries\DensityEstimation');
addpath('..\src\Libraries\DensityEstimation');
addpath('..\src\Libraries\TrajectoryAnalysis');
addpath('..\src');
org_color=[0 0 1];
rd_color=[0 0 0];
colormap = [org_color; rd_c... |
%%
% NOTE: This script was used to setup the unittests for flexible beam in Python
clear all; close all; clc;
format short;
addpath('../');
nShapes_bld=3;
nSpan_bld=30;
L_bld = 60 ; EI_bld = 2E+10; m_bld = 5E+2 ;
GKt_bld=7e11; % [Nm2]
jxx_bld=1e5; % [kg.m]
% --- Test 1 - Straight beam
Bld=fCreateBodyUniformBeam(... |
function [ ordered_channel_list_chans_rmvd, varargout ] = removeEEGchannels( ordered_channel_list, chans_to_remove, varargin )
%REMOVEEEGCHANNELS Summary of this function goes here
% Detailed explanation goes here
%% Optional Input Arguments
OIAflag = 0; % initialize optional input argument (OIA) flag
varargou... |
function [gatingGroup,gating_mb] = group_gating(z,x,P,model)
idx_in = [];
zlength = size(z,2);
plength = size(x,2);
tentativeGroup = cell(plength,1);
for j=1:plength
Sj = model.H*P(:,:,j)*model.H' + model.R;
nu = z - model.H*repmat(x(:,j),[1 zlength]);
dist = diag(nu'*pinv(Sj)*nu);
idx_in= union(idx_i... |
% generate a high frequency AR coefficient
% G is coefficient without the leading "one"
% de is corresponding variance so that variance
% of x is 1.0
% r is the absolute value of the roots
% f is the frequency, rangre: -0.5~0.5
% e.g.
% [G, de] = gen_hfreq_coef(0.9, 0.05);
% plot(real(squeeze(A2S(G, de, 1024)))... |
function [ xp ] = projection( x )
%PROJECTION Summary of this function goes here
% Detailed explanation goes here
r = norm(x(1:2));
scale = 0;
if r>1
scale = 1/r;
else
scale = 1.0;
end
x(1:2)=x(1:2)*scale;
xp=x;
end
|
De onderstaande code wordt niet correct uitgevoerd omdat
de variabele z nog niet is gedefinieerd als de je in de
for-lus komt.
======= Code =======
clc
clear variables
for nHerhaling = 1:10
z(nHerhaling+1) = z(nHerhaling);
end
======= Code ======= |
%% generate random weights for a network with a given architecute
%% Here, we follow an advice on effective choice of initial parameters
%% and choose then from the interval (-eps_s, eps_s), where eps depends on the
%% number of units in layers s and s+1: eps_s = sqrt(6/(L_s + L_{s+1})).
%% Returns:
%% weights - unfold... |
function [ac_X ac_Y ac_Z ac_T ac_R ac_S ac_c ] = ...
dijkstra_clusterMeta(str_target, varargin)
%
% NAME
%
% function [ac_X ac_Y ac_Z ac_T ac_R ac_S ac_c ] = ...
% dijkstra_clusterMeta(str_target [, ...
% <distanceMetric>, ...
% <linkageMetric>, ...
% <cutOff>, ...
% <crite... |
function [E, R, FC] = Range(W_ini, rho, V, S, C_Dmin, c_t, AR, W_fin, e)
% This function can be used to give the Range, Endurance and Fuel
% Consumption for the aircraft, only in the Cruise phase.
% The INPUTS are: (ALL SI UNITS)
% W_ini is the weight of aircraft at start of cruise phase in Newtons
% rho is t... |
function Get_Trial_Averages_orientation
%%%%%%%%%%%%%%%%%%%%
% Get traial averages for each stimulus
% Do I need over-sampling?
%
% s_ave :: trial average
% s_each :: peak values for each trial
% imgobj.dFF_s_mean :: mean values from dFF_s_each
%
% Separate plot part (180406)
% To modulate each roi, add, specifying roi... |
% -----------------------------------------------
% --- PD_Recognition.m
% --- Partial Discharge Recognition Tool
% -----------------------------------------------
% --- Authors: Thomas J. smith & David Mahmoodi
% --- University of Southampton
% --- School of Electronics and Computer Science
% --- ELEC6089 High Voltage... |
function net = sparseNet_stl10_init(varargin)
opts.networkType = 'simplenn' ;
opts.batchSize = 128;
opts = vl_argparse(opts, varargin) ;
% Define network CIFAR10-quick
net.layers = {} ;
n = 1;
blockfn = @insertSCBlock ;
K = 4;
Kd = 1;
net = blockfn(net, 3, 3, 16, 1,1);
net = blockfn(net, 3, 16, 16*K, 1,1);
for... |
function hexagi_behaviour_LMShift_MemoryBias(Subjects,StatsPath,FigPath)
% Correlate LM Shift (angular difference of the vectors drop locations to
% the true location, and the vector of the true location to the landmark)
% from the test phase with memory bias (doeller 2008) from the transfer
% phase.
if na... |
function sequential(x,train_label,x_te,test_label)
model=[];
test_model=[];
xrr=[];
yrr=[];
testxrr=[];
testyrr=[];
warning('off','all');
for i=1:10
max=0;
for j=1:size(x,2)
temp=[];
temp=[model x(:,j)];
model1 = glmfit(temp,train_label... |
function centroids = newCentroids(X, idx, K)
[m n] = size(X);
centroids = zeros(K,n);
for i = 1:K,
centroids(i,:) = sum(X(idx==i,:))/length(X(idx==i,:));
end
end |
%% problem description
%
% min int f(x,y) dxdy
% f X*Y
%
% s.t. f(x,y) >= -1 for all (x,y) \in X*Y
% f(c,.) >= +1 for all y \in Y
%
%% user parameters
degree = 12 ;
c = 0 ;
%% SPOTLESS PROBLEM
% variables
x = msspoly('x',1) ;
y = msspoly('y',1) ;
% create program
prog = spotsospro... |
function [data]=peiceWiseGraph(PeakTime,Peaks,Time,SS)
Slopes(1,1)=Peaks(1,1)/PeakTime(1,1);
for i=2:size(Peaks)
Slopes(i,1)=(Peaks(i,1)-Peaks(i-1,1))/(PeakTime(i,1)-PeakTime(i-1,1));
end
Slopes
for i=1:size(Time)
if(Time(i,1)<PeakTime(1,1))
data(i,1)=Slopes(1,1)*Time(i,1);
elseif(Time(i,1)<PeakTime(size(PeakT... |
function xdata = reverse_normal(x, xmin, xmax)
% need original min and max values for it to work
% x = xi * (xmax - xmin) + xmin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% x = normalised data
% xmax = original max value & xmin = original min value
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xdata = x * (xmax - xmin) + xm... |
function[NC]=generate_nc(sig2,w,Rat,iii)
f_signal=sig2{2*w-1};
%Amplitude normalization
%f_signal=median(f_signal);
[NC]=epocher(f_signal,2);
% av=mean(NC,1);
% av=artifacts(av,10);
% %Limits artifacts to a maximum of 10
% if sum(av)>=10
% av=artifacts(av,20);
% end
% av=not(av);
% %Removing artifacts.
% NC=NC(:,... |
function Func_ShowText(axes,Message)
delete(get(axes,'Child'));
text(0.5, 0.5,Message, ...
'HorizontalAlignment', 'center', ...
'Parent',axes,...
'FontUnits', 'Normalized', ...
'FontSize', 0.7 );
end |
function varargout = crosstabG(E,O, varargin)
opt.computemarginal = true;
opt.computeindividual = true;
opt.rownames = {};
opt.colnames = {};
opt.showtable = false;
opt.adjustexpected = false;
opt.showresiduals = false;
sz = size(E);
if ((nargin == 1) || ~isnumeric(O) || any(size(O) ~= sz))
if (nargin >= 2)
... |
% example_KMPC.m
% This script identifies a linear Koopman model from data, constructs an
% MPC controller, and simulates the performance of the controller on a
% trajectory following task.
%
% The file "/datafiles/softrobot_train-13_val-4.mat" contains the data
% used to train the soft robot model in t... |
function Frhs = f_n_state_AME_vector(t, x, Fvec, Rvec, al_pk, al, al_plus1, k_dim, a_dim, n, non_null_lin_indices, index_shift, index_removal)
% Version2: Instead of working with a state tensor have a vector.
x = reshape(x,[],n);
% NODE TRANSITIONS
node_transitions_out = Rvec.*x;
x_rep = repmat(x, [1 1 n])... |
% State Space Representation
Jt = Jr*Jp + Mp*(Lp/2)^2*Jr + Jp*Mp*Lr^2;
A = [0 0 1 0;
0 0 0 1;
0 Mp^2*(Lp/2)^2*Lr*g/Jt -Dr*(Jp+Mp*(Lp/2)^2)/Jt -Mp*(Lp/2)*Lr*Dp/Jt;
0 Mp*g*(Lp/2)*(Jr+Mp*Lr^2)/Jt -Mp*(Lp/2)*Lr*Dr/Jt -Dp*(Jr+Mp*Lr^2)/Jt];
B = [0; 0; (Jp+Mp*(Lp/2)^2)/Jt; Mp*(Lp/2)*Lr/Jt];
C = eye(2,4);
D = z... |
% Solucion del problema de minimos cuadrados con la factorizacion QR.
function [x] = MinimosCuadradosLineal(A, b)
% Suponer que el rango de la matriz A es el numero de columnas.
% Obtener las dimensiones de la matriz A.
[m,n]=size(A);
% Obtener la factorizacion QR de A.
[Q,R]=qr(A);
% Calcular R... |
function varargout = Gauss_pivote_gui(varargin)
% GAUSS_PIVOTE_GUI MATLAB code for Gauss_pivote_gui.fig
% GAUSS_PIVOTE_GUI, by itself, creates a new GAUSS_PIVOTE_GUI or raises the existing
% singleton*.
%
% H = GAUSS_PIVOTE_GUI returns the handle to a new GAUSS_PIVOTE_GUI or the handle to
% ... |
%ARIA: display of results
%Input: Ab - set of antibodies (Nxdim)
% Ag - set of antigens (Mxdim)
% R - radius of each antibody
%OBS: dim must be equal to 1 or 2
function ai_plot(Ab,Ag)
%extract dimensions of Ab
[N,dim] = size(Ab);
%extract number of antigens
M = length(Ag(:,1));
%check if data ... |
function pheromoneLevel = InitializePheromoneLevels(numberOfCities, tau0)
pheromoneLevel = zeros(numberOfCities);
pheromoneLevel(:) = tau0;
end
|
clear; clc; setup; config_re_csi;
%% ! R-E region vs CSIT error
reRandomSample = cell(nChannels, length(Variable.nReflectors));
reErrorSample = cell(nChannels, length(Variable.nReflectors), length(Variable.cascadedErrorVariance));
reRandomSolution = cell(nChannels, length(Variable.nReflectors));
reErrorSolution = cel... |
function [] = AWB(image1)
%AWV applies color correction to an RGB image by using Grey-World algorithm.
%plots the original image and the color corrected one on the same figure.
original = imread(image1);
m1 = mean2(original(:,:,1));
m2 = mean2(original(:,:,2));
m3 = mean2(original(:,:,3));
corrected1 = original(:,:,1... |
function [n_im, ii_im] = LoadImage(im_fname)
im = double(imread(im_fname));
mu = mean(im(:));
sd = std(im(:));
n_im = (im - mu) / sd;
ii_im = cumsum(cumsum(n_im, 2));
end
|
%calculate Magnitude of Completeness %
%Maximum curvature estimation %
%Goodness of Fit (90%-95%) [Wiemer and Wyss,2000] %
%Input : Catalog data %
%Format: y... |
classdef nndropout < nntest
methods (Test)
function basic(test)
x = test.randn(4,5,10,3) ;
[y,mask] = vl_nndropout(x) ;
dzdy = test.randn(size(y)) ;
dzdx = vl_nndropout(x,dzdy,'mask',mask) ;
test.der(@(x) vl_nndropout(x,'mask',mask), x, dzdy, dzdx, 1e-3*test.range) ;
end
end
en... |
function qnew = qupdate(q, vel, dt)
% qnew = qupdate(q, vel, dt) returns the new configuration due to the
% robot moving at velocity vel (as above) for a period of dt. You will
% convert the velocity vel to the robot's configuration rate q and
% integrate using rectangular integration over the time s... |
close all; clear all; clc;
load('RegressionData.mat');
% X = matrix with (d + 1) * N
% Y = matrix with 1 * N
n = 0.5; % step size
[D N] = size(X);
% W_log = zeros(D, 1);
W_log = pinv(X') * Y';
M = 5; % The number of Datasets we get from one time
for t = 1:8000
r = randperm(N, M);
for i = 1:M
% Vi... |
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/AMIGO_blackbox_smooth_simulation.m 2034 2015-08-24 11:54:26Z attila $
% AMIGO_blackbox_smooth_simulation: Smooth solution of the black box models
%
%******************************************************************************
% AMIGO2: dynamic modeling, optimization and c... |
function noise(coverImageGrayScale,CoverImageGrayScaleTemp,watermarkBinary,str)
if strcmp(str,'salt & pepper')
coverImageGrayScale = imnoise(coverImageGrayScale,str,0.01);
else
coverImageGrayScale = imnoise(coverImageGrayScale,str,1,0.1);
end
show(coverImageGrayScale,CoverImageGrayScaleTemp,watermarkB... |
%%
addpath .\201783107_HW1
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
% 读取全部数据
datas = [];
for label = 1:3
filename = ['data', num2str(label), '.txt'];
%fprintf('%s',filename)
file = load(filename);
x1 = file(:, 1);
x2 = file(:, 2);
... |
close all;
clear all;
clc;
%% Create the obstacles for the first scenario
Rec1 = [1,1,1,4];
Rec2 = [3,4,1,8];
Rec3 = [6,5,6,1];
Rec4 = [12,5,1,8];
Rec5 = [3,12,9,1];
PathCoords = importdata("Bug1PathFile.txt");
PathCoords2 = importdata("Bug2PathFile.txt");
figure(1)
hold on
rectangle('Position',Rec1, 'FaceColor', [0,... |
function params = fit4Gaussian(data,symmetric,threshold)
% Fit a Gaussian to each data channel and return parameters as matrix
% Newly added feature to choose whether we fit a symmetric or
% thresholded Gaussian
% Output: a, x0, y0, sx, sy, threshold
if nargin < 2
symmetric = 0;
... |
function [ mbd ] = spherical_mirror_aberr( fn, D )
%SPHERICAL_MIRROR_ABERR Summary of this function goes here
% Detailed explanation goes here
delta_x = 0.01;
x = 0:delta_x:D/2;
f = fn*D;
theta = asin(x/(2*f));
d = 2*f*tan(2*theta).*(1./cos(theta)-1);
mbd = 8 * delta_x/D^2 * sum(x.*d);
end
|
function [x,flag,relres,iter,resvec] = pcg_1(A,b,tol,maxit,M1,M2,x0,varargin)
%PCG Preconditioned Conjugate Gradients Method.
% X = PCG(A,B) attempts to solve the system of linear equations A*X=B for
% X. The N-by-N coefficient matrix A must be symmetric and positive
% definite and the right hand side column ve... |
% function Formation
% 画出编队运动轨迹图像
% 作者:李欣
% 单位:上海海事大学水下机器人实验室
% 2018-10-30
% Shanghai, China
clear all;
close all;
xmin = [0; 0];
xmax = [50;50];
Step = 30;
%%%%%%%%%%%%%%%%%%%%%
%设置机器人的参数%
%%%%%%%%%%%%%%%%%%%%%
Dmin = 1;
count = 0;
Target=[19 20; 14 16.2; 9 12; 15 8.9; 21 6; 20 13]'-2;
Robot = [19 15 10 16 23... |
function [minutes,runnumbers]=readTime(thepath)
if thepath(end)=='/'
thepath=thepath(1:end-1);
end
lista = dir(thepath);
errfiles=lista([]);
minutes=[];
runnumbers=[];
eind=0;
for ind=1:length(lista)
if length(lista(ind).name) > 5
if lista(ind).name(1:4)=='err.'
eind=eind+1;
runnumbers(eind,1)=st... |
function fdets = PruneDetections(dets)
nd = size(dets, 1);
D = zeros(nd, nd);
p = 0.82;
for i=1:nd
for j=i+1:nd
A = dets(i, 3) * dets(i, 4);
B = dets(j, 3) * dets(j, 4);
intersection = rectint(dets(i, :), dets(j, :));
D(i, j) = (intersection / (A + B - intersection)) > p;
D(... |
% tab:4
%
%
% "Copyright (c) 2000-2002 The Regents of the University of California.
% All rights reserved.
%
% Permission to use, copy, modify, and distribute this software and its
% documentation for any purpose, without fee, and without written agreement is
% hereby granted, provided that the above copyrig... |
clear all;
close all;
folderName = 'LH'; %Usually this is the subject ID
expIdx = 'LH_EXP_'; %The initial of the experiment data file
readSacInfo = 1; %Use the eye-tracking timing from eyelink
readStim = 1;
selectIdx = ':'; %Analyze a subset of files
getAllInfo;
fcIdx = prefc =... |
[images, eyesPos, looksInfo] = readData(path, dimensions);
[trainset, testset] = splitData(images, eyesPos, looksInfo, 80);
[eyes, noEyes] = getEyes(trainset, 10, dimensions);
[looks, noLooks] = getLooks(eyes, trainset{3}, dimensions.subImgSize); |
% Lec 6.4 : Interpolation Options in MATLAB
% Speed in 1.5 minutes
t = 0:10:90;
s = [45, 32, 0, 0, 7, 12, 20, 15, 29, 55];
plot(t,s,'bo');hold on ;
% Interpolation using spline
tI = 0:90;
sI = spline(t,s,tI);
plot(tI,sI,'-k');
% % Interpolation using pchip
sI_pc = pchip(t,s,tI);
plot(tI,sI_pc,'--r'); |
function [Total_Gain,Horizontal_Polarization, Vertical_Polarization, Incident_Angle] = Reflection_Coefficient_Calculator(Freq,Ground_Distance, Height_Tx, Height_Rx,Relative_Dielectric_Constant,Conductivity,varargin )
% This function to calculate the reflection coefficient in 2-ray model
% with ground reflection... |
%% kinectplotter
%
% plot kinect skeleton
%
%% Syntax
%
% kinectplotter(KinectData)
%
% kinectplotter(KinectData,rate)
%
% kinectplotter(KinectData,keyword)
%
%% Description
% display a "video" of the recorded kinect skeleton
%
%% Examples
%
% display skeleton at default speed
%
% kinectpl... |
% Program narise Fordove kroge C(1/0), C(0/1), C(1/1):
% ulomku p/q ustreza krog z dotikaliscem v p/q
% in polmerom 1/(2q^2)
t = linspace(0,2*pi,100);
s = linspace(-0.5,1.5,1000);
% C(0/1)
x_1 = (1/2)*cos(t);
y_1 = 1/2 + (1/2)*sin(t);
% C(1,1)
x_2 = 1 + (1/2)*cos(t);
y_2 = 1/2 + (1/2)*sin(t);
% C(1/0)
x_3 = s;
y_3 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.