How can I sum two plots that don´t have the same number of elements?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Andriy Voshchenko
am 26 Mai 2022
Kommentiert: Sam Chak
am 27 Mai 2022
I have the following case which represents the pressure distribution over a profile:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1011735/image.png)
I want to separate the intrados and extrados sections and calculate the sum of it. I´ve divided my data but the 2 parts don´t have the same number of elements. For example, I have 170 data points for the entire plot and 94 of them are data from intrados and the rest is extrados.
I can divide it and represent it:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1011740/image.png)
but I have troubles with performing the sum. I need to create extra points somehow so the 2 data sets have the same number, how can I do it?
0 Kommentare
Akzeptierte Antwort
Sam Chak
am 26 Mai 2022
I think one of the methods is to perform data interpolation using interp1 so that both curves are interpolated at the same point coordinates.
https://www.mathworks.com/help/matlab/ref/interp1.html
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!