Hello all,
I have columns of data that represent independent variables a,b,c and two dependent variables x,y in a non linear system.
I want to be able to predict x and y given a,b,c. Matlab has a newrb function that does this well. I have not been able to find how to do it in Julia. I have looked at Surrogates and basis function expansions and I can’t see how to set it up
Thanks

What have you tried, and what was the problem? Try to put together a minimal runnable example to illustrate what you are trying to do.

Thanks for the reply. I keep thinking it should be simple.One independent one dependent.
I have data x vs y and I want to input x and get y. This works fine

using Surrogates

x=[0.0035, 0.0045, 0.0175, 0.0585, 0.068, 0.0935, 0.165, 0.2125, 0.241, 0.3615, 0.474, 0.4985, 0.5815, 0.646, 0.654, 0.723, 0.79, 0.837, 0.8731, 0.883, 0.888, 0.8973, 0.9489, 0.9707, 0.9825]
y=[0.0205, 0.0275, 0.1315, 0.305, 0.3615, 0.411, 0.52, 0.5455, 0.5675, 0.606, 0.6505, 0.6555, 0.697, 0.729, 0.731, 0.776, 0.82, 0.852, 0.8817, 0.8885, 0.893, 0.9012, 0.9502, 0.9715, 0.9835]
val=interp(.4)
print(val)

now say I have x,y,z data to predict a dependent variable w. how is that set up? how do I pass the values to the function? Thanks

You just need an array of tuples, via `xyz = tuple.(x,y,z)`, e.g.

``````julia> x, y, z = rand(1000), rand(1000), rand(1000);

julia> w = @. cos(x^2 - y * sin(z*x));

julia> interp = RadialBasis(tuple.(x,y,z), w, [0,0,0], [1,1,1]);

julia> interp((0.2,0.3,0.4))
0.9999134605897768

julia> cos(0.2^2 - 0.3 * sin(0.4*0.2))
0.9998715929517374
``````
1 Like

Nicely done thanks

This isn’t very clear in the Surrogates.jl documentation; if someone wants to make a PR to make the supported datastructures explicit that would be good.