MATLAB Answers

Problem with symsum: not working with vector of matrix elements

9 views (last 30 days)
Help Plz, I want to calculate summation from 1 to j of (x(6,k).*dz./sin((pi/180).*atan((pi/180).*x(6,k))), but no results
Note that Pas(j)=j with j =1:nz-1; nz= a number
Thank's for any answer !!

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Jan 2020
It is never possible to use a symbolic variable as an index into an array. You should just calculate the expression in vectorized form outside of symsum and then sum() them.

  0 Comments

Sign in to comment.

More Answers (1)

Steven Lord
Steven Lord on 10 Jan 2020
If I understand what you're trying to do correctly, symsum is the wrong tool to use because you're trying to use that variable of summation as indices into a variable. Instead just use sum, something like:
>> x = 1:10;
>> syms dz
>> sY = sum(x.*dz./sin((pi/180).*atan((pi/180)*x)))
The degree-based trigonometry functions like sind and atand functions may also be of interest to you.

  0 Comments

Sign in to comment.

Sign in to answer this question.