The problem of plotting
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
the cyclist
2023-2-26
编辑:the cyclist
2023-2-26
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 个评论
Walter Roberson
2023-2-26
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!