Error using feval and Invalid function name
Please friends, i will aprecciate your help,
I have this code:
function I= Trapecios(f,a,b,n)
%Fórmula Trapecios compuesta
h=(b-a)/n;
x=a:h:b;
x=x(:);
for i=1:n-1
k1=feval(f,x(i));
pesos=[1 2*ones(1,n-1) 1];
I=h./2*sum(pesos*k1);
end
end
So when I input the arguments, issues these messagges:
>> Trapecios(‘x/56’,-56/2,9*56/10,8)
Error using feval
Invalid function name ‘x/56’.
Error in Trapecios (line 7)
k1=feval(f,x(i));Please friends, i will aprecciate your help,
I have this code:
function I= Trapecios(f,a,b,n)
%Fórmula Trapecios compuesta
h=(b-a)/n;
x=a:h:b;
x=x(:);
for i=1:n-1
k1=feval(f,x(i));
pesos=[1 2*ones(1,n-1) 1];
I=h./2*sum(pesos*k1);
end
end
So when I input the arguments, issues these messagges:
>> Trapecios(‘x/56’,-56/2,9*56/10,8)
Error using feval
Invalid function name ‘x/56’.
Error in Trapecios (line 7)
k1=feval(f,x(i)); Please friends, i will aprecciate your help,
I have this code:
function I= Trapecios(f,a,b,n)
%Fórmula Trapecios compuesta
h=(b-a)/n;
x=a:h:b;
x=x(:);
for i=1:n-1
k1=feval(f,x(i));
pesos=[1 2*ones(1,n-1) 1];
I=h./2*sum(pesos*k1);
end
end
So when I input the arguments, issues these messagges:
>> Trapecios(‘x/56’,-56/2,9*56/10,8)
Error using feval
Invalid function name ‘x/56’.
Error in Trapecios (line 7)
k1=feval(f,x(i)); feval, function MATLAB Answers — New Questions