Finding the time constant

25 ビュー (過去 30 日間)
donnabelle
donnabelle 2015 年 3 月 20 日
コメント済み: Image Analyst 2015 年 3 月 20 日
I have been given two vectors, x and y, and I need to find the time constant for these data points. I graphed the data using "plot(x,y) I basically need to find the value of x for a given value of y. Is there a specific Matlab function to calculate the exact answer for the time constant? I was able to approximate a function using the data cursor tool but I think there has to be a way to get a more accurate time content. any ideas?

採用された回答

Adam
Adam 2015 年 3 月 20 日
doc find
This will give you the index of the x value matching a given condition such as y == 37.
  2 件のコメント
donnabelle
donnabelle 2015 年 3 月 20 日
thanks!
Image Analyst
Image Analyst 2015 年 3 月 20 日
donnabelle, be aware that code may only work with integers or with certain other situations, like where you're comparing the array with an exact element of the array, not some number generated elsewhere or typed in. To do that you need to use a tolerance like I tried to show you in my answer (which of course will also work with integers as well). Please see the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 3 月 20 日
Try this:
tolerance = 0.0001;
indexes = find(abs(y-yDesired)<tolerance);
xMatches = x(indexes);

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by