clear all
clc
n=1
x(1)=600
err_1=1
while err_1>0.001
x(n+1)=x(n)-(x(n)^2-10*x(n)+16)/(2*x(n)-10)
err_1=abs(x(n+1)-x(n))
n=n+1
if err_1<0.8
break
end
end
clear all
clc
i=0
for x=-5:5
y=x^2+4*x
x(i)=x
y(i)=y
i=i+1
if x<0
plot(y,x,'gs');hold on
else
plot(y,x,'r*');hold on
end
end
این برنامه کاملا تست شده و فاقد ایراد می باشد
[x=[1 2 3 4 5 6]
[y=[1 5 10 15 27 35
(p=polyfit(x,y,2
(y2=polyval(p,x
(e=abs(y-y2
('*plot(x,y,'r
hold on
('plot(x,e,'bs
hold on
(plot(x,y2
برنامه های متلب نوشته شده کاملا تست شده و فاقد ایراد می باشند