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

1 回表示 (過去 30 日間)
Quasirat Tarfi
Quasirat Tarfi 2018 年 3 月 8 日
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.

回答 (1 件)

Santosh Prasad Choudhury
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]');

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by