Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

need some help please

조회 수: 1 (최근 30일)
Mutaz Alsomali
Mutaz Alsomali 2018년 2월 26일
댓글: Mutaz Alsomali 2018년 2월 27일
  댓글 수: 3
Mutaz Alsomali
Mutaz Alsomali 2018년 2월 27일
if true
clear, clc
x1=unput('Enter the angel in dgree');
x=x1*pi/180;
tol=10^(-7);
f=(0);
for n=0:100
f=f+(-1)^(n)*x^(2*n)/factorial(2*n);
s(n+1)=f;
if(n>1)
err=abs((s(n+1)-s(n))/s(n));
if err<tol
break;
end
end
end
f1=cos(x);
fprintf('cos(%d)=%f\n',x1s(end));
fprintf('Actual Value of cos(%d)=%1.8f\n'x1,f1);
end

답변 (1개)

Mutaz Alsomali
Mutaz Alsomali 2018년 2월 26일
i forgot the Taylor series for cos(x)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by