Azzera filtri
Azzera filtri

the explicit solution in matlab

2 visualizzazioni (ultimi 30 giorni)
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)))

Risposta accettata

Walter Roberson
Walter Roberson il 8 Ott 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 .*

Più risposte (0)

Categorie

Scopri di più su Simulink in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by