Help storing for loop iterations
조회 수: 2(최근 30일)
I am having trouble trying to calculate the stresses for each layer in a composite laminate, where the program prompts the user to input the number of layers, fiber orientation per layer and material properties, etc. The relevant parts of the code are as follows:
%prompts user for fiber angles and then stores values into a matrix.
fprintf('\n Layer %d:',i+1);
prompt=' The fiber angle of the ply is ';
%Qbar is a function with inputs Q and theta. Outputs a 3x3 stiffness matrix for each layer. (#layers=#matrices needed)
Later on, the 3x1 strain matrix for each layer is calculated using another function.
strain = Strains(eps_xo,eps_yo,gam_xyo,kap_xo,kap_yo,kap_xyo,z(i))
It works fine up until I try calculate the 3x1 stress matrix for each layer where Stress=Q_bar*strain. I tried using another for loop but I keep getting an error message stating "Subscripted assignment dimension mismatch." I'm fairly new to using matlab and am not really sure how to proceed.