How to make a curved line

1 回表示 (過去 30 日間)
Sophia
Sophia 2016 年 10 月 17 日
編集済み: David Goodmanson 2016 年 10 月 17 日
lat1 = 81.9;
lat2 = 82;
long1 = -12;
long2 = 20;
[I1,J1] = find(lat>=lat1 &lat<=lat2 & (long>=long1 & long<=long2));
The values obtained in I1 are [192,174,175,187,188,189] and in J1 are [215, 216, 216, 216, 216,216]
It is not giving any error but not giving the result either
xx = (I1(1):(I1(end)-I1(1))/2:I1(end));
yy = interp1(I1,J1,xx,'spline');
m_plot(I1,J1,'bs',xx,yy);

回答 (1 件)

David Goodmanson
David Goodmanson 2016 年 10 月 17 日
編集済み: David Goodmanson 2016 年 10 月 17 日
Your I1 data is not sorted, so I1(end) - I1(1) is not the entire span. Also, if it were sorted, setting the spacing as half the span in the xx = ( : : ) command means that xx will always have three points. You might consider creating xx with the linspace command.

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by