Resolution of plot code errors

조회 수: 2 (최근 30일)
영석
영석 2023년 12월 1일
댓글: Voss 2023년 12월 1일
syms x;
y=1/sqrt((1-x^2)^2+(2*x)^2);
plot(x,y);
xlim([0 5]); ylim([0 4]);
I can't draw a graph. A code error appears
I need your help

채택된 답변

Les Beckham
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
  댓글 수: 2
영석
영석 2023년 12월 1일
thank you:)
Les Beckham
Les Beckham 2023년 12월 1일
You are quite welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Voss
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
영석
영석 2023년 12월 1일
That's what I wanted. thank you:)
Voss
Voss 2023년 12월 1일
You're welcome! If this answer helped, please vote for and/or Accept it. Thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by