フィルターのクリア

How to write a range of numbers in MATLAB?

1 回表示 (過去 30 日間)
Abdul Rahim Mahayadin
Abdul Rahim Mahayadin 2018 年 4 月 18 日
編集済み: Abdul Rahim Mahayadin 2018 年 4 月 22 日
Hi, I am trying to generate a speed range in MATLAB. Let second by second vehicle speed data samples is V (km/h) = 0 13 27 38 54 70 84 93 102 98 66 37 25 9 0 22 41 75 81 98 105 92 85 43 61 48 17 13 6 3 0. How to write the coding to classify the value of V based on speed range of:
0<V<=60
60<V<=80
80<V<=110
V>110

回答 (2 件)

njj1
njj1 2018 年 4 月 18 日
v1 = V((V>0) & (V<=60)); numV1 = numel(v1);
v2 = V((V>60) & (V<=80)); numV2 = numel(v2);
v3 = V((V>80) & (V<=110)); numV3 = numel(v3);
v4 = V(V>110); numV4 = numel(v4);

Steven Lord
Steven Lord 2018 年 4 月 18 日

Use the histogram or histcounts functions, depending on whether or not you want a graphical representation of the distribution of your values.

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by