필터 지우기
필터 지우기

How to use Matlab to write a function

조회 수: 1 (최근 30일)
NIANNIAN
NIANNIAN 2014년 11월 2일
편집: NIANNIAN 2014년 11월 12일

채택된 답변

Stelina
Stelina 2014년 11월 2일
a short .mfile with the solution

추가 답변 (1개)

Star Strider
Star Strider 2014년 11월 2일
Your detailed solution is waiting for you here.
  댓글 수: 3
Star Strider
Star Strider 2014년 11월 2일
Thank you!
NIANNIAN
NIANNIAN 2014년 11월 3일
편집: NIANNIAN 2014년 11월 3일
To clarify, I did not ask for answer here. I apologize that there is something wrong with the way I post my questions here. I post the question just because to explain what I was stuck with. I did put my effort in my homework!
The following is my code: function the_maclaurin_series_expansion x=linspace(0,(3*pi)/2); y=cos(x);
macxp=1-x.^2/factorial(2)+x.^4/factorial(4)-x.^6/factorial(6)+x.^8/factorial(8)
plot(x,macxp) hold on plot(x,y,'--') hold on xlabel('x'); ylabel('cos(x)'); legend('Series expansion','True'); title('Series expansion of the cosine function'); grid on hold off
er=(sum(abs(y-macxp)))/sum(abs(y)) disp(er)

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by