Info
This question is closed. Reopen it to edit or answer.
Using a for loop to build a funciton
1 view (last 30 days)
Show older comments
I have an array and those are supposed to act as the integers for each x in the function expcet the data may change depending on what is entered. Thus i would like to have a function that is built with a for loop then i can take the derrivative of that. I am not sure I am very clear.
for i = 1:order+1
f = @(z) yp(i)*z^(i-1);
end
Basicailly I want it to add to the funciton for each position of yp
1 Comment
dpb
on 8 Dec 2019
It is definitely so that your explanation is not at all clear what you're trying to accomplish.
"the data may change depending on what is entered"
Which data changes and what, specifically, does "what is entered" refer to?
Whatever are the variables in the RHS of the definition of an anonymous function are embedded in the function when it is created. Only the dummy argument variable is changeable by subsquently calling the function.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!