3D Logarithmic Spiral Code

조회 수: 1 (최근 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