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 CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by