How to plot 3D radiation pattern together from 2 separated .OGL files data in Matlab
22 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to plot 2 raw data into one 3D radiation pattern plot. The raw data .txt file contain 4 columns (column 1: magE in dB, column 2: x axis, column 3: y axis, column 4: z axis). Please see below code:
% Read the data from both files
data1 = readmatrix('F902.txt');
magE1 = data1(:, 1);
x1 = data1(:, 2);
y1 = data1(:, 3);
z1 = data1(:, 4);
data2 = readmatrix('F915.txt');
magE2 = data2(:, 1);
x2 = data2(:, 2);
y2 = data2(:, 3);
z2 = data2(:, 4);
% Plot both radiation patterns
figure;
patternCustom(magE1, x1, y1, z1);
title('Radiation Pattern from F902.txt');
figure;
patternCustom(magE2, x2, y2, z2);
title('Radiation Pattern from F915.txt');
Errors:
Error using patternCustom
The value of 'theta' is invalid. Expected input to be finite.
Error in patternCustom (line 102)
parse(parseobj, MagE, theta, phi, varargin{:});
Error in Plot3D_2 (line 16)
patternCustom(magE1, x1, y1, z1);
Please advise. I also attached 2 .txt files. In addition, is there other way to perform this plot?
Thanks alot.
0 个评论
回答(1 个)
Walter Roberson
2024-11-14,20:39
patternCustom() does not accept x y z vectors. patternCustom accepts magE array or vector, and theta and phi vectors.
(In the case where magE is a vector, it must be N x 1 where N is the length of both theta and phi. Your code happens to match this restriction.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!