I have defined several numbers and a vector as follows:
d1=-0.3;d2=0.4;dv=[d1 d2];
I now attempt to define a function in which one of the arguments of the function is used to look up an entry of the vector dv; and the selected entry of the vector is then used in the function. I have defined this function as follows:
syms y zTHETA(y, z) = dv(y) + z
I then want to use the function in a for loop (:
for j=1:MB;Nzero(j, a)=sqrt((1/conj(a) - dv(j))*(THETA(l, a) - dv(j))/((a - dv(j))*(THETA(l, 1/conj(a)) - dv(j))));end;
The issue that I am having is that MATLAB halts at
THETA(y, z) = dv(y) + z
Have I defined this function in an appropriate way for my use? In particular, I think the problem is with the use of the object dv(y) in this function. Is there a better way to code for one of the function's arguments to be used to look up an entry of a vector, which is subsequently used in the function?
Best Answer