diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 36bbdc2729e3aad7d617dfb2bdbfdb2cf4b53299..795eb6647acc99e885f0b89880f7bdb14f69b7bc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,8 +14,9 @@
   script:
     # Let's run the tests. Substitute `coverage = false` below, if you do not
     # want coverage results.
-    - julia -e 'Pkg.rm("LabProcesses");Pkg.clone("https://gitlab.control.lth.se/processes/LabProcesses.jl")' # Update LabProcesses first
-    - julia -e 'Pkg.rm("BallAndBeam");Pkg.clone(pwd()); Pkg.test("BallAndBeam",coverage = false)'
+    - julia -v
+    - julia -e 'using Pkg;Pkg.rm("LabProcesses");Pkg.clone("https://gitlab.control.lth.se/processes/LabProcesses.jl")' # Update LabProcesses first
+    - julia -e 'using Pkg;Pkg.rm("BallAndBeam");Pkg.clone(pwd()); Pkg.test("BallAndBeam",coverage = false)'
     #- julia -e 'Pkg.update();Pkg.test("BallAndBeam", coverage = true)'
     # Comment out below if you do not want coverage results.
     #- julia -e 'Pkg.add("Coverage"); cd(Pkg.dir("BallAndBeam"));
@@ -23,8 +24,8 @@
     #  println("(", cl/tl*100, "%) covered")'
 
 # Name a test and select an appropriate image.
-test:0.6.0:
-  image: julialang/julia:v0.6.0
+test:1.0.0:
+  image: julialang/julia:v1.0.0
   <<: *test_definition
 
 
