Plot data from excel problem - Real flight data

2 views (last 30 days)
Hello the community,
I am facing a problem using Matlab for plotting data from excel sheet.
I am a private pilot and I used the Iphone app "Flight data reccorder" to reccord my flight yesterday. It sends me by mail a csv file with a lot if data like altitude, ground speed, longitude, etc...
I want to visualize in 3D my flight so I plotted the longitute, the lattitude and the altitude using plot3 after converting excel collumn into arrays.
Here is wat tI obtain:
untitled.png
As you can see on the upper side on the left there are some problems with the altitude at the begining and the end of the flight.
I checked the values of the altitude on my arrays and there is no problem the first value are about 300ft which was the altitude of the terrain.
When I plot pnly the alitude here is what it looks like:
altitude.JPG
The are problems at the boundaries as you can see. But the strange values in the plot don't appear in the array. Here are the first and last values int the array altitude:
tk.JPG ld.JPG
On the lft we have the take off and on the right landing.
I don't understand why whenI plot it there are the points at the beginings and the end at about 3000ft....
Does any one have an idea??
Thks in advance
Regards from France
Alex
  2 Comments
Walter Roberson
Walter Roberson on 14 Apr 2019
Can you attach the data?
Is it possible that you are using something like a moving average to smooth the data before plotting it? Moving average can introduce odd values at the two ends.
Alex LENFANT
Alex LENFANT on 14 Apr 2019
Thks for the quick reply.
Here is mat file of the altitude.
Regards

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Apr 2019
Your data is not numeric. Your data is categorical. When you plot(), you are plotting the category code numbers, not the values associated with the categories. That might potentially be okay if the category codes corresponding to sequential category values that were separated by a constant value, but that is not the case.
In particular, the category names got created in sorted order by characters. As in '1007.0' sorts far earlier than '298.0' ...
I speculate that you used importdata() to read in the Excel file, and had categorical selected.
I recommend that you instead use detectImportOptions() and readtable()

More Answers (1)

Alex LENFANT
Alex LENFANT on 15 Apr 2019
Edited: Alex LENFANT on 15 Apr 2019
Thank you it works!
Here is the final result:

Community Treasure Hunt

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

Start Hunting!