Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab plot antenna farfield in 3D

Status
Not open for further replies.

inception_

Newbie level 4
Joined
May 15, 2020
Messages
6
Helped
0
Reputation
0
Reaction score
1
Trophy points
3
Activity points
53
Hi,

I'm sure I'm not the first who ever asked about the problem of plotting a 3D farfield exported from CST MWS. However, since days I try to get a reasonable solution with mesh(), surf() and plot3() in Matlab. All of this does not work. I found a function that does the job: patternCustom(). But I do not have access to the Antenna Toolbox, so I want to plot it on my own. My question is: is there a way of plotting a 3D farfield exported from CST MWS in Matlab exploiting any "free" function like mesh(), surf() or plot3() (or maybe a function I do not know so far) to get a result as indicated below (click on link)?

https://de.mathworks.com/matlabcentral/answers/368054-3d-farfield-radiation-pattern

My idea was to use the following code:
Code:
%% init
clear all;
close all;
clc;

%% settings
file = "20200508_embedded_element_referenced.txt";
resample = 1; % take every xth value, 1 for no resampling

%% read data
data = dlmread(file, "", 2, 0);
theta = data(1:resample:end, 1); % values in degree
phi = data(1:resample:end, 2); % values in degree
ffdata = data(1:resample:end, 3); % directivity in dBi

%% transform spherical to cartesian coordinates
x = ffdata .* sind(theta) .* cosd(phi);
y = ffdata .* sind(theta) .* sind(phi);
z = ffdata .* cosd(theta);

%% plot farfield
figure;
plot3(x, y, z, 'x');

I know there is a function called sph2cart(), but the coordinate system definition of CST MWS and Matlab is different, so I use my own transformation formulas. The plot3() function just give me single data points, but I want the plot to look as with mesh() or surf().
 

Hi,

it is long time ago I used CST, but I frequently importing data into MATLAB.
Please upload an exported CST data file and the corresponding CST plot, to enable a look on the data structure and how its corresponding plot should look like.

greets
 

Hi stenzer.

Thanks for your reply.
Please find the files attached.


eda1_ff.PNG

eda2_ff.PNG
 

Attachments

  • testdata.txt
    5.4 MB · Views: 173

can you please refer any good book to learn matlab specially for plotting our data in matlab . A book that can help to understand and how to use matlab for graphing purposes.
 

Hi,

a good start is the implemented help function of MATLAB. Just enter e.g. "help plot" into the prompt of the command window. At the end of the corresponding help entry, also related functions/settings are listed.

BR
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top