Curve on specific X and Y coordinates
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
John D'Errico
le 19 Mar 2021
Modifié(e) : John D'Errico
le 19 Mar 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?
0 commentaires
Walter Roberson
le 19 Mar 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])
0 commentaires
Voir également
Catégories
En savoir plus sur Curve Fitting Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!