It is not displaying both plots
1 view (last 30 days)
Show older comments
x=[2012 2013 2014 2015 2016 2017]
y=[10 10.9 11.7 12.6 13.8 14.9]
plot(x,y,'dk')
xlabel('Año')
ylabel('Eje y')
title('Población')
hold on
sxy=sum(x.*y)
sx=sum(x)
sy=sum(y)
sx2=sum(x.^2)
csx=sum(sx)^2
n=length(x)
m=((n*sxy)-(sx*sy))/(n*sx2-(csx))
b=(sy-m*sx)/n
f=m*x+b
a=["y=" m "x" "+" b]
disp(a)
plot(f)
0 Comments
Answers (1)
Star Strider
on 2 Jun 2022
Plot ‘f’ as a funciton of ‘x’ —
plot(x,f)
.
1 Comment
Star Strider
on 2 Jun 2022
See Also
Categories
Find more on 2-D and 3-D 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!