summation using syms and rounding

is this way correct?Also want the number rounded to the first dp.
syms k
f = k-4/k-5;
v1 = subs(f, k, 1:3)
s_sum = sum(v1)
v2=subs(f,k,6:100)
s_sum2=sum(v2)
f=(0-4)/(0-5)
sum=s_sum+s_sum2+f
value = round(sum * 10) / 10

6 件のコメント

Walter Roberson
Walter Roberson 2019 年 3 月 18 日
No, that is a product symbol, not a summation symbol.
Also, k-4/k-5 is parsed as (k-(4/k))-5
dulanga
dulanga 2019 年 3 月 18 日
編集済み: dulanga 2019 年 3 月 18 日
okay thanks alot so how do i go about it ?
this is what i thought but the zero gives an error.
clc
clear
syms k
P1 = symprod((k-(4/k))-5 , k, 0, 3)
P2 = symprod((k-(4/k))-5 , k, 6, 100)
Walter Roberson
Walter Roberson 2019 年 3 月 19 日
(k-4)/(k-5)
dulanga
dulanga 2019 年 3 月 19 日
The solution i get for this is wrong any idea why?
clc
clear
syms k
P1 = symprod((k-4)/(k-5) , k, 0,3)
P2 = symprod((k-4)/(k-5) , k, 6, 100)
sum= P1+P2
Torsten
Torsten 2019 年 3 月 19 日
Because you have to multiply P1 and P2, not add them.
dulanga
dulanga 2019 年 3 月 19 日
noted

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2019 年 3 月 18 日

コメント済み:

2019 年 3 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by