3D Logarithmic Spiral Code

2 vues (au cours des 30 derniers jours)
Aadil
Aadil le 27 Mar 2013
Hello,
I need to generate a 3D Logarithmic Spiral !
Can anybody help me with the code.
Thanks!!!!!!!!!
  3 commentaires
Aadil
Aadil le 27 Mar 2013
Hi Cedric,
Thanks for the response. I have generated the spiral but it is an Archimedian Type. I need a logarithmic 3d spiral instead. Please help if you can.
Cedric
Cedric le 27 Mar 2013
Well, you've seen that already I guess http://en.wikipedia.org/wiki/Logarithmic_spiral
so you have a formula for x(t) and y(t), and you could generate a formula for z(t) as t/100 for example.
Now you want to create a vector of all times that you want to consider, e.g.
>> t = 0:0.1:100 ;
and compute x, y, and z from there. Play a bit with a smaller vector t and see what you can do, keeping in mind that multiplying vectors element by element requires a dotted operator..
>> t = 1:4
t =
1 2 3 4
>> exp(t)
ans =
2.7183 7.3891 20.0855 54.5982
>> sin(t)
ans =
0.8415 0.9093 0.1411 -0.7568
>> exp(t) * sin(t) % Wrong way to perform element-wise multiplication..
Error using *
Inner matrix dimensions must agree.
>> exp(t) .* sin(t) % Correct way; each element of the output is the
% product of corresponding elements of the inputs.
ans =
2.2874 6.7188 2.8345 -41.3200

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by