Borrar filtros
Borrar filtros

Plotting selective grid data

1 visualización (últimos 30 días)
Prathamesh Khorgade
Prathamesh Khorgade el 15 de Feb. de 2024
Respondida: Shubham el 22 de Feb. de 2024
Respected Madam/ Sir,
I am trying to understand the interaction between 5 different stresses for certain material, of which 2 (tau13 and sigma33) I have held constant and the other three (sigma22, tau12, and tau23), I am varying with "meshgrid". However, I want to plot these 3 stresses based on a certain condition (iff_phi ==1), which needs to be checked at different values of phi. For a certain value of phi, if iff_phi == 1 is satisfied, then I need to plot these stresses/ save these stresses, delete the points in meshgrid for the sigma22, tau12, and tau23 then go to next value of phi. After checking for all values for phi, I need one isosurface and then head on to the next set of tau13 and sigma33 and carry on the same operation for all the values of sigma22, tau12, and tau23. I have written the attached code, however, unable to find a solution to save, plot and delete selective data from meshgrid.
Any sort of help is deeply solicited.
Sincerely,
Prathamesh Khorgade.

Respuestas (1)

Shubham
Shubham el 22 de Feb. de 2024
Hi Prathamesh,
It seems that you are trying to plot the stresses based on condition “iff_phi==1”. You want to save those plots and delete the corresponding points from the meshgrid. By delete the points in meshgrid phrase, I am assuming that you do not intend to use the same points that resulted in “iff_phi==1” condition for further analysis.
You can use the provided condition to create a logical array. The array can then be used as indices for extracting relevant data points and plotting them.
For example, refer to the following code snippet:
condition = iff_phi==1;
scatter3(sigma2Grid(condition),t12Grid(condition),t23Grid(condition), 'filled');
You can also change the condition to check if “iff_phi” is approximately equal to 1 by introducing a threshold:
threshold = 0.1;
condition = abs(iff_phi - 1) < threshold;
After creating the plot, you can save the data in a *.mat“ format, or export the 3D figure by referring to the following MATLAB Answer: https://www.mathworks.com/matlabcentral/answers/473586-is-there-a-way-to-export-save-a-matlab-3d-figure-so-that-a-3rd-party-can-view-it-with-the-rotation-e
As for “deleting” the data points in the meshgrid, you can assign them “NaN” values to prevent them from further consideration. For example, you can modify “sigma2Grid” as:
sigma2Grid(condition) = NaN;
You can further use logical indexing to store the data points that fulfilled the mentioned condition for creating the isosurface” plot.
I hope this helps!

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by