blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 6 214 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 6 87 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 15 values | visit_date timestamp[us]date 2016-08-04 09:00:04 2023-09-05 17:18:33 | revision_date timestamp[us]date 1998-12-11 00:15:10 2023-09-02 05:42:40 | committer_date timestamp[us]date 2005-04-26 09:58:02 2023-09-02 05:42:40 | github_id int64 436k 586M ⌀ | star_events_count int64 0 12.3k | fork_events_count int64 0 6.3k | gha_license_id stringclasses 7 values | gha_event_created_at timestamp[us]date 2012-11-16 11:45:07 2023-09-14 20:45:37 ⌀ | gha_created_at timestamp[us]date 2010-03-22 23:34:58 2023-01-07 03:47:44 ⌀ | gha_language stringclasses 36 values | src_encoding stringclasses 17 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 1 class | length_bytes int64 5 10.4M | extension stringclasses 15 values | filename stringlengths 2 96 | content stringlengths 5 10.4M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cac0447537ef1770d69fe6c44320eb7169b9f500 | 8667898fde492ddc28b1a13f691abc256f30e1cb | /lab2.sce | 20918976fe7bb4d668f58a4c76443bc976c01aa3 | [] | no_license | lainys/tsisa | f269a87516470d14cebc1d13365980030f9258a5 | 15c07d1f4fa4d73b876d63982eba4de323b44b84 | refs/heads/master | 2020-08-02T15:34:16.743889 | 2019-09-30T18:58:14 | 2019-09-30T18:58:14 | 211,411,674 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,650 | sce | lab2.sce | function [p,err]=approx(f,G,Z,p0)
[p,err]=datafit(G,Z,p0)
xgrid;
xlabel('x');
ylabel('y');
scatter(X,Y);
x = -5:0.1:10;
plot2d(x,f(x,p),12);
endfunction
X = [1.28,2.00,2.91,4.07,5.00,6.00,7.01,7.89];
Y = [2.36,3.15,3.55,4.00,4.41,5.08,5.49,6.12];
Z = [X;Y];
scf();clf();
p0=[1;1;1;1;1];
//f1
function y=f1(x,p)
a = p(1);b = p(2);
y = a*x + b;
endfunction
function e=G1(p, z)
e=sum((z(2)-f1(z(1),p))^2);
endfunction
// f2
function y=f2(x,p)
a = p(1);b = p(2);c = p(3);
y = a*x^2 + b*x + c;
endfunction
function e=G2(p, z)
e=sum((z(2)-f2(z(1),p))^2);
endfunction
// f3
function y=f3(x,p)
a = p(1);b = p(2);c = p(3);d = p(4);
y = a*x^3 + b*x^2 + c*x + d;
endfunction
function e=G3(p, z)
e=sum((z(2)-f3(z(1),p))^2);
endfunction
// f4
function y=f4(x,p)
alp = p(1);bt = p(2);a = p(3);b = p(4);c = p(5);
y = alp*exp(a*x) + bt*exp(b*x) + c;
endfunction
function e=G4(p, z)
e=sum((z(2)-f4(z(1),p))^2);
endfunction
subplot(2,2,1);
approx(f1,G1,Z,p0);
subplot(2,2,2);
approx(f2,G2,Z,p0);
subplot(2,2,3);
approx(f3,G3,Z,p0);
subplot(2,2,4);
[p,err]=approx(f4,G4,Z,p0);
// ex2
X = [1 2 3 4];
Y = X^2 + 25*X - exp(X);
Z = [X;Y];
p0=[1;1;1;1;1];
scf();clf();
subplot(2,2,1);
approx(f1,G1,Z,p0);
subplot(2,2,2);
approx(f2,G2,Z,p0);
subplot(2,2,3);
approx(f3,G3,Z,p0)
subplot(2,2,4);
approx(f4,G4,Z,p0);
//ex3
c(1) = Y(1)
for i=1:3
temp1 = 1;
temp2 = 0;
for j = 1:i
temp2 = temp2 + temp1*c(j);
temp1 = temp1*(X(i+1)-X(j));
end
c(i+1) = Y(i+1) - temp2/temp1;
end
c
scf();clf();
xgrid;
scatter(X,Y);
x = -5:0.1:10;
plot2d(x,f3(x,c),12);
|
f5d3c6b829e041ac7fe7cb456678339b3781a094 | e2cee73f9682b79c4a5d6a1e6381cf6679dc1094 | /TP_AN/TP3/MethodeSecante.sci | 0ebada62ddf583921d4b6ea3a4b15f6540d39643 | [] | no_license | melurne/TP_ANgit | b1b91e444aef30706fef0cac4da9355d4d04e1aa | 59c1aa6a5261f9753e108877079a495d5b95fb50 | refs/heads/master | 2023-04-19T09:23:02.045251 | 2021-05-17T14:56:34 | 2021-05-17T14:56:34 | 350,416,537 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 305 | sci | MethodeSecante.sci | function approx = MethodeSecante(f, x_0, x_1, N)
xn_1 = x_0;
xn = x_1;
approx = xn - f(xn)/((f(xn)-f(xn_1))/(xn-xn_1));
n = 1;
while n < N
xn_1 = xn;
xn = approx;
approx = xn - f(xn)/((f(xn)-f(xn_1))/(xn-xn_1));
n = n+1;
end
return;
endfunction
|
7767d72d1f82064977285f6e55f45f5e6488cb13 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3556/CH1/EX1.4/Ex1_4.sce | ab343032ec0c67c6b3e8b670fda62c78ea09d128 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 547 | sce | Ex1_4.sce | clc
// Fundamental of Electric Circuit
// Charles K. Alexander and Matthew N.O Sadiku
// Mc Graw Hill of New York
// 5th Edition
// Part 1 : DC Circuits
// Chapter 1 : Basic Concepts
// Example 1 - 4
clear; clc; close;
//
// Given data
i = 2.0000;
delta_t = 10.0000;
delta_w = 2300.0000
//
// Calculations Voltage Drops
delta_q = i * delta_t;
v = delta_w/delta_q;
//
disp("Example 1-4 Solution : ");
printf(" \ v = Voltage Drop Acroos The Bulb = %.3f Volt",v)
|
eeeccb6fd028c9a5a9e13b8e538a247b316f47f9 | c565d26060d56f516d954d4b378b8699c31a71ef | /mpc/mpc_init.sce | 9a4ab9248e4d83e61de3cf3036eda49247d847bc | [] | no_license | rupakrokade/sbhs-manual | 26d6e458c5d6aaba858c3cb2d07ff646d90645ce | 5aad4829d5ba1cdf9cc62d72f794fab2b56dd786 | refs/heads/master | 2021-01-23T06:25:53.904684 | 2015-10-24T11:57:04 | 2015-10-24T11:57:04 | 5,258,478 | 0 | 0 | null | 2012-11-16T11:45:07 | 2012-08-01T11:36:17 | Scilab | UTF-8 | Scilab | false | false | 1,081 | sce | mpc_init.sce | // For scilab 5.1.1 or lower version users,
//use scicos command to open scicos diagrams instead of xcos
global fdfh fdt fncr fncw m err_count y p q xk_old
p = 40; //prediction horizon
q = 4; // control horizon
xk_old = zeros(8,1);
fncr = 'clientread.sce';
fdt = mopen(fncr);
mseek(0);
err_count = 0; //initialising error count for network error
m =1;
exec ("steptest.sci");
exec("mpc_run.sci");
fdfh = mopen('clientwrite.sce');
mseek(0);
b = mgetl(fdfh,1);
a = mgetl(fdt,1);
mclose(fdfh);
if a ~= []
if b~= []
disp("ERROR!EMPTY THE CLIENTREAD AND CLIENTWRITE FILES");
return
else
disp("ERROR!EMPTY THE CLIENTREAD FILE");
return
end
else
if b~= []
disp("ERROR!EMPTY THE CLIENTWRITE FILE");
return
end;
A = [0.1,m,0,251];
fdfh = file('open','clientwrite.sce','unknown');
write(fdfh,A,'(7(e11.5,1x))');
file('close', fdfh);
sleep(1000);
a = mgetl(fdt,1);
mseek(0);
if a~= [] //open xcos only if communication is through
xcos('mpc.xcos');
else
disp("NO NETWORK CONNECTION!");
return
end
|
c1ed66c5068be0086627b3d6c69101df897cea59 | 449d555969bfd7befe906877abab098c6e63a0e8 | /257/CH7/EX7.7/example_7_7.sce | bfb158cc888ad1e90976e5a3880b0dfd3757ed35 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 520 | sce | example_7_7.sce | q=poly([0 0 6 5 1],'s','coeff');
G=1/q //gain FACTOR=k
H=1
y=G*H
disp(y)
syms s
Kp=limit(s*y/s,s,0) //Kp= position error coefficient
Kv=limit(s*G*H,s,0) //Kv= velocity error coefficient
Ka=limit(s^2*G*H,s,0) //Ka= accelaration error coefficient
disp(Ka ,"Ka = ")
disp(Kv ,"Kv = ")
disp(Kp ,"Kp = ")
Ess1=1/(1+Kp)
disp(Ess1, "Ess1 = ")
Ess2=10/(Kv)
disp(Ess2, "Ess2 = ")
Ess3=40/(Ka)
disp(Ess3, "Ess3 = ")
Ess=Ess1+Ess2+Ess3 //Ess=10 given
k=Ess/10
disp(k, "k = ")
|
626d072ffb849807f61a89554bc7f854f79425a7 | 449d555969bfd7befe906877abab098c6e63a0e8 | /608/CH15/EX15.17/15_17.sce | 49d8cb090894d28236ed57df3fc35083f699fa14 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 794 | sce | 15_17.sce | //Problem 15.17: Determine the p.d.’s V1 and V2 for the circuit shown in Figure 15.17 if the frequency of the supply is 5 kHz. Draw the phasor diagram and hence determine the supply voltage V and the circuit phase angle.
//initializing the variables:
R1 = 4; // in ohms
C = 1.273E-6; // in Farads
L = 286E-6; // in Henry
R2 = 8; // in ohms
f = 5000; // in Hz
I = 5; // in amperes
//calculation:
XL = 2*%pi*f*L
phid1 = atan(XL/R1)*180/%pi
V1 = I*((R1^2 + XL^2)^0.5)
Xc = 1/(2*%pi*f*C)
V2 = I*((R2^2 + Xc^2)^0.5)
phid2 = atan(Xc/R2)*180/%pi
Z = ((R1+R2)^2 + (Xc-XL)^2)^0.5
V = I*Z
phid = atan((Xc-XL)/(R1+R2))*180/%pi
printf("\n\n Result \n\n")
printf("\n Voltage V1 = %.2f V and V2 = %.1f V",V1, V2)
printf("\n Voltage supply, V = %.0f V",V)
printf("\n circuit phase angle is %.2f°",phid) |
4f7f74f9daff7e04e3206d01ca7671be10b1ae30 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2150/CH2/EX2.20/ex2_20.sce | 45e0a2d36f273f1413630f487f56ae1d27ae4e3b | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 272 | sce | ex2_20.sce | // Exa 2.20
clc;
clear;
close;
// Given data
V1 = 10;// in V
V2 = 0.7;// in V
V3 = V2;// in V
V = V1-V2-V3;// in V
R1 = 1;// in ohm
R2 = 48;// in ohm
R3 = 1;// in ohm
R = R1+R2+R3;// in ohm
I = V/R;// in A
I = I * 10^3;// in mA
disp(I,"Current in mA is");
|
122b3c8bf2c0d45a478cbce43c7be9049bd17373 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3492/CH7/EX7.2/Ex7_2.sce | 68abb4f36c2aea75976040c16b62a81eceaee591 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 486 | sce | Ex7_2.sce | clc
//Chapter7
//Ex_2
//Given
N=5*10^28 //in m^-3
e=1.6*10^-19 // in coulombs
Z=4
me=9.1*10^-31 //in Kg
epsilon_o=8.85*10^-12//F/m2
epsilon_r=11.9
//part(a)
alpha_e=(3*epsilon_o/N)*((epsilon_r-1)/(epsilon_r+2))
disp(alpha_e,"Electronic polarizability in F/m2")
//part(b)
//let x=E_loc/E
x=(epsilon_r+2)/3
printf("Local field is a factor of %f greater than applied field",x)
//part(c)
wo=sqrt(Z*e^2/(me*alpha_e))
fo=wo/(2*%pi)
disp(fo,"resonant frequency in Hz is")
|
bf2e0703e4a51a2ea57ee756130f46be874b044f | e176c804d3e82d065a9c9635dad92da21c1483a9 | /libs/readpbm.sci | e8e1983785f14d2e427bd8efc8f22e67b42ed9f5 | [
"MIT"
] | permissive | Exia-Aix-2016/ExoLife | 38f7d5e54a1fd26333f19d99a8b63f0d64cc4c4c | a88d4bc3b852f8a85b6c8cc0979ced29fb28b751 | refs/heads/master | 2021-09-07T01:47:04.742247 | 2018-02-15T11:57:47 | 2018-02-15T11:57:47 | 120,471,380 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 443 | sci | readpbm.sci | // reading image PGM RAW (8 bits) (PBM)
// usage: img = readpbm('image.pbm');
function image=readpbm(filename)
[u,err]=mopen(filename,'rb')
if err<>0 then error('Error opening file '+filename), end
if mgetl(u,1)~='P5' error('Unrecognized format'), end
z=mgetl(u,1), while part(z,1)=='#', z=mgetl(u,1), end
n=strtod(z)
z=mgetl(u,1)
n=[n strtod(z) ]
mgetl(u,1)
image=matrix(mget(n(1)*n(2),'uc',u),n)
mclose(u)
endfunction
|
877f103c46b2a1f47447b71bb3328e35f47e9509 | 66106821c3fd692db68c20ab2934f0ce400c0890 | /test/disassembler/subi.instr.tst | 4329ca41b3740c87f0f5e7d603013a9f519af99b | [] | no_license | aurelf/avrora | 491023f63005b5b61e0a0d088b2f07e152f3a154 | c270f2598c4a340981ac4a53e7bd6813e6384546 | refs/heads/master | 2021-01-19T05:39:01.927906 | 2008-01-27T22:03:56 | 2008-01-27T22:03:56 | 4,779,104 | 2 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 2,234 | tst | subi.instr.tst | ; @Harness: disassembler
; @Result: PASS
section .text size=0x00000054 vma=0x00000000 lma=0x00000000 offset=0x00000034 ;2**0
section .data size=0x00000000 vma=0x00000000 lma=0x00000000 offset=0x00000088 ;2**0
start .text:
label 0x00000000 ".text":
0x0: 0x0f 0x57 subi r16, 0x7F ; 127
0x2: 0x1f 0x57 subi r17, 0x7F ; 127
0x4: 0x2f 0x57 subi r18, 0x7F ; 127
0x6: 0x3f 0x57 subi r19, 0x7F ; 127
0x8: 0x4f 0x57 subi r20, 0x7F ; 127
0xa: 0x5f 0x57 subi r21, 0x7F ; 127
0xc: 0x6f 0x57 subi r22, 0x7F ; 127
0xe: 0x7f 0x57 subi r23, 0x7F ; 127
0x10: 0x8f 0x57 subi r24, 0x7F ; 127
0x12: 0x9f 0x57 subi r25, 0x7F ; 127
0x14: 0xaf 0x57 subi r26, 0x7F ; 127
0x16: 0xbf 0x57 subi r27, 0x7F ; 127
0x18: 0xcf 0x57 subi r28, 0x7F ; 127
0x1a: 0xdf 0x57 subi r29, 0x7F ; 127
0x1c: 0xef 0x57 subi r30, 0x7F ; 127
0x1e: 0xff 0x57 subi r31, 0x7F ; 127
0x20: 0x0f 0x5f subi r16, 0xFF ; 255
0x22: 0x00 0x50 subi r16, 0x00 ; 0
0x24: 0x0f 0x57 subi r16, 0x7F ; 127
0x26: 0x0f 0x53 subi r16, 0x3F ; 0x63
0x28: 0x0f 0x51 subi r16, 0x1F ; 0x31
0x2a: 0x0f 0x50 subi r16, 0x0F ; 0x15
0x2c: 0x07 0x50 subi r16, 0x07 ; 7
0x2e: 0x03 0x50 subi r16, 0x03 ; 3
0x30: 0x01 0x50 subi r16, 0x01 ; 1
0x32: 0x00 0x5f subi r16, 0xF0 ; 240
0x34: 0x08 0x57 subi r16, 0x78 ; 120
0x36: 0x0c 0x53 subi r16, 0x3C ; 0x60
0x38: 0x0e 0x51 subi r16, 0x1E ; 0x30
0x3a: 0x0c 0x5c subi r16, 0xCC ; 204
0x3c: 0x06 0x56 subi r16, 0x66 ; 102
0x3e: 0x03 0x53 subi r16, 0x33 ; 0x51
0x40: 0x09 0x51 subi r16, 0x19 ; 0x25
0x42: 0x0c 0x50 subi r16, 0x0C ; 0x12
0x44: 0x06 0x50 subi r16, 0x06 ; 6
0x46: 0x0a 0x5a subi r16, 0xAA ; 170
0x48: 0x05 0x55 subi r16, 0x55 ; 0x85
0x4a: 0x0a 0x52 subi r16, 0x2A ; 0x42
0x4c: 0x05 0x51 subi r16, 0x15 ; 0x21
0x4e: 0x0a 0x50 subi r16, 0x0A ; 0x10
0x50: 0x05 0x50 subi r16, 0x05 ; 5
0x52: 0x02 0x50 subi r16, 0x02 ; 2
start .data:
|
b94905832e9180e0736d1ec28dca5fd2dd940556 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3763/CH10/EX10.10/Ex10_10.sce | e81356d3ec35e9ef32b81225b9fc66526ee9e868 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 348 | sce | Ex10_10.sce | clear
//
//
//
//Variable declaration
a=50
n2=1.5 //refractive index of cladding
n1=1.53 //refractive index of core
lamda0=1 //wavelength(micro m)
//Calculation
V_number=(2*%pi*a*sqrt(n1**2-n2**2)/lamda0) //V number
n=V_number**2/2 //maximum number of modes
//Result
printf("\n maximum number of modes is %0.3f ",n)
|
793d01f63fd551d2eec227d6835760c9b68a1bdd | caafd05eb866a2bd249681ceeb5734ca2df71833 | /TP7/construct.sci | c5a58019da64baabba03c90f0d0ce6f31e888901 | [
"MIT"
] | permissive | mmewen/MT09-numerical-analysis | 5fb1f251e86f9d43d7eeb23ce7bcc91d6ca3fa8b | cde3871aa885811bc31166e778b2a4f052e74b64 | refs/heads/master | 2021-01-11T22:11:18.631204 | 2017-01-14T10:59:23 | 2017-01-14T10:59:23 | 78,934,966 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 455 | sci | construct.sci | function [A] = construct (t, tau)
exec("place.sci", -1);
m = length(tau);
n = length(t);
A = zeros(m, n);
for i = 1 : m
j = place(t, tau(i)); // localise t dans la suite de pts T
// disp(i);
// disp(m);
// disp(j);
// disp(n);
// disp("--");
A(i, j) = (tau(i) - t(j+1)) / (t(j) - t(j+1));
A(i, j+1) = (tau(i) - t(j)) / (t(j+1) - t(j));
end
endfunction
|
84290327ffc8411f7174d0e923bbf3a9f699f606 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2084/CH13/EX13.4/13_4.sce | 34e1719251eb4be27220db4c417e09d9a85b3830 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 635 | sce | 13_4.sce | //developed in windows XP operating system 32bit
//platform Scilab 5.4.1
clc;clear;
//example 13.4
//calculation of the difference in the pressures at A and B point
//given data
A1=1*10^-4//area(in m^2) at point A of the tube
A2=20*10^-6//area(in m^2) at point B of the tube
v1=10*10^-2//speed(in m/s) of the ingoing liquid
rho=1200//density of the liquid(in kg/m^3)
//calculation
v2=A1*v1/A2//equation of continuity
//by Bernoulli equtation.....P1 + (rho*g*h1) + (rho*v1^2/2) = P2 + (rho*g*h2) + (rho*v2^2/2)
deltaP=(1/2)*rho*(v2^2-v1^2)
printf('the difference in the pressures at A and B point is %d Pa',deltaP)
|
22c61dd5088d6c037556b5f75e4731ef68c8d598 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2048/CH3/EX3.2/conv2.sce | f3945a6d3923667034e63c02bb7bb41634504cde | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 90 | sce | conv2.sce | // Convolution of two sequences
// 3.2
h = [1 2 3];
u = [4 5 6];
y = convol(u,h)
|
8c14c9290b33513e413acfcf3bfefe3998b7ff25 | a62e0da056102916ac0fe63d8475e3c4114f86b1 | /set4/s_Digital_Communications_S._Sharma_1631.zip/Digital_Communications_S._Sharma_1631/CH9/EX9.12/Ex9_12.sce | 4b5fae1052fc8f19f9c70f2ed798782a6ea59faf | [] | no_license | hohiroki/Scilab_TBC | cb11e171e47a6cf15dad6594726c14443b23d512 | 98e421ab71b2e8be0c70d67cca3ecb53eeef1df6 | refs/heads/master | 2021-01-18T02:07:29.200029 | 2016-04-29T07:01:39 | 2016-04-29T07:01:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 313 | sce | Ex9_12.sce | errcatch(-1,"stop");mode(2);//Caption: rate of information
//Example 9.12
//page no 401
//Find Average rate of information
;
;
m=16;
pxi=1/16;
elements=2*10^6;
n=32
HX=0;
for(i=1:16)
HX=HX+(-(pxi*log2(pxi)));
end
r=elements*n;
R=r*HX
printf("Average rate of information\n \n \t R = %d Mbs",R/10^6);
exit();
|
3ea89267b098c972a064b29602692c5ddde5e528 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1427/CH19/EX19.17/19_17.sce | 41c301fd9bbaf5a3eeb8bbe0138f15f4e3940fa0 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 252 | sce | 19_17.sce | //ques-19.17
//Calculating mass of a particle
clc
dx=9.54*10^-10;//uncertainity in position (in m)
dv=5.5*10^-20;//uncertainity in velocity (in m/s)
h=6.6*10^-34;//(in Js)
m=h/(4*%pi*dx*dv);
printf("The mass of the particle is %d mg.",m*10^6);
|
f63a6631df9dd7968f28dab58f538d594b14f20a | 449d555969bfd7befe906877abab098c6e63a0e8 | /998/CH29/EX29.52/Ex52.sce | a12fd28fff42f8bcd4abc722442c7dbb5e8c45ab | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 287 | sce | Ex52.sce | //Ex:52
clc;
clear;
close;
e=0.5;//orbital eccentricity
a_e=14000;//dis b/w center of ellipse to the center of earth in km
a=a_e/e;//semi major axis in km
r_a=a*(1+e);//apogee in km
r_p=a*(1-e);//perigee in km
printf("The apogee=%d km",r_a);
printf("\n The perigee=%d km",r_p); |
1ac338d3b2c9d30772cc00bd567236b7b8d6835b | 449d555969bfd7befe906877abab098c6e63a0e8 | /536/CH4/EX4.2/Example_4_2.sce | 5b57ce4dcceb6aafc1f58077bede59529e7fadd1 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 405 | sce | Example_4_2.sce | clc;
printf("\n Example 4.2\n");
l=30;//Length of the tube
d=150e-3;//Diameter of the tube
P1=0.4e3;//Initial Pressure
P2=0.13e3;//final Pressure
//X=e/d, Relative roughness
//Y=R/(rho*u^2) = 0.004
X=0.003;
Y=0.005;
v1=21.15e1;
G_A=poly([0],'G_A');
f=(G_A^2*log(P1/P2))+((P2^2-P1^2)/(2*P1*v1))+(4*(Y*l/d)*G_A^2);
A=roots(f);
printf("\n The approximate flow rate = %.2f kg/m^2 s",A(1)); |
6194d377236bd7156c3e3843d781c6ad04c049ca | 449d555969bfd7befe906877abab098c6e63a0e8 | /3041/CH3/EX3.15/Ex3_15.sce | e536272f2e50dcba0195de7258172c61e74efb2b | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 408 | sce | Ex3_15.sce | //Variable declaration
Vcc=6 //supply voltage(V)
R=1.2 //resistance(k ohms)
Vbe=0.7 //base to emitter voltage(V)
beeta=100. //current gain
//Calculations
//Part a
Ir=(Vcc-Vbe)/R //current(mA)
I=(beeta/(beeta+3))*Ir //current(mA)as transistors are identiical,I=Ie
//Result
printf ("load current I is %.2f mA ",I)
|
9dcf7a82364f1969d8a3a50b961a049a67d4d7c2 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3710/CH8/EX8.6/Ex8_6.sce | 608b297f538b2b5d96aed5dd3458318d84d36167 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 415 | sce | Ex8_6.sce | //Example 8.6, Page Number 380
//Intermodal Dispersion in step index fibers
clc;
n1=1.48//refractive index
n2=1.46//refractive index
L=1*(10**3) //Length of Fiber in kilometer
c=3*(10**8) //Speed of Light in meters per second
//Using equation 8.24
td=((L*n1)/(c*n2))*(n1-n2) //t is the time difference due tp intermodal dispersion
disp(td,"The Time difference due to Intermodal dispersion in s is:")
|
bad06692e1b85c7e3e52348a8400f5ab8a335a97 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1634/CH1/EX1.30/example1_30.sce | 3705698b454411c1de5e3af7b8cb8179d0ba925b | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 551 | sce | example1_30.sce |
//exapple 1.30
clc; funcprot(0);
// Initialization of Variable
longP=85+20/60;//longitude of place
GST=18+30/60;//standard time
gst=6+32/60+12/3600;//GST at GMN
dot=longP/15;//difference in time
GMT=GST-dot-12;
i=GMT*9.8565/3600;//error
GMT=GMT+i;//SI time
LST=GMT+dot+gst;//LST at LMT
disp("local standard time in past midnight observed:");
a=modulo(LST*3600,60);
printf("seconds %.2f",a);
b=modulo(LST*3600-a,3600)/60;
printf(" minutes %i",b);
c=(LST*3600-b*60-a)/3600;
if c>24 then
c=c-24;
end
printf(" hours %i",c);
|
faa3ff5b186f6e31b7e1068e8702a798a2f4b8d5 | 449d555969bfd7befe906877abab098c6e63a0e8 | /551/CH10/EX10.5/5.sce | 4c727bf4206e98cd564041067c2df7957dc583e6 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 933 | sce | 5.sce | clc
//For the air at 35 0C DBT and 60% R.H.
p_vs=0.0563; //bar; Corresponding to 35 0C from stem tables
phi=0.6;
p_t=1.0132; //bar
cp=1.005;
t_db=35; //0C
h_g=2565.5; //kJ/kg
m1=1; //kg
m2=2; //kg
m=m1+m2;
p_v=phi*p_vs;
W1=0.622*p_v/(p_t-p_v);
//Corresponding to 0.0388 bar, from steam tables
t_dp=26+(27-26)*(0.0338-0.0336)/(0.0356-0.0336);
h_vapour=h_g + 1.88*(t_db - t_dp);
h1=cp*t_db+W1*h_vapour;
//For the air at 20°C DBT and 13°C dew point temperature :
p_v=0.0150; //bar
W2=0.622*p_v/(p_t-p_v);
t_db=20; //0C
t_dp=13;
h_g=2538.1; //kJ/kg
h_vapour=h_g + 1.88*(t_db - t_dp);
h2=cp*t_db+W2*h_vapour;
//let enthalpy per kg of moist air be h
h=((m1*h1/(1+W1)) + (m2*h2/(1+W2)))/m;
//Let Mass of vapour/kg of moist air be M
M=(m1*W1/(1+W1) + m2*W2/(1+W2))/m;
//Let specific humidity be denoted by SH
SH=M/(1-M);
disp("Specific humidity =")
disp(SH)
disp("kg/kg of dry air") |
9dd0b3ead48eba65bcd46ce78d542cfb63e3a6ba | 449d555969bfd7befe906877abab098c6e63a0e8 | /527/CH9/EX9.3/9_4exam.sce | fc9515672dba4dc70e01a3c89f54918d64a6cd76 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,558 | sce | 9_4exam.sce | //Engineering and Chemical Thermodynamics
//Example 9.4
//Page no :447
clear ; clc ;
//Given
del_gf_0_CH2O = -110.0 ; //[kJ/mol],From Appendix A.2 & A.3
del_gf_0_H2 = 0 ; //[kJ/mol],From Appendix A.2 & A.3
del_gf_0_CH4O = -162.0 ; //[kJ/mol],From Appendix A.2 & A.3
del_hf_0_CH2O = -116.0 ; //[kJ/mol],From Appendix A.2 & A.3
del_hf_0_H2 = 0 ; //[kJ/mol],From Appendix A.2 & A.3
del_hf_0_CH4O = -200.7 ; //[kJ/mol],From Appendix A.2 & A.3n_CH20 = 1 ;
n_H2 = 1 ;
n_CH4O = 1 ;
n_CH2O = 1 ;
T1 = 298 ;//[K]
T2 = 873 ; // [K]
R = 8.314 ; //[J/molK]
Del_A = 3.302 ;
Del_B = -4.776 * 10^-3 ;
Del_C = 1.57 * 10^-6 ;
Del_D = 0.083 * 10^5 ;
//Solution (a)
del_g_rxn_298 = n_CH2O * del_gf_0_CH2O + n_H2 * del_gf_0_H2 - n_CH4O * del_gf_0_CH4O ;
K_298 = exp( - del_g_rxn_298 * 10^3 / (R * T1)) ;
disp(" Example: 9.4 Page no : 447") ;
printf("\n (a) K_298 = %g \n\n As the equilibrium constant is very small very little amount of formaldehyde will be formed .\n",K_298) ;
//Solution(b)
del_h_rxn_298 = (n_CH2O * del_hf_0_CH2O + n_H2 * del_hf_0_H2 - n_CH4O * del_hf_0_CH4O) * 10^3 ;//[J/mol]
K_873 = K_298 * exp((-del_h_rxn_298 * (1/T2 - 1/T1)) / R) ;
printf("\n (b)\n (i) K_873 = %g \n\n",K_873) ;
//Solution(c)
x = ( -del_h_rxn_298 / R + Del_A * T1 + Del_B / 2 * T1^2 + Del_C /3 * T1^3 - Del_D / T1 ) *(1/T2 - 1/T1) + Del_A * log(T2 / T1) + Del_B / 2 * (T2 -T1) + Del_C / 6 * (T2^2 -T1^2) + Del_D / 2 * (1/(T2^2) -1/(T1^2)) ;
K_873 = K_298 * exp(x) ;
printf("\n (ii) K_873 = %g \n\n",K_873) ; |
da662c7780c22705071925954d6efeb905bc131c | 717ddeb7e700373742c617a95e25a2376565112c | /278/CH23/EX23.23/ex_23_23.sce | 440d976d74f9a3e01ac9d8e0a10cbbead59731c6 | [] | no_license | appucrossroads/Scilab-TBC-Uploads | b7ce9a8665d6253926fa8cc0989cda3c0db8e63d | 1d1c6f68fe7afb15ea12fd38492ec171491f8ce7 | refs/heads/master | 2021-01-22T04:15:15.512674 | 2017-09-19T11:51:56 | 2017-09-19T11:51:56 | 92,444,732 | 0 | 0 | null | 2017-05-25T21:09:20 | 2017-05-25T21:09:19 | null | UTF-8 | Scilab | false | false | 491 | sce | ex_23_23.sce | //find
clc
//solution
//given
tL=140000//N
ns=4
n=10
L=500//mm
dx=80//mm
E=200000//N/mm^2
f=600//N/mm^2
W=tL/8//N
//let t be thickness and b be th width
//f=6WL/(nbt^2)
//nbt^2=87.5*1000...eq1
//dx=6WL^3/(nEbt^3)
//nbt^3=0.82*10^6....eq2
//from eq1 and eq2 ,we get
t=10//mm
b1=87.5*1000/(n*t^2)
printf("width using bending stress is,%f mm\n",b1)
b2=0.82*10^6/(n*t^3)
printf("width using deflection is,%f mm\n",b2)'
printf("taking larger value 87.5 mm into account...") |
86d77b31de1930976d5e1c45c6d29fe0fd6dd122 | cb4516492965c75d14c9d499c387d3cd0b883bc4 | /X3/Section 7 -Tools Environmental Effects/7.1 Joachim Diepstraten, Mike Eißele/arithmetic_sparly.tst | b153790e3a6e48e743eaf1c04cff58b7576865b7 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | nedma/ShaderX | 48367dfc1153e4e6ad6bb5c205777285b06376c5 | 0503dd6ae16f3d288f2e27b0f93ebdfbaf1f4436 | refs/heads/master | 2020-04-08T01:51:11.173038 | 2018-11-24T08:37:42 | 2018-11-24T08:37:42 | 158,911,553 | 0 | 3 | null | null | null | null | UTF-8 | Scilab | false | false | 245 | tst | arithmetic_sparly.tst | \shader\cmp.psh
\shader\cmp_4x.psh
\shader\cmp_pp.psh
\shader\frc.psh
\shader\frc_4x.psh
\shader\lrp.psh
\shader\lrp_4x.psh
\shader\rcp.psh
\shader\rcp_pp.psh
\shader\rcp_4x.psh
\shader\rsq.psh
\shader\rsq_pp.psh
\shader\rsq_4x.psh
|
1d868d164e6b8ff2936e476d2c80e93d295c9721 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3428/CH2/EX1.2.13/Ex1_2_13.sce | e3b53deb03e431b783b2e87f2707bb97dd42256d | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 227 | sce | Ex1_2_13.sce | //Section-1,Example-3,Page no.-AC.182
//To calculate the percentage of sulphur in the given coal sample.
clc;
W_BaSO4=0.01
W_coal=0.1
P_S=(W_BaSO4*32*100)/(W_coal*233)
disp(P_S,'Percentage of sulphur in the given coal sample')
|
009e83a1a404dc0f9e43b97b9673f9ee0fd861a2 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1529/CH16/EX16.11/16_11.sce | 94f677feb968b26e8fb6a6dd74da0a2367eb9d24 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 448 | sce | 16_11.sce | //Chapter 16, Problem 11, Fig 16.13(a)
clc;
f = 50; // in ohm
V = 240; // in Volts
pf = 0.6 // power factor
Im = 50; // in amperes
//calculation:
phi = acos(pf)
phid = phi*180/%pi
Ic = Im*sin(phi)
I = Im*cos(phi)
printf("\n\n (a)The capacitor current Ic must be %.0f A for the power factor to be unity. ",Ic)
printf("\n\n (b)Supply current I = %.0f A ",I)
|
06494a4a048f6fddf2d498da217aa0f397eabebb | 449d555969bfd7befe906877abab098c6e63a0e8 | /659/CH12/EX12.6/exm12_6.sce | 17cf059fc435ddd1454ba7701c31b6b2603b4c6e | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,554 | sce | exm12_6.sce | // Example 12.6
//Write a program to append additional items to the file INVENTORY
//created in Example 12.3 and print the total contents of the file.
funcprot(0);
warning('off');
function[item] =append(product,fp)
printf("Item name:\n");
product.name=scanf("%s");
printf("Item number:.\n");
product.number=scanf("%d");
printf("Item price\n");
product.price=scanf("%f");
printf("Quantity:\n");
product.quantity=scanf("%d");
//Write data in the file
mfprintf(fp,'%s %d %.2f %d\n',product.name,product.number,product.price,product.quantity);
item=product;
endfunction
//Creating structure
item=struct('name','0','number','0','price','0','quantity','0');
//Read file name that is 'INVENTORY'
disp("Type file name");
filename=scanf("%s");
//Open file in append mode,fp is file descriptor
fp=mopen(filename,'a+');
b=0;response=-1;
//Read data
while(response==1|b==0)
item=append(item,fp); //calling append() function
printf("Item %s appended.\n",item.name);
printf("Do you want to add another item\(1 for YES/0 for NO)?");
response=scanf("%d");
b=1;
end
n=mtell(fp); //position of last character
mclose(fp);
//Opening file in the read mode
fp=mopen(filename,'r');
while (mtell(fp) < n-2)
//read data from terminal
[g,item.name,item.number,item.price,item.quantity]=mfscanf(fp,"%s %d %f %d");
//Print Data to screen
printf('%s %7d %8.2f %8d\n',item.name,item.number,item.price,item.quantity);
end
mclose(fp);
|
499e86251f460b07d71220226d52b0a60df12e1b | 8217f7986187902617ad1bf89cb789618a90dd0a | /browsable_source/2.5/Unix-Windows/scilab-2.5/macros/percent/%r_n_s.sci | 03ea45042fa9a6d407f1848df927f4a7f2b20acf | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | clg55/Scilab-Workbench | 4ebc01d2daea5026ad07fbfc53e16d4b29179502 | 9f8fd29c7f2a98100fa9aed8b58f6768d24a1875 | refs/heads/master | 2023-05-31T04:06:22.931111 | 2022-09-13T14:41:51 | 2022-09-13T14:41:51 | 258,270,193 | 0 | 1 | null | null | null | null | UTF-8 | Scilab | false | false | 183 | sci | %r_n_s.sci | function [r]=%r_n_s(l1,l2)
// l1<>l2 rational<>constant
// Copyright INRIA
r=degree(l1('num'))==0°ree(l1('den'))==0
if r then r=coeff(l1('num'))./coeff(l1('den'))==l2,end
r=~r
|
7ffec1a0c25055001a96b832f13f53a717212e0e | 1db0a7f58e484c067efa384b541cecee64d190ab | /macros/poly2rc.sci | cfdbec63369cb59c683bd5d0753c438b07fad2ab | [] | no_license | sonusharma55/Signal-Toolbox | 3eff678d177633ee8aadca7fb9782b8bd7c2f1ce | 89bfeffefc89137fe3c266d3a3e746a749bbc1e9 | refs/heads/master | 2020-03-22T21:37:22.593805 | 2018-07-12T12:35:54 | 2018-07-12T12:35:54 | 140,701,211 | 2 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,862 | sci | poly2rc.sci | function [kr, R0]=poly2rc(a, efinal)
//poly2rc function convert prediction polynomial to reflection coefficients.
// Calling Sequence
// kr = poly2rc(a)
// [kr, R0] = rc2poly(a, efinal)
// Parameters
// a: prediction polynomial.
// efinal: final prediction error.
// kr: Return refelection coefficient.
// R0: Return the zero lag autocorrelation, R0.
// Examples
//X = [7 6 5 8 3 6]
// [kr, R0] = poly2rc(X)
//
// See also
//
// Author
// Jitendra Singh
// modified to handle empty vector as i/p by Debdeep Dey
if or(type(a)==10) then
error ('Input arguments must be double.')
end
if (size(a,1) > 1) & (size(a,2) > 1)
error ('The prediction polynomial must be stored in a vector.')
end
if argn(2)==1 | isempty(efinal) then
efinal=0;
end
if length(a)<=1 then
kr= [];
R0=efinal;
end
if a(1) ==0 then
error ('Leading coefficient cannot be zero.')
end
a=a(:)./a(1);
n=length(a)-1;
e=zeros(n,1);
if(n>=1) then
e(n)=efinal;
kr(n)=a($);
a=a';
end
if(n>=1) then
for j= (n-1):-1:1
ee=a($)
a = (a-kr(j+1)*flipdim(a,2,1))/(1-kr(j+1)^2);
a=a(1:$-1)
kr(j)=a($);
econj=conj(ee)
econj=econj'
e(j) = e(j+1)/(1.-(econj.*ee));
end
R0 = e(1)./(1-abs(kr(1))^2);
else
R0=efinal;
end
endfunction
|
6d12c5e9a498f42553ec0bca01bfb39cffd84d58 | 637fcd60a4e2a98ebbeaaa9551554a13e1ebfdba | /quad/ctrl/paparazzi/sw/airborne/firmwares/vor/sci_gen_c_filters.sce | d25cf76236de45a5c23af2e894f388082acf9624 | [] | no_license | zoomx/lxyppc-tetrix | b7079c07aee9b85a34207245f526e1613fdb0498 | 884027f37594f9f006f88d634c4392a60c482491 | refs/heads/master | 2021-01-10T21:04:54.219013 | 2015-05-10T08:45:33 | 2015-05-10T08:45:33 | 35,362,463 | 12 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,523 | sce | sci_gen_c_filters.sce | //
//
// Generates C file and corresponding headers for filters used in
// C implementation
//
clear();
exec('sci_vor_filters.sci');
[filters] = vor_get_filters();
filter_name = [ "BP_VAR"
"BP_REF"
"LP_DECIM"
"LP_VAR"
"LP_REF"
"LP_FM" ];
function print_poly(fid, name, p, header)
c_p = coeff(p);
l_p = length(c_p);
l_ps = name+'_LEN';
if (header)
fprintf(fid, '#define %s %i\n', l_ps, l_p);
fprintf(fid, 'extern FLOAT_T %s[];\n', name);
else
fprintf(fid, 'FLOAT_T %s[%s]={\n', name, l_ps);
for i=l_p:-1:1
fprintf(fid,'%10.40f,\n',c_p(i));
end
fprintf(fid,'};\n');
end
endfunction
//
// header
//
filename = 'vor_filter_params';
fid = mopen(filename+'.h', 'w');
fprintf(fid,'#ifndef VOR_LF_FILTER_PARAMS_H\n');
fprintf(fid,'#define VOR_LF_FILTER_PARAMS_H\n\n');
for i=1:FILTER_NB
f = filters(i);
fn = filter_name(i);
fprintf(fid,'/* %s filter */\n', fn);
print_poly(fid, fn+"_NUM", f.tf.num, 1);
print_poly(fid, fn+"_DEN", f.tf.den, 1);
fprintf(fid,'\n');
end
fprintf(fid,'#endif /* VOR_LF_FILTER_PARAMS_H */\n');
mclose(fid);
//
// C
//
fid = mopen(filename+'.c', 'w');
fprintf(fid,'#include ""%s.h""\n\n', filename);
for i=1:FILTER_NB
f = filters(i);
fn = filter_name(i);
print_poly(fid, fn+"_NUM", f.tf.num, 0);
print_poly(fid, fn+"_DEN", f.tf.den, 0);
fprintf(fid,'\n');
end
mclose(fid);
|
71da0e6856c4cdcd99fc145178acab3995139a20 | 449d555969bfd7befe906877abab098c6e63a0e8 | /617/CH5/EX5.2/Example5_2.sci | 94959c09a5c6a7f3e0bfc96cc55a2f0568eb8fb2 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,139 | sci | Example5_2.sci | clc();
clear;
// to find tempearture difference between inner and outer surface
r=1/4; // radius in inches
to=300; // outer surface temperature of cylinder in degF
q0=10; // i2r heat loss in Btu-in^2/hr
k=10; // thermal conductivity of the material in Btu/hr-ft-degF
tc=to+(q0*r*r)*12 /(4*k); // temperature at center
delt=tc-to;
printf("The temperature diference between center and outer surface is %.2f degF",delt);
// to find heat flow from outer surface
// Total energy within the cylinder must be transferred to as heat to outer surface
v=%pi*r^2; // Volume of heatinf element in in^3
q1=q0*v; // heat flow to outer surface in Btu/sec
tr=-q1*r/(2*k); // derivative of temperature wrt radius
q=q1*12; // Heat flow at the outer surfae in Btu/hr-ft
printf("\n Heat transfer per unit length at the outer surface is %.1f Btu/hr",q);
|
4bcfb4c62dd1abd786cb817c280e954273740a66 | 449d555969bfd7befe906877abab098c6e63a0e8 | /992/CH3/EX3.3/Ex3_3.sce | 3c0d6618056a35ae0c41a736f2ad601c0040e3bd | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 261 | sce | Ex3_3.sce |
//Exa:3.3
clc;
clear;
close;
//Given:
Bw=12;//in KHz
Mod_mn=300;
Mod_mx=3000;
dev=6;//in KHz
m1={(Bw-dev)*1000}/Mod_mn;
m2={(Bw-dev)*1000}/Mod_mx;
printf("\n 1)modulation indexat 300Hz = %f ",m1);
printf("\n 2)modulation indexat 3000Hz = %f ",m2); |
27df9d67dff8a34e13e6e841f1e203344b98fd0a | 449d555969bfd7befe906877abab098c6e63a0e8 | /2015/CH9/EX9.3/9_3.sce | 9cf6e611641f2c3b537f8cc617d34bc032e4147a | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 698 | sce | 9_3.sce | clc
//initialisation of variables
p2=3.24 //pressure in bar
p1=1 //pressure in bar
v1=16 //volume in m*m*m
n=1.35
rp=3.24 //pressure
r=10.5
t1=294 //temparature in k
t2=294 //temparature in k
cp=1.005 //kj/kg
rx=0.287
//CALCULATIONS
w1=(2*n/(n-1))*p1*v1*100*0.35630 //(3.24)^0.2592-1
w2=(n/(n-1))*p1*v1*100*0.8396 //(10.5)^0.2592-1
pr1=w1/60
pr2=w2/60
tb=t1*(r)^(n-1/n)
t3=t2*(rp)^((n-1)/n)
m=(p1*v1*100)/(rx*t1)
hr=m*cp*(t3-t2)
ma=hr/(4.18*25)
//RESULTS
printf('minimum power required are %2fkw and %2fkw',pr1,pr2)
printf('\nmass of air compressed is %2fkg/min',m)
printf('\nheat rejected by air compressor is %2fkj/min',hr)
printf('\nmass of water is %2fkg/min',ma)
|
bc88b13b031af013aaaacd28b28d87ec57c2f760 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2966/CH1/EX1.6.10/1_6_10.sce | 11a1fc2ebd7542d618029489514314f61560678d | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 791 | sce | 1_6_10.sce | //water//
//page 1.10 example 6//
clc
W1=14.6;//Mg(HCO3)2 in water in mg/L//
W2=8.1;//Ca(HCO3)2 in water in mg/L//
W3=29.6;//Mg(NO3)2 in water in mg/L//
W4=19;//MgCl2 in water in mg/L//
W5=24;//MgSO4 in water in mg/L//
M1=100/146;//multiplication factor of Mg(HCO3)2//
M2=100/162;//multiplication factor of Ca(HCO3)2//
M3=100/148;//multiplication factor of Mg(NO3)2//
M4=100/95;//multiplication factor of MgCl2//
M5=100/120;//multiplication factor of MgSO4//
P1=W1*M1;//Mg(HCO3)2 in terms of CaCO3//
P2=W2*M2;//Ca(HCO3)2 in terms of CaCO3//
P3=W3*M3;//Mg(NO3)2 in terms of CaCO3//
P4=W4*M4;//MgCl2 in terms of CaCO3//
P5=W5*M5;//MgSO4 in terms of CaCO3//
T=P1+P2;
printf("\nTemporary hardness is %.0f ppm",T);
P=P3+P4+P5;
printf("\nPermanant hardness is %.0f ppm",P); |
1f1f0d862924a9c8c9d954e2a1cf09e2c401d3d3 | 449d555969bfd7befe906877abab098c6e63a0e8 | /887/CH3/EX3.2/3_2.sce | 91f1a7b233b4a343e54068311758433a0f88c890 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 542 | sce | 3_2.sce | clc
//ex3.2
C=0.1*10^-6;
//symbolic integration cannot be done in scilab
t=[0:0.001*10^-3:3*%pi*10^-4];
i=0.5*sin((10^4)*t);
//on integrating 'i' w.r.t t
q=0.5*10^-4*(1-cos(10^4*t));
C=10^-7;
V=q/C;
subplot(221)
plot(t,q*10^6)
xtitle('charge vs time','time in seconds','charge in Mc') //Mc=micro coulombs(10^-6)
subplot(222)
plot(t,i)
xtitle('current vs time','time in seconds','current in amperes') //Mc=micro coulombs(10^-6)
subplot(223)
xtitle('voltage vs time','time in seconds','voltage in volts')
plot(t,V)
|
914ffb6302d71769947198082f83a6cc3e367352 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2708/CH22/EX22.3/ex_22_3.sce | be4bc92e803eb72783389f3f0f56bec908899fb5 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 343 | sce | ex_22_3.sce | //Example 22.3 // critical current density
clc;
clear;
//given data :
d=1D-3;//diameter of wire in m
Ho=6.5D4;//critical field at temperature at 0k
Tc=7.18;// critical temperature in kelvin
T=4.2;//temperature in kelvin
Hc=Ho*(1-(T/Tc)^2);//critical field at T kelvin
Jc=4*Hc/d;//formula
disp(Jc,"critical current density in A/m2")
|
bea620e4b35a2388ee35fe29974a33179423a764 | 449d555969bfd7befe906877abab098c6e63a0e8 | /10/CH10/EX2/cha10_2.sce | 2bd67fa6823c9ea3b0868d9532eea0a0d1e03b45 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 152 | sce | cha10_2.sce | Vp=120;Angle=60;
t0=%pi/2
t1=t0:0.01:(210/360*2*%pi);
integrate('2^.5*120*sin(t)','t',t0,t1)
Vo=((3*sqrt(6))/(2*%pi))*120*cos(%pi*Angle/180) |
7f1279af38b699c0081f38a4ec3545e55aeec7e4 | 449d555969bfd7befe906877abab098c6e63a0e8 | /876/CH5/EX5.8/Ex5_8.sce | 58314059744669a040e53a09d242f6a4b374fd55 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 630 | sce | Ex5_8.sce | //caption:Find the value of multiplier resistance for the range(a)0-10V(b)0-50V(c)0-100V(d)0-200V
//Ex5.8
clc
clear
close
V1=10//maximum voltage range(in V)
V2=50//maximum voltage range(in V)
V3=100//maximum voltage range(in V)
V4=200//maximum voltage range(in V)
I=0.002//deflection current(in A)
R=100//internal resistance(in ohm)
Rt1=V1/I
R1=Rt1-R
disp(R1,'(a)multiplier resistance(in ohm)=')
Rt2=V2/I
R2=Rt2-(R1+R)
disp(R2,'(b)multiplier resistance(in ohm)=')
Rt3=V3/I
R3=Rt3-(R2+R1+R)
disp(R3,'(c)multiplier resistance(in ohm)=')
Rt4=V4/I
R4=Rt4-(R1+R2+R3+R)
disp(R4,'(d)multiplier resistance(in ohm)=') |
0fa967178c361c76a9403b93cc07d5139c56bce4 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2858/CH7/EX7.2/Ex7_2.sce | 16251be18d2cb73a634e10d83398638e0b9fb0a3 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 601 | sce | Ex7_2.sce | //example 7.2
clc; funcprot(0);
c=14.36;
Gamma=17.4;
H=6;
phi=26*%pi/180;
Ka=(tan(%pi/4-phi/2))^2;
sigma0=Gamma*H*Ka-2*c*sqrt(Ka);
Pa=1/2*Gamma*H^2*Ka-2*c*H*sqrt(Ka);
disp(Pa,"active force before which tensile crack appeared in kN/m");
zbar=(244.32-323.1)/14.46;
disp(zbar,"the line of action on which net force is acting in m");
zc=2*c/Gamma/sqrt(Ka);
disp(zc,"distance where tensile crack appeared in m");
Pa=1/2*(H-zc)*(Gamma*H*Ka-2*c*sqrt(Ka));
disp(Pa,"Active force in tensile crack in kN/m");
zbar=(H-zc)/3;
disp(zbar,"the line of action on which net force is acting in m");
|
605cbf92fc751add620ca2d99405971de9cccd60 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3760/CH1/EX1.52/Ex1_52.sce | e8cc26cc34ecba71c4a1af02ee739f447795cfab | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,146 | sce | Ex1_52.sce | clc;
// two transformers are connected in parallel and has following data
P1=100; // rated KVA of transformer 1
E11=6600; // rated primary voltage for transformer 1
E21=230; // rated secondary voltage for transformer 1
z1=1.5+4*%i // percentage leakage impedance for transformer 1
P2=200; // rated KVA of transformer 2
E12=6600; // rated primary voltage for transformer 2
E22=220; // rated secondary voltage for transformer 2
z2=1+5*%i // percentage leakage impedance for transformer 2
i1=(P1*1000)/E21; // full load current for transformer 1
ze1=(z1/100)*(E21^2/(P1*1000)); // leakage impedance for transformer 1 in ohm
i2=(P2*1000)/E22; // full load current for transformer 2
ze2=(z2/100)*(E22^2/(P2*1000)); // leakage impedance for transformer 2 in ohm
io=(E21-E22)/abs(ze1+ze2); // circulating current at no load
printf('No load circulating current is %f A\n',real(io));
poh=abs(io)^2*(real(ze1)+real(ze2));
printf(' Ohmic losses due to circulting current is %f W\n',poh);
vd=abs(io)*abs(ze1); // voltage drop in leakage impedance
vt=E21-vd; // secondary terminal voltage
printf('secondary terminal voltage is %f v',vt);
|
b4730669570cf442f21f192aa19bbef51022f5a8 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3311/CH2/EX2.4/Ex2_4.sce | d68ebf75b4de3d1c18be5da5057e6126d35ac081 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 799 | sce | Ex2_4.sce | // chapter 2
// example 2.4
// Find the value of series resistor and average power
// page-31
clear;
clc;
// given
// Vg=1.5+8*Ig; // relation between Vg and Ig
Vgs=12; // in V
t=50; // in us
D=0.2; // duty cucle
P=5; // in W
// calculate
// since Vgs=Ig*Rg+Vg=Ig*Rg+1.5+8*Ig or
// Vgs=(Rg+8)*Ig+1.5, (i)
// since P=Vg*Ig and therefore
// P=(1.5+8*Ig)*Ig ,
// P=1.5*Ig+8*Ig^2.
// This is quadratic equation and can be written as
// 8*Ig^2+1.5*Ig-P=0 solving it
Ig1=(-1.5+sqrt(1.5^2-(4*8*(-P))))/(2*8);
Ig2=(-1.5-sqrt(1.5^2-(4*8*(-P))))/(2*8);
if Ig1>0 then
Ig=Ig1
else
Ig=Ig2
end
Rg=((Vgs-1.5)/Ig)-8; // calculation of series resistance
Pavg=P*D; // calculation of average power
printf("\nThe series resistance is \t Rg=%.f ohm",Rg);
printf("\nThe average power is \t\t Pavg=%.f W",Pavg); |
ac19f5036221bdd05464c9e4fc9146569be0e660 | 449d555969bfd7befe906877abab098c6e63a0e8 | /869/CH13/EX13.9/13_9.sce | eb7b4293fe91904ed3511f878d288854d08d9f2b | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 160 | sce | 13_9.sce | clc
//initialisation of variables
I= 1.5 //in^4
Da= 0.5 //in
E= 30*10^6
l= 60 //in
//CALCULATIONS
F= 6*Da*E*I/(l^3)
//RESULTS
printf ('F= %.2f lb',F)
|
d5b31e786887b097adab0a216da64ce868586ce6 | 51e9b626c77bd433b81b6b9830d2db2518806582 | /task1/kadai3.sce | b876b50f2213d71df5eb37255abb995857cba4e4 | [] | no_license | hama1185/IinteractiveSystem | 1e005fd92fa4b89e4f75926a4f872595aa831a8f | fb880fc82fa8e477306695f5abd7d6b0e0f0a24c | refs/heads/master | 2022-12-19T12:48:36.368503 | 2020-05-30T08:18:55 | 2020-05-30T08:18:55 | 268,037,754 | 0 | 0 | null | 2020-06-11T05:37:25 | 2020-05-30T08:16:47 | Scilab | UTF-8 | Scilab | false | false | 763 | sce | kadai3.sce | fs = 44100;//サンプリングレート
T = 0.25;//音の生成時間(この値の2倍の長さ)
t = [0 : T * fs - 1] / fs;//時間軸の設定
//音の周波数リスト
C = 1046.502;//周波数ド(C)
D = 1174.659;//周波数レ(D)
E = 1318.510;//周波数ミ(E)
F = 1396.913;//周波数ファ(F)
G = 1567.982;//周波数ソ(G)
A = 1760.000;//周波数ラ(A)
B = 1975.533;//周波数シ(B)
//石焼き芋の歌
c = sin(2 * %pi * C * t);
d = sin(2 * %pi * D * t);
e = sin(2 * %pi * E * t);
longrest = sin(2 * %pi * 1 * t);
t = [0 : 0.4 * fs - 1] / fs;
longe = sin(2 * %pi * E * t);
longd = sin(2 * %pi * D * t);
t = [0 : 0.125 * fs - 1] / fs;
rest = sin(2 * %pi * 1 * t);
y = [c,d,longe,longrest,e,d,longd,rest,c,d,longd];
playsnd(y);
savewave("sample.wav",y);
|
113352484765d6ee378de60c69a57206f7bc9783 | 8217f7986187902617ad1bf89cb789618a90dd0a | /source/2.4.1/macros/elem/tanh.sci | 4b26e72ce1e17857cf6be5d732305dd50f76ff5d | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | clg55/Scilab-Workbench | 4ebc01d2daea5026ad07fbfc53e16d4b29179502 | 9f8fd29c7f2a98100fa9aed8b58f6768d24a1875 | refs/heads/master | 2023-05-31T04:06:22.931111 | 2022-09-13T14:41:51 | 2022-09-13T14:41:51 | 258,270,193 | 0 | 1 | null | null | null | null | UTF-8 | Scilab | false | false | 186 | sci | tanh.sci | function t=tanh(x)
//Element wise Hyperbolic tangent
// Copyright INRIA
if type(x)<>1 then error(53),end
t1=exp(x);t2=exp(-x);
t=(t1-t2)./(t1+t2);
k=find(isnan(t))
t(k)=sign(real(x(k)))
|
70d51276cb5a83035995e34d723fc78a1978364e | 449d555969bfd7befe906877abab098c6e63a0e8 | /3269/CH4/EX4.6/Ex4_6.sce | 3b82cb570402e6bb6527a908ef40c6530fcd73e6 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,473 | sce | Ex4_6.sce | // Example 4.6
clear;
clc;
// Given data
A_U = 238; // Atomic Mass number of Uranium
A_O = 16; // Atomic Mass number of Oxygen
amt_UO2 = 33000; // Amount of Uranium dioxide (UO2) present in kilogram(kg)
x_P = 0.032; // Enrichment of 3.2 w/o uranium product
x_T = 0.002; // Enrichemnt of 0.2 w/o residual tails
// From Figure 4.45
x_F = 0.00711; // Enrichemnt of 0.711 w/o feed
// 1.
// Estimation of enriched uranium in kg
M_P = A_U*amt_UO2/(A_U+2*A_O);
// Estimation of amount of Uranium feed in kg
M_F = ((x_P-x_T)/(x_F-x_T))*M_P;
// Result
printf(" \n The amount of uranium feed required per reload = %d kg \n",ceil(M_F));
// 2.
V_x_P = (1-2*x_P)*log((1-x_P)/x_P); // Value function of uranium product with enrichemnt of 3.2 w/o
V_x_F = (1-2*x_F)*log((1-x_F)/x_F); // Value function of feed with enrichemnt of 0.711 w/o
V_x_T = (1-2*x_T)*log((1-x_T)/x_T); // Value function of tallings with enrichemnt of 0.2 w/o
rate_SWU = 130.75; // Enrichment cost in dollars per SWU
// Calculation
SWU = M_P*(V_x_P-V_x_T)-M_F*(V_x_F-V_x_T); // Separative Work (SWU) in kg
enrich_cost = ceil(SWU)*rate_SWU; // Enrichment cost in dollars
// Result
printf("\n The enrichment cost = $ %d \n",ceil(enrich_cost));
// Due to approximation of Separative Work Unit(SWU), there is a difference in the value of enrichment cost on comparison with the textbook value. |
f4196307a8bee06675713462596e975c3e261c3c | f0919c8ea73f22939a890aa4f8327f8200344d2b | /html/tcp_rec.tst | a57c6ed7d118548a0ab0bbb333be19b2189ba3e0 | [] | no_license | kalex375/OVC | af5e91f90754454b90f339e846c5b9112d38d6c8 | f4b47dfc497299c4944b4ff9b93253c279012454 | refs/heads/master | 2021-05-31T07:55:44.326597 | 2013-12-02T14:15:52 | 2013-12-02T14:15:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,248 | tst | tcp_rec.tst | PL/SQL Developer Test script 3.0
28
DECLARE
c utl_tcp.connection; -- TCP/IP connection to the Web server
ret_val pls_integer;
BEGIN
c := utl_tcp.open_connection(remote_host => '192.168.100.2',
remote_port => 8084,
charset => 'US7ASCII'); -- open connection
--ret_val := utl_tcp.write_line(c, 'OPTIONS /svn/ORA_VER/trunk/$svn/act/exp/ HTTP/1.1'); -- send HTTP request
ret_val := utl_tcp.write_line(c, 'CHECKOUT /svn/ORA_VER/trunk/exp/EXP.log HTTP/1.1');
--MKACTIVITY http://www.example.com/repos/foo/$svn/act/01234567-89ab-cdef-0123-45789abcdef
ret_val := utl_tcp.write_line(c, 'Host: 192.168.100.2'); -- send HTTP request
ret_val := utl_tcp.write_line(c, 'Authorization: Basic bWFkY2FwOkdmaGprbTgy'); -- send HTTP request
ret_val := utl_tcp.write_line(c, 'Content-Length: 0'); -- send HTTP request
ret_val := utl_tcp.write_line(c);
--CHECKOUT /his/12/ver/V3 HTTP/1.1
--Host: repo.webdav.org
--Content-Length: 0
BEGIN
LOOP
dbms_output.put_line(utl_tcp.get_line(c, TRUE)); -- read result
END LOOP;
EXCEPTION
WHEN utl_tcp.end_of_input THEN
NULL; -- end of input
END;
utl_tcp.close_connection(c);
END;
0
0
|
9063220c0524a449f6a81bccd4638ca19aa41099 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2138/CH11/EX11.4/ex_11_4.sce | 98a3ab6b4efc7a6ba3cdef389e3c7b2261fc3ba0 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 229 | sce | ex_11_4.sce | //Example 11.4 // current flowing
clc;
clear;
close;
//given data :
f=50; // frequency in Hz
C=100*10^-6;// capacitor in Farad
V=210; // voltage in volts
pi=22/7;
XC=(1/(2*pi*f*C));
Z=XC;
I=V/Z;
disp(I,"current flowing,I(A) = ")
|
5e09e04542df6cb02cb43e8512312b734bde8477 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1787/CH3/EX3.8/Exa3_8.sce | 74d7965fdee713d85ea0a55bcfab17e5e0cfe613 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 347 | sce | Exa3_8.sce | //Exa 3.8
clc;
clear;
close;
//given data
ND=10^21;//in m^-3
NA=10^22;//in m^-3
De=3.4*10^-3;//in m^2-s^-1
Dh=1.2*10^-3;//in m^2-s^-1
Le=7.1*10^-4;//in meters
Lh=3.5*10^-4;//in meters
ni=1.6*10^16;//in m^-3
e=1.602*10^-19;//constant
IoA=e*ni^2*(Dh/(Lh*ND)+De/(Le*NA));
disp(IoA*10^6,"Reverse saturation current density in uA/m2 is ") |
9713e883dd26c0a19efefee8b6fb4069b3e5014c | 449d555969bfd7befe906877abab098c6e63a0e8 | /965/CH7/EX7.50/50.sci | 964f2eebaffe0df8192037390a0e1c68394fe352 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 484 | sci | 50.sci | clc;
clear all;
disp("heat transferred per meter")
ta=15+273;//K air temperature
ts=605+273;//K plate temperature
U=6.5;// m/s velocity of air
x=0.35;//m distance
tf=(ts+ta)/2;// mean film temperature
rho=0.614;//kg/m^3
cp=1046;//J/kg.K
k=0.04593;// W/m.C
mu=29.7*10^(-6);//kg/m.s
Pr=0.675;,
Re=rho*U*x/mu;
Nux=0.332*Pr^(1/3)*Re^0.5*(ts/ta)^0.117;
hx=Nux*k/x;
h=2*hx;
Q=2*h*x*1*(ts-ta);
disp("W",Q,"heat transfer from both sides of the plate, per meter width =")
|
b7c359bd9325b1dc25e0ec3f0f27e004b6ed2892 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3681/CH9/EX9.10/Ex9_10.sce | 3fa502598f9010fa2f091dd3ad09bfc0cfec0c42 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 862 | sce | Ex9_10.sce | // Calculating the demagnetizing and cross magnetizing mmf per pole
clc;
disp('Example 9.10, Page No. = 9.38')
// Given Data
P = 500;// Power rating (in kW)
rpm = 375;// Speed in r.p.m.
p = 8;// Number of poles
flux = 0.0885;// Flux per pole (in Wb per meter)
// Calculation of the demagnetizing and cross magnetizing mmf per pole
n = rpm/60;// Speed in r.p.s.
alpha = 5/100*180;// Brush shift (in electrical degree). Since the brushes are given a lead by of 5% of pole pitch
ATa = P/(2*flux*n*p*p*10^(-3));// Armature mmf per pole (A)
ATad = ATa*2*alpha/180;;// Demagnetizing mmf per pole (A)
ATaq = ATa-ATad;// Cross magnetizing mmf per pole (A)
disp(ATad,'Demagnetizing mmf per pole (A) =');
disp(ATaq,'Cross magnetizing mmf per pole (A) =');
//in book answers are 706 (A) and 6354 (A) respectively. The answers vary due to round off error
|
c0f7d2cb15cff611c8f230270806348910109b3f | 089894a36ef33cb3d0f697541716c9b6cd8dcc43 | /NLP_Project/test/blog/bow/bow.13_10.tst | 9ae346527cf2b30fc51c7bd1d5dd096bb1b7db20 | [] | no_license | mandar15/NLP_Project | 3142cda82d49ba0ea30b580c46bdd0e0348fe3ec | 1dcb70a199a0f7ab8c72825bfd5b8146e75b7ec2 | refs/heads/master | 2020-05-20T13:36:05.842840 | 2013-07-31T06:53:59 | 2013-07-31T06:53:59 | 6,534,406 | 0 | 1 | null | null | null | null | UTF-8 | Scilab | false | false | 4,457 | tst | bow.13_10.tst | 13 8:0.5 13:1.0 32:0.25 81:1.0 222:1.0 1005:1.0
13 8:0.5 37:0.5 130:0.5 624:0.25
13 4:0.3333333333333333 12:0.5 22:0.16666666666666666 29:0.18181818181818182 36:0.1 114:0.14285714285714285 118:1.0 165:1.0 180:0.3333333333333333 198:1.0 279:1.0 582:1.0 963:1.0 1353:1.0
13 8:0.5 12:0.5 32:0.25 153:0.3333333333333333 171:0.2 305:1.0 862:1.0 1130:1.0
13 916:1.0
13 15:0.02702702702702703 104:0.07692307692307693 209:0.3333333333333333 379:1.0 580:1.0 586:1.0
13 2:0.125 4:0.3333333333333333 13:1.0 15:0.02702702702702703 25:1.0 59:1.0 92:1.0 114:0.14285714285714285 209:0.3333333333333333 594:0.5 684:1.0 704:0.0625 970:1.0 973:1.0 1346:1.0
13 2:0.125 15:0.02702702702702703 19:0.3333333333333333 165:1.0 179:0.3333333333333333 450:1.0 694:1.0 702:0.3333333333333333 931:1.0
13 115:1.0 239:1.0 702:0.3333333333333333
13 2:0.0625 4:0.3333333333333333 8:0.5 15:0.02702702702702703 23:1.0 32:0.5 104:0.07692307692307693 111:0.5 165:1.0 171:0.2 274:1.0 544:1.0 607:1.0
13 4:0.3333333333333333 15:0.02702702702702703 31:1.0 59:1.0 114:0.14285714285714285 115:1.0 135:1.0 858:1.0 1421:1.0
13 2:0.1875 12:1.0 15:0.02702702702702703 19:0.6666666666666666 68:0.6666666666666666 130:0.5 132:0.5 150:1.0 171:0.2 203:1.0 504:1.0 526:1.0 704:0.0625 824:1.0 1007:1.0
13 4:0.3333333333333333 8:0.5 32:0.25 68:0.3333333333333333 130:0.5 274:1.0 537:1.0 624:0.25
13 2:0.25 4:0.3333333333333333 12:0.5 15:0.05405405405405406 19:0.3333333333333333 25:1.0 32:0.25 68:0.3333333333333333 79:0.3333333333333333 108:1.0 179:0.3333333333333333 334:1.0 343:1.0 377:0.5 526:1.0 544:1.0 710:1.0 916:1.0 1194:1.0 1202:1.0
13 2:0.0625 4:0.3333333333333333 15:0.05405405405405406 25:1.0 31:1.0 32:0.5 45:1.0 68:0.3333333333333333 126:1.0 274:1.0 406:1.0 704:0.0625 1048:1.0 1081:1.0 1145:1.0 1194:1.0
13 2:0.0625 12:0.5 22:0.08333333333333333 31:1.0 32:0.25 135:1.0 167:1.0 209:0.3333333333333333 282:1.0 586:1.0 845:1.0 860:1.0 867:0.5 1077:0.5 1308:1.0
13 2:0.0625 4:1.0 12:1.5 19:0.3333333333333333 37:0.5 179:0.3333333333333333 239:1.0 430:0.5 594:0.5 704:0.25 952:0.5 1097:1.0 1113:1.0
13 12:0.5 31:2.0 89:2.0 100:0.5 114:0.14285714285714285 292:0.3333333333333333 359:1.0 483:1.0 702:0.3333333333333333 704:0.0625 866:1.0 867:0.5
13 2:0.0625 19:0.3333333333333333 25:1.0 32:0.25 704:0.0625 1048:1.0
13 15:0.05405405405405406 31:1.0 32:0.25 37:0.5 45:1.0 81:1.0 110:0.25 305:1.0 1009:0.5 1031:0.3333333333333333 1202:1.0
13 2:0.0625 4:0.6666666666666666 12:0.5 13:3.0 15:0.05405405405405406 25:1.0 59:1.0 100:0.5 108:1.0 115:1.0 171:0.2 282:1.0 372:1.0 382:1.0 408:1.0 430:0.5 504:1.0 581:0.5 702:0.3333333333333333 704:0.0625 747:1.0 771:1.0 831:1.0 860:1.0 1080:1.0 1088:1.0 1101:1.0 1170:1.0 1171:1.0 1172:1.0
13 12:1.5 13:1.0 37:0.5 118:1.0 122:1.0 704:0.0625 866:1.0 1140:1.0 1350:1.0
13 13:1.0 209:0.3333333333333333 214:0.5 237:1.0 251:1.0 262:1.0 430:0.5 653:1.0 1293:1.0
13 4:0.6666666666666666 8:0.5 15:0.05405405405405406 25:1.0 27:0.5 32:0.25 36:0.1 59:1.0 68:0.3333333333333333 101:1.0 114:0.14285714285714285 125:1.0 131:1.0 149:1.0 150:1.0 161:1.0 180:0.3333333333333333 292:0.3333333333333333 502:1.0 525:1.0 580:1.0 637:1.0 702:0.3333333333333333 704:0.0625 1180:1.0
13 15:0.02702702702702703 115:1.0
13 15:0.02702702702702703 114:0.14285714285714285 311:1.0 1353:1.0
13 15:0.02702702702702703
13 15:0.02702702702702703 150:1.0 342:1.0 429:1.0 704:0.0625 1145:1.0
13 15:0.05405405405405406 16:1.0 101:1.0 118:1.0 153:0.3333333333333333 518:1.0
13 12:0.5 13:1.0 15:0.05405405405405406 22:0.08333333333333333 23:1.0 25:1.0 36:0.1 89:1.0 101:1.0 114:0.14285714285714285 153:0.3333333333333333 169:0.3333333333333333 239:2.0 274:1.0 430:0.5 583:1.0 956:0.3333333333333333 1191:1.0
13 108:1.0 115:1.0 125:1.0 502:1.0 704:0.0625 1128:1.0
13 8:0.5 32:0.25 43:1.0 92:1.0 104:0.07692307692307693 618:1.0 702:0.3333333333333333 878:1.0
13 702:0.3333333333333333
13 4:0.3333333333333333 12:0.5 24:0.5 31:1.0 32:0.25 112:1.0 153:0.3333333333333333 227:1.0 385:1.0 539:1.0 702:0.3333333333333333 704:0.0625 747:1.0 1209:1.0
13 110:0.25 115:2.0 235:0.2 253:1.0 1209:1.0
13 235:0.2 695:1.0 702:0.3333333333333333 704:0.0625 813:1.0
13 235:0.2
13 2:0.0625 12:0.5 32:0.25 146:1.0 239:1.0 292:0.3333333333333333 660:1.0 943:1.0
13 2:0.0625 4:0.3333333333333333 10:1.0 12:0.5 22:0.08333333333333333 29:0.09090909090909091 31:1.0 53:1.0 68:0.3333333333333333 108:1.0 110:0.25 150:1.0 153:0.6666666666666666 165:1.0 180:0.3333333333333333 236:1.0 342:1.0 382:1.0 843:1.0 1077:0.5 1346:1.0
|
f50c5126fc6102ca16fa645e91a865beaaf7f6f5 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2795/CH7/EX7.4/Ex7_04.sce | 822ae93e63b9ed36dc6ca5381bdb824017ada7f9 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,087 | sce | Ex7_04.sce | // Scilab Code Ex7.4: Page-252 (2014)
clc; clear;
n = 3; // Principal quantum number
Total = 0;
printf("\nn l m_l 2(l + 1)");
printf("\n------------------------------------");
for l = 0:1:n-1
printf("\n%d", n);
printf(" %d ", l);
if l > 0 then
count = 0;
for m_l = -l:1:l
printf("%2d ", m_l);
count = count + 1;
end
if l == 1 then
printf(" ");
else
printf("");
end
else
m_l = 0;
count = 0;
printf("%2d ", m_l);
count = count + 1;
end
printf(" %d", count);
Total = Total + count;
end
printf("\n Total = %d", Total);
// Result
// n l m_l 2(l + 1)
// ------------------------------------
// 3 0 0 1
// 3 1 -1 0 1 3
// 3 2 -2 -1 0 1 2 5
// Total = 9 |
59beaa89ffcfe61b932f6c056a2bdf59d1685caf | 449d555969bfd7befe906877abab098c6e63a0e8 | /479/CH1/EX1.6/Example_1_6.sce | f64b60019fc0cfc8ce18201e9c7581c99c44d19f | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 539 | sce | Example_1_6.sce | //Chemical Engineering Thermodynamics
//Chapter 1
//Introduction
//Example 1.6
clear;
clc;
//Given
n = 1;//n is the Kg mole of ideal gas.
P1 = 700*(10^4);//P1 is the initial pressure of the system in N/(m^2)
P2 = 638*(10^4);//P2 is the final pressure of the system in N/(m^2)
T = 300;//T is temperature of the system in K
R = 8314.4;//R is gas constant in Nm/Kgmole deg K
//To calculate the work done
W = n*R*T*log(P1/P2);//W is the work done by the system in Nm
mprintf('Work done by the system is %4.2e Nm',W);
//end |
12a745f32050ece600e54318a97f731418cd5b3c | 449d555969bfd7befe906877abab098c6e63a0e8 | /3860/CH1/EX1.8/Ex1_8.sce | 77e476d08c953ce3ff2bbbf9bc35539c924b0567 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 196 | sce | Ex1_8.sce | //Example 1.8 Conversion from decimal number to binary number.
clc;
x = dec2bin(105); // binary equivalent of decimal number
disp('The binary number is = ');
disp(x) // answer in binary form
|
001ed070f1c45fe7f8a9415a74a4c3ee18a2da3c | 449d555969bfd7befe906877abab098c6e63a0e8 | /2084/CH18/EX18.18w/18_18w.sce | d1bec7ace70ac24ec2fdeacd4ed823141d7d8d53 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,575 | sce | 18_18w.sce | //developed in windows XP operating system 32bit
//platform Scilab 5.4.1
clc;clear;
//example 18.18w
//calculation of position of image due to refraction at the first surface and position of final image
//given data1
//u=infinite object distance (in cm)
R=2; //radius of curvature of the spherical convex surface (in mm)
mu1=1.33; //refractive index of the medium from which light beam is entering
mu2=1; //refractive index of the medium of spherical air bubble
nR=-2; //radius of curvature of the spherical convex surface (in mm)
nmu1=1; //refractive index of the medium in which previous image is formed
nmu2=1.33; //refractive index of the medium from which light beam is entering
//calculation
v=R/(mu2-mu1) //formula for refraction at spherical surface for object at infinite distance
nu=-(-v+-(2*nR))
if(v<0)
disp(-v,'virtual image is formed on the same side of water at a distance(in mm) of');
else
disp(v,'real image is formed on the other side of water at a distance(in mm) of');
end
nv=nmu2/((nmu2-nmu1)/nR+(nmu1/nu)) //formula for refraction at spherical surface
if(nv<0)
disp(-nv,'final image is formed on the same side of air at a distance(in mm) of');
else
disp(nv,'final image is formed on the other side of air at a distance(in mm) of');
end
disp(-v+R,'from the centre first image is formed on the side from which incident rays are coming at a distance(in mm) of ');
disp(-nv+nR,'from the centre second image is formed on the side from which incident rays are coming at a distance(in mm) of ');
|
6c84ecb479cfa71e1b3caaf3756581b070face03 | 449d555969bfd7befe906877abab098c6e63a0e8 | /257/CH11/EX11.13/example_11_13.sce | 737a1e969465544961967dba06052a7c8bdbf156 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 668 | sce | example_11_13.sce | s=poly(0,'s');
F=syslin('c',[(1+0.2*s)*(1+0.025*s)/((1+0.001*s)*s^(3)*(0.005*s+1))])
fmin=0.1; //Min freq in Hz
fmax=20; //Max freq in Hz
scf(1);clf;
bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
disp(freqGM*2*3.14,"omegaPC=")
show_margins(F) //display gain and phase margin and associated crossover frequencies
//for omegaPC=16.54 ; the plot needs to be shifted by 64dB
k1=10^(64/20)
//for omegaPC =400 ; the plot needs to be shifted by 100dB
k2=10^(100/20)
disp(k1,k2,"the 2 values k lies between are")
|
5ddcd8251d869bf74064ca1da71d81268879afe7 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2135/CH6/EX6.34/Exa_6_34.sce | a765be5fb8db897eeca26df860322b83ae8414e2 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 535 | sce | Exa_6_34.sce | //Exa 6.34
clc;
clear;
close;
format('v',7);
//Given Data :
p1=80;//bar
Tsup3=350;//degree C
pb=712.5/760*1.01325;//bar
mdot=2;//Kg/s
//mdot=1;//Kg
h3=2964;//KJ/Kg(Molliers diagram)
h4=2184;//KJ/Kg(Molliers diagram)
WT=h3-h4;//KJ/Kg
WTdot=mdot*WT;//KW
disp(WTdot,"Total turbine work in KW : ");
wp=(p1-pb)/10;//KJ/Kg
hf1=411.35;//KJ/Kg(from steam table)
h1=hf1;//KJ/Kg
h2=h1+wp;//KJ/Kg
qi=h3-h2;//KJ/Kg
EtaR=(WT-wp)/qi*100;//%
disp(EtaR,"Rankine efficiency in % : ");
//Steam table is used to get some data.
|
631bad3344f6b4755697e6b8ec4e2baad2bde043 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2660/CH11/EX11.1/Ex11_1.sce | b4678572676342ef75837861f06c7fa5285427e8 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 554 | sce | Ex11_1.sce | clc
v = 15000 // vertical magnification
h = 100 // horizontal magnification
l = 0.8 // sampling length in mm
a1 = 160 // area above datum line in mm^2
a2 = 90 // area above datum line in mm^2
a3 = 180 // area above datum line in mm^2
a4 = 50 // area above datum line in mm^2
a5 = 95 // area below datum line in mm^2
a6 = 65 // area below datum line in mm^2
a7 = 170 // area below datum line in mm^2
a8 = 150 // area below datum line in mm^2
a = (a1+a2+a3+a4+a5+a6+a7+a8)/(v*h)
CLA= a/l
printf("\n C.L.A value = %0.2f*10^-6 m " , CLA*1000)
|
471c457288567366e7e4465b8271e39f5082e317 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2201/CH3/EX3.5/ex3_5.sce | 8fbfa883673dfefbfc33304baeb5a2c5866a248e | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 402 | sce | ex3_5.sce | // Exa 3.5
clc;
clear;
close;
// Given data
Miu_n = 0.15;// in m^2/v-s
K = 1.38*10^-23;
T = 300;// in K
e = 1.6*10^-19;// in C
D_n = Miu_n*((K*T)/e);// in m^2/s
Torque_n = 10^-7;// in s
L_n = sqrt(D_n*Torque_n);// in m
disp(L_n,"The diffusion length in m is");
del_n = 10^20;// in electrons/m^3
J_n = (e*D_n*del_n)/L_n;// in A/m^2
disp(J_n,"The diffusion current density in A/m^2 is");
|
46b83971f3e66265eba1eb77328085603d7c92b5 | 6e257f133dd8984b578f3c9fd3f269eabc0750be | /ScilabFromTheoryToPractice/CreatingPlots/testmatrixhandle.sce | d3f0efb662f64473b7f63a7e37a3de72c81538d4 | [] | no_license | markusmorawitz77/Scilab | 902ef1b9f356dd38ea2dbadc892fe50d32b44bd0 | 7c98963a7d80915f66a3231a2235010e879049aa | refs/heads/master | 2021-01-19T23:53:52.068010 | 2017-04-22T12:39:21 | 2017-04-22T12:39:21 | 89,051,705 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 159 | sce | testmatrixhandle.sce | lines(10) //to delete
plot() // commande graphique Scilab
E=gce() // handle de type Compound
E.children(1) // 1er des 41 descendants de E
|
79ec0c7639ccd7c74bbe996bee36a52eb0516dbd | 449d555969bfd7befe906877abab098c6e63a0e8 | /3035/CH14/EX14.2/Ex14_2.sce | 73898c397fd912455ef5c437253561db39169234 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 2,217 | sce | Ex14_2.sce |
// Variable Declaration
I_f_A = 6000.0 //3-phase fault current of substation A(A)
I_f_B = 5000.0 //3-phase fault current of substation B(A)
I_f_C = 3000.0 //3-phase fault current of substation C(A)
I_f_D = 2000.0 //3-phase fault current of substation D(A)
I_L_max = 100.0 //Maximum load cuurent(A)
T = 0.5 //Operating time of breakers(sec)
I_set = 1.0 //Setting current(A)
// Calculation Section
I_L_maxD = I_L_max //Maximum load current at D(A)
CT_D = I_L_max/1 //CT ratio
PSM_D = I_f_D/(CT_D*I_set) //Plug setting multiplier
TMS_D = 0.1 //Time multiplier setting
T_D = 0.14*TMS_D/(PSM_D**0.02-1) //Time of operation(sec)
I_L_maxC = I_L_max+I_L_maxD //Maximum load current at C(A)
CT_C = I_L_maxC/1 //CT ratio
PSM_C = I_f_C/(CT_C*I_set) //Plug setting multiplier
T_C = T_D+T //Minimum time of operation(sec)
TMS_C = T_C*(PSM_C**0.02-1)/0.14 //Time multiplier setting
I_L_maxB = I_L_max+I_L_maxC //Maximum load current at B(A)
CT_B = I_L_maxB/1 //CT ratio
PSM_B = I_f_B/(CT_B*I_set) //Plug setting multiplier
T_B = T_C+T //Minimum time of operation(sec)
TMS_B = T_B*(PSM_B**0.02-1)/0.14 //Time multiplier setting
I_L_maxA = I_L_max+I_L_maxB //Maximum load current at A(A)
CT_A = I_L_maxA/1 //CT ratio
PSM_A = I_f_A/(CT_A*I_set) //Plug setting multiplier
T_A = T_B+T //Minimum time of operation(sec)
TMS_A = T_A*(PSM_A**0.02-1)/0.14 //Time multiplier setting
// Result Section
printf('Relay A :')
printf('CT ratio = %.f/1' ,CT_A)
printf('PSM of R_A = %.1f' ,PSM_A)
printf('TMS of R_A = %.1f sec' ,TMS_A)
printf('\nRelay B :')
printf('CT ratio = %.f/1' ,CT_B)
printf('PSM of R_B = %.2f' ,PSM_B)
printf('TMS of R_B = %.1f sec' ,TMS_B)
printf('\nRelay C :')
printf('CT ratio = %.f/1' ,CT_C)
printf('PSM of R_C = %.1f' ,PSM_C)
printf('TMS of R_C = %.1f sec' ,TMS_C)
printf('\nRelay D :')
printf('CT ratio = %.f/1' ,CT_D)
printf('PSM of R_D = %.1f' ,PSM_D)
printf('TMS of R_D = %.2f sec' ,TMS_D)
|
d74287bacb02dc2f1b4de89f536e10113f2ed69b | 99b4e2e61348ee847a78faf6eee6d345fde36028 | /Toolbox Test/rc2lar/rc2lar6.sce | 3d4de991eeb198605df8f40059400b9070808646 | [] | no_license | deecube/fosseetesting | ce66f691121021fa2f3474497397cded9d57658c | e353f1c03b0c0ef43abf44873e5e477b6adb6c7e | refs/heads/master | 2021-01-20T11:34:43.535019 | 2016-09-27T05:12:48 | 2016-09-27T05:12:48 | 59,456,386 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 219 | sce | rc2lar6.sce | //check o/p when i/p is a matrix
k = [0.3090 0.9801; 0.0031 0.0082; -0.0082 0.54365];
g = rc2lar(k);
disp(g);
//output
//
// 0.6388789 4.6001829
// 0.0062000 0.0164004
// - 0.0164004 1.218645
//
|
aabf82de2c7e09b21cc16ce57ad2e741da715f73 | 668ca4e9ddcb0e4af73b341adf7dc544e552980d | /笔记/java笔记1.tst | 19c15446f21eca5093c8e96d94a947b7bb45d891 | [] | no_license | ysily8817/biji | 6d5c70e681d9753597557a3204d8b6f69a5b2d7b | 15ff1b882a6e107caea02401bc384a38ceb1c4d6 | refs/heads/master | 2022-06-25T07:41:45.485965 | 2019-09-30T04:14:12 | 2019-09-30T04:14:12 | 199,145,828 | 0 | 0 | null | 2022-06-21T01:36:05 | 2019-07-27T09:44:03 | Scilab | UTF-8 | Scilab | false | false | 46,202 | tst | java笔记1.tst | 一、数组
常用方法说明
1、copy数组
公式:Arrays.copyOf(original, newLength);
说明:original:源数组,newLength:copy的长度
例:
int[] a = new int[]{1, 3, 6, 22, 31, 4};
int[] c = Arrays.copyOf(a, 10);
结果:打印数组c--》[1, 3, 6, 22, 31, 4, 0, 0, 0, 0]
如果源数组a长度不够,则补零;
2、copy数组
公式:Arrays.copyOfRange(original, from, to);
说明:original:源数组,from:从第几位开始,to:到第几位结束,结果为包含from位置,不包含to位置
例:
int[] a = new int[]{1, 3, 6, 22, 31, 4};
int[] b = Arrays.copyOfRange(a, 1, 4);
结果:打印数组b--》[3, 6, 22]
3、将数组转化为字符串
公式:Arrays.toString(a);
说明:直接将数组名作为参数传递,打印结果为:[1, 3, 6, 22, 31, 4]
4、将数组进行排序
公式:Arrays.sort(a);
说明:将数组a按升序排序
5、查找数组中元素出现的位置
公式:Arrays.binarySearch(a, key);
说明:a为要查找的元素,key为要查找的元素,“进行查找前必须要进行sort排序!!!!!”
执行结果为元素key的角标
6、比较两个数组内容是否一致
公式:Arrays.equalse(int[] a, int[] b);
说明:比较数组a和数组b的内容是否一致
7、使用同一个值,填充整个数组
公式1:Arrays.fill(int[] a, 5);
公式2:Arrays.fill(a, fromIndex, toIndex, val);
说明:公式1,将数组a中的元素全部替换为5
说明:公式2,将数组a中fromIndex角标到toIndex之间的元素替换为val。
二、变长参数
公式:方法名(参数类型...参数名称){}
说明:如果存在多个类型的形式参数,变长参数只能作为最后一个参数进行传递
eg: public int sum(int... a) { //参数就相当于一个数组,求和通过遍历数组
int sum = 0;
for(int i : a) {
sum += i;
}
三、多态
1、多态中的成员访问的特点:
A:成员变量
编译看左边,运行看左边
B:构造方法
创建子类对象的时候,访问父类的构造方法,对父类的数据进行初始化
C:成员方法
编译看左边,运行看右边
D:静态方法
编译看左边,运行看左边(静态和类香港,算不上重写,所以访问还是看左边)
四、内部类
1、内部类概述
把类定义在其他类的内部,这个类就被称为内部类,如下Inner就是Outer的内部类
class Outer {
class Inner {
}
}
2、内部类的访问特点
A:内部类可以直接访问外部类的成员,包括私有
B:外部类要访问内部类的成员,必须先创建内部类的对象
3、内部类的位置
成员位置:在成员位置定义的类,被称为成员内部类
局部位置:在局部位置定义的类,被称为局部内部类,比如将内部类定义在外部类的方法中
4、匿名内部类的定义格式
接口名 对象名 = new 接口名() {
//覆写抽象方法
};
MyInterface obj = new MyInterface() {
@Override
public void method() {
System.out.print("匿名内部类实现了方法");
}
}
五、Eclipse常用配置
A:程序的编译和运行环境的配置
window -- Preferences -- Java
编译环境:Compiler 默认选中的就是最高版本
运行环境:Installed JREs默认会找到自己安装的JDK
编译版本比运行版本低就可以运行
B:字体大小及颜色
a:Java代码区域的字体大小和颜色
window -- Preferences -- General -- Appearance -- Colors And Fonts -- Java修改 -- Java Edit Text Font
b:控制台
window -- Preferences -- General -- Appearance -- Colors And Fonts -- Debug -- Console font
c:其他文件
window -- Preferences -- General -- Appearance -- Colors And Fonts -- Baseic -- Text Font
--------------------------------------常用类-----------------------------
六、Object类
A:hashCode() //返回对象的哈希码值,将该对象的内部地址转换为一个整数返回
B:getClass() //返回一个Class类型的变量, 可以调用Class类的getName()方法,获取当前类的类名
C:toString() //返回该对象的字符串表示,要重写该方法;打印对象名称时会自动调用toString()方法
D:equals() //默认比较引用地址的值,所以需要重新该方法。其中String中的equals()方法比较的是字符串内容是否相同
E:“==” //比较基本数据类型的值是否相等;比较引用时,比较的是地址值是否相同
七、Scanner类
A:构造方法 //Scanner sc = new Scanner(System.in); 创建Scanner对象
B:hasNextInt() //返回值类型为boolean,用于判断输入的数据是否为数字
C:nextInt() //获取一个Int类型的值,返回类型为Int
D:nextLine() //获取一个String类型的值,返回类型为String
八、String类
A:构造方法:
*public String() //空构造
*public String(byte[] bytes) //把字节数组转化成字符串
public String(byte[] bytes, int offset, int length) //把字节数组的一部分转成字符串,offset指从某个位置开始
*public String(char[] value) //把字符数组转成字符串
public String(char[] value, int offset, int length) //把字符数组的一部分转成字符串
public String(String original) //把字符串常量值转化成字符串
B:判断功能
boolean equals(Object obj) //比较字符串内容是否相同,区分大小写
boolean equalsIgnoreCase(String str) //比较字符串的内容是否相同,忽略大小写
boolean contains(String str) //判断大字符串中是否包含小字符串
boolean startWith(String str) //判断字符串是否以某个指定的字符串开头
boolean endsWith(String str) //判断字符串是否以某个指定的字符串结尾
boolean isEmpty() //判断字符串是否为空
C:获取功能
int length() //获取字符串的长度
char charAt(int index) //获取指定索引位置的字符
int indexOf(int ch) //返回指定字符在此字符串中第一次出现的索引
int indexOf(String str) //返回指定字符串在此字符串中第一次出现的索引
int indexOf(int ch, int fromIndex) //返回指定字符在此字符串中从指定位置后第一次出现的索引
int indexOf(String str, int fromIndex) //返回指定字符串在此字符串中从指定位置后第一次出现的索引
String substring(int start) //从指定位置开始截取字符串,默认到末尾
String substring(int start, int end) //从指定位置开始到指定位置结束截取字符串
D:判断字符是大小写或者是数字
a >= '0' && a <= '9'
a >= 'a' && a <= 'z'
a >= 'A' && a <= 'Z'
//char类型的字符可以直接与数字和字母进行比较
E:String转换功能
byte[] getBytes() //把字符串转换为字节数组
char[] toCharArray() //把字符串转换为字符数组
static String valueOf(char[] chs) //把字符数组转成字符串
static String valueOf(int i) //把int类型的数据转成字符串
String类的valueOf方法可以把任意类型的数据转成字符串
String toLowerCase() //把字符串转成小写
String toUpperCase() //把字符串转成大写
String concat(String str) //字符串拼接 str1.concat(str2) 等价于 str1 + str2
F:String其他功能
1、判断功能
public boolean matches(String regex) //接收正则类型,用于判断字符串是否匹配该正则表达式
2、String字符串替换
String replaceAll(String regex, String replacement) //全部替换
String replaceFirst(String regex, String replacement) //替换首个满足条件的内容
eg:String str = "helloworld12321java123123213213haha";
String regex = "\\d";
String strNew = str.replaceAll(regex, "*");
System.out.println(strNew); //输出结果,用*号替代所有数字
3、分割功能
public String[] split(String regex);
eg:String str = "18-24"; String[] age = str.split("-");
4、获取功能,从str中获取与正则匹配的子字符串
eg:String str = "da jia ting wo shuo, jin tian yao xia yu, bu shang wan zi xi, kai xin bu";
String regex = "\\b[a-zA-Z]{3}\\b";
Pattern p = Pattern.compile(regex); //把规则编译成模式对象
Matcher m = p.matcher(str); //通过模式对象得到匹配对象
while(m.find()) {
System.out.println(m.group());
} //使用group()方法时,需要先调用find()方法进行判断,要不然会报错
九:StringBuffer类
A:构造方法:
public StringBuffer(); //无参构造,初始容量为16个字符
public StringBuffer(int capacity); //指定容量的字符串缓冲区对象
public StringBuffer(String str); //指定字符串内容的字符串缓冲区对象
B:StringBuffer的普通方法
public int capacity(); //返回当前容量,理论值,如水杯的容量为800L
public int length(); //返回长度,实际值,如水杯内实际有300L水
C、添加方法
public StringBuffer append(String str); //可以把任意类型的数据添加到字符串缓冲区里,并返回字符串缓冲区本身
public StringBuffer insert(int offset, String str); //在指定位置把任意类型的数据插入到字符串缓冲区里面
D、删除功能
public StringBuffer deleteCharAt(int index); //删除指定位置的字符,并返回本身
public StringBuffer delete(int start, int end); //删除从指定位置开始指定位置结束的内容,并返回本身
E、替换功能
public StringBuffer replace(int start, int end, String str); //从start开始到end结束用str替换
F、反转功能
public StringBuffer reverse(); //abcd --> dcba
G、截取功能
public String substring(int start)
public String substring(int start, int end); //注意返回类型为String
H、String和StringBuffer相互转换
String --> StringBuffer
1、构造方法转换
public StringBuffer(String str);
2、普通方法转换
public StringBuffer append(String str);
StringBuffer --> String
1、构造方法转换
public String(StringBuffer sb);
2、普通方法转换
public String toString(); StringBuffer.toString();
I、面试题
1、String、StringBuffer、StringBuilder的区别
String内容不可改变,而StringBuffer和StringBuilder内容都可变
StringBuffer是同步的,数据安全,效率低;StringBuilder是不同步的,数据不安全,效率高
2、StringBuffer和数组的区别
二者都可以看做是一个容器,装其他数据
但StringBuffer可以同时装多种类型,最终是一个字符串数据
而数组可以放置多种数据,但必须是同一种数据类型
3、形式参数
基本类型:形式参数的改变不影响实际参数
引用类型:形式参数的改变直接影响实际参数
String作为参数传递,效果与基本类型作为参数传递一样。
十、基本类型
A、Integer的构造方法
public Integer(int value) //将int类型的数字转换为Integer对象
public Integer(String str) //将字符串转换为Integer对象,其中字符串中的元素只能是数字
B、将int转换为String
int number = 100;
方法一:
String st = "" + number;
方法二:(重点使用)
String st = String.valueOf(number);
方法三:
Integer in = new Integer(number);
String st = in.toString;
方法四:
String st = Integer.toString(number);
C、将String转换为int
String st = "100";
方法一:
Integer in = new Integer(st);
int i = Integer.intValue(); 将Integer转换为int; //Integer in = Integer.valueOf(100); 将100转为Integer类型
//自动拆装箱功能,可以使两者直接转换 Integer in = 100; in += 200;
//Integer的直接赋值,如果在-128到127之间,会直接从缓冲池里获取数据 Integer in =100;
方法二:(重点使用这种方法)
int i = Integer.parseInt(st); //推荐使用 XX类型.parseXX(st) 把String类型转换为基本数据类型
int i = Integer.parseInt(“123”,2)//将String转换为2进制,但不能转换为2进制,因为2进制由0和1组成,所以前后参数要一致
D、10进制转换为其他进制(了解)
Integer.toString(100, 16); //将100转换为16进制,进制范围是2-36,因为0-9,a-z共36个数字
十一、Math类:用于数学运算的类,
A、成员变量
public static final double PI
public static final double E
B:成员方法、都是静态的
public static int abs(int a); 绝对值
public static double ceil(double a); 向上取整
public static double floor(double a); 向下取整
public static int(int a, int b); 最大值
public static double pow(double a, double b); a的b次幂
public static double random(); 随机数[0.0, 1.0)
public static int round(float a) 四舍五入
public static double sqrt(double a); 正平方根
十二、Random类:产生随机数的类;(生成随机数,一般使用Math类中random()方法)
A、构造方法:
public Random(); //没给种子,用的默认种子,是当前时间的毫秒值
public Random(long seed); //给出指定的种子,给定种子后,每次生成的随机数都是相同的
B、成员方法
public int nextInt(); //返回的是int范围内的随机数
public int nextInt(int n); //返回的是[0, n)范围内的随机数
十三、System类,包含一些有用的类字段和方法,不能被实例化
方法:
public static void gc(); //运行垃圾回收器
public static void exit(int status); //终止当前正在运行的java虚拟机,参数作为状态码,非0表示异常退出
public static long currentTimeMillis(); //返回以毫秒为单位的当前时间,如在代码开始和结束时调用该方法,以计算代码运行时间
public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
十四、BigInteger,位于java.math包下
说明:Integer in = new Integer("11111111111");,当接收的字符串超出Integer最大值时,会报错
此时选择BigInteger类型,该类下有多种数学计算方法
十五、BigDecimal,位于java.math包下,用于解决数学运算中出现的精度问题
A、构造方法:
public BigDecimal(String str)
eg:System.out.println(0.01 + 0.09) ==>输出结果是0.09999999999999999为解决这个问题,使用如下
BigDecimal bd1 = new BigDecimal(0.01);
BigDecimal bd2 = new BigDecimal(0.09);
System.out.println(bd1 + bd2) ==>输出结果是0.01
十六、Date类
A、构造方法:
public Date(); //根据当前默认毫秒值创建日期对象
public Date(long date); //根据给定的毫秒值创建日期对象,date单位是毫秒
B、成员方法
public long getTime(); //获取时间,以毫秒为单位
public void setTime(long time); //设置时间
十七、DateFormat类:抽象类,位于java.text包下,日期转换中通常使用子类:SimpleDateFormat
eg1:Date --》 String
Date date = new Date();
SimpleDateFormat sim = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
String time = sim.format(date);
System.out.println(time);
eg2:String --> Date
String time2 = "2018-06-05 18:20:20";
//在把一个字符串解析为日期的时候,注意格式必须和给定的字符串格式匹配
SimpleDateFormat sim2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date da = sim2.parse(time2);
System.out.println(da);
十八、Calendar类,抽象类,位于java.util包下,用于操作日期
Calendar cal = Calendar.getInstance(); //Calendar是一个抽象类,所以不能实例化对象,而是通过方法返回子类对象
int year = cal.get(cal.YEAR); //get方法中,传什么参数就能获取什么样的值
int month = cal.get(cal.MONTH);
int day = cal.get(cal.DATE);
System.out.println(year + " " + (month + 1) + " " + day);
B、成员方法
public void add(int field, int amount); //根据给定的日历字段和对应的时间,来对当前的日历进行操作
public final void set(int year, int month, int date); //设置当前日历的年月日
eg:Calendar cal = Calendar.getInstance(); //获取当前的日历时间
int year = c.get(cal.YEAR);
c.add(Calendar.YEAR, -3) //三年前的今天
c.set(2011, 11, 11)
Date date = c.getTime()//通过日历对象把日历转换为日期对象
集合--------------------------------------------------------
十九、Collection [kəˈlekʃn]
A:添加功能
boolean add(Object obj); //添加一个元素
boolean addAll(Collection c); //添加一个集合的元素
B:删除功能
void clear(); //移除所有元素
boolean remove(Object obj); //移除一个元素
boolean removeAll(Collection c); //移除一个集合的元素,移除一个元素就返回true
C:判断功能
boolean contains(Object o); //判断集合中是否包含指定元素
boolean containsAll(Collection c); //判断集合中是否包含指定的集合元素,必须包含所有的元素才返回true
boolean isEmpty(); //判断集合是否为空
D:获取功能
Iterator<E> iterator() (重点)
E:长度功能
int size(); //获取元素个数
F:交集功能
boolean retainAll(Collection c); //两个集合都有的元素,没有交集也返回true,调用方法的集合变为[];
当调用该方法的集合发生变化时返回true,否则返回false;
a集合["a","b","c"] b集合["e","d","f"] c集合["a","b","c","d"]
结果:a.retainAll(b) //a变为[],返回true; a.retainAll(c) //a不变,返回false
G:把集合转换成数组
Object[] toArray();
H:把数组转成集合;使用Arrays类中的asList(T... t)方法,接收一个可变参数
List<String> list = Arrays.asList("hello","world"); //可接收0个或多个参数
注意:因为转换后list集合仍是数组,所以长度不可变,故使用删除和添加时报错
I:遍历Iterator
通过集合获取迭代器对象
迭代器有两个常用方法
1、boolean hasNext()如果仍有元素可以迭代,则返回true
2、next()返回迭代的下一个元素--》取出集合中的下一个元素
Collection c = new ArrayList();
Iterator i = c.Iterator();
while(i.hasNext()) {
System.out.println(i.next());
}
二十、List集合,List实现了Collection,下面是List特有功能
特点:集合中的元素是有序、可重复的。
A:添加功能
void add(int index, Object element); //在指定位置添加元素
B:获取功能
Object get(int index); //获取指定位置的元素
C:列表迭代器
ListIterator listIterator(); //List集合特有的迭代器
D:删除功能
Object remove(int index); //根据索引删除元素,返回被删除的元素
E:修改功能
Object set(int index, Object element): //根据索引修改元素,返回被修改的元素。
练习:
//有一个集合,判断是否有world这个元素,如果有,就添加一个"javaee"元素
list.add("java");
Iterator it = list.iterator();
while(it.hasNext()) {
String str = (String)it.next();
if("world".equals(str)) {
list.add("javaee");
}
//以上代码报错:java.util.ConcurrentModificationException
产生原因:
迭代器是依赖于集合存在的,在判断成功后,集合中新添加了元素,而迭代器不知道,所以报错,这个错叫并发修改异常
问题描述:使用迭代器遍历元素的时候,通过集合是不能修改元素的
解决方案
A:使用迭代器迭代元素,迭代器添加元素,Iterator迭代器中没有添加方法,使用子类ListIterator
新添加的元素跟在刚才判断的元素后面
B:集合遍历元素,集合添加元素(通过for循环遍历)
元素在最后添加
二十一、数据结构
A:栈:特点,先进后出
B:队列:特点,先进先出
C:数组:特点,查询快,增删慢
D:链表:特点,查询慢,增删快
二十二、List子类的特点
ArrayList:
底层数据结构是数组,查询快,增删慢
线程不安全,效率高
Vector
底层数据结构是数组,查询快,增删慢
线程安全,效率低
LinkedList
底层数据结构是链表,查询慢,增删快
线程不安全,效率高
二十三、泛型:一般用于集合中,查看API文档,类和接口后面跟着<>就可以使用
是一种把类型明确的工作推迟到创建对象或者调用方法的时候才去明确的特殊类型,参数化类型,把类型当做参数一样传递
格式:ArrayList<String> list = new ArrayList<String>();
好处:
A:把运行时期的问题提前到了编译期间
B:避免了强制类型转换
C:优化了程序设计,解决了黄色警告线
for(int i = 0; i < obj.length; i++) {
Student s = (Student)obj[i]; //有了泛型可以修改为 Student s = obj[i],因为已经明确类型是Student了
System.out.println(s.getName() + "----" + s.getAge());
}
二十四、泛型应用
A:泛型类
格式:public class 类名<泛型类型...> ;如public class ObjectTool<T>
注意:泛型类型必须是引用类型
B:泛型方法
格式:public <T> void show(T t); //可以接收任意类型,也就是t可以是任意类型的参数
C:泛型接口
//第一种情况在实现的时候就确定是什么类型,很少用
public class Inter implements InterImpl<String>{
public void show(String str) {
System.out.println(str);
}
}
//第二种情况,在实现的时候不确定什么类型
public class Inter<T> implements InterImpl<T>{
@Override
public void show(T t) {
System.out.println(t);
}
}
D:泛型高级(通配符)
? :表示任意类型,如果没有明确,那么就是Object以及任意的java类
? extends E:向下限定,E及其子类
? super E:向上限定,E及其父类
1、 //如果明确泛型的话,前后要保持一致
Collection<String> co = new ArrayList<String>();
Collection<String> co1 = new ArrayList<Integer>(); //报错
2、//?表示任意类型都可以
Collection<?> co2 = new ArrayList<Object>();
Collection<?> co3 = new ArrayList<Animal>();
Collection<?> co4 = new ArrayList<Dog>();
Collection<?> co5 = new ArrayList<Cat>();
3、//? extends E:向下限定,?代表E及其子类
Collection<? extends Object> co6 = new ArrayList<Object>();
Collection<? extends Animal> co7 = new ArrayList<Animal>();
Collection<? extends Animal> co8 = new ArrayList<Dog>();
Collection<? extends Animal> co9 = new ArrayList<Cat>();
二十五、set集合(子类:HashSet、LinkedHashSet、TreeSet)
特点:无序,不可重复;无序指的是存储和取出顺序不同
A:子类HashSet跟hashCode和equal方法相关的类
存储字符串的时候,重复字符串只会存储一次,是 因为String类重新了hashCode和equal方法
存储对象的时候,需要在该对象类中重新hashCode和equal方法,可以通过Eclipse自动生成
B:子类LinkedHashSet
特点:底层数据结构由哈希表和链表组成
哈希表保证元素的唯一性
链表保证元素有序,(存储和取出的顺序一致)
C、子类TreeSet
特点:能够对元素按照某种规则进行排序,元素唯一
排序有两种方式
1:(元素具有比较性)根据元素的自然顺序对元素进行排序(一个类要实现自然排序,就要实现自然排序的接口)
真正的比较是依赖于元素的compareTo()方法,而这个方法是定义在Comparable里面的
所以,要想重写该方法,就必须是先实现Comparable接口,这个接口表示的就是自然排序
2:(集合具有比较性)或者根据创建set时提供的Comparator(比较器)进行排序,具体取决于使用的构造方法
使用TreeSet(Collection<? extends E> c)构造方法排序时,要自己建一个类实现
Comparator接口并重写compare()方法。
D:TreeSet底层是二叉树结构
1、元素的存储:第一个元素存储的时候,直接作为根节点存储
从第二个元素开始,每个元素从根节点开始比较
大了,放右边;小了放左边,相等不做处理
2、元素的取出:从根节点开始,按照左中右的原则依次取出
二十六、针对Collection集合我们到底使用谁?
唯一吗?
是:set
排序吗?
是:TreeSet
否:HashSet
如果你知道是Set,但是不知道是哪个Set,就用HashSet
否:List
要安全吗?
是:Vector
否:ArrayList或者LinkedList
查询多:ArrayList
增删多:LinkedList
如果你知道是List,但不知道是哪个List,那么就使用ArrayList
如果你知道是Collection集合,但是不知道使用谁,就用ArrayList
如果你知道用集合,就用ArrayList
二十七、Map集合(HashMap和TreeMap两个主要子类)
A、 添加功能
V put(K key, V value); 添加元素,
如果键是第一次存储,就直接存储元素,返回null
如果键不是第一次存储,就用值把以前的值替换掉,返回以前的值
eg://添加元素
System.out.println(map.put("zhangsan", "lisi")); //null
System.out.println(map.put("zhangsan", "wangwu"));//lisi
System.out.println(map.put("wanger", "xiaoyi")); //null
B、删除功能
void clear();移除所有的键值对元素
V remove(Object key); 根据键删除键对应的元素,并把键对应的值返回
eg:System.out.println(map.remove("wanger")); //xiaoyi
C、判断功能
boolean containsKey(Object key); 判断集合是否包含指定的键
boolean containsValue(object value); 判断集合是否包含指定的值
boolean isEmpty(); 判断集合是否为空
D、获取功能
Set<Map.Entry<K,V>> entrySet();
V get(Object key); 根据键获取值
eg:System.out.println("get = " + map.get("wanger")); //返回xiaoyi
Set<K> keySet(); 获取集合中所有键的集合
eg:Set<String> set = map.keySet();
Collection<V> values(); 获取集合中所有值的集合
eg:Collection<String> coll = map.values();
E、长度功能
int size(); 返回集合中键值对的对数
二十八、IO
File类
A、创建功能
1、boolean createNewFile(); //创建文件,如果存在这个文件,就不创建了
2、boolean mkdir(); //创建文件夹,如果存在了就不创建了
3、boolean mkdirs(); //同时创建多层文件夹,如(E:aa\bb\cc),如果存在就不创建
使用方法如下:
File file = new File("E:\\aaa\\bb"); //先创建File对象
System.out.println(file.mkdirs());
B、删除功能
public boolean delete();
1、如果创建文件对象时没有写路径,默认在项目路径下
2、Java删除不走回收站
3、要删除一个文件夹,文件夹内不能有文件或者文件夹,有的话要一层层删除。
C、重命名
public boolean renameTo(File dest)
例:File file = new File("E:\\aaa");
File newfile = new File("E:\\addddddddddddddddd");
System.out.println(file.renameTo(newfile));
如果file和newfile路径相同,就改名
如果路径不同,就改名并剪切
D、判断功能
public boolean isDirectory(); //判断是否是目录
public boolean isFile(); //判断是否是文件
public boolean exists(); //判断是否是存在
public boolean canRead(); //判断是否是可读
public boolean CanWrite(); //判断是否是可写
public boolean isHidden(); //判断是否是隐藏
例:File file = new File("E:\\aaa");
file.isDirectory;
E、普通获取功能
public String getAbsolutePath() //获取绝对路径
public String getPath() //获取相对路径
public String getName() //获取名称
public long length() //获取长度(文件的大小,字节数)
public long lastModified() //获取最后一次的修改时间,以毫秒为单位
把毫秒转换成当前时间
Date d = new Date("毫秒值");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
F、高级获取功能,获取指定目录下面所有的文件名
public String[] list(); //获取指定目录下的所有文件或文件夹的名称数组
public File[] listFiles(); //获取指定目录下的所有文件或文件夹的File数组
二十九、IO流分类
A、按流向分
1、输入流,读数据(相对于程序,如通过程序读取硬盘上的文件。)
2、输出流,写数据
B、按类型分(默认按类型分)
1、字节流
InputStream //是所有字节输入流的超类(抽象类)
OutputStream //是所有字节输出流的超类
2、字符流
Reader //是所有字符输入流的超类(抽象类)
Writer //是所有字符输出流的超类
三十、OutputStream 字节输出流(写数据)
A、构造方法
1、FileOutputStream(File file)
2、FileOutputStream(String name)
3、FileOutputStream(File file, boolean append) //后面参数为true时,表示追加写入,即从文件的末尾写入
4、FileOutputStream(String name, boolean append) //不追加,表示从文件的开头写入
B、字节输出流操作步骤
1、创建字节输出流对象
使用以上1、2两种构造方法
a、 File file = new File("D:\\test\\1.txt");
FileOutputStream fos = new FileOutputStream(file);
b、 FileOutputStream fos = new FileOutputStream("D:\\test\\1.txt");
2、写数据
fos.write("hello".getBytes()); //write(byte[] b) write方法接收byte数组,需要把字符串转换成byte数组
3、释放资源
for.close();
为什么一定要close()呢
1、让流对象编程垃圾,这样就可以被垃圾回收器回收了
2、通知系统去释放该文件相关的资源
三十一、InputStream 字节输入流(读数据)
A、构造方法
1、FileInputStream(String name)
B、字节输入流操作步骤
1、创建字节输入流对象
FileInputStream fis = new FileInputStream("D:\\test\\1.txt");
2、读数据--》 int read();每次读一个字节,返回int类型,类似于迭代器中的next()方法。
int a = 0;
while((a = fipt.read()) != -1) { //-1,如果到达文件末尾,则返回-1
System.out.print((char)a);
}
3、释放资源
for.close();
eg://复制文本文件,从1.txt复制文件内容到2.txt;
FileInputStream fipt = new FileInputStream("D:\\BaiduNetdiskDownload\\java视频\\day20\\day20\\1.txt");
FileOutputStream fopt = new FileOutputStream("D:\\BaiduNetdiskDownload\\java视频\\day20\\day20\\2.txt");
int a = 0;
while((a = fipt.read()) != -1) {
fopt.write(a);
}
C:在计算机中中文的存储分为两个字节:
第一个字节肯定是负数
第二个字节场景的是负数,可能有正数,但是没影响
//int read(byte[] byte) 一次读取一个字节数组, 返回值int表示实际读取的字节个数
FileInputStream fis = new FileInputStream("1.txt");
byte[] by = new byte[5];
int len = 0;
while((len = fis.read(by)) != -1) {
System.out.print(new String(by, 0, len));
}
//缓冲区读取数据,速度更快
public static void method3(String srcFile, String deskFile) throws Exception {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile));
BufferedOutputStream bops = new BufferedOutputStream(new FileOutputStream(deskFile));
int a = 0;
while((a = bis.read()) != -1) {
bops.write(a);
}
bis.close();
bops.close();
}
public static void method4(String srcFile, String deskFile) throws Exception {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(deskFile));
byte[] by = new byte[1024];
int len = 0;
while((len = bis.read(by)) != -1) {
bos.write(by, 0, len);
}
bis.close();
bos.close();
}
三十二、OutputStreamWriter //字符输出流(又叫字符转换流),是Writer子类
A、五种写数据的方法
1、public void write(int c) //写一个字符
2、public void write(char[] cbuf) //写一个字符数组
3、public void write(char[], int off, int len) //写一个字符数组的一部分
4、public void write(String str) //写一个字符串
5、public void write(String str, int off, int len) //写一个字符串的一部分
ps:写完数据之后必须执行,flush()或者close()方法,才能把数据成功写入文本文件
因为,字符 = 2个字节, 文件中数据存储的基本单位是字节,所以FileOutputStream可以直接写入
close()方法,关闭并刷新流
B、两种读的方式,InputStreamReader();一次读一个字符和一次读一个字符数组
InputStreamReader isr = new InputStreamReader(new FileInputStream("1.txt"));
//方法一
/*int len = 0;
while((len = isr.read()) != -1) {
System.out.print((char)len);
}*/
//方法二
int len = 0;
char[] ch = new char[1024];
while((len = isr.read(ch)) != -1) {
System.out.print(new String(ch, 0, len));
}
*****因为以上两种字符转换流类名比较长,所以产生了两个子类FileReader和FileWriter*****
三十三、BufferedWirter和BufferedInput
//两种创建对象的方式
//BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("aa.txt")));
BufferedWriter bw = new BufferedWriter(new FileWriter("a.txt"));
B、字符缓冲流的特殊方法
BufferedWriter
public void newLine(); 根据系统来决定换行符,
BufferReader
public String readLine(); 一次读取一行数据
包含该行内容的字符串,不包含任何行中支付,如果已经到达流末尾,则返回null
例:
public static void reader() throws Exception {
BufferedReader br = new BufferedReader(new FileReader("999.txt"));
String st = null;
while((st = br.readLine()) != null) {
System.out.println(st);
}
br.close();
}
public static void writer() throws Exception {
BufferedWriter bw = new BufferedWriter(new FileWriter("999.txt"));
for(int i = 0; i < 10; i++) {
bw.write("hello" + i);
bw.newLine(); //会根据不同的操作系统进行换行
bw.flush(); //一般写、换行、缓冲一起操作
}
bw.close();
}
C、BufferedReader子类LineNumberReader有两个方法
getLineNumber(); //获取行号
setLineNumber(); //设置当前行号
例:
LineNumberReader lr = new LineNumberReader(new FileReader("student.txt"));
String st = null;
while((st = lr.readLine()) != null) {
System.out.println(lr.getLineNumber() + ":" + st);
}
三十四、IO小结
字节流 字符流
输入流 输入流
InputStream(抽象类) Reader(抽象类)
实际使用: 实际使用:
FileInputStream InputStreamReader(太长,使用子类FileReader)
BufferedInputStream BufferedReader //特殊方法 String readLint() 一次读取一行数据
输出流 输出流
OutputStream(抽象类) Writer(抽象类)
实际使用: 实际使用:
FileOutputStream OutputStreamWriter(太长,使用子类FileWriter)
BufferedOutputStream BufferedWriter //特殊方法 void newLine(); //写入换行符号
字节流复制数据:4种方式
字符流复制数据:5种方式,多了一个Buffered中的特殊方法
三十五、Thread
注意:同一个Thread线程对象只能调用一次start()方法,再次调用报错IllegalThreadStateException,因为线程已经启动了,
再次调用,表示又要启动一次,所以报错
A、设置线程名称
//方法一
MyThread my1 = new MyThread(); //MyThread()自定义的线程类,继承Thread,重新run()方法,run方法的内容为多进程执行的代码
my1.setName("aaa"); //调用setName方法,给线程指定名称
my1.start(); //start的方法有两个作用,启动多线程,并调用run()方法
//方法二
MyThread my1 = new MyThread("aaa"); //使用构造方法指定进程名称,MyThread要定义一个接收name的构造方法
my1.start();
public MyThread(String name) { //MyThread要定义一个接收name的构造方法
super(name);
}
B、针对不是Thread子类如何获取线程对象的名称
public static Thread currentThread(); //返回当前正在执行的线程对象
如:System.out.println(Thread.currentThread().getName()); 执行结果为main
C、线程优先级的设置
1、默认优先级是5
优先级范围是[1, 10]
优先级仅仅表示线程获取的CPU时间相对较高,并不是所优先级高的线程一定先执行完
2、如何获取线程对象的优先级
public final int getPriority(); 返回线程对象的优先级
3、设置线程对象的优先级
public final void setPriority(int newPriority); 更改线程的优先级
D、线程控制
1、线程休眠
public static void sleep(long millis);
使用方法: Thread.sleep(1000); 表示进程暂停1000毫秒
2、等待线程结束
public final void join();
使用方法, 对象名.join(); 表示当该对象执行完之后,其他进程对象才开始执行
并且该方法在start方法之后调用,因为只有启动了才可以结束
3、暂停线程
public static void yield();暂停当前正在执行的线程对象,并执行其他进程
在run()方法中调用 让多个进程执行的更加和谐,但不能保证一人执行一次
4、守护线程
public final void setDaemon(boolean on);将该线程标记为守护线程或用户线程
当正在运行的线程都是守护线程时,java虚拟机退出,该方法必须在启动线程前调用
如有三个线程,线程1、2设置为守护线程,当线程3执行完毕后,线程1、2也会结束,但不会立刻结束
5、中断线程
public void interrupt(); 中断线程,把线程的状态终止,并抛出InterruptibleChannel
在启动线程之后执行
public class ThreadStopTest001 {
public static void main(String[] args) {
StopThread stopThread = new StopThread();
stopThread.start();
//如果stopThread线程执行超过3秒,就关闭该线程,关闭该进程也会执行线程后面的代码
try {
Thread.sleep(3000);
stopThread.interrupt();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
class StopThread extends Thread {
public void run() {
System.out.println("线程启动" + new Date());
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
System.out.println("线程终止");
}
System.out.println("线程结束" + new Date());
}
}
执行结果:线程启动Sun Jul 08 18:45:56 CST 2018
线程终止
线程结束Sun Jul 08 18:45:59 CST 2018
E:创建线程的第一种方式:继承Thread类
步骤:
a、定义类继承Thread
b、复写Thread类中的run方法
c、调用线程的start方法
该方法有两个作用:启动线程,调用run方法。
创建线程的第二中方式:实现Runnable接口
步骤:
a、定义MyRunnable类实现Runnable接口
b、覆盖Runnable接口中的run方法
将线程要运行的代码存放在该run方法中
c、创建MyRunnable类的对象
d、通过Thread类建立线程对象
e、将Runnable接口的子类对象作为实际参数传递给Thread类的构造函数
为什么要将Runnable接口的子类对象传递给Thread的构造函数
因为,自定义的run方法所属的对象是Runnable接口的子类对象
所以要让线程去指定对象的run方法。就必须明确该run方法所属对象。
f、调用Thread类的start方法开启线程并调用Runnable接口子类的run方法
public class ThreadRunnableTest {
public static void main(String[] args) {
ThreadRunnable tr = new ThreadRunnable();
Thread t1 = new Thread(tr);
Thread t2 = new Thread(tr);
t1.start();
t2.start();
}
}
class ThreadRunnable implements Runnable {
public void run() {
for(int i = 0; i < 500; i++) {
System.out.println(Thread.currentThread().getName() + " " + i);
}
}
}
第二种实现方式的好处:避免了单继承,降低了耦合性,易于扩展,推荐使用第二种方式
F、线程安全问题(卖票案例,会出现同票多卖,和负数票的问题)
class SellTicker implements Runnable {
private int ticker = 100;
@Override
public void run() {
while(ticker > 0) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "正在出售第 : " + ticker-- + "张票");
}
}
}
产生原因:
1、是否是多线程 是
2、是否有共享数据 是
3、是否存在多条语句操作共享数据 是
(因为问题1和2改变不了,所以只能改变问题3,思路是:把多条语句操作共享数据的代码包成一个整体,
让某个线程在执行的时候,别人不能执行)
解决线程安全的方法一:java提供了:同步机制;
使用同步代码块解决,格式如下:
synchronized(对象) {需要同步的代码;} //其中对象可以是任意对象
private Object obj = new Object();
@Override
public void run() {
synchronized(obj) {
需要同步的代码;
}
}
G、同步的特点
同步的前提:
必须要有两个或两个以上的线程
必须是多个线程使用同一个锁
好处:解决了多线程的安全问题
弊端:多个线程需要判断锁,较为消耗资源
H、同步函数 ---synchronized修饰的函数为同步函数
格式如下:
public synchronized void add(int i)
三十九、多线程(概念、理解)
A、多线程:一个应用程序有多条执行路径
进程:正在执行的应用程序
线程:进程的执行单元,执行路径
单线程:一个应用程序只有一条执行路径
多线程:一个应用程序有多条执行路径
多进程的意义?
提高CPU的使用率
多线程的意义?
提高应用程序的使用率
B、Java程序的运行原理及JVM的启动是多线程的吗?
1、Java命令去启动JVM,JVM会启动一个进程,该进程会启动一个主线程
2、JVM的启动是多线程的,因为它最低有两个线程启动了,主线程和垃圾回收线程
四十、JDK5之后的Lock锁
创建子类对象,Lock是接口。
Lock lock = new ReentrantLock();
//加锁
lock.lock();
需要加锁的代码
//释放锁
lock.unlock();
四十一、多个类同时使用同一对象,实现方法如下
实现方法:在外界把这个对象创建出来,然后通过构造方法传递给其他的类
Student ss = new Student();
SetThread st = new SetThread(ss);
GetThread gt = new GetThread(ss); //以上代码,使SetThread和GetThread类访问了同一个对象ss
四十二、网络编程
A、网络编程的三要素
1、IP地址
2、端口(0-65535)
3、协议
UDP:
把数据打包
数据有限制,大小限制在64K
不建立连接,不可靠
速度快
TCP:
建立连接通道
数据无限制
速度慢,可靠
B、public static InetAddress getByName(String host);根据主机名或IP地址的字符串获取地址对象
public String getHostAddress();获取主机的IP
public String getHostName(); 获取主机的名称
C、Socket编程,网络编程,又叫套接字编程
Socket包含了:IP地址 + 端口号
Socket原理机制:
通信的两端都有Socket
网络通信其实就是Socket间的同学
数据在两个Socket间通过IO传输
D、UDP协议发送数据
1、创建发送端Socket对象
DatagramSocket ds = new DatagramSocket();
2、创建数据,并把数据打包
//DatagramPacket(byte[] buf, int offset, int length, InetAddress address, int port)
//创建数据
byte[] by = "hello,你好".getBytes();
//长度
int length = by.length;
//IP地址对象
InetAddress in = InetAddress.getByName("JXL-ycm");
//端口
int port = 10000;
DatagramPacket p = new DatagramPacket(by, length, in, port);
3、调用Socket对象的发送方法发送数据包
//public void send(DatagramPacket p);
ds.send(p);
4、释放资源
E、UDP协议接收数据
1、创建接收端Socket对象
DatagramSocket ds = new DatagramSocket(10000); //调用DatagramSocket(int port)构造方法
2、创建一个数据包(接收容器)
byte[] buf = new byte[1024];
int length = buf.length;
DatagramPacket dp = new DatagramPacket(buf, length); //用来接收长度为 length 的数据包。
3、调用Socket对象的接收方法接收数据包
ds.receive(dp);
4、解析数据,并显示在控制台
InetAddress in = dp.getAddress(); //getAddress(),返回接收/发送主机对象
String ip = in.getHostAddress();
byte[] by = dp.getData(); //getData(),返回数据缓冲区
int len = dp.getLength(); //getLength(),返回将要发送或接收到的数据的长度。即实际的数据长度
String s = new String(by, 0, len);
System.out.println(ip + "---" + s);
5、释放资源
ds.close();
F、TCP协议发送数据
1、创建发送端的Socket对象
Socket so = new Socket("JXL-ycm", 1234);
2、获取输出流,写数据
OutputStream out = so.getOutputStream();
out.write("nihaoTCP".getBytes());
3、释放资源
so.close();
G、TCP协议接收数据
1、创建接收端的Socket对象
ServerSocket ss = new ServerSocket(1234);
2、监听客户端连接,返回一个对应的Socket对象
Socket s = ss.accept();
3、获取输入流,读取数据并显示在控制台
InputStream in = s.getInputStream();
byte[] by = new byte[1024];
int len = in.read(by);
String str = new String(by, 0, len);
System.out.println(str);
4、释放资源(关闭客户端对象,而不是关闭服务器对象)
s.close();
|
eda3dec24c7a5d3920e18a547e403b4a9c7bfc43 | 449d555969bfd7befe906877abab098c6e63a0e8 | /965/CH2/EX2.72/72.sci | 07e63fedb5f1b5148209fc9129276669dc2f827a | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 502 | sci | 72.sci | clc;
clear all;
disp("heat flow through wire")
k=0.12;// W/(m*C)
r1=2/2;//mm
r2=r1+0.8;//mm
ho=35;// W/(m^2*K)
rc=1000*k/ho;//mm
disp("mm",rc,"critical radius of insulation =")
disp("i) heat flow through an insulated wire")
Rthcd=(log(r2/r1))/k;
Rthcv=1000/(ho*r2);
Rth12=Rthcd+Rthcv;
//Q12=2*pi*L*(t1-tair)/Rth12;
Rthcd=(log(rc/r1))/k;
Rthcv=1000/(ho*rc);
Rth1c=Rthcd+Rthcv;
//Q1c=2*pi*L*(t1-tair)/Rth1c;
//(Q1c-Q12)/Q12*100
change=(1/Rth1c-1/Rth12)*100/(1/Rth12)
disp("%")
|
53a1c9bcdb326ab7ee43b5e3a91dd4fd8411798d | d63acd02651109079a842c5d5f44fa51a23a2e12 | /test.tst | 0d77becc2c1467464411780ea5156a8185a177a7 | [] | no_license | HeroNani/mycode | 3cae27f7120b8447b3108df94eaf041a625a0ed3 | 258a9e9dbe4a6affed687e8898bd4bd3afec32e4 | refs/heads/master | 2021-05-02T07:51:39.339128 | 2019-02-20T15:48:08 | 2019-02-20T15:48:08 | 120,840,073 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 211 | tst | test.tst | sd lkjasd l;kajsd lkasd
sdg
sdf g
dsf gs
df gs
df
g
df gsdf g
sdf
g
sd
fgs
df g
spp
-- test.lua 文件末尾注释-- test.lua 文件末尾注释-- test.lua 文件末尾注释-- test.lua 文件末尾注释 |
1b4b865adb40fb03b4853158e7c9365676cd8f4a | 449d555969bfd7befe906877abab098c6e63a0e8 | /476/CH7/EX7.10/Example_7_10.sce | 4f86bae7f1f94cb54a3ccced3ce791d9187a8b7e | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 655 | sce | Example_7_10.sce | //A Textbook of Chemical Engineering Thermodynamics
//Chapter 7
//Properties of Solutions
//Example 10
clear;
clc;
//Given:
K = 4.4*10^4; //Henry's law constant (bar)
pp = 0.25; //partial pressure of oxygen in bar
M_O2 = 32; //molecular wt of oxygen
M_water = 18; //molecular wt of water
//To estimate the solubility of oxygen in water at 298 K
//Using eq. 7.72 (Page no. 275)
x_O2 = pp/K; //mole fraction of O2
mprintf('Solubility of oxygen is %5.4e moles per mole of water',x_O2);
//In mass units
sol_O2 = (x_O2*M_O2)/M_water;
mprintf('\n Solubility of oxygen in mass units is %4.3e kg oxygen per kg water',sol_O2);
//end |
4383ef1fed2a7101fc03c139d77dad7bdb88a937 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1052/CH20/EX20.7/207.sce | 355a45fa030a5f76c58c09d6534754d7b3843505 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 618 | sce | 207.sce | clc;
//Example 20.7
//page no 276
printf("\n Example 20.7 page no 276\n\n");
//refer to illustrative Example 20.5
//(1)
//we have to calculate minimum air ventilation flow rate into the room containing 10 ng/m^3 of a toxic chemical
//ng means nanograms
rV=250//chemical generated in the laboratory,ng/min
c_o=10//room containg toxic chemical of 10ng/m^3
c=35//limit of chemical concentration,ng/m^3
//applicable modal in this case
//q_o(c_o-c) + rV =V*dc/dt
//substituting gives
q_o=(-rV)/(c_o-c)//minimum air ventilation flow rate
printf("\n q_o min. air ventilation flow rate=%f m^3/min",q_o);
|
958c0a9f0a504593d7cd13b0493ae1972ddbb387 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3137/CH3/EX3.11/Ex3_11.sce | 20ed04db39207834647ea1dfa62221ed3ee8ba4b | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 510 | sce | Ex3_11.sce | //Initilization of variables
F1=150 //lb
F2=80 //lb
F3=100 //lb
F4=50 //lb
theta1=((45*%pi)/180) //radians
r=3 //units
//Calculations
Fh=F1-F3*cos(theta1) //lb
Fv=F4-F2-F3*sin(theta1) //lb
R=sqrt(Fh^2+Fv^2) //lb
//Applying the Varignons Theorem
a=(F4*r-F1*r+F2*r-F3*r)/R //units
//Result
clc
printf('The resultant of the force system is:%f lb \n',R) //lb
printf('The resultant acts at %f units form the point O',a) //units
//Negative sign indicates a negative moment caused by the resultant
|
565b5f38e1969325ac0b5e687d42616cba7bc8e1 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1529/CH13/EX13.5/13_05.sce | 53c53829bc05e9a2493ebcea26aabd3a00009022 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,501 | sce | 13_05.sce | //Chapter 13, Problem 5, figure 13.16
clc;
E1=4; //e.m.f source 1
E2=2; //e.m.f source 2
R=4 //resistor
r1=2; //internal resistance 1
r2=1; //internal resistance 2
Rr2=(R*r2)/(R+r2); //equivalent resistance
//calculating I2, I3, I4, I5, I6 by using current division formula
I1=E1/(r1+Rr2);
I2=(r2/(R+r2))*I1;
I3=(R/(R+r2))*I1;
Rr1=(R*r1)/(R+r1);
I4=E2/(Rr1+r2);
I5=(r1/(R+r1))*I4;
I6=(R/(R+r1))*I4;
printf("Redraw the original circuit with sourceE2 removed,being replaced by r2 only, as shown in Fig. 13.17(a)\n\n");
printf("From the equivalent circuit of Fig. 13.17(a) and (b),\n");
printf("I1 = %.3f A\n",I1);
printf("I2 = %.3f A\n",I2);
printf("I3 = %.3f A\n\n\n",I3);
printf("Redraw the original circuit with sourceE1 removed, being replaced by r1 only, as shown in Fig. 13.18(a)\n\n");
printf("From the equivalent circuit of Fig. 13.18(a) and (b)\n")
printf("I4 = %.3f A\n",I4);
printf("I5 = %.3f A\n",I5);
printf("I6 = %.3f A\n\n",I6);
printf("Superimpose Fig. 13.18(a) on to Fig. 13.17(a) as shown in Fig. 13.19\n\n");
printf("Resultant current flowing through source 1 = %.3f A (discharging)\n",I1-I6);
printf("Resultant current flowing through source 2 = %.3f A (charging)\n",I4-I3);
printf("Resultant current flowing through resistor R = %.4f A\n\n",I2+I5);
printf("The resultant currents with their directions are shown in Fig. 13.20");
|
b9fb408193698f0b5a90367f1e3cc8f2334dadf9 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2921/CH12/EX12.2/Ex12_2.sce | 5ef68a3f67d6f45c04c3158a42d29e661bdd6a88 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 193 | sce | Ex12_2.sce | clc;
clear;
mprintf('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-12.2 Page No.256\n');
//Surface speed
Dp=2.5;
n=1725;
Vm=%pi*Dp*n/12;
mprintf('\n Surface speed = %f ft/min.',Vm);
|
8082eda5599d34ad209471d4effb2b4906231d48 | 717ddeb7e700373742c617a95e25a2376565112c | /40/CH8/EX8.24/Exa_8_24.sce | 5ad54e146c76bd05ab8d1b548fc101feccee2c21 | [] | no_license | appucrossroads/Scilab-TBC-Uploads | b7ce9a8665d6253926fa8cc0989cda3c0db8e63d | 1d1c6f68fe7afb15ea12fd38492ec171491f8ce7 | refs/heads/master | 2021-01-22T04:15:15.512674 | 2017-09-19T11:51:56 | 2017-09-19T11:51:56 | 92,444,732 | 0 | 0 | null | 2017-05-25T21:09:20 | 2017-05-25T21:09:19 | null | UTF-8 | Scilab | false | false | 422 | sce | Exa_8_24.sce | //The importance of Periodic extension
//(a)For M=3
x=[1 2 1];
XDFT=dft(x,-1)
w=exp(-%i*2*%pi/3);
for i=1:3
for j=1:3
WN(i,j)=w^((i-1)*(j-1));
end
end
WI=WN';
xn=1/3*WI*XDFT
//The result is periodic with M=3 & 1 period equals x[n]
//(b)For M=4
y=[1 2 1 0];
YDFT=dft(y,-1)
w=exp(-%i*%pi/2);
for i=1:4
for j=1:4
WN(i,j)=w^((i-1)*(j-1));
end
end
WI=WN';
yn=1/4*WI*YDFT
|
2c4cbd58c6b4f4eed979dc7ab5e1562d284970a4 | 449d555969bfd7befe906877abab098c6e63a0e8 | /620/CH12/EX12.6/example12_6.sce | 94a7330d31f413bd47c348e1f36063b0af7850ea | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 227 | sce | example12_6.sce | im=0.05;
v=5;
rm=3;
disp("Part a");
rt=v/im;
disp("the total resistance (in kΩ) of the meter is"); disp(rt);
disp("Part b");
rs=rt-rm;
disp("the necessary resistance (in kΩ) of the voltmeter multiplier is"); disp(rs); |
d9e1f5ed5f1fcb422050af5ce543571fc86e3823 | 0812f3bb6f3cc038b570df68ccee4275da04b11f | /models/complexity_1000/Applied_Thermodynamics_and_Engineering/CH3/EX3.10/3_10.sce | 799ad9a4172257f1e3215e3874c2b1ab3223361a | [] | no_license | apelttom/20-semester_PhD_thesis | edc0b55580bae9d364599932cd73cf32509f4b7a | ff28b115fcf5e121525e08021fa0c02b54a8e143 | refs/heads/master | 2018-12-26T22:03:38.510422 | 2018-12-14T20:04:11 | 2018-12-14T20:04:11 | 106,552,276 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 255 | sce | 3_10.sce | clc;
h3=2716.4;//kJ/kg
hf2=640;
h_fg2=2109;
x2=(h3-hf2)/(h_fg2);
flow_rate=9;
m_w2=(1-x2)*(flow_rate);
mass_water=0.5;
m_w1=m_w2+mass_water
flow_rate_dry=mass_water+flow_rate-m_w1;
x1=flow_rate_dry/(mass_water+flow_rate);
disp("fraction is:");
disp(x1)
|
a3e088050327e91800a2a97cd2f8a0fb6492f7bc | 383d7e4e7497262c502a37604756a2305bd9c1d1 | /root_calculation_methods.sce | 6bf35bfd5e9d3be261724a0baa064cd12ed20583 | [] | no_license | JoaoMagal/Scilab-Math-Functions | 3dce9c494c6ff99266425cbf25a4c8229a17e02d | 350350bbf015eb758f14687622091da28a33da77 | refs/heads/master | 2022-02-17T23:37:06.786756 | 2019-09-02T13:13:51 | 2019-09-02T13:13:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 4,485 | sce | root_calculation_methods.sce | function bissect(func, a, b, errmargin, maxn)
if (sign(func(a)) ~= sign(func(b))) then // If f(a) and f(b) have opposite signs
n = 1
x_n = (a + b) / 2
if (func(x_n) == 0) then // If the first X is root
disp("found on the first midpoint", string(x_n), "Absolute root of f:")
disp(string(func(x_n)), "Value of f(x): ")
else
while((abs(func(x_n)) > errmargin) && (n < maxn)) do
if (sign(func(x_n)) == sign(func(a))) then
// If f(x_n) has the same sign as f(a)
a = x_n
else
// If f(x_n) has opposite sign as f(a)(aka same sign as f(b))
b = x_n
end
disp([n, xn])
x_n = (a + b) / 2 // X update
n = n + 1 // Iteration count increment
end
disp("iterations.", string(n),"found in", string(x_n), "Approximated root of f:")
disp(string(func(x_n)), "Value of f(x_n):")
end
else // If f(a) and f(b) doesnt have opposite signs
error("Invalid function/interval")
end
endfunction
function bissect_min_iterations(a, b, tol)
n = ((log(abs((b - a) / tol))) / log(2)) - 1
disp(n, "Minimum number of iterations for interval and tolerance:")
endfunction
function regula_falsi(func, a, b, errmargin, maxn)
if (sign(func(a)) ~= sign(func(b))) then // If f(a) and f(b) have opposite signs
n = 1
x_n = (a*abs(func(a)) + b*abs(func(b))) / (abs(func(a)) + abs(func(b)))
if (func(x_n) == 0) then // If the first X is root
disp("found on the first midpoint", string(x_n), "Absolute root of f:")
disp(string(func(x_n)), "Value of f(x): ")
else
while((abs(func(x_n)) > errmargin) && (n < maxn)) do
if (sign(func(x_n)) == sign(func(a))) then
// If f(x_n) has the same sign as f(a)
a = x_n
else
// If f(x_n) has opposite sign as f(a)(aka same sign as f(b))
b = x_n
end
disp([n, x_n])
x_n = (a*abs(func(a)) + b*abs(func(b))) / (abs(func(a)) + abs(func(b))) // X update
n = n + 1 // Iteration count increment
end
disp("iterations.", string(n),"found in", string(x_n), "Approximated root of f:")
disp(string(func(x_n)), "Value of f(x_n):")
end
else // If f(a) and f(b) doesnt have opposite signs
error("Invalid function/interval")
end
endfunction
function fixed_point(func, x, maxn, tol)
x0 = x
xn = 0
n = 1
while (n < maxn)
xn = func(x0)
if (abs(xn - x0) <= tol) then
break
else
disp([n, xn])
x0 = xn
n = n + 1
end
end
if (n >= maxn) then
disp("Solution not found; Could not achieve convergence within the defined max number of iterations.")
else
disp(xn, "Convergence number:")
disp(n, "Number of iterations:")
end
endfunction
// FOR NEWTON-RAPHSON METHOD:
// Case 1: f" > 0 e (f(a) < 0 e f(b) > 0) --> x0 = b
// Case 2: f" > 0 e (f(a) > 0 e f(b) < 0) --> x0 = a
// Case 3: f" < 0 e (f(a) < 0 e f(b) > 0) --> x0 = a
// Case 4: f" < 0 e (f(a) > 0 e f(b) < 0) --> x0 = b
// x0 equals a or b such as f(x0) * f"(x0) > 0
function newton_raphson(func, deriv, x, maxn, tol)
xn = x
n = 1
h = (func(xn)/deriv(xn))
disp("Iteration; xn; f(xn)/g(xn);")
while (abs(h) >= tol && n < maxn) do
h = (func(xn)/deriv(xn))
xn = xn - h
disp([n xn h])
n = n + 1
end
disp(xn, "Root:")
disp(n, "Number of iterations:")
endfunction
function secant(func, x0, x1, maxn, tol)
n = 1
xn2 = x0
xn1 = x1
xn = (xn2 * func(xn1) - xn1*func(xn2)) / (func(xn1) - func(xn2))
disp("Iteration; xn+1; xn; xn-1;")
while (abs(func(xn)) > tol && n < maxn) do
xn2 = xn1;
xn1 = xn;
xn = (xn2 * func(xn1) - xn1*func(xn2)) / (func(xn1) - func(xn2))
disp([n xn xn1 xn2])
n= n + 1
end
if (n >= maxn) then
disp("Root does not exist")
else
disp(xn, "Root: x = ")
end
endfunction
|
2be306a40d399ba6957115b602b6b0bfb8b2b662 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3472/CH44/EX44.4/Example44_4.sce | a70a815817f915aa29fefba613cdbcd350f76063 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 940 | sce | Example44_4.sce | // A Texbook on POWER SYSTEM ENGINEERING
// A.Chakrabarti, M.L.Soni, P.V.Gupta, U.S.Bhatnagar
// DHANPAT RAI & Co.
// SECOND EDITION
// PART IV : UTILIZATION AND TRACTION
// CHAPTER 6: MOTORS FOR ELECTRIC TRACTION
// EXAMPLE : 6.4 :
// Page number 791
clear ; clc ; close ; // Clear the work space and console
// Given data
F_t = 33800.0 // Tractive effort(N)
V = 48.3 // Velocity(kmph)
T = 53400.0 // Tractive effort(N)
// Calculations
HP = F_t*V*1000/(60*60*746) // HP on level track(hp)
HP_i = HP*(T/F_t)**0.5 // hp delivered by locomotive for dc series motor(hp)
HP_ii = HP*T/F_t // hp delivered by locomotive for induction motor(hp)
// Results
disp("PART IV - EXAMPLE : 6.4 : SOLUTION :-")
printf("\nhp delivered by the locomotive when dc series motor is used = %.f HP", HP_i)
printf("\nhp delivered by the locomotive when induction motor is used = %.f HP", HP_ii)
|
e11162a34416888b6f5f4e73f201e2b01358d716 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1655/CH4/EX4.3.1/Example_4_3_1.sce | 3af0966493203b14af50733b288c0abfa898b347 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 810 | sce | Example_4_3_1.sce |
// Example 4.3.1 page 4.4
clc;
clear;
L=10; //fiber length in km
Pin=150d-6; //input power
Pout=5d-6; //output power
len=20; //length of optical link
interval=1; //splices after interval of 1 km
l=1.2; //loss due to 1 splice
attenuation=10*log10(Pin/Pout);
alpha=attenuation/L;
attenuation_loss=alpha*20;
splices_loss=(len-interval)*l;
total_loss=attenuation_loss+splices_loss;
power_ratio=10^(total_loss/10);
printf("\nSignal attenuation is %.2f dBs.\nSignal attenuation is %.3f dB/Km.\nTotal loss in 20 Km fiber is %.2f dbs.\nTotal attenuation is %.2f dBs.\ninput/output ratio is %e.",attenuation,alpha,attenuation_loss,total_loss,power_ratio);
printf("\nAs signal attenuation is approximately equal to 10^5, we can say that line is very lossy.");
|
ebb685363440394a347d425246c0584124469e58 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3204/CH14/EX14.22/Ex14_22.sce | 8aad11eba987b7796fcc97208778bdb223952b86 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 483 | sce | Ex14_22.sce | // Initilization of variables
P=50 // N // Weight of the car
Q=100 // N // Weight of the rectangular block
g=9.81 // m/s^2 // acc due to gravity
b=25 // cm // width of the rectangular block
d=50 // cm // depth of the block
// Calculations
a=(Q*g)/(4*P+2*Q) // m/s^2 // from eq'n 4
W=(Q*(P+Q))/(4*P+Q) // N // from eq'n 6
// Resuts
clc
printf('The maximum value of weight (W) by which the car can be accelerated is %f N \n',W)
printf('The acceleration is %f m/s^2 \n',a)
|
023e1c8faaf334fce8e14bed60ad167292d3a5ac | 449d555969bfd7befe906877abab098c6e63a0e8 | /3542/CH4/EX4.1/Ex4_1.sce | 0c86541db13612d470da0c74df8443858387b0a6 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 541 | sce | Ex4_1.sce | // Example 4.1
// To find far field distance for antenna with maximum dimensions and operating frequency
// Page No.109
clc;
clear all;
// Given data
D=1; // Maximum dimension in m
f=900*10^6; // Operating frequency in Hz
C=3*10^8; // Speed of light in m/sec
lambda=C/f; // Carrier wavelength in m
// To find far field distance
df=(2*D^2)/lambda; //Far field distance
//Displaying the result in command window
printf('\n Far field distance = %0.0f meter',df);
|
db3472303e0121286d907a288e21065d0a79ff1b | 449d555969bfd7befe906877abab098c6e63a0e8 | /3648/CH26/EX26.3/Ex26_3.sce | e08d3b89bab948e17aac987c71964c5ca04e837a | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 620 | sce | Ex26_3.sce | //Example 26_3
clc();
clear;
//To draw the energy level diagram and the find the first line of balmer type series
n=1
e1=-54.4/n^2 //units in ev
n=2
e2=-54.4/n^2 //units in ev
n=3
e3=-54.4/n^2 //units in ev
printf("The energy associated with line 1 is E1=%.1f eV\nThe energy associated with line 2 is E2=%.1f eV\nThe energy associated with line 3 is E3=%.2f eV\n",e1,e2,e3)
e1=1 //units in eV
e2=7.6 //Units in eV
lamda1=1240 //units in nm
lamda=(e1/e2)*lamda1 //Units in nm
printf("The first line of balmer series is lamda=%d nm and belongs to the ultraviolet region",lamda)
|
48e64ce5ee9852b750e175bfeda732f4445c798b | 449d555969bfd7befe906877abab098c6e63a0e8 | /1187/CH2/EX2.1/1.sce | 86f554e5dcd8b522c480d171d4c6c745a33eb2b4 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 453 | sce | 1.sce | clc
d=1.5; // m
m=1.2; // kg
rate=0.0065; // K/m
R=287; // J/(kg.K)
T_0=288.15; // K
p_0=101*10^3; // Pa
g=9.81; // m/s^2
rho=m/(%pi*d^3/6);
rho_0=p_0/R/T_0;
// log(rho/rho_0)=(g/R*rate - 1)*log((T_0-rate*z)/T_0)
z=1/rate*(T_0-T_0*exp(log(rho/rho_0)/(g/R/rate-1)));
disp("The height above sea level to which the ballon will rise = ")
disp(z)
disp("m")
printf("The height above sea level to which the ballon will rise = %f m", z) |
33ddfd6bd588db60951a4b441da0bbe9cdfcdd3f | 449d555969bfd7befe906877abab098c6e63a0e8 | /2858/CH11/EX11.4/Ex11_4.sce | 3dc05a2822ebe31a967a03a46da1dc0e83878c70 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 898 | sce | Ex11_4.sce | //example 11.4
clc; funcprot(0);
FS=4;
Ap=0.1295;
Nc=9;
cu2=100;
Qp=Ap*Nc*cu2;
D=[5, 10, 30];
avgD=[2.5, 7.5,20];
sigma=[45, 110.5, 228.5];
cu=[30, 30, 100];
alpha=[0.6 0.9 0.725];
L=[5, 5, 20];
p=%pi*0.406;
Qs=0;
disp(Qp,"bering capacity in kN");
printf("depth (m)\t avg Depth(m)\t avgVerticalStress(kN/m^2)\t cu(kN/m^2)\t cu/sigma\t alpha\n" )
for i=1:3
cusig(i)=cu(i)/sigma(i);
Qs=Qs+alpha(i)*cu(i)*L(i)*p;
printf("%.2f\t %.2f\t %.2f\t\t\t %.2f\t %.2f\t\t %.2f\n",D(i),avgD(i),sigma(i),cu(i),cusig(i),alpha(i));
end
disp(Qs,"bearing capacity in kN");
//part2
lambda=0.136;
L=30;
fav=lambda*(178.48+2*76.7);
Qs2=p*L*fav;
//part3
fav1=13;
fav2=31.9;
fav3=93.43;
Qs3=p*(fav1*5+fav2*5+fav3*20);
disp(Qs3,"bearing capacity in kN");
Qsavg=Qs/3+Qs2/3+Qs3/3;
Qu=Qp+Qsavg
Qall=Qu/FS;
disp(Qall,"allowed bearing capacity in kN");
|
ac7d0719b476acf7f9a8dc61b50e4ede3a08e07a | 449d555969bfd7befe906877abab098c6e63a0e8 | /3754/CH30/EX30.12/30_12.sce | 34e4ec5061e0fbf924e4147a2cbbb11d4e9e9116 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 695 | sce | 30_12.sce | clear//
//Variables
RD = 100.0 * 10**3 //Drain resistance (in ohm)
gm = 1.6 * 10**-3 //Transconductance (in Ampere per volt)
rd = 44.0 * 10**3 //Resistance (in ohm)
Cgs = 3.0 * 10**-12 //Capacitance gate-to-source (in Farad)
Cds = 1.0 * 10**-12 //Capacitance drain-to-source (in Farad)
Cgd = 2.8 * 10**-12 //Capacitance gate-to-drain (in Farad)
//Calculation
rL = RD * rd / (RD + rd) //a.c. load resistance (in ohm)
Av = -gm * rL //Voltage gain
//Result
printf("\n Voltage gain is %0.1f ",Av)
|
6ce273c5ae16044beae2dfa4374683aab9df13b4 | 449d555969bfd7befe906877abab098c6e63a0e8 | /998/CH29/EX29.66/Ex66.sce | dc767d22493ad15f0567e3803518d11f5b0da1b1 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 446 | sce | Ex66.sce | //Ex:66
clc;
clear;
close;
r=6378;//radius of earth in km
h=35786;// in km
r_h=r+h;//height in km
E_min=0;// in degree
P=cos(E_min*3.14/180);
Q=(r/(r_h)*P);
a_mx=(asin(Q))*(180/3.14);//the theoretical max coverage angle in degree
D=(r^2)+(r_h^2)-2*r*r_h*sin(a_mx*3.14/180);
d=sqrt(D);// in km
d1=ceil(d);//max slant range in km
printf("The theoretical max coverage angle=%f degree",a_mx);
printf("\n The max slant range=%d km",d1); |
cfa58936a7790ab931deb8737c98e131196f4355 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1583/CH4/EX4.6/FSNT_Ex_4_6.sce | 5784c48a64de5f93be1cd2e5bb48e725d542527e | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 521 | sce | FSNT_Ex_4_6.sce | clc
//Chapter 4:Frequency selective networks and transformers
//example 4.6 paga no 130
//given
Rs=10//source resistance
L=0.2*10^-6//inductor
f=20*10^6//given frequency
XL=(2*%pi*f*L)//inductive reactance
Rp=50//input impedance
Xs=sqrt(Rp*Rs-Rs^2)//series reactance
Xcs=5.1//series capacitive reactance
CS=(2*%pi*f*Xcs)^-1//series capacitance
Xp=(Rs^2+Xs^2)/Xs//equivalent parallel reactance
mprintf('the value of series reactance is j%f ohm \n the value equivalent parallel reactance is j%f ohm ',Xs,Xp)
|
e0e012513d304c3a0c712fa6569c3efb5b3169c9 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2417/CH9/EX9.14/Ex9_14.sce | 5e2c4933f197921791715791aad5e2c22c05283f | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 1,621 | sce | Ex9_14.sce | //scilab 5.4.1
clear;
clc;
printf("\t\t\tProblem Number 9.14\n\n\n");
// Chapter 9 : Gas Power Cycles
// Problem 9.14 (page no. 489)
// Solution
//A Brayton cycle
rc=7; //Compression Ratio Rc=v2/v3
k=1.4; //It is apparent incerease in compression ratio yields an increased cycle efficiency
cp=0.24; //Unit:Btu/(lbm*R) //Specific heat constant for constant pressure process
T3=1500; //(unit:fahrenheit) //peak tempeature
p1=14.7; //Unit:psia //Initial condition
T1=70+460; //temperatures converted to absolute temperatures; //Initial condition
R=53.3; //Unit:ft*lbf/lbm*R //constant of proportionality
nBrayton=1-((inv(rc))^(k-1)); //A Brayton cycle efficiency
printf("A Brayton cycle efficiency is %f percentage\n",nBrayton*100);
//If we base our calculation on 1 lbm of gas and use subscripts that corresponds to points (1),(2),(3) and (4) of fig.9.22,we have
v1=(R*T1)/p1; //Unit:ft^3/lbm //specific volume at point 1
//Because rc=7 then,
v2=v1/rc; //Unit:ft^3/lbm //specific volume at point 2
//After the isentropic compression, T2*v2^k-1 = T1*v1^k-1
T2=T1*(v1/v2)^(k-1); //Unit:R //temperature at point 2
T2=T2-460; //Unit:fahrenheit //temperature at point 2
qin=cp*(T3-T2); //Heat in //Unit:Btu/lbm
printf("The heat in is %f Btu/lbm\n",qin);
//Because efficiency can be stated to be work out divided by heat in,
wbyJ=nBrayton*qin; //The work out //Unit:Btu/lbm
printf("The work out is %f Btu/lbm\n",wbyJ); //Answer is wrong in the book.cause they have taken efficiency value wrong
printf("The heat rejected is %f Btu/lbm\n",qin-wbyJ); //Anser is affected because of value of wbyJ
|
c1308179ea24b357984dd784cfa8965864c71a2a | 449d555969bfd7befe906877abab098c6e63a0e8 | /23/CH11/EX11.10/Example_11_10.sce | f63a78f3701743565e6619f29e48303fbc3208c4 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 775 | sce | Example_11_10.sce | clear;
clc;
//To find Approx Value
function[A]=approx(V,n)
A=round(V*10^n)/10^n;//V-Value n-To what place
funcprot(0)
endfunction
//Example 11.10
//Caption : Program to Find the Excess Properties for a mixture
T0=298.15;//[K]
T=323.15;//[K]
Cp_E=-2.86;//[J/mol/K]
Ho_E=897.9;//[J/mol]
Go_E=384.5;//[J/mol]
//(a) Derivations
//G_E=-a*(T ln T - T)+ bT + c
//S_E=a ln T - b
//H_E=aT + c
//Where
//a=Cp_E
//c=Ho_E-aT0
//b=((Go_E+a(T ln T0 - T0)-c)/T0)
//(b)
a=Cp_E;
c=approx(Ho_E-(a*T0),1);
b=approx((Go_E+(a*((T0*log(T0))-T0)-c))/T0,4);
G_E=approx((-a*(T*log(T)-T))+(b*T)+c,1);
S_E=approx((a*log(T))-b,3);
H_E=approx((a*T)+c,1);
disp('J/mol',G_E,'G_E = ')
disp('J/mol/K',S_E,'S_E = ')
disp('J/mol',H_E,'H_E = ')
//End |
10a1192fa257b03d61700a9c031d92a760f9d60d | 449d555969bfd7befe906877abab098c6e63a0e8 | /3886/CH12/EX12.2/12_2.sce | 9e1744a7672d669ed432136e5a9c20813ac96f39 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 532 | sce | 12_2.sce | //Steel ball shot vertically up
//refer fig.12.6
//For upward motion
au=18 //m/sec
av=0
aa=-9.81 //m/sec^2
//s=h
//let t1 be the time required to reach maximum height
t1=1.83 //sec
h=(18^2)/(2*9.81) //m
//total height from the ground
ah=25+h //m
//Downward motion
bu=0
bs=41.51 //m
ba=9.81 //m/sec^2
v2=sqrt(2*9.81*41.51) //m/sec
t2=28.54/9.81 //m/sec
//total time during which the body is in motion
t=t1+t2 //sec
printf("\nt1=%.2f sec\nh=%.2f m\nv2=%.2f m/sec\nt2=%.2f sec\nt=%.2f sec",t1,h,v2,t2,t)
|
7a196582cb0d5f2a264e49c16160d78190da23be | 449d555969bfd7befe906877abab098c6e63a0e8 | /3717/CH12/EX12.6/Ex12_6.sce | 9d1f23a6faea2bcf8f5e398c377445ca63b14e77 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 345 | sce | Ex12_6.sce | // Ex12_6 Page:248 (2014)
clc; clear;
e = 1.6e-019; // Charge on an electron, C
n = 5e+028; // Number of atoms per unit volume of Cu, per metre-cube
R_H = -1/(n*e); // Hall coefficient, metre-cube/C
printf("\nThe Hall coefficient for Cu = %4.2e metre-cube/C", R_H);
// Result
// The Hall coefficient for Cu = -1.25e-10 metre-cube/C
|
cf5d8e39aa0669dccd0a15bd955591f610e5b499 | 8217f7986187902617ad1bf89cb789618a90dd0a | /source/2.5/macros/m2sci/replace_brackets.sci | bda3be0340496c72e305b567767aaef9f1b03c0f | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | clg55/Scilab-Workbench | 4ebc01d2daea5026ad07fbfc53e16d4b29179502 | 9f8fd29c7f2a98100fa9aed8b58f6768d24a1875 | refs/heads/master | 2023-05-31T04:06:22.931111 | 2022-09-13T14:41:51 | 2022-09-13T14:41:51 | 258,270,193 | 0 | 1 | null | null | null | null | UTF-8 | Scilab | false | false | 313 | sci | replace_brackets.sci | function txt=replace_brackets(txt)
// Copyright INRIA
for k=1:size(txt,'r')
tk=txt(k)
ko=strindex(tk,'{')
if ko<>[] then
kf=strindex(tk,'}')
//create matching pairs
kw=[ko,kf]
for kk=1:size(ko,'*')
pchar=abs(str2code(part(tk,ko(kk)-1)))
if pchar<36 then // extraction
end
end
|
229f840aaac25aa26995c2acc46891515c1ba848 | 8965236683cecafded4c307c22f5b917ce36263f | /java-src/emulator/assembler/go.tst | 43e3f3b23979653e1772110d664edb53c39cc99d | [] | no_license | artagesw/FROIDZ | 67f484f6938fd16cb9e2e0aa7770b67dbfba2041 | 9498ba04651cc30053274f622d43ae20b03524f6 | refs/heads/master | 2016-09-06T13:50:26.181686 | 2012-05-21T22:59:49 | 2012-05-21T22:59:49 | 3,656,428 | 1 | 1 | null | null | null | null | UTF-8 | Scilab | false | false | 360 | tst | go.tst | 0100 0011 0000 0000 0001 0000 0100 1000
0100 0110 0000 0000 1000 0111 0001 0000
0100 0011 0000 0000 0001 0001 1111 1111
0100 0001 0000 0000 0001 0100 0001 0001
0100 0011 0000 0000 0001 0100 0000 0000
0100 0001 0000 0000 0001 1000 0001 0100
0100 0011 0000 0000 0001 0010 1111 1111
0100 0001 0000 0000 0001 1000 0001 0010
0101 0011 0000 0000 0000 0000 0000 0000
|
e06b4c88683b85d4b928a097eae185c651b746d7 | 01ecab2f6eeeff384acae2c4861aa9ad1b3f6861 | /sci2blif/sci2blif_added_blocks/pad_out.sce | 7ad8f5a88a7aaf7bfd9245c26232602db4d25e49 | [] | no_license | jhasler/rasp30 | 9a7c2431d56c879a18b50c2d43e487d413ceccb0 | 3612de44eaa10babd7298d2e0a7cddf4a4b761f6 | refs/heads/master | 2023-05-25T08:21:31.003675 | 2023-05-11T16:19:59 | 2023-05-11T16:19:59 | 62,917,238 | 3 | 3 | null | null | null | null | UTF-8 | Scilab | false | false | 1,255 | sce | pad_out.sce | //**************************** IO PAD OUT ******************************
if(blk_name.entries(bl)=='pad_out') then
fd_io= mopen (fname+'.pads','a+'); // DEDICATED PADS code
for ss=1:scs_m.objs(bl).model.ipar(1)
tmp_pad = strsplit(iopad_loc(loc_num,scs_m.objs(blk_objs(bl)).model.rpar(ss)).entries," ")
if tmp_pad(3) == '3' | tmp_pad(3)== '5' then tmp_pad(3) = '1';
elseif tmp_pad(3) == '2' then tmp_pad(3) = '0';
end
if tmp_pad(4)=='#int[5]'|tmp_pad(4)=='#int[4]'|tmp_pad(4)=='#int[3]'|tmp_pad(4)=='#int[2]'|tmp_pad(4)=='#int[1]'|tmp_pad(4)=='#int[0]' then
mputl('out:net'+ string(blk(blk_objs(bl),2)) + "_" + string(ss) + ' ' + iopad_loc(loc_num,scs_m.objs(blk_objs(bl)).model.rpar(ss)).entries,fd_io);
else
mputl('out:net'+ string(blk(blk_objs(bl),2)) + "_" + string(ss) + ' ' + iopad_loc(loc_num,scs_m.objs(blk_objs(bl)).model.rpar(ss)).entries + 'tgate[' + tmp_pad(3)+ ']',fd_io);
end
if scs_m.objs(blk_objs(bl)).model.rpar(ss)==56 then
Counter_class=1;
end
// disp(iopad_loc(loc_num,scs_m.objs(blk_objs(bl)).model.rpar(1+ss)).entries)
// disp(scs_m.objs(blk_objs(bl)).model.rpar(1+ss))
end
mclose(fd_io);
end
|
785f1fa8dac0bd4bd6e8c251c9f3caa2527335be | cc3bff70280a1ee19aaf881e852ab1d5a8a1014d | /Experiment No.3 - PDF of different random variable.sce | b273b9104b67990b09206ceb85c49fe21ebf8306 | [] | no_license | imdeepak27/Digital-Communication-Systems | 814380444ff466fdbd693318fdc25815abd85347 | e35a99437a63bb023e2d6468ecfb92633d6049e5 | refs/heads/master | 2022-06-18T01:07:37.718079 | 2020-05-13T04:26:12 | 2020-05-13T04:26:12 | 263,524,581 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 661 | sce | Experiment No.3 - PDF of different random variable.sce | clc;
clear;
u=input(" ");
v=input(" ");
disp("GAUSSIAN RANDOM VARIABLE");
disp("MEAN = "+string(u));
disp("VARIANCE = "+string(v));
x=-10:0.001:10;
N=1/sqrt(2*3.14*v)*exp(-(x-u)^2/(2*v));
figure(1);
plot(x,N);
xlabel("x");
ylabel("PROBABILITY DENSITY");
title("GAUSSIAN PDF");
a=input(" ");
b=input(" ");
disp("UNIFORM RANDOM VARIABLE");
disp("MINIMUM VALUE OF RANDOM VARIABLE = "+string(a));
disp("MAXIMUM VALUE OF RANDOM VARIABLE = "+string(b));
x=a-5:0.001:b+5;
for i=1:length(x);
if x(i)>=a&x(i)<=b;
u(i)=1/(b-a);
else
u(i)=0;
end
end
figure(2);
plot(x,u);
xlabel("x");
ylabel("PROBABILITY DENSITY");
title("UNIFORM PDF");
|
4c1d99a8b1d21ccc61d7b38486f81ce135c3ead5 | 127061b879bebda7ce03f6910c80d0702ad1a713 | /bin/PIL_read_mat.sci | e2a914427e10fcb3e6b066a40a85e7c9e9f4effe | [] | no_license | pipidog/PiLib-Scilab | 961df791bb59b9a16b3a32288f54316c6954f128 | 125ffa71b0752bfdcef922a0b898263e726db533 | refs/heads/master | 2021-01-18T20:30:43.364412 | 2017-08-17T00:58:50 | 2017-08-17T00:58:50 | 100,546,695 | 0 | 1 | null | null | null | null | UTF-8 | Scilab | false | false | 3,348 | sci | PIL_read_mat.sci | // **** Purpose ****
// This is a read function of the standard output format of my library
// This format also consistent with my Fortran output format
// **** Variables ****
// [fid]: 1x1, integer
// <= your file ID
// [read_range]: 2x2, integer, default: read all data
// <= specify the range you want to read,ex:[3,10;7,12]
// [A]: NxM, integer, real or complex
// => you read data
// **** Version ****
// 02/07/2014 First Built
// 06/05/2014 auto read data type, no type input needed anymore
// 06/07/2014 add sparse and string matrix (separated by '#') format
// 04/26/2015 read row numbers
// **** Comment ****
// 1. illustration
// Helpful to pass and receive data with Fortran. It makes Scilab and
// Fortran well-integrated.
function [A]=PIL_read_mat(fid,read_range)
// determin starting point and size
while meof(fid)==0
read_data=mgetl(fid,1);
if length(grep(read_data,['PiLib Variable']))~=0 then
mgetl(fid,1);
mgetstr(6,fid);
order=mfscanf(1,fid,'%4d');
mgetstr(8,fid);
A_size(1)=mfscanf(1,fid,'%6d');
mgetstr(1,fid);
A_size(2)=mfscanf(1,fid,'%6d');
mgetstr(8,fid);
data_type=mfscanf(1,fid,'%s');
if data_type=='STRING' then
mgetl(fid,2);
else
mgetl(fid,4);
end
break;
end
end
[lhs,rhs]=argn();
if rhs==1 then
read_range=[1,A_size(1);1,A_size(2)];
end
r_size=read_range(1,2)-read_range(1,1)+1;
c_size=read_range(2,2)-read_range(2,1)+1;
tot_column=A_size(2);
A=zeros(r_size,c_size);
mgetl(fid,read_range(1,1)-1);
select data_type
case 'INTEGER'
for n=1:r_size
mfscanf(1,fid,'%6d');
mfscanf(read_range(2,1)-1,fid,'%d ')
A(n,:)=(mfscanf(c_size,fid,'%d '))';
if read_range(2,2)< tot_column then
mgetl(fid,1);
end
end
case 'REAL'
for n=1:r_size
mfscanf(1,fid,'%6d');
mfscanf(read_range(2,1)-1,fid,'%f ')
A(n,:)=(mfscanf(c_size,fid,'%f '))';
if read_range(2,2)< tot_column then
mgetl(fid,1);
end
end
A=A*10^(order);
case 'COMPLEX'
A=zeros(r_size,c_size);
B=zeros(r_size,c_size*2);
for n=1:r_size
mfscanf(1,fid,'%6d');
mfscanf(2*(read_range(2,1)-1),fid,'%f ')
B(n,:)=(mfscanf(2*c_size,fid,'%f '))';
if read_range(2,2)< tot_column then
mgetl(fid,1);
end
end
for n=1:c_size
A(:,n)=B(:,2*n-1)+%i*B(:,2*n)
end
A=A*10^(order);
case 'SPARSE'
if rhs~=1 then
disp('Warning: PIL_read_mat, sparse format cannot assign read range!');
end
A=mfscanf(A_size(1),fid,'%f %f %f %f')
A(:,1:2)=round(A(:,1:2));
A(:,3)=A(:,3)+%i*A(:,4);
A=A(:,1:3);
A(:,3)=A(:,3)*10^(order);
A=sparse(PIL_sparse(A,'sparse','all'));
case 'STRING'
A=emptystr(A_size(1),A_size(2));
for n=1:A_size(1)
A(n,:)=PIL_str_split(mgetl(fid,1));
end
A=A(read_range(1,1):read_range(1,2),read_range(2,1):read_range(2,2));
end
endfunction
|
fa755cd6be41d1623420aa7c9bf8a5ec42b27edc | 013fbb3c74956eb0dd76e916566c11e5823feef4 | /projects/02/Ng16.tst | ca722267888510757fa1c5c28c8e587f09246519 | [] | no_license | btesf/nand_to_tetris | f0831cbaa41bacedacdef8975d1497f224c0ac55 | 5f418a3e191b89c7f32e35f3ae6180c3b506ce73 | refs/heads/master | 2023-05-28T00:08:37.728944 | 2021-06-19T17:09:22 | 2021-06-19T17:09:22 | 356,931,420 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 296 | tst | Ng16.tst | load Ng16.hdl,
output-file Ng16.out,
compare-to Ng16.cmp,
output-list a%B1.16.1 out%B1.1.1;
set a %B0000000000000000,
eval,
output;
set a %B1111111111111111,
eval,
output;
set a %B1010101010101010,
eval,
output;
set a %B0011110011000011,
eval,
output;
set a %B0001001000110100,
eval,
output; |
54f984ef1fe097442047d873d5aa88696ed8513b | 2c2dc93267283e4aebcffffd5bd76e19ddcf5cc7 | /output/KNN/resultadoKNN4.tst | ed9ef972743369f923c019f46ccc0437eaa6f645 | [] | no_license | joseangeldiazg/probabilistic_keel | c9cf4ddc2cf750cbbeca88e6f84218084892ae1f | 6c5ddf8c98cc7431d523b291e521d1e8607dc662 | refs/heads/master | 2020-05-21T12:26:41.754863 | 2017-01-08T10:29:44 | 2017-01-08T10:29:44 | 55,733,275 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 787 | tst | resultadoKNN4.tst | @relation ecoli
@attribute Mcg real [0.0, 89.0]
@attribute Gvh real [1.0, 88.0]
@attribute Lip real [1.0, 48.0]
@attribute Chg real [1.0, 5.0]
@attribute Aac real [0.0, 88.0]
@attribute Alm1 real [1.0, 94.0]
@attribute Alm2 real [0.0, 99.0]
@attribute Site {cp, im, imS, imL, imU, om, omL, pp}
@data
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp pp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
cp cp
im im
im imU
im im
im imU
im im
im im
im im
im im
im im
im im
im im
im im
im imU
im im
im im
im im
imL omL
imU im
imU im
imU imU
imU imU
imU imU
imU im
imU imU
om om
om om
om om
om om
omL omL
pp pp
pp om
pp pp
pp im
pp pp
pp pp
pp pp
pp pp
pp pp
pp pp
|
54ae549ce5fcdf559b6c6f79cc6b0bd83b9a4e00 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1184/CH2/EX2.13/Ex2_13.sce | ccab0150561a3b4f23c03d5c8d37cd0c2a077ad3 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 148 | sce | Ex2_13.sce | //Example 2-13, Page No - 40
clear
clc
pout_db =12.3
pout_mW = 0.001*10^(12.3/10)
printf('The output power is %.1f mW',pout_mW*10^3)
|
9914a8719bfbe47d31b7600c915db3a90d4e7fa4 | 8781912fe931b72e88f06cb03f2a6e1e617f37fe | /scilab/final/wave_intro/wave1d.sce | 7274ee5e5bb816eba1735681469ff5c6ca0cedde | [] | no_license | mikeg2105/matlab-old | fe216267968984e9fb0a0bdc4b9ab5a7dd6e306e | eac168097f9060b4787ee17e3a97f2099f8182c1 | refs/heads/master | 2021-05-01T07:58:19.274277 | 2018-02-11T22:09:18 | 2018-02-11T22:09:18 | 121,167,118 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 509 | sce | wave1d.sce | //1d wave
//return a 1d vector of wave amplitudes
function [wave1d]=wave1d(time, wavetype, maxamplitude, wavenumber, wavefreq,delta, n)
wave1d=zeros(n);
k=wavenumber;
//stationary/standing wave
if wavetype == 0 then
for i=1:n
wave1d(i)=maxamplitude*sin((k*i*delta))*sin(wavefreq*time);
end
//travelling/progressive wave
elseif wavetype == 1 then
for i=1:n
wave1d(i)=maxamplitude*sin(((k*i*delta))-(wavefreq*time));
end
end
endfunction
|
0961d1b9d6382c24a88e0fbdf17e4897997820f7 | 18137e490b85726a353b3039386d13ce07cee8d6 | /Hack Computer/Assembly Language Programs/Program1/Program1.tst | 3ff25a6ed30fc9031e06c74201b372bffc613adc | [] | no_license | saha-nab2001/Hack-ALU-and-Hack-CPU-in-HDL | 087c9d59a9032ac4a145b8f899364ee9d6a6d74d | 3b1c461aa0f331ce7d7505b6ad9b0eab70f102e3 | refs/heads/main | 2023-06-15T16:59:24.758610 | 2021-07-19T15:50:45 | 2021-07-19T15:50:45 | 387,511,878 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 681 | tst | Program1.tst | load HackComputer.hdl,
output-file Program1.out,
output-list time%S1.4.1 reset%B2.1.2 ARegister[0]%D1.7.1 DRegister[0]%D1.7.1 PC[]%D0.4.0 RAM64[16]%D1.7.1 RAM64[17]%D1.7.1 RAM64[18]%D1.7.1 RAM64[19]%D1.7.1;
ROM32K load Program1.hack,
output;
// First run (at the beginning PC=0)
set RAM64[16] 3,
set RAM64[17] 4,
set RAM64[18] 5,
repeat 8 {
tick, tock, output;
}
// Reset the PC
set reset 1,
set RAM64[16] 0,
set RAM64[17] 0,
set RAM64[18] 0,
set RAM64[19] 0,
tick, tock, output;
//Second run, to check that the PC was reset correctly.
set reset 0,
set RAM64[16] 9,
set RAM64[17] 3,
set RAM64[18] 13,
repeat 8 {
tick, tock, output;
}
|
673a192e6e7cdfe1001e57b560a520cd88960be0 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1962/CH2/EX2.6/example2_6.sce | 2b5636d78e6e1f41acec712f4ae12b19f75db922 | [] | no_license | FOSSEE/Scilab-TBC-Uploads | 948e5d1126d46bdd2f89a44c54ba62b0f0a1f5e1 | 7bc77cb1ed33745c720952c92b3b2747c5cbf2df | refs/heads/master | 2020-04-09T02:43:26.499817 | 2018-02-03T05:31:52 | 2018-02-03T05:31:52 | 37,975,407 | 3 | 12 | null | null | null | null | UTF-8 | Scilab | false | false | 319 | sce | example2_6.sce | //example 2.6
//page 66
clc; funcprot(0);
//initialisation of variable
Gamma=9810;
ybar=5+0.5;
pi=3.14;
theta=90/180*pi;
Ig=pi*1^4/64;//moment of Inertia
A=pi*1^2/4;
F=Gamma*A*ybar;//force
hbar=ybar+Ig*(sin(theta))^2/A/ybar;//centroid
F1=F*(hbar-5);
disp(F1,"Force required to open the gate (N)");
clear
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.