How do I make this graph in just one expression?
Show older comments
Hello! I'm fairly new to matlab and I wonder how to properly plot a graph with its line of regression in just one expression as when I tried to convert it to a .tex file it only showed the inital data points and not the regression. Since these two are two seperate graphs layered on top of another i wonder if there is a way to merge them. Thanks in advance!
Here is the code:
ir=[0.03485,0.0294,0.0198,0.0074]; t_ir=[0.372,0.233,0.108,0.037]
p=polyfit(log(ir),log(t_ir),1);
k=p(1);
m=p(2);
f=@(ir)k.*ir+m;
xMin=min(log(ir));xMax=max(log(ir));
hold on
plot(log(ir),log(t_ir),'o'); xlabel('ln(innerradius/m)'); ylabel('ln(time/s)');
fplot(f,[xMin,xMax])
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots 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!

