Plotting a trendline on a logarithmic scale
问题 I am trying to add a trendline to a semilogx plot but cannot succeed. I want the trendline between y(17) and y(20) , but it is not plotted as a straight line. This is my code: %// Define equation. x = [90868 68151 45434 34076 27261 13631 6816 3408 2273 1948 1705 1137 853 683 569 455 342 274 228 190]; y = [3680 3723 3800 3866 3920 4103 4250 4320 4340 4344 4350 4364 4373 4379 4384 4393 4398 4402 4405 4407]; %// Plot it semilogx(x,y, 'bo-', 'LineWidth', 3); grid on; %// Enlarge figure to full