[scilab-Users] Matlab to Scilab conversion

Yann Collette yann.collette at scilab.org
Thu Sep 3 13:39:48 CEST 2009


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*(1-v^2));
    phi=(1)./(((D.*k.^4)./((rho_m-rho_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.7e-6,0.5,'T_e=100km')
xstring(3.6e-5,0.5,'T_e=10km')
xstring(8e-5,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



More information about the users mailing list