theta1(i+1)=theta1(i)+psy1(i)*dt1
psy1(i+1)=(-g/l)*dt1*theta1(i)+(1-c*dt1)*psy1(i);
theta_exact=10.*exp(-2.*t1).*cos(w.*t1)+(20/w).*exp(-2.*t1).*sin(w.*t1)
epsilon1=(theta1(i)-theta_exact)
plot(t1(1:end-1),theta_exact,'blue')
plot(t1(1:end-1),(epsilon1))
If you read the code you notice that the second plot is a time vs "epsilon1". My issue is that the first value for "epsilon1" is -10 but epsilon1=(theta1(i)-theta_exact), where theta1(i) and theta_exact are the same value for their first values. The first value should read 0 for epsilon1, can anyone help me figure out why this is not the case?
0 Comments
Sign in to comment.