MATLAB Answers

Please help me convert equation to matlab code.

156 views (last 30 days)
adi putra
adi putra on 1 Apr 2018
Commented: kalai selvi on 23 Sep 2020
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 Comment

Walter Roberson
Walter Roberson on 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?

Sign in to comment.

Answers (4)

Birdman on 1 Apr 2018
Edited: Birdman on 1 Apr 2018
Basically, Symbolic Toolbox will help you:
syms y(x) n


Show 1 older comment
Birdman on 1 Apr 2018
Now that you have f(x)=sin(x), simply write
but remember that sin function takes input arguments in radians, you need to write
to get a numerical result.

Sign in to comment.

Roger Stafford
Roger Stafford on 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));
(I think you meant to take the limit as N approaches infinity, not x.)


Sign in to comment.

kalai selvi
kalai selvi on 15 Sep 2020
pls answer this question to write the equation into code


John D'Errico
John D'Errico on 15 Sep 2020
Please don't post a completely distinct question as an answer.
Walter Roberson
Walter Roberson on 15 Sep 2020
π is written as pi in MATLAB.
exp of an expression is written as exp(expression) in MATLAB.
is written as sqrt(expression) in MATLAB.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by