The symbolic code is not running

1 次查看(过去 30 天)
MINATI
MINATI 2019-11-4
评论: MINATI 2019-11-10
syms t x a p q r a1 a2 A pr
f(1)=x+p*x^2/2;g(1)=a*x+q*x^2/2;h(1)=1+r*x;
for i=1:5 %(Can I take i=0:5)
fa(i) = subs(f(i),x,t);ga(i) = subs(g(i),x,t);ha(i) = subs(h(i),x,t);
f(i+1) =f(i)+a1*int(int(int((diff(fa(i),t,3)+(fa(i)+ga(i))*diff(fa(i),t,2)+ a1*diff(fa(i),t,1)*(diff(fa(i),t,1)+diff(ga(i),t,1))),t,0,x)));
g(i+1) =g(i)+a1*int(int(int((diff(ga(i),t,3)+(fa(i)+ga(i))*diff(ga(i),t,2)+ a1*diff(ga(i),t,1)*(diff(fa(i),t,1)+diff(ga(i),t,1))),t,0,x)));
h(i+1) =h(i)+pr*a2*int(int((diff(ha(i),t,2)+(fa(i)+ga(i))*diff(ha(i),t,1)+ A*ha(i)*(diff(fa(i),t,1)+diff(ga(i),t,1))),t,0,x));
end
f=f(1)+f(2)+f(3)+f(4)+f(5);
disp(f(i+1))
figure(1)
fplot(x,f) %% (for FIG. a1=1;a2=2;A=1;pr=1;)
  10 个评论
Walter Roberson
Walter Roberson 2019-11-10
You have triple nested integrals, but you only have bounds for one of the levels, which leads you open to issues about ending up with whatever constant of integration that the routines decide to throw in. Wouldn't it be better to use definite integrals for all of the calculations? At the very least you should be indicating the variable of integration.
MINATI
MINATI 2019-11-10
ok
Thanks Walter
for your interest and time

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by