the explicit solution in matlab

3 visualizaciones (últimos 30 días)
alireza amiri
alireza amiri el 8 de Oct. de 2017
Respondida: Walter Roberson el 8 de Oct. de 2017
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)))

Respuesta aceptada

Walter Roberson
Walter Roberson el 8 de Oct. de 2017
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 .*

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by