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

9 vues (au cours des 30 derniers jours)
Tuna KISAAGA
Tuna KISAAGA le 3 Avr 2021
Réponse apportée : VBBV le 12 Avr 2023
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.

Réponses (1)

VBBV
VBBV le 12 Avr 2023
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)');

Catégories

En savoir plus sur Labels and Annotations 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