3-D plot with 3 variables resulting in 3 responses

2 Ansichten (letzte 30 Tage)
Osman AKYUREK
Osman AKYUREK am 18 Aug. 2022
Kommentiert: Cris LaPierre am 22 Aug. 2022
Hello Everyone,
I am trying to create a 3-d plot with 3 independent variables that result in 3 responses in the three orthogonal directions of the structure. EF= scaling factor that I used amplifies the earthquake effect in the dynamic analysis. I want to see a 3-d plot concerning the change of EF in three orthogonal directions. Any help will be appreciated. Here is the code that I simplified and attached below.
Best,
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load('Earthquake_Elcenctro_data.mat') % loading Elcentro data in g
load('repsonses.mat')
Qx=Elctorsion(2,:) % rotation in radyan about x-direction
Qx = 1×2501
1.0e+00 * -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0001 -0.0001 -0.0000 -0.0000 -0.0000 0.0001 0.0001 0.0000 -0.0000 -0.0001 -0.0002 -0.0001 -0.0000 0.0001 0.0000 0.0000 0.0000 -0.0000
Qy=Qx; % rotation in radyan about y-direction
Qz=Qx; % rotation in radyan about z-direction
T=zeros(4,4,5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ux=max(abs(yout(:,9)));
Uy=max(abs(yout(:,18)));
Uz=0;
%%%% building geometric and earthquake data inputs
Tx=max(abs(Elcxyonu(2,:))); % earthquake data x-translational component in g
Ty=max(abs(Elcyyonu(2,:))); % earthquake data y-translational component in g
Tz=max(abs(Elczyonu(2,:))); % earthquake data z-translational component in g
dx=max(abs(Elctorsion(2,:))); % earthquake data x-rotational component in radyan
dy=dx; % earthquake data y-rotational component in radyan
dz=dx; % earthquake data z-rotational component in radyan
Umax=[Ux Uy Uz]'; % top floor displacement vector over time without rotaional components of earthquake.
for i=1:5
%%%% rotation matrix with Eular angles
R=[cos(Qy(i))*cos(Qz(i)), -cos(Qy(i))*sin(Qz(i)), sin(Qy(i));
(sin(Qx(i))*sin(Qy(i))*cos(Qz(i))+cos(Qx(i)*sin(Qz(i)))), sin(Qx(i))*sin(Qy(i))*sin(Qz(i))+cos(Qx(i))*cos(Qz(i)), sin(Qx(i))*sin(Qy(i));
sin(Qx(i))*sin(Qz(i))-cos(Qx(i))*sin(Qy(i))*cos(Qz(i)), sin(Qx(i))*cos(Qz(i))-cos(Qx(i))*sin(Qy(i))*sin(Qz(i)) , cos(Qx(i))*cos(Qy(i))];
%%%% Transformation matrix
T(:,:,i)=[R Umax;
zeros(1,3) ones(1,1)];
end
Ef=zeros(1,4);
t=1;
xyz=zeros(90405:4);
UT_max=zeros(4,1,5);
%%%% Final total translation response including rotational components
for i=0:0.5:10
for j=0:0.5:10
for k=0:0.5:20
for z=1:5
Ef=[i,j,k ones(1,1)]';
UT_max(:,:,t)=T(:,:,z)*Ef;
xyz(t,:)=Ef;
t=t+1;
end
end
end
end
N=length(UT_max)
N = 90405
result=zeros(N,1);
for i=1:N
resultx(i)=UT_max(1,1,i);
resulty(i)=UT_max(2,1,i);
resultz(i)=UT_max(3,1,i);
end
result=[resultx; resulty;resultz]';
figure(1)
scatter3(xyz(:,1),xyz(:,2),xyz(:,3),result);
Error using scatter3
Value must be a vector of positive numeric type or nan.
xlabel('Amplification factor (Ef_x)');
ylabel('Amplification factor (Ef_y)')
zlabel('Amplification factor (Ef_z)')
figure(2)
pdeplot3D(xyz(:,1),xyz(:,2),xyz(:,3),"ColorMapData",result);
xlabel('Amplification factor (Ef_x)');
ylabel('Amplification factor (Ef_y)')
zlabel('Amplification factor (Ef_z)')

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 18 Aug. 2022
Bearbeitet: Cris LaPierre am 18 Aug. 2022
Some of your values in your variable result are <=0. They must be positive (can't have a marker with a size <=0)
  6 Kommentare
Osman AKYUREK
Osman AKYUREK am 22 Aug. 2022
Bearbeitet: Cris LaPierre am 22 Aug. 2022
Hi Criss,
You are right. I changed my code. There are only two direction I am considering right now which are EFx and EFy, and EFz is neglected. The results separately resultx and resulty depends on EFx and EFy. We can now mesh-grid (EFx, EFy) and get the surf plot according to your explanation. Thanks in advance. The updated code is below;
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load('Earthquake_Elcenctro_data.mat') % loading Elcentro data in g
load('repsonses.mat')
Qx=Elctorsion(2,:) % rotation in radyan about x-direction
Qy=Qx; % rotation in radyan about y-direction
Qz=Qx; % rotation in radyan about z-direction
T=zeros(4,4,5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ux=max(abs(yout(:,9)));
Uy=max(abs(yout(:,18)));
Uz=0;
%%%% building geometric and earthquake data inputs
Tx=max(abs(Elcxyonu(2,:))); % earthquake data x-translational component in g
Ty=max(abs(Elcyyonu(2,:))); % earthquake data y-translational component in g
Tz=max(abs(Elczyonu(2,:))); % earthquake data z-translational component in g
dx=max(abs(Elctorsion(2,:))); % earthquake data x-rotational component in radyan
dy=dx; % earthquake data y-rotational component in radyan
dz=dx; % earthquake data z-rotational component in radyan
Umax=[Ux Uy Uz]'; % top floor displacement vector over time without rotaional components of earthquake.
for i=1:5
%%%% rotation matrix with Eular angles
R=[cos(Qy(i))*cos(Qz(i)), -cos(Qy(i))*sin(Qz(i)), sin(Qy(i));
(sin(Qx(i))*sin(Qy(i))*cos(Qz(i))+cos(Qx(i)*sin(Qz(i)))), sin(Qx(i))*sin(Qy(i))*sin(Qz(i))+cos(Qx(i))*cos(Qz(i)), sin(Qx(i))*sin(Qy(i));
sin(Qx(i))*sin(Qz(i))-cos(Qx(i))*sin(Qy(i))*cos(Qz(i)), sin(Qx(i))*cos(Qz(i))-cos(Qx(i))*sin(Qy(i))*sin(Qz(i)) , cos(Qx(i))*cos(Qy(i))];
%%%% Transformation matrix
T(:,:,i)=[R Umax;
zeros(1,3) ones(1,1)];
end
Ef=zeros(1,4);
t=1;
xyz=zeros(90405:4);
UT_max=zeros(4,1,5);
%%%% Final total translation response including rotational components
for i=0:0.5:10
for j=0:0.5:10
% for k=0:0.5:20
k=0
for z=1:5
Ef=[i,j,k ones(1,1)]';
UT_max(:,:,t)=T(:,:,z)*Ef;
xyz(t,:)=Ef;
t=t+1;
end
% end
end
end
N=length(UT_max)
result=zeros(N,1);
for i=1:N
resultx(i)=abs(UT_max(1,1,i));
resulty(i)=abs(UT_max(2,1,i));
resultz(i)=abs(UT_max(3,1,i));
end
result=[resultx; resulty;resultz]';
figure(1)
surf(xyz(:,1),xyz(:,2),resultx);
xlabel('Amplification factor (Ef_x)');
ylabel('Amplification factor (Ef_y)')
zlabel('Result in the x-direction')
figure(2)
pdeplot3D(xyz(:,1),xyz(:,2),resultx,"ColorMapData",result);
xlabel('Amplification factor (Ef_x)');
ylabel('Amplification factor (Ef_y)')
zlabel('Result in the x-direction')
Cris LaPierre
Cris LaPierre am 22 Aug. 2022
In this case, I would just use reshape to turn the X, Y, and Z data into matrices
X = reshape(xyz(:,1),105,[]);
Y = reshape(xyz(:,2),105,[]);
Z = reshape(resultx,105,[]);
The 105 comes from the fact that the first 105 rows of xyz are all for the same X value, so I assume that is one of the dimensions of your grid. The '[]' allows reshape to figure out what the second dimension is automatically.
I'm not sure what you are trying to do with pdeplot, but you do not appear to be using it correctly (for example, you have not created nor passed in a PDEModel object), so I have removed it.
load('Earthquake_Elcenctro_data.mat') % loading Elcentro data in g
load('repsonses.mat')
Qx=Elctorsion(2,:) % rotation in radyan about x-direction
Qx = 1×2501
1.0e+00 * -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0001 -0.0001 -0.0000 -0.0000 -0.0000 0.0001 0.0001 0.0000 -0.0000 -0.0001 -0.0002 -0.0001 -0.0000 0.0001 0.0000 0.0000 0.0000 -0.0000
Qy=Qx; % rotation in radyan about y-direction
Qz=Qx; % rotation in radyan about z-direction
T=zeros(4,4,5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ux=max(abs(yout(:,9)));
Uy=max(abs(yout(:,18)));
Uz=0;
%%%% building geometric and earthquake data inputs
Tx=max(abs(Elcxyonu(2,:))); % earthquake data x-translational component in g
Ty=max(abs(Elcyyonu(2,:))); % earthquake data y-translational component in g
Tz=max(abs(Elczyonu(2,:))); % earthquake data z-translational component in g
dx=max(abs(Elctorsion(2,:))); % earthquake data x-rotational component in radyan
dy=dx; % earthquake data y-rotational component in radyan
dz=dx; % earthquake data z-rotational component in radyan
Umax=[Ux Uy Uz]'; % top floor displacement vector over time without rotaional components of earthquake.
for i=1:5
%%%% rotation matrix with Eular angles
R=[cos(Qy(i))*cos(Qz(i)), -cos(Qy(i))*sin(Qz(i)), sin(Qy(i));
(sin(Qx(i))*sin(Qy(i))*cos(Qz(i))+cos(Qx(i)*sin(Qz(i)))), sin(Qx(i))*sin(Qy(i))*sin(Qz(i))+cos(Qx(i))*cos(Qz(i)), sin(Qx(i))*sin(Qy(i));
sin(Qx(i))*sin(Qz(i))-cos(Qx(i))*sin(Qy(i))*cos(Qz(i)), sin(Qx(i))*cos(Qz(i))-cos(Qx(i))*sin(Qy(i))*sin(Qz(i)) , cos(Qx(i))*cos(Qy(i))];
%%%% Transformation matrix
T(:,:,i)=[R Umax;
zeros(1,3) ones(1,1)];
end
Ef=zeros(1,4);
t=1;
xyz=zeros(90405:4);
UT_max=zeros(4,1,5);
%%%% Final total translation response including rotational components
for i=0:0.5:10
for j=0:0.5:10
% for k=0:0.5:20
k=0;
for z=1:5
Ef=[i,j,k ones(1,1)]';
UT_max(:,:,t)=T(:,:,z)*Ef;
xyz(t,:)=Ef;
t=t+1;
end
% end
end
end
N=length(UT_max)
N = 2205
result=zeros(N,1);
for i=1:N
resultx(i)=abs(UT_max(1,1,i));
resulty(i)=abs(UT_max(2,1,i));
resultz(i)=abs(UT_max(3,1,i));
end
result=[resultx; resulty;resultz]';
X = reshape(xyz(:,1),105,[]);
Y = reshape(xyz(:,2),105,[]);
Z = reshape(resultx,105,[]);
figure(1)
surf(X,Y,Z);
xlabel('Amplification factor (Ef_x)');
ylabel('Amplification factor (Ef_y)')
zlabel('Result in the x-direction')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Earthquake Engineering finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by