How to fit a curve into contour plot?
21 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I would like to fit a curve (draw black line) into a contour plot (please refer to the attachment).
Any suggestions?
Thank you,
Carola
0 个评论
采纳的回答
John D'Errico
2022-4-19
编辑:John D'Errico
2022-4-19
Sometimes it is easier to just draw the curve yourself. I say this because the curve you drew might not have been the curve I would have chosen. I might have chosen something that goes more through the middle of the contour lines. And that means that your judgement about where you want the curve to be is most important.
Having said that, I would also point out that the AXIS scaling can be a significant factor in all of this. For example, consider the following set of contours:
To me, it clearly looks like the line I would draw here, using the same logic I think you used, that line would be vertical. Right?
In this second contour plot, the line drawn would absolutely be horizontal, correct?
I drew in lines where I think you would draw them in each case.
But, what if I told you the only difference between those two contour plots was the axis scaling?
[X,Y] = meshgrid(-100:100);
contour(X,Y,Z,[1:5:500]);
All I did then was to carefully change the axis scaling, making the same set of PERFECTLY circular contours, now look like they were pointing in one direction or another.
Look carefully at the axes on the two plots.
So are you still ABSOLUTELY positive where that line belongs? If you are, then just draw it by hand. But I would still be asking if you really do know where that curve belongs?
6 个评论
Torsten
2022-4-19
Now use a search to find the maximum value for y, at that specific value of x.
Is it this what is meant by "most energetic part of the signal" ?
Rik
2022-4-20
Thank you for your reply. This comment really helps.
Comment posted as flags by @carola forlini:
Not exactly. What I mean is that the signal presents an interval in which the power is higher. This is the area where I want to fit a curve. Thank you.
更多回答(1 个)
KSSV
2022-4-19
Get the contour line coordinates using the contour function and use polyfit. Read about polyfit.
1 个评论
Ruya Ulutas
2023-2-17
How can you combine these together? I have a polyfit and view of a trisurface function.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!