This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% travel is the location of the wiper along the pot from 0 to 1 | |
travel = linspace(0,1,1000); | |
% Define the factor of resistance at the middle pot position | |
mid = 0.15; | |
% b is the base of the exponential equation | |
b = (1/mid - 1)^2; | |
% a is the multiple and also the offset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [I, J] = bjt(v, Is, N, Bf, Br) | |
% BJT: a general model for the currents through a BJT and their | |
% derivatives. | |
% Ben Holmes, 2017/11/28, GPL 3.0 | |
% Arguments: | |
% - v: [vce; vbe], collector-emitter voltage and base-emitter voltage. | |
% - Is: saturation current | |
% - N: ideality factor | |
% - Bf: forward current gain | |
% - Br: reverse current gain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [transferFunction] = circuitShelf(isHighShelf,R,C,f) | |
%%% CircuitShelf: A circuit informed shelf filter written as a continuous | |
%%% time transfer function. | |
% Author: Ben Holmes | |
% Date: 2017/12/16 | |
% License: GPL v3 | |
% Arguments: | |
% - isHighShelf: Boolean variable to switch between highpass and lowpass | |
% - R: 2x1 vector of resistor values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function string = engFormat(value, type) | |
%ENGFORMAT a function to take a passive electronic component value and | |
% return a string with the properly formatted suffix. | |
aVal = abs(value); | |
nn = 0; | |
if strcmp(type,'R') | |
type = char(937); | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [Ac,Bc,Cc,Dc] = cascadeSSM(A,B,C,D) | |
% CASCADESSM A function to cascade linear state-space matrices for the | |
% purpose of cascading filters etc. | |
% | |
% Author: Ben Holmes | |
% Date: 2018/05/20 | |
% License: GPL V3 | |
% | |
% This function is derived from the answer | |
% https://math.stackexchange.com/questions/2201067/cascade-of-state-space-models-for-linear-systems |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [Xmag, Xarg] = fftdBV(x) | |
%FFTDBV Returns the FFT of a voltage signal (in volts) with the amplitude response units dBV. | |
% Number of samples | |
N = length(x); | |
% Scaling factor is sqrt(2) except for at DC when it is 1. | |
k = [1, ones(1,N-1)*sqrt(2)]; | |
% Calculate the scaled DFT. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fileName=$(basename $1) | |
directory=$(dirname $1) | |
gs \ | |
-sOutputFile="$directory/${fileName%.*}-grayscale.pdf" \ | |
-sDEVICE=pdfwrite \ | |
-sColorConversionStrategy=Gray \ | |
-dProcessColorModel=/DeviceGray \ | |
-dCompatibilityLevel=1.4 \ | |
-dAutoRotatePages=/None \ | |
-dNOPAUSE \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function X = forceFFTSymmetry(X) | |
% forceFFTSymmetry A function to force conjugate symmetry on an FFT such that when an | |
% IFFT is performed the result is a real signal. | |
% The function has been written to replace MATLAB's ifft(X,'symmetric'), as this function | |
% is not compatible with MATLAB Coder. | |
% Licensed under Creative Commons Zero (CC0) so use freely. | |
XStartFlipped = fliplr(X(2:floor(end/2))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Calculate full frame to cropped equivalent. First order approximations only. Designed as described by <a href="https://northrup.photo/gear-basics/camera-body-features/sensor-size-crop-factor/">Chelsea and Tony Northrup</a>. | |
<form name="cropCalculator" action="" method="get"> | |
<table> | |
<tr> | |
<td>Crop factor:</td> | |
<td><input type="text" name="cropFactor" value="1.53"></td> | |
</tr> | |
<tr> | |
<td>Direction:</td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%% Low Pass Circuit | |
% A computable RC circuit model using a recurrence relation derived from | |
% MNA, through to a transfer function which is then discretised using the | |
% symbolic math toolbox. | |
% Author: Ben Holmes | |
% Date: 2019/01/01 | |
% License: GPL v3 | |
clear; |
OlderNewer