フィルターのクリア

How can I obtain the difference between two data stored in workspace?

5 ビュー (過去 30 日間)
saleh shlimet
saleh shlimet 2023 年 11 月 30 日
コメント済み: Star Strider 2023 年 12 月 4 日
I experimentally tested a motor and the measured speed and the reference speed were stored in the workspace. My supervisor asked me to obtain the speed error (the difference between the reference and the measured speed). How can I obtain it from the data stored in the workspace?
  5 件のコメント
saleh shlimet
saleh shlimet 2023 年 12 月 3 日
thanks I tried hold on and it is working.
Star Strider
Star Strider 2023 年 12 月 3 日
As always, my pleasure!

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2023 年 11 月 30 日
If the two variables have the same number of elements, just subtract one from the other.
For example:
speed_error = reference - measured
That will give the error at each element of each vector.
If you want to get a single parameter with respect to the ‘speed_error’ vector, one option is to use the rms function to get the RMS error. To get the mean squared error, simply square the RMS result.
There are other options as well. The sum squared error is simply:
sum_squared_error = sum(speed_error.^2)
.
  5 件のコメント
saleh shlimet
saleh shlimet 2023 年 12 月 4 日
If the two variables do not have the same number of elements? how to find the error?
Star Strider
Star Strider 2023 年 12 月 4 日
Since they both by definition have to have the same sampling frequencies (so the differences between their respective time data are constant), the only way to calculate the error in that instance is to shorten the longer vector to the length of the shorter vector. Interpolating one ot the length of the other will not be appropriate.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by