plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | haller-group/LCStool-master | elliptic_lcs.m | .m | LCStool-master/LCStool-1-0/elliptic_lcs.m | 1,790 | utf_8 | 9b86507cb12ec7e38fca6e4f094c0335 | % elliptic_lcs Given closed lambda lines, return elliptic LCSs
%
% SYNTAX
% ellipticLcs = elliptic_lcs(closedLambdaLine)
%
% INPUT ARGUMENTS
% closedLambdaLine: closed lambda line positions returned from
% discard_empty_closed_lambda
%
% OUTPUT ARGUMENT
% ellipticLcs: elliptic LCS position for each poincare section ove... |
github | haller-group/LCStool-master | plot_ftle.m | .m | LCStool-master/LCStool-1-0/plot_ftle.m | 583 | utf_8 | c37a837e1851ef8a094383de10344aae | % plot_ftle Plot finite-time Lyapunov exponent
%
% SYNTAX
% [hFtle,hColorbar] = plot_ftle(hAxes,flow,ftle)
%
% EXAMPLES
% To adjust FTLE range: set(hAxes,'clim',[0,.5]);
%
% To highlight NaN values:
% ftle(isnan(ftle)) = max(ftle(:));
% plot_ftle(hAxes,flow,ftle)
function [hFtle,hColorbar] = plot_ftle(hAxes,domain,res... |
github | haller-group/LCStool-master | angle_change.m | .m | LCStool-master/LCStool-1-0/angle_change.m | 1,098 | utf_8 | 61b29f2b861461b0937522d7fd5dedf8 | % angle_change Angular change of vector field between adjacent grid points.
%
% SYNTAX
% [thetaX,thetaY] = angle_change(vector)
% [thetaX,thetaY,thetaMax] = angle_change(vector)
function [thetaX,thetaY,varargout] = angle_change(vector)
% Compare x to x + DeltaX
a = vector(:,:,1:end-1);
b = vector(:,:,2:end);
normA =... |
github | haller-group/LCStool-master | integrate_flow.m | .m | LCStool-master/LCStool-1-0/integrate_flow.m | 2,893 | utf_8 | 426f0c9e2692b6e1149883034f6b92e4 | %integrate_flow Integrate flow
%
% SYNTAX
% flowSolution = integrate_flow(flow,initialPosition,useEoV)
% flowSolution = integrate_flow(flow,initialPosition,useEoV,verbose)
%
% INPUT ARGUMENTS
% initialPosition: n-by-2 array
% useEoV: true or false
% verbose: true or false
function flowSolution = integrate_flow(flow,in... |
github | haller-group/LCStool-master | eig_error.m | .m | LCStool-master/LCStool-1-0/eig_error.m | 518 | utf_8 | 4fc8fc75e07dbc9edd692f56f9d7562d | % error Error measurement of eigenvalues and eigenvectors
%
% SYNTAX
% e = eig_error(a,v,d)
%
% DESCRIPTION
% The error is defined by:
% e(i) = norm((a - d(i,i)*eye(size(a)))*v(:,i))
%
% EXAMPLE
% a = rand(4);
% [v,d] = eig(a);
% e = eig_error(a,v,d);
function EigError = eig_error(a,v,d)
function EigErrorArrayfun... |
github | haller-group/LCStool-master | plot_orient_discont.m | .m | LCStool-master/LCStool-1-0/plot_orient_discont.m | 2,196 | utf_8 | b996bbb51015deccfe06906ecb78c73a | % plot_orient_discont Plot eigenvector field orientation discontinuities
%
% SYNTAX
% hAxes = plot_orient_discont(eigenvector,domain,resolution)
% hAxes = plot_orient_discont(eigenvector,domain,resolution,angleTol)
%
% EXAMPLE
% s = load('datasets/bickley_jet/bickleyJet1.mat');
% eigenvector = [s.bickleyJet.flow.cg... |
github | haller-group/LCStool-master | lambda_line.m | .m | LCStool-master/LCStool-1-0/lambda_line.m | 1,964 | utf_8 | eb3a09740dbf95e473548721d9e637f2 | % lambda_line Null-geodesics of generalized Green-Lagrange Lorentzian
% metric
%
% SYNTAX
% [etaPos,etaNeg] = lambda_line(cgEigenvector,cgEigenvalue,lambda)
% [etaPos,etaNeg] = lambda_line(...,'forceComplexNaN',forceComplexNaN)
%
% INPUT ARGUMENTS
% forceComplexNaN: logical to control whether complex etaPos and etaNeg ... |
github | haller-group/LCStool-master | animate_flow.m | .m | LCStool-master/LCStool-1-0/animate_flow.m | 3,342 | utf_8 | ab97d80b3b97e417790220dec4bdc42b | % animate_flow Display flow animation
%
% DESCRIPTION
% flow = animate_flow(flow,animationTime,framerate,animationFilename)
% animationTime has units of seconds
% framerate has units of 1/second
%
% EXAMPLE
% addpath('flow_templates')
% doubleGyre = double_gyre;
% doubleGyre.flow = animate_flow(doubleGyre.flow);
funct... |
github | haller-group/LCStool-master | initialize_ic_grid.m | .m | LCStool-master/LCStool-1-0/initialize_ic_grid.m | 357 | utf_8 | fcbe4dd9ce80dcfd80930e939c146278 | %initialize_ic_grid Initialize initial conditions on cartesian grid
function position = initialize_ic_grid(resolution,domain)
xVector = linspace(domain(1,1),domain(1,2),resolution(1));
yVector = linspace(domain(2,1),domain(2,2),resolution(2));
[positionX,positionY] = meshgrid(xVector,yVector);
position(:,1) = positio... |
github | haller-group/LCStool-master | remove_strain_in_elliptic.m | .m | LCStool-master/LCStool-1-0/remove_strain_in_elliptic.m | 1,481 | utf_8 | 23c94c62d72416b1302fcf76aa5e5dbc | % remove_strain_in_elliptic Remove strainlines inside elliptic LCSs
function strainlinePosition = remove_strain_in_elliptic(strainlinePosition,ellipticLcs)
strainlinePositionNew = cell(size(strainlinePosition));
strainlinePositionStart = cell(size(strainlinePosition));
strainlinePositionEnd = cell(size(strainlinePosit... |
github | haller-group/LCStool-master | setup_figure.m | .m | LCStool-master/LCStool-1-0/setup_figure.m | 425 | utf_8 | d93b2722041259ad197cddeec97edaac | % setup_figure
%
% SYNTAX
% hAxes = setup_figure(flowDomain)
function hAxes = setup_figure(flowDomain)
hFigure = figure;
hAxes = axes;
set(hAxes,'parent',hFigure)
set(hAxes,'nextplot','add',...
'box','on',...
'DataAspectRatio',[1 1 1],...
'DataAspectRatioMode','Manual',...
'XGrid','on',...
'YGrid'... |
github | haller-group/LCStool-master | poincare_closed_orbit_range.m | .m | LCStool-master/LCStool-1-0/poincare_closed_orbit_range.m | 3,263 | utf_8 | 64a9e6eddac8e4e77d1f9708379e65f9 | % poincare_closed_orbit_range Find closed orbits over ranges of lambda
%
% SYNTAX
% [closedLambdaLinePos,closedLambdaLineNeg] = poincare_closed_orbit_range(domain,resolution,cgEigenvector,cgEigenvalue,lambda,poincareSection)
%
% OUTPUT ARGUMENTS
% closedLambdaLinePos: closed lambda line positions for etaPos, cell arra... |
github | haller-group/LCStool-master | ftle.m | .m | LCStool-master/LCStool-1-0/ftle.m | 137 | utf_8 | 3bfebb18b4c2950df2ab483bb98be43b | %FTLE Calculate Finite-time Lyapunov exponent
function ftle_ = ftle(max_eigenvalue,timespan)
ftle_ = .5*log(max_eigenvalue)/timespan;
|
github | haller-group/LCStool-master | plot_elliptic_lcs.m | .m | LCStool-master/LCStool-1-0/plot_elliptic_lcs.m | 431 | utf_8 | 07d3ef2f41820f081cd296896dd75431 | % plot_elliptic_lcs Plot elliptic LCSs
%
% SYNTAX
% h = plot_elliptic_lcs(hAxes,ellipticLcs)
%
% INPUT ARGUMENTS
% ellipticLcs: elliptic LCS positions returned from elliptic_lcs
function h = plot_elliptic_lcs(hAxes,ellipticLcs)
nPoincareSection = numel(ellipticLcs);
h = gobjects(1,nPoincareSection);
for iPs = 1:nPo... |
github | haller-group/LCStool-master | integrate_line.m | .m | LCStool-master/LCStool-1-0/integrate_line.m | 13,009 | utf_8 | ce53d5c9e700571c30036efc2d5850c9 | %integrate_line Integrate line in non orientable vector field.
%
% SYNTAX
% position = integrate_line(timespan,initialCondition,domain,flowResolution,flowPeriodicBc,vectorGrid,odeSolverOptions)
% position = integrate_line(timespan,initialCondition,domain,flowResolution,flowPeriodicBc,vectorGrid,odeSolverOptions,poincar... |
github | haller-group/LCStool-master | print_theta_hist.m | .m | LCStool-master/LCStool-1-0/print_theta_hist.m | 817 | utf_8 | d813b47e84e5ccd5d1c357c048b1d9e6 | % print_theta_hist Print a list of angular change values
%
% SYNTAX
% print_theta_hist(theta)
%
% EXAMPLE
% epsilon = .1;
% amplitude = .1;
% omega = pi/5;
% domain = [0,2;0,1];
% resolution = [750,375];
% timespan = [0,5];
% addpath(fullfile('demo','double_gyre'))
% lDerivative = @(t,x,~)derivative(t,x,false,epsilon,a... |
github | haller-group/LCStool-master | poincare_closed_orbit_multi.m | .m | LCStool-master/LCStool-1-0/poincare_closed_orbit_multi.m | 5,184 | utf_8 | 6d0798536ea512c0e445b506fa28f887 | % poincare_closed_orbit_multi Find closed orbits of multiple Poincare
% sections
%
% SYNTAX
% [closedOrbits,orbits] = poincare_closed_orbit_multi(domain,resolution,etaPos,etaNeg,PSList)
% [closedOrbits,orbits] = poincare_closed_orbit_multi(...,'nBisection',nBisection)
% [closedOrbits,orbits] = poincare_closed_orbit_mul... |
github | haller-group/LCStool-master | poincare_closed_orbit.m | .m | LCStool-master/LCStool-1-0/poincare_closed_orbit.m | 15,563 | utf_8 | 49adb83c6f29301213d3ff82b46245d5 | % poincare_closed_orbit Find closed orbits using Poincare section map
%
% SYNTAX
% [closedOrbitPosition,orbitPosition] = poincare_closed_orbit(domain,resolution,vectorField,poincareSection)
% [closedOrbitPosition,orbitPosition] = poincare_closed_orbit(...,'odeSolverOptions',options)
% [closedOrbitPosition,orbitPosition... |
github | haller-group/LCStool-master | eig_cgStrain.m | .m | LCStool-master/LCStool-1-0/eig_cgStrain.m | 15,361 | utf_8 | 7615f07f09619e59a3c42a5f04e2e3e5 | % eig_cgStrain Calculate eigenvalues and eigenvectors of Cauchy-Green strain
%
% SYNTAX
% cgStrainD = eig_cgStrain(derivative,domain,timespan,resolution)
% [cgStrainV,cgStrainD] = eig_cgStrain(derivative,domain,timespan,resolution)
% [cgStrainV,cgStrainD] = eig_cgStrain(...,'auxGridRelDelta',auxGridRelDelta)
% [cgStrai... |
github | haller-group/LCStool-master | derivative.m | .m | LCStool-master/LCStool-1-0/demo/double_gyre/derivative.m | 2,144 | utf_8 | e1de8afe39399070f71ed2ce197f8ce5 | % derivative Double gyre velocity field
%
% SYNTAX
% derivative_ = derivative(t,position,useEoV,epsilon,amplitude,omega)
%
% INPUT ARGUMENTS
% t: time
% position: [x1;y1;x2;y2;...;xn;yn]
% useEov: logical that controls use of the equation of variation
% epsilon,amplitude,omega: double gyre parameters
%
% REFERENCE
% DO... |
github | haller-group/LCStool-master | d_phi.m | .m | LCStool-master/LCStool-1-0/demo/bickley_jet/d_phi.m | 177 | utf_8 | 779955cc87658947f647bd0e7ebd44f4 | % Forced-damped Duffing oscillator used with aperiodic forcing
function dPhi = d_phi(tau,phi)
dPhi(2,1) = nan;
dPhi(1) = phi(2);
dPhi(2) = -.1*phi(2) - phi(1)^3 + 11*cos(tau);
|
github | haller-group/LCStool-master | derivative.m | .m | LCStool-master/LCStool-1-0/demo/bickley_jet/derivative.m | 4,235 | utf_8 | 01aa116cae5418f62bcf0a99c69cf04c | % derivative Bickley jet velocity field
%
% SYNTAX
% derivative_ = derivative(t,position,useEoV,u,lengthX,lengthY,epsilon,perturbationCase)
% derivative_ = derivative(t,position,useEoV,u,lengthX,lengthY,epsilon,perturbationCase,phiSol,phi1Max)
%
% INPUT ARGUMENTS
% t: time
% position: [x1;y1;x2;y2;...;xn;yn]
% useEov: ... |
github | haller-group/LCStool-master | derivative.m | .m | LCStool-master/LCStool-1-0/demo/ocean_dataset/derivative.m | 805 | utf_8 | a5276c4cfd12a54da93a6541798652fc | % derivative Ocean data velocity
%
% SYNTAX
% derivative_ = derivative(time,position,VX_interpolant,VY_interpolant)
%
% INPUT ARGUMENTS
% time: scalar
% position: [x1;y1;x2;y2;...;xN;yN]
% VX_interpolant: griddedInterpolant for x-component of velocity
% VY_interpolant: griddedInterpolant for y-component of velocity
%
%... |
github | slitayem/cloaking-detection-master | plot_clusters.m | .m | cloaking-detection-master/src/utils/plot_clusters.m | 3,126 | utf_8 | 040e8523ab19820ec433c3d3508eff98 | function [ output_args ] = plot_clusters( filename )
%PLOT_CLUSTERS Summary of this function goes here
% Detailed explanation goes here
%
% To Run:
% plot_clusters('train13_test24/plot_clusters_md_9_mcz_2_sw_1_tw_1');
fid = fopen(filename);
% Make the title more illustrative
if ~isempty(strfind(filename,'dom... |
github | slitayem/cloaking-detection-master | DataHash.m | .m | cloaking-detection-master/src/utils/DataHash.m | 15,429 | utf_8 | e725a80cb9180de1eb03e47b850a95dc | function Hash = DataHash(Data, Opt)
% DATAHASH - Checksum for Matlab array of any type
% This function creates a hash value for an input of any type. The type and
% dimensions of the input are considered as default, such that UINT8([0,0]) and
% UINT16(0) have different hash values. Nested STRUCTs and CELLs are parsed
%... |
github | hooperfly/paparazzi-master | dialog.m | .m | paparazzi-master/sw/logalizer/dialog.m | 34,826 | utf_8 | 5407ab492113a3d0358e62c19dc1feab | %--------------------------------------------------------------------
%A simple MATLAB GUI for paparazzi autopilot log-file plotting
%Paparazzi Project [http://www.nongnu.org/paparazzi/]
%by Roman Krashhanitsa 28/10/2005
%adjustable parabeters:
% maxnum - increase if dialog window hangs up or doesnt refresh
% Nres - nu... |
github | hooperfly/paparazzi-master | dialog.m | .m | paparazzi-master/sw/logalizer/matlab_log/dialog.m | 41,728 | utf_8 | 8a40368512745e70d158a49ee08c5926 | %--------------------------------------------------------------------
%A simple MATLAB GUI for paparazzi autopilot log-file plotting
%Paparazzi Project [http://www.nongnu.org/paparazzi/]
%by Roman Krashhanitsa 28/10/2005
%adjustable parabeters:
% maxnum - increase if dialog window hangs up or doesnt refresh
% Nres - nu... |
github | hooperfly/paparazzi-master | tilt.m | .m | paparazzi-master/sw/logalizer/matlab/tilt.m | 3,005 | utf_8 | 28f19a8ce44283009a8f4ba0410e4c0b | %
% this is a 2 states kalman filter used to fuse the readings of a
% two axis accelerometer and one axis gyro.
% The filter estimates the angle and the gyro bias.
%
%
function [angle, bias, rate, cov] = tilt(status, gyro, accel)
TILT_UNINIT = 0;
TILT_PREDICT = 1;
TILT_UPDATE = 2;
persistent tilt_angle; %... |
github | hooperfly/paparazzi-master | theta_of_accel.m | .m | paparazzi-master/sw/logalizer/matlab/theta_of_accel.m | 186 | utf_8 | a68d408f14dcafd800965d810c91c1c1 | %
% return pitch angle from an accelerometer reading
% under assumption that acceleration is vertical
%
function [theta] = theta_of_accel(accel)
theta = -asin( accel(1) / norm(accel)); |
github | hooperfly/paparazzi-master | eulers_of_quat.m | .m | paparazzi-master/sw/logalizer/matlab/eulers_of_quat.m | 334 | utf_8 | aa4e8f9fcedb41872e29eb098aefa7d3 | %
% initialise euler angles from a quaternion
%
function [eulers] = eulers_of_quat(quat)
q0 = quat(1);
q1 = quat(2);
q2 = quat(3);
q3 = quat(4);
phi = atan2(2*(q2*q3 + q0*q1), (q0^2 - q1^2 - q2^2 + q3^2));
theta = asin(-2*(q1*q3 - q0*q2));
psi = atan2(2*(q1*q2 + q0*q3), (q0^2 + q1^2 - q2^2 - q3^2));
eulers = [phi t... |
github | hooperfly/paparazzi-master | synth_data.m | .m | paparazzi-master/sw/logalizer/matlab/synth_data.m | 923 | utf_8 | c23bbe3eb4319edf0890fc9bc4b033c2 |
%
% build synthetic data
%
function [t, rates, quat] = synth_data(dt, nb_samples)
t_end = dt * (nb_samples - 1);
t = 0:dt:t_end;
rates = zeros(3, nb_samples);
omega_q = 15;
amp_q = 2;
osc_start = floor(nb_samples/2);
osc_end = floor(osc_start+2*pi/(omega_q*dt));
for idx=osc_start:osc_end
rates(2, idx) = -amp_q*(... |
github | hooperfly/paparazzi-master | theta_of_quat.m | .m | paparazzi-master/sw/logalizer/matlab/theta_of_quat.m | 182 | utf_8 | 1b15a8391b14bd82c12a4031d009657c | %
% initialise euler angles from a quaternion
%
function [theta] = theta_of_quat(quat)
q0 = quat(1);
q1 = quat(2);
q2 = quat(3);
q3 = quat(4);
theta = asin(-2*(q1*q3 - q0*q2));
|
github | hooperfly/paparazzi-master | synth_imu.m | .m | paparazzi-master/sw/logalizer/matlab/synth_imu.m | 382 | utf_8 | eb83cb7d22000974d367cc96ef11e37f |
%
% build synthetic imu data
%
function [gyro, accel, mag] = synth_imu(rates, quat)
nb_samples = length(rates);
g_ned = [ 0
0
258.3275];
h_ned = [ 166.8120
0.0
203.3070];
for idx = 1:nb_samples
dcm = dcm_of_quat(quat(:, idx));
accel(:, idx) = sim_accel(g_ned, dcm);
mag(:, idx) = sim_mag(h_n... |
github | hooperfly/paparazzi-master | sfun_ahrs.m | .m | paparazzi-master/sw/logalizer/matlab/sfun_ahrs.m | 7,062 | utf_8 | 738df5f0b69d65203e9e7dea9d2b8c41 |
function [sys,x0,str,ts] = sfun_ahrs(t,x,u,flag)
AHRS_UNINIT = 0;
AHRS_STEP_PHI = 1;
AHRS_STEP_THETA = 2;
AHRS_STEP_PSI = 3;
persistent ahrs_state;
persistent ahrs_quat; % first four elements of our state
persistent ahrs_biases;% last three elements of our state
persistent ahrs_rates; % we get unbiased body... |
github | hooperfly/paparazzi-master | quat_of_eulers.m | .m | paparazzi-master/sw/logalizer/matlab/quat_of_eulers.m | 629 | utf_8 | 8783ebf9fadbb74652d2a366c9064c02 |
%
% initialise a quaternion from euler angles
%
function [quat] = quat_of_eulers(eulers)
phi2 = eulers(1) / 2.0;
theta2 = eulers(2) / 2.0;
psi2 = eulers(3) / 2.0;
sinphi2 = sin( phi2 );
cosphi2 = cos( phi2 );
sintheta2 = sin( theta2 );
costheta2 = cos( theta2 );
sinpsi2 = sin( psi2 );
cospsi2 = c... |
github | hooperfly/paparazzi-master | dcm_of_quat.m | .m | paparazzi-master/sw/logalizer/matlab/dcm_of_quat.m | 481 | utf_8 | b9950e5f461f13427a7c670158a92c14 | %
% initialise a DCM from a quaternion
%
function [dcm] = dcm_of_quat(quat)
q0 = quat(1);
q1 = quat(2);
q2 = quat(3);
q3 = quat(4);
dcm00 = q0^2 + q1^2 - q2^2 - q3^2;
dcm01 = 2 * (q1*q2 + q0*q3);
dcm02 = 2 * (q1*q3 - q0*q2);
dcm10 = 2 * (q1*q2 - q0*q3);
dcm11 = q0^2 - q1^2 + q2^2 - q3^2;
dcm12 = 2 * (q2*q3 + q0*q1);... |
github | hooperfly/paparazzi-master | ahrs.m | .m | paparazzi-master/sw/logalizer/matlab/ahrs.m | 4,335 | utf_8 | 5723f910e49a91fc556660bc06826fa8 |
function [quat, biases] = ahrs(status, gyro, accel, mag)
AHRS_UNINIT = 0;
AHRS_STEP_PHI = 1;
AHRS_STEP_THETA = 2;
AHRS_STEP_PSI = 3;
persistent ahrs_quat;
persistent ahrs_biases;
persistent ahrs_rates;
persistent ahrs_P; % covariance matrix
persistent ahrs_Q; % estimate noise variance
ahrs_dt = 0.01... |
github | hooperfly/paparazzi-master | range_meter_accel_kalman.m | .m | paparazzi-master/sw/logalizer/matlab/range_meter_accel_kalman.m | 2,603 | utf_8 | e73c363bd661f2f111583fc707bf8fde | %
%
%
%
function [sys,x0,str,ts] = range_meter_accel_kalman(t,x,u,flag)
period = 0.015625;
persistent X; % state (Z, Zdot, Zdotdot)
persistent P; % error covariance
switch flag,
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0,
X=[0. 0. 0.]';
P=[1. 0. 0.
0. 1. 0.
... |
github | hooperfly/paparazzi-master | psi_of_quat.m | .m | paparazzi-master/sw/logalizer/matlab/psi_of_quat.m | 205 | utf_8 | 821c1b678bcc85fbf97dd6fe3a1b3e3d | %
% initialise euler angles from a quaternion
%
function [psi] = psi_of_quat(quat)
q0 = quat(1);
q1 = quat(2);
q2 = quat(3);
q3 = quat(4);
psi = atan2(2*(q1*q2 + q0*q3), (q0^2 + q1^2 - q2^2 - q3^2));
|
github | hooperfly/paparazzi-master | phi_of_quat.m | .m | paparazzi-master/sw/logalizer/matlab/phi_of_quat.m | 205 | utf_8 | 577a048517be0669ac35e0f7fc8f3b30 | %
% initialise euler angles from a quaternion
%
function [phi] = phi_of_quat(quat)
q0 = quat(1);
q1 = quat(2);
q2 = quat(3);
q3 = quat(4);
phi = atan2(2*(q2*q3 + q0*q1), (q0^2 - q1^2 - q2^2 + q3^2));
|
github | hooperfly/paparazzi-master | phi_of_accel.m | .m | paparazzi-master/sw/logalizer/matlab/phi_of_accel.m | 175 | utf_8 | 7f341eaa185852c295e0a3d39219d885 | %
% returns roll angle from an accelerometer reading
% under assumption that acceleration is vertical
%
function [phi] = phi_of_accel(accel)
phi = atan2(accel(2), accel(3)); |
github | hooperfly/paparazzi-master | dcm_of_eulers.m | .m | paparazzi-master/sw/logalizer/matlab/dcm_of_eulers.m | 607 | utf_8 | d49ff8d4658100d798e02d14b725d7b8 | %
% initialise a DCM from a set of eulers
%
function [dcm] = dcm_of_eulers(eulers)
phi = eulers(1);
theta = eulers(2);
psi = eulers(3);
dcm00 = cos(theta) * cos(psi);
dcm01 = cos(theta) * sin(psi);
dcm02 = -sin(theta);
dcm10 = sin(phi) * sin(theta) * cos(psi) - cos(phi) * sin(psi);
dcm11 = sin(phi) * sin(theta) * si... |
github | hooperfly/paparazzi-master | psi_of_mag.m | .m | paparazzi-master/sw/logalizer/matlab/psi_of_mag.m | 1,076 | utf_8 | 04a2ed36a67c0a29c793684357f7f95d | %
% return yaw angle from a magnetometer reading, knowing roll and pitch
%
% The rotation matrix to rotate from NED frame to body frame without
% rotating in the yaw axis is:
%
% [ 1 0 0 ] [ cos(Theta) 0 -sin(Theta) ]
% [ 0 cos(Phi) sin(Phi) ] [ 0 1 0 ]
% [ 0 -sin(Phi) cos(Phi)... |
github | hooperfly/paparazzi-master | normalize_quat.m | .m | paparazzi-master/sw/logalizer/matlab/normalize_quat.m | 84 | utf_8 | 059325b9c340c1295d2d86b71c7f0d02 |
function [quat_out] = normalize_quat(quat_in)
quat_out = quat_in / norm(quat_in);
|
github | hooperfly/paparazzi-master | plot_prop.m | .m | paparazzi-master/sw/logalizer/matlab/plot_prop.m | 1,636 | utf_8 | a1b37b753e6331884f03d5edc92a7ad1 | %
% plot a serie of measures realised with the black 10*4.5 prop
%
function [] = plot_prop()
rpm = [ 2800 3350 3720 4450 5250 ];
thrust_g = [ 122 175 219 310 445 ];
torque_g = [ 10 16 19 26 44 ];
omega = rpm / 60 * 2 * pi;
omega_square = omega.^2;
thrust_n = thrust_g .* (... |
github | hooperfly/paparazzi-master | eulers_ahrs.m | .m | paparazzi-master/sw/logalizer/matlab/eulers_ahrs.m | 3,448 | utf_8 | ff18ecc6efcad8ecea4cb1c04b4153e3 |
function [eulers, biases] = eulers_ahrs(status, gyro, accel, mag, dt)
AHRS_UNINIT = 0;
AHRS_PREDICT = 1;
AHRS_UPDATE_PHI = 2;
AHRS_UPDATE_THETA = 3;
AHRS_UPDATE_PSI = 4;
persistent ahrs_eulers;
persistent ahrs_biases;
persistent ahrs_rates;
persistent ahrs_P;
if (status == AHRS_UNINIT)
[ahrs_eul... |
github | hooperfly/paparazzi-master | eulers_of_quat.m | .m | paparazzi-master/sw/airborne/test/ahrs/plot/eulers_of_quat.m | 789 | utf_8 | e5d898a1c84e280d2b3097f8a270c990 | %% EULERS OF QUATERNION
%
% [euler] = eulers_of_quat(quat)
%
% transposes a quaternion to euler angles
function [euler] = eulers_of_quat(quat)
algebra_common;
if size(quat)(2)==4
quat = quat';
transpose = 1;
end
dcm00 = 1.0 - 2*(quat(Q_QY,:).*quat(Q_QY,:) + quat(Q_QZ,:).*quat(Q_QZ,:));
dcm01 ... |
github | hooperfly/paparazzi-master | unwrap.m | .m | paparazzi-master/sw/airborne/test/ahrs/plot/unwrap.m | 360 | utf_8 | 88eb2f76dedb25dfbdeb635ff1af9f1e | %% unwrap
%
% [unwraped] = unwrap(wraped)
%
%
function [unwraped] = unwrap(wraped)
unwraped = zeros(length(wraped), 1);
cnt = 0;
for i=2:length(wraped)
dif = wraped(i) - wraped(i-1);
if (dif > pi/2)
cnt=cnt-1;
elseif (dif <-pi/2)
cnt=cnt+1;
end
unwraped(i) =... |
github | hooperfly/paparazzi-master | deg_of_rad.m | .m | paparazzi-master/sw/airborne/test/ahrs/plot/deg_of_rad.m | 124 | utf_8 | b8cf99172588f77a253dd84982a9d2e7 | %% degres of radians
%
% [deg] = deg_of_rad(rad)
%
%
function [deg] = deg_of_rad(rad)
deg = rad * 180 / pi;
endfunction |
github | hatsunearu/etchasketch-stepper-master | stepperinstruction.m | .m | etchasketch-stepper-master/mfiles/stepperinstruction.m | 2,224 | utf_8 | 1c94d5b7eda63578efb2309dd4c9d6b6 | % this function returns the stepper motor instructions given an image file
% and starting coordinates startx and starty.
%
% stepper motor instructions have the following code associated:
% 1 2 3
% 4 5 6
% 7 8 9
%
% where 5 corresponds to the current position.
% an instruction of 5 corresponds to essentially a noop.
f... |
github | satwikkottur/StochasticMCMC-master | originalHMC.m | .m | StochasticMCMC-master/src/originalHMC.m | 7,717 | utf_8 | 3483eacab522843ce371dac950bdc4f2 | function [samples, energies, diagn] = hmc(f, x, options, gradf, varargin)
%HMC Hybrid Monte Carlo sampling.
%
% Description
% SAMPLES = HMC(F, X, OPTIONS, GRADF) uses a hybrid Monte Carlo
% algorithm to sample from the distribution P ~ EXP(-F), where F is the
% first argument to HMC. The Markov chain starts at the poi... |
github | satwikkottur/StochasticMCMC-master | hmcGeneric.m | .m | StochasticMCMC-master/src/hmcGeneric.m | 7,835 | utf_8 | 2c008f2bc068ec143bf40e15fc391ec5 | function [samples, energies, diagn] = hmc(f, x, options, gradf, varargin)
%HMC Hybrid Monte Carlo sampling.
%
% Description
% SAMPLES = HMC(F, X, OPTIONS, GRADF) uses a hybrid Monte Carlo
% algorithm to sample from the distribution P ~ EXP(-F), where F is the
% first argument to HMC. The Markov chain starts at the poi... |
github | satwikkottur/StochasticMCMC-master | sghmc.m | .m | StochasticMCMC-master/src/sghmc.m | 8,968 | utf_8 | d03b01f3dc9ddc37ebcb7292f2cf82d2 | function [samples, energies, diagn] = sghmc(f, x, options, gradf, fisher, varargin)
%HMC Hybrid Monte Carlo sampling.
%
% Description
% SAMPLES = HMC(F, X, OPTIONS, GRADF) uses a hybrid Monte Carlo
% algorithm to sample from the distribution P ~ EXP(-F), where F is the
% first argument to HMC. The Markov chain starts ... |
github | satwikkottur/StochasticMCMC-master | hmcLocal.m | .m | StochasticMCMC-master/src/cpusmall/hmcLocal.m | 7,840 | utf_8 | 3479bc0336a072892939ff15ea91a448 | function [samples, energies, diagn] = hmcLocal(f, x, options, gradf, varargin)
%HMC Hybrid Monte Carlo sampling.
%
% Description
% SAMPLES = HMC(F, X, OPTIONS, GRADF) uses a hybrid Monte Carlo
% algorithm to sample from the distribution P ~ EXP(-F), where F is the
% first argument to HMC. The Markov chain starts at th... |
github | satwikkottur/StochasticMCMC-master | stocGradLikelihood.m | .m | StochasticMCMC-master/src/GaussianMeanL1/stocGradLikelihood.m | 1,182 | utf_8 | b421f1db6301c46268548f76338866ad | function gradient = stocGradLikelihood(theta, data, priorPDF, stepSize, batchSize, varargs)
% Function to compute the stochastic gradient given the data,
% current estimate of theta and prior for theta
%
% There are two options for selecting the batches:
% Linear - linearly select the batches
% ... |
github | satwikkottur/StochasticMCMC-master | gradLikelihood.m | .m | StochasticMCMC-master/src/GaussianMeanL1/gradLikelihood.m | 945 | utf_8 | f75aa556fad6380d392f128dc8f2aa02 | function gradient = gradLikelihood(theta, data, priorPDF, stepSize, varargs)
% Function to compute the gradient given the data, current estimate of
% theta and prior for theta
% Asserting if theta is a row vector
%assert(isrow(theta));
% Evaluating the gradient
shifted = bsxfun(@minus,... |
github | kamratia1/FYP_2015-master | calculate_constants.m | .m | FYP_2015-master/MATLAB Files/calculate_constants.m | 766 | utf_8 | 01585574ad43528832bd77a506e18d99 | % This function calculates the constants of the mirror to be used on the
% simulink Model.
% I is the moment of Inertia of the mirror
% C is the rotational Friction
% K is the torsion coeddicient
function [I, C, K] = calculate_constants(l,w,d,Q,Wn)
% Q is the q-factor
% Wn is the undamped natural frequency in Hz.
% l... |
github | Semyonic/CourseCodes-master | Homework03.m | .m | CourseCodes-master/COMP-403/Homework03.m | 3,742 | utf_8 | e05605168bccf9e78319231cb366eecd | function Tutorial_Noise_SNR()
%{
To read the original image, add noise and write the noisy picture in the
directory.
%}
original_image='cameraman.jpg';
%Reading the image
img2D = imread(original_image);%256*256 uint8
%Looking at the original picture
imshow(uint8(img2D));
title('Original image');
%ADDING SALT&PEPPER... |
github | sensbio/sensbiotk-master | AdaptBool.m | .m | sensbiotk-master/examples/vicon3Dvalidation/Script/AdaptBool.m | 792 | utf_8 | 9ad73f24b89901d19f7d4f0bc9610056 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright (C) OMG Plc 2009.
% All rights reserved. This software is protected by copyright
% law and international treaties. No part of this software / document
% may be reproduced or distributed in any form or by any means,
% w... |
github | sweeneychris/TheiaSfM-master | flann_search.m | .m | TheiaSfM-master/libraries/flann/src/matlab/flann_search.m | 3,564 | utf_8 | 7dfb2eee171a6fef9aa4adec527e3145 | %Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
%Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
%
%THE BSD LICENSE
%
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions
%are met:
%
... |
github | sweeneychris/TheiaSfM-master | flann_load_index.m | .m | TheiaSfM-master/libraries/flann/src/matlab/flann_load_index.m | 1,578 | utf_8 | f9bcc41fd5972c5c987d6a4d41bdc796 | %Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
%Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
%
%THE BSD LICENSE
%
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions
%are met:
%
... |
github | sweeneychris/TheiaSfM-master | test_flann.m | .m | TheiaSfM-master/libraries/flann/src/matlab/test_flann.m | 10,328 | utf_8 | 151c22994b0192f8a071649ad26fbc6b | %Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
%Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
%
%THE BSD LICENSE
%
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions
%are met:
%
... |
github | sweeneychris/TheiaSfM-master | flann_free_index.m | .m | TheiaSfM-master/libraries/flann/src/matlab/flann_free_index.m | 1,614 | utf_8 | 5d719d8d60539b6c90bee08d01e458b5 | %Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
%Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
%
%THE BSD LICENSE
%
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions
%are met:
%
... |
github | sweeneychris/TheiaSfM-master | flann_save_index.m | .m | TheiaSfM-master/libraries/flann/src/matlab/flann_save_index.m | 1,563 | utf_8 | 5a44d911827fba5422041529b3c01cf6 | %Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
%Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
%
%THE BSD LICENSE
%
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions
%are met:
%
... |
github | sweeneychris/TheiaSfM-master | flann_set_distance_type.m | .m | TheiaSfM-master/libraries/flann/src/matlab/flann_set_distance_type.m | 1,914 | utf_8 | a62dd85add564e04c01aefeb65083f5d | %Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
%Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
%
%THE BSD LICENSE
%
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions
%are met:
%
... |
github | sweeneychris/TheiaSfM-master | flann_build_index.m | .m | TheiaSfM-master/libraries/flann/src/matlab/flann_build_index.m | 2,299 | utf_8 | f4cdee51a1c9616f205dcc814c943903 | function [index, params, speedup] = flann_build_index(dataset, build_params)
%FLANN_BUILD_INDEX Builds an index for fast approximate nearest neighbors search
%
% [index, params, speedup] = flann_build_index(dataset, build_params) - Constructs the
% index from the provided 'dataset' and (optionally) computes the optima... |
github | DiffusionMRITool/dmritool-master | OptimalSamplingSingleShellCNLO.m | .m | dmritool-master/Matlab/SamplingScheme/OptimalSamplingSingleShellCNLO.m | 6,696 | utf_8 | 707f78cfd9528c494518db53733e9549 | function [grad, xopt, fopt, retcode] = OptimalSamplingSingleShellCNLO(gradInitial, param)
% update gradients from an initial gradient set, such that the updated gradients are evenly distributed.
%
% USAGE:
% [grad, xopt, fopt, retcode] = OptimalSamplingSingleShellCNLO(gradInitial, param)
%
% INPUT
% gradInitial ... |
github | DiffusionMRITool/dmritool-master | OptimalSamplingMultiShellCNLO_singleRun.m | .m | dmritool-master/Matlab/SamplingScheme/OptimalSamplingMultiShellCNLO_singleRun.m | 16,267 | utf_8 | c6148cb2a62b850c1e8b0d28d7c8f5e0 | function [gradCell, xopt, fopt, retcode] = OptimalSamplingMultiShellCNLO_singleRun(gradCellInitial, param)
% update gradients from an initial gradient set, such that the updated gradients are evenly distributed.
%
% USAGE:
% [gradCell, xopt, fopt, retcode] = OptimalSamplingMultiShellCNLO_singleRun(gradCellInitial, p... |
github | phleong/matlab-master | CKF.m | .m | matlab-master/GSCKF/CKF.m | 2,122 | utf_8 | 462c2b54d680ada277af24aa67e2b9e5 | % Cubature Kalman Filter for the bearings-only tracking problem
function [target_est, target_cov, nees] = CKF (ownship, measurement, target, target_range_bar, target_speed_bar)
global n_x cubature_points covariance_matrix transition_matrix sigma_theta
% Outputs - estimated target state and covariance
target_e... |
github | phleong/matlab-master | gaussian_split3.m | .m | matlab-master/GSCKF/gaussian_split3.m | 1,194 | utf_8 | 4c605fcbb126f111a5fac97c4efb11fa | % The Gaussian splitting method in `a versatile Gaussian splitting approach
% to nonlinear state estimation and its application to noise-robust ASR'
function [states, covariances, weights] = gaussian_split3 (state, covariance, num, const, eigenvector)
K = (num-1)/2; % Total number of components = 2K+1
di... |
github | phleong/matlab-master | bearings_average.m | .m | matlab-master/GSCKF/bearings_average.m | 417 | utf_8 | fe4b80035d76bb9d024bb910f08757ac | % This function calculates the average of a list of bearing values, with their corresponding weights
function average = bearings_average(bearings, weights)
% To make sure weights are normalized
weights = weights/sum(weights);
average = bearings(1);
for k = 2:length(weights)
diff = wraparound(bearings(k)... |
github | phleong/matlab-master | gaussian_split.m | .m | matlab-master/GSCKF/gaussian_split.m | 1,057 | utf_8 | f8bfcd4d24bd80553afc5948ed81e1ec | % Splies a Gaussian component into 2 or 3 components
function [means, covs, weights] = gaussian_split (mean, covariance, ori_weight, n)
[V, D] = eig(covariance);
[~,Dx] = find(D == max(max(D)));
max_D = D(Dx, Dx);
max_V = V(:,Dx);
v = 0.5;
means = zeros([length(mean), n]);
covs = zeros([size(covaria... |
github | phleong/matlab-master | wraparound.m | .m | matlab-master/GSCKF/wraparound.m | 301 | utf_8 | 6d595214a27e12bbe28dd88d0bd7164b | % Wraparound theta so they lie between -pi and pi
function wraparound_theta = wraparound (theta)
new_theta = theta;
[xx1] = find(new_theta > pi);
new_theta(xx1) = new_theta(xx1) - 2*pi;
[xx2] = find(new_theta < -pi);
new_theta(xx2) = new_theta(xx2) + 2*pi;
wraparound_theta = new_theta;
|
github | phleong/matlab-master | GSCKF.m | .m | matlab-master/GSCKF/GSCKF.m | 5,785 | utf_8 | 1789337cc5a5ac720d99ddb15f9ea62f | % Gaussian Sum Cubature Kalman Filter
% -- measure of nonlinearity -- Li
% -- method of merging components -- no interactions between CKFs
function [target_est, target_cov, nees] = GSCKF (ownship, measurement, target, target_speed_bar, const, th)
global n_x N_F cubature_points covariance_matrix transition_matri... |
github | phleong/matlab-master | nonlinearity_degree.m | .m | matlab-master/GSCKF/nonlinearity_degree.m | 482 | utf_8 | b4ac0177b1d9d8790abb88b234ffb482 | % Calculates the degree of nonlinearity of the CKF using 'Measure of nonlinearity for
% stochastic systems' by X.R.Li
function nonlinearity = nonlinearity_degree (states, state_center, transformed_states, transformed_center, cov_state, weights)
diff = wraparound(transformed_states - transformed_center);
C_g = w... |
github | phleong/matlab-master | check_components.m | .m | matlab-master/GSCKF/check_components.m | 1,272 | utf_8 | 7c3ea8ac5e851b246f0e20875e7f1194 | % When one of the components have negligible weight, it is discarded and
% one of the components will be split into 2 components
function [new_states, new_covs, new_weights] = check_components (old_states, old_covs, old_weights, nonlinearities)
new_states = zeros(size(old_states));
new_covs = zeros(size(old_cov... |
github | phleong/matlab-master | rp_filter_initialization.m | .m | matlab-master/GSCKF/rp_filter_initialization.m | 1,589 | utf_8 | 9b1f554842a0bcf76e2c23c8298e6da6 | % Initializaing the filtering algorithm with a number of independent
% filters, each with a different range estimate
function [init_estimate, init_state_cov] = rp_filter_initialization (init_ownship, init_bearing_bar, n, target_speed_bar)
global sigma_theta sigma_s sigma_c r_min common_ratio
% Prior knowledge... |
github | phleong/matlab-master | gaussian_mixture.m | .m | matlab-master/GSCKF/gaussian_mixture.m | 564 | utf_8 | 09bcf530ceb55273f98c7b2525c2c742 | % Gaussian mixture of several Gaussian components
function [state, covariance] = gaussian_mixture (weights, state_m, cov_m)
global n_x
if(sum(weights) == 0)
state = state_m(:,1);
covariance = cov_m(:,:,1);
else
weights = weights/sum(weights); % Make sure the weights are normalised
state =... |
github | phleong/matlab-master | dir_nonlinearity.m | .m | matlab-master/GSCKF/dir_nonlinearity.m | 456 | utf_8 | 13db9bc32fa7f9f41a1a18fb4562c2a6 | % Determines the direction of nonlinearity
function vector = dir_nonlinearity (points, center, points_x, center_x)
dim = length(points)/2;
matrix = zeros(dim, dim);
for n = 1:dim;
dist = 0.5*(wraparound(points(n) + points(n+dim) - 2*center))^2;
phi = (points_x(:,n) - center_x)/norm(points_x(:,n) - c... |
github | phleong/matlab-master | CRLB.m | .m | matlab-master/GSCKF/CRLB.m | 1,367 | utf_8 | 3d826a6fdff13b06e807c68ef57b141e | % Cramer-Rao Lower Bound for RMS error
function filter_bound = CRLB (target_trajectories, ownship, init_covs)
global transition_matrix covariance_matrix sigma_theta n_x
num_runs = size(init_covs,3);
all_steps = size(target_trajectories,2);
filter_bound = zeros(1, all_steps);
K_11 = transition_matrix'/c... |
github | phleong/matlab-master | filter_initialization.m | .m | matlab-master/GSCKF/filter_initialization.m | 1,400 | utf_8 | b6a67983703a110ca55bc00a1be27ff9 | % Initialization of the filter for bearings-only tracking
function [init_estimate, init_state_cov] = filter_initialization (init_ownship, init_bearing_bar, target_speed_bar, target_range_bar)
global sigma_r sigma_theta sigma_s sigma_c
% Prior knowledge of target trajectory
target_course_bar = init_bearing_bar... |
github | imkaywu/CPSC540-master | decision_tree.m | .m | CPSC540-master/Coding project/decision_tree.m | 9,157 | utf_8 | 275aa542ae7a645b5c91e77325b9e0c8 | function t = decision_tree(X, y, options)
% t = decision_tree(X, y, options)
%
% Description:
% Builds a decision tree to predict y from X. The tree is grown by
% recursively splitting each node using the feature which gives the best
% information gain or information gain ratio until the leaf is consi... |
github | imkaywu/CPSC540-master | matLearn_classification_boosting.m | .m | CPSC540-master/Coding project/matLearn_classification_boosting.m | 3,530 | utf_8 | 18e236c540b82da8cd5be66c5f241e49 | function model = matLearn_classification_boosting(X, y, options)
% matLearn_classification_boosting(X,y,options)
%
% Description:
% - Multi-class classification boosting based on decision stump or
% decision tree
%
% Options
% - nBoosts: Specify the number of base learners
% - classifier: Specify ... |
github | imkaywu/CPSC540-master | decisionStump.m | .m | CPSC540-master/Coding project/decisionStump.m | 1,775 | utf_8 | 82712a6760c699bb040beed4077c68ff | function model = decisionStump(X, y, weights)
% model = decisionStump(X, y, weights)
%
% Description:
% - decision stump
% Parameter:
% Input:
% X is an NxM matrix, where N is the number of points and M is the
% number of features.
% y is an Nx1 vector of classes
% weights are weights fo... |
github | imkaywu/CPSC540-master | decision_tree.m | .m | CPSC540-master/Coding project/multi-class bagging(Shashin Sharan's code)/decision_tree.m | 9,157 | utf_8 | 275aa542ae7a645b5c91e77325b9e0c8 | function t = decision_tree(X, y, options)
% t = decision_tree(X, y, options)
%
% Description:
% Builds a decision tree to predict y from X. The tree is grown by
% recursively splitting each node using the feature which gives the best
% information gain or information gain ratio until the leaf is consi... |
github | imkaywu/CPSC540-master | matLearn_classification_bagging.m | .m | CPSC540-master/Coding project/multi-class bagging(Shashin Sharan's code)/matLearn_classification_bagging.m | 2,509 | utf_8 | 1b2c3cb296db42a8eba8adae92d07b32 | function [model] = matLearn_classification_bagging(X,y,options)
% matLearn_classification_bagging(X,y,options)
%
% Description:
% - Classification based on the average prediction among models fit to
% bootstrap samples
%
% Options
% - Specify the number of bootstrap samples
% - Specify the input model that ne... |
github | imkaywu/CPSC540-master | matLearn_classification_decisionTree.m | .m | CPSC540-master/Coding project/multi-class bagging(Shashin Sharan's code)/matLearn_classification_decisionTree.m | 3,025 | utf_8 | f332ce03e7ae271c46b7064f8d384ff0 | function [model] = matLearn_classification_decisionTree(X,y,options)
% matLearn_classification_decisionTree(X,y,options)
%
% Description:
% - DESCRIPTION HERE!!!!
%
% Options:
% - None
%
% Authors:
%
root = fitTree(X, y, 0, options);
model.name = 'Decision Tree';
model.predict = @predict;
model.getTree ... |
github | imkaywu/CPSC540-master | adaBoost_RBFSVM.m | .m | CPSC540-master/Course project/adaBoost_RBFSVM.m | 2,927 | utf_8 | 848d22126bb4454feb8f11b89572423c | function [model] = adaBoost_RBFSVM(X,y,nBoosts,boostedClassifier)
[nTrain, ~] = size(X);
model.nBoosts = nBoosts;
model.boostedClassifier = boostedClassifier;
% Initialize Weights
z = (1 / nTrain) * ones(nTrain, 1);
alpha = zeros(nBoosts, 1);
% Select part of the training se... |
github | imkaywu/CPSC540-master | adaBoost.m | .m | CPSC540-master/Course project/adaBoost.m | 2,330 | utf_8 | 1e27237b2683d1ac9ae42d63947670d7 | function [model] = adaBoost(X,y,nBoosts,boostedClassifier)
[nTrain, ~] = size(X);
model.nBoosts = nBoosts;
model.boostedClassifier = boostedClassifier;
% Initialize Weights
z = (1 / nTrain) * ones(nTrain, 1);
alpha = zeros(nBoosts, 1);
% error vector
error = zeros(nBoos... |
github | imkaywu/CPSC540-master | decision_tree.m | .m | CPSC540-master/Course project/Base Learner/decision_tree.m | 9,407 | utf_8 | 3c4794fdd2d52bc44182746e34067062 | function t = decision_tree(X, y, options)
% Builds a decision tree to predict y from X. The tree is grown by
% recursively splitting each node using the feature which gives the best
% information gain until the leaf is consistent or all inputs have the same
% feature values.
%
% X is an n... |
github | imkaywu/CPSC540-master | SVM_Kernel.m | .m | CPSC540-master/Course project/Base Learner/SVM_Kernel.m | 2,173 | utf_8 | 5ec137f407cf76d7300dd787eac5ecee | function model = SVM_Kernel(X, y, z, options)
N = size(X, 1);
X = [ones(N,1), X];
model.X = X;
model.y = y;
if(nargin == 2)
z = ones(size(y));
elseif(nargin == 4)
ind_1 = options.ind_1;
alpha_dual = options.alpha_dual;
Kernel = options.Kernel;
... |
github | imkaywu/CPSC540-master | linear_regression.m | .m | CPSC540-master/Course project/Base Learner/linear_regression.m | 351 | utf_8 | 0661c1af9a551059b0feea570643ac4b | function model = linear_regression(X, y, z, options)
% lambda = 1 / numel(y);
z = 1 - z;
w = (X' * diag(z) * X) \ X' * diag(z) * y;
% w = (X' * X + lambda * eye(size(X, 2))) \ X' * y;
model.w = w;
model.predict = @predict;
end
function y = predict(model, X)
y = sign(X * mode... |
github | imkaywu/CPSC540-master | decision_stump.m | .m | CPSC540-master/Course project/Base Learner/decision_stump.m | 1,223 | utf_8 | 60da8ad1f608b3dce6e38db1bac432f7 | function model = decision_stump(X, y, weights)
nFeatures = size(X, 2);
minErr = inf;
minVar = 0;
minThreshold = 0;
minThresholdType = '';
for j = 1 : nFeatures
thresholds = [min(X(:, j)) - eps; sort(unique(X(:, j))); max(X(:, j)) + eps];
for t = thresholds'
... |
github | imkaywu/CPSC540-master | decision_tree_weight - 副本.m | .m | CPSC540-master/Course project/Base Learner/decision_tree_weight - 副本.m | 6,853 | utf_8 | ed97f51df18182f81d9ec47407d11ff4 | function t = decision_tree_weight(X, Y, z, options)
% Builds a decision tree to predict Y from X. The tree is grown by
% recursively splitting each node using the feature which gives the best
% information gain until the leaf is consistent or all inputs have the same
% feature values.
%
%... |
github | imkaywu/CPSC540-master | SVM.m | .m | CPSC540-master/Course project/Base Learner/SVM.m | 1,888 | utf_8 | 2e423d6d509ed19a3a24a1ee37c741a9 | function model = SVM(X, y, z, options)
N = size(X, 1);
X = [ones(N,1), X];
model.X = X;
model.y = y;
if(nargin == 2)
z = ones(size(y));
elseif(nargin == 4)
ind_1 = options.ind_1;
alpha_dual = options.alpha_dual;
X = X(ind_1 == 1, :);
y = y... |
github | imkaywu/CPSC540-master | decision_tree_weight.m | .m | CPSC540-master/Course project/Base Learner/decision_tree_weight.m | 9,277 | utf_8 | 9e59325fce7dfe5b8cf9453385d225b5 | function t = decision_tree_weight(X, y, z, options)
% Builds a decision tree to predict y from X. The tree is grown by
% recursively splitting each node using the feature which gives the best
% information gain until the leaf is consistent or all inputs have the same
% feature values.
%
%... |
github | imkaywu/CPSC540-master | SVM1.m | .m | CPSC540-master/Course project/Base Learner/SVM1.m | 1,927 | utf_8 | 304b953595e9e620fefbd5af1771ebf9 | function model = SVM1(X, y, z, options)
if(nargin == 2)
z = ones(size(y));
elseif(nargin == 4)
ind_1 = options.ind_1;
alpha_dual = options.alpha_dual;
X = X(ind_1 == 1, :);
y = y(ind_1 == 1);
z = z(ind_1 == 1);
end
% Training set size
... |
github | open-connectome-classes/StatConn-Spring-2015-Coursework-master | adjlist2matrix.m | .m | StatConn-Spring-2015-Coursework-master/project/submission/SGR-StatConnFinalProject/adjlist2matrix.m | 422 | utf_8 | 09e5f1a5de20fd01f590965b553baca6 | %Final Project - Class: Statistical Connectomics
%Author: Sandra Gomez R., May 2015
%Software: Created on MATLAB R2014b
%Project: Clustering and inferring the C. elegans glia network
function [B]=adjlist2matrix(A)
%Returns the matrix of any adjacency list where the
%input is A=any adj list with 2 columns
rows = A(:... |
github | open-connectome-classes/StatConn-Spring-2015-Coursework-master | coarsen_conn.m | .m | StatConn-Spring-2015-Coursework-master/project/submission/akim1/coarsen_conn.m | 1,246 | utf_8 | 5af3a9f859b04a23afd4e737ef010458 | % akim1 150513
function ret = coarsen_conn(n_x, n_y, conn_mat)
new_matrix = zeros(n_x*n_y/4);
l = 1;
for j = 1:2:n_x
for i = 1:2:n_y
% figure out the mask in the pixel domain
mask = zeros(n_y, n_x);
mask(i:i+1,j:j+1) = ones(2, 2);
mask_v = reshape(mask, [numel(mas... |
github | open-connectome-classes/StatConn-Spring-2015-Coursework-master | eval_partitions.m | .m | StatConn-Spring-2015-Coursework-master/project/submission/gkiar/eval_partitions.m | 2,171 | utf_8 | 283c83e871dc2846abb686b11e589f34 | %% eval_partitions.m
% MRI Partition Comparion for small graphs generated on the KKI2009,
% 21-subject 42-scan dataset.
%
function performance = eval_partitions(metric, N)
%Sets up number of subjects and similarity metric
if ~exist('N', 'var')
N = 42;
end
if ~exist('metric', 'var') %modes of the 'norm' function,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.