I need to partition my plot

조회 수: 7 (최근 30일)
Lidia Toscano
Lidia Toscano 2017년 1월 13일
댓글: Lidia Toscano 2017년 1월 13일
I have a data set of 899 points. I can partition my data to plot the first 300 points but I don't know how to do that for the equation that computes the distance_error_rms:
distance_error_rms=sqrt(sum(sub_off_radial)/length(gps_distance))
I want to plot the first 300 points and I want the distance error rms to match that plot. Also, I want to print the answer on the plot. How do I do that?
off_radial=0; %distance away from leader in meters
gps_distance=acos(cos(deg2rad(90-LatA)).*cos(deg2rad(90-LatWP))+sin(deg2rad(90-LatA)).*sin(deg2rad(90-LatWP)).*cos(deg2rad(LonA-LonWP)))*6371*1000;
sub_off_radial=((gps_distance-off_radial).^2);
distance_error_rms=sqrt(sum(sub_off_radial)/length(gps_distance)) %How do I partition this for 1-300 points
figure('Color','White')
plot(gps_distance(1:300)) %This partitions my plot 1-300
ylabel('GPS Distance - meters')
xlabel('Samples at 10Hz')
legend('GPS Distance - 899 Sampes')
title('RMS off radial=0 - 10Hz 02Dec2016 Test 1')
grid
Thanks in advance
Lidia

채택된 답변

John Chilleri
John Chilleri 2017년 1월 13일
Hello,
It seems like you could just redefine distance_error_rms at the end as:
distance_error_rms = distance_error_rms(1:300);
Otherwise when you create it, place a (1:300) on all vectors in its computation.
To print your answer on the plot, use text.
TLDR for text: type text(x,y,txt) where x,y specifies the location of the string, and txt is the string to be printed.
Hope this helps, please comment if I didn't cover something, I answered this in a hurry!
  댓글 수: 1
Lidia Toscano
Lidia Toscano 2017년 1월 13일
Thank you for your quick response, that was just what I needed.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by