Construction of various plots according to data with the NDGrid structure

4 次查看(过去 30 天)
This question addresses a slightly different aspect of the problem originally asked in the link above.
There are a number of parameters , for which a multidimensional computational grid is formed. Then the condition of fulfillment/non-fulfillment of the inequality is calculated.
[X Y Z]=ndgrid(-1:0.05:1,-1:0.05:1,-1:0.05:1);
Xgen=[];
Ygen=[];
Zgen=[];
F = X.^2 + Y.^2 + Z.^2;
cond1 = F > 1/2;
cond2 = F < 1;
cond1 = double(cond1);
cond2 = double(cond2);
cond1(cond1 == 0) = NaN;
cond2(cond2 == 0) = NaN;
cond = cond1.*cond2;
X = X.*cond; %A "mask" is superimposed on the parameters, showing at which points in space the inequality is fulfilled and at which it is not.
Y = Y.*cond;
Z = Z.*cond;
And then I got problems. I want to visualize the data obtained in a visual form so that I can see the internal structure (for this I thought to use the Contour, Contour3 or something like that) and use the resulting graphs to choose such a combination of parameters so that the inequality is fulfilled.
I decided to turn all the received data into two-dimensional tables with the following code:
for i=1:40 %Number of "pages" of the NDgrid
Xgen = [Xgen; X(:,:,i)];
end
for i=1:40
Ygen = [Ygen; Y(:,:,i)];
end
for i=1:40
Zgen = [Zgen; Z(:,:,i)];
end
But even here I did not manage to build anything digestible, except for all the "layers" received.
surf(Xgen,Ygen,Zgen)
I tried to apply the Contour and Contour3 commands, but without success. I get just empty plots, because the values of the z-axes are constant. I hoped that they would help me visualize the structure of the resulting computational domain. I don't know any other commands. Please suggest a way out.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by