Defining a function that is a summation?

조회 수: 11 (최근 30일)
Mark
Mark 2012년 5월 3일
답변: Tushar GUPTA 2019년 3월 25일
Hello, I want to define a matlab function for the following sum: http://i45.tinypic.com/fddkeb.png
I've written the sum part:
syms x k
symsum((-1)^(k-1).*x^k/(k^2), k, 1, 100)
and want to define the function as f(x) = 1 + this sum, but seem to get errors no matter what I do.
Can anyone help with setting up the definition of the function?

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 3일
syms x k
f = matlabfunction( 1 + symsum((-1)^(k-1).*x^k/(k^2), k, 1, 100) );
  댓글 수: 10
RB
RB 2017년 5월 14일
Thank you so much. I have done that.
Regards, RB
RB
RB 2017년 5월 16일
@ Walter Sir can you please have a look at the attached jpg file in the new question created. I am not being able to sum functions although I have now define an array for matrices.
Thanks.

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

추가 답변 (1개)

Tushar GUPTA
Tushar GUPTA 2019년 3월 25일
Creating a function file: Write a local function with two input arguments ‘a’ and ‘N’ to perform the summation:, for N = 5 and 50.
can u plz help me in solving this question?

Community Treasure Hunt

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

Start Hunting!

Translated by