find(V,1) returns an index that doesn't match with the plot

1 次查看(过去 30 天)
>> find(SL_B_Optml,1)
ans =
381
>> plot (linspace(1,1441-(T_B+1)+1,1441),SL_B_Optml);
>> hold on
>> plot([381 381],[0 1.4],'LineWidth',1)
First of all, the find funciton tells us that my SL_B_Optml array reaches a non-zero value for the first time at the x=381.
The plots written above give this:
We can clearly see that SL_B_Optml array reaches the first non-zero value at x=358.3.
I don't understand what's happening here.

采纳的回答

Cris LaPierre
Cris LaPierre 2022-8-5
Find tells you the index value of the elements of SL_B_Optml that meet your criteria. It therefore will be an integer value. However, that is different than an x-value of 381. Here, your x values are linspace(1,1441-(T_B+1)+1,1441).
You should therefore highlight your point doing something like this:
x=linspace(1,1441-(T_B+1)+1,1441);
plot([x(381) x(381)],[0 1.4],'LineWidth',1)
We don't have your values, so I can't check if there is anything else wrong.
  1 个评论
Abdallah
Abdallah 2022-8-5
Find tells you the index value of the elements of SL_B_Optml that meet your criteria. It therefore will be an integer value. However, that is different than an x-value of 381.
This.You're right, sir, I get it now, thanks.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by