I would like to know if in MATLAB there is a way to evaluate f(v) with f a handle function of 'n' arguments (x1. xn) and v a vector of length 'n' (v1. vn) since f(v) would throw error. The correct syntax: f(v(1),v(2). v(n)) but this is not easy in the example below I'm trying to deduce a code to obtain the jacobian matrix of a function F : R^n -----> R^n so i'm using the three point derivative formula. F is a cell array and for each row i'm taking f=F as my function in which i want to evaluate the derivative with respect to each variable x(j). My problem arises when I want to evaluate the difference f(x_adelantado)-f(x_atrasado) x_adelantado, x_atrasado are vectors but the arguments of f should be written as: f(x_adelantado(1),x_adeltantado(2), . ,x_adelantado(n)) is there a way to evaluate f(v)? with f a handle function of 'n' arguments and v of length 'n'
function [J] = Jacobiano(F,x0) %#JACOBIANO % calcula el Jacobiano de la funcion F evaluado % en x0 (punto de R^n). % Inputs: F --------- Arreglo de funciones anónimas, % continuas y derivables en x0 % x0 -------- Punto de evaluacion del jacobiano h=0.01; n=length(F); m=length(x0); for i=1:n %me paro en una fila del jacobiano f=F; %todas las derivadas parciales corresponden a la i-esima funcion for j=1:m x_adelantado=x0; x_adelantado(j)=x0(j)+h; x_atrasado=x0; x_atrasado(j)=x0(j)-h; J(i,j)=(1/(2*h))*(f(x_adelantado)-f(x_atrasado)); end end end