Your O(A(:,3)) is essentially requesting that double(subs(p)) be executed once for each value of A(:,3) with zd being set to each value in turn, so you are going to get one answer for each A(:,3) value. [This is not how it is actually implemented, but the result is the same.]
When you create a symbolic expression involving a variable, then there is no way to tell the Symbolic toolbox that the variable is standing in for something that will later be replaced by an array and that you want array operations used in conjunction with the arrays that are already in the expression. As far as the symbolic toolbox is concerned, every symbolic variable name (that is not a function) represents a scalar, and it will use scalar logic for it.
Consider for example,
syms x y
x * y
y * x
ans =
x*y
ans =
x*y
Notice you get the same response for the two different orders. This is acceptable under the assumption that x and y are scalars, because scalars are commutative under matrix multiplication. It would, however, be unacceptable if x and y were standing in for arrays, because matrix multiplication of arrays is not commutative.
When you subs() in a matrix for a symbol in an expression, the entire expression is evaluated once for each value of the matrix, even if what you are subs() in is the same size as the original expression
> syms x
A = [1 + x, 2 + x; 3 + x, 4 + x]
X = [9 10; 11 12]
A =
[ x + 1, x + 2]
[ x + 3, x + 4]
X =
9 10
11 12
>> subs(A,x,X)
ans =
[ 10, 11, 11, 12]
[ 12, 13, 13, 14]
[ 12, 13, 13, 14]
[ 14, 15, 15, 16]
>> subs(A,x,[100 200])
ans =
[ 101, 201, 102, 202]
[ 103, 203, 104, 204]
When you subs() in multiple variables in the same subs() call, then corresponding elements of the input matrices are used.
>> syms x y
>> A = [x+y, x+2*y]
A =
[ x + y, x + 2*y]
>> subs(A,{x,y}, {[100 200], [1000 2000]})
ans =
[ 1100, 2200, 2100, 4200]
This is not the same as doing the two subs() sequentially:
>> subs(subs(A,x,[100 200]),y,[1000 2000])
ans =
[ 1100, 2100, 1200, 2200, 2100, 4100, 2200, 4200]