How to find the difference between two graphs?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Agastya
el 24 de Nov. de 2014
Comentada: Saraswatula Sai Pavan Sastry Sastry SOME
el 23 de Sept. de 2018

I have a graph shown in the figure below and now i have to find difference between two graphs, red line is drawn from some A= 59x2 matrix(taken from matlab Simulink) and blue line drawn from B= 149x2 matrix both drawn for same parameters and i don't have any idea how to find the difference between both the lines. So if anyone has any idea please help me with that.
code used is
figure();plot(simout.A.Time,simout.A.Data);
hold on;
plot(B(:,1),B(:,2));
Thanks in advance Agastya
0 comentarios
Respuesta aceptada
the cyclist
el 24 de Nov. de 2014
The curves are pretty smooth, so you could use the interp1 command to create y values at common x points for the two curves, and then take the differences of those y values.
4 comentarios
Saraswatula Sai Pavan Sastry Sastry SOME
el 23 de Sept. de 2018
Hello the cyclist, what if the x values aren't common?Then how to find the difference?
Más respuestas (1)
Ahmet Cecen
el 24 de Nov. de 2014
One way is to interpolate the 59x2 matrix to be 149x2. Check spectral interpolation using Fourier transforms. You might even be able to get away with imresize in your case.
Ver también
Categorías
Más información sobre Spline Postprocessing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!