diff --git a/Manifest.toml b/Manifest.toml
new file mode 100644
index 0000000000000000000000000000000000000000..91a42cfce85bd943bc4146076cb7a3bf315ebab8
--- /dev/null
+++ b/Manifest.toml
@@ -0,0 +1,599 @@
+[[AbstractFFTs]]
+deps = ["Compat", "LinearAlgebra"]
+git-tree-sha1 = "8d59c3b1463b5e0ad05a3698167f85fac90e184d"
+uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
+version = "0.3.2"
+
+[[ArrayInterface]]
+deps = ["Requires", "Test"]
+git-tree-sha1 = "6a1a371393e56f5e8d5657fe4da4b11aea0bfbae"
+uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
+version = "0.1.1"
+
+[[Base64]]
+uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
+
+[[BinDeps]]
+deps = ["Compat", "Libdl", "SHA", "URIParser"]
+git-tree-sha1 = "12093ca6cdd0ee547c39b1870e0c9c3f154d9ca9"
+uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
+version = "0.8.10"
+
+[[BinaryProvider]]
+deps = ["Libdl", "Pkg", "SHA", "Test"]
+git-tree-sha1 = "055eb2690182ebc31087859c3dd8598371d3ef9e"
+uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
+version = "0.5.3"
+
+[[Blosc]]
+deps = ["BinaryProvider", "CMakeWrapper", "Compat", "Libdl"]
+git-tree-sha1 = "71fb23581e1f0b0ae7be8ccf0ebfb3600e23ca41"
+uuid = "a74b3585-a348-5f62-a45c-50e91977d574"
+version = "0.5.1"
+
+[[BufferedStreams]]
+deps = ["Compat", "Test"]
+git-tree-sha1 = "5d55b9486590fdda5905c275bb21ce1f0754020f"
+uuid = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d"
+version = "1.0.0"
+
+[[CMake]]
+deps = ["BinDeps", "Libdl", "Test"]
+git-tree-sha1 = "6e39bef3cbb8321e8a464b18a5c20d7cef813938"
+uuid = "631607c0-34d2-5d66-819e-eb0f9aa2061a"
+version = "1.1.1"
+
+[[CMakeWrapper]]
+deps = ["BinDeps", "CMake", "Libdl", "Parameters", "Test"]
+git-tree-sha1 = "2b43d451639984e3571951cc687b8509b0a86c6d"
+uuid = "d5fb7624-851a-54ee-a528-d3f3bac0b4a0"
+version = "0.2.2"
+
+[[CRC32c]]
+uuid = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
+
+[[Calculus]]
+deps = ["Compat"]
+git-tree-sha1 = "f60954495a7afcee4136f78d1d60350abd37a409"
+uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
+version = "0.4.1"
+
+[[ColorTypes]]
+deps = ["FixedPointNumbers", "Random", "Test"]
+git-tree-sha1 = "f73b0e10f2a5756de7019818a41654686da06b09"
+uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
+version = "0.7.5"
+
+[[Colors]]
+deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Printf", "Reexport", "Test"]
+git-tree-sha1 = "9f0a0210450acb91c730b730a994f8eef1d3d543"
+uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
+version = "0.9.5"
+
+[[CommonSubexpressions]]
+deps = ["Test"]
+git-tree-sha1 = "efdaf19ab11c7889334ca247ff4c9f7c322817b0"
+uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
+version = "0.2.0"
+
+[[Compat]]
+deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
+git-tree-sha1 = "49269e311ffe11ac5b334681d212329002a9832a"
+uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
+version = "1.5.1"
+
+[[Conda]]
+deps = ["Compat", "JSON", "VersionParsing"]
+git-tree-sha1 = "b625d802587c2150c279a40a646fba63f9bd8187"
+uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d"
+version = "1.2.0"
+
+[[Contour]]
+deps = ["LinearAlgebra", "StaticArrays", "Test"]
+git-tree-sha1 = "b974e164358fea753ef853ce7bad97afec15bb80"
+uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
+version = "0.5.1"
+
+[[ControlSystemIdentification]]
+deps = ["ControlSystems", "DSP", "FFTW", "FillArrays", "LinearAlgebra", "Optim", "Parameters", "Random", "RecipesBase", "Roots", "Statistics", "Test", "TotalLeastSquares"]
+git-tree-sha1 = "a061988a6d8c5c586eb121262319e8d6dcb1f5c7"
+repo-rev = "master"
+repo-url = "https://github.com/baggepinnen/ControlSystemIdentification.jl"
+uuid = "0861197f-74c3-5f66-9cd7-8a02bdf51734"
+version = "0.0.0"
+
+[[ControlSystems]]
+deps = ["Colors", "DSP", "IterTools", "LaTeXStrings", "LinearAlgebra", "OrdinaryDiffEq", "Plots", "Polynomials", "Printf", "SparseArrays", "Test"]
+git-tree-sha1 = "0c017cd077ef5d316766b9a55df02d9841ebd014"
+uuid = "a6e380b2-a6ca-5380-bf3e-84a91bcd477e"
+version = "0.5.0"
+
+[[DSP]]
+deps = ["AbstractFFTs", "Compat", "FFTW", "LinearAlgebra", "Polynomials", "Random", "Reexport", "SpecialFunctions"]
+git-tree-sha1 = "5ec38ebc4ddf6320ad50b826eb8fd7fb521993a5"
+uuid = "717857b8-e6f2-59f4-9121-6e50c889abd2"
+version = "0.5.2"
+
+[[DataStructures]]
+deps = ["InteractiveUtils", "OrderedCollections", "Random", "Serialization", "Test"]
+git-tree-sha1 = "ca971f03e146cf144a9e2f2ce59674f5bf0e8038"
+uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
+version = "0.15.0"
+
+[[Dates]]
+deps = ["Printf"]
+uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
+
+[[DelimitedFiles]]
+deps = ["Mmap"]
+uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
+
+[[DiffBase]]
+deps = ["StaticArrays"]
+git-tree-sha1 = "38522d70e417cf9ace93848f17eb9fff20d486d2"
+uuid = "c5cfe0b6-c10a-51a5-87e3-fd79235949f0"
+version = "0.3.2"
+
+[[DiffEqBase]]
+deps = ["Compat", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "RecursiveArrayTools", "Requires", "Roots", "SparseArrays", "StaticArrays", "Statistics", "SuiteSparse", "TableTraits", "Test", "TreeViews"]
+git-tree-sha1 = "c60ea94050751f09e3f86dc6182a4cccac9806b8"
+uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
+version = "4.32.0"
+
+[[DiffEqDiffTools]]
+deps = ["LinearAlgebra", "Test"]
+git-tree-sha1 = "67700c9fc82033ec68a145bc650f6b9debdf9103"
+uuid = "01453d9d-ee7c-5054-8395-0335cb756afa"
+version = "0.7.1"
+
+[[DiffEqOperators]]
+deps = ["DiffEqBase", "LinearAlgebra", "Random", "SparseArrays", "StaticArrays", "Test"]
+git-tree-sha1 = "332eea616ae687e7e4581602947ad5f053c7c650"
+uuid = "9fdde737-9c7f-55bf-ade8-46b3f136cc48"
+version = "3.4.0"
+
+[[DiffResults]]
+deps = ["Compat", "StaticArrays"]
+git-tree-sha1 = "db8acf46717b13d6c48deb7a12007c7f85a70cf7"
+uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
+version = "0.0.3"
+
+[[DiffRules]]
+deps = ["Random", "Test"]
+git-tree-sha1 = "09d69da75967ec48a8b1ad0897ec9144ee052bf9"
+uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
+version = "0.0.8"
+
+[[Distances]]
+deps = ["LinearAlgebra", "Printf", "Random", "Statistics", "Test"]
+git-tree-sha1 = "0e37d8a95bafbeb9c800ef27ab6f443d29e17610"
+uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
+version = "0.7.4"
+
+[[Distributed]]
+deps = ["LinearAlgebra", "Random", "Serialization", "Sockets"]
+uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
+
+[[DocStringExtensions]]
+deps = ["LibGit2", "Markdown", "Pkg", "Test"]
+git-tree-sha1 = "1df01539a1c952cef21f2d2d1c092c2bcf0177d7"
+uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
+version = "0.6.0"
+
+[[Documenter]]
+deps = ["Base64", "DocStringExtensions", "InteractiveUtils", "LibGit2", "Logging", "Markdown", "Pkg", "REPL", "Random", "Test", "Unicode"]
+git-tree-sha1 = "de745be4b00336588ab3269d5f43517e5c012973"
+uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
+version = "0.21.1"
+
+[[ExponentialUtilities]]
+deps = ["LinearAlgebra", "Printf", "Random", "SparseArrays", "Test"]
+git-tree-sha1 = "a25edb801ef3299b1c0fbbfe62692a074a82893b"
+uuid = "d4d017d3-3776-5f7e-afef-a10c40355c18"
+version = "1.3.0"
+
+[[FFTW]]
+deps = ["AbstractFFTs", "BinaryProvider", "Compat", "Conda", "Libdl", "LinearAlgebra", "Reexport", "Test"]
+git-tree-sha1 = "29cda58afbf62f35b1a094882ad6c745a47b2eaa"
+uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
+version = "0.2.4"
+
+[[FileIO]]
+deps = ["Pkg", "Random", "Test"]
+git-tree-sha1 = "c94b0787956629036fb2b20fccde9e52b89d079a"
+uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
+version = "1.0.5"
+
+[[FillArrays]]
+deps = ["LinearAlgebra", "Random", "SparseArrays", "Test"]
+git-tree-sha1 = "471b7e33dc9c9c5b9170045dd57c8ba0927b2918"
+uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
+version = "0.4.0"
+
+[[FixedPointNumbers]]
+deps = ["Test"]
+git-tree-sha1 = "b8045033701c3b10bf2324d7203404be7aef88ba"
+uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
+version = "0.5.3"
+
+[[ForwardDiff]]
+deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "InteractiveUtils", "LinearAlgebra", "NaNMath", "Random", "SparseArrays", "SpecialFunctions", "StaticArrays", "Test"]
+git-tree-sha1 = "e393bd3b9102659fb24fe88caedec41f2bc2e7de"
+uuid = "f6369f11-7733-5829-9624-2563aa707210"
+version = "0.10.2"
+
+[[GR]]
+deps = ["Base64", "DelimitedFiles", "LinearAlgebra", "Pkg", "Printf", "Random", "Serialization", "Sockets", "Test"]
+git-tree-sha1 = "3c62c19ddf86ff016829fdac1663cd3c75558c34"
+uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
+version = "0.37.0"
+
+[[GenericSVD]]
+deps = ["LinearAlgebra", "Random", "Test"]
+git-tree-sha1 = "8aa93c3f3d81562a8962047eafcc5712af0a0f59"
+uuid = "01680d73-4ee2-5a08-a1aa-533608c188bb"
+version = "0.2.1"
+
+[[HDF5]]
+deps = ["BinDeps", "Blosc", "CRC32c", "Distributed", "Homebrew", "Libdl", "LinearAlgebra", "Mmap", "Pkg", "Test", "WinRPM"]
+git-tree-sha1 = "dd83e1e9c72e44e3a156438b552cf75dbdda722f"
+uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
+version = "0.11.0"
+
+[[HTTPClient]]
+deps = ["Compat", "LibCURL"]
+git-tree-sha1 = "161d5776ae8e585ac0b8c20fb81f17ab755b3671"
+uuid = "0862f596-cf2d-50af-8ef4-f2be67dfa83f"
+version = "0.2.1"
+
+[[Homebrew]]
+deps = ["BinDeps", "InteractiveUtils", "JSON", "Libdl", "Test", "Unicode"]
+git-tree-sha1 = "f01fb2f34675f9839d55ba7238bab63ebd2e531e"
+uuid = "d9be37ee-ecc9-5288-90f1-b9ca67657a75"
+version = "0.7.1"
+
+[[InteractiveUtils]]
+deps = ["LinearAlgebra", "Markdown"]
+uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
+
+[[IterTools]]
+deps = ["SparseArrays", "Test"]
+git-tree-sha1 = "79246285c43602384e6f1943b3554042a3712056"
+uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
+version = "1.1.1"
+
+[[IteratorInterfaceExtensions]]
+deps = ["Test"]
+git-tree-sha1 = "5484e5ede2a4137b9643f4d646e8e7b87b794415"
+uuid = "82899510-4779-5014-852e-03e436cf321d"
+version = "0.1.1"
+
+[[JLD]]
+deps = ["Compat", "FileIO", "HDF5", "LegacyStrings", "Profile", "Random"]
+git-tree-sha1 = "95fd5d7f129918a75d0535aaaf5b8e235e6e0b0b"
+uuid = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
+version = "0.9.1"
+
+[[JSON]]
+deps = ["Dates", "Distributed", "Mmap", "Sockets", "Test", "Unicode"]
+git-tree-sha1 = "1f7a25b53ec67f5e9422f1f551ee216503f4a0fa"
+uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
+version = "0.20.0"
+
+[[LaTeXStrings]]
+deps = ["Compat"]
+git-tree-sha1 = "7ab9b8788cfab2bdde22adf9004bda7ad9954b6c"
+uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
+version = "1.0.3"
+
+[[LabProcesses]]
+deps = ["ControlSystems", "DSP", "LinearAlgebra", "Parameters", "Pkg", "Test"]
+git-tree-sha1 = "c0caf55a5062b94dc844927f782827c6e04a6340"
+repo-rev = "master"
+repo-url = "https://gitlab.control.lth.se/processes/LabProcesses.jl"
+uuid = "6929cf19-6a72-5044-8237-19d456703100"
+version = "0.0.0"
+
+[[LegacyStrings]]
+deps = ["Compat"]
+git-tree-sha1 = "d4b9bde2694c552fe579cc4462733f1ce08733fe"
+uuid = "1b4a561d-cfcb-5daf-8433-43fcf8b4bea3"
+version = "0.4.1"
+
+[[LibCURL]]
+deps = ["BinaryProvider", "Compat", "Libdl", "Printf"]
+git-tree-sha1 = "6339c87cb76923a3cf947fcd213cbc364355c9c9"
+uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
+version = "0.4.1"
+
+[[LibExpat]]
+deps = ["Compat"]
+git-tree-sha1 = "fde352ec13479e2f90e57939da2440fb78c5e388"
+uuid = "522f3ed2-3f36-55e3-b6df-e94fee9b0c07"
+version = "0.5.0"
+
+[[LibGit2]]
+uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
+
+[[Libdl]]
+uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
+
+[[Libz]]
+deps = ["BufferedStreams", "Random", "Test"]
+git-tree-sha1 = "d405194ffc0293c3519d4f7251ce51baac9cc871"
+uuid = "2ec943e9-cfe8-584d-b93d-64dcb6d567b7"
+version = "1.0.0"
+
+[[LineSearches]]
+deps = ["LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "Printf", "Test"]
+git-tree-sha1 = "54eb90e8dbe745d617c78dee1d6ae95c7f6f5779"
+uuid = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
+version = "7.0.1"
+
+[[LinearAlgebra]]
+deps = ["Libdl"]
+uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
+
+[[Logging]]
+uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
+
+[[MacroTools]]
+deps = ["Compat"]
+git-tree-sha1 = "c443e1c8d58a4e9f61b708ad0a88286c7042145b"
+uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
+version = "0.4.4"
+
+[[Markdown]]
+deps = ["Base64"]
+uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
+
+[[Measures]]
+deps = ["Test"]
+git-tree-sha1 = "ddfd6d13e330beacdde2c80de27c1c671945e7d9"
+uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
+version = "0.3.0"
+
+[[Missings]]
+deps = ["Dates", "InteractiveUtils", "SparseArrays", "Test"]
+git-tree-sha1 = "d1d2585677f2bd93a97cfeb8faa7a0de0f982042"
+uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
+version = "0.4.0"
+
+[[Mmap]]
+uuid = "a63ad114-7e13-5084-954f-fe012c677804"
+
+[[MuladdMacro]]
+deps = ["MacroTools", "Test"]
+git-tree-sha1 = "41e6e7c4b448afeaddaac7f496b414854f83b848"
+uuid = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
+version = "0.2.1"
+
+[[NLSolversBase]]
+deps = ["Calculus", "DiffEqDiffTools", "DiffResults", "Distributed", "ForwardDiff", "LinearAlgebra", "Random", "SparseArrays", "Test"]
+git-tree-sha1 = "5a1d1b047ffb18eb72cc898245eaef3e2dd63762"
+uuid = "d41bc354-129a-5804-8e4c-c37616107c6c"
+version = "7.1.2"
+
+[[NLsolve]]
+deps = ["DiffBase", "DiffEqDiffTools", "Distances", "ForwardDiff", "LineSearches", "LinearAlgebra", "NLSolversBase", "Printf", "Reexport", "SparseArrays", "Test"]
+git-tree-sha1 = "0e046f4f72801c9782d64db972ce66a85d3473f1"
+uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
+version = "3.0.1"
+
+[[NaNMath]]
+deps = ["Compat"]
+git-tree-sha1 = "ce3b85e484a5d4c71dd5316215069311135fa9f2"
+uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
+version = "0.3.2"
+
+[[Optim]]
+deps = ["Calculus", "DiffEqDiffTools", "ForwardDiff", "LineSearches", "LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "PositiveFactorizations", "Printf", "Random", "SparseArrays", "StatsBase", "Test"]
+git-tree-sha1 = "0f2a6c6ff9db396cc7af15bb1cf057a26662ff17"
+uuid = "429524aa-4258-5aef-a3af-852621145aeb"
+version = "0.17.2"
+
+[[OrderedCollections]]
+deps = ["Random", "Serialization", "Test"]
+git-tree-sha1 = "85619a3f3e17bb4761fe1b1fd47f0e979f964d5b"
+uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
+version = "1.0.2"
+
+[[OrdinaryDiffEq]]
+deps = ["DataStructures", "DiffEqBase", "DiffEqDiffTools", "DiffEqOperators", "ExponentialUtilities", "ForwardDiff", "GenericSVD", "InteractiveUtils", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "Parameters", "Printf", "Random", "RecursiveArrayTools", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "Test"]
+git-tree-sha1 = "bd2695f7010757296ad4414738913ee778dc738d"
+uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
+version = "4.21.1"
+
+[[Parameters]]
+deps = ["Markdown", "OrderedCollections", "REPL", "Test"]
+git-tree-sha1 = "70bdbfb2bceabb15345c0b54be4544813b3444e4"
+uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a"
+version = "0.10.3"
+
+[[Pkg]]
+deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
+uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
+
+[[PlotThemes]]
+deps = ["PlotUtils", "Requires", "Test"]
+git-tree-sha1 = "f3afd2d58e1f6ac9be2cea46e4a9083ccc1d990b"
+uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
+version = "0.3.0"
+
+[[PlotUtils]]
+deps = ["Colors", "Dates", "Printf", "Random", "Reexport", "Test"]
+git-tree-sha1 = "fd28f30a294a38ec847de95d8ac7ac916ccd7c06"
+uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
+version = "0.5.5"
+
+[[Plots]]
+deps = ["Base64", "Contour", "Dates", "FixedPointNumbers", "GR", "JSON", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "Printf", "REPL", "Random", "RecipesBase", "Reexport", "Requires", "Showoff", "SparseArrays", "StaticArrays", "Statistics", "StatsBase", "Test", "UUIDs"]
+git-tree-sha1 = "1c345ad538fa31ea6953d89a9d0cbef21e86a3ed"
+uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
+version = "0.23.0"
+
+[[Polynomials]]
+deps = ["LinearAlgebra", "SparseArrays", "Test"]
+git-tree-sha1 = "62142bd65d3f8aeb2226ec64dd8493349147df94"
+uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
+version = "0.5.2"
+
+[[PositiveFactorizations]]
+deps = ["LinearAlgebra", "Test"]
+git-tree-sha1 = "86ae7329c4b5c266acf5c7c524a972300d991e1c"
+uuid = "85a6dd25-e78a-55b7-8502-1745935b8125"
+version = "0.2.1"
+
+[[Printf]]
+deps = ["Unicode"]
+uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
+
+[[Profile]]
+deps = ["Printf"]
+uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
+
+[[ProgressMeter]]
+deps = ["Distributed", "Printf", "Random", "Test"]
+git-tree-sha1 = "48058bc11607676e5bbc0b974af79106c6200787"
+uuid = "92933f4c-e287-5a05-a399-4b506db050ca"
+version = "0.9.0"
+
+[[REPL]]
+deps = ["InteractiveUtils", "Markdown", "Sockets"]
+uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
+
+[[Random]]
+deps = ["Serialization"]
+uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
+
+[[RecipesBase]]
+deps = ["Random", "Test"]
+git-tree-sha1 = "0b3cb370ee4dc00f47f1193101600949f3dcf884"
+uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
+version = "0.6.0"
+
+[[RecursiveArrayTools]]
+deps = ["ArrayInterface", "RecipesBase", "Requires", "StaticArrays", "Statistics", "Test"]
+git-tree-sha1 = "187ea7dd541955102c7035a6668613bdf52022ca"
+uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
+version = "0.20.0"
+
+[[Reexport]]
+deps = ["Pkg"]
+git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
+uuid = "189a3867-3050-52da-a836-e630ba90ab69"
+version = "0.2.0"
+
+[[Requires]]
+deps = ["Test"]
+git-tree-sha1 = "f6fbf4ba64d295e146e49e021207993b6b48c7d1"
+uuid = "ae029012-a4dd-5104-9daa-d747884805df"
+version = "0.5.2"
+
+[[Roots]]
+deps = ["Compat", "Printf"]
+git-tree-sha1 = "2e7171b6f3b58b81201ba37d9e1220aff6d904a1"
+uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
+version = "0.7.4"
+
+[[SHA]]
+uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
+
+[[Serialization]]
+uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
+
+[[SharedArrays]]
+deps = ["Distributed", "Mmap", "Random", "Serialization"]
+uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
+
+[[Showoff]]
+deps = ["Compat"]
+git-tree-sha1 = "276b24f3ace98bec911be7ff2928d497dc759085"
+uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
+version = "0.2.1"
+
+[[Sockets]]
+uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
+
+[[SortingAlgorithms]]
+deps = ["DataStructures", "Random", "Test"]
+git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd"
+uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
+version = "0.3.1"
+
+[[SparseArrays]]
+deps = ["LinearAlgebra", "Random"]
+uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
+
+[[SpecialFunctions]]
+deps = ["BinDeps", "BinaryProvider", "Libdl", "Test"]
+git-tree-sha1 = "0b45dc2e45ed77f445617b99ff2adf0f5b0f23ea"
+uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
+version = "0.7.2"
+
+[[StaticArrays]]
+deps = ["InteractiveUtils", "LinearAlgebra", "Random", "Statistics", "Test"]
+git-tree-sha1 = "1eb114d6e23a817cd3e99abc3226190876d7c898"
+uuid = "90137ffa-7385-5640-81b9-e52037218182"
+version = "0.10.2"
+
+[[Statistics]]
+deps = ["LinearAlgebra", "SparseArrays"]
+uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
+
+[[StatsBase]]
+deps = ["DataStructures", "DelimitedFiles", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "Test"]
+git-tree-sha1 = "7b596062316c7d846b67bf625d5963a832528598"
+uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
+version = "0.27.0"
+
+[[SuiteSparse]]
+deps = ["Libdl", "LinearAlgebra", "SparseArrays"]
+uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
+
+[[TableTraits]]
+deps = ["IteratorInterfaceExtensions", "Test"]
+git-tree-sha1 = "eba4b1d0a82bdd773307d652c6e5f8c82104c676"
+uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
+version = "0.4.1"
+
+[[Test]]
+deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
+uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
+
+[[TotalLeastSquares]]
+deps = ["FillArrays", "LinearAlgebra", "Printf", "Random", "SparseArrays", "Statistics", "Test"]
+git-tree-sha1 = "65a44f8159e02bccedf975365be8d7f5d78e317b"
+uuid = "028f657a-7ace-5159-a694-8cfd97933b0c"
+version = "0.1.1"
+
+[[TreeViews]]
+deps = ["Test"]
+git-tree-sha1 = "8d0d7a3fe2f30d6a7f833a5f19f7c7a5b396eae6"
+uuid = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7"
+version = "0.3.0"
+
+[[URIParser]]
+deps = ["Test", "Unicode"]
+git-tree-sha1 = "6ddf8244220dfda2f17539fa8c9de20d6c575b69"
+uuid = "30578b45-9adc-5946-b283-645ec420af67"
+version = "0.4.0"
+
+[[UUIDs]]
+deps = ["Random"]
+uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
+
+[[Unicode]]
+uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
+
+[[VersionParsing]]
+deps = ["Compat"]
+git-tree-sha1 = "c9d5aa108588b978bd859554660c8a5c4f2f7669"
+uuid = "81def892-9a0e-5fdd-b105-ffc91e053289"
+version = "1.1.3"
+
+[[WinRPM]]
+deps = ["BinDeps", "Compat", "HTTPClient", "LibExpat", "Libdl", "Libz", "URIParser"]
+git-tree-sha1 = "2a889d320f3b77d17c037f295859fe570133cfbf"
+uuid = "c17dfb99-b4f7-5aad-8812-456da1ad7187"
+version = "0.4.2"
diff --git a/Project.toml b/Project.toml
new file mode 100644
index 0000000000000000000000000000000000000000..a68942256ac3a5375af9627ad107ab810f7ab1c3
--- /dev/null
+++ b/Project.toml
@@ -0,0 +1,11 @@
+[deps]
+ControlSystemIdentification = "0861197f-74c3-5f66-9cd7-8a02bdf51734"
+ControlSystems = "a6e380b2-a6ca-5380-bf3e-84a91bcd477e"
+DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
+Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
+GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
+JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
+LabProcesses = "6929cf19-6a72-5044-8237-19d456703100"
+Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
+Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
+ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
diff --git a/README.md b/README.md
index 979f14990697b4cf20396cf3b928c687cb1c2d0d..e8dde868b65176a38b6b92d1f2079e12714bac23 100644
--- a/README.md
+++ b/README.md
@@ -3,26 +3,23 @@
 
 # Installation (specific to lab 1 FRTN35: Frequency response analysis)
 0. If you run on your personal computer, you *might* need to install Julia.
-Download and install Julia v0.6+ from [julialang.org](https://julialang.org/downloads/).
+Download and install Julia v1.0+ from [julialang.org](https://julialang.org/downloads/).
 If you prefer a "batteries included" approach with an IDE, download and install
 the free version of [Julia Pro](https://juliacomputing.com/products/juliapro.html).
 1. Open a terminal
 2. Type `mkdir FRTN35_lab1; cd FRTN35_lab1`
 3. Paste the following in a terminal
 ```
-printf 'export JULIA_PKGDIR=/var/tmp/$USER\n' > julialab1
+printf 'export JULIA_DEPOT_PATH=/var/tmp/$USER\n' > julialab1
 printf 'export JULIA_EDITOR=gedit\n' >> julialab1
 printf 'julia\n' >> julialab1
 chmod +x julialab1
 ```
 (Feel free to choose another text editor if you don't like gedit.) This step only needs to be done once. Henceforth you can start julia with the environment setup by running `./julialab1` in the current directory.
 4. Start `./julialab`
-5. Install `BallAndBeam.jl` using command `Pkg.clone("https://gitlab.control.lth.se/processes/BallAndBeam.jl.git"); using BallAndBeam` Lots of packages will now be installed, this will take some time.
-6. Type `cp(Pkg.dir("BallAndBeam","src","FRTN35_lab1.jl"), "FRTN35_lab1.jl"); edit("FRTN35_lab1.jl")`. The script `FRTN35_lab1.jl` will now open in the chosen text editor, edit it while following the lab manual. If unsure about how a function works, type `?function_name` for help.
-
-printf 'export JULIA_PKGDIR=/var/tmp/$USER; export JULIA_EDITOR=gedit' > julialab
-printf 'julia' >> julialab
-chmod +x julialab
+5. Install `BallAndBeam.jl` using command `using Pkg; Pkg.add("https://gitlab.control.lth.se/processes/BallAndBeam.jl.git"); using BallAndBeam` Lots of packages will now be installed, this will take some time.
+6. Type `cp(joinpath(pathof(BallAndBeam),"src","FRTN35_lab1.jl")), "FRTN35_lab1.jl"); edit("FRTN35_lab1.jl")`. The script `FRTN35_lab1.jl` will now open in the chosen text editor, edit it while following the lab manual. If unsure about how a function works, type `?function_name` for help.
+7. Run `Pkg.activate(pathof(BallAndBeam))` to install further required packages.
 
 
 # Documentation
diff --git a/REQUIRE b/REQUIRE
index ac8656465a4e7bb5e245010a93cdf061e44b0652..ca27e579296d1a5631849568697076b656ec0c32 100644
--- a/REQUIRE
+++ b/REQUIRE
@@ -1,3 +1,4 @@
+julia 1.0
 Plots
 GR
 ControlSystems
@@ -5,3 +6,4 @@ Polynomials
 ProgressMeter
 JLD
 Documenter
+DSP
diff --git a/src/BallAndBeam.jl b/src/BallAndBeam.jl
index 0cfa11a59f291bc730a710f86cd810b36b144db2..fcd40a7d1a28d602858e68b74338c9682651f7ee 100644
--- a/src/BallAndBeam.jl
+++ b/src/BallAndBeam.jl
@@ -1,7 +1,4 @@
-installed_packages = Pkg.installed()
-if "LabProcesses" ∉ keys(installed_packages)
-	Pkg.clone("https://gitlab.control.lth.se/processes/LabProcesses.jl.git")
-end
+using Pkg
 
 #__precompile__()
 
@@ -19,7 +16,7 @@ bopl, bopl!, nypl, nypl!, plot, fbdesign, ffdesign, opendoc
 export SysFilter, run_control_2DOF # For documentation
 
 
-using LabProcesses, Plots, Polynomials, ControlSystems, ProgressMeter
+using LabProcesses, Plots, Polynomials, ControlSystems, ProgressMeter, DSP, LinearAlgebra, Statistics
 
 include("arx.jl")
 
@@ -30,18 +27,18 @@ Perform fra-experiemnt For a single frequency `ω`. Called from inside `fra`
 """
 function run_experiment(P::Beam, ω, duration, settling_time, amplitude)
 	h       = sampletime(P)
-	data    = zeros(0:h:duration)
+	data    = zeros(length(0:h:duration))
 	LabProcesses.initialize(P)
 	for t = 0:h:settling_time
 		@periodically h begin
-			u              = amplitude*sin(ω*t)
+			u = amplitude*sin(ω*t)
 			control(P, u + bias(P))
 		end
 	end
 	for (i,t) = enumerate(0:h:duration)
 		@periodically h begin
-			data[i]        = measure(P)
-			u              = amplitude*sin(ω*t)
+			data[i] = measure(P)
+			u       = amplitude*sin(ω*t)
 			control(P, u + bias(P))
 		end
 	end
@@ -51,7 +48,7 @@ end
 
 function run_experiment(P::BeamSimulator, ω, duration, settling_time, amplitude)
 	h       = sampletime(P)
-	data    = zeros(0:h:duration)
+	data    = zeros(length(0:h:duration))
 	LabProcesses.initialize(P)
 	for t = 0:h:settling_time
 		u = amplitude*sin(ω*t)
@@ -86,10 +83,10 @@ function fra(P::AbstractBeam, Ω::AbstractVector;
 			nbr_of_periods = 10,
 			amplitude 	   = 1)
     h = sampletime(P)
-	G = zeros(Complex, size(Ω)) 				      # Transfer function
+	G = zeros(Complex, size(Ω)) 				  # Transfer function
 
 	@showprogress 1 "Running experiments"  for (i,ω) = enumerate(Ω)
-		T               = 2π/ω 			      # Period time
+		T               = 2π/ω 			          # Period time
 		settling_time_i = ceil(settling_time/T)*T # Settling time even number of periods
 		duration        = nbr_of_periods*T
 		data            = run_experiment(P,ω,duration,settling_time_i, amplitude)
@@ -139,10 +136,16 @@ end
 
 @recipe function Nypl(p::Nypl)
 	G = p.args[1]
+	@series begin
+		linestyle := :dash
+		color := :black
+		α = LinRange(0,2π,100)
+		cos.(α),sin.(α)
+	end
 	xlabel --> "\$Re(G)\$"
 	ylabel --> "\$Im(G)\$"
 	title  --> "Nyquist plot"
-	real.(G[:,2]), imag.(G[:,2])
+	@series real.(G[:,2]), imag.(G[:,2])
 end
 
 
@@ -175,7 +178,7 @@ function fbdesign(G::AbstractMatrix, polevect, zerovect, gain)
 	sysFB = ss(zpk(zerovect,polevect,gain*prod(abs.(polevect))/pzv))
 	C = Number[ω freqresp(sysFB, ω)]
 	L = Number[ω G[:,2].*C[:,2]]
-	T = Number[ω L[:,2]./(1+L[:,2])]
+	T = Number[ω L[:,2]./(1 .+L[:,2])]
 	sysFB,L,T,C
 end
 
@@ -201,8 +204,8 @@ poles2poly(poles) = reduce((r,l) -> conv(r,[1, l]), [1], poles) #|> reverse |> P
 Build and launch the documentation website.
 """
 function opendoc()
-	include(Pkg.dir("BallAndBeam", "docs","make.jl"))
-	docpath = Pkg.dir("BallAndBeam", "docs","build","index.html")
+	include(joinpath(dirname(pathof("BallAndBeam")), "docs","make.jl"))
+	docpath = joinpath(dirname(pathof("BallAndBeam")), "docs","build","index.html")
 	run(`xdg-open $docpath`)
 end
 
diff --git a/src/FRTN35_lab1.jl b/src/FRTN35_lab1.jl
index 7d0d7938ce8be922249e895f58ec573bc0c72e59..b0342cc4b85c8b62dcfd34623e074f47e7c0856c 100644
--- a/src/FRTN35_lab1.jl
+++ b/src/FRTN35_lab1.jl
@@ -1,4 +1,4 @@
-using BallAndBeam, ControlSystems, JLD, LabProcesses, Plots
+using BallAndBeam, ControlSystems, ControlSystemIdentification, LabProcesses, Plots, JLD
 # @load "workspace.jld" # Run this command to restore a saved workspace
 
 P    = LabProcesses.Beam(bias = 0.)  # Replace for BeamSimulator() to run simulations
@@ -11,15 +11,15 @@ nbr_of_periods = 3
 # and run three experiments. You may modify the freqency vectors
 # any way you want and add/remove experiments as needed.
 
-w1_100 = logspace(log10(1),log10(300),8)
+w1_100 = exp10.(LinRange(log10(1),log10(300),8)) # exp10.(LinRange = logspace
 G1     = fra(P, w1_100, amplitude=1, nbr_of_periods=nbr_of_periods, settling_time=settling_time)
 @save "workspace.jld"
 
-w1_200 = logspace(log10(50),log10(100),10)
+w1_200 = exp10.(LinRange(log10(50),log10(100),10))
 G2     = fra(P, w1_200, amplitude=2, nbr_of_periods=nbr_of_periods, settling_time=settling_time)
 @save "workspace.jld"
 
-w1_300 = logspace(log10(100),log10(300),20)
+w1_300 = exp10.(LinRange(log10(100),log10(300),20))
 G3     = fra(P, w1_300, amplitude=2, nbr_of_periods=nbr_of_periods, settling_time=settling_time)
 @save "workspace.jld"
 
@@ -35,7 +35,7 @@ nypl(G123, m=:star)
 polevect = [-10]
 zerovect = []
 gain     = 1
-sysFBc,L,T,C = fbdesign(G, polevect, zerovect, gain)
+sysFBc,L,T,C = fbdesign(G123, polevect, zerovect, gain)
 
 polevect = [-10]
 zerovect = []
@@ -55,8 +55,8 @@ plot([y u r], lab = ["y" "u" "r"])
 # If you have time, estimate ARX model =====================================================
 prbs     = PRBSGenerator()
 function prbs_experiment(;amplitude = 1, duration = 10)
-    y = zeros(0:h:duration)
-    u = zeros(0:h:duration)
+    y = zeros(length(0:h:duration))
+    u = zeros(length(0:h:duration))
     LabProcesses.initialize(P)
     for (i,t) = enumerate(0:h:duration)
         @periodically h begin
@@ -71,12 +71,12 @@ function prbs_experiment(;amplitude = 1, duration = 10)
     y,u
 end
 y,u = prbs_experiment(duration = 10, amplitude = 1)
-plot([y u], lab=["y" "u"])
+plot([u y], lab=["u" "y"])
+
+bopl(G123, lab="FRA", legend=:left)
 
 na = 4 # Order of A polynomial
 nb = 2 # Order of B polynomial
 arxtf, Σ = arx(h, y, u, na, nb) # Estimate transfer function with ARX method
-
-bopl(G123, lab="Measured transfer function")
-bodeconfidence!(arxtf, Σ, ω = logspace(0,3,200), linecolor=:red) # The exclamation mark (!)
+bodeconfidence!(arxtf, Σ, ω = exp10.(LinRange(0,3,200)), lab="ARX na=$(na)") # The exclamation mark (!)
 # adds to the previous plot. If there is no plot open, remove the !
diff --git a/src/arx.jl b/src/arx.jl
deleted file mode 100644
index 13017c2c2318e7282da617dd0cee807998f64af6..0000000000000000000000000000000000000000
--- a/src/arx.jl
+++ /dev/null
@@ -1,182 +0,0 @@
-export toeplitz, getARXregressor, find_na, arx, bopl_confidence, bopl_confidence!
-
-
-## Helper functions
-rms(x) = sqrt(mean(x.^2))
-sse(x) = sum(x.^2)
-fit(y,yh) = 100 * (1-rms(y-yh)./rms(y-mean(y)));
-aic(x,d) = log(sse(x)) + 2d/length(x)
-
-"""
-    toeplitz{T}(c::AbstractArray{T},r::AbstractArray{T})
-Returns a Toeplitz matrix where `c` is the first column and `r` is the first row.
-"""
-function toeplitz{T}(c::AbstractVector{T},r::AbstractVector{T})
-    nc = length(c)
-    nr = length(r)
-    A = zeros(T, nc, nr)
-    A[:,1] = c
-    A[1,:] = r
-    for i in 2:nr
-        A[2:end,i] = A[1:end-1,i-1]
-    end
-    A
-end
-
-"""
-    getARXregressor(y::AbstractVector,u::AbstractVecOrMat, na, nb)
-Returns a shortened output signal `y` and a regressor matrix `A` such that the least-squares ARX model estimate of order `na,nb` is `y\\A`
-Return a regressor matrix used to fit an ARX model on, e.g., the form
-`A(z)y = B(z)f(u)`
-with output `y` and input `u` where the order of autoregression is `na` and
-the order of input moving average is `nb`
-# Example
-Here we test the model with the Function `f(u) = √(|u|)`
-```julia
-A     = [1,2*0.7*1,1] # A(z) coeffs
-B     = [10,5] # B(z) coeffs
-u     = randn(100) # Simulate 100 time steps with Gaussian input
-y     = filt(B,A,u)
-yr,A  = getARXregressor(y,u,3,2) # We assume that we know the system order 3,2
-x     = A\yr # Estimate model polynomials
-plot([yr A*x], lab=["Signal" "Prediction"])
-```
-For nonlinear ARX-models, see [BasisFunctionExpansions.jl](https://github.com/baggepinnen/BasisFunctionExpansions.jl/)
-"""
-function getARXregressor(y::AbstractVector{Float64},u::AbstractVecOrMat{Float64}, na, nb)
-    assert(length(nb) == size(u,2))
-    m    = max(na+1,maximum(nb))
-    n    = length(y) - m+1
-    offs = m-na-1
-    A    = toeplitz(y[offs+na+1:n+na+offs],y[offs+na+1:-1:1])
-    y    = copy(A[:,1])
-    A    = A[:,2:end]
-    for i = 1:length(nb)
-        offs = m-nb[i]
-        A = [A toeplitz(u[nb[i]+offs:n+nb[i]+offs-1,i],u[nb[i]+offs:-1:1+offs,i])]
-    end
-    return y,A
-end
-
-"""
-    find_na(y::AbstractVector,n::Int)
-Plots the RMSE and AIC For model orders up to `n`. Useful for model selection
-"""
-function find_na(y::AbstractVector,n::Int)
-    error = zeros(n,2)
-    for i = 1:n
-        w,e = ar(y,i)
-        error[i,1] = rms(e)
-        error[i,2] = aic(e,i)
-        print(i,", ")
-    end
-    println("Done")
-    scatter(error, show=true)
-end
-
-"""
-    Gtf, Σ = arx(h,y, u, na, nb; λ = 0)
-Fit a transfer Function to data using an ARX model.
-`nb` and `na` are the orders of the numerator and denominator polynomials.
-"""
-function arx(h,y::AbstractVector{Float64}, u::AbstractVector{Float64}, na, nb; λ = 0)
-    na -= 1
-    y_train, A = getARXregressor(y,u, na, nb)
-
-    if λ == 0
-        w = A\y_train
-    else
-        w = (A'A + λ*eye(size(A,2)))\A'y_train
-    end
-    a,b = params2poly(w,na,nb)
-    model = tf(b,a,h)
-    Σ = parameter_covariance(y_train, A, w, λ)
-    return model, Σ
-end
-
-"""
-    a,b = params2poly(params,na,nb)
-"""
-function params2poly(w,na,nb)
-    a = [1; -w[1:na]]
-    b = w[na+1:end]
-    a,b
-end
-
-"""
-    Σ = parameter_covariance(y_train, A, w, λ=0)
-"""
-function parameter_covariance(y_train, A, w, λ=0)
-    σ² = var(y_train .- A*w)
-    iATA = if λ == 0
-        inv(A'A)
-    else
-        ATA = A'A
-        ATAλ = factorize(ATA + λ*I)
-        ATAλ\ATA/ATAλ
-    end
-    iATA = (iATA+iATA')/2
-    Σ = σ²*iATA + sqrt(eps())*eye(iATA)
-end
-
-"""
-    bodeconfidence(arxtf::TransferFunction, Σ::Matrix; ω = logspace(0,3,200))
-Plot a bode diagram of a transfer function estimated with [`arx`](@ref) with confidence bounds on magnitude and phase.
-"""
-bodeconfidence
-
-@userplot BodeConfidence
-
-@recipe function BodeConfidence(p::BodeConfidence; ω = logspace(-2,3,200))
-    arxtfm = p.args[1]
-    Σ      = p.args[2]
-    L      = chol(Hermitian(Σ))
-    am, bm = -reverse(denpoly(arxtfm)[1].a[1:end-1]), reverse(arxtfm.matrix[1].num.a)
-    wm     = [am; bm]
-    na,nb  = length(am), length(bm)
-    mc     = 100
-    res = map(1:mc) do _
-        w             = L'randn(size(L,1)) .+ wm
-        a,b           = params2poly(w,na,nb)
-        arxtf         = tf(b,a,arxtfm.Ts)
-        mag, phase, _ = bode(arxtf, ω)
-        mag[:], phase[:]
-    end
-    magmc      = hcat(getindex.(res,1)...)
-    phasemc    = hcat(getindex.(res,2)...)
-    mag        = mean(magmc,2)[:]
-    phase      = mean(phasemc,2)[:]
-    uppermag   = getpercentile(magmc,0.95)
-    lowermag   = getpercentile(magmc,0.05)
-    upperphase = getpercentile(phasemc,0.95)
-    lowerphase = getpercentile(phasemc,0.05)
-
-    layout := (2,1)
-
-    @series begin
-        subplot := 1
-        title --> "ARX estimate"
-        ylabel --> "Magnitude"
-        ribbon := (lowermag, uppermag)
-        yscale --> :log10
-        xscale --> :log10
-        alpha --> 0.3
-        ω, mag
-    end
-    @series begin
-        subplot := 2
-        ribbon := (lowerphase, upperphase)
-        ylabel --> "Phase [deg]"
-        xlabel --> "Frequency [rad/s]"
-        xscale --> :log10
-        alpha --> 0.3
-        ω, phase
-    end
-    nothing
-end
-
-function getpercentile(mag,p)
-    uppermag = mapslices(mag, 2) do magω
-        sort(magω)[round(Int,endof(magω)*p)]
-    end
-end