Problem with polyfit command (R2015a)
Below is a small script for using the polyfit command but surprisingly the last command gives me a completely wrong polynomial p. I don’t understand why. Thanks in advance for your help.
Below the script is the response from my version of MATLAB (R2015a).
%————————————————————————————————————–
%butta_sto_test
%
clear all
clc
x=[1:9]
y=[5,6,10,20,28,33,34,36,42]
p=polyfit(x,y,1)
[p,S]=polyfit(x,y,1)
[p,S,mu]=polyfit(x,y,1)
%———————————————————————————————————————-
x =
1 2 3 4 5 6 7 8 9
y =
5 6 10 20 28 33 34 36 42
p =
4.9833 -1.1389
p =
4.9833 -1.1389
S =
R: [2×2 double]
df: 7
normr: 8.4581
p =
13.6474 23.7778
S =
R: [2×2 double]
df: 7
normr: 8.4581
mu =
5.0000
2.7386Below is a small script for using the polyfit command but surprisingly the last command gives me a completely wrong polynomial p. I don’t understand why. Thanks in advance for your help.
Below the script is the response from my version of MATLAB (R2015a).
%————————————————————————————————————–
%butta_sto_test
%
clear all
clc
x=[1:9]
y=[5,6,10,20,28,33,34,36,42]
p=polyfit(x,y,1)
[p,S]=polyfit(x,y,1)
[p,S,mu]=polyfit(x,y,1)
%———————————————————————————————————————-
x =
1 2 3 4 5 6 7 8 9
y =
5 6 10 20 28 33 34 36 42
p =
4.9833 -1.1389
p =
4.9833 -1.1389
S =
R: [2×2 double]
df: 7
normr: 8.4581
p =
13.6474 23.7778
S =
R: [2×2 double]
df: 7
normr: 8.4581
mu =
5.0000
2.7386 Below is a small script for using the polyfit command but surprisingly the last command gives me a completely wrong polynomial p. I don’t understand why. Thanks in advance for your help.
Below the script is the response from my version of MATLAB (R2015a).
%————————————————————————————————————–
%butta_sto_test
%
clear all
clc
x=[1:9]
y=[5,6,10,20,28,33,34,36,42]
p=polyfit(x,y,1)
[p,S]=polyfit(x,y,1)
[p,S,mu]=polyfit(x,y,1)
%———————————————————————————————————————-
x =
1 2 3 4 5 6 7 8 9
y =
5 6 10 20 28 33 34 36 42
p =
4.9833 -1.1389
p =
4.9833 -1.1389
S =
R: [2×2 double]
df: 7
normr: 8.4581
p =
13.6474 23.7778
S =
R: [2×2 double]
df: 7
normr: 8.4581
mu =
5.0000
2.7386 polyfit MATLAB Answers — New Questions