필터 지우기
필터 지우기

How do I find variable values for functions?

조회 수: 5 (최근 30일)
Matthew Pearson
Matthew Pearson 2015년 9월 16일
댓글: Walter Roberson 2015년 9월 16일
How do I use the find function to solve for a variable? I have an equation involving height and time and I want to find the value for time when the height y equals 0. I created a vector for time already.

답변 (1개)

Thorsten
Thorsten 2015년 9월 16일
Use logical indexing:
time_where_height_is_zero = time(height == 0)
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 9월 16일
Caution: if there are no points where height is exactly 0 then this will produce an empty answer. If you have a 0 crossing, such as if adjacent entries are 1e-7 and -9.99e-15 then using the above will only notice that none of the answers are exactly 0 and will not notice that the value went "through" 0.
Basically, using the "find function" is usually not a good idea to find the root of an equation.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by