How to use curve fitting with log scale axis?

14 views (last 30 days)
For the most part my graph is appearing how I wish it to, but right after the 0 time point, the graph is dipping down and I do not want that to happen, there is no data below the zero time point so I'm not sure why that is occurring. How can I get a smooth connecting line but only connecting my given data, not dipping down where there is no data?
Thanks
% code
hold on
h1 = scatter(X,Y1);
set(h1,'MarkerEdgeColor','b','MarkerFaceColor','b');
csp = csape( X, Y1, 'periodic' );
fnplt(csp,'b');
s = errorbar(X, Y1, Z1,'.');
set(s,'Color','b');
h2 = scatter(X,Y2);
set(h2,'MarkerEdgeColor','r','MarkerFaceColor','r');
csp = csape( X, Y2, 'periodic' );
fnplt(csp,'r');
s = errorbar(X, Y2, Z2,'.');
set(s,'Color','r');
xlim([0 96]);
ax = gca;
ax.XTick = [0 24 48 72 96];
ylim([10000 10000000]);
ay = gca;
ay.YScale = 'log';
xlabel('Hours') % x-axis label
ylabel('CFU/mL') % y-axis label
end

Answers (0)

Categories

Find more on Linear and Nonlinear Regression 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!