Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Computer lab 2 & 3
- % Johan Larsson
- % Max Niia
- function [ alpha, alphas ] = super_linearity(xi, r)
- syms x;
- % The first and second derivate of the polynomial
- xprim = diff(54*x^6 + 45*x^5 - 102*x^4 - 69*x^3 + 35*x^2 + 16*x - 4, x, 1);
- xbis = diff(54*x^6 + 45*x^5 - 102*x^4 - 69*x^3 + 35*x^2 + 16*x - 4, x, 2);
- % The value of the first and second derivative f'(r) and f''(r)
- first = vpa(subs(xprim, x, r));
- second = vpa(subs(xbis, x, r));
- index = size(xi, 2) - 1;
- index2 = index - 1;
- e = abs(xi(index) - r);
- e1 = abs(xi(index2) - r);
- alphas = [];
- for i = 1:size(xi, 2) - 2
- e_i = abs(xi(i) - r);
- e_i1 = abs(xi(i + 1) - r);
- t_1 = (log(e_i1) + log(abs(second/(2*first))));
- n_1 = (log(e_i) + log(abs(second/(2*first))));
- alphas(i) = t_1/n_1;
- end
- t = (log(e) + log(abs(second/(2*first))));
- n = (log(e1) + log(abs(second/(2*first))));
- alpha = t/n;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement