Wie kann man in der Antenna Toolbox die Funktion show() auf ein Koordinatensystem ax beziehen?

Mit show(antenna) kann sich eine gewählte Antenne grafisch in 3D darstellen lassen. Leider erscheint das Bild nur in einem zusätzlichen Fenster. Dadurch ist es offenbar unmöglich, eine entsprechende App, die show() nutzt, auf dem App-Server zu compilieren.
Gibt es dafür ein Workaround, so dass man die Darstellung der Antenne in einem eigenen UIAxes-Objekt darstellen lassen kann? Ist eine entsprechende Erweiterung wie etwa show(ax,antenna) geplant?

Antworten (1)

Hi,
I will be answering this question in English.
To display an antenna in a specific UIAxes object use the show() function from the Antenna Toolbox. You can use the axes function to set the current axes to your desired UIAxes before calling show().
To know more about, refer to the following documentation:
I hope this helps.

5 Kommentare

Thanks, but your solution doesn't run.
For example I want to show the antenna app.aktAntObj. Using
show(app.aktAntennaObj)
the antenna is shown in a separate Window, as expected.
But using the following code, the antenna is still to be seen in a separate Window and not in app.UIAxes3 as desired.
oldAxes=gca;
axes(app.UIAxes3);
show(app.aktAntObj);
hold(app.UIAxes3,'on');
axes(oldAxes);
Oh, thanks for reverting back.
There is another workaround I think using the plot function, which allows more direct control over where plots are rendered.
% First, get the geometry mesh data for your antenna
antennaMesh = mesh(app.aktAntObj);
% Switch to your desired UIAxes and plot
hold(app.UIAxes3, 'on'); % Hold to allow for multiple elements if necessary
trisurf(antennaMesh.Triangles, antennaMesh.Points(:,1), antennaMesh.Points(:,2), antennaMesh.Points(:,3), ...
'Parent', app.UIAxes3); % Plotting the antenna in app.UIAxes3
hold(app.UIAxes3, 'off');
  • mesh(app.aktAntObj) returns the triangular mesh data of the antenna, which includes vertices and faces.
  • trisurf(...) plots the triangular surface in the specified UIAxes (in this case, app.UIAxes3).
This approach should work for displaying the antenna in your specified UIAxes, as long as you’re only looking to visualize the geometry of the antenna model without requiring the additional rendering effects that show() provides.
% Get the geometry mesh of the antenna object
antennaMesh = mesh(app.aktAntObj);
% Clear previous content on UIAxes3 if needed
cla(app.UIAxes3); % Clears UIAxes3, preparing it for new content
% Plot the antenna mesh in app.UIAxes3 using trisurf
trisurf(antennaMesh.Triangles, ...
antennaMesh.Points(:,1), antennaMesh.Points(:,2), antennaMesh.Points(:,3), ...
'Parent', app.UIAxes3, ...
'EdgeColor', 'none'); % Use 'EdgeColor' as 'none' to make it look similar to show()
% Adjust axes for 3D view and hold settings
axis(app.UIAxes3, 'equal'); % Optional: for uniform scaling
view(app.UIAxes3, 3); % Set view to 3D
hold(app.UIAxes3, 'on'); % If you want to add more elements
% Customize appearance if desired
camlight(app.UIAxes3, 'headlight');
lighting(app.UIAxes3, 'gouraud');
Thanks, but this doesn't run. I think there are two reasens:
  1. The mesh depends on frequency, the higher frequency the smaller meshlength. Therefore the mesh must be computed with frequency.
  2. Matrices for Vertices and Faces must be transposed when using patch. Your solution produces an error.
The following solution ist tested with a lot of antennas.
antenna=app.aktAntObj;
% Compute mesh for desired frequency stored in app.fmax.Value
f=impedance(antenna,1e6*app.fmax.Value);
antennaMesh = mesh(antenna);
cla(app.UIAxes3);
P=antennaMesh.Points; % needs to be transposed later
Faces=antennaMesh.Triangles(1:3,:) % needs to be transposed later
patch(app.UIAxes3,'Faces',Faces','Vertices',P','FaceColor','cyan');
%axis(app.UIAxes3, 'equal'); % Optional: for uniform scaling
grid(app.UIAxes3,'on');
view(app.UIAxes3, 3); % Set view to 3D
hold(app.UIAxes3, 'on'); % If you want to add more elements
There is still another possibility I tested with success. I wrote the antenna data as an STL-File in %temp% und read ist back to the client.This was necessary because of my desired server solution.
A little change for higher speed. As the mesh is only computes for the picture you can reduce the frequency to 1 Mhz which is an practical value and sufficiant for good picture.
f=impedance(antenna,1e6);

Melden Sie sich an, um zu kommentieren.

Produkte

Version

R2024a

Gefragt:

am 7 Nov. 2024

Kommentiert:

am 16 Nov. 2024

Community Treasure Hunt

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

Start Hunting!