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!