Info
This question is closed. Reopen it to edit or answer.
how do i debug my program
1 view (last 30 days)
Show older comments
i have here a picture of the problam and also i attached here the code which is going wrong. what i am trying to do is to update the info in the vector integ(i) by summerizing each cell with the integral's calculation. for this iam writing integ(i)= int(...) + integ(i) however for some reson, as you can see in the picture below (click on it) i highlight in red that the values are 0 and i don't understand why it is not being updated with new values. please help me to correct my code.
l=1;
h=l/10;
n=round(l/h);
syms t j
K(t)=exp(-t);
F(t)=t;
integrand(t,j) = K(t-j)*F(j);
U(t)=1 - int(integrand(t,j),j,0,t);
Uexact=zeros(1,n+3);
Utest=zeros(1,n+3);
integ=zeros(1,n+3);
Udiff=zeros(1,n+3);
LOGtest=zeros(1,n+3);
ERRORord=zeros(1,n+3);
for i=2:n+1
for m=1:i
integ(i)=int(K((i-1)*h-j)*(1/h)*((F(m*h)-F((m-1)*h))*j+h*(i*F((m-1)*h-(m-1)*F(m*h)))),j,(m-1)*h,(m*h))+integ(i);
end
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!