Code not graphing properly?

2 ビュー (過去 30 日間)
Briana Canet
Briana Canet 2022 年 3 月 17 日
回答済み: David Hill 2022 年 3 月 17 日
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

回答 (1 件)

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by