the explicit solution in matlab

3 次查看(过去 30 天)
dear i cant solve this equation in matlab please help to me
k=1:1:3
m=2:1:8;
l=0:1:3;
R1=0.5;
g(m)=m/(2*m-1)*(2*m+1);
I1 = @(m, l) k*R1/2*((g(m+1)*I1((m+1),l-1))+I1((m),l-1)+(g(m)*I1((m-1),l-1)))

采纳的回答

Walter Roberson
Walter Roberson 2017-10-8
Anonymous functions cannot refer to themselves.
Your definition gives no way to stop the recursion. You increase the first parameter and decrease the second parameter but there is nothing in your definition that prevents negative second parameters.
The l variable you assign early on is never used.
In your assignment to g, you define g(2:8)but not g(1)
You definition of g(m) uses the row vector m on the left side of the / matrix right divide operator, and a row vector of the same length on the right side of that operator. That is a size error. When you use vectors with the matrix right divide operator, the sizes only work out if you use column vectors. Watch out for the * matrix multiply too. You might instead want ./ and .*

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by