Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Matlab plot antenna farfield in 3D

inception_

Newbie level 4
Joined
May 15, 2020
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
49
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().
 

stenzer

Full Member level 4
Joined
Oct 1, 2012
Messages
216
Helped
27
Reputation
54
Reaction score
24
Trophy points
1,298
Activity points
3,218
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
 

inception_

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

Thanks for your reply.
Please find the files attached.


eda1_ff.PNG
eda2_ff.PNG
 

Attachments


Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top