I need to partition my plot

1 visualización (últimos 30 días)
Lidia Toscano
Lidia Toscano el 13 de En. de 2017
Comentada: Lidia Toscano el 13 de En. de 2017
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

Respuesta aceptada

John Chilleri
John Chilleri el 13 de En. de 2017
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 comentario
Lidia Toscano
Lidia Toscano el 13 de En. de 2017
Thank you for your quick response, that was just what I needed.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by