Plot on the same figure the calculated acceleration and the classification variable ds mapping
against time. Use left side y-axis and a line style to plot the acceleration. Use right side
y-axis to illustrate the driving style classification. Hint: You may use plotyy to complete this
task. Add labels to all axes. Add legend to the figure.
Table 2: Example of classification
acceleration value ds_mapping
-1.2 1
1.23 1
3.2 2
-4.3 3
9.5 0
close all,
clear all,
clc,
Acc = [ -1.2, 1.23, 3.2, -4.3, 9.5;
1.0, 1.00, 2.0, 3.0, 0.0]'
t = [0, 1, 2, 3, 4];
scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
plot(t,Acc(:,1),'r'); hold on,
plot(t,Acc(:,2),'b'); hold on,
grid on,
xlabel('--- Time(t) --->');
ylabel('Acceleration Vs ds-mapping');
title('Acceleration Vs ds-mapping','FontSize',20);
legend('Acceleraion','ds-mapping,''NorthWest');
Comments
Leave a comment