Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = 3;
- a = -1;
- b = 1;
- function W = calculate_W(x,k)
- cheb3 = @(arg) 4*(arg^3)-3*arg;
- if(!k>=2)
- disp("k problem")
- else
- W = (x^k - (2^(1-k)) * cheb3(x));
- end
- endfunction
- points = [-1,-0.5,0,0.5,1]
- points_result = points.^n
- points_poly_results = [];
- for i=1:size(points,2)
- points_poly_results = [points_poly_results,calculate_W(points(i),n)];
- end
- points_poly_results
- error = max(abs(points_result.-points_poly_results))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement