How to plot x^2 - y^2 = 1?

124 visualizaciones (últimos 30 días)
Niklas Kurz
Niklas Kurz el 14 de Nov. de 2020
Comentada: Niklas Kurz el 3 de Nov. de 2021
Very simple question to understand I think.

Respuesta aceptada

Star Strider
Star Strider el 14 de Nov. de 2020
Try this:
syms x y
figure
fimplicit(x^2 + y^2 -1, [-1 1])
axis('equal')
.
  8 comentarios
Star Strider
Star Strider el 16 de Nov. de 2020
As always, my pleasure!
Note that ‘<1’ includes everything from infinitesimally less than +1 to -Inf.
Niklas Kurz
Niklas Kurz el 3 de Nov. de 2021
Digging this out again, how about ?
A kind of solution would go like:
[x,y] = meshgrid(-4:0.008:4);
u = y;
v = x;
w = zeros(size(u));
D1 = (x.^2+y.^2)>1;
D2 = (x.^2+y.^2)<4;
u(~D1) = NaN;
u(~D2) = NaN;
mesh(u,v,w)
But are there other ones, for instance with the aid of a countour plot?

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 14 de Nov. de 2020
Try this:
% x^2 - y^2 = 1
% Or y = sqrt(x^2 - 1)
x = linspace(-2, 2, 1000);
y = sqrt(x .^ 2 - 1);
plot(x, y, 'b-', 'LineWidth', 2);
title('y = sqrt(x .^ 2 - 1)', 'FontSize', 15, 'Interpreter', 'none');
xlabel('x', 'FontSize', 15);
ylabel('y', 'FontSize', 15);
grid on;

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by