3D Logarithmic Spiral Code

2 次查看(过去 30 天)
Aadil
Aadil 2013-3-27
Hello,
I need to generate a 3D Logarithmic Spiral !
Can anybody help me with the code.
Thanks!!!!!!!!!
  3 个评论
Aadil
Aadil 2013-3-27
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 2013-3-27
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by