Skip to content

Commit ce3c806

Browse files
Update SINDy_module.jl
1 parent 64ebad7 commit ce3c806

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Identifying Nonlinear Dynamics/Julia Scripts/SINDy_module.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ function sindy(dxdt, Θ, total_dim, lam=0.01)
3838
return Xi_new
3939
end
4040

41-
function print_model(Xi_new, mons,total_dim)
41+
function print_model(Xi_new, mons,total_dim, print_f=["dx/dt", "dy/dt", "dz/dt"], lam=1e-3)
4242
println("Discovered Model using SINDy: ")
4343
for ind = 1:total_dim
44-
println("d" * mons[ind+1] *"/dt = ")
45-
bigcoeffs = abs.(Xi_new[ind,:]) .> 1e-3; # chosen small just to weed out zero coefficients
44+
println(print_f[ind] * " = ")
45+
bigcoeffs = abs.(Xi_new[ind,:]) .> lam; # chosen small just to weed out zero coefficients
4646
for jnd = eachindex(bigcoeffs)
4747
if bigcoeffs[jnd] == 1
4848
# Print the model by excluding zeroed out terms
@@ -58,4 +58,4 @@ function print_model(Xi_new, mons,total_dim)
5858
end
5959
print("\n")
6060
end
61-
end
61+
end

0 commit comments

Comments
 (0)