View LsqFitExample.jl
This file contains 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
""" | |
fit_data(model, tdata, ydata, p0) | |
Fit the model function `model` to the data `ydata` at time points `tdata` | |
using initial parameters `p0`. | |
# Arguments | |
- `model::Function`: The model function to fit. | |
- `tdata::Vector`: A vector of time points. | |
- `ydata::Vector`: A vector of corresponding data points. |
View VecVec_to_Array
This file contains 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
""" | |
# Convert a vector of vectors to an array | |
This function assumes that each vector is the same length; | |
i.e. | |
v1 = [ [1,2], [2,3], [5,6] ] # this is fine | |
v2 = [ [1,2,8], [2,3], [5,6] ] # this is not fine | |
Example of usage: | |
``` | |
vv = [[1,2,3], [4,5,6], [7,8,9],[12,13,14]] |
View Plot_Import_Header
This file contains 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
using Plots | |
gr() | |
using LaTeXStrings, Measures | |
default(fontfamily = "Computer Modern", size=(800,500), titlefont = (16), legendfontsize = 10, | |
guidefont = (16, :darkgreen), tickfont = (12, :black), | |
framestyle = :box, yminorgrid = true) | |
plot([sin, cos], -2π, 2π, label = [L"\sin(θ)" L"\cos(θ)"], | |
linewidth = 2, linealpha=0.7, legend = :outertopright) | |
plot!(xticks = ([-2π:π:2*π;], ["-2π", "-π", "0", "π", "2π"])) |