Borrar filtros
Borrar filtros

problem doing implicit plotting

30 visualizaciones (últimos 30 días)
Chris
Chris el 11 de Jul. de 2024 a las 23:57
Comentada: Chris el 12 de Jul. de 2024 a las 18:23
Hi, I am trying to make an implicit 3D plot in Matlab. A Matlab Help page says to use the following (as an example):
f = @(x,y,z) x.^2 + y.^2 - z.^2;
interval = [-5 5 -5 5 0 5];
fimplicit3(f,interval)
This works fine. But if I try to complicate things a bit by changing f to:
f = @(x,y,z) x.^2 + y.^2 - z.^2 + x.*y.
then I get the error message "Error: Invalid expression. Check for missing or extra characters".
Any idea what the problem is?
Thank you!

Respuestas (1)

Torsten
Torsten el 12 de Jul. de 2024 a las 14:41
Movida: Torsten el 12 de Jul. de 2024 a las 14:42
Remove the dot at the end of the expression x.*y.
  6 comentarios
Sam Chak
Sam Chak el 12 de Jul. de 2024 a las 18:08
@Chris, you can see the effect of the dot in this example and comparison.
x = [1 2;
3 4];
% Case 1: element-wise product
y = x.^2
y = 2x2
1 4 9 16
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% Case 2a: 2x2 matrix multiplication
y = x^2
y = 2x2
7 10 15 22
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% Case 2b: 2x2 matrix multiplication
y = [x(1)*x(1) + x(2)*x(3), x(3)*x(1) + x(4)*x(3)
x(1)*x(2) + x(2)*x(4), x(3)*x(2) + x(4)*x(4)]
y = 2x2
7 10 15 22
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Chris
Chris el 12 de Jul. de 2024 a las 18:23
Ahhh, I see. Thank you!
C

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by