Error When Input Interpolation 'Error using Inter (line 13) Values plotted against x-axis must be datetime values. To create datetime values, use the DATETIME function'
显示 更早的评论
Hello, i'm new to matlab, and i've got an error when tried a code regarding my interpolation's college task.
This is my code
disp('input nilai x0 dan y0')
x_0=input('ketik x0 awal dengan angka ')
y_0=input('ketik y0 dengan angka ')
disp('masukkan nilai x1 dan y1 ')
x_1=input('ketik nilai x1 dengan angka ')
y_1=input('ketik nilai y1 dengan angka ')
disp('masukkan nilai yang ingin dicari ')
x=input('ketik nilai x dengan angka ')
y=y_0 + ((y_1-y_0)/(x_1-x_0)) * (x - x_0)
disp(y)
plot(x_0,y_0,'o',x_1,y_1,'o',x,y,'d');
%x0 dan y0 = 10;8
%x1 dan y1 = 12;13.9
%xx dan yx = 11.3;11.835
I've tried to input those element and got an message error above in line 13, which is
plot(x_0,y_0,'o',x_1,y_1,'o',x,y,'d');
I tried to figure it out and read some forum but still no solution.
Hopefully you can help me.
Thank you very much
回答(1 个)
Walter Roberson
2020-11-17
0 个投票
You have an existing axes that is a datetime plot, and hold is turned on. You cannot mix datetime and numeric coordinates on one axes.
类别
在 帮助中心 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!