Hi guys,
could you please help me figure out why the polyfit works in one figure but not in the other? I don'T understand why it's not plotting the full line in the second figure.
Thank you!
load workspace_23_08_19coeffs = polyfit(d_rel_mM, dil_rel, 1);fittedX = linspace(min(d_rel_mM), max(d_rel_mM), 200);fittedY = polyval(coeffs, fittedX);coeffs_a = polyfit(d_rel_mM, time_a, 1);fittedXA = linspace(min(time_a), max(time_a), 200);fittedYA = polyval(coeffs_a, fittedXA);figure(1)plot(d_rel_mM,dil_rel,'x','Markersize',15, 'Linewidth',6)xlabel('Imaging depth [\mum]', 'Fontname','LM Roman 10','Fontsize', 40)ylabel('Peak dilation [%]','Fontname','LM Roman 10','Fontsize', 40)set(gca,'Fontname','LM Roman 10','FontSize',20,'box','off')axis tighthold on;plot(fittedX, fittedY, 'k-', 'LineWidth', 2);%%
figure(3) %% INCOMPLETE LINE, SEE ATTACHED
plot(d_rel_mM,time_a,'x','Markersize',15, 'Linewidth',6)xlabel('Imaging depth [\mum]', 'Fontname','LM Roman 10','Fontsize', 40)ylabel('Time constant 1/\alpha [s]','Fontname','LM Roman 10','Fontsize', 40)set(gca,'Fontname','LM Roman 10','FontSize',20,'box','off')axis tighthold on;plot(fittedXA, fittedYA, 'k-', 'LineWidth', 3);
Best Answer