フィルターのクリア

Issues using Summation in Matlab

4 ビュー (過去 30 日間)
Matthew Charles
Matthew Charles 2022 年 7 月 6 日
コメント済み: Matthew Charles 2022 年 7 月 6 日
Hi, just want to confirm whether the code that I have below is indeed correct or there are changes that is needed to solve. I have values of "n' and "d" that I have to input but the summation tool id new to me
syms i n d
SMD = symsum(n*d^3/(n*d^2),i,1,N)
formula:

採用された回答

Chunru
Chunru 2022 年 7 月 6 日
This is symbolic computation. It's not clear what you want to calculate exactly.
If you have value of d and n, you may want to do numerical summation. For example
d = [1 3 4 2];
n = [2 5 6 7];
% sum first, then division
s1 = sum(d)/(sum(n))
s1 = 0.5000
% division first, then sum
s2 = sum(d./n)
s2 = 2.0524
  1 件のコメント
Matthew Charles
Matthew Charles 2022 年 7 月 6 日
Thanks @Chunru duly noted. I will make the necessary adjustments

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 7 月 6 日
編集済み: Walter Roberson 2022 年 7 月 6 日
never use symsum to form the sum of a vector of values. The variable of summation for symsum is always symbolic, but symbolic values can never be used to index anything.
symsum should only be used when you are working with formulas, such as
symsum((-1)^n / 2^n, n, 1, m)
hoping to get out a function like (-1/2)^m/3 - 1/3
  1 件のコメント
Matthew Charles
Matthew Charles 2022 年 7 月 6 日
Okay not a problem, thank you very much

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

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by