
Lester,
If you do not have the plotlib toolbox installed, I recommend it. It will handle the semilogx command
without having to convert to the Scilab plot command. Not that the plot command is bad, just easier
to convert. Post if yo uhave problems getting plot lib working. I just did this myself. Plotlib can be found
on the Scilab contributions site.
Dave
Original Message From: Lester Anderson [mailto:[hidden email]] Sent: Wednesday, September 2, 2009 01:30 PM To: [hidden email] Subject: [scilabUsers] Matlab to Scilab conversion
Hello
I am fairly new to using Scilab (and Matlab) but need to convert some existing files. I have attached an example which I can't get to work and the image of the correct plot from Matlab.
Original Matlab file:
rho_m=3300; % in kg/m^3 rho_infill=2700; % in kg/m^3 E=1e11; % in kg/m/s^2 v=0.25; g=9.81; % in m/s^2 l1=1e3:2e3:50e3; % in m l2=75e3:25e3:1000e3; % in m l=[l1 l2]; % in m k=1./l; % in 1/m
for Te=0:10e3:100e3 % in m D=E*Te^3/(12*(1v^2)); phi=1./((D.*k.^4./((rho_mrho_infill)*g))+1); semilogx(k,phi) hold on title('\Phi _e(k) for various T_e') xlabel('Wavenumber k') ylabel('\Phi _e(k)') end text(1.7e6,0.5,'T_e=100km') text(3.6e5,0.5,'T_e=10km') text(8e5,0.95,'T_e=0km')
Output from the conversion below:
// Display mode mode(0);
// Display warning for floating point exception ieee(1);
rho_m = 3300; // in kg/m^3 rho_infill = 2700; // in kg/m^3 E = 100000000000; // in kg/m/s^2 v = 0.25; g = 9.81; // in m/s^2 l1 = 1000:2000:50000; // in m l2 = 75000:25000:1000000; // in m l = [l1,l2]; // in m k = 1 ./l; // in 1/m
for Te = 0:10000:100000 // in m D = (E*(Te^3))/(12*(1v^2)); phi = 1 ./((D .*(k .^4)) ./((rho_mrho_infill)*g)+1); // !! L.14: Matlab function semilogx not yet converted, original calling sequence used. semilogx(k,phi) set(gca(),"auto_clear","off") title("\Phi _e(k) for various T_e") xlabel("Wavenumber k") ylabel("\Phi _e(k)") end; // !! L.20: Matlab function text not yet converted, original calling sequence used. text(0.0000017,0.5,"T_e=100km") // !! L.21: Matlab function text not yet converted, original calling sequence used. text(0.000036,0.5,"T_e=10km") // !! L.22: Matlab function text not yet converted, original calling sequence used. text(0.00008,0.95,"T_e=0km")
Hopefully someone can see what is needed to get things working. Thanks in advance all.
Lester Anderson


Hello Dave
Thanks for the pointer on the toolbox idea.
Downloaded and have tried to install/setup on Windows Vista but can't get it to
work. Think it's something to do with the path. At the moment I extracted the
toolbox folder to C:\users\lester\documents\plotlib021install I
also use Windows XP but haven't got around to testing on there. I have both
version 5.01 and 5.1
Tried loading the loader.sce file into
Scilab:
Startup execution: loading initial
environment mclose: Cannot close file whose descriptor is 2: File is
not active.
exec('builder.sce',1)
!error 241 File "builder.sce" does not exist or read access
denied.
at line 11 of exec
file called by :
exec("C:/Users/Lester/Documents/plotlib021install/loader.sce"); in
execstr instruction called by :
Given that I am still pretty new with Scilab, it
would be useful to know how the scilab plot commands could be used to generate
the graphic I showed previously.
Sorry if this is a basic question/problem but got
to learn by asking :) I'm sure I'm missing some basic things with regards to the
toolbox issue, but I thought they were prebuilt and all you did was run the
loader.sce file to get them into Scilab?
Thanks for the assistance in advance.
Lester
 Original Message 
