MATLAB: Create a loop relating two variables

for looploop

I am trying to create a for loop and I want to set something like:
for (Numerator./Denominator (4:pi))
Numerator = Numerator.*-1
Denominator = Denominator+2
end
I don't know if the parentheses are correct at all but my real question is: can I relate both my variables right after the "for"? Can I say "for when variable 1 over variable 2 (vector)"? How?

Best Answer

If the intention "for (Numerator./Denominator (4:pi))" is that you want MATLAB to assign values for Numerator and Denominator such that the ratio of the two is to be in the range 4 down to pi, then No, that is not possible, partly because there many many combinations. For example Numerator might be 8192 and Denominator might be 2048, or Numerator might be 54 and Denominator might be 17. And if it did find something, the first thing you do in your loop is multiply the numerator by -1, which would result in Numerator/Denominator being negative and so outside the desired range so it could at best execute once.
I suggest that you want a while loop, and that it is some other value that you want to test, such as the sum of the terms.