Defining an anonymous function with 3*(N+1) variables
Mostrar comentarios más antiguos
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 comentarios
David Hill
el 8 de Abr. de 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
el 8 de Abr. de 2021
Cris LaPierre
el 8 de Abr. de 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
el 8 de Abr. de 2021
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!