I'm trying to iterate over a function in order to extract the discrete values of a symbolic function:
syms x;
y = sinc(x);
x = -100:1:100;
for i = 1:length(x)
t(i) = y(x(i));
end
but it gives me error:
Subscript indices must either be real positive integers or logicals.
if I use:
t(i) = y{i}(x);
it says that:
SYM objects do not allow nested indexing. Assign intermediate values to variables instead.
So how this can be done in matlab, it looks like the linear sampling from symbolic function is somewhat more complicated than expected, or is there a function for this that I'm missing here?