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
| Arrows: | |
| Dash, Equals | |
| Greek | |
| Superscripts | |
| Type formatting - Mathbb and Bold | |
| Mathcal P for powersets | |
| Scientific Constants | |
| Sum, Integral, Product, Sqrt, Not, cdot for multiply |
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 [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. | |
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 [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); |
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
| 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: |
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
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import math as m | |
| def Rx(theta): | |
| return np.matrix([[ 1, 0 , 0 ], | |
| [ 0, m.cos(theta),-m.sin(theta)], | |
| [ 0, m.sin(theta), m.cos(theta)]]) | |
| def Ry(theta): |
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
| clear all; close all; clc; | |
| % 3B13c Q1 Tutorial Exploration Sandbox | |
| % Written by William Matthews 25/02/2021 | |
| % Q2, Q3, Q4, Q6 can be applied here, | |
| % but is left as an exercise for the interested reader. | |
| % For the interested reader, Q5 asks for the instantaneous frequency. | |
| % This can be found with a signal processing technique, | |
| % research 'Analytic signal' which is covered in 4th year's |
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
| import matplotlib.pyplot as plt | |
| flips = [0 for _ in range(100)] | |
| flips[0] = 1 | |
| for i in range(1, len(flips)): | |
| flips[i] = flips[i-1]/2 | |
| total_mass = sum(flips) | |
| prob = [f/total_mass for f in flips] |
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
| import serial # ONLY USE PYSERIAL!! pip install pyserial | |
| import time | |
| import sys | |
| import glob | |
| def serial_ports(): | |
| """ Lists serial port names | |
| :raises EnvironmentError: | |
| On unsupported or unknown platforms |
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
| clear all; close all; clc; | |
| % the below code fits a sine wave which has a zero DC component. | |
| % the output is 'bestx' which is a 1x3 matrix with components | |
| % [amplitude, omega, phase 0-2*pi] | |
| % we also have a fitting function @fitfun which can be used y = | |
| % fitfun(bestx,time_arry) to generate our fitted sine wave for some generic | |
| % time array. |
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
| clear all; close all; clc; | |
| xp = linspace(-2,2,1000); | |
| yp = xp'; | |
| d = (xp.^2 + yp.^2).^0.5; | |
| d2 = (abs(xp) + abs(yp)); | |
| % defines pupil | |
| p = (d<0.1); % circle |
OlderNewer