Resolution of plot code errors
조회 수: 2 (최근 30일)
이전 댓글 표시
syms x;
y=1/sqrt((1-x^2)^2+(2*x)^2);
plot(x,y);
xlim([0 5]); ylim([0 4]);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557939/image.png)
I can't draw a graph. A code error appears
I need your help
댓글 수: 0
채택된 답변
Les Beckham
2023년 12월 1일
Why are you trying to do this with symbolic variables? It works using simple numeric variables.
x = linspace(-5, 5, 500);
y = 1 ./ sqrt((1-x.^2).^2 + (2*x).^2); % <<< use element-wise powers and division
plot(x, y);
% xlim([0 5])
ylim([0 4])
grid on
추가 답변 (1개)
Voss
2023년 12월 1일
Use fplot instead of plot:
syms x;
y=1/sqrt((1-x^2)^2+(2*x)^2);
fplot(x,y);
xlim([0 5]); ylim([0 4]);
댓글 수: 2
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!