Matlab to Scilab conversion

Lester Anderson lester at arctica1.wanadoo.co.uk
Wed Sep 2 19:30:37 CEST 2009


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*(1-v^2));
    phi=1./((D.*k.^4./((rho_m-rho_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.7e-6,0.5,'T_e=100km')
text(3.6e-5,0.5,'T_e=10km')
text(8e-5,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*(1-v^2));
  phi = 1 ./((D .*(k .^4)) ./((rho_m-rho_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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20090902/5efdea5f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iso_response_func.jpg
Type: application/octet-stream
Size: 123968 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20090902/5efdea5f/attachment.obj>


More information about the users mailing list