plotting line function in 3D
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jente Marien
el 25 de Mzo. de 2017
Comentada: Star Strider
el 25 de Mzo. de 2017
t = linspace(0, 4*pi);
x = @(t)(4+sin(a*t))*cos(3*t);
y = @(t) (4+sin(a*t))*sin(3*t);
z = @(t) cos(3*t);
How is it possible to plot this function?
0 comentarios
Respuesta aceptada
Star Strider
el 25 de Mzo. de 2017
I had to supply a value for ‘a’, assuming it is a scalar.
This works:
t = linspace(0, 4*pi);
a = 1; % Guess The Value Of ‘a’
x = @(t)(4+sin(a*t)).*cos(3*t);
y = @(t) (4+sin(a*t)).*sin(3*t);
z = @(t) cos(3*t);
figure(1)
plot3(x(t), y(t), z(t))
grid on
You need to vectorize your functions to do element-wise operations (replacing ‘*’ with ‘.*’). See the documentation on Array vs. Matrix Operations for details.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!