can u tell me how to extract first 5 columns and draw a subplot

1 view (last 30 days)
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.

Answers (1)

Santosh Prasad Choudhury
Santosh Prasad Choudhury on 8 Mar 2018
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]');

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!