フィルターのクリア

Plotting selective grid data

1 回表示 (過去 30 日間)
Prathamesh Khorgade
Prathamesh Khorgade 2024 年 2 月 15 日
回答済み: Shubham 2024 年 2 月 22 日
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.

回答 (1 件)

Shubham
Shubham 2024 年 2 月 22 日
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!

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by