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'
Show older comments
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
Answers (1)
Walter Roberson
on 17 Nov 2020
0 votes
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.
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!