Fit line on an edge of datapoints area

3 ビュー (過去 30 日間)
MM
MM 2020 年 2 月 3 日
回答済み: MM 2020 年 2 月 7 日
Not the best title but I didn't know a better one.
My question, I have some datapoints of 0 and 1 and I would like to know if (probably yes) and how I can fit lines through these datapoints on the edge. For example, I have the following plot from an analitycal solution:
And I have some data from simulations that exist of 0 and 1 that looks like this with contourf:
The first one is with 21x21 datapoints, the second with 41x41 datapoints. Yellow is 1 purple is 0. In the attachment are the datapoints of the 21x21 figure. (But I'll be working with 41x41 (or more) datapoints)
Plot is made with:
xaxis = [-0.5:0.1:1.5];
yaxis = [-0.5:0.1:1.5];
figure
contourf(xaxis,yaxis,STABLE,[0 1])
How can I get a fit over the edges of 0 to 1 to create a figure like the analytical one.?
edit: I see I uploaded the data file of another simulation. The question remains the same, but the data file is not exactly the same as the pictures I posted above. I'll try to find the proper file but it isn't really necessary because I just want to know how to make a fit. The pictures and data file is just as an example.

回答 (2 件)

KSSV
KSSV 2020 年 2 月 3 日
[c,h] = contourf(xaxis,yaxis,STABLE,[0 1]) ;
The above gives you the points of the countour lines. SPlit them into two parts, use polyfit to fit a line.
  1 件のコメント
MM
MM 2020 年 2 月 3 日
But then polyfit will try to fit a line through all the 0's in the datapoints or all the 1's in the datapoints right? I want to fit a line on the edge of those two area's of 0's and 1's

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


MM
MM 2020 年 2 月 7 日
It isn't possible what I'm trying to do?

カテゴリ

Help Center および File ExchangeExploration and Visualization についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by