Error using mupadmex of syms
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
in th file here that is attached, this is the program that i am trying to run:
syms t
syms j
K(t)=exp(-t);
F=1;
integrand(t,j) = K(t-j)*F;
U(t)=1 - int(integrand(t,j),j,0,t);
l=1;
h=l/10;
n=round(l/h);
Utest=zeros(1,n+3);
Uapp=zeros(1,n+3);
Kvector= zeros(1,n+3);
Fvector= zeros(1,n+3);
Integvector= zeros(1,n+3);
for i=1:n+1
Integvector(i)=int(integrand(t,j),j,(i-1)*h,i*h);
end;
then i get the following error:
"The following error occurred converting from sym to double: Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead."
why is that? how can i correct it so it will work right?
0 comentarios
Respuestas (1)
Ced
el 23 de Oct. de 2014
In your second to last line
Integvector(i)=int(integrand(t,j),j,(i-1)*h,i*h);
the left side is a double vector because you initialized Integvector as such, whereas the right side is a symbolic expression still dependent on t.
So, either you initialize Integvector as a symbolic variable instead of a double vector, or you make the right side into a double by assigning a value to "t". This could be done using "subs".
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!