错误和plotting my function
1 view (last 30 days)
Show older comments
Having issues getting my nonlinear function to plot.
f = @(x) 2.^x-5*x+2;%Given Function
xaxis = [0:0.5:2];%x-axis
plot(xaxis,f)%plotting function //DOESN'T WORK
Accepted Answer
Star Strider
on 18 Sep 2021
It works if you give
‘f’
a vector to work
with
—
f = @(x) 2.^x-5*x+2;%Given Function
xaxis = [0:0.5:2];%x-axis
plot(xaxis,f(xaxis))%plotting function //DOESN'T WORK —> YEs, IT DOES!
Experiment to get different results.
.
2 Comments
More Answers (0)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!