Export radiation pattern to stl
Show older comments
Hey there,
I try to export a radiation pattern (3D) in the .stl format. That's my code:
fc = 62e9;
pm = design(patchMicrostrip, fc);
pattern(pm, fc);
Now it would be great to export this pattern as .stl or something similar. I'll be greatful for every idea or hint.
Thanks in advance!
1 Comment
Answers (2)
Sai Kiran
on 21 Dec 2022
Hi,
Please follow the steps below to export the 3D radiation pattern to .stl format.
[D,A,E]=pattern(pm,fc)
where D is the Directivity, A is an array of azimuth angle and E is an array of elevation angle.
[A,E]=meshgrid(A,E);
Download the surf2stl function from the below link.
surf2stl('filename.stl',D,A,E);
The resultant stl file contains the 3D radiation pattern.
I hope it resolves your query.
Let's go the rest of the way.
% let's say we have the pattern data
l = linearArray;
[D A E] = pattern(l,70e6);
% yeah, we're gonna need to expand
[A E] = meshgrid(A,E);
% but we also need to change to cartesian
% note the change of units and the shift on D
[X Y Z] = sph2cart(deg2rad(A),deg2rad(E),D - min(D(:)));
% now the data is in a form that can be accepted by surf() or surf2stl()
hs = surf(X,Y,Z); axis equal
% but we really don't need to use surf2stl() if we don't want to
[F,V] = surf2patch(hs,'triangles'); % the 'triangles' option is needed
T = triangulation(F,V); % now we can just write it like any STL
stlwrite(T,'test.stl')
% for show and tell, let's just read it back and show it
T = stlread('test.stl');
figure
trisurf(T,'facecolor',[1 1 1]*0.8,'edgecolor','none')
view(3); view(-40,33); camlight;
axis equal; grid on
As an aside, trying to learn toolboxes I don't even have, while in the confines of the forum editor is really a cumbersome feeling.
See also:
Categories
Find more on STL (STereoLithography) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
