how do i plot this?

17 ビュー (過去 30 日間)
Maryam
Maryam 2022 年 11 月 5 日
編集済み: KSSV 2022 年 11 月 5 日
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 日
x=linspace(-2,6) ;
f=(2*x./x.^2+1)-(x./sqrt(3*x+6)); %<--- element by element division
plot(x,f)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by