Defining an anonymous function with 3*(N+1) variables
Show older comments
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 Comments
David Hill
on 8 Apr 2021
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
on 8 Apr 2021
Cris LaPierre
on 8 Apr 2021
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
on 8 Apr 2021
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!