|
Carp Fisher <bmjim@gmail.com> wrote in message <16409623.1236739893454.JavaMail.jakarta@nitrogen.mathforum.org>...
> Lets say I have two arrays:
>
> x = [1 2 3 4 5]
> y = [9 8 7 6 5]
>
> How would I write a loop that would solve for
>
> z = x + y
>
> for each different combination of x and y values, i.e
> z(1,9) z(2,9) z(3,9)... etc?
>
> Thanks,
>
> Kim
You could also do:
z = round(log(exp(x.')*exp(y)));
assuming x and y contain only positive integers as in your example. Otherwise remove the 'round' portion.
To be candid with you, I don't actually recommend this method but only present it here as a curiosity.
Roger Stafford
|