Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ns = 5 : 21;
- n = length(ns);
- y_theory = zeros(n, 1);
- y_fact = zeros(n, 1);
- y_runge = zeros(n, 1);
- for i = 1 : n
- y_theory(i) = 0.4 / 12 * (0.4 / (ns(i) - 1))^2;
- y_fact(i) = abs(Trap(0, 0.4, ns(i)) + exp(-0.4) - 1);
- y_runge(i) = abs(Trap(0, 0.4, ns(i) * 2) - Trap(0, 0.4, ns(i))) / (2^2 - 1);
- end;
- semilogy(ns, y_theory, ns, y_fact, '--', ns, y_runge, '-.');
- legend('теор.', 'факт.', 'Рунге');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement