Multiplying Function Handles in Product of Sequence application
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi
I have the following equation that I need to code up as a single function.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147544/image.png)
The output function handle would contain the function for the passed value of k.
I was planning of making individual function handles for each value of k and then multiply them in a FOR loop, but that does not seem to work. Any ideas?
Thanks,
Hasan
댓글 수: 0
답변 (1개)
Youssef El Seblani
2018년 3월 25일
function [li]=lagrange(x,i) c=x(i); x(i)=[]; syms X; f(X)=prod( (X-x)./(c-x)); li=f(X); end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!