MATLAB: Plot array of x ,y both in 2 columns, got unexpected multiple line result.

MATLAB

Hi, :
I beg your pardon, I got some unexpected result of plot number of line. I have uploaded the .mat files which contained the x,y axes data.
The code is as below:
% plot_array_result_in_multiple_line.m
load('X.mat','X');
load('Y.mat','Y');
plot(log10(X(:,1)),20*log10(hypot(Y(:,1),Y(:,2))));
title( ['Plot Bode']);
xlabel( 'x=Freq-axis (in 10^n)') , ylabel( 'y=data value-axis (in dB)' );
grid on;
But I get 3 lines on the plot figure, as I expect to be only one. One is possible because of the hypot(), root of square , but there is another one (the lowest one) I thought it's very strange, its y-values seems same as reciprocal of x-values, Can anyone know why does it plot this ? And how to fix it ?
Thank you very much.

Best Answer

Just one line is ploted. See this:
% plot_array_result_in_multiple_line.m
load('X.mat','X');
load('Y.mat','Y');
h = plot(log10(X(:,1)),20*log10(hypot(Y(:,1),Y(:,2))));
title( ['Plot Bode']);
xlabel( 'x=Freq-axis (in 10^n)') , ylabel( 'y=data value-axis (in dB)' );
grid on;
findobj(h)
ans =
Line with properties:
Color: [0 0.4470 0.7410]
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerSize: 6
MarkerFaceColor: 'none'
XData: [1×3505 double]
YData: [1×3505 double]
ZData: [1×0 double]
Show all properties
The problem is that you have repeated X(1) values (i.e. X(371) == X(1773)), but the corresponding Y are different. For that reason you get "unexpected results".