mypoly.m

来自「a file for determining a polynomial degr」· M 代码 · 共 15 行

M
15
字号
function mypoly(x,y,n)
n=input('enter the number of points :');
%x=rand(1,n);y=rand(1,n);
%temp=[x y];
for i=1:n
    temp=[x y];
    %temp=input('enter [x y] :');
    x(i)=temp(1);
    y(i)=temp(2);
end
p=polyfit(x,y,1);
z=polyval(p,x);
y1=p(1)*z+p(2);
plot(x,y,'bo',z,y1);
axis ([0 10 0 10]);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?