Filter löschen
Filter löschen

How to apply symsum function for this eqaution

6 Ansichten (letzte 30 Tage)
Phoom
Phoom am 18 Sep. 2023
Beantwortet: Walter Roberson am 18 Sep. 2023
I need help to apply the symsum function with odd number value to this eqaution

Antworten (1)

Walter Roberson
Walter Roberson am 18 Sep. 2023
You cannot use symsum() for that purpose.
symsum() expects a formula in a symbolic variable as the first parameter. The formula is used to attempt to calculate a closed form formula for the summation, and if that works then then bounds are used with the closed form formula to calculate a difference. If no closed form can be calculated but the bounds are both finite integers, then the value of the formula is calculated at each integer from the lower bound to the upper bound and the terms are added together.
The formula cannot contain any indexing of an array by a symbolic variable. It is never possible to index anything by a symbolic variable..
You need to calculate the individual terms of the formula, and sum() them together. You can do that because the memory block is a fixed finite size. If you are trying to represent a memory block that is an indefinite size but which indexes arrays, then you simply cannot do that.
If you are trying to represent a memory block that is of indefinite size, then you can get something quite similar to your target by replacing your arrays v and w by functions v(n) and w(n), as in
symfun v(n) w(n)
and if that is done then you can use symfun() . But if you do this then at some point you need to subs() an expression for the function where the expression acts to index an array, such as
v_(n) = piecewise(n==1, V(1), n == 2, V(2), ... ) %every term must be listed
subs(FORMULA, v, v_)

Community Treasure Hunt

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

Start Hunting!

Translated by