function true_L3_plot (x, y) % ------------------------------------------------------ % graph of value in 3 node quadratic line elements % ------------------------------------------------------ % n_p, n_e = Number of points and elements % x, y = Mesh coordinate and data values % e_x, e_y = coordinates & data values at 3 element nodes % x_el, y_el = interpolated parametric values % control data: number of nodes, elements & curve segments n_p=size(x, 1) ; n_e=(n_p-1)/2 ; n_poly = 8 ; %b n_poly = 75/n_e %b n_poly = ceil (n_poly) ; rows(3)=0 ; e_x(3)=0 ; e_y(3)=0 ; H(3)=0 ; % pre-allocation % Loop over all elements for it = 1:n_e ; % Extract nodal coordinates & values. Plot nodes. rows = [1, 2, 3] + (it - 1)*2 ; % get connectivity e_x = x (rows) ; e_y = y (rows) ; plot (e_x, e_y, 'ko') % nodal symbols e_text = sprintf (' (%g)', it); % offset # from pt text (e_x(2), e_y(2), e_text) % Plot element number % Loop over local points on the quadratic element for k = 1: (n_poly + 1) % points in parametric space % get parametric interpolation functions X = 2*(k - 1)/n_poly - 1 ; % on -1 to 1 H(1) = 0.5*(X*X - X) ; H(2) = 1. - X*X ; H(3) = 0.5*(X*X + X) ; x_el (k) = H * e_x ; y_el (k) = H * e_y ; % true value end % for k parametric points in element plot (x_el, y_el) % parametric curve through 3 nodes end % for it over all elements % end of true_L3_plot