フィルターのクリア

Upgraded to R2017a from R2016a and now fit function won't work

2 ビュー (過去 30 日間)
Thomas Burbey
Thomas Burbey 2018 年 3 月 23 日
コメント済み: Walter Roberson 2018 年 3 月 26 日
I'm getting the following error (the code worked fine with version R2016a). Can anyone help and explain why??
Error using cfit/plot (line 224)
Values plotted against x-axis must be datetime values. To create datetime values, use the DATETIME function.
Error in Well31 (line 17)
plot(f06,d2006,pf31.piezo_F31(r2006),'.b')
pf31.Date1 = datetime(pf31.date);
% 2006
figure
r2006 = 75:439;
plot(pf31.Date1(r2006),pf31.piezo_F31(r2006),'.b','DateTimeTickFormat','MMM-yy') % 2006 data
hold on
d2006=datenum(pf31.Date1(r2006));
f06 = fit(d2006,pf31.piezo_F31(r2006),'poly3','Normalize','on','Robust','Bisquare');
coeff06 = coeffvalues(f06)
pvals = probvalues(f06)
disp(f06)
plot(f06,d2006,pf31.piezo_F31(r2006),'.b') <--This is line 17 d2006 is a datenum value
xlabel('Date');
ylabel('Water Level (m)')
title('P31');
ylim([-10 -2]);

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 3 月 23 日
It is not possible to plot datetime (pf31.Date1) and datenum (d2006) on the same axis.
Try using datetime() isntead of datenum() for d2006
  2 件のコメント
Thomas Burbey
Thomas Burbey 2018 年 3 月 26 日
It worked fine with revision R2016a.
Walter Roberson
Walter Roberson 2018 年 3 月 26 日
R2016a converted the datetime to datenum for plot() purposes. In later versions it uses datetime based axis

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCalendar についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by