Find out the intersection of two curves despite NaN-Values
1 回表示 (過去 30 日間)
古いコメントを表示
Benedikt Friedrich Nowak
2022 年 11 月 8 日
コメント済み: Benedikt Friedrich Nowak
2022 年 11 月 9 日
Hello there,
im struggeling with a the intersection of two curves. One curve is defined as a function :
x= (0 : 50)
y=(m*x)+yaxis (m and yaxis are constants).
The other curves is defined as a dataset of two vectors. Lets say:
V1=[1 2 3 4 5] and V2=[50 80 NaN 90 100].
Right now im using polyxpoly, but it struggels with the NaN-Value:
[xi,yi] = polyxpoly(V1,V2,x,y)
xi and yi would be the intersection.
Does anyone have a better alternative ?
Thank you for your help, Ben !
0 件のコメント
採用された回答
Jan
2022 年 11 月 8 日
編集済み: Jan
2022 年 11 月 8 日
x = 0:50;
m = 0.234;
yaxis = 60;
y = (m*x)+yaxis;
V1 = [1 2 3 4 5];
V2 = [50 80 NaN 90 100];
V1(isnan(V2)) = nan; % Avoid error message from polyxpoly
[xi,yi] = polyxpoly(V1,V2,x,y)
plot(x, y);
hold('on');
plot(V1, V2);
plot(xi, yi, 'ok')
I'm not sure what "it struggels with the NaN-Value" means. Without setting the x-value to NaN at locations, where the y-value is NaN, polyxpoly throghs an error. But with a cleaning the code runs fine. So what exactly is the problem?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!