plot the function which is dependent on x, y and z with x, y and z on three axis.

3 vues (au cours des 30 derniers jours)
MADHVI
MADHVI le 18 Avr 2024
Modifié(e) : Torsten le 18 Avr 2024
D_value = 0.1;
L_value = 0.1;
B_value = 0.1;
x = 0:0.01:L_value/D_value;
y = 0:0.01:B_value/D_value;
z = 0:0.01:0.25;
[Y, X, Z] = meshgrid(y, x, z);
Ra_value = 80;
xi = 0.3;
R_value = Ra_value*xi;
A1_1_1 = -8.2516;
A1_1_2 = -1.7735;
A1_2_1 = -1.0336;
A1_2_2 = 0.6812;
A2_1_1 = -0.5388;
A2_1_2 = -0.8701;
A2_2_1 = -0.0329;
Phi_z = @(x,y,z) A1_1_1.*pi.*cos(pi.*Z) + 2.*A2_1_1.*pi.*cos(2.*pi.*Z) + A1_1_2.*pi.*cos((pi.*D_value.*Y)./B_value).*cos(pi.*Z) + 2.*A2_1_2.*pi.*cos((pi.*D_value.*Y)./B_value).*cos(2.*pi.*Z) + A1_2_1.*pi.*cos((pi.*D_value.*X)./L_value).*cos(pi.*Z) + 2.*A2_2_1.*pi.*cos((pi.*D_value.*X)./L_value).*cos(2.*pi.*Z) + A1_2_2.*pi.*cos((pi.*D_value.*Y)./B_value).*cos((pi.*D_value.*X)./L_value).*cos(pi.*Z);
xlabel('x');
ylabel('y');
zlabel('z');
plot the function Phi_z.

Réponses (2)

Torsten
Torsten le 18 Avr 2024
Modifié(e) : Torsten le 18 Avr 2024
You can plot the function on slices (i.e. 2d-objects (e.g. planes)) through the volume of interest.
Of course a full plot over a 3d-volume is not possible because we cannot see in 4d.
D_value = 0.1;
L_value = 0.1;
B_value = 0.1;
x = 0:0.01:L_value/D_value;
y = 0:0.01:B_value/D_value;
z = 0:0.01:0.25;
[X,Y,Z] = meshgrid(x,y,z);
Ra_value = 80;
xi = 0.3;
R_value = Ra_value*xi;
A1_1_1 = -8.2516;
A1_1_2 = -1.7735;
A1_2_1 = -1.0336;
A1_2_2 = 0.6812;
A2_1_1 = -0.5388;
A2_1_2 = -0.8701;
A2_2_1 = -0.0329;
Phi_z = @(X,Y,Z) A1_1_1.*pi.*cos(pi.*Z) + 2.*A2_1_1.*pi.*cos(2.*pi.*Z) +...
A1_1_2.*pi.*cos((pi.*D_value.*Y)./B_value).*cos(pi.*Z) +...
2.*A2_1_2.*pi.*cos((pi.*D_value.*Y)./B_value).*cos(2.*pi.*Z) +...
A1_2_1.*pi.*cos((pi.*D_value.*X)./L_value).*cos(pi.*Z) +...
2.*A2_2_1.*pi.*cos((pi.*D_value.*X)./L_value).*cos(2.*pi.*Z) +...
A1_2_2.*pi.*cos((pi.*D_value.*Y)./B_value).*cos((pi.*D_value.*X)./...
L_value).*cos(pi.*Z);
slice(X,Y,Z,Phi_z(X,Y,Z),(x(1)+x(end))/2,[],[])
xlabel('x');
ylabel('y');
zlabel('z');
colorbar

Fangjun Jiang
Fangjun Jiang le 18 Avr 2024
Modifié(e) : Fangjun Jiang le 18 Avr 2024
You are asking for the impossible, the visualization of the 4th dimension.
  1. I thought it was impossible in three dimentional world.
  2. There migth be some methods to "help" the visualization. https://en.wikipedia.org/wiki/Four-dimensional_space
  3. I can't think of any built-in method in MATLAB that can help. Maybe, you could plot a dot at each and every point of the whole (x,y,z) grid. Set the color of the dot according to the value of Phi_z. Could that be regarded as the visualization of the 4th dimension? Not sure what is the visual effect though.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by