The problem of plotting
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I make a curve fitting selection for a set of points and build a graph that includes: a set of points for which the fitting is performed(f), a fitted curve(dv,tv) and another set of points(mlbt1, mlbt2). But for some unknown reason, the schedule is not being built. How can this be fixed?
P.s. I have attached all the data files to the question.
My code:
load tv
load dv
load mlbt1
load mlbt2
t_v = tv';
d_v = dv';
f = fit(d_v,t_v,'rat55');
plot(f, mlbt1, mlbt2,'o', dv,tv,'-b');
grid on
0 Kommentare
Antworten (2)
the cyclist
am 26 Feb. 2023
Bearbeitet: the cyclist
am 26 Feb. 2023
A quick look at the documentation for fit suggests to me that you syntax you used (to include two plots in one figure) is not valid. Try this instead. (I'm not certain this exact plot is what you intended, but I'm guessing you can edit to get what you wanted.)
load("dv","dv")
load("tv","tv")
load("mlbt1","mlbt1")
load("mlbt2","mlbt2")
t_v = tv';
d_v = dv';
f = fit(d_v,t_v,'rat55');
figure
hold on
plot(f, mlbt1, mlbt2,'o');
plot(dv,tv,'-b');
grid on
0 Kommentare
Walter Roberson
am 26 Feb. 2023
When you plot() a cfit object https://www.mathworks.com/help/curvefit/cfit.plot.htm then you cannot specify multiple datasets to plot.
plot(f, mlbt1, mlbt2,'o'
that part would correspond to the syntax
In order to have more parameters after that, you would have to be using
plot(...,ptype,level)
but ptype for that syntax is a character vector or scalar string object, which your dv is not.
If you want to plot tv vs dv on the same line you will need to
plot(f, mlbt1, mlbt2,'o');
hold on
plot(dv,tv,'-b');
hold off
0 Kommentare
Siehe auch
Kategorien
Mehr zu Fit Postprocessing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!