The problem of plotting
조회 수: 15 (최근 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에서 Fit Postprocessing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!