Skip to content

Instantly share code, notes, and snippets.

View mattgaidica's full-sized avatar
💭
Spending most my time at https://github.com/Neurotech-Hub

Matt Gaidica, Ph.D. mattgaidica

💭
Spending most my time at https://github.com/Neurotech-Hub
View GitHub Profile
extern float32_t inputSignal[SIG_SAMPLES] = { 2.09186630161801,
2.17981806111224, 2.2458345331045, 2.20702098281261, 2.05451765784143,
1.85916546584311, 1.7767591356537, 1.79267779175089, 1.85004295412198,
1.82818508686074, 1.72760166685638, 1.54716102329878, 1.39328525785108,
1.37279362871747, 1.37225304331087, 1.31022305067551, 1.21566162283513,
1.24287644762541, 1.38510735478485, 1.60578710124569, 1.93459280511249,
2.26110788479076, 2.43559114351632, 2.44546630752519, 2.37477587905096,
2.14026122136909, 1.77405580991932, 1.36350765781611, 0.998258176086951,
0.77357268824843, 0.567933484496516, 0.384275954063506,
0.288059029461084, 0.311287985207322, 0.323805443624895,
% MATLAB Code
% Generated by MATLAB(R) 9.9 and Signal Processing Toolbox 8.5.
% Generated on: 14-Dec-2020 15:39:25
% Elliptic Lowpass filter designed using FDESIGN.LOWPASS.
% All frequency values are in Hz.
Fs = 250; % Sampling Frequency
Fpass = 3; % Passband Frequency
n = 1024;
Fs = 250;
t = linspace(0,(1/Fs)*n,n)';
x = zeros(n,1);
for Fc = [5,25]
x = x + sin(2*pi*Fc*t);
end
L = numel(t);
n = (2^nextpow2(L));
extern float32_t inputSignal[FFT_SAMPLES] = { 2, 1.80075512683121,
1.27637053325758, 0.618871900194794, 0.0656112591359919,
-0.191339455865792, -0.0783815301685531, 0.331835982653282,
0.848683105690253, 1.23703243919349, 1.30782963716736,
0.991081272267325, 0.363318387328728, -0.380984958988108,
-1.00311152015435, -1.31072642475088, -1.23075864316698,
-0.836658892316524, -0.319613844304356, 0.085256675713322,
0.18946595086915, -0.0761778607350844, -0.634629641347059,
-1.29170265140208, -1.81007298891733, -1.99987740193588,
-1.79123725544972, -1.26095670117884, -0.603178660320141,
// ... application includes here
// CMSIS Math includes
#include "arm_math.h"
#include "arm_const_structs.h"
// using a 1024 point signal
#define FFT_SAMPLES 1024
#define FFT_SAMPLES_HALF (FFT_SAMPLES / 2)
fs = 125; % sampling frequency
t = 0 : 1/fs : 5; % time (0-5s)
fmod = 2; % Hz
x = sin((2*pi*fmod*t) + pi/2); % create test signal
% setup plot
rows = 4;
cols = 1;
close all
figure('position',[0 0 1000 700]);
close all
files = {'/Users/matt/Downloads/Addison_XC31160 - Red-tailed Hawk - Buteo jamaicensis.mp3',...
'/Users/matt/Downloads/Chartier_XC401311 - Red-tailed Hawk - Buteo jamaicensis.mp3',...
'/Users/matt/Downloads/Wilson_XC53797 - Red-tailed Hawk - Buteo jamaicensis.mp3'};
fileTitles = {'Addison Hawk','Chartier Hawk','Wilson Hawk'};
rows = 3;
cols = 4;
figure('position',[0,0,1500,900]);
@mattgaidica
mattgaidica / run_paletteMaker.m
Created March 11, 2020 14:37
Reducing color palette script
paletteImPath = '~/Downloads/myLittePalette.JPG';
mypal = paletteMaker(paletteImPath);
imPath = '~/Downloads/squirrels.JPG';
[im, cmap] = rgb2ind(imread(imPath),256);
figure('position',[0 0 1200 800]);
subplot(121);
imshow(im,cmap);
subplot(122);
@mattgaidica
mattgaidica / paletteMaker.m
Created March 11, 2020 14:11
Creates a color palette (i.e. colormap) by selecting points on an image
function mypal = paletteMaker(paletteImPath)
% input: image path for your palette
% output: color palette as a colormap
im = imresize(imread(paletteImPath),0.5);
figure;
imshow(im);
[xs,ys,mypal] = impixel();
for iColor = 1:size(mypal,1)
@mattgaidica
mattgaidica / run_firstLastDate.m
Created February 19, 2020 16:29
Complete_Pero_Master_1.29.20
csvPath = "/Users/matt/Documents/MATLAB/Misc/Complete_Pero_Master_1.29.20_dateFMT.csv";
T = readtable(csvPath);
% augment table
firstCaught = cell(size(T,1),1);
lastCaught = firstCaught;
% new table
new_firstCaught = {};
new_lastCaught = {};
new_mouseID = {};