How to combine multiple curve fits in one plot?

Hi, this is my first study in Matlab. I have used "cftool" function, and have plotted these two figures. "x", which is "VarName1" is same for both. What I want to do is combine these two figures in one plot. x axis will be same, y axis will extend to maximum y value. Briefly, I want to see all points and their fits in one graph. What am I supposed to do?
Thanks in advance.

Respuestas (2)

Matt J
Matt J el 17 de Mzo. de 2022
Editada: Matt J el 17 de Mzo. de 2022
Use the cftool to export each fit to a workspace variable cfit1 and cfit2. Then
plot(cfit1,Varname1,y); hold on
plot(cfit2,Varname1,y1); hold off

3 comentarios

Aynkaran
Aynkaran el 5 de Oct. de 2022
Editada: Aynkaran el 5 de Oct. de 2022
I think this code is not working
t=[0 5 10 15 30 60];
COD1=[2395.8, 2142.2, 2103.2, 2096.2, 2123, 2094];
COD2=[2395.8, 2010, 1686.7, 1651, 1593.3, 1150];
COD3=[2395.8, 1131.7, 966.7, 820, 621.7, 436.7];
x1=[1,1,1,1,1,1];
COD11=COD1.*COD1;
COD22=COD2.*COD2;
COD33=COD3.*COD3;
y1=0.5*(x1./COD11);
y2=0.5*(x1./COD22);
y3=0.5*(x1./COD33);
hold on
plot(ccfit1,t,y1);
%plot(ccfit2,t,y2)
%plot(ccfit3,t,y3)
hold off
This worked perfectly for me. Thank you.
Matt J
Matt J el 24 de Feb. de 2023
@Carlos Eduardo Correia Gatell I'm glad it worked, but if so, please Accept-click the Answer.

Iniciar sesión para comentar.

Daniel Pollard
Daniel Pollard el 25 de Mzo. de 2021

0 votos

This was literally the top result when I googled "plot multiple graphs matlab". For future reference:

1 comentario

Esra Ilhan
Esra Ilhan el 17 de Mzo. de 2022
This link does not necessarly show how to create the plots in the same figure with Curve fitting option ;)

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de Mzo. de 2021

Comentada:

el 24 de Feb. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by