How can I plot a combined of attached photos (triangular domain)?

Hi friends
I plotted some figures using followin code with several Delta:
delta = 0.05;
[z, y] = meshgrid(0:delta:0.8660254, -0.5:delta:0.5);
s = (0.1069166660e0 .* (0.36e2 .* (z - sqrt(0.3e1) ./ 0.2e1) .^ 2 .* y .^ 2 + (0.3e1 .* y .^ 2 - z .^ 2 - 0.2e1 .* (z - sqrt(0.3e1) ./ 0.2e1) .* z) .^ 2) ./ (0.370370196e0 .* (z - sqrt(0.3e1) ./ 0.2e1) .* (0.3e1 .* y .^ 2 - z .^ 2) + 0.1e1) + 0.1e1) ./ (0.370370196e0 .* (z - sqrt(0.3e1) ./ 0.2e1) .* (0.3e1 .* y .^ 2 - z .^ 2) + 0.1e1);;
s(y<-0.5773502692.*z) = NaN;
s(y>0.5773502692.*z) = NaN;
surf(z, y, s,'FaceColor','interp','FaceLighting','phong');
the following figures have been plotted using delta=0.005, 0.005, 0.05 and 0.01, respectively.
As it is obvious, the boundary of triangular domain is good in 1st and 2nd figures but their Edges is so high which if i show them, the figure's color will be black!
about the third figure, the number of edges is good but its boundary is so bad.
I want to generate the combining of 1st figure and the figure with similar edge density to 3rd figure.
If you know please answer to my question as simple as you can.
Thanks a lot

 Accepted Answer

You could try plotting both of them on the same axes:
funZY = @(d) meshgrid(0:d:0.8660254, -0.5:d:0.5);
funS = @(z,y) (0.1069166660e0 .* (0.36e2 .* (z - sqrt(0.3e1) ./ 0.2e1) .^ 2 .* y .^ 2 + (0.3e1 .* y .^ 2 - z .^ 2 - 0.2e1 .* (z - sqrt(0.3e1) ./ 0.2e1) .* z) .^ 2) ./ (0.370370196e0 .* (z - sqrt(0.3e1) ./ 0.2e1) .* (0.3e1 .* y .^ 2 - z .^ 2) + 0.1e1) + 0.1e1) ./ (0.370370196e0 .* (z - sqrt(0.3e1) ./ 0.2e1) .* (0.3e1 .* y .^ 2 - z .^ 2) + 0.1e1);
funN = @(z,y) y<(-0.5773502692.*z) | y>(0.5773502692.*z);
[surfZ,surfY] = funZY(0.0005);
[gridZ,gridY] = funZY(0.05);
surfS = funS(surfZ,surfY);
gridS = funS(gridZ,gridY);
surfS(funN(surfZ,surfY)) = NaN;
gridS(funN(gridZ,gridY)) = NaN;
surf(surfZ, surfY, surfS,'FaceColor','interp','FaceLighting','phong','EdgeColor','none');
hold on
surf(gridZ, gridY, gridS,'FaceColor','none','FaceLighting','phong');
view(43,20)

4 Comments

thank you, but this method has two problems:
1) all the surface has not covered with edges and some areas near boundaries have not edges.
2) I want to use myaa.m file to generate a figure with more smooth curves. but if we use myaa.m file in order to generate the above figure, result's shape is not so good (following shape):
the above figure has not a good shape to submit to an isi journal!
However, thank you for your help.
Patches themselves have edges, and when these are shown on the figure what seems like a "smooth" edge is not: it is just lots of tiny patches. So there is an inherent contradiction because it is not possible to get "smooth" edges without lots of patches. With surf you can either choose "smooth" edges (lots of patches) and curves XOR fewer, larger patches with edges. You cannot have both using surf and have their extremities (i.e. outlines) matching.
I would suggest an alternative:
  • plot the colored surface without any edges.
  • calculate your own grid and outline (perhaps analytically) and plot this using plot3.
thank you very much Stephen
your idea was the best one and i could plot the best figure!
look at it:
I am glad to help. You can also Accept the answer that best resolves your question.

Sign in to comment.

More Answers (1)

Basically you want the technique I used in this blog post about surface interpolation. You want to draw the high-res one with FaceColor='interp' and EdgeColor='none'. Then, with hold on, you draw the low-res one with FaceColor='none' and EdgeColor='black'. They're not going to line up perfectly around the nans though.

3 Comments

thank you Mike, but is it possible to apply your method on my code?
I have copied and pasted the definition of function "interpsurf(z, method)" in command window, but it errors:
??? function interpsurf(z, method) | Error: Function definitions are not permitted in this context.
what should i do? can you explain more?
Save it somewhere on your MATLAB search path as interpsurf.m (in its own .m-file). You should then be able to call it without error.

Sign in to comment.

Asked:

on 20 Jan 2016

Commented:

on 21 Jan 2016

Community Treasure Hunt

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

Start Hunting!