how do i plot this?

9 vues (au cours des 30 derniers jours)
Maryam
Maryam le 5 Nov 2022
Modifié(e) : KSSV le 5 Nov 2022
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

Réponses (1)

KSSV
KSSV le 5 Nov 2022
Modifié(e) : KSSV le 5 Nov 2022
x=linspace(-2,6) ;
f=(2*x./x.^2+1)-(x./sqrt(3*x+6)); %<--- element by element division
plot(x,f)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by