how do I plot this in matlab?
f(x)=2x/(x^2)+1 - x/sqrt(3*x+6) in the interval of -2<x_<6 (what i mean is that x is smaller or exactly 6)
i wrote like this below:
x=linspace(-2,6)
f=(2*x/x.^2+1)-(x/sqrt(3*x+6))
plot(x,f)
but this did not work

답변 (1개)

KSSV
KSSV 2022년 11월 5일
편집: KSSV 2022년 11월 5일

1 개 추천

x=linspace(-2,6) ;
f=(2*x./x.^2+1)-(x./sqrt(3*x+6)); %<--- element by element division
plot(x,f)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2022년 11월 5일

편집:

2022년 11월 5일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by