I'm trying to convert some code over
from Scilab 6.01 to Octave 5.0.91.
I'm testing the code with Octave version 5.0.91 on Ubuntu
64bit 16gig ram.
In Scilab the code plots in about 2 seconds but after 15mins
in Octave 5.0.91 it's still going. Can anyone see the error
in my conversion from Scilab to Octave and why this won't
plot with the same values as Scilab?
Code below:
Scilab Code:
//================
//2D Quaterion Rotation Program in Scilab 5.5.0
w1=111
w2=333
w3=777
// No phase differences in this: add in phi1 and phi2 phase
differences if desired to the psi and phi angles
clf
//Clear the graphics window first
n = [0:0.001:45]
x1=50.*cos((n./360).*2.*%pi.*w1).*(1.144.*n./100) //w = mu
cos theta, the scalar
x2=50.*cos((n./360).*2.*%pi.*w2).*(1.144.*n./100) //cos phi
y1=50.*cos((n./360).*2.*%pi.*w3).*(1.144.*n./100) //cos psi
y2=50.*sin((n./360).*2.*%pi.*w1).*(1.144.*n./100) //sin
theta
z1=50.*sin((n./360).*2.*%pi.*w2).*(1.144.*n./100) //sin phi
z2=50.*sin((n./360).*2.*%pi.*w3).*(1.144.*n./100) //sin psi
x = y2.*x2
y=y2.*z1.*y1
z = y2.*z1.*z2
//plot(x,z)
//3D: Replace plot (x,z) with:
scatter3(x,y,z,1,".")
gca().rotation_angles = [45,105]
Octave code converted:
%%========================
%%2D Pseudo Quaterion Rotation Program in converted from
Scilab 6.01 to Octave 5.0.91
w1=111
w2=333
w3=777
%% No phase differences in this: add in phi1 and phi2 phase
differences if desired to the psi and phi angles
n = [0:.001:45];
x1=50.*cos((n./360).*2.*pi.*w1).*(1.144.*n./100); %%w = mu
cos theta, the scalar
x2=50.*cos((n./360).*2.*pi.*w2).*(1.144.*n./100); %%cos phi
y1=50.*cos((n./360).*2.*pi.*w3).*(1.144.*n./100); %%cos psi
y2=50.*sin((n./360).*2.*pi.*w1).*(1.144.*n./100); %%sin
theta
z1=50.*sin((n./360).*2.*pi.*w2).*(1.144.*n./100); %sin phi
z2=50.*sin((n./360).*2.*pi.*w3).*(1.144.*n./100); %%sin psi
x = y2.*x2;
y=y2.*z1.*y1;
z = y2.*z1.*z2;
scatter3 (x, y, z); %color can be created based on z
xlabel('X-axis')
ylabel('Y-axis')
zlabel('Z-axis')
grid on
az = 347; %90;
el = 37; %180;
view([az,el]);
--