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

 Akzeptierte Antwort

Les Beckham
Les Beckham am 1 Dez. 2023

0 Stimmen

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 Kommentare

영석
영석 am 1 Dez. 2023
thank you:)
Les Beckham
Les Beckham am 1 Dez. 2023
You are quite welcome.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Voss
Voss am 1 Dez. 2023

0 Stimmen

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 Kommentare

영석
영석 am 1 Dez. 2023
That's what I wanted. thank you:)
Voss
Voss am 1 Dez. 2023
You're welcome! If this answer helped, please vote for and/or Accept it. Thanks!

Melden Sie sich an, um zu kommentieren.

Produkte

Tags

Gefragt:

am 1 Dez. 2023

Kommentiert:

am 1 Dez. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by