first commit with current lessons
This commit is contained in:
11
10-04/plotQ.jl
Normal file
11
10-04/plotQ.jl
Normal file
@ -0,0 +1,11 @@
|
||||
using LinearAlgebra
|
||||
using Plots
|
||||
|
||||
function plotQ(Q::Matrix, q::Vector, xyrange::Tuple{Tuple{Number, Number}, Tuple{Number, Number}})::Plots.Plot
|
||||
f(x, y) = dot((1/2) * hcat(x, y) * Q, vcat(x, y)) + dot(q', vcat(x, y))
|
||||
xrange = LinRange(xyrange[1][1], xyrange[2][1], 200)
|
||||
yrange = LinRange(xyrange[1][2], xyrange[2][2], 200)
|
||||
z = @. f(xrange', yrange)
|
||||
plt = contour(xrange, yrange, z)
|
||||
plt
|
||||
end
|
||||
Reference in New Issue
Block a user