Skip to content

Instantly share code, notes, and snippets.

View WillMatthews's full-sized avatar
🎓
I am *legally* a doctor. Hooray

William Matthews WillMatthews

🎓
I am *legally* a doctor. Hooray
View GitHub Profile
@WillMatthews
WillMatthews / yoctolight.py
Created March 17, 2024 22:21
read yoctopuce light sensor (python) and write to CSV
import os, sys
from yoctopuce.yocto_api import *
from yoctopuce.yocto_lightsensor import *
import datetime
import csv
errmsg = YRefParam()
# Setup the API to use local USB devices
if YAPI.RegisterHub("usb", errmsg) != YAPI.SUCCESS:
function [screen, yscale] = eyediagram_dense(signal, time, rep)
% EYEDIAGRAM_DENSE Creates a very pretty eyediagram compared to MATLAB's default rubbish.
% uses the same arguments as matlab's eyediagram function
scr = 500;
num2delete = rep*mod(numel(signal)/rep,1);
num2delete = round(num2delete);
signal = signal((num2delete + 1):end);
@WillMatthews
WillMatthews / detect_interference.m
Last active November 30, 2021 10:21
MATLAB code which detects if WiFi or phone signals are present
function [interference_present] = detect_interference(dataRX)
% takes a structure `dataRX` which has fields `x` and `y` which is an
% oscilloscope capture.
% Returns a boolean if interference is detected
% tested bands are defined in this function, below.
% use this function to determine if the capture has interference.
% this can be used to cause an error and then place capture code in a 'try catch' block.
Arrows:
Dash, Equals
Greek
Superscripts
Type formatting - Mathbb and Bold
Mathcal P for powersets
Scientific Constants
Sum, Integral, Product, Sqrt, Not, cdot for multiply