How can I extend polyfit line on loglog scale ?
Show older comments
I wrote this code, but I need to extend this line from y=10 to y=100. I tried but I couldn't do it. Can anybody help ?
x= [0.310 0.220 0.125 0.065]
y= [95.4 63.3 36.8 22.4]
X=log10(x); Y=log10(y);
P=polyfit(X,Y,1);
yhat=10.^[polyval(P,[X(1) X(end)])];
loglog(x,y,'s')
hold on
loglog([x(1) x(end)],yhat)
xlabel('(mm)')
ylabel('(%)')
grid on
slope = P(1)
txt = ['m=' num2str(P(1))]
text(0.4,40,txt)
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!