I need to partition my plot
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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.
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!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!