how to plot values that only fall within a range?

조회 수: 1(최근 30일)
isamh 2020년 1월 15일
댓글: isamh 2020년 1월 15일
have an excel file where i am plotting the values that are around 113 KPH. there are thousands of rows for that specifc column and i just wanna plot the Y values that fall between 111KPH and 114 KPH. I also am trying to add the average of those data points but that doesnt seem to work as well. I attached the plot which is incorrect and for some reason is between 0 and 1.
code is:
%%% 70 MPH KPH vs Time
figure(1)
FVY = (Y >= 111 & Y <= 114)
KPH_70 = mean(FVY);
yyaxis left
plot(X,FVY);
yyaxis right
plot(X,KPH_70);

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J 2020년 1월 15일
편집: Matt J 2020년 1월 15일
KPH_70 = mean(Y(FVY));
yyaxis left
plot(X(FVY),Y(FVY));
yyaxis right
plot(X(FVY),KPH_70*ones(size(FVY)));
댓글 수: 17표시숨기기 이전 댓글 수: 16
isamh 2020년 1월 15일
works great, Thanks so much!!

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!