Code not graphing properly?

2 views (last 30 days)
Briana Canet
Briana Canet on 17 Mar 2022
Answered: David Hill on 17 Mar 2022
I am trying to plot f_i for values of 0 to 1 (x-axis) and K_traction (y-axis).
It is not graphing properly. I graphed in Excel and MATLAB is producing the right graph.
I think I am missing the periods/dots in the equation for K_traction.
% Part A for COMP1
E_m = 70000; % Elastic modulus of matrix, MPa
v_m = .33; % Poisson ratio of matrix
E_i = 250000; % Elastic modulus of inclusion, MPa
v_i = .2; % Poisson ratio of inclusion
% Fiber volume fraction
f_i = 0:0.01:1;
% 0 is 0% fiber and 1 is 100% fiber content
% points to be plotted
K_m = (E_m)/(3*(1-2*(v_m))); % Bulk modulus of matrix, MPa
K_i = (E_i)/(3*(1-2*(v_i))); % Bulk modulus of inclusion, MPa
s1 = (1+v_m)/(3*(1+v_m));
K_traction = K_m*(1+(f_i*((K_m/(K_m-K_i))-s1)^-1)^-1);
K_disp = K_m*((1-(f_i*(((K_m)/(K_m-K_i))-s1)^-1).^-1));
% Plotting
plot(f_i,K_traction, 'Color', 'red', 'LineWidth', 2.5);
grid off;
title('Bulk Modulus vs. Inclusion Volume Fraction')
xlabel('Inclusion Volume Fraction, f_i')
ylabel('Bulk Modulus, K [MPa]')
hold on

Answers (1)

David Hill
David Hill on 17 Mar 2022
K_traction = K_m*(1+(f_i*((K_m/(K_m-K_i))-s1)^-1).^-1);%just missing a dot .^-1

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!