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.
2 个评论
Torsten
2022-8-5
Is SL_B_Optml a vector, a matrix ?
What do you get when you type
size(SL_B_Optml)
before the "find" command ?
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!