Plotting the graph of (4*x*sinx − 3)/(2 + x^2 )

9 ビュー (過去 30 日間)
Tuna KISAAGA
Tuna KISAAGA 2021 年 4 月 3 日
回答済み: VBBV 2023 年 4 月 12 日
f(x) = (4*x*sinx − 3)/(2 + x^2 ) for 0 ≤ x ≤ 4
How can I plot the graph of this function?
x=linspace(0,4,400);
y=((4.*x.*sin(x))-3)/(2+x.^2);
z=zeros(1,400);
figure
plot(x,y)
hold on
plot(x,z,'--')
title('Plot of (4*x*sin(x)-3)/(2+x^2)')
This code does not work.

回答 (1 件)

VBBV
VBBV 2023 年 4 月 12 日
Use the element wise division for the equation
x=linspace(0,4,400);
y=((4.*x.*sin(x))-3)./(2+x.^2);
%^ use element wise division
z=zeros(1,400);
figure
plot(x,y)
hold on
plot(x,z,'--')
title('Plot of (4*x*sin(x)-3)/(2+x^2)');

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by