Defining an anonymous function with 3*(N+1) variables
显示 更早的评论
I need to define a function
f = @(X)...
where X has 3*(N+1) variables in the form: X(:,1), X(:,2), ... X(:,3*(N+1)) . The problem is that the expression for the function is very long. However, there is a pattern which I want to take advantage of.
The function is 

Notice that the function can be expressed in terms of summations and products. I want to take advantage of this fact so that I don't have to manually type out the products and sums. Is there any way of doing this using for loops?
4 个评论
David Hill
2021-4-8
What is the X matrix or array? X(i+N+1) appears to exceed the array and X(i+2N+2) is much bigger than the array. Therefore without understanding what X and how you are indexing into it with i and j, I cannot help.
Anthony Gurunian
2021-4-8
Cris LaPierre
2021-4-8
Perhaps I'm getting hung up on symantics here, but it appears you have a single variable, X. Is it correct to say that your array X has 3*(N+1) columns?
Anthony Gurunian
2021-4-8
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!