can u tell me how to extract first 5 columns and draw a subplot
1 次查看(过去 30 天)
显示 更早的评论
Write a script to: 1. Extract data from the ev data dataset time in seconds [Time] speed in km/h [Speed] gear [Gear] elevation in meters [Elv] SOC (state-of-charge) in % [SOC] battery voltage in V [Pack Volts] battery current in A [Pack Amps] 2. Plot each variable listed above against time in a form of a subplot. There should be 6 subplots in total. Align the subplots horizontally. Use a different colour for each plot. Add labels to all axes.
0 个评论
回答(1 个)
Santosh Prasad Choudhury
2018-3-8
save all data into individual variables respectively. subplot(1,6,1); plot(time,speed,'r'); legend('Speed'); xlabel('Time[sec]'); ylabel('Speed[km/h]'); subplot(1,6,2); plot(time,gear,'y'); legend('Gear'); xlabel('Time[sec]'); ylabel('Gear[-]'); subplot(1,6,3); plot(time,elevation,'g'); legend('Elv'); xlabel('Time[sec]'); ylabel('Elv[meter]'); subplot(1,6,4); plot(time,state_of_charge,'b'); legend('SOC'); xlabel('Time[sec]'); ylabel('SOC[%]'); subplot(1,6,5); plot(time,battery_voltage,'m'); legend('PackVolt'); xlabel('Time[sec]'); ylabel('PackVolt[V]'); subplot(1,6,6); plot(time,battery_current,'c'); legend('PackAmps'); xlabel('Time[sec]'); ylabel('PackAmps[A]');
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!