Help writting a simple code!
11 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to make a Simulink model consisting of a clock (as a source) and a MATLAB function that calculates the following:
Y=exp(t) * sigma(n=1:inf)[n * exp(n*t)]
Can anybody help me write the code?
0 件のコメント
回答 (5 件)
Paulo Silva
2011 年 6 月 29 日
MATLAB Fcn
exp(u)*sum([1:10].* exp([1:10].*u)) %not infinite sum but close enough
0 件のコメント
C.J. Harris
2011 年 6 月 29 日
You won't be able to write an infinite series directly. You will either have to use an approximation, or only calculate the sum for the first 'n' elements.
0 件のコメント
Walter Roberson
2011 年 6 月 29 日
If and only if t is less than 0,
Y = exp(2*t)/(exp(t)-1)^2
That is, sum(n*exp(n*t), n = 1 .. infinity) is exp(t)/(exp(t)-1)^2
If t is 0 or greater, the sum is infinite, as you are adding together numbers that increase infinitely.
0 件のコメント
Hossein sadri
2011 年 6 月 30 日
2 件のコメント
Walter Roberson
2011 年 6 月 30 日
n.^2 instead of n^2
But n^2*exp(u) has the same problem I described above of having an infinite value unless u is negative.
amey
2011 年 7 月 1 日
n=1:1:100; y=exp(0.4)*(n.*exp(0.4*n)); tot=0; for i=1:100; tot=tot+y(i); end disp(tot);
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!