csapi with multiple consecutive coordinates
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My x,y data is in the following format. Basically I have separate lines, but all the x and y are in the same array.
0 -15.6434352099231
0.0993194000787092 -16.0154142771549
0.198638800157418 -16.1980660624796
0.292335074968857 -16.0367986149356
0.386031344158518 -15.6270128679105
0.479727618969956 -15.3230394016863
0.579047019048666 -15.3221427866024
0.678426923997697 -15.4457363459043
0.777806828946728 -15.5349466895620
0.851871220779107 -15.8151654343951
0.925935608167622 -16.0956878582673
1 -16.1980660624796
NaN NaN
0 -15.3365041384341
0.0993194000787092 -14.8688490307282
0.198638800157418 -14.5851836920701
0.292335074968857 -14.7051627633113
0.386031344158518 -14.9423031670397
0.479727618969956 -14.9377721995851
0.579047019048666 -14.9270476491485
0.678426923997697 -15.1172369876827
0.777806828946728 -15.2044753223834
0.851871220779107 -14.9222557245268
0.925935608167622 -14.6532254842178
1 -14.5851836920701
NaN NaN
When I try to plot the spline, the results do not make much sense:
cs = csapi(X,Y);
fnplt(cs);
0 commentaires
Réponses (1)
Abhaya
le 30 Sep 2024
Hi Pelajar,
The MATLAB ‘csapi’ function is used to generate a spline from given ‘x’ and ‘y’ coordinates, and the resulting spline can be visualized in the attached graph.
According to the data provided by you, there are two y-values for each x-point. In this scenario, the function optimizes the curve by averaging the two y-values to plot the spline.
The black dots in the graph represent the average of the two y-values for each x-point.
For more information on MATLAB ‘csapi’ function, please follow the MATLAB documentation.
Hope it resolves your query.
0 commentaires
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!