MATLAB Answers

I did plot(x,y) with a set of data that is not in oder, and now my line plot looks terribly wrong. How can I fix this?

2 views (last 30 days)
Samantha Chin
Samantha Chin on 24 Jan 2020
Answered: Walter Roberson on 24 Jan 2020
So my code is pasted below, but I am really confused. I expected the line to go in order, but the line is going everywhere. can someone please help me
%% Part 2
data=xlsread('HWL 1 Data.xlsx');
% Separating data based on category
Heightdata= data(:,2);
Legdata= data(:,3);
Footdata= data(:,4);
Stridesdata= data(:,5);
StrideLengthdata= data(:,6);
StrideFreqdata= data(:,7);
Speeddata= data(:,8);
%% Means using mean() function
Heightmean= mean(Heightdata);
Legmean= mean(Legdata);
Footmean= mean(Footdata);
Stridesmean= mean(Stridesdata);
StrideLengthmean= mean(StrideLengthdata);
StrideFreqmean= mean(StrideFreqdata);
Speedmean= mean(Speeddata);
%% Standard Deviation using std() function
Heightstd= std(Heightdata);
Legstd= std(Legdata);
Footstd= std(Footdata);
Stridesstd= std(Stridesdata);
StrideLengthstd= std(StrideLengthdata);
StrideFreqstd= std(StrideFreqdata);
Speedstd= std(Speeddata);
%% Plots
x1= Heightdata
y1= Legdata


Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 24 Jan 2020
Before doing any processing, sortrows data based on column 2.


Sign in to comment.


Community Treasure Hunt

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

Start Hunting!

Translated by