I need to partition my plot

1 回表示 (過去 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 Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by