On 25/08/16 04:50, iceman wrote:

> the value of F returned should be

>

> @(A, x) A11 .* x .^ 2 + A12 .* x + A13

> where A = [A11,A12,A13]

>

> How should I go about doing this ?

Here's one approach using num2cell:

>> tmp = function_handle(p)

tmp =

@(A11, A12, A13, x) A11 .* x .^ 2 + A12 .* x + A13

>> F = @(A,x) tmp(num2cell(A){:}, x)

F =

@(A, x) tmp (num2cell (A) {:}, x)

>> F([5, 7, 11], x)

ans = (sym)

2

5⋅x + 7⋅x + 11

>> F([5, 7, 11], 2)

ans = 45

This has some overhead, so maybe there is a better way.

Colin

_______________________________________________

Help-octave mailing list

[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave