Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Generic selection (randomly selection) from two matrices

조회 수: 1 (최근 30일)
Ali Tawfik
Ali Tawfik 2020년 8월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
I am trying to select random values from angle_pss and thick_pss ?
How could I do the selection randomly like choose 1st index in angle pss with another index in thick_pss ??
I am attaching the code, with functions to run
Thanks,
clearvars;
close all;
clc;
syms s real;
rr=0;
factor=[0 0]
while (all(factor)<=1)||(all(factor)>=1.3)
angle_pss=[0 45 -45 30 90;45 -45 60 90 30;45 -45 60 90 30];
thick_pss=[.125 .15 .25 .5 1;.125 .15 .25 .5 1;.125 .15 .25 .5 1];
rr=rr+1
% STEP ONE
E1=1.4e3;E2=1.4e3;G12=.53e3;v12=.35;
if rr>length(angle_pss)
return
end
angle=angle_pss(:,rr)';
thickness=thick_pss(:,rr)';
% STEP TWO
S=q_cal(angle,E1,E2,G12,v12);
% STEP THREE
sigma1_c=1500; sigma2_c=246; sigma1_t=1500; sigma2_t=40; tau_12=68;
H1=(1/sigma1_t) - (1/sigma1_c); H11= 1/(sigma1_t*sigma1_c); H2=(1/sigma2_t) - (1/sigma2_c); H22=1/(sigma2_t*sigma2_c); H6=0; H66=1/(tau_12)^2;
H12=-1/2*sqrt(1/(sigma1_t*sigma1_c*sigma2_t*sigma2_c));
% STEP FOUR
[T_zinv,T_z_,Q_tran]=q_tran_cal(angle,S);
% STEP FIVE
Z=h_mid(angle,thickness);
% STEP SIX
[A,B,D]=abd_cal(angle,Z,Q_tran);
% STEP SEVEN
M=[A B;B D];
F=[0;0;0;0;0;10]; % ADD APPLIED FORCES HERE
%F=[N_x;N_y;N_xy;M_x;M_y;M_xy;]
E=M\F; % STRAIN % inv(M)*F
e=E(1:3);
k=E(4:end); % curvature
% STEP EIGHT
[sigmal_t,sigmal_m,sigmal_b]=stress_strain_cal(angle,e,Z,k,Q_tran,thickness,T_zinv,T_z_);
% STEPNINE
tsai_wu=zeros(2,1,length(angle));
for i=1:length(angle)
5789
tsai_wu(:,:,i)=double(solve((H1*sigmal_t(1,:,i)+H2*sigmal_t(2,:,i)+H6*sigmal_t(3,:,i))*s...
+(H11*sigmal_t(1,:,i)^2+H22*sigmal_t(2,:,i)^2+H66*(sigmal_t(3,:,i)^2)+2*H12*sigmal_t(1,:,i)*sigmal_t(2,:,i))*s^2==1,s))
tsai_w=tsai_wu(find(tsai_wu(:,:,i)>0),:,i)
factor(i)=tsai_w
end
thickness
angle
%%
% STEP EIGHT
end

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by