Curve on specific X and Y coordinates
1 回表示 (過去 30 日間)
古いコメントを表示
i would like to graph a curve that passes through the X, Y coordinates
x = [429.245/3, 303.996/3, 287.771/3, 267.384/3, 252.095/3, 239.755/3, 224.149/3, 201.129/3, 0, -198.87/3, 222.745/3, 237.498/3, 249.837/3, 265.127/3, 285.513/3, 301.739/3, 432.098/3];
y = [ 20.61/3, 20.61/3, 20.61/3, 16.436/3, 10.8/3, 6.243/3, 2.488/3, 0, 0, 0, 2.488/3, 6.243/3, 10.8/3, 16.436/3, 20.61/3, 20.61/3, 20.61/3];
0 件のコメント
回答 (2 件)
John D'Errico
2021 年 3 月 19 日
編集済み: John D'Errico
2021 年 3 月 19 日
x = [429.245/3, 303.996/3, 287.771/3, 267.384/3, 252.095/3,239.755/3,224.149/3,201.129/3,0,-198.87/3, 222.745/3,237.498/3,249.837/3,265.127/3,285.513/3,301.739/3,432.098/3];
y = [20.61/3, 20.61/3, 20.61/3, 16.436/3, 10.8/3,6.243/3, 2.488/3,0,0,0,2.488/3,6.243/3,10.8/3,16.436/3,20.61/3,20.61/3,20.61/3];
plot(x,y,'-')
Done. Did you really expect some nice smooth well-behaved curve? I hope not. Is there some information you know about the curve? If there is, then how do you expect a computer to know what you know?
0 件のコメント
Walter Roberson
2021 年 3 月 19 日
Difficult to say what you want in a curve when it doubles back on itself.
If this is intended as a hysterisis curve then you should say so instead of just giving it as a list of points.
x = [429.245/3, 303.996/3, 287.771/3, 267.384/3, 252.095/3, 239.755/3, 224.149/3, 201.129/3, 0, -198.87/3, 222.745/3, 237.498/3, 249.837/3, 265.127/3, 285.513/3, 301.739/3, 432.098/3];
y = [ 20.61/3, 20.61/3, 20.61/3, 16.436/3, 10.8/3, 6.243/3, 2.488/3, 0, 0, 0, 2.488/3, 6.243/3, 10.8/3, 16.436/3, 20.61/3, 20.61/3, 20.61/3];
[sx, idx] = sort(x);
sy = y(idx);
plot(x, y, '-*k'); ylim([-1 8])
plot(sx, sy, '--+b'); ylim([-1 8])
ix = linspace(sx(1),sx(end));
iy = interp1(sx, sy, ix, 'spline');
plot(sx, sy, '--+b', ix, iy, '-.sg'); ylim([-3 8])
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Curve Fitting Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!