Filter löschen
Filter löschen

Curve on specific X and Y coordinates

2 Ansichten (letzte 30 Tage)
simon beaudet
simon beaudet am 19 Mär. 2021
Beantwortet: Walter Roberson am 19 Mär. 2021
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];

Antworten (2)

John D'Errico
John D'Errico am 19 Mär. 2021
Bearbeitet: John D'Errico am 19 Mär. 2021
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 am 19 Mär. 2021
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])

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by