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?
回答 (1 件)
Manikanta Aditya
2024 年 11 月 13 日
0 投票
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:
- Antenna Toolbox Coordinate System: https://www.mathworks.com/help/antenna/gs/antenna-coordinate-system.html
- axes:https://www.mathworks.com/help/matlab/ref/axes.html
- show:https://www.mathworks.com/help/optim/ug/optim.problemdef.optimizationvariable.show.html
I hope this helps.
5 件のコメント
Robi
2024 年 11 月 14 日
Manikanta Aditya
2024 年 11 月 15 日
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.
Manikanta Aditya
2024 年 11 月 15 日
% 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');
Robi
2024 年 11 月 16 日
Robi
2024 年 11 月 16 日
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!