It is not displaying both plots

조회 수: 3 (최근 30일)
LG
LG 2022년 6월 2일
댓글: Star Strider 2022년 6월 2일
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)

답변 (1개)

Star Strider
Star Strider 2022년 6월 2일
Plot ‘f’ as a funciton of ‘x’
plot(x,f)
.
  댓글 수: 1
Star Strider
Star Strider 2022년 6월 2일
This obviously worked because you quoted it in How to find Coefficient R.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by