Instantly share code, notes, and snippets.

# Martin Vincent BloedornMartinBloedorn

• Sort options
Created Aug 7, 2018
View thdf.m
 function [thd, p0, l0] = thdf( P1, f, varargin ) %thdf Computes the total harmonic distortion to the fundamental. % Fundamental is the first harmonic peak that's larger than 2% than % the largest harmonic in the supplied frequency spectrum. % % thd = thdf( P1, f ) % % P1 Single-sided amplitude spectrum of the signal. % f Frequency span of P1. % thd Total harmonic distortion.
Created Aug 7, 2018
View spwm.m
 function [ y, r, c ] = spwm( f1, fc, varargin ) %SPWM Generates sine-wave modulated bipolar PWM. % Will produce the closest possible to a single period of f1. % [ y, t, c ] = spwm( f1, fc, varargin ) % % f1 Base harmonic frequency. % fc Carrier frequency. % 'NSamples'  Samples per 1/fc period. % 'Method' ['left'] 'left', 'right' or 'center'. % 'ModIndex'  Modulation index.
Created Aug 7, 2018
View sfft.m
 function [ P1, f ] = ssfft( X, Fs ) %ssfft Computes the single-sided amplitude spectrum of a signal. % https://www.mathworks.com/help/matlab/ref/fft.html % [ P1, f ] = ssfft( X, Fs ) % % X Input signal. % Fs Sampling frequency. % P1 Single-sided Amplitude Spectrum. % f Frequency range. %
Last active Jul 17, 2016
View knight.c
 #include #include int sgn(int x) { return (x >= 0 ? 1 : -1); } int main(int argc, char * argv[]) { if(argc != 3) { printf("ERROR: Supply X and Y target position!\n");
You can’t perform that action at this time.