How do you plot values from a cell array?

1 回表示 (過去 30 日間)
James Taylor
James Taylor 2016 年 2 月 18 日
コメント済み: James Taylor 2016 年 2 月 18 日
% Clearing EVERYTHING
clear all
close all
clc
%Variables
Em = 2.4 ; % Em = Youngs modulus of the matrix [GPa]
vm = 0.34; % Poisson's Ratio matrix
Ef = 76; % Ef = Youngs modulus of the fiber [GPa]
vf = 0.22; % Poisson's Ratio fiber
Vm = 0.4; % Marix Volume fraction
Vf = 0.6; % Fiber Volume fraction
Angle = -90:1:90; %Angle of the force in Deg => Rad
force = [0.150 0 0]'; %[xx yy xy]---[GPa]
tv = 0.13; %Length [m]
%Shear moduli
Gm = Em/(2*(1+vm)); %matrix
Gf = Ef/(2*(1+vf)); %fiber
%Bulk modui
Km = Em/(3*(1-2*vm));
Kf = Ef/(3*(1-2*vf));
%Moduli referred to lamina axes
E1 = Em*Vm+ (Ef*Vf);
%passions ratio
top = (vf-vm)*(1/Km - 1/Kf)*(Vm*Vf);
bottom = Vm/Kf + Vf/Km + 1/Gm;
v12 = (vm*Vm)+ (vf*Vf) + (top/bottom);
%Shear modulus
G12 = Gm + ((Vf)/((1/(Gf -Gm))+(Vm/(2*Gm))));
%bulk modulus
K_star = Km + (Vf/((1/(Kf - Km)) + (Vm/(Km +Gm))));
%{
************Key*********
B - beta
y - Gama
a - alpha
p - Rho
%}
%Variables required for G23 calculations
Bm = 1/(3-(4*vm));
Bf = 1/(3-(4*vf));
y = Gf/Gm;
a = (Bm - (y*Bf))/(1 + (y*Bf));
p = (y +Bm)/(y-1);
%Shear modulus G23
if (Gf > Gm && Kf>Km)
top = (1+Bm)*Vf;
bottom = p -((1+ (3 * (Bm^2) * (Vm^2))/((a * (Vf^3) + 1))))*Vf;
G23 = Gm*(1+ (top/bottom));
elseif (Gf < Gm && Kf < Km)
top = (1+Bm)*Vf;
bottom = p -((1+ (3 * (Bm^2) * (Vm^2))/((a * (Vf^3) + Bm))))*Vf;
G23 = Gm*(1+ (top/bottom));
end
%Elasticity
E2 = 4/ ((1/G23)+(1/K_star)+((4*v12^2)/E1));
%Calcuations
Z = (E1-((v12^2)*E2))/E1;
Q11= E1/Z;
Q22 = E2/Z;
Q12 = (v12*E2)/Z;
Q66 = G12;
Q_matrix = [Q11 Q12 0;
Q12 Q22 0;
0 0 Q66];
anglev = (-90:1:90)*pi/180; % Angle Vector
for k1 = 1:length(anglev)
angle{k1} = anglev(k1); % Angle
m{k1} = cos(angle{k1});
n{k1} = sin(angle{k1});
Stress_matrix_1{k1}= [m{k1}^2 n{k1}^2 -2*m{k1}*n{k1};
n{k1}^2 m{k1}^2 2*m{k1}*n{k1};
m{k1}*n{k1} -m{k1}*n{k1} m{k1}^2-n{k1}^2];
Strain_matrix_1{k1} = [ m{k1}^2 n{k1}^2 -m{k1}*n{k1};
n{k1}^2 m{k1}^2 m{k1}*n{k1};
2*m{k1}*n{k1} -2*m{k1}*n{k1} m{k1}^2-n{k1}^2];
Q_bar{k1} = (Stress_matrix_1{k1})*(Q_matrix)*inv(Strain_matrix_1{k1});
S_bar{k1} = inv(Q_bar{k1});
strain{k1} = S_bar{k1}*force;
strain_xx{k1} = strain{k1}(1,1);
% z = cell2mat(strain_xx{k1});
% hold on ;
%plot (Angle, strain_xx{k1}); hold on;
%grid on;
%mesh(Angle, strain_xx{k1})
end
At the end of this piece of code I want to plot strain_xx but I can't because it is a cell array can anyone help?

回答 (1 件)

MHN
MHN 2016 年 2 月 18 日
plot(cell2mat(strain_xx))
  1 件のコメント
James Taylor
James Taylor 2016 年 2 月 18 日
Thank you!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by