I'm not sure what a rational integer is. How is that distinct from an integer?
Anyway, assume x and y are integers, with a completely unspecified?
Lets see. You specify x and y, but then you overwrite x, as
syms x rational positive integer
syms y rational positive integer
So now x is a function of y. It is NO longer an unknown integer. You overwriote the initial specification. People seem to fail to realize this, thinking the syms call is necessary to declare a variable. This is NOT Fortran, or some other language where you might do that.
Next, we see this:
eqn no longer has anything to do with x or y! We now simply have the relation that a = 1/3.
Using solve on it is irrelevant, since you cannot solve for something that has no relation to x anymore! Therefore, solve fails.
Now, what COULD you have done? This is difficult, since I have no idea what you really wanted to do. But let me start over.
syms x y positive integer
And this still fails, because all we know is that a is some number, but x and y are integers. While it seems that x = y/a, consider if a solution exists for any general value of a, and integer y? And the answer is no. So no solution was found.
I still have no clue what you really wanted to do. If I relax things further, ;like this:
Then the answer is trivial. We get x, as a function of y and a. MATLAB is no longer worried that x and y MUST be positive integers, and therefore it finds a solution.
My guess is, you probably need to spend more time working through any tutorials with the symbolic toolbox and MATLAB in general, as it feels like you don't really understand variables and what they are, and why you use tools like syms.