%% Function name % densitycomposite %% Revised: % 28 January 2014 %% Author % Willie Valentin, Trey Moore, & Autar Kaw % Section: All % Semester: Fall 2013 %% Purpose % Given the density of a fiber and matrix, as well as the fiber % volume fraction, output the density of the composite %% Usage % function [rhoc] = densitycomposite(rhof,rhom,Vf) % Input variables % rhof=density of fiber % rhom=density of matrix % Vf=fiber volume fraction % Output variables % rohc=density of composite % Keywords % density %% License Agreement % http://www.eng.usf.edu/~kaw/OCW/composites/license/limiteduse.pdf %% Testing Code clc clear all %% Inputs rhof=2500; rhom=1200; fprintf('\nFiber Density: %g ',rhof) fprintf('\nMatrix Ensity: %g ',rhom) %% Test 1 % Testing for a particular Vf % Input desired Vf Vf=0.6; % Call function: beta_micro [rhoc]=densitycomposite(rhof,rhom,Vf); % Results for a particular Vf fprintf('\n\nFiber Volume Fraction: %G\n\n',Vf) disp('Density of Composite') disp('___________________________') fprintf('\n rohc | %G\n\n\n\n',rhoc) %% Test 2 % Table of Density of a Unidirectional Lamina % as a Function of Fiber Volume Fraction for i=1:1:11 Vf(i)=i/10-0.1; rhoc(i)=densitycomposite(rhof,rhom,Vf(i)); end % Table of results disp('Density of Composite') disp('________________________________') disp(' Vf | rohc ') for i=1:1:11 fprintf(' %3.2f | %g\n',Vf(i),rhoc(i)) end %% Test 3 % Graph of Density of a Unidirectional Lamina % as a Function of Fiber Volume Fraction for i=1:1:101 Vf(i)=i/100-0.01; rhoc(i)=densitycomposite(rhof,rhom,Vf(i)); end hold on plot(Vf,rhoc,'LineWidth',2) grid legend('rohc') title('Density of Composite vs. Fiber Volume Fraction') xlabel('Fiber Volume Fraction') ylabel('Density of Composite') hold off