Error Using "Fit" feature with app.UIAxes
Show older comments
All,
I am trying to use the "Fit" feature in my code for a logarithmic type, and it works fine when I use a simple "Plot", but when I try to plot it to app.UIAxes on app designer I get the error : "Error using plot. Data must be numeric, datetime, duration or an array convertible to double." Would anyone know why it works for one but not the other? Below is my code that works in creating "Figure 1".
x = [0.0498 0.0975 0.1575 0.2052 0.0689 0.1182 0.1761];
y = [63.43404943 63.35712264 97.36962948 101.6632456 70.12364289 100.7818903 98.74765614];
myfittype = fittype('a + b*log(x)','dependent',{'y'},'independent',{'x'},'coefficients',{'a','b'});
myfit = fit(x',y',myfittype);
a = myfit.a;
b = myfit.b;
%Succesful using:
plot(myfit)
%I want to change to, but gives me an error:
%plot(app.UIAxes, myfit)
Successful plot:

Accepted Answer
More Answers (0)
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!