MATLAB Efficient MATLAB Code for Recursive Functions: Expert Tips and Tricks

AI Thread Summary
The discussion revolves around programming a recursive function in MATLAB. The user seeks assistance with implementing a specific equation and is advised to create a 2D matrix of size k, which can be defined as a parameter in the function. Initial values should be seeded in the matrix, and the use of for or while loops is recommended to effectively handle the recursion. Helpful resources from MathWorks are provided to guide the implementation process.
EngWiPy
Messages
1,361
Reaction score
61
Hello,

I have the following equation, and I want to program it using MATLAB. But it is a recursive function, and it seems that I can not handle it well. So please if anyone can help, I will be thankful.

attachment.php?attachmentid=19240&stc=1&d=1244335353.jpg
 

Attachments

  • ExpansionFactor.JPG
    ExpansionFactor.JPG
    10.8 KB · Views: 3,835
Physics news on Phys.org
I would suggest you create a 2D matrix of size k (whatever that happens to be / you choose it to be--maybe this is a parameter that your function takes in?), seed the initial values given, and then make copious use of the for or while loops in MATLAB:
http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f4-1931.html#brbsthm
http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f4-1931.html#brbstiw-1
 
Last edited by a moderator:

Similar threads

Replies
4
Views
4K
Replies
5
Views
3K
Replies
32
Views
4K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
5
Views
2K
Replies
3
Views
2K
Back
Top