I have a cell of function handles and I would like to take the product of each row.
I then want to evaluate the function handles within the cell for certain values.
Example:
Original cell:
P{1,1} = @(x) x P{1,2} = @(y) y
P{2,1} = @(x) x P{2,2} = @(y) y.^2
Desired product:
P{1,1} = @(x,y) x.*y
P{2,1} = @(x,y) x.*y.`2
Then evaluate for
x = 2:0.1:3;
y = 1:0.1:2;
Then I suppose use cell2mat
to get P
?
I have been trying to use cellfun
, but not sure if this is correct when using anonymous functions.
Would appreciate any advice!