3D Logarithmic Spiral Code
2 views (last 30 days)
Show older comments
Hello,
I need to generate a 3D Logarithmic Spiral !
Can anybody help me with the code.
Thanks!!!!!!!!!
3 Comments
Cedric
on 27 Mar 2013
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
Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!