Plotting the graph of (4*x*sinx − 3)/(2 + x^2 )
조회 수: 9 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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)');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Labels and Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
