


BAR_MAKER - builds some useful matrices
matrix bar is used to evaluate the mean value of a parameter
over the elements as follows:
o Pelements=matrix_bar*Pnodes
The two other matrices matrix xbar and matrix ybar are used
to evaluate a parameter derivative over the elements with respect
to x or y exactly as above
Usage:
[matrix_bar, matrix_xbar, matrix_ybar]=bar_maker(nel,nods,index,alpha,beta)

0001 function [matrix_bar, matrix_xbar, matrix_ybar]=... 0002 bar_maker(nel,nods,index,alpha,beta) 0003 %BAR_MAKER - builds some useful matrices 0004 % 0005 % matrix bar is used to evaluate the mean value of a parameter 0006 % over the elements as follows: 0007 % o Pelements=matrix_bar*Pnodes 0008 % The two other matrices matrix xbar and matrix ybar are used 0009 % to evaluate a parameter derivative over the elements with respect 0010 % to x or y exactly as above 0011 % 0012 % Usage: 0013 % [matrix_bar, matrix_xbar, matrix_ybar]=bar_maker(nel,nods,index,alpha,beta) 0014 0015 row=zeros(nel*3,1); 0016 col=zeros(nel*3,1); 0017 value=zeros(nel*3,1); 0018 valuex=zeros(nel*3,1); 0019 valuey=zeros(nel*3,1); 0020 count=-nel+1; 0021 for m=1:3 0022 count=count+nel; 0023 row(count:count+nel-1)=[1:nel]'; 0024 col(count:count+nel-1)=index(:,m); 0025 0026 value(count:count+nel-1)=1/3 ; 0027 valuex(count:count+nel-1)=alpha(:,m); 0028 valuey(count:count+nel-1)=beta(:,m) ; 0029 end 0030 0031 matrix_bar=sparse(row,col,value,nel,nods); 0032 matrix_xbar=sparse(row,col,valuex,nel,nods); 0033 matrix_ybar=sparse(row,col,valuey,nel,nods);