Effacer les filtres
Effacer les filtres

the explicit solution in matlab

2 vues (au cours des 30 derniers jours)
alireza amiri
alireza amiri le 8 Oct 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)))

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Oct 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 .*

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by