Plotting the data with extended field.

9 ビュー (過去 30 日間)
Steve Avilesmejia
Steve Avilesmejia 2020 年 10 月 28 日
回答済み: Shubham Khatri 2020 年 11 月 2 日
I need to plot this data in both in a scatter plot and a 2d line plot and I need the speed from 10-160 km/hr

回答 (1 件)

Shubham Khatri
Shubham Khatri 2020 年 11 月 2 日
Please take a look at the following code. To change the limits on the x axis, xlim function is used.
speed = [30 45 60 75 90 120];
thinkingmin = [6 9 11 15 17 22];
brakingcarmin = [5 12 21 33 48 86];
brakingmotorcyclemin = [2 4 9 17 27 82];
plot(speed,thinkingmin,speed,brakingcarmin,'r',speed,brakingmotorcyclemin,'g')
xlim([10 160])
legend('Thinking','Braking Car','Braking Motorcycle')
figure (2)
scatter(speed,thinkingmin)
hold on
scatter(speed,brakingcarmin)
hold on
scatter(speed,brakingmotorcyclemin)
xlim([10 160])
legend('Thinking','Braking Car','Braking Motorcycle')

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by