How can I a function on the interval
조회 수: 7 (최근 30일)
이전 댓글 표시
I got a equation: x+ln x = 0, and I want to plot it on the interval [0.1, 1]
I have tried this code:
f = @(x)x+log(x)
fplot(f,[0.1 1])
But it only shows: f =
function_handle with value:
@(x)x+log(x)
Is anything wrong with my code? Thank you!
댓글 수: 1
Torsten
2022년 11월 1일
You didn't set a
;
at the end of the line
f = @(x)x+log(x)
So f is displayed.
But the plot follows - so everything is fine.
답변 (1개)
Star Strider
2022년 11월 1일
If you want the x and y values, you need to ask for them —
f = @(x)x+log(x)
hfp = fplot(f,[0.1 1]);
x = hfp.XData
y = hfp.YData
.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!