Skip to content

Instantly share code, notes, and snippets.

@caiorss
caiorss / extractedLinks.csv
Created December 25, 2016 22:39 — forked from bskaggs/extractedLinks.csv
Here are links to Wikipedia articles from Stack Overflow's tag wiki pages extracted from the May 2014 dump. Each link has been name normalized and has had redirects followed, and only valid articles are listed. The format is a CSV file, with triples representing tag name, the wikipedia link found on the tag wiki page, and the fully resovled link…
@caiorss
caiorss / .m
Created December 25, 2016 22:37 — forked from GiovanniBalestrieri/.m
Snippet - Basic Matlab Code
% Filters the signal using coefficients obtained by the butter filter
% design
x_filtered = filter(b,a,y);
% Plots the filtered signal
figure(4)
plot(t,x_filtered,'r')
hold on
plot(t,y0,'k','LineWidth',2)
hold on
@caiorss
caiorss / .m
Created December 25, 2016 22:37 — forked from GiovanniBalestrieri/.m
Snippet - Basic Matlab Filter
%% Filter Design
% Designs a second order filter using a butterworth design guidelines
[b a] = butter(2,0.2,'high');
% Plot the frequency response (normalized frequency)
figure(3)
H = freqz(b,a,floor(num_bins/2));
plot(0:1/(num_bins/2 -1):1, abs(H), 'r');
hold on
@caiorss
caiorss / stupid_tricks.matlab
Created December 25, 2016 22:37 — forked from adambard/stupid_tricks.matlab
Stupid MATLAB Tricks.
function stupid_tricks
% I made some functional tools for MATLAB.
assert(reduce_(@(x, y) x + y, [1, 2, 3, 4]) == 10)
% They got a little out of hand.
join = @(sep, args) ...
if_(ischar(sep), @() ... % Input check
reduce_(@(x, y) [x sep y], ... % Reduce to string
map_(@num2str, args))); % Convert args to string.
@caiorss
caiorss / gist:99798ba0b4ce9caceb3c46aec057c9d6
Created December 25, 2016 22:37 — forked from moorepants/gist:1007366
Basic Matlab Animation
t = 0:0.001:1000;
x = cos(t);
y = sin(t);
fig = figure();
ax = axes();
hold on
dot1 = plot(x(1), y(1));
dot2 = plot(1.5 * x(1), 1.5 * y(2));
hold off
@caiorss
caiorss / fourier.m
Created December 25, 2016 21:28 — forked from StephenKing/fourier.m
Matlab Fourier
%% Matlab-Skript zur Vorlesung Informationsuebertragung am 14.11.2014
% Autor: Valentin Burger, Michael Seufert, Steffen Gebert
clear all; %set(0, 'defaultlinelinewidth', 1);
figure(1);clf;box on;
A=5; % Amplitude
w=4; % Frequenz
phi=pi/2; % Phasenverschiebung
x=(0:0.001:2)*pi;
y=A*sin(x*w+phi);
@caiorss
caiorss / lda.m
Created December 25, 2016 21:28 — forked from gregoryely/lda.m
SOME MATLAB
%Function lda takes in a list of Words and documents and generates the
%probability matrices for LDA
% INPUTS:
% W -list of words
% D -list of documents assigned to each word
% nTopics - number of topics to use for LDA
% maxIter - maximum iterations to run LDA
% nVocab - (optional) number of unique words
%
% Outputs:
@caiorss
caiorss / Eulers Equations.m
Created December 25, 2016 21:27 — forked from jasdumas/Eulers Equations.m
Biomechanics, matlab
clear all
% Sample kinematic data set
% saved as TEST.m
% kinetic data from pg 191
% Reaction forces (RD from frame 7) and Moment forces (M from frame 7)
RD7 = [-134.33 -768.38 -10.26]; % units are Newtons in GRS
MD7 = [16.13 -0.49 -101.32] ; % units are Newtons*meters in GRS
% RP7 = [-96.41 -755.17 -13.15]; % proximal reaction force used in the g to a axes system
% kinetic data 'table 7.4' Leg angular displacements
@caiorss
caiorss / matlab-file.matlab
Created December 25, 2016 21:27
Matlab Example
n = 20; % number of points
points = [random('unid', 100, n, 1), random('unid', 100, n, 1)];
len = zeros(1, n - 1);
points = sortrows(points);
%% Initial set of points
plot(points(:,1),points(:,2));
for i = 1: n-1
len(i) = points(i + 1, 1) - points(i, 1);
end
while(max(len) > 2 * min(len))
@caiorss
caiorss / slice.m
Created December 25, 2016 21:27 — forked from yichao0319/slice.m
matlab:slice
function [ out_sym, table ] = slice( in_sym, mod_type )
%SLICE Makes hard decision on input symbols with designated modulation type
%
% Inputs:
% in_sym: input symbols to be sliced
% mod_type: modulation type, BPSK, QPSK, 16QAM, or 64QAM
%
% Outputs:
% out_sym: output symbols
% table: mapping alphabet