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];

回答(2 个)

John D'Errico
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?

Walter Roberson
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])

类别

Help CenterFile Exchange 中查找有关 Curve Fitting Toolbox 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by