Sent: Wednesday, September 02, 2009 6:50
PM
Subject: Re: [scilabUsers] Matlab to
Scilab conversion
Lester,
If you do not have the plotlib toolbox
installed, I recommend it. It will handle the semilogx command
without having to convert to the Scilab plot
command. Not that the plot command is bad, just easier
to convert. Post if yo uhave problems getting
plot lib working. I just did this myself. Plotlib can be found
on the Scilab contributions site.
Dave
Original Message From: Lester
Anderson [mailto:[hidden email]] Sent: Wednesday,
September 2, 2009 01:30 PM To:
[hidden email] Subject: [scilabUsers] Matlab to Scilab
conversion
Hello
I am fairly new to using Scilab (and
Matlab) but need to convert some existing files. I have attached an
example which I can't get to work and the image of the correct plot
from Matlab.
Original Matlab file:
rho_m=3300; % in
kg/m^3 rho_infill=2700; % in
kg/m^3 E=1e11; % in
kg/m/s^2 v=0.25; g=9.81; % in
m/s^2 l1=1e3:2e3:50e3; % in
m l2=75e3:25e3:1000e3; % in m l=[l1 l2];
% in m k=1./l; % in 1/m
for Te=0:10e3:100e3 %
in m
D=E*Te^3/(12*(1v^2));
phi=1./((D.*k.^4./((rho_mrho_infill)*g))+1);
semilogx(k,phi) hold on
title('\Phi _e(k) for various T_e')
xlabel('Wavenumber k') ylabel('\Phi
_e(k)') end text(1.7e6,0.5,'T_e=100km') text(3.6e5,0.5,'T_e=10km') text(8e5,0.95,'T_e=0km')
Output from the conversion
below:
// Display mode mode(0);
// Display warning for floating point
exception ieee(1);
rho_m = 3300; // in
kg/m^3 rho_infill = 2700; // in kg/m^3 E =
100000000000; // in kg/m/s^2 v = 0.25; g = 9.81; // in
m/s^2 l1 = 1000:2000:50000; // in m l2 =
75000:25000:1000000; // in m l = [l1,l2]; // in m k = 1
./l; // in 1/m
for Te = 0:10000:100000 // in
m D = (E*(Te^3))/(12*(1v^2)); phi = 1 ./((D .*(k
.^4)) ./((rho_mrho_infill)*g)+1); // !! L.14: Matlab
function semilogx not yet converted, original calling sequence
used. semilogx(k,phi)
set(gca(),"auto_clear","off") title("\Phi _e(k) for various
T_e") xlabel("Wavenumber k") ylabel("\Phi
_e(k)") end; // !! L.20: Matlab function text not yet converted,
original calling sequence
used. text(0.0000017,0.5,"T_e=100km") // !! L.21: Matlab
function text not yet converted, original calling sequence
used. text(0.000036,0.5,"T_e=10km") // !! L.22: Matlab function
text not yet converted, original calling sequence
used. text(0.00008,0.95,"T_e=0km")
Hopefully someone can see what is needed
to get things working. Thanks in advance all.
Lester Anderson


On 20090902 19:30, Lester Anderson wrote:

> Hello
>
> I am fairly new to using Scilab (and Matlab) but need to convert some
> existing files. I have attached an example which I can't get to work and
> the image of the correct plot from Matlab.
>
> Original Matlab file:
>
> rho_m=3300; % in kg/m^3
> rho_infill=2700; % in kg/m^3
> E=1e11; % in kg/m/s^2
> v=0.25;
> g=9.81; % in m/s^2
> l1=1e3:2e3:50e3; % in m
> l2=75e3:25e3:1000e3; % in m
> l=[l1 l2]; % in m
> k=1./l; % in 1/m
>
> for Te=0:10e3:100e3 % in m
> D=E*Te^3/(12*(1v^2));
> phi=1./((D.*k.^4./((rho_mrho_infill)*g))+1);
> semilogx(k,phi)
> hold on
> title('\Phi _e(k) for various T_e')
> xlabel('Wavenumber k')
> ylabel('\Phi _e(k)')
> end
> text(1.7e6,0.5,'T_e=100km')
> text(3.6e5,0.5,'T_e=10km')
> text(8e5,0.95,'T_e=0km')
>
> Output from the conversion below:
>
> // Display mode
> mode(0);
>
> // Display warning for floating point exception
> ieee(1);
>
> rho_m = 3300;
> // in kg/m^3
> rho_infill = 2700;
> // in kg/m^3
> E = 100000000000;
> // in kg/m/s^2
> v = 0.25;
> g = 9.81;
> // in m/s^2
> l1 = 1000:2000:50000;
> // in m
> l2 = 75000:25000:1000000;
> // in m
> l = [l1,l2];
> // in m
> k = 1 ./l;
> // in 1/m
>
> for Te = 0:10000:100000
> // in m
> D = (E*(Te^3))/(12*(1v^2));
> phi = 1 ./((D .*(k .^4)) ./((rho_mrho_infill)*g)+1);
> // !! L.14: Matlab function semilogx not yet converted, original
> calling sequence used.
> semilogx(k,phi)
> set(gca(),"auto_clear","off")
> title("\Phi _e(k) for various T_e")
> xlabel("Wavenumber k")
> ylabel("\Phi _e(k)")
> end;
> // !! L.20: Matlab function text not yet converted, original calling
> sequence used.
> text(0.0000017,0.5,"T_e=100km")
> // !! L.21: Matlab function text not yet converted, original calling
> sequence used.
> text(0.000036,0.5,"T_e=10km")
> // !! L.22: Matlab function text not yet converted, original calling
> sequence used.
> text(0.00008,0.95,"T_e=0km")
>
> Hopefully someone can see what is needed to get things working. Thanks
> in advance all.
>
> Lester Anderson
You have to change "%" to "//" for comments!
Regards
Stefan


Hi,
before launching loader.sce, you should have run builder.sce once (for
all).
The following commands should work
> cd plotlib021install
> exec builder.sce
then you can issue a
> exec loader.sce
to load the toolbox. If you need to load the plotlib each time you
launch Scilab,
edit your .scilab startup script :
scipad(SCIHOME+"/.scilab")
and add the following line therein :
exec path/plotlib021install/loade.sce
(replace "path" with the actual path to "plotlib021install")
S.
Lester Anderson a écrit :
Hello Dave
Thanks for the pointer on the
toolbox idea. Downloaded and have tried to install/setup on Windows
Vista but can't get it to work. Think it's something to do with the
path. At the moment I extracted the toolbox folder to
C:\users\lester\documents\plotlib021install I also use Windows XP
but haven't got around to testing on there. I have both version 5.01
and 5.1
Tried loading the loader.sce file
into Scilab:
Startup execution:
loading initial environment
mclose: Cannot close file whose descriptor is 2: File is not active.
exec('builder.sce',1)
!error 241
File "builder.sce" does not exist or read access denied.
at line 11 of exec file called
by :
exec("C:/Users/Lester/Documents/plotlib021install/loader.sce");
in execstr instruction called by :
Given that I am still pretty new
with Scilab, it would be useful to know how the scilab plot commands
could be used to generate the graphic I showed previously.
Sorry if this is a basic
question/problem but got to learn by asking :) I'm sure I'm missing
some basic things with regards to the toolbox issue, but I thought they
were prebuilt and all you did was run the loader.sce file to get them
into Scilab?
Thanks for the assistance in advance.
Lester

Original Message 
Sent:
Wednesday, September 02, 2009 6:50 PM
Subject:
Re: [scilabUsers] Matlab to Scilab conversion
Lester,
If you do not have the plotlib
toolbox installed, I recommend it. It will handle the semilogx command
without having to convert to
the Scilab plot command. Not that the plot command is bad, just easier
to convert. Post if yo uhave
problems getting plot lib working. I just did this myself. Plotlib can
be found
on the Scilab contributions
site.
Dave
Original Message
From: Lester Anderson
[[hidden email]]
Sent: Wednesday, September 2, 2009 01:30 PM
To: [hidden email]
Subject: [scilabUsers] Matlab to Scilab conversion
Hello
I am fairly new to using
Scilab (and Matlab) but need to convert some existing files. I have
attached an example which I can't get to work and the image of the
correct plot from Matlab.
Original Matlab file:
rho_m=3300; % in kg/m^3
rho_infill=2700; % in kg/m^3
E=1e11; % in kg/m/s^2
v=0.25;
g=9.81; % in m/s^2
l1=1e3:2e3:50e3; % in m
l2=75e3:25e3:1000e3; % in m
l=[l1 l2]; % in m
k=1./l; % in 1/m
for Te=0:10e3:100e3 %
in m
D=E*Te^3/(12*(1v^2));
phi=1./((D.*k.^4./((rho_mrho_infill)*g))+1);
semilogx(k,phi)
hold on
title('\Phi _e(k) for various T_e')
xlabel('Wavenumber k')
ylabel('\Phi _e(k)')
end
text(1.7e6,0.5,'T_e=100km')
text(3.6e5,0.5,'T_e=10km')
text(8e5,0.95,'T_e=0km')
Output from the conversion
below:
// Display mode
mode(0);
// Display warning for
floating point exception
ieee(1);
rho_m = 3300;
// in kg/m^3
rho_infill = 2700;
// in kg/m^3
E = 100000000000;
// in kg/m/s^2
v = 0.25;
g = 9.81;
// in m/s^2
l1 = 1000:2000:50000;
// in m
l2 = 75000:25000:1000000;
// in m
l = [l1,l2];
// in m
k = 1 ./l;
// in 1/m
for Te = 0:10000:100000
// in m
D = (E*(Te^3))/(12*(1v^2));
phi = 1 ./((D .*(k .^4)) ./((rho_mrho_infill)*g)+1);
// !! L.14: Matlab function semilogx not yet converted, original
calling sequence used.
semilogx(k,phi)
set(gca(),"auto_clear","off")
title("\Phi _e(k) for various T_e")
xlabel("Wavenumber k")
ylabel("\Phi _e(k)")
end;
// !! L.20: Matlab function text not yet converted, original calling
sequence used.
text(0.0000017,0.5,"T_e=100km")
// !! L.21: Matlab function text not yet converted, original calling
sequence used.
text(0.000036,0.5,"T_e=10km")
// !! L.22: Matlab function text not yet converted, original calling
sequence used.
text(0.00008,0.95,"T_e=0km")
Hopefully someone can see
what is needed to get things working. Thanks in advance all.
Lester Anderson



Hello,
Here is the converted script:
rho_m=3300; // in kg/m^3
rho_infill=2700; // in kg/m^3
E=1e11; // in kg/m/s^2
v=0.25;
g=9.81; // in m/s^2
l1=1e3:2e3:50e3; // in m
l2=75e3:25e3:1000e3; // in m
l=[l1 l2]; // in m
k=(1)./l; // in 1/m
for Te=0:10e3:100e3 // in m
D=E*Te^3/(12*(1v^2));
phi=(1)./(((D.*k.^4)./((rho_mrho_infill)*g))+1);
plot2d(k,phi);
a=gca();
a.log_flags='lnn';
xtitle('\Phi _e(k) for various T_e','Wavenumber k','Phi e(k)');
end
xstring(1.7e6,0.5,'T_e=100km')
xstring(3.6e5,0.5,'T_e=10km')
xstring(8e5,0.95,'T_e=0km')
One thing you must be careful on: the ./ operator:
 1./l means (1.0)/l
 you must write (1)./l
YC

 