BIVA ellipse incorrect when rotated / sizing issue

1 view (last 30 days)
Ive generated an ellipse and successfully rotated it about a fixed point. My problem is that the resulting rotated ellipse is much too large, with the axiis being much too large
my graph vs expected graph
Furthermore, I am working off the expected given values from the expected graph
with given semi-major, and semi-minor axii given
Im unsure what i've done wrong and just want to know if its an error with the paper or with my script
clear all;
close all;
% Creates the varaibles for the average mens impedance values:
load("mens_average_impedance_20t69_19t25.mat");
% creates AD5933 data variables:
load("Test1_Data_Averages.mat");
x = 0:RH_mean;
y = (XcH_mean / RH_mean) * x;
Height = 1.778;
GF = 93.089e-9;
% calculate Z score
ZR = ((Re_mean/Height)- (R_mean/Height)) / R_sd
ZXc = ((abs(Im_mean)/Height) - (Xc_mean/Height)) / Xc_sd
% Generate Rotation Matrix
rot_major = 68.68;
rot_minor = -21.32;
rot_matrix = [cosd(rot_major), sind(rot_major); ...
-sind(rot_major), cosd(rot_major)];
% Generate Ellipses
C = [RH_mean, XcH_mean] ; % center
a_95 = 161; % major axis
b_95 = 62; % minor axis
a_75 = 110; % major axis
b_75 = 42; % minor axis
a_50 = 77; % major axis
b_50 = 30; % minor axis
th = linspace(0,2*pi) ;
% 95% tolerance Elipse
xe_95 = C(1)+a_95*sin(th) ;
ye_95 = C(2)+b_95*cos(th) ;
xe_95_alligned = [xe_95 - C(1); ye_95 - C(2)]';
xe_95_shift = xe_95_alligned * rot_matrix;
% 75% tolerance Elipse
xe_75= C(1)+a_75*cos(th) ;
ye_75 = C(2)+b_75*sin(th) ;
xe_75_alligned = [xe_75-C(1); ye_75-C(2)]';
xe_75_shift = xe_75_alligned * rot_matrix;
% 50% tolerancee Elipse
xe_50 = C(1)+a_50*cos(th) ;
ye_50 = C(2)+b_50*sin(th) ;
xe_50_alligned = [xe_50-C(1); ye_50-C(2)]';
xe_50_shift = xe_50_alligned * rot_matrix;
% plot
plot(xe_95_shift(:,1)+C(1),xe_95_shift(:,2)+C(2), "r")
hold on
plot(C(1), C(2), "b*")
%plot(ZR, ZXc,"b*")
% plot(xe_95, ye_95, "k")
% plot(xe_75, ye_75, "k")
% plot(xe_50, ye_50, "k")
plot(x,y, "k")
plot(xe_75_shift(:,1)+C(1), xe_75_shift(:,2)+C(2), "r")
plot(xe_50_shift(:,1)+C(1), xe_50_shift(:,2)+C(2), "r")
xlabel("R/H, Ohm/m");
ylabel("Xc/H, Ohm/m");
Please let me know your thoughts, and if you have any issues running the code

Answers (1)

Tushar
Tushar on 4 Sep 2023
Hi Lachlan,
I understand that you are trying to plot an ellipse with respect to the data present in the MAT-files attached along. Here are some possible reasons for the issue:
  1. Inconsistency in axes alignment: The current plot doesn't match the expected figure in terms of axis scales and positioning.
  2. Ellipse distortion along the y-direction: The ellipse is similar to the expected figure in the x-direction, but blown out along the y-direction.
To address the first issue, you can try using the following lines of code:
% Plot the ellipse first
% Specify axis ticks and limits as shown in the expected figure attached
xlim([0 500]);
xticks([0:100:500]);
ylim([0 70]);
yticks([0:10:70]);
xlabel("R/H, Ohm/m");
ylabel("Xc/H, Ohm/m");
Here are some observation regarding the second issue:
  • It seems that variables like 'RH_mean' and 'XcH_mean' differ among different groups of people (e.g., 'Non-Hispanic white,' 'Non-Hispanic black'). However, the imported variables from the provided MAT-files are consistent across these groups. Please verify this discrepancy.
  • Could you explain the 'Re_mean' variable, since it is not present in the tables attached.
  • The rotation matrix appears to be correctly implemented, so there should not be any issues related to rotation.
I am attaching the following reference material/documentation to help you taking this forward -
With these resources, I believe you can make the necessary adjustments to achieve your desired ellipse plot.
Regards,
Tushar

Categories

Find more on Polar Plots in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!