Skip to content

Commit

Permalink
updated brownian in plot
Browse files Browse the repository at this point in the history
  • Loading branch information
mfalt committed Sep 5, 2017
1 parent fc02ae8 commit b5af14a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions examples/plotall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function plotall(Λ,ℓ,t,g, both=true)
plot!(p, y, x, l=:red, subplot=k, lab="$I, $ystr, $fstr", ylims=(-4,4), xlims=(0,6))
if both && length(I) > 1 && fI != NaN
Y, _ = dev.find_optimal_y_values(ℓ, I)
tcont = linspace(t[1],t[end])
tcont = linspace(t[1],t[end], 100*length(t))
plot!(p, tcont/t[end]*(N-1)+1, g.(tcont), l=:blue, lab="", subplot=k+N-1)
plot!(p, I, Y, m=:circle, l=:red, lab="", subplot=k+N-1)
end
Expand All @@ -39,18 +39,21 @@ function plotall(Λ,ℓ,t,g, both=true)
return p
end

function brownian(t)
N = length(t)
ran = cumsum(0.1*randn(10*N))
return t -> ran[floor(Int64, t*10/2pi*(N-1))+1]
end
N = 7
t = linspace(0,2π,N)
#g = Poly([0,0,1,-1])
ran = cumsum(0.1*randn(10*N))
z(t) = ran[floor(Int64, t*10/2pi*(N-1))+1]
g = sin
g2(t) = z(t)
= dev.compute_transition_costs(g2, t);

g = brownian(t)
= dev.compute_transition_costs(g, t);

Λ_0 = [dev.create_new_pwq(dev.minimize_wrt_x2(ℓ[i, N])) for i in 1:N-1];
Λ, t2, _, _, _ = @timed dev.find_optimal_fit(Λ_0, ℓ, N-1);
plotly()
p = plotall(Λ,ℓ,t,g2, true);
p = plotall(Λ,ℓ,t,g, true);

plot!(p, show=true)

0 comments on commit b5af14a

Please sign in to comment.