I am trying to run the Radial basis
from Surrogates
to perform interpolation with multiquadricRadial
.
I have created the following script:
using Surrogates
using Plots; plotly()
lb = [0.0, 0.0]
ub = [10.0, 10.0]
function f(x)
x1=x[1]
x2=x[2]
sin(x[1]) + cos(x[2])
end
#Sampling
function sam()
x = range(0, 10.0, length = 9) |> collect
y = range(0, 10.0, length = 9) |> collect
tuple = zip(x,y) |> collect
return tuple
end
xy = sam()
z = f.(xy)
surrogate_rbf = Surrogates.RadialBasis(xy, z, lb, ub; rad=multiquadricRadial)
function test_val()
x = range(0, 10.0, length = 101) |> collect
y = range(0, 10.0, length = 101) |> collect
tuple = zip(x,y) |> collect
return tuple
end
arr = test_val()
result_surrogates_radial = [surrogate_rbf(i) for i in arr]
x, y = 1:10, 1:10
p1 = surface(x, y, (x, y) -> surrogate_rbf([x y]))
xs = [a[1] for a in xy]
ys = [a[2] for a in xy]
zs = f.(xy)
scatter!(xs, ys, zs, marker_z=zs, label="Actual Points", title="Surrogates RBF")
This script works when the rad=linearRadial
but upon changing it to MultiquadricRadial
it throws the follwoing error:
LinearAlgebra.SingularException(9)
Stacktrace:
[1] checknonsingular at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\factorization.jl:19 [inlined]
[2] checknonsingular at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\factorization.jl:21 [inlined]
[3] bunchkaufman!(::LinearAlgebra.Symmetric{Float64,Array{Float64,2}}, ::Bool; check::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\bunchkaufman.jl:99
[4] #bunchkaufman#142 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\bunchkaufman.jl:186 [inlined]
[5] #_factorize#94 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:638 [inlined]
[6] _factorize at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:636 [inlined]
[7] factorize at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:634 [inlined]
[8] \(::LinearAlgebra.Symmetric{Float64,Array{Float64,2}}, ::Array{Float64,1}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:648
[9] _calc_coeffs(::Array{Tuple{Float64,Float64},1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Function, ::Int64, ::Float64, ::Bool) at C:\Users\user\.julia\packages\Surrogates\wJbFN\src\Radials.jl:61
[10] #RadialBasis#10 at C:\Users\user\.julia\packages\Surrogates\wJbFN\src\Radials.jl:51 [inlined]
[11] top-level scope at In[7]:24
[12] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
Please suggest what might be causing this issue?
Thanks!!