plotting, tools and fitting

1 visualización (últimos 30 días)
Johannes Deelstra
Johannes Deelstra el 22 de En. de 2019
Comentada: Luna el 22 de En. de 2019
Hei
I plot two lines using
plot(1961:2017,res(:,2))
hold on
plot(1961:2017,res(:,4),'--')
Then in figure clicking on Tools I can do basic linear fitting through series one (data1)
When I also want to do a linear fit through series two(data2), the first fit disappears
How can I keep both linear fits (through data1 and data2) in place
I tried lsline but this can only be applied to scatter (x,y) it looks like
What other possibilities are there.
Regards
Johannes

Respuesta aceptada

Luna
Luna el 22 de En. de 2019
Try to define the axis handle inside the figure. Than hold it:
hFig = figure;
hAxis = axes(hFig);
hold(hAxis,'on')
plot(hAxis,data1,'*r');
plot(hAxis,data2,'b');
  4 comentarios
Johannes Deelstra
Johannes Deelstra el 22 de En. de 2019
Hei Luna
I fixed the problem by using polyfit and polyval
Thanks for helping
Luna
Luna el 22 de En. de 2019
Your welcome :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Scatter Plots 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!

Translated by