How to remove unwanted double image in plot
Show older comments
Hi Fellas
I created this plot from a text file I imported into matlab, and I am not sure why the plot looks like it has these extra lines on it, particularly one going straight from the starting point to the end poin on the graph. I am not sure why this plot has this issue, as I looked through the text file and all of the numbers seem correct. The plot was originally generated using a network analyzer on an antenna, and no double lines were originally present. I have also not seen this issue with any of the other plots I have made in matlab. Any info on what could be the issue is appreciated. I have attached the matlab code file and the s parameter data below.

Accepted Answer
More Answers (1)
Image Analyst
on 26 Apr 2026 at 3:38
Try something like this with your data
[sortedx, sortOrder] = sort(x, 'ascend'); % Sort x and get the order it was sorted in.
sortedy = y(sortOrder); % Sort y the same way so the y stays matched up with its original x.
plot(sortedx, sortedy, 'b-', 'LineWidth', 2); % Plot the sorted data.
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
