series de taylor
Publicado por cristhian (1 intervención) el 10/04/2012 02:00:14
nesesito realizar un .m de series de taylor encontre uno en un libro y me aparese un problema el siguiente problema a la hora de correrlo
??? Undefined function or method 'numeric' for input arguments of type 'double'.
Error in ==> taylor1 at 21
y1=numeric(subs(polt,x,x1));
el codigo es el siguiente
function[ ]=taylor1( )
v=[1 2 4 6 8 10];
x1=0:pi/(6*4):pi;
x0=pi/6;
a=find((x1-x0*ones(1,25))<0);
j=length(a)+1;
texto=cell(1,2);
texto(1)={('sen(x)')};
y=sin(x1);
hold on
syms x
p=sin(x);
for i=1:length(v)
subplot(3,2,i)
plot(x1,y,'m')
hold on
polt=taylor(p,v(i));
y1=numeric(subs(polt,x,x1));
if(length(y1)==1)
y1=y1*ones(1,length(x1));
end
plot(x1,y1,'*');
texto(2)={['taylor grado',inst2str(v(i)-1)]};
error=norm((y(j)-y1(j))/y(j));
text(0.2,1.75,['error=',num2str(error,3)])
axis([0,pi,0,4])
legend(texto,2)
hold off
end
el problema es con numeric no se que pasa y he buscado por todas partes y no he encontrado una explicacion de numeric, pero si la he encontrado en .m de matlab
??? Undefined function or method 'numeric' for input arguments of type 'double'.
Error in ==> taylor1 at 21
y1=numeric(subs(polt,x,x1));
el codigo es el siguiente
function[ ]=taylor1( )
v=[1 2 4 6 8 10];
x1=0:pi/(6*4):pi;
x0=pi/6;
a=find((x1-x0*ones(1,25))<0);
j=length(a)+1;
texto=cell(1,2);
texto(1)={('sen(x)')};
y=sin(x1);
hold on
syms x
p=sin(x);
for i=1:length(v)
subplot(3,2,i)
plot(x1,y,'m')
hold on
polt=taylor(p,v(i));
y1=numeric(subs(polt,x,x1));
if(length(y1)==1)
y1=y1*ones(1,length(x1));
end
plot(x1,y1,'*');
texto(2)={['taylor grado',inst2str(v(i)-1)]};
error=norm((y(j)-y1(j))/y(j));
text(0.2,1.75,['error=',num2str(error,3)])
axis([0,pi,0,4])
legend(texto,2)
hold off
end
el problema es con numeric no se que pasa y he buscado por todas partes y no he encontrado una explicacion de numeric, pero si la he encontrado en .m de matlab
Valora esta pregunta


0