what does mean: "@(x) ....."?
이전 댓글 표시
Hi everbody,
i want to understand some code, which I need for my own project.
This ist an function handle. But i can understand this:
@(x) xValue - polyval([x(1:end-1),0],yValue,[],[0,x(end)]);
What does mean x(end) or x(1:end-1) ?? How can I realize this codeline in function?
Thanks for the comming answer.
답변 (1개)
execute this code:
x = 1:10 % create a vector with elements from 1...10
a = x(end) % access last element of vector and write to a
b = x(end-1) % access 2.last element of vector and write to b
c = x(1:5) % access elements 1...5
d = x(1:end) % access all elements
e = x(1:end-1) % access all elements but not the last one
f = x(1:end-3) % access all elements but not the last three
g = x(1:2:end) % access every second element
댓글 수: 6
Furkan Kocaman
2019년 6월 25일
Furkan Kocaman
2019년 6월 25일
편집: Furkan Kocaman
2019년 6월 25일
Walter Roberson
2019년 6월 25일
Those variables would have already been assigned to before that line. Initial guess about the solution is being constructed as all except the last p vector, followed by the second mu entry. You could also phrase this like.
Temp = p ;
Temp(end) = mu(2);
and then pass Temp in place of the construct.
Furkan Kocaman
2019년 6월 25일
Walter Roberson
2019년 6월 25일
Eigen for Python appears to be bindings for a C++ implementation.
The values such as zInit in the examples there correspond to x0.
카테고리
도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!