Plot 1D data of electromagnetics simulation

조회 수: 7 (최근 30일)
dj1du
dj1du 2021년 10월 26일
답변: Nipun 2024년 4월 15일
Hello everyone,
I calculated the current on a conducting wire when being exposed to electromagnetic radiation and would like to plot this data in Matlab. The mesh data consists of 50 segments and 49 vertices and the current in each segment is known. For 2D data I successfully used trisurf in the past, but plotting 1D data is new to me. Is there some function like trisurf for 1D data, which gives a result like shown below? A simple graph, in which current and position acts as abscissa and ordinate is no alternative for me, it should be a spatial plot like in the given image.

답변 (1개)

Nipun
Nipun 2024년 4월 15일
Hi,
I understand that you intend to plot a one dimensional data on a 3D plane in MATLAB as shown in the attached figure.
I assume that you that the data line is parallel to one axis, and at an offset to the other axis. In this case, the data varies along Y, has an offset at Z, and no dependency on X.
You can use the "plot3" function in MATLAB to plot the required data. Consider the following code in which a 1D line is plotted in 3D space.
n = 1000; % number of points
y_coord = linspace(0,100,1000); % data points
x_coord = zeros(size(y_coord)); % x-coordinates are 0
z_coord = 4*ones(size(y_coord));% same offset for all data points
% plot
plot3(x_coord, y_coord, z_coord)
For more information on "plot3" function in MATLAB, refer to the following MathWorks documentation:
Hope this helps.
Regards,
Nipun

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by