How to combine 2 Matlab figure plots?
Mostrar comentarios más antiguos
I have created 2 lines on the same plot. I need to take an average of them and add a 3rd line on this figure. Any idea how may I easily do so ? I am attaching the .fig (test_combine.fig) file as well.

Thanks
Respuesta aceptada
Más respuestas (1)
Raheel Naveed
el 24 de Jul. de 2023
Greetings,
You can take average of data along Y-axis using mean() function.
Assuming your , y-axis data as y1 and y2, we can use below code to create a 3rd graph on same figure
hold on % to plot on same figure
yAvg=mean([y1:y2]) % You can replace your variables here
In case, there's still any problem, share the whole code for better debugging (or .mat file )
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

