Problems with symbolic integration -> numeric integration

1 visualizzazione (ultimi 30 giorni)
Basically I have this loop
while (erro > tol)
interno1 = dot(an1,f); %Realização de um produto interno, para que não seja recalculado a cada loop de Bn1
for p = 1:n
for q = 1:n
Bn1(p,q)= eval(int((k0+(k1/Tp)*(Tp+dot(an1,f)))*(fx(p)*fx(q)),x,0,L));
end
end
Resid = (A*(an1-an0)/deltat) + (1-beta)*(Bn0+C)*an0 + beta*(Bn1+C)*an1 -F';
erro = norm(abs(Resid),2);
Ktan = (A/deltat) + beta*(Bn1+C);
deltaa = Ktan\Resid;
an2 = an1 - deltaa;
an1 = an2 ;
if (iterac>50)
disp('Necessita mais de 50 interaçoes para convergencia.');
pause;
end
disp(sprintf('Iteracao numero %d',iterac));
iterac = iterac + 1;
end
What does it does? It iterates the Bn1 matrix until convergence. an1 is a real number array, while f and fx are defined the following:
for i=1:n
f(i)=sin( ((2*i-1)*pi*x)/(2*L) );
fx(i)=diff(f(i),x);
end
At the first loop an1 is a zero vector. So, when it comes to evaluate Bn1, there is no problem. At the end of the first loop, it receives a numeric value different from zero here:
an1 = an2 ;
And then, with the new an1, an inner product is calculated
interno1 = dot(an1,f)
Then, when it comes to evaluate this function again:
Bn1(p,q)= eval(int((k0+(k1/Tp)*(Tp+dot(an1,f)))*(fx(p)*fx(q)),x,0,L));
I get the following error message:
Warning: Explicit integral could not be found.
Error using mupadmex
Error in MuPAD command: Second argument must be either of form x or x=a..b. [int]
Error in sym/int (line 107)
rSym = mupadmex('symobj::intindef',f.s,x.s,options);
Error in sym/eval (line 15)
s = evalin('caller',vectorize(map2mat(char(x))));
Error in TrabalhoFMM (line 98)
Bn1(p,q)= eval(int((k0+(k1/Tp)*(Tp+dot(an1,f)))*(fx(p)*fx(q)),x,0,L));
So, I'm beginning to think that the integral is too "hard" to be solved symbolically. What I've tried is replacing the "eval" for "double". But that was just some stupid thing I've done, since it wouldn't give me the "real" result. What I'd like to do is find a way to integrate this numerically, throughout a quadrature. But I'm having problems with that 'cause the quad function family requires a explicit function... so... how could I solve this?

Risposte (1)

Walter Roberson
Walter Roberson il 15 Mag 2012
Is it possible that your R2009a version was configured to use the Maple Symbolic Toolbox? R2012a would very likely use MuPAD; R2009a was transitional and could use either (if you had Maple)
  6 Commenti
Walter Roberson
Walter Roberson il 15 Mag 2012
Could I ask you to put in a breakpoint at the line of the int() that is reporting no explicit integral, and post the function being integrated and the limits? I do not have access to the symbolic toolbox.
Cyberz
Cyberz il 15 Mag 2012
I've changed the question... guess it is clearer now. Need something else?

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by