MATLAB Answers

Swapping of data points

2 views (last 30 days)
sreeraj t
sreeraj t on 12 Apr 2018
I have a MATLAB code which has been attached with this question. when you run it and plot it (which has been already done in the program), the output file produces a zig-zag pattern. What really happens is that the values that is being written are being done so very randomly. For e.g. look the r(118,4) which is -32.654347733133000 and look at the value just below it r(119,4) which is 24.888699542411665 + 14.273828030014714i. If you look at the trend in which the fourth column goes one can see that whatever given in r(119,4) is unacceptable, but on the other-hand whatever in r(119,6)= -32.892395565247682 is acceptable. And once you do this for all the places where this happens, the plot becomes clear.
My question is why is this "root swapping" happens? And how can this be solved? I have tried 'sort' command, but that destroys whole order of 'r'.
Any help will be deeply appreciated...


Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!