MATLAB Answers

Please help me convert equation to matlab code.

조회 수: 124(최근 30일)
adi putra
adi putra 1 Apr 2018
Deal all.
I need you help to convert this equation to matlab code
I spend a lot of time to write it but it doesn't work. Thank you.

  댓글 수: 1

Walter Roberson
Walter Roberson 1 Apr 2018
Are you permitted to use the symbolic toolbox?
Is the question about providing some kind of symbolic proof, or is it about calculation of the formula using finite precision and a particular numeric input?

로그인 to comment.

답변 수 (2)

Birdman
Birdman 1 Apr 2018
Birdman 님이 편집함. 1 Apr 2018
Basically, Symbolic Toolbox will help you:
syms y(x) n
f(x)=symsum((-1).^n*(x.^(2*n+1))/factorial(2*n+1),n,0,Inf)

  댓글 수: 4

표시 이전 댓글 수: 1
Birdman
Birdman 1 Apr 2018
Now that you have f(x)=sin(x), simply write
f(90)
but remember that sin function takes input arguments in radians, you need to write
f(pi/2)
to get a numerical result.
Roger Stafford
Roger Stafford 1 Apr 2018
@Birdman: I think you meant f(pi/2)
Birdman
Birdman 1 Apr 2018
Yes, I just now edited it Roger.

로그인 to comment.


Roger Stafford
Roger Stafford 1 Apr 2018
N = 100; % <-- Choose some large number
s = x;
for n = 2*N-1:-2:1
s = x - s*x^2/((n+2)*(n+1));
end
(I think you meant to take the limit as N approaches infinity, not x.)

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by