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 1 below : Example of classification
acceleration value
-1.2 1
1.23 1
3.2 2
-4.3 3
9.5 0
ds mapping values
1
1
2
3
close all,
clear all,
clc,
Acc = [-1.2, 1.23, 3.2, -4.3, 9.5];
ds_mapping = [1,1,2,3,0];
scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
subplot(1,2,1);
plot(Acc,'r');
grid on,
xlabel('--- Time(t) --->');
ylabel('Acceleration');
title('Plot: Acceleration','FontSize',20);
subplot(1,2,2);
plot(ds_mapping,'r');
grid on,
xlabel('--- Time(t) --->');
ylabel('ds_mapping');
title('Plot: ds-mapping','FontSize',20);
Comments
Leave a comment