This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: x2=(b(2,1)-A(2,1)*x1-A(2,3)*x3)/A(2,2); x3=(b(3,1)-A(3,1)*x1-A(3,2)*x2)/A(3,3); if lam>1 && lam<2 %really want to use a for loop, is there any way? %method for overrelaxation, which is designed to accelerate the %convergent system. x1=(1-lam)*x1_old+lam*(; x2=(1-lam)*x2_old; x3=(1-lam)*x3_old; end ea=abs((x1-x1_old)/x1)*100; x1_old=x1; i=i+1; if ea<=es fprintf('\nAfter %d iterations, x1=%7.4f, x2=%7.4f, x3=%7.4f, maximum error=%4.3f percent\n\n',i,x1,x2,x3,ea); break end end...
View Full Document
This note was uploaded on 09/27/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.
- Spring '09