MATLAB: Is it possible to use vpasolve with a function within the equation (Spline)

MATLAB and Simulink Student Suitesolvesplinevpasolve

Hi all!
I was searching the web and the documentation, and I couldn't find any solution to my problem. There maybe another method that solves my problem instead of vpasolve, but that one was the closest I could find. So maybe I'm just doing it wrong or vpasolve is not capable of solving my equation. I'd appreciate any help.
So here's my problem:
I have a cubic spline created with spap2 which I use to approximate data. There's an angle to every point of my function, just like polar coordinates. Out of the spline-function I want to create an array with x, y and phi (angle to y-axis), but I need the angles to have a linear spacing. (Something like pi/1000)
So I've been thinking of writing my own method, that just approximates every value for every angle, but that takes a lot of computing time for a thousand angles.
I've tried so far:
syms x;
eqn = .25 == x / ppval(SPL, x);
solx = vpasolve(eqn, x);
With .25 being tan(pi/4), just to test one angle, and SPL being the spline-function. I'm planning to put this in a loop and then calculate y with ppval to every new x (out of solx).
The error I get:
Error using histc
First Input must be a real non-sparse numeric array.
Error in ppval
if lx, [~,index] = histc(xs,[-inf,b(2:l),inf]);
I assume that vpasolve can't handle the SPL-function… But I'm not sure.
Thank you! Felix

Best Answer

When you use
syms x;
eqn = .25 == x / ppval(SPL, x)
then this creates x as symbolic in the first line. In the second line, it passes SPL and the symbolic x to ppval() and expects a result for that, and then it calculates symbolic x divided by that value and does a symbolic equate of that to 0.25, and the result of that is assigned to eqn. But ppval() is not designed to expect symbolic inputs, so the ppval fails.
When you define something like
eqn = .25 == x / ppval(SPL, x)
then you are not defining a function, you are defining an expression, so each part of it has to be executable with symbolic variables.
What you should do is switch to numeric expressions,
eqn = @(x) (.25) - (x / ppval(SPL, x));
x0 = something
solx = fzero(eqn, x0)