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 / 24 * (0.4 / ns(i)) ^ 2;
- y_fact(i) = abs(Rectangle(0, 0.4, ns(i)) + exp(-0.4) - 1);
- y_runge(i) = (Rectangle(0, 0.4, ns(i) * 2) - Rectangle(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