Question about find function on matlab and

I am trying to use the find function to locate the index where x = 4 is located but every time I see the value its 401 can someone please because i dont understand this at all.

回答 (3 件)

Walter Roberson
Walter Roberson 2018 年 11 月 1 日

1 投票

The output is correct.
The first x is 0. You increment by 0.01. So the N'th entry in x, x(N), contains (N-1)/100. Thus x(401) contains (401-1)/100 = 400/100 = 4.0. And that never changes.
madhan ravi
madhan ravi 2018 年 11 月 1 日
編集済み: madhan ravi 2018 年 11 月 1 日

0 投票

x0 = 4 %edited after sir Walter’s comment
y0 = interp1(x,y_linear,x0)
Now you will get the corresponding y value when x is 4.

4 件のコメント

Walter Roberson
Walter Roberson 2018 年 11 月 1 日
y0 = 4
x0 = interp1(y_linear,x, y0)
madhan ravi
madhan ravi 2018 年 11 月 1 日
Ah thank you sir Walter :).
Walter Roberson
Walter Roberson 2018 年 11 月 1 日
I suspect that the real question is to find x such that y is 4, which is what I coded for in my comment here.
madhan ravi
madhan ravi 2018 年 11 月 1 日
find function to locate the index where x = 4
I am not sure either sir from the above statement

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

Eduardo Jimenez
Eduardo Jimenez 2018 年 11 月 1 日

0 投票

This result I am trying to get with my code

1 件のコメント

Walter Roberson
Walter Roberson 2018 年 11 月 2 日
Okay, then, always getting 401 is correct for the location of 4.0 . For x = 6, it would come out as 601.
The point of the exercise is to not have to come up with the formula, to use find() to locate the value.

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

カテゴリ

質問済み:

2018 年 11 月 1 日

コメント済み:

2018 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by