Octave 倍频程线图不跟随数据点

Octave 倍频程线图不跟随数据点,octave,Octave,我正试图绘制一个适合于数据集的函数,但直线图没有正确连接函数图形上的点:问题似乎是在我开始将毫秒从历元转换为日期x轴之后开始的 %convert millis since epoch to days since 0000 timeVec = zeros(size(x,1), 1); f = "ddd mmm dd HH:MM:SS yyyy"; for i = 1:size(x,1) timeTmp = ctime(x(i)/1000); timeVec(i) =

我正试图绘制一个适合于数据集的函数,但直线图没有正确连接函数图形上的点:问题似乎是在我开始将毫秒从历元转换为日期x轴之后开始的

%convert millis since epoch to days since 0000
  timeVec = zeros(size(x,1), 1);
  f = "ddd mmm dd HH:MM:SS yyyy";

  for i = 1:size(x,1)
    timeTmp = ctime(x(i)/1000);
    timeVec(i) = datenum(timeTmp(1:end-1), f);
  endfor
  %

  %convert millis since epoch to days since 0000 (now for the training set examples)
  timeVecXX = zeros(size(XX,1), 1);

  for i = 1:size(XX,1)
    timeTmp = ctime(XX(i)/1000);
    timeVecXX(i) = datenum(timeTmp(1:end-1), f);
  endfor
  %

  hold("off");
  plot(timeVec, plotFunc(x), '-ob');
  datetick("ddd mmm dd");
  hold("on");
  grid on;
  plot(timeVecXX,yy, '.g');
MCVE:


让它像这样工作:

 optimTheta = [8.0916e+004; -3.4102e+003; 7.5091e+003];
 optimA = 78250000;
 mu = [1.5431e+012, 5.8217e-003];
 s = [2.4831e+007, 7.1022e-001];

 plotFunc = @(p) predict(p,optimTheta,mu,s,optimA);

 linZero = -(optimTheta(1)*s(1)-optimTheta(2)*mu(1))/optimTheta(2);  %solution for the equation theta0 + theta1*(x-mu(1))/s(1) = 0

 tOffset = 1543076107026;

 x = [1543076107026:(linZero-1543076107026)/100:linZero];
 x = x';

 timeVec = x-tOffset;

 xTicks = [-65707026:(24*60*60*1000):539092974];

 hold("on");
 set(gca, 'xtick', xTicks);
 plot(timeVec, plotFunc(x), '-ob');

 lTVec = [];
 for i=1:size(xTicks,2)
 lTVec = [lTVec; strftime("%a %b %d", localtime((xTicks(i)+tOffset)/1000))];
 endfor


 set(gca, 'xticklabel', lTVec);
 grid on;
 xlabel ("Day");
 hold("off");

如果不提供MCVE,很难告诉您,但我想您看到这一点是因为OpenGL中的单精度浮点计算。尝试将第一个元素vor开关减为Gnuplot作为绘图后端请阅读Andy提到的MCVE。可能与此问题有关:@Andy Oh,我将添加MCVE。谢谢@塔索斯帕萨蒂亚努:谢谢,的确如此。
function [y] = predict (X, theta, mu, s, a)

  Xtemp = [X, sin((X-a)/(1000*60*60*24/(2*pi)))];
  Xtemp = (Xtemp-mu)./s;
  Xtemp = [ones(size(Xtemp,1),1), Xtemp];

  y = Xtemp*theta;

endfunction
 optimTheta = [8.0916e+004; -3.4102e+003; 7.5091e+003];
 optimA = 78250000;
 mu = [1.5431e+012, 5.8217e-003];
 s = [2.4831e+007, 7.1022e-001];

 plotFunc = @(p) predict(p,optimTheta,mu,s,optimA);

 linZero = -(optimTheta(1)*s(1)-optimTheta(2)*mu(1))/optimTheta(2);  %solution for the equation theta0 + theta1*(x-mu(1))/s(1) = 0

 tOffset = 1543076107026;

 x = [1543076107026:(linZero-1543076107026)/100:linZero];
 x = x';

 timeVec = x-tOffset;

 xTicks = [-65707026:(24*60*60*1000):539092974];

 hold("on");
 set(gca, 'xtick', xTicks);
 plot(timeVec, plotFunc(x), '-ob');

 lTVec = [];
 for i=1:size(xTicks,2)
 lTVec = [lTVec; strftime("%a %b %d", localtime((xTicks(i)+tOffset)/1000))];
 endfor


 set(gca, 'xticklabel', lTVec);
 grid on;
 xlabel ("Day");
 hold("off");