Skip to content

Instantly share code, notes, and snippets.

View johanrhodin's full-sized avatar

Johan Rhodin johanrhodin

View GitHub Profile
@johanrhodin
johanrhodin / frictiondifference.mo
Last active September 9, 2015 16:59
Two different ways to model friction
// New, in https://github.com/dzimmer/ZimmersModelicaTutorial/blob/master/Tutorial2015/BaseComponents/Friction/IdealDryFriction.mo
free = false;
f0 = R;
f0_max = S;
// velocity and acceleration of flanges
v_relfric = der(-s_rel);
a_relfric = der(v_relfric);
// Friction force
-f = if locked then sa * unitForce else if startForward then R else if startBackward then -R else if pre(mode) == Forward then R else -R;
@johanrhodin
johanrhodin / BetaAndUniform.m
Created July 9, 2015 16:00
Plot improvement suggestion for "Error and Dimensionality" draft article by Nassim Nicholas Taleb
(*See Figure 1 in https://dl.dropboxusercontent.com/u/50282823/Propagation.pdf*)
With[{a = 10, b = 20},
Plot[{PDF[UniformDistribution[{0, 1}], f],
PDF[BetaDistribution[a, b], f]},
{f, 0, 1},
Filling -> Axis,
AxesLabel -> {Text[Style["f", Italic]], "Pr"},
PlotRange -> All,
Ticks -> {Automatic, None},
PlotLegends ->
Verifying that +rhodin is my openname (Bitcoin username). https://onename.io/rhodin