blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 214 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 6 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 21 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 141k 586M ⌀ | star_events_count int64 0 30.4k | fork_events_count int64 0 9.67k | gha_license_id stringclasses 8 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 50 values | src_encoding stringclasses 23 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 1 class | length_bytes int64 5 10.4M | extension stringclasses 29 values | filename stringlengths 2 96 | content stringlengths 5 10.4M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
208ac1f1fc9513c5ae01fd257bb794f0941f29fe | 449d555969bfd7befe906877abab098c6e63a0e8 | /32/CH7/EX7.11/7_11.sce | ec34820f5b2c32bab356540b8871df266960a9fc | [] | 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 | 530 | sce | 7_11.sce | //pathname=get_absolute_file_path('7.11.sce')
//filename=pathname+filesep()+'7.11-data.sci'
//exec(filename)
//Heat removed(in kJ):
Q=500
//Temperature of the heat reservoir(in K):
T1=835
//Temperature of the system(in K):
T2=720
//Temperature of surroundings(in K):
T0=280
//Availability for heat reservoir(in kJ/kg.K):
A1=T0*Q/T1
//Availability for system(in kJ/kg.K):
A2=T0*Q/T2
//Net loss of available energy(in kJ/kg.K):
Anet=A1-A2
printf("\nRESULT")
printf("\nLoss of available energy = %f kJ/kg.K",-Anet) |
f10d680317feec446cbee6f5cd0397e46c8e3a87 | f5bb8d58446077a551e4d9a6461a55255db523fe | /ajuste_de_curvas/calc1.sce | 4cd1b0bd1d425be6367150c480ae5ee17e16623a | [] | no_license | appositum/numerical-calculus | 6be1a9990a1621c705af6ba5694cf8c7b891d06e | 7759e74ce9ce5c5826f96be7de84a2f7ecb97c91 | refs/heads/master | 2021-07-19T18:19:09.336819 | 2018-11-27T21:52:36 | 2018-11-27T21:52:36 | 143,060,426 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 504 | sce | calc1.sce | // ajuste linear
xs = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
ys = [1.3; 3.5; 4.2; 5.0; 7.0; 8.8; 10.1; 12.5; 13.0; 15.6]
a11 = 10
a12 = sum(xs)
a21 = a12
a22 = sum(xs.^2)
A = [a11, a12; a21, a22]
b1 = sum(ys)
b2 = sum(xs.*ys)
b = [b1; b2]
X = inv(A)*b
a0 = X(1)
a1 = X(2)
function y=f(x)
y = a0 + a1.*x
endfunction
axes = get("default_axes");
axes.x_location = "origin";
axes.y_location = "origin";
t = 0:0.05:11
plot(t, f(t))
plot2d(xs, ys, -4)
err = sum((ys - f(xs)).^2)
printf("Erro: %g\n", err)
|
4976fda207d8d182c5c043b618231279641e4d10 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2129/CH1/EX1.21.4/ex1_21_4.sce | 16ac42e889e28a94185577fa9f52044575449e6b | [] | 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 | 317 | sce | ex1_21_4.sce | // Exa1.21.4
clc;
clear;
close;
// Given data
Rho = 0.3623 * 10^-3;// in Ohm m
Sigma = 1/Rho;//in mho/m
D = 4.42 * 10^28;// Ge density in atom/m^3
n_d = D / 10^6;// in atom/m^3
e = 1.6 * 10^-19;// in C
Mu = Sigma/(n_d * e);// in m^2/V.sec
disp(Mu,"The mobility of electron in germanium in m^2/V.sec is");
|
a2cf3d902999c8123c229666aad0432d1f42ae79 | 449d555969bfd7befe906877abab098c6e63a0e8 | /635/CH5/EX5.15/Ch05Ex15.sci | c31f9d002b80b16598f454f7d1657885ed1f7447 | [] | 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,200 | sci | Ch05Ex15.sci | // Scilab Code Ex5.15 Determining applied tensile stress in a direction to initiate plastic deformation: Page-170 (2010)
tau_critical = 0.7; // Critical resolved shear stress for fcc crystal, MPa
// For directions [100] and [1 1 1]
h1 = 1; k1 = 0; l1 = 0; // Miller indices for first set of planes
h2 = 1; k2 = 1; l2 = 1; // Miller indices for second set of planes
cos_phi = (h1*h2+k1*k2+l1*l2)/(sqrt(h1^2+k1^2+l1^2)*sqrt(h2^2+k2^2+l2^2)); // Cosine of angle between [100] and [1 1 1] directions
// For directions [1 0 0] and [1 -1 0]
h1 = 1; k1 = 0; l1 = 0 // Miller indices for first set of planes
h2 = 1; k2 = -1; l2 = 0; // Miller indices for second set of planes
cos_lambda = (h1*h2+k1*k2+l1*l2)/(sqrt(h1^2+k1^2+l1^2)*sqrt(h2^2+k2^2+l2^2)); // Cosine of angle between [1 0 0] and [1 -1 0] directions
sigma_c = tau_critical/(cos_phi*cos_lambda); // The critical resolved shear stress in the [1 -1 0] direction on the (1 1 1) plane, MPa
printf("\nThe critical resolved shear stress in the [1 -1 0] direction on the (1 1 1) plane = %3.1f MPa", sigma_c);
// Result
// The critical resolved shear stress in the [1 -1 0] direction on the (1 1 1) plane = 1.7 MPa |
67655bfbd63b6847e2358dd8cdaad0738b2072e2 | cab1992a709a3eb977bef46f17eadab0c7bbbc5f | /modeling_simulation/ofc_adaptation.sce | 009f5a410e4357e08e7eb168f07bc56e9aa8c60b | [] | no_license | andreinakagawa/neuroscience | 80ab70cfc2c7df7d7891373cc9c889b4b8f83dd6 | 681125f0e1248269665749ed8bf17d5cfe6c2fda | refs/heads/master | 2021-06-07T09:37:51.810764 | 2017-10-05T11:32:03 | 2017-10-05T11:32:03 | 15,914,740 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 4,804 | sce | ofc_adaptation.sce | //------------------------------------------------------------------------------
// FEDERAL UNIVERSITY OF UBERLANDIA
// Faculty of Electrical Engineering
// Biomedical Engineering Lab
// Uberlandia, Brazil
//------------------------------------------------------------------------------
// Author: Andrei Nakagawa, MSc
// Contact: andrei.ufu@gmail.com
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Kalman filter
function [xplus,pplus] = kalman(F,G,H,Q,R,xk,pk,yk,uk)
//time update (prediction)
xminus = F*xk + G*uk;
pminus = F*pk*F' + G*Q*G';
//measurement update (correction)
measureError = yk - (H*xminus);
kalmanGain = pminus*H' * inv(H*pminus*H' + R);
//state estimate
xplus = xminus + kalmanGain * measureError;
//covariance
pplus = pminus - kalmanGain*H*pminus;
endfunction
//------------------------------------------------------------------------------
//States
//Position and velocity in X
//Position and velocity in Y
//Inputs
//Force in X and Y
function [Ac,Bc,Cc] = pointMassModel(m)
Ac = [0 1 0 0; 0 0 0 0; 0 0 0 1; 0 0 0 0];
Bc = [0 0; 1/m 0; 0 0; 0 1/m];
Cc = eye(size(Ac,1),size(Ac,2))
endfunction
//------------------------------------------------------------------------------
[A,B,C] = pointMassModel(1);
//------------------------------------------------------------------------------
//Simulation parameters
t0=0;
tf=3;
dt = 0.01;
t = t0:dt:tf;
//Continuous-time system
contSys = syslin('c',A,B,C);
//Discrete-time system
discSys = dscr(contSys,dt);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Weight matrices
Qd=diag([0.1,0.1,0.1,0.1]);
Rd=diag([0.01,0.01]);
//Discrete riccati
Ad = discSys(2); //A
Bd = discSys(3); //B
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Differential Riccati Equation - Discrete-time
//Calculating the solution to riccati for each instant in time
//and then finding the time-varying gain for each time step
//------------------------------------------------------------------------------
Sdisc = [];
Kdisc = [];
S0 = diag([500,0,120,0]); //Estimate for the Riccati matrix
for k=1:length(t)
//Calculating the time-varying gain
K = inv(Bd'*S0*Bd + Rd)*(Bd'*S0*Ad);
//New riccati solution
S0 = Ad'*S0*Ad - Ad'*S0*Bd*((Rd + Bd'*S0*Bd)^-1)*Bd'*S0*Ad + Qd;
//Stores the riccati solution
Sdisc = [Sdisc S0];
//Stores the gain
Kdisc = [Kdisc K];
end
//------------------------------------------------------------------------------
cont = 1;
//Desired setpoints or reference trajectory
xd = [0;0;5;0];
xint = []; //stores all the states during integration
uint = []; //stores all the inputs during integration
costQ = [0]; //cost of states
costR = [0]; //cost of control
x0 = [0;0;0;0]; //temporary variable for storing states
u0 = [0;0];
x = x0;
xint = [xint x0];
uint = [uint u0];
//Perturbation
//Rotation matrix
Ck = [cos((30*%pi)/180) 0 -sin((30*%pi)/180) 0; sin((30*%pi)/180) 0 cos((30*%pi)/180) 0];
yint = [x0];
yaux = x0;
//------------------------------------------------------------------------------
for k=1:length(t)-1
//Calculating the input
u = -Kdisc(:,cont:cont+3) * (x-xd);
//Calculating the new states
x = Ad*x + Bd*u;
//perturbation
y = Ck*x;
y = [y(1);0;y(2);0];
aux = [yint y];
yvx = diff(yint(1,:));
if yvx == [] then
yvx = 0;
end
yvy = diff(yint(3,:));
if yvy == [] then
yvy = 0;
end
yaux(1) = y(1);
yaux(2) = yvx($);
yaux(3) = y(3);
yaux(4) = yvy($);
yint = [yint yaux];
//Storing the new states
xint = [xint x];
//Storing the new inputs
uint = [uint u];
//Stores the cost in this step
costQ = [costQ (x-xd)'*Qd*(x-xd)];
//Stores the cost in this step
costR = [costR u'*Rd*u];
//Increments the counter to loop through the gain matrix
cont = cont + 4;
end
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
figure();
plot(xint(1,:),xint(3,:),'k');
plot(xint(1,$),xint(3,$),'k.');
plot(yint(1,:),yint(3,:),'b');
plot(x0(1),x0(3),'b.');
plot(xd(1),xd(3),'r.');
ax=gca();
ax.data_bounds=[-5 -5; 5 5];
figure();
plot(t,xint(2,:),'r');
plot(t,xint(4,:),'g');
plot(t,uint(1,:),'k');
plot(t,uint(2,:),'k');
figure();
plot(t,costQ,'r');
plot(t,costR,'b');
title("Cost");
//------------------------------------------------------------------------------
|
0897e360d1b530d2ad58dbdb67a7f24e00ed1442 | e9d5f5cf984c905c31f197577d633705e835780a | /GED/linear/scilab/functions/pmgei_method/method/pls/generate_pls_models_m.sci | 290cea1436a5c57c9a35a9c3aef860b1bae00e06 | [] | no_license | faiz-hub/dr-ged-benchmarks | 1ad57a69ed90fe7595c006efdc262d703e22d6c0 | 98b250db9e9f09d42b3413551ce7a346dd99400c | refs/heads/master | 2021-05-18T23:12:18.631904 | 2020-03-30T21:12:16 | 2020-03-30T21:12:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 5,023 | sci | generate_pls_models_m.sci | function [model,models_stat] = generate_pls_models_m( string_problem, nofstreams, nofeqps, train, validate, ndatarand,ndatainterval)
// streams model
models_stat = list();
total_train = nofstreams + nofeqps + 1; // total number of inputs
length_train = size(validate,'r');
total_validate = total_train + nofstreams + nofeqps; //total number of variables (input + outputs)
//pause
// create the PLS model with the 'train' dataset the inputs are:
// train(:,1:total_train) and the outputs are:
//train(:,total_train+1:$)
model = qpls(train(:,1:total_train),train(:,total_train+1:$),total_train,1,0); // create the PLS model with the 'train' dataset the inputs are:
//pause
// simulate the outputs from the generated mode, 'model', using the 'validate' dataset as input (validate(:,1:total_train)
//and compare with the outputs, (validate(:,(total_train + 1):total_validate))
[Y0hat, pred_error,abs_pred_error,mean_absolute_error,imax_error,max_error] =predictq(validate(:,1:total_train),model,model.stat.bestdirs, validate(:,(total_train + 1):total_validate));
//Yhat holds the predictions
//find the max value in the random error dataset which belongs to the measured streams
find_max_rand_meas = max(abs(Y0hat(1:ndatarand,1:nofstreams )));
//find the max value in the random error dataset which belongs to the leakings. They are separeted because of the magnitude of the random errorsi
find_max_rand_eqp = max(abs(Y0hat(1:ndatarand,nofstreams+1:$ )));
printf('\n find_max_rand_meas: %f', find_max_rand_meas)
printf('\n find_max_rand_eqp: %f \n' , find_max_rand_eqp)
for i = (total_train + 1):total_validate
// pause
model_s = struct();
// prediction
Y0hat_int = Y0hat(:,i - total_train);
predict_model.Y0hat = Y0hat_int;
Y0_int = validate(:,i);
predict_model.Y0 = Y0_int;
predict_model.pred_error = Y0hat_int - Y0_int;
predict_model.abs_pred_error = abs(Y0hat_int - Y0_int);
predict_model.mean_absolute_error = sum(abs((Y0hat_int - Y0_int)))/length_train;
[ predict_model.max_error, predict_model.imax_error] = max(abs(Y0hat_int - Y0_int));
// FIXME - CHECK FOR MULTIPLE ERRORS
// find_max_rand = max(abs(validate(1:ndatatrain,i )));
//pause
[find_simulated_error_i,find_simulated_error_j] = find(validate(:,i ) <> 0);
[not_simulated_error_i,not_simulated_error_j] = find(validate(:,i ) == 0);
find_simulated_error_j = unique(find_simulated_error_j);
not_simulated_error_j = unique (not_simulated_error_j);
min_lower = min(abs(Y0hat_int(find_simulated_error_i,find_simulated_error_j)));
//disp(' inside generate_pls_models: ')
//disp(i);
// [find_upper_i,find_upper_j] = find(abs(Y0hat_int(find_simulated_error_i,find_simulated_error_j)) >= min_lower) ;
// if i == 73 then
// pause
// else
// end
if length(find_simulated_error_i) > 0 then
if( i - (total_train) <= nofstreams ) then
[find_upper_i,find_upper_j] = find(abs(Y0hat_int(find_simulated_error_i,find_simulated_error_j)) >= find_max_rand_meas) ;
else
[find_upper_i,find_upper_j] = find(abs(Y0hat_int(find_simulated_error_i,find_simulated_error_j)) >= find_max_rand_eqp) ;
end
find_upper = length(find_upper_i )/length(find_simulated_error_i);
// aee = sum(abs(validate(find_simulated_error_i,i)) - abs(Y0hat_int(find_simulated_error_i,find_simulated_error_j)))/length(find_simulated_error_i);
aee = 100*abs(sum((validate(find_simulated_error_i,i) -Y0hat_int(find_simulated_error_i,find_simulated_error_j))./validate(find_simulated_error_i,i))/length(find_simulated_error_i));
else
find_upper = 0;
aee = -666;
end
// pause
if length(not_simulated_error_i) > 0 & length(min_lower) > 0 then
[find_lower_i,find_lower_j] = find(Y0hat_int(not_simulated_error_i,not_simulated_error_j) >= min_lower)
avti = length(find(abs(validate(1:ndatarand,i ))) >= min_lower);
find_lower = length(find_lower_i)/length(not_simulated_error_i);
else
find_lower = 1;
avti = -6666
end
// disp('before aee')
// pause
//
predict_model.false_detection = find_lower;
predict_model.selectivity = 1 - find_lower;
predict_model.correct_detection = find_upper;
predict_model.avti = avti;
predict_model.aee = aee;
// disp(i-total_train);
model_s.prediction = predict_model;
if (i - total_train) <= nofstreams then
model_s.name = ('model_' + string_problem + '_stream_' + string(i - total_train));
else
model_s.name = ('model_' + string_problem + '_leak_' + string(i - total_train - nofstreams));
end
models_stat(i - total_train) = model_s;
end
endfunction
|
4f57b5f8c8a03872261b59e542bf4ed4a98919c4 | 8217f7986187902617ad1bf89cb789618a90dd0a | /source/2.2/macros/metanet/plot_graph2.sci | b15389758b65646c6da6a895189aab5118f61115 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | 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 | 4,687 | sci | plot_graph2.sci | function []=plot_graph2(g,orx,ory,wx,hy)
//This function plot a graph with multiple arcs in the Scilab graphic window
//with the orientation of arcs
//It uses the data of the list defining the graph
[lhs,rhs]=argn(0)
// g
check_graph(g)
n=g('node_number');ma=g('edge_number');
xnodes=g('node_x');ynodes=g('node_y');
if (xnodes==[]|ynodes==[]) then
error('plot_graph1: coordinates of nodes needed for plotting');
return;
end
diam=g('default_node_diam'); if diam==[] then diam=20;end;
nodediam=g('node_diam');if nodediam==[] then nodediam=zeros(1,n);end;
ii=find(nodediam==0);nodediam(ii)=diam*ones(ii);ray=0.5*nodediam;
if rhs==1 then
lim=max(nodediam);
ah=min(xnodes);bh=max(xnodes);
av=min(-ynodes);bv=max(-ynodes);
enx=bh-ah;enx=max(enx,5.*lim);
eny=bv-av;eny=max(eny,5.*lim);
orx=ah+0.09*enx;wx=0.82*enx;
ory=av+0.05*eny;hy=0.9*eny;
else
if rhs<>5 then error(39), end
end
xsetech([0,0,1.0,1.0],[orx,ory,orx+wx,ory+hy]);
isoview(orx,orx+wx,ory,ory+hy);
nodecolor=nodediam
nodeborder=0*ones(1,n);
nodefontsize=23040.*ones(1,n);
// DEFINITION OF NODE PLOT
metarcs=[xnodes-ray;-ynodes+ray;nodecolor;nodediam;nodeborder;nodefontsize];
xset("use color",1);
ncolor=g('node_color')
if ncolor=[] then ncolor=0*ones(1,n);end;
vtail=g('tail');vhead=g('head');v=0*ones(1,ma);
spp=0*ones(n,n);
for i=1:ma
ii=vtail(i); kk=vhead(i);
spp(ii,kk)=spp(ii,kk)+1; at=spp(ii,kk)+spp(kk,ii)+0;v(i)=at
end
// PLOT OF STRAIGHT ARCS
edgecolor=g('edge_color');if edgecolor==[] then edgecolor=1*ones(1,ma);end;
ii=find(edgecolor==0);edgecolor(ii)=1*ones(ii);
for i=1:ma
if v(i)==1 then
x1=xnodes(vtail(i));x2=xnodes(vhead(i));
y1=ynodes(vtail(i));y2=ynodes(vhead(i));
txx(1,1)=x1;txx(2,1)=x2;
tyy(1,1)=-y1;tyy(2,1)=-y2;
xpolys(txx,tyy,-edgecolor(i));
enorm=sqrt((x2-x1)**2+(y2-y1)**2);
if enorm < 0.0000001 then enorm=1.;end;
lsin=(x2-x1)/enorm;lcos=(y2-y1)/enorm;
x1m=x1+0.5*(x2-x1)-6*lsin;y1m=y1+0.5*(y2-y1)-6*lcos;
x1mm=x1m-6*lcos;y1mm=y1m+6*lsin;
x2mm=x1m+6*lcos;y2mm=y1m-6*lsin;
x3mm=x1m+12*lsin;y3mm=y1m+12*lcos;
fr(1,1)=x1mm;fr(2,1)=x3mm;fr(3,1)=x2mm;
gr(1,1)=-y1mm;gr(2,1)=-y3mm;gr(3,1)=-y2mm;
xpolys(fr,gr,-edgecolor(i));
end
end;
// PLOT OF CURVED ARCS WITH ARROWS
for i=1:ma
if v(i)<>1 then
ii=vtail(i); kk=vhead(i);
x1=xnodes(ii);y1=ynodes(ii);x2=xnodes(kk);y2=ynodes(kk);
x1p=x1+0.25*(x2-x1);y1p=y1+0.25*(y2-y1);
x2p=x2-0.25*(x2-x1);y2p=y2-0.25*(y2-y1);
iv=v(i);ivv=((-1)**iv)*round(iv/2)*sign(kk-ii);epai=10.*ivv;
enorm=sqrt((x2-x1)**2+(y2-y1)**2);
if enorm < 0.0000001 then enorm=1.;end;
lsin=(x2-x1)/enorm;lcos=(y2-y1)/enorm;
x1m=x1+0.5*(x2-x1)-6*lsin;y1m=y1+0.5*(y2-y1)-6*lcos;
x1pp=x1p-epai*lcos;y1pp=y1p+epai*lsin;
x2pp=x2p-epai*lcos;y2pp=y2p+epai*lsin;
x1m=x1m-epai*lcos;y1m=y1m+epai*lsin;
x1mm=x1m-6*lcos;y1mm=y1m+6*lsin;
x2mm=x1m+6*lcos;y2mm=y1m-6*lsin;
x3mm=x1m+12*lsin;y3mm=y1m+12*lcos;
fr(1,1)=x1mm;fr(2,1)=x3mm;fr(3,1)=x2mm;
gr(1,1)=-y1mm;gr(2,1)=-y3mm;gr(3,1)=-y2mm;
xpolys(fr,gr,-edgecolor(i));
ar(1,1)=x1;ar(2,1)=x1pp;ar(3,1)=x2pp;ar(4,1)=x2;
br(1,1)=-y1;br(2,1)=-y1pp;br(3,1)=-y2pp;br(4,1)=-y2;
xpolys(ar,br,-edgecolor(i));
end
end
// PLOT OF LOOPS
gona=diag(spp);ii=find(gona<>0);kk=size(ii);
for i=1:kk(2)
iii=ii(i); imax=gona(iii);
x1=xnodes(iii);y1=-ynodes(iii); uni=nodediam(iii);
jj=find(vtail==iii & vhead==iii);
for k=1:imax
xup=x1-0.5*uni; h=(k+0.5)*uni; yup=y1+h; icol=jj(k);
metarc=[xup,yup,uni,h,0,23040];
xarcs(metarc',edgecolor(icol)-1);
x1mm=xup-6;x3mm=xup;x2mm=xup+6;
y1mm=y1+0.5*h+12;y3mm=y1+0.5*h;y2mm=y1mm;
fr(1,1)=x1mm;fr(2,1)=x3mm;fr(3,1)=x2mm;
gr(1,1)=y1mm;gr(2,1)=y3mm;gr(3,1)=y2mm;
xpolys(fr,gr,-edgecolor(icol));
end
end
// PLOT OF SINK NODES
GCD=ncolor;ii=find(GCD==0);GCD(ii)=1*ones(ii);
nodetype=g('node_type');ii=find(nodetype==1);kk=size(ii);
for i=1:kk(2)
iii=ii(i);
x1=xnodes(iii);y1=-ynodes(iii);mesu=nodediam(iii);
xset('pattern',ncolor(iii)-1);
xrect(x1-0.5*mesu,y1-0.5*mesu,mesu,mesu);
ar(1,1)=x1-mesu;ar(2,1)=x1+mesu;ar(3,1)=x1;ar(4,1)=ar(1,1);
br(1,1)=y1-1.5*mesu;br(2,1)=br(1,1);br(3,1)=y1-2.5*mesu;br(4,1)=br(1,1);
xpolys(ar,br,-GCD(iii));
end
// PLOT OF SOURCE NODES
ii=find(nodetype==2);kk=size(ii);
for i=1:kk(2)
iii=ii(i);
mesu=nodediam(iii);x1=xnodes(iii);y1=-ynodes(iii)+3*mesu;
xset('pattern',ncolor(iii)-1);
xrect(x1-0.5*mesu,y1-0.5*mesu,mesu,mesu);
ar(1,1)=x1-mesu;ar(2,1)=x1+mesu;ar(3,1)=x1;ar(4,1)=ar(1,1);
br(1,1)=y1-1.5*mesu;br(2,1)=br(1,1);br(3,1)=y1-2.5*mesu;br(4,1)=br(1,1);
xpolys(ar,br,-GCD(iii));
end
// FINAL PLOT OF PLAIN NODES
xarcs(metarcs,ncolor-1);
|
814835d72bb49116e056c5bacb908ba0fedef4c3 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1919/CH4/EX4.12/Ex4_12.sce | b6bab10e96b1788b66fee276ee5a846f3e2d8d81 | [] | 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 | 212 | sce | Ex4_12.sce |
// Theory and Problems of Thermodynamics
// Chapter 4
// Energy Analysis of Process
// Example 12
clear ;clc;
//The given problem is theoritical and does not involve any numerical computation
|
2117bae94bd73baedbec1139f4d8b1153ee284c4 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2579/CH1/EX1.50/Ex1_50.sce | 01bd4ec83b63b5babcc23533b8820177907701b3 | [] | 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 | 950 | sce | Ex1_50.sce | //Ex:1.50
clc;
clear;
close;
V=5*10^-3;// rms value in volt
r=3*10^3;// in meter
Rr=73;// the radiation resistance in ohm
// The electric field in the far region may be given by
// Ex=(60.pi.Im.sin(x)/y.r)*e^(-jko.r)*integrate('(cos(koz)*e^(jko.z.cos(x))),'z',-y/4,y/4)
// Ex=(60.pi.Im.sin(x)/y.r)*e^(-jko.r)*integrate('(2.cos(ko)(cos(ko.z).cos(x)+j.sin(ko.z).cos(x))','z',0,y/4)
// Ex=(60.pi.Im.sin(x)/y.r)*e^(-jko.r)*integrate('(2.cos(ko.z).cos(ko.z.cos(x)))','z',0,y/4)
// on integrating, we get,
// Ex=(60*Im/r)*(cos(pi/2.cos(x))/sin(x))
Emax=V*sqrt(2);// the peak value of field in V/m
// on putting x=90 degree in Ex=(60*Im/r)*(cos(pi/2.cos(x))/sin(x)), we get
// Emax=60*Im/r, then
Im=Emax*r/60;// max current in amp
Pav=(Im^2/2)*(Rr);// the average power in watts
printf("The expression of total electric field amplidude, Ex=(60*Im/r)*(cos(pi/2.cos(x))/sin(x))")
printf("\n The value of the average power= %f watts", Pav); |
a1d2219f6ed92bcc28e50b06494d75c3feaf4db3 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1535/CH14/EX14.7/Ch14Ex7.sci | cf71549e4eaa3e032ad4cb1b4c13a9dae70d64ee | [] | 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,244 | sci | Ch14Ex7.sci | // Scilab Code Ex14.7: Susceptibility and magnetisation of paramagnetic salt: Page-308 (2010)
mu_0 = 4*%pi*1e-07; // Magnetic permeability of free space, tesla metre per ampere
N_A = 6.02e+026; // Avogadro's number, per kmol
rho = 4370; // Density of paramegnetic salt, kg per metre cube
M = 168.5; // Molecular weight of paramagnetic salt, g/mol
T = 27+273; // Temperature of paramagnetic salt, K
H = 2e+005; // Field strength to which the paramagnetic salt is subjected, ampere per metre
mu_B = 9.27e-024; // Bohr's magneton, ampere metre square
p = 2; // Number of Bohr magnetons per molecule
k = 1.38e-023; // Boltzmann constant, J/K
N = rho*N_A/M; // Total density of atoms in the paramagnetic salt, per metr cube
chi = mu_0*N*p^2*mu_B^2/(3*k*T); // Magnetic susceptibility of paramagnetic salt
M = chi*H; // Magnetisation of paramagnetic salt, ampere per metre
printf("\nThe magnetic susceptibility of paramagnetic salt = %4.2e per metre", chi);
printf("\nThe magnetisation of paramagnetic salt = %4.2e ampere per metre", M);
// Result
// The magnetic susceptibility of paramagnetic salt = 5.43e-004 per metre
// The magnetisation of paramagnetic salt = 1.09e+002 ampere per metre
|
8ec6c7ae49c912015fdb82f6af102f4cf234d063 | 449d555969bfd7befe906877abab098c6e63a0e8 | /608/CH29/EX29.07/29_07.sce | 63772d37677d57894a4e7d7a14762174a2e8fb91 | [] | 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 | 760 | sce | 29_07.sce | //Problem 29.07: In an LR–C network, the capacitance is 10.61 nF, the bandwidth is 500 Hz and the resonant frequency is 150 kHz. Determine for the circuit (a) the Q-factor, (b) the dynamic resistance, and (c) the magnitude of the impedance when the supply frequency is 0.4% greater than the tuned frequency.
//initializing the variables:
C = 10.61E-9; // in Farad
bw = 500; // in Hz
fr = 150000; // in Hz
x = 0.004
//calculation:
//Q-factor
Q = fr/bw
wr = 2*%pi*fr
//dynamic resistance, RD
//Rd = Q*L/(C*wr*L)
Rd = Q/(C*wr)
del = x
Z = Rd/(1 + (2*del*Q*%i))
Zmag = (real(Z)^2 + imag(Z)^2)^0.5
printf("\n\n Result \n\n")
printf("\n (a)Q-factor %.2f",Q)
printf("\n (b)dynamic resistance %.2E ohm",Rd)
printf("\n (c)magnitude of the impedance %.2E ohm",Zmag) |
e33b5dec9ea376f5525df1e8364bc69eb83ca5b3 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1730/CH2/EX2.15/Exa2_15.sce | c61b9c427405dffbb4719c5c612fae5b318d940b | [] | 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 | 280 | sce | Exa2_15.sce | //Exa2.15
clc;
clear;
close;
//given data
alpha0=0.0038;// in ohm/ohm/degree C
t1=20; //in degree C
alpha20=1/(1/alpha0+t1);
R1=400;//in ohm
//Formula R2=R1*[1+alpha20*(t2-t1)]
R2=R1*[1+alpha20*(80-20)];
disp("Resistance of wire at 80 degree C si : "+string(R2)+" ohm") |
83ddfe2f82528ea6fb291aaf88d3892e8a321017 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2885/CH5/EX5.1/ex5_1.sce | af004ab0d020e624a982adb680deb5f9b155eb68 | [] | 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 | 376 | sce | ex5_1.sce | //Calculate saturation voltage and saturation current
clear;
clc;
//soltion
//given
Vp=-4//V //pinch off voltage
Idss=12*10^-3;//A //drain to source current with gate shorted
Vgs=-2;//V //gate to source voltage
Vds=Vgs-Vp;
Id=Idss*(Vds/Vp)^2;
printf("Saturation Voltage is %.0f V\n",Vds);
printf("Saturation current is %.0f mA",Id*10^3);
|
7960389db6139374dda445fcc26566bf5b844cea | 449d555969bfd7befe906877abab098c6e63a0e8 | /3812/CH1/EX1.7.a/1_7_a.sce | edb6f693c73a02166a4d370f54f0a9f209c130e6 | [] | 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 | 1_7_a.sce | //Example 1.7<a>
//draw the waveform of the signal x1(t)=r(t-1)
clc;
clear all;
t=-10:.001:10;
for i=1:length(t)
if t(i)>=0 then
x(i)=t(i)+1;
else
x(i)=0;
end
end
plot2d(x,t);
xtitle('Required figure','t','x(t)')
|
1a881c14df3a724bccaec09e56f2498a39ce2561 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2333/CH2/EX2.17/17.sce | 42b7e63ec526e1d444151fc941ae650c45cc91b5 | [] | 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 | 391 | sce | 17.sce | clc
// Given that
lambda = 5460 // Wavelength in angstrom
t = 6.3e-4 // Thickness of plate in cm
n = 6 // order of fringe
// Sample Problem 17 on page no. 100
printf("\n # PROBLEM 17 # \n")
printf("\n Standard formula used \n (mu - 1)*t = n*lambda\n")
mu = n*lambda*1e-10/(t*1e-2) +1 // Calculation of thickness of glass plate
printf("\n Refractive index of sheet is %f.", mu)
|
0036632f8acf9533976b017fe7aa61d1c23f64ff | b4be5ed282b4c531c0d140038804106b52e5e9be | /runCompare2.sce | bf5a255d65256452cdc79f701e015264592f9c05 | [] | no_license | solothinker/compare | 9df946e9d40f0565d1eb3bcb18cb4891435d8fed | d0b4b633f47aaa2578d39f723c6becd1d3aa2359 | refs/heads/master | 2021-06-24T21:42:05.654744 | 2017-09-08T05:57:35 | 2017-09-08T05:57:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 172 | sce | runCompare2.sce | // without iddata function
compare([yy,uu],sys)
// other output datas
[x0] = compare([yy,uu],sys)
[fit x0] = compare([yy,uu],sys)
[y fit x0] = compare([yy,uu],sys)
|
fc70afd596d50776595af1f8752cb1eedc7fd0bb | 449d555969bfd7befe906877abab098c6e63a0e8 | /2873/CH13/EX13.3/Ex13_3.sce | 23c98b6f1155c4fcbe7d58a4bf6608c29e9ba3be | [] | 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,036 | sce | Ex13_3.sce | // Display mode
mode(0);
// Display warning for floating point exception
ieee(1);
clear;
clc;
disp("Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3")
C=300;//aircraft flying speed in m/s
P=0.472*10^5;//altitude pressure in Pa
rho=0.659;//density in kg/m^3
y=1.4;//expansion constant
R=287;//gas constant in J/kg K
disp("From bernoulli equation,Po-P=(1/2)*rho*C^2")
disp("so Po=P+(1/2)*rho*C^2 in N/m^2")
Po=P+(1/2)*rho*C^2
disp("speed indicator reading shall be given by mach no.s")
disp("mach no.,M=C/a=C/sqrt(y*R*T)")
disp("using perfect gas equation,P=rho*R*T")
disp("so T=P/(rho*R)in K")
T=P/(rho*R)
disp("so mach no.,M")
M=C/sqrt(y*R*T)
M=0.947;//approx.
disp("considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))")
disp("so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2")
Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))
disp("also Po-P=(1+k)*(1/2)*rho*C^2")
disp("substitution yields,k=")
k=((Po-P)/((1/2)*rho*C^2))-1
disp("so compressibility correction factor,k=0.2437")
|
f0f963315f438762792cbb70518ce4f9452c3e53 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2579/CH2/EX2.18/Ex2_18.sce | fcd40717ebd1ac910e496fb0ba3fba25e62c570a | [] | 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 | 210 | sce | Ex2_18.sce | //Ex:2.18
clc;
clear;
close;
fr=110*10^6;// frequency in Hz
Q=70;// quality factor
df=fr/Q;// bandwidth in MHz
printf("The bandwidth= %f MHz", df/10^6);
printf("\n The answer is wrong in the textbook"); |
327c9277619545ac993210f2666b814d75fd463a | 449d555969bfd7befe906877abab098c6e63a0e8 | /3685/CH19/EX19.3/Ex19_3.sce | 284d30c8dce39b92a31d0f4b43a418f39dd3a35b | [] | 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 | 803 | sce | Ex19_3.sce | clc
P1 = 101.3e03
P4 = P1 // in Pa
P2 = 8*P1
P3 = P2
T1 = 288
Vs = 2000
V3 = 100
Vc = V3
V1 = Vs + Vc
n = 1.25
R = 287
V4 = ((P3/P4)^(1/n))*V3
W = ((n*P1*(V1-V4)*1e-06)/(n-1))*(((P2/P1)^((n-1)/n))-1)
P = (W*800*0.001)/60
m = (P1*(V1-V4)*1e-06)/(R*T1)
m_dot = m*800
FAD = (V1-V4)*1e-06*800
Wt = P1*(V1-V4)*1e-06*log(P2/P1)
n_isothermal = (Wt*800*0.001)/(P*60)
Pi = P/0.85
n_v =100*(V1-V4)/Vs
printf("\n Example 19.3\n")
printf("\n Indicated poer is %f kW",P)
printf("\n Volumetric efficiency is %f percent",n_v)
printf("\n Mass flow rate is %f kg/min",m_dot)
printf("\n Free air delivery is %f m^3/min",FAD)
printf("\n Isothermal efficiency is %f percent",100*n_isothermal)
printf("\n Input power is %f kW",Pi)
//The answers vary due to round off error
|
a5170aaf08655776159044266e7ef7f7ac9fc820 | 74275e4abd1ce3610a3fde4fb4bf81c7b30bb31d | /qml/3rdparty/qt/webbrowser/content/pics/addressbar.sci | 8f1cd18fcab59bb3f7f3049a05392e111c2f7e36 | [
"MIT"
] | permissive | matgnt/mobos-gui | 132800a5abbb6cb38b49a81fa9022940fe85b96d | 8bb3502c46e69f1d3492d79f271d4887989e6174 | refs/heads/master | 2021-01-22T07:10:05.411720 | 2015-06-08T17:09:14 | 2015-06-08T17:09:14 | 572,488 | 3 | 3 | null | null | null | null | UTF-8 | Scilab | false | false | 86 | sci | addressbar.sci | border.left: 7
border.top: 7
border.bottom: 7
border.right: 7
source: addressbar.png
|
4de47115f3cc1b68ddc63c482593eebadee17edc | 9eee9f16f22ece682f8592130aa351a0d050f197 | /compiler.tst | db52388e5cb19f97ceeafabdf406983b9c2217c5 | [] | no_license | ansjob/wacc | e388482b79af937a092f24011dd7c96a271101ce | aae607757954ad77614ba300ac3615dcb443ca4d | refs/heads/master | 2021-01-23T18:49:28.013827 | 2014-01-10T16:15:57 | 2014-01-10T16:15:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,346 | tst | compiler.tst | compile(skip:1 ; skip:2, C)
:: C = [noop:1, noop:2].
phrase(stmt(S), [var(x), =, 5, +, 7]), add_control_points(S, Sp), compile(Sp, C)
:: C = [push(7), push(5), add, store(x):_, eop:_].
phrase(stmt(S), [var(x), =, 5, *, 3, -, 2]), add_control_points(S, Sp), compile(Sp, C)
:: C = [push(2), push(3), push(5), mult, sub | _].
phrase(stmt(S), [var(_), =, var(X)]), add_control_points(S, Sp), compile(Sp, C)
:: C = [fetch(X), store(_):_, eop:_].
phrase(stmt(S), [while, l_paren, 5, '<=', 3, r_paren, ^, !, l_paren, false, r_paren, do, skip]),
add_control_points(S, Sp),
compile(Sp, C)
:: C = [loop([false, neg, push(3), push(5), le, and], [noop:_]):_ , eop:_].
phrase(stmt(S), [while, true, ^, var(x), eq, 3, do, skip]),
add_control_points(S, Sp),
compile(Sp, C)
:: C = [loop([push(3), fetch(x), eq, true, and], [noop:_]):_, eop:_].
compile(ass(var(y), 2 + 4):_, C)
:: C = [push(4), push(2), add, store(y):_].
compile(cond(true, skip:_, skip:_):_, C)
:: C = [true, branch([noop:_], [noop:_]):_].
compile(while(true, skip:_):_, C)
:: C = [loop([true], [noop:_]):_].
compile((((5) / (0))), C)
:: C = [push(0), push(5), div].
phrase(stmt(S), [try, var(z), =, 7, catch, l_paren, skip, semicolon, skip, r_paren]),
add_control_points(S, Sp),
compile(Sp, C)
:: C = [try([push(7), store(z):_]):_, catch([noop:_, noop:_]):_, eop:_].
|
976268673a06137ffdc1083614d93cc493fae4d1 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1163/CH19/EX19.8/example_19_8.sce | e3c2e43eef426329a3360da4e090bd398951d49b | [] | 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 | 303 | sce | example_19_8.sce | clear;
clc;
disp("--------------Example 19.8---------------")
//address :- 205.16.37.39/28
n=28; //cidr
exp_of_2 = 32-n;
num_of_addresses= 2^(exp_of_2); //formula to calculate number of addresses
printf("\n The number of addresses in the block is %d.",num_of_addresses); //display the results
|
037e6eba80ab4aa707b70c5622c8d1bb9ef618fc | 8217f7986187902617ad1bf89cb789618a90dd0a | /source/1.1/macros/sci2for/get2f.sci | a19d718e76ec8b49eeafe451de876b5aeec90760 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | 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 | 852 | sci | get2f.sci | //[stk,top,vnms,vtps]=get2f(nam,stk,top,vnms,vtps)
// realise la traduction fortran de l'acquisition d'une variable (stackg)
//!
top=top+1
vn=find(nam=vnms(:,2))
if vn==[] then
op1=lst(ilst+1)
if op1(1)<>'5'|op1(2)<>'24' then
if nam='%eps' then
stk(top)=list('%eps','0','1','1','1')
nv=prod(size(vnms))/2+1;
vnms=[vnms;['%eps','%eps']]
vtps(nv)=list('1','1','1',0)
elseif nam='%i' then
stk(top)=list(['0.0d0','1.0d0'],'0','1','1','1')
elseif nam='%io' then
stk(top)=list(%io,'0','0','1','2')
nv=prod(size(vnms))/2+1;
vnms=[vnms;['%io','%io']]
vtps(nv)=list('0','1','2',0)
else
error('la variable: ' +nam+' n''est pas definie')
end
else
stk(top)=list(nam,'?','0','0','0',0)
end
else
typ=vtps(vn)
stk(top)=list(vnms(vn,1),'0',typ(1),typ(2),typ(3))
end
//end
|
6ca214ebc100175cb354b0accce78279c9b67604 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2744/CH13/EX13.1/Ex13_1.sce | 85cc0018191dbc1c61f5b4ff6c02563efdfd684d | [] | 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 | 450 | sce | Ex13_1.sce | clear;
clc;
b = 10;//inches
d = 1;//inches
h = 20;//inches
r = 2;//inches
M_r = 500000;//lb-inches
m = 15;
A_r = 4*0.25*%pi*d^2;//in^2
h_eff = h-r;//inches
K = m*A_r/(b*h_eff);//inches
n1 = sqrt((K)^2+(2*K))-K;
n = n1*h_eff;//inches
a = h_eff-(n/3);//inches
c = 2*M_r/(b*n*a);//lb/in^2
t = (h_eff-n)*m*c/n;//lb/in^2
printf('The stress induced in the concrete and steel, t = %d lb/in^2',t);
//there is a minute error in the answer given in textbook.
|
89909b0fce47314777a9aff765b4786780170908 | 449d555969bfd7befe906877abab098c6e63a0e8 | /149/CH35/EX35.1/example1.sce | f608bdd3075513a1383044c1d8dd394f4c388b8f | [] | 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 | 456 | sce | example1.sce | clc
disp('suppose the coin is unbiased ')
disp('then probability of getting the head in a toss=1/2')
disp('then,expected no. of successes=a=1/2*400 ')
a=1/2*400
disp('observed no. of successes =216')
b=216
disp('the excess of observed value over expected value=')
b-a
disp('S.D. of simple sampling = (n*p*q)^0.5=c')
c=(400*0.5*0.5)^0.5
disp('hence,z=(b-a)/c=')
(b-a)/c
disp('as z<1.96,the hypothesis is accepted at 5% level of significance') |
fd11341a877300130be2d5135bb4d41b008fa268 | c557cd21994aaa23ea4fe68fa779dd8b3aac0381 | /test/pathrename.tst | e2945a5c578f5cbc48eaf07a0cc404cdeae676ac | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | dougsong/reposurgeon | 394001c0da4c3503bc8bae14935808ffd6f45657 | ee63ba2b0786fa1b79dd232bf3d4c2fe9c22104b | refs/heads/master | 2023-03-09T15:22:45.041046 | 2023-02-25T08:33:06 | 2023-02-25T08:33:06 | 280,299,498 | 1 | 0 | NOASSERTION | 2023-02-25T08:33:08 | 2020-07-17T01:45:32 | Go | UTF-8 | Scilab | false | false | 153 | tst | pathrename.tst | ## Test path rename capability
set relax
read <sample1.fi
path README rename REAMDE # Should succeed
path .gitignore rename REAMDE # Should fail
write -
|
6d1418da2ea043d1fad348dfb39a6f4c94558730 | b29e9715ab76b6f89609c32edd36f81a0dcf6a39 | /ketpicscifiles6/Zparapt.sci | 5c237179324b08201645dc63eec48613f2244556 | [] | no_license | ketpic/ketcindy-scilab-support | e1646488aa840f86c198818ea518c24a66b71f81 | 3df21192d25809ce980cd036a5ef9f97b53aa918 | refs/heads/master | 2021-05-11T11:40:49.725978 | 2018-01-16T14:02:21 | 2018-01-16T14:02:21 | 117,643,554 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 160 | sci | Zparapt.sci | // 08.07.11
function Out=Zparapt(P)
global PHI THETA;
x=P(1); y=P(2); z=P(3);
Out=x*cos(PHI)*sin(THETA)+y*sin(PHI)*sin(THETA)+z*cos(THETA);
endfunction
|
aa4723fc7523d34a9e4af2d93e9d4e2b1d87b17d | 449d555969bfd7befe906877abab098c6e63a0e8 | /2342/CH2/EX2.19/EX2_19.sce | b5e7fe6a30a32b8987296f71b98cee1363ae7f7b | [] | 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 | 407 | sce | EX2_19.sce | //Exa 2.19
format('v',9)
clc;
clear;
close;
//Given data
l= 0.50*10^-2;// width of ribbon in m
d= 0.10*10^-3;// thickness of ribbon in m
A= l*d;// area of ribbon in m^2
B = 0.8;// in Tesla
D = 10.5;//density in gm/cc
I = 2;// in amp
q = 1.6 * 10^-19;// in C
n=6*10^28;// number of elec. per m^3
V_H = ( I * B * d)/(n * q * A);// in volts
disp(V_H,"The hall Voltage produced in volts is");
|
b81e59679f9632691fcefae441c0b7a5e8447166 | 1bb72df9a084fe4f8c0ec39f778282eb52750801 | /test/BV22.prev.tst | 1754bf57f5a57601bcf45bd8165b661d026641a9 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | gfis/ramath | 498adfc7a6d353d4775b33020fdf992628e3fbff | b09b48639ddd4709ffb1c729e33f6a4b9ef676b5 | refs/heads/master | 2023-08-17T00:10:37.092379 | 2023-08-04T07:48:00 | 2023-08-04T07:48:00 | 30,116,803 | 2 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 466 | tst | BV22.prev.tst | [1,4,6,4,1] | [1,3,3,1] =
initial: [1,4,6,4,1] / [1,3,3,1], rem1=[1,4,6,4,1], div2=[1,3,3,1], lenq=2, len1=5, len2=4
step end: quot=[0,0]/qden=1, rem1=[1,4,6,4,1]/rden=1, div2=[1,3,3,1], bquot=1, lenq=2, len1=5, len2=4
while end: quot=[0,1]/1, rem1=[1,3,3,1]/1
step end: quot=[0,1]/qden=1, rem1=[1,3,3,1]/rden=1, div2=[1,3,3,1], bquot=1, lenq=2, len1=4, len2=4
while end: quot=[1,1]/1, rem1=[0]/1
gcd: [1,4,6,4,1] / [1,3,3,1] -> [1,1] rest [0]
gcd: [1,1]
|
ae502c02bab4fdecab1251a0967f38255478db8b | 449d555969bfd7befe906877abab098c6e63a0e8 | /3557/CH13/EX13.5/Ex13_5.sce | d462b9ed78f35887a5982352350cec1418ce5031 | [] | 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 | 624 | sce | Ex13_5.sce | //Example13.5//
a=33.3;//g // of each components (acrylonitrile, butadiene, and sytrene)
C=12.01;//amu //atomic mass of carbon //(From Appendix 1)
H=1.008;//amu //atomic mass of hydrogen //(From Appendix 1)
N=14.01;//amu //atomic mass of Nitrogen //(From Appendix 1)
b=3;//Number of atoms
A=a/((b*C)+(b*H)+(N))
mprintf("A = %f mol",A)
c=4;//Number of atoms
d=6;//Number of atoms
B=a/((c*C)+(d*H))
mprintf("\nB = %f mol",B)
d=8;//Number of atoms
S=a/((d*C)+(d*H))
mprintf("\nS = %f mol",S)
fA=A/(A+B+S)
mprintf("\nfA = %f ",fA)
fB=B/(A+B+S)
mprintf("\nfB = %f",fB)
fS=S/(A+B+S)
mprintf("\nfS = %f",fS)
|
3dfafb4ac4bb478f69eddef4013f92360115f500 | 449d555969bfd7befe906877abab098c6e63a0e8 | /629/CH4/EX4.8/example4_8.sce | 0e7fd3ca6922d91a2a43a6541cc6a1e4fd9453b9 | [] | 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 | 534 | sce | example4_8.sce | clear
clc
//Example 4.8 APPLICATION OF PITOT EQUATION WITH MANOMETER
g=32.2; //[ft/s^2]
y=7/12; //[ft]
//Specific gravities
S_kero=0.81;
S_Hg=13.55;
//Specific weights
g_water=62.4; //[lbf/ft^3]
g_Hg=S_Hg*g_water //[lbf/ft^3]
g_kero=S_kero*g_water //[lbf/ft^3]
rho_kero=g_kero/g //density[lbm/ft^3]
//Manometer equation, pz1-pz2=y*(gamma_Hg-gamma_kero)
//Pitot-static tube equation, V=[2*(pz1-pz2)/rho]^(1/2)
V=(2*y*(g_Hg-g_kero)/rho_kero)^(1/2) //[ft/s]
printf("\n The kerosene velocity in the pipe = %.1f ft/s.\n",V) |
5355d99219831cf913fcb792716dfd2c92a0bf8e | 449d555969bfd7befe906877abab098c6e63a0e8 | /848/CH10/EX10.5/Example10_5.sce | fb85ead24217f7520c056504bdc1d9c8bb75416a | [] | 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 | 447 | sce | Example10_5.sce | //clear//
//Caption:Finding output powers at output port of 2x2 coupler
//Example10.5
//page 350
clear;
clc;
close;
S = sqrt(1/2)*[1,%i;%i,1];//scattering matrix
Ein = [1;0];
Eout = S*Ein;
Pout1 = Eout(1)*conj(Eout(1));
Pout2 = Eout(2)*conj(Eout(2));
disp(Pout1,'Output power at port 1 Pout1 =')
disp(Pout2,'Output power at port 2 Pout2 =')
//Result
//Output power at port 1 Pout1 = 0.5
//Output power at port 2 Pout2 = 0.5
|
5725745fe498c7c926c2a21b2b7b44d008626c9f | 449d555969bfd7befe906877abab098c6e63a0e8 | /1325/CH9/EX9.5/9_5.sce | bcb6aa297ea27024074a203bc5a461d8f42de4cd | [] | 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 | 865 | sce | 9_5.sce | //To draw complete displacement, velocity and acceleration diagrams
clc
//given
alpha=55*%pi/180
N=1200//rpm
lift=.5//in
rn=.125//in ; noseradius
rmin=1.125//in ; minimum radius
OQ=rmin+lift-rn
OP=(OQ^2-1)/(2*(1-OQ*cos(alpha)))//from triangle opq fig 201(a)
PQ=OP+rmin-rn
phi=asin(OQ*sin(alpha)/PQ)
x1=[0:.0001:phi]
x2=[phi:.0001:alpha]
y1=4.477*(1-cos(x1))//from 9.6
y2=1.5*cos(alpha-x2)-1//from 9.9
v1=%pi*N*4.477*sin(x1)/(30*12)//from 9.7
v2=15.71*sin(alpha-x2)//from 9.10
f1=(%pi*N/30)^2*(4.477/12)*cos(x1)//from 9.8
f2=-1974*cos(alpha-x2)//from 9.11
a=[0:.0001:phi]
b=[phi:.0001:alpha]
p=[0:.0001:phi]
q=[phi:.0001:alpha]
subplot(3,1,3)
subplot(311)
plot(x1,y1,x2,y2)
xtitle("","angle","displacement")
subplot(312)
plot(a,v1,b,v2)
xtitle("","angle","velocity")
subplot(313)
plot(p,f1,q,f2)
xtitle("","angle","acceleration")
|
8a008f0ae9ac1c8a56f8db759c7f735220cecdef | 449d555969bfd7befe906877abab098c6e63a0e8 | /3636/CH6/EX6.3/Ex6_3.sce | 44e7ee7b523e44942969c8666c5d47fb9cef24f8 | [] | 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,169 | sce | Ex6_3.sce | clc;
clear;
sigma_p=1000 //conductivity of p-junction in ohm^-1*m^-1
sigma_n=20 //conductivity of n-junction in ohm^-1*m^-1
myu_p=0.05 //in m^2/V*s
myu_n=0.13 //in m^2/V*s
K=8.61*10^-5 //Boltzmann constant in eV/K
T=300 //in K
V=0.4 //forward bias voltage in V
e=1.602*10^-19 //in J
ni=1.5*10^16 //in m^-3
tau_n=10^-6 //minority carrier lifetime in s
tau_p=5*10^-6 //in s
Const=0.026 //constant for kT/e in V
hole_current=0.603*10^-6 //in A
electron_current=0.016*10^-6 //in A
//Calculation
pp0=sigma_p/(e*myu_p) //majority carrier densities in m^-3
nn0=sigma_n/(e*myu_n) //in m^-3
np0=ni^2/pp0 //minority carrier densities in m^-3
pn0=ni^2/nn0 //in m^-3
Dn=myu_n*K*T //in m^2/s
Dp=myu_p*K*T //in m^2/s
Ln=sqrt(Dn*tau_n) //in m
Lp=sqrt(Dp*tau_p) //in m
Js=(((e*np0*Ln)/tau_n)+((e*pn0*Lp)/tau_p))
Ratio=(hole_current)/(electron_current)
J=Js*(exp(V/Const)-1)
mprintf("1)\nReverse bias stauration current density= %0.3e A/m^2\n",Js) //The answers vary due to round off error
mprintf("2)\nRatio of hole to electron current= %2.2f \n",Ratio)
mprintf("3)\nTotal current density= %2.2f A/m^2",J) //The answers vary due to round off error
|
76bc0967f77060b8c5b8450270e49e613f237509 | a557f90da8513f81cafd8f65e37e2c0d66449a2f | /Gortzel Al.sce | 55b9a9586284bb1ee853cd7623ea64aa5c34a681 | [] | no_license | Sahil966121/SCI | 484cd77d6247e54fe87d36b4f112965c83ab5d96 | cf2921861486a4f2e2e83c3ca813a4e7710d3508 | refs/heads/main | 2023-03-03T17:43:08.236192 | 2021-02-03T05:19:43 | 2021-02-03T05:19:43 | 324,413,192 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,494 | sce | Gortzel Al.sce | //Goertzel Algorithm: DTMF Generation and Detection
//DTMF Generation
clear;
clc;
close;
//DTMF Generation and Detection: Generate two single tones of frequency f1 Hz and f2 Hz for a duration of 40 ms. Use a sampling rate of 8 kHz. Add the two signals. Plot the spectrum of this sum signal. Decode the DTMF signal thus generated. Use Goertzel’s algorithm.
// DTMF Generation
row_number=input('Row Number');
column_number=input('Column Number');
fr=[697 770 852 941];
fc=[1209 1336 1477 1633];
fs=8000;
N=0.04*8000;//40 ms duration
f1=fr(row_number);
f2=fc(column_number);
tm=0:1/fs:(N-1)/fs;
x1=cos(2*%pi*f1*tm);
x2=cos(2*%pi*f2*tm);
x=x1+x2;
x_dft=abs(fft(x));
freq_axis=(0:N-1)*fs/N;
figure;
plot(freq_axis,x_dft);
//DTMF Detector
fr=[697 770 852 941];
fc=[1209 1336 1477 1633];
// Calculate the bin numbers for these frequencies
kr=ceil(fr*N/fs);
kc=ceil(fc*N/fs);
//To find WN_k (coefficient for first order Goertzel filter)
WN_kr=exp(%i*2*%pi*kr/N);
WN_kc=exp(%i*2*%pi*kc/N);
//Filteing Operation
for i=1:length(kr)
yk_n(1)=x(1);
for n=2:length(x)
yk_n(n)=x(n)+WN_kr(i)*(yk_n(n-1));
end
geortzel_op_kr(i)=abs(WN_kr(i)*yk_n(N));
end
for i=1:length(kc)
yk_n(1)=x(1);
for n=2:length(x)
yk_n(n)=x(n)+WN_kc(i)*(yk_n(n-1));
end
geortzel_op_kc(i)=abs(WN_kc(i)*yk_n(N));
end
row=find(geortzel_op_kr==max(geortzel_op_kr));
clm=find(geortzel_op_kc==max(geortzel_op_kc));
disp([row clm]);
|
639fefef9940c965996ae3d476cdd08a733251ee | c534aaf940d56e381c99fd80398980cd2d2414c2 | /Amplifier_prj/substrates/0000.sci | 300560956f2522a89a4c278b4aa6f701c8b893d8 | [] | no_license | BertF/VUB-HFE | e9930f161717229bc83d30312a489f7e27b01002 | c0e20467257f845b178808deb490b3c1a165faa9 | refs/heads/master | 2021-01-18T14:11:48.680744 | 2010-04-29T09:28:52 | 2010-04-29T09:28:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 516 | sci | 0000.sci | #Momentum: B.08.00.182 (*) 331.200 May 5 2008
#Momentum Date and Time: Wed Apr 28 11:00:02 2010
# Cell Info name : .\\substrates\0000
NUMBER OF LAYERS 3,
UNITS METRE
BOTTOMPLANE OPEN
TOPPLANE OPEN
LAYERS
0 THICKNESS INFINITY
PERMITTIVITY VALUE 1 0
PERMEABILITY VALUE 1 0,
1 THICKNESS 0.00152
PERMITTIVITY VALUE 3 0
PERMEABILITY VALUE 1 0
STRIP,
2 THICKNESS INFINITY
PERMITTIVITY VALUE 1 0
PERMEABILITY VALUE 1 0
STRIP;
END
0.03774753523 0.01646912459 0,
0.01646912459 0.03774753523 0,
0 0 0;
|
8f0aedcdae67f6f72a53d154106036b2c1aa8cba | 449d555969bfd7befe906877abab098c6e63a0e8 | /1322/CH14/EX14.5/102ex3.sce | 1d48e66ee10144068e7c07008b06348d220e65e2 | [] | 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 | 194 | sce | 102ex3.sce |
//factors of ab-5a-3b+15
clear;
clc;
close;
//by arrangement into suitable pairs,
mprintf("(ab-5a)-(3b-15) => a(b-5)-3(b-5)")
mprintf("\n the factors are: \n")
val=string('(b-5)(a-3)')
|
e347c8e1b3380287c462f085d05125e09d293eb0 | 449d555969bfd7befe906877abab098c6e63a0e8 | /626/CH4/EX4.3/4_3.sce | 2b32a25addd592ca51022c8c96fa955dcbbe1ca1 | [] | 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 | 575 | sce | 4_3.sce | clear;
clc;
close;
disp("Example 4.3")
Tt3=800 //in K
pt3=2*10^6 // in Pa
m=50 //air mass flow rate in kg/s
gm=1.4 //gamma
cp3=1004 //specific heat at inlet in j/kg.K.
Qr=42000 //heating valuein kJ/kg
mf=1 //fuel flow rate in kg/s
be=0.995 //burner efficiency
p=0.96 //p=pt4/pt3
cp4=1156 //specific heat at exit in J/kg.K
f=mf/m // fuel-to-air ratio
Tt4=(((cp3/cp4)*Tt3)+((f*Qr*be*1000.)/cp4))/(1+f)
pt4=p*pt3/10^6
disp(f,"(a)Fuel-to-air ratio :")
disp(Tt4,"b(1) combustor exit total temperature in K:")
disp(pt4,"b(2)combustor exit total pressure in MPa") |
2d29b766698cbc701fe3f92e06b2fe000114e3fa | 449d555969bfd7befe906877abab098c6e63a0e8 | /764/CH7/EX7.23.a/data7_23.sci | 7ca327ea5c153b8a3718f93ce5c4015dc0a5366d | [] | 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 | 766 | sci | data7_23.sci |
//(Threaded Joints) Example 7.23
//Refer Fig.7.47 on page 267
//Maximum pressure in the vessel Pmax (MPa)
Pmax = 1
//Minimum pressure in the vessel Pmin (MPa)
Pmin = 0
//Seating pressure for the gasket PSeat (MPa)
PSeat = 5
//Number of bolts N
N = 8
//Assume the stiffness of the bolts to be 1N/mm kb
kb = 1
//Calculate the stiffness of the parts kc
kc = 4 * kb
//Factor of safety fs
fs = 2
//Ultimate tensile strength of bolt material Sut (N/mm2)
Sut = 780
//Yield tensile strength of the bolt material Syt (N/mm2)
Syt = 580
//Endurance limit in bending Sdash (N/mm2)
Sdash = 260
//Fatigue stress concentration factor Kf
Kf = 3
//Inner diameter of the gasket Di (mm)
Di = 300
//Outer diameter of the gasket Do (mm)
Do = 300 + (2 * 50)
|
aec6e475e9f6ee02e7fdb8fc4be507b5406ad181 | e9b135074a04c0ae4273c18ac8466c003190b21a | /2 Ano/Metodos Numericos/Soluciones/fijo.sce | 9a6924c7e0ed4a95718e7080445d7075d2ebb957 | [] | no_license | damianarielm/lcc | 804faae03e5f60e44de58d264721892e1fea0c3c | ffd3e65f54073215e1e3542aabd62b3ec1ec5960 | refs/heads/master | 2023-02-18T12:14:00.543045 | 2023-02-14T00:19:54 | 2023-02-14T00:19:54 | 161,278,175 | 60 | 9 | null | 2020-12-04T14:43:40 | 2018-12-11T04:41:42 | HTML | UTF-8 | Scilab | false | false | 148 | sce | fijo.sce | function r = fijo(ecuacion, g, xk)
if ecuacion(xk) then
r = xk
else
r = fijo(ecuacion, g, g(xk))
end
endfunction
|
e9efa70c369157cbcb1f9d097f35676dfdfb7f04 | 449d555969bfd7befe906877abab098c6e63a0e8 | /593/CH13/EX13.7/ex13_7.sce | 30a7fa082430306659b9643b8dc7fd82e883b8f7 | [] | 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 | 968 | sce | ex13_7.sce | clear;
//clc();
// Example 13.7
// Page: 362
printf("Example-13.7 Page no.-362\n\n");
//***Data***//
T = 298.15;//[K] Temperature
F = 96500;//[(coulomb)/(mole*electrons)] faraday constant
// The reaction is given as
// Al2O3 + 1.5C = 2Al + 1.5CO2
// No of the electron being exchanged are
n_e = 6;//[electron]
// All the reactants and products enter or leave the reactor as pure species in their standard states, so
// delta_g_0 = delta_g_1 and E = E_0
// Free energy of the species in the above equation as reported in the Table A.8 in the book is
g_0_CO2 = -394.4*1000;//[J/mol]
g_0_Al = 0;//[J/mol]
g_0_C = 0;//[J/mol]
g_0_Al2O3 = -1582.3*1000;//[J/mol]
// Free energy change of the reaction is
delta_g_0 = 1.5*g_0_CO2 + 2*g_0_Al - 1.5*g_0_C - g_0_Al2O3;//[J/mol]
// So, standard state cell voltage is
E_0 = (-delta_g_0)/(n_e*F);//[V]
printf("Standard state cell voltage for the production of aluminium is %f Volt",E_0);
|
720a9293cf1c931e6d6f79ec7c91ee29302f06ca | c34cdc974263b166a6f9f6a8d043f8e0630181b1 | /rozjasnij.sce | 90bd94d7ac48e68daea2932ea134841846788952 | [] | no_license | BartusZak/WDGM_3 | adffa505744c6612a8bed4b85a8bd17fa4f33458 | 932dfd0b3e124dcadbc80d48c69ce12ff618da3c | refs/heads/master | 2021-05-08T04:31:02.725849 | 2017-10-27T12:37:35 | 2017-10-27T12:37:35 | 108,414,880 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,140 | sce | rozjasnij.sce | function rozjasnij(img, b)
img = uint16(img);
[h w] = size(img);
LUT = zeros(256,1);
X=0:1:255;
for i=1:256
if(i+b<0) then
LUT(i) = 0;
end
if (i+b >= 0 & i+b <= 255 ) then
LUT(i) = i+b;
end
if(i+b>255) then
LUT(i) = 255;
end
end
for i=1:h
for j=1:w
out(i,j) = LUT(img(i,j));
end
end
out = uint8(out);
//plot(X,LUT);
imshow(out);
endfunction
function rozjasnij2(img,b)
img = uint16(img);
img = rgb2gray(img);
[h w] = size(img);
for i=1:256
if b>0 then
LUT(i) = min(255,i+b); //rozjasnianie
elseif b<0 then
LUT(i) = max(0,i+b); //przyciemnianie
else
LUT(i) = i+b; //nic nie rob
end
end
for i=1:h
for j=1:w
out(i,j) = LUT(img(i,j));
end
end
out = uint8(out);
imshow(out);
endfunction
img = imread('lena.jpg');
rozjasnij2(img,50);
|
560300b9519b955e8bc9396458951dda86b4e205 | 34fe04e70c3d8cd31b1e57e0aa6ef7cc241f39ec | /medea_result/heat_expansion/Au/Au_108/initial.sci | 8c0370e1a56beca66f0289bbad4756091ee63cfd | [] | no_license | daddygongon/thesis_data | 162563a27f98d97f5550c910a5b4403675e1533d | 4c9bf2caa9224c2249cfdd873452249fadd5e124 | refs/heads/master | 2020-05-21T10:34:53.619953 | 2017-03-10T08:09:30 | 2017-03-10T08:09:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,580 | sci | initial.sci | #MD System 2.0
@Title Untitled_1
@Columns AsymmetricAtom
AtomicNumber int 0
Connections string {{}}
Fractional double {{0.0 0.0 0.0}}
Name string {{}}
Site int 1
WyckoffPosition int -1
@end
@data
79 {} {0 0 0} Au 1 1
@end
@Columns Cell
Constraints string {a b c A B G}
Origin int {{0 0 0}}
Parameters double {{10.0 10.0 10.0 90.0 90.0 90.0}}
PrimitiveData double {{{1.0 0.0 0.0} {0.0 1.0 0.0} {0.0 0.0 1.0}}}
RotationMatrix double {{{1.0 0.0 0.0} {0.0 1.0 0.0} {0.0 0.0 1.0}}}
SpaceGroup string P1
SpaceGroupNumber int 1
ToCartesians double {{{10.0 0.0 0.0} {0.0 10.0 0.0} {0.0 0.0 10.0}}}
ToFractionals double {{{0.10000000000000001 0.0 0.0} {0.0 0.10000000000000001 0.0} {0.0 0.0 0.10000000000000001}}}
@end
@data
{a b c A B G} {0 0 0} {4.45780841904 4.45780841904 4.45780841904 90 90 90} {{1 0 0} {0 1 0} {0 0 1}} {{1 0 0} {0 1 0} {0 0 1}} Fm-3m 225 {{4.45780841904 0 0} {8.1736585068e-008 4.45780841904 0} {8.1736585068e-008 8.17365835693e-008 4.45780841904}} {{0.224325477005 0 0} {-4.11314186493e-009 0.224325477005 0} {-4.11314178951e-009 -4.11314178951e-009 0.224325477005}}
@end
@Columns AsymmetricBond
Atom1 reference AsymmetricAtom
Atom2 reference AsymmetricAtom
Key int 0
Order int 0
@end
@data
@end
@Columns Bond
AsymmetricBond reference AsymmetricBond
Atom1 reference Atom
Atom2 reference Atom
CellOffset2 int {{0 0 0}}
Key int 0
@end
@data
@end
@Columns Subset
Criteria string {{}}
Dynamic int 0
Length int 1
Name string {{}}
Table string {{}}
Type string atom
@end
@data
@end
|
91d15c9d1cff3ce30ee1181ea44117ba4a364aee | 0d6a074efca7f6d9d5b1ec4413faf975046ec9af | /lms.sce | bbee9563434d69847adac6631c01c48a9c7286b5 | [] | no_license | rishabh1217/Adaptive-noise-cancellation-algorithms-LMS-and-RLS-SCILAB | e36c0d52c4eaabe74c8b71d177c4ba2237198273 | f9786644f0d61efa4a7af8bbb9c9163fea0d34f8 | refs/heads/master | 2022-12-22T14:20:29.442433 | 2020-10-01T11:00:13 | 2020-10-01T11:00:13 | 300,246,859 | 0 | 0 | null | 2020-10-01T10:58:57 | 2020-10-01T10:58:56 | null | UTF-8 | Scilab | false | false | 1,343 | sce | lms.sce | // set len of signal mp
mp=500
// set time vector n
n=(1:1:mp ) ;
// set len of filter hmm and hmp
nfilter =20 ;
// set noise vector
R= .2 // variance Gaussian
av =0 // mean Gaussian
sd =sqrt(R) // std Gaussian
v = grand(1,mp,'nor',av,sd) ;// generate white gaussian
hmm = zeros(1,nfilter) ;
hmp = zeros(1,nfilter) ;
// est vector is dest
dest=zeros(1, mp);
// create input signal x in theta
dtheta =2*%pi/mp ;
x=dtheta*n ;
// create desired vector d as sin(x)
d =sin(x) ;
figure(0) ;
plot (x ,d) ;
// set xmm init vector
i=1 ;
x1=x; // we are using x as d + noise so we store x as x1
// now create input vector x with noise
x= d+v ;
deltn =.01 // step size
// begin computation for i statement
for i=1: mp-nfilter ;
i ;
xmm = x(1:1, i: (nfilter+i -1) ) ;
in= i+1 ;
// set next input vector
//xmp = x(1:1, in: (nfilter+in -1) ) ;
// compute thedhat value from xmm ' *hmm
// dhat is set to zero vector first
dhat = xmm*hmm' ;
// update est vector
dest(i) = dhat ;
// compute last error
elast= d(i) - dhat ;
elast ;
// update hmm vector
hmp= hmm + xmm*elast*deltn ;
hmm =hmp ;
// next step
end ;
d ;
dest ;
figure(1);
subplot(221) ;
title (' true signal ');
plot(x1, d);
subplot(222) ;
title (' signal + noise ');
plot(x1, x);
subplot(224)
title (' filtered signal ');
plot(x1, dest);
subplot(223)
title (' noise ');
plot(x1, v);
|
0b996b40bddb7ba8cdb7e373b74a33b474780c61 | efaddd6eadae0c99f538a83a8d01ccff8b38fab7 | /Mux16Way16.tst | 757542d3cbe563bda55e15ac580dc72f396e2317 | [] | no_license | NicoCardenas/Proyecto_Arqc | 34adcb0da6286c393cfc316eacf986195add1531 | 6425534ece7212fb68604303c4a17c6eaadde994 | refs/heads/master | 2020-03-08T18:11:16.233688 | 2018-04-11T02:57:01 | 2018-04-11T02:57:01 | 128,289,727 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,705 | tst | Mux16Way16.tst | // File name: Mux16Way16.tst
load Mux16Way16.hdl,
output-file Mux16Way16.out,
compare-to Mux16Way16.cmp,
output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 i%B1.16.1 j%B1.16.1 k%B1.16.1 l%B1.16.1 m%B1.16.1 n%B1.16.1 o%B1.16.1 p%B1.16.1 sel%B2.4.2 out%B1.16.1;
set a 0,
set b 0,
set c 0,
set d 0,
set e 0,
set f 0,
set g 0,
set h 0,
set i 0,
set j 0,
set k 0,
set l 0,
set m 0,
set n 0,
set o 0,
set p 0,
set sel 0,
eval,
output;
set sel 1,
eval,
output;
set sel 2,
eval,
output;
set sel 3,
eval,
output;
set sel 4,
eval,
output;
set sel 5,
eval,
output;
set sel 6,
eval,
output;
set sel 7,
eval,
output;
set sel 8,
eval,
output;
set sel 9,
eval,
output;
set sel 10,
eval,
output;
set sel 11,
eval,
output;
set sel 12,
eval,
output;
set sel 13,
eval,
output;
set sel 14,
eval,
output;
set sel 15,
eval,
output;
set a %B0001001000110100,
set b %B0010001101000101,
set c %B0011010001010110,
set d %B0100010101100111,
set e %B0101011001111000,
set f %B0110011110001001,
set g %B0111100010011010,
set h %B1000100110101011,
set i %B1000100110101100,
set j %B1000100110101101,
set k %B1000100110101110,
set l %B1000100110101111,
set m %B1000100110110000,
set n %B1000100110110001,
set o %B1000100110110010,
set p %B1000100110110011,
set sel 0,
eval,
output;
set sel 1,
eval,
output;
set sel 2,
eval,
output;
set sel 3,
eval,
output;
set sel 4,
eval,
output;
set sel 5,
eval,
output;
set sel 6,
eval,
output;
set sel 7,
eval,
output;
set sel 8,
eval,
output;
set sel 9,
eval,
output;
set sel 10,
eval,
output;
set sel 11,
eval,
output;
set sel 12,
eval,
output;
set sel 13,
eval,
output;
set sel 14,
eval,
output;
set sel 15,
eval,
output;
|
c1c9c874301fd13f91a08a1bc38aac420a9bb493 | 349b0dbeaccc8b9113434c7bce7b9166f4ad51de | /src/1a/calage1.sci | 7e2e8a44698e14b727a627fa9cdacd217e278c0d | [] | no_license | jbailhache/log | 94a89342bb2ac64018e5aa0cf84c19ef40aa84b4 | 2780adfe3df18f9e40653296aae9c56a31369d47 | refs/heads/master | 2021-01-10T08:55:43.044934 | 2020-01-09T02:57:38 | 2020-01-09T02:57:38 | 54,238,064 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 310 | sci | calage1.sci |
A = [ 0, 0, 1, 0;
0, 0, 0, 1;
10, 0, 1, 0;
0, 10, 0, 1;
20, 0, 1, 0;
0, 20, 0, 1];
K = [100; 200; 110; 200; 100; 210]
P = diag ([1,1,1,1,1,1])
tAPA = A'*P*A
itAPA = inv (tAPA)
tAPK = A' * P * K
abpq = itAPA * tAPK
a=abpq(1)
b=abpq(2)
p=abpq(3)
q=abpq(4) |
a08804d5e3eb652a7b765a3a37b677d90d45fb6c | 449d555969bfd7befe906877abab098c6e63a0e8 | /2409/CH12/EX12.11/Ex12_11.sce | 8d0b158bfbfdc46fa010290fd3481b499ff985af | [] | 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 | 438 | sce | Ex12_11.sce |
//Variable Declaration
Ps=-91.4 //saturation flux density(dBW/m2)
f=14 //uplink frequency(GHz)
GTR=-6.7 //G/T (dB/k)
BO=11 //Input Back off(dB)
k=-228.6 //Value of k(dB)
RFL=0.6 //receiver feeder loss
//Calculation
A0=-21.5-20*log10(f) //Effective antenna aperture(dB)
CNR=Ps+A0-BO+GTR-k-RFL //carrier to noise ratio(dB)
//Result
disp(A0)
printf("The carrier to noise ratio is %.1f dB",CNR)
|
1f7aa89e32314b8b10893640299180d8b0071955 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1430/CH9/EX9.1/exa9_1.sce | 5e11a0e9d02f3fcb604c4408c27c03b3eb7d7357 | [] | 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 | 629 | sce | exa9_1.sce | // Example 9.1
// Zero-Input Response of an RL circuit
// From figure 9.5
L=60*10^-3;
R_eq=40+10;// Equivalent resistance
tau=L/R_eq; // Time constant
// Let us denote y(0^-) by y_bef and y(0^+) by y_aft
i_bef= 25/10; // t<0 , under steady state conditions
// form the continuity equation of inductor current we get
i_aft=i_bef;
v_bef=25;
t=0:0.0001:0.01;
i=i_aft*%e^(-t/tau); // t>0
v=-40*i; // t>0
subplot(2,1,1)
plot(t,i,'r');
xlabel('t')
ylabel('i(t)')
title('Current Waveform of inductor')
subplot(2,1,2)
plot(t,v,'-g')
xlabel('t')
ylabel('v(t)')
title('Voltage Waveform across 40-Ohm resistance')
|
c21d0527a02e68c428c7b4275439ddf20191d5c1 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2699/CH14/EX14.10/Ex14_10.sce | c7ec28b14d115f552a5d03684a9408d073ec1656 | [] | 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 | 401 | sce | Ex14_10.sce | //example 14.10 PG-14.39
clc
clear
printf("Given=> A''B''C''+A''BC''+A''BC = A''C''(B''+B)+A''BC ......Distributive property")
printf("\n\n A''B''C''+A''BC''+A''BC = A''C''+ A''BC .........Since A+A''=1\n\n")
printf(" A''B''C''+A''BC''+A''BC = A''(C''+BC) .........Distributive property")
printf("\n\n A''B''C''+A''BC''+A''BC = A''(C''+B) .............Since A+A''B=A+B")
|
cdb7283ddefafbf29bdb3ec1676e9fc45eb69715 | 1bb72df9a084fe4f8c0ec39f778282eb52750801 | /test/PV5.prev.tst | ced31fa63d3757fa82f6904c41c0800f8d103f6c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | gfis/ramath | 498adfc7a6d353d4775b33020fdf992628e3fbff | b09b48639ddd4709ffb1c729e33f6a4b9ef676b5 | refs/heads/master | 2023-08-17T00:10:37.092379 | 2023-08-04T07:48:00 | 2023-08-04T07:48:00 | 30,116,803 | 2 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 76 | tst | PV5.prev.tst | parse: [0,(8*n^2+28*n+24),(-n^2-4*n-3)]
matrix:[[0],[24,28,8],[-3,-4,-1]]
|
873810161a885cfc33dadf87eef9339db831e9e7 | fbed2099cbc592fa10384c5232f17cf75399bd6d | /data/SAMPLE_CAMERACAPTURE/scenario/cameraOutputs.sce | 29694f49144a50504e4c285b71835b90ee25ecda | [] | no_license | AVSGuillaume/Samples-Pack-1 | ff21835de28de8f61bf8d192829b024922344f7d | 2968cb9d4269d57fb44650b2cda60da7005c0fc2 | refs/heads/main | 2023-04-19T16:42:25.925838 | 2021-04-12T19:48:40 | 2021-04-12T19:48:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 25,265 | sce | cameraOutputs.sce | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<sce version="20.21.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Scenario>
<description></description>
<name></name>
<online>1</online>
<steadystate>0</steadystate>
<Environment>
<gravity>9.81</gravity>
<waterVolumetricMass>1000</waterVolumetricMass>
<DayTime>
<dawnTime>21600</dawnTime>
<day>1</day>
<duskTime>72000</duskTime>
<month>6</month>
<startTime>43200</startTime>
<year>2000</year>
</DayTime>
<Lighting>
<dynamicLighting>1</dynamicLighting>
<lightMax>1</lightMax>
<lightMin>0</lightMin>
</Lighting>
<Panorama>
<file></file>
<scale>0.00225</scale>
</Panorama>
<Weather>
<airTemperature>293.15</airTemperature>
<atmosphericPressure>101500</atmosphericPressure>
<autoComputeFogColor>1</autoComputeFogColor>
<autoComputeFogDistance>1</autoComputeFogDistance>
<cloudsLevel>0.2</cloudsLevel>
<fogColor>0.5 0.5 0.5</fogColor>
<fogDistance>20000</fogDistance>
<fogEnable>1</fogEnable>
<groundTemperature>293.15</groundTemperature>
<hygrometry>0.5</hygrometry>
<rainLevel>0</rainLevel>
<skySaturation>1</skySaturation>
<snowLevel>0</snowLevel>
<snowOnRoad>0</snowOnRoad>
<waterOnRoad>0</waterOnRoad>
</Weather>
</Environment>
<ExternalTraffic>
<extTrafficConfigFile></extTrafficConfigFile>
<replication>0</replication>
</ExternalTraffic>
<ExternalTrafficConnexion>
<host></host>
<port>0</port>
</ExternalTrafficConnexion>
<Ground>
<enableRoughness>0</enableRoughness>
<infrastructure></infrastructure>
<name>Meung2.rnd</name>
<useSpecificSurfaceForTraffic>0</useSpecificSurfaceForTraffic>
</Ground>
<PredefinedRun>
<type>0</type>
<TacticalMobility>
<backupSampleTime>0.1</backupSampleTime>
<brakePedalPressDelay>2</brakePedalPressDelay>
<finalDistance>200</finalDistance>
<gasPedalPressDelay>1</gasPedalPressDelay>
<maxForceOnBrakePedal>400</maxForceOnBrakePedal>
<maxPosGasPedal>1</maxPosGasPedal>
</TacticalMobility>
<StrategicRoadMobility>
<finalDistanceStratMob>200000</finalDistanceStratMob>
<firstMaxSpeedForSlope>25</firstMaxSpeedForSlope>
<firstSlopeCondition>0</firstSlopeCondition>
<fourthMaxSpeedForSlope>8.33333333333333</fourthMaxSpeedForSlope>
<fourthSlopeCondition>-0.1</fourthSlopeCondition>
<maxPosOnBrakePedal>400</maxPosOnBrakePedal>
<maxPosOnGasPedal>1</maxPosOnGasPedal>
<samplingDistanceStratMob>10</samplingDistanceStratMob>
<secondMaxSpeedForSlope>19.4444444444444</secondMaxSpeedForSlope>
<secondSlopeCondition>-0.025</secondSlopeCondition>
<thirdMaxSpeedForSlope>13.8888888888889</thirdMaxSpeedForSlope>
<thirdSlopeCondition>-0.06</thirdSlopeCondition>
</StrategicRoadMobility>
<OperativeMobility>
<finalDistanceOpMob>200</finalDistanceOpMob>
<finalTimeOpMob>300</finalTimeOpMob>
<firstMaxSpeedCondOpMob>25</firstMaxSpeedCondOpMob>
<firstSlopeCondOpMob>0</firstSlopeCondOpMob>
<fourthMaxSpeedCondOpMob>8.33333333333333</fourthMaxSpeedCondOpMob>
<fourthSlopeCondOpMob>-0.1</fourthSlopeCondOpMob>
<isGeneralCriteriaOpMob>1</isGeneralCriteriaOpMob>
<isWarningOnlyCriteriaOpMob>1</isWarningOnlyCriteriaOpMob>
<maxAccelOpMob>1</maxAccelOpMob>
<maxDecelOpMob>4</maxDecelOpMob>
<maxLateralOpMob>3</maxLateralOpMob>
<secondMaxSpeedCondOpMob>19.4444444444444</secondMaxSpeedCondOpMob>
<secondSlopeCondOpMob>-0.025</secondSlopeCondOpMob>
<thirdMaxSpeedCondOpMob>13.8888888888889</thirdMaxSpeedCondOpMob>
<thirdSlopeCondOpMob>-0.06</thirdSlopeCondOpMob>
</OperativeMobility>
<PrecomputationLap>
<areInterimResultsFilesSaved>1</areInterimResultsFilesSaved>
<isNewTrajSavedPrecomputationLap>1</isNewTrajSavedPrecomputationLap>
<isResultFromStartLinePrecomputationLap>1</isResultFromStartLinePrecomputationLap>
<minimalSpeed>8.33333333333333</minimalSpeed>
<nbTurnPoints>20</nbTurnPoints>
</PrecomputationLap>
<DynamicLap>
<brakingPointsPrecision>0.5</brakingPointsPrecision>
<isBrakingPointsIteration>0</isBrakingPointsIteration>
<isCircuitOpenedDynamicLap>0</isCircuitOpenedDynamicLap>
<isRecordUpdatedTrajDynamicLap>1</isRecordUpdatedTrajDynamicLap>
<isResultFromStartLineDynamicLap>1</isResultFromStartLineDynamicLap>
<maxSideslipAngle>0.785398163397448</maxSideslipAngle>
<maxTrajectoryError>2</maxTrajectoryError>
<minSpeed>2.77777777777778</minSpeed>
<timePrecision>0.01</timePrecision>
</DynamicLap>
</PredefinedRun>
<ProgressDlg>
<fullScreen>0</fullScreen>
<playSound>0</playSound>
<refreshRate>10</refreshRate>
<showGraphs>0</showGraphs>
<showView>0</showView>
<ResultsGraph>
<abcissa>131072</abcissa>
<abcissaUnit>s</abcissaUnit>
<tabName>Graph</tabName>
<title>Graph</title>
</ResultsGraph>
</ProgressDlg>
<Recording>
<mode>AUTO</mode>
<recordPath></recordPath>
<ModelHandlerRecorder>
<enable>0</enable>
<enableTrafficRecording>0</enableTrafficRecording>
<isOneEvery>0</isOneEvery>
<oneEvery>1</oneEvery>
<samplePeriod>0.1</samplePeriod>
<zipResultFile>0</zipResultFile>
</ModelHandlerRecorder>
<ScanerNetRecorder/>
</Recording>
<ScenarioStopCriteria>
<finalTime>10</finalTime>
<stopAtFinalTime>1</stopAtFinalTime>
</ScenarioStopCriteria>
<UserDataList/>
<Visual>
<Others>
<loadCache>0</loadCache>
<optimize>1</optimize>
<refreshRate>60</refreshRate>
<viewMode></viewMode>
</Others>
<Quality>
<anisotropicFiltering>8</anisotropicFiltering>
<antiAliasing>8</antiAliasing>
<fadeLOD>0</fadeLOD>
</Quality>
<RoadMarks>
<mode></mode>
<nodeName></nodeName>
<Interval>
<max>0</max>
<min>0</min>
</Interval>
</RoadMarks>
<Sfx>
<dazzleHalo>1</dazzleHalo>
<fog>1</fog>
<fogHalo>1</fogHalo>
<sky>1</sky>
</Sfx>
<Viewing>
<farPlane>5000</farPlane>
<nearPlane>1</nearPlane>
<terrainLODScale>1</terrainLODScale>
<vehicleLODScale>1</vehicleLODScale>
</Viewing>
</Visual>
<Vehicle>
<cabin></cabin>
<decorationName></decorationName>
<driveInReverse>0</driveInReverse>
<driverId>0</driverId>
<id>0</id>
<initEngineRunning>1</initEngineRunning>
<initialDistOnTrajectory>0</initialDistOnTrajectory>
<initialSpeed>0</initialSpeed>
<modelColor>0 0 0</modelColor>
<modelName>BMW_S3_Black_Sapphire</modelName>
<motionId>-1</motionId>
<name>BMW_S3_Black_Sapphire</name>
<process>TRAFFIC</process>
<recomputeRestitutionMovement>1</recomputeRestitutionMovement>
<state>1</state>
<trailerId>-1</trailerId>
<Equipments>
<sensorConfigurationName>bmw</sensorConfigurationName>
<SensorOutputProcs>
<sensorUniqueId>100000</sensorUniqueId>
<OutputProc>
<outputName>sensorPointAnchor</outputName>
<processName>Automatic</processName>
</OutputProc>
<OutputProc>
<outputName>sensorTargetBBox</outputName>
<processName>Automatic</processName>
</OutputProc>
<OutputProc>
<outputName>cameraImage</outputName>
<processName>CAMERASENSOR</processName>
</OutputProc>
</SensorOutputProcs>
</Equipments>
<ItineraryRoadXml>
<endBehaviour>0</endBehaviour>
</ItineraryRoadXml>
<Model>
<Simple/>
</Model>
<ObjectPosition>
<heading>0.611333310604095</heading>
<position>189.981314542428 3712.60560514136 10.0284339153176</position>
<RoadPosition>
<abscissa>3378.28681548072</abscissa>
<gapInItnSystem>1.74999999999983</gapInItnSystem>
<relativeHeading>0</relativeHeading>
<subNetwork>Sub Network</subNetwork>
<track>Branche automatique 33</track>
<zOffset>0</zOffset>
</RoadPosition>
</ObjectPosition>
<StopCriteria>
<finalDistance>100000</finalDistance>
<finalTime>3600</finalTime>
<maxSideslipAngle>0.261799387799149</maxSideslipAngle>
<maxSideslipAngleSpeed>0.349065850398866</maxSideslipAngleSpeed>
<maxSpeed>111.111111111111</maxSpeed>
<maxTrajectoryError>3</maxTrajectoryError>
<minSpeed>0.277777777777778</minSpeed>
<stopCanonContact>0</stopCanonContact>
<stopConeCollision>0</stopConeCollision>
<stopFinalDistance>0</stopFinalDistance>
<stopFinalTime>0</stopFinalTime>
<stopLateralAccelerationPeek>0</stopLateralAccelerationPeek>
<stopMaxSpeed>0</stopMaxSpeed>
<stopMinSpeed>0</stopMinSpeed>
<stopSideslipAngle>0</stopSideslipAngle>
<stopSideslipAngleSpeed>0</stopSideslipAngleSpeed>
<stopSpin>0</stopSpin>
<stopStableMovement>0</stopStableMovement>
<stopStall>0</stopStall>
<stopStallDuration>1</stopStallDuration>
<stopStandstill>0</stopStandstill>
<stopTrajectoryError>0</stopTrajectoryError>
<stopWheelLift>0</stopWheelLift>
</StopCriteria>
<Swarm>
<appearBackRadius>250</appearBackRadius>
<appearFrontRadius>500</appearFrontRadius>
<density>1</density>
<disappearBackRadius>500</disappearBackRadius>
<disappearFrontRadius>1000</disappearFrontRadius>
<frontAppearFactor>0.75</frontAppearFactor>
<queen>-1</queen>
<queenDirectionFactor>0.3</queenDirectionFactor>
</Swarm>
</Vehicle>
<Driver>
<driverName>Driver 0</driverName>
<driverType>TrafficDriver</driverType>
<id>0</id>
<process>TRAFFIC</process>
<TrafficDriver>
<accelCurveObserving>1</accelCurveObserving>
<accelEmergencyPedestrianObserving>1</accelEmergencyPedestrianObserving>
<accelEmergencyVehicleObserving>1</accelEmergencyVehicleObserving>
<accelFollowObserving>1</accelFollowObserving>
<accelRegulationObserving>1</accelRegulationObserving>
<autonomousToDriverTransitionTime>1</autonomousToDriverTransitionTime>
<brakePedalThreashold>1</brakePedalThreashold>
<disconectSteeringWhenAutonomous>1</disconectSteeringWhenAutonomous>
<driverToAutonomousTransitionTime>5</driverToAutonomousTransitionTime>
<gasPedalThreashold>0.01</gasPedalThreashold>
<ignoreDriverPeriod>4</ignoreDriverPeriod>
<laneGapMean>0</laneGapMean>
<laneGapPeriodMean>0</laneGapPeriodMean>
<laneGapPeriodStdDev>0</laneGapPeriodStdDev>
<laneGapStdDev>0.2</laneGapStdDev>
<manualOverrideModule></manualOverrideModule>
<maxSpeed>38.8888888888889</maxSpeed>
<norm>NormalDriver</norm>
<overtakeRisk>0.5</overtakeRisk>
<priorityObserving>1</priorityObserving>
<safetyTime>2.5</safetyTime>
<signObserving>1</signObserving>
<speedLimitRisk>1.1</speedLimitRisk>
<stayOnLane>0</stayOnLane>
<steeringTorqueThreashold>5</steeringTorqueThreashold>
<strategyFile>default</strategyFile>
</TrafficDriver>
<AirplaneDriver>
<Trajectory>
<isClosed>0</isClosed>
<isWithObstacles>0</isWithObstacles>
<notes></notes>
<type>0</type>
<CurvatureTrajectory>
<initialHeading>0</initialHeading>
<initialPosition>0 0</initialPosition>
</CurvatureTrajectory>
<XYTrajectory>
<interpolationType>0</interpolationType>
</XYTrajectory>
</Trajectory>
</AirplaneDriver>
</Driver>
<Vehicle>
<cabin></cabin>
<decorationName></decorationName>
<driveInReverse>0</driveInReverse>
<driverId>1</driverId>
<id>1</id>
<initEngineRunning>1</initEngineRunning>
<initialDistOnTrajectory>0</initialDistOnTrajectory>
<initialSpeed>0</initialSpeed>
<modelColor>0 0 0</modelColor>
<modelName>Kid_Boy_Winter_01</modelName>
<motionId>-1</motionId>
<name>Kid_Boy_Winter_01</name>
<process>WALKERTRAFFIC</process>
<recomputeRestitutionMovement>1</recomputeRestitutionMovement>
<state>1</state>
<trailerId>-1</trailerId>
<Equipments>
<sensorConfigurationName></sensorConfigurationName>
</Equipments>
<ItineraryRoadXml>
<endBehaviour>0</endBehaviour>
</ItineraryRoadXml>
<Model/>
<ObjectPosition>
<heading>0.611333310604095</heading>
<position>221.963173850039 3730.71111393568 10.1296038259267</position>
<RoadPosition>
<abscissa>3414.8680657802</abscissa>
<gapInItnSystem>5.28000000000007</gapInItnSystem>
<relativeHeading>0</relativeHeading>
<subNetwork>Sub Network</subNetwork>
<track>Branche automatique 33</track>
<zOffset>0</zOffset>
</RoadPosition>
</ObjectPosition>
<StopCriteria>
<finalDistance>100000</finalDistance>
<finalTime>3600</finalTime>
<maxSideslipAngle>0.261799387799149</maxSideslipAngle>
<maxSideslipAngleSpeed>0.349065850398866</maxSideslipAngleSpeed>
<maxSpeed>111.111111111111</maxSpeed>
<maxTrajectoryError>3</maxTrajectoryError>
<minSpeed>0.277777777777778</minSpeed>
<stopCanonContact>0</stopCanonContact>
<stopConeCollision>0</stopConeCollision>
<stopFinalDistance>0</stopFinalDistance>
<stopFinalTime>0</stopFinalTime>
<stopLateralAccelerationPeek>0</stopLateralAccelerationPeek>
<stopMaxSpeed>0</stopMaxSpeed>
<stopMinSpeed>0</stopMinSpeed>
<stopSideslipAngle>0</stopSideslipAngle>
<stopSideslipAngleSpeed>0</stopSideslipAngleSpeed>
<stopSpin>0</stopSpin>
<stopStableMovement>0</stopStableMovement>
<stopStall>0</stopStall>
<stopStallDuration>1</stopStallDuration>
<stopStandstill>0</stopStandstill>
<stopTrajectoryError>0</stopTrajectoryError>
<stopWheelLift>0</stopWheelLift>
</StopCriteria>
<Swarm>
<appearBackRadius>250</appearBackRadius>
<appearFrontRadius>500</appearFrontRadius>
<density>1</density>
<disappearBackRadius>500</disappearBackRadius>
<disappearFrontRadius>1000</disappearFrontRadius>
<frontAppearFactor>0.75</frontAppearFactor>
<queen>-1</queen>
<queenDirectionFactor>0.3</queenDirectionFactor>
</Swarm>
</Vehicle>
<Driver>
<driverName>Driver 1</driverName>
<driverType>TrafficDriver</driverType>
<id>1</id>
<process>WALKERTRAFFIC</process>
<TrafficDriver>
<accelCurveObserving>1</accelCurveObserving>
<accelEmergencyPedestrianObserving>1</accelEmergencyPedestrianObserving>
<accelEmergencyVehicleObserving>1</accelEmergencyVehicleObserving>
<accelFollowObserving>1</accelFollowObserving>
<accelRegulationObserving>1</accelRegulationObserving>
<autonomousToDriverTransitionTime>1</autonomousToDriverTransitionTime>
<brakePedalThreashold>1</brakePedalThreashold>
<disconectSteeringWhenAutonomous>1</disconectSteeringWhenAutonomous>
<driverToAutonomousTransitionTime>5</driverToAutonomousTransitionTime>
<gasPedalThreashold>0.01</gasPedalThreashold>
<ignoreDriverPeriod>4</ignoreDriverPeriod>
<laneGapMean>0</laneGapMean>
<laneGapPeriodMean>0</laneGapPeriodMean>
<laneGapPeriodStdDev>0</laneGapPeriodStdDev>
<laneGapStdDev>0.2</laneGapStdDev>
<manualOverrideModule></manualOverrideModule>
<maxSpeed>0.988888888888889</maxSpeed>
<norm>NormalDriver_Pedestrian</norm>
<overtakeRisk>-0.11</overtakeRisk>
<priorityObserving>1</priorityObserving>
<safetyTime>0.78</safetyTime>
<signObserving>1</signObserving>
<speedLimitRisk>0.98</speedLimitRisk>
<stayOnLane>0</stayOnLane>
<steeringTorqueThreashold>5</steeringTorqueThreashold>
<strategyFile>default</strategyFile>
</TrafficDriver>
<AirplaneDriver>
<Trajectory>
<isClosed>0</isClosed>
<isWithObstacles>0</isWithObstacles>
<notes></notes>
<type>0</type>
<CurvatureTrajectory>
<initialHeading>0</initialHeading>
<initialPosition>0 0</initialPosition>
</CurvatureTrajectory>
<XYTrajectory>
<interpolationType>0</interpolationType>
</XYTrajectory>
</Trajectory>
</AirplaneDriver>
</Driver>
<Vehicle>
<cabin></cabin>
<decorationName></decorationName>
<driveInReverse>0</driveInReverse>
<driverId>2</driverId>
<id>2</id>
<initEngineRunning>1</initEngineRunning>
<initialDistOnTrajectory>0</initialDistOnTrajectory>
<initialSpeed>0</initialSpeed>
<modelColor>0 0 0</modelColor>
<modelName>BMW_S3_Melbourne_Red</modelName>
<motionId>-1</motionId>
<name>BMW_S3_Melbourne_Red</name>
<process>TRAFFIC</process>
<recomputeRestitutionMovement>1</recomputeRestitutionMovement>
<state>1</state>
<trailerId>-1</trailerId>
<Equipments>
<sensorConfigurationName></sensorConfigurationName>
</Equipments>
<ItineraryRoadXml>
<endBehaviour>0</endBehaviour>
</ItineraryRoadXml>
<Model>
<Simple/>
</Model>
<ObjectPosition>
<heading>3.75292587280273</heading>
<position>218.51483774349 3736.87901675867 10.0043375018232</position>
<RoadPosition>
<abscissa>3415.58440867129</abscissa>
<gapInItnSystem>-1.74999999999982</gapInItnSystem>
<relativeHeading>3.14159250259399</relativeHeading>
<subNetwork>Sub Network</subNetwork>
<track>Branche automatique 33</track>
<zOffset>0</zOffset>
</RoadPosition>
</ObjectPosition>
<StopCriteria>
<finalDistance>100000</finalDistance>
<finalTime>3600</finalTime>
<maxSideslipAngle>0.261799387799149</maxSideslipAngle>
<maxSideslipAngleSpeed>0.349065850398866</maxSideslipAngleSpeed>
<maxSpeed>111.111111111111</maxSpeed>
<maxTrajectoryError>3</maxTrajectoryError>
<minSpeed>0.277777777777778</minSpeed>
<stopCanonContact>0</stopCanonContact>
<stopConeCollision>0</stopConeCollision>
<stopFinalDistance>0</stopFinalDistance>
<stopFinalTime>0</stopFinalTime>
<stopLateralAccelerationPeek>0</stopLateralAccelerationPeek>
<stopMaxSpeed>0</stopMaxSpeed>
<stopMinSpeed>0</stopMinSpeed>
<stopSideslipAngle>0</stopSideslipAngle>
<stopSideslipAngleSpeed>0</stopSideslipAngleSpeed>
<stopSpin>0</stopSpin>
<stopStableMovement>0</stopStableMovement>
<stopStall>0</stopStall>
<stopStallDuration>1</stopStallDuration>
<stopStandstill>0</stopStandstill>
<stopTrajectoryError>0</stopTrajectoryError>
<stopWheelLift>0</stopWheelLift>
</StopCriteria>
<Swarm>
<appearBackRadius>250</appearBackRadius>
<appearFrontRadius>500</appearFrontRadius>
<density>1</density>
<disappearBackRadius>500</disappearBackRadius>
<disappearFrontRadius>1000</disappearFrontRadius>
<frontAppearFactor>0.75</frontAppearFactor>
<queen>-1</queen>
<queenDirectionFactor>0.3</queenDirectionFactor>
</Swarm>
</Vehicle>
<Driver>
<driverName>Driver 2</driverName>
<driverType>TrafficDriver</driverType>
<id>2</id>
<process>TRAFFIC</process>
<TrafficDriver>
<accelCurveObserving>1</accelCurveObserving>
<accelEmergencyPedestrianObserving>1</accelEmergencyPedestrianObserving>
<accelEmergencyVehicleObserving>1</accelEmergencyVehicleObserving>
<accelFollowObserving>1</accelFollowObserving>
<accelRegulationObserving>1</accelRegulationObserving>
<autonomousToDriverTransitionTime>1</autonomousToDriverTransitionTime>
<brakePedalThreashold>1</brakePedalThreashold>
<disconectSteeringWhenAutonomous>1</disconectSteeringWhenAutonomous>
<driverToAutonomousTransitionTime>5</driverToAutonomousTransitionTime>
<gasPedalThreashold>0.01</gasPedalThreashold>
<ignoreDriverPeriod>4</ignoreDriverPeriod>
<laneGapMean>0</laneGapMean>
<laneGapPeriodMean>0</laneGapPeriodMean>
<laneGapPeriodStdDev>0</laneGapPeriodStdDev>
<laneGapStdDev>0.2</laneGapStdDev>
<manualOverrideModule></manualOverrideModule>
<maxSpeed>33.2527777777778</maxSpeed>
<norm>NormalDriver</norm>
<overtakeRisk>-0.13</overtakeRisk>
<priorityObserving>1</priorityObserving>
<safetyTime>1.54</safetyTime>
<signObserving>1</signObserving>
<speedLimitRisk>0.97</speedLimitRisk>
<stayOnLane>0</stayOnLane>
<steeringTorqueThreashold>5</steeringTorqueThreashold>
<strategyFile>default</strategyFile>
</TrafficDriver>
<AirplaneDriver>
<Trajectory>
<isClosed>0</isClosed>
<isWithObstacles>0</isWithObstacles>
<notes></notes>
<type>0</type>
<CurvatureTrajectory>
<initialHeading>0</initialHeading>
<initialPosition>0 0</initialPosition>
</CurvatureTrajectory>
<XYTrajectory>
<interpolationType>0</interpolationType>
</XYTrajectory>
</Trajectory>
</AirplaneDriver>
</Driver>
<ScenarioScript>
<isScriptActive>1</isScriptActive>
<script>
TYPEOF SCENARIO (0)
{
IS_EXPANDED="1"
LABEL="Main"
FILE="cameraOutputs_Main"
TASK_KIND="0"
TYPEOF RULE (1)
{
IS_EXPANDED="1"
LABEL="Rule: Move pedestrian out of beam after 5s"
TYPEOF CONDITION (SUPEQUAL)
{
IS_EXPANDED="1"
MODIFIER="BECOMES_TRUE"
TYPEOF PARAMETER (OPERAND_1)
{
KIND="FUNCTION"
TYPEOF FUNCTION (GET_SCENARIO_CLOCK)
{
}
OWNER_FILE=""
}
TYPEOF PARAMETER (OPERAND_2)
{
KIND="USER"
VALUE="2"
OWNER_FILE=""
}
}
TYPEOF ACTION (SET_VHL_POSITION)
{
IS_EXPANDED="1"
TYPEOF PARAMETER (VHL_NUMBER)
{
KIND="VEHICLE"
VALUE="1"
OWNER_FILE=""
}
TYPEOF PARAMETER (MAP_XPOSITION)
{
KIND="USER"
VALUE="190.954"
OWNER_FILE=""
}
TYPEOF PARAMETER (MAP_YPOSITION)
{
KIND="USER"
VALUE="3708.98"
OWNER_FILE=""
}
TYPEOF PARAMETER (HEADING)
{
KIND="USER"
VALUE="0"
OWNER_FILE=""
}
}
}
TYPEOF RULE (2)
{
IS_EXPANDED="1"
LABEL="Rule: Move car out of beam after 10s"
TYPEOF CONDITION (SUPEQUAL)
{
IS_EXPANDED="1"
MODIFIER="BECOMES_TRUE"
TYPEOF PARAMETER (OPERAND_1)
{
KIND="FUNCTION"
TYPEOF FUNCTION (GET_SCENARIO_CLOCK)
{
}
OWNER_FILE=""
}
TYPEOF PARAMETER (OPERAND_2)
{
KIND="USER"
VALUE="5"
OWNER_FILE=""
}
}
TYPEOF ACTION (SET_VHL_POSITION)
{
IS_EXPANDED="1"
TYPEOF PARAMETER (VHL_NUMBER)
{
KIND="VEHICLE"
VALUE="2"
OWNER_FILE=""
}
TYPEOF PARAMETER (MAP_XPOSITION)
{
KIND="USER"
VALUE="186.295"
OWNER_FILE=""
}
TYPEOF PARAMETER (MAP_YPOSITION)
{
KIND="USER"
VALUE="3714.54"
OWNER_FILE=""
}
TYPEOF PARAMETER (HEADING)
{
KIND="USER"
VALUE="0"
OWNER_FILE=""
}
}
}
TYPEOF RULE (0)
{
IS_EXPANDED="1"
LABEL="Rule: Move car in beam after 15s"
TYPEOF CONDITION (SUPEQUAL)
{
IS_EXPANDED="1"
MODIFIER="BECOMES_TRUE"
TYPEOF PARAMETER (OPERAND_1)
{
KIND="FUNCTION"
TYPEOF FUNCTION (GET_SCENARIO_CLOCK)
{
}
OWNER_FILE=""
}
TYPEOF PARAMETER (OPERAND_2)
{
KIND="USER"
VALUE="8"
OWNER_FILE=""
}
}
TYPEOF ACTION (SET_VHL_POSITION)
{
IS_EXPANDED="1"
TYPEOF PARAMETER (VHL_NUMBER)
{
KIND="VEHICLE"
VALUE="2"
OWNER_FILE=""
}
TYPEOF PARAMETER (MAP_XPOSITION)
{
KIND="USER"
VALUE="294.059"
OWNER_FILE=""
}
TYPEOF PARAMETER (MAP_YPOSITION)
{
KIND="USER"
VALUE="3785.22"
OWNER_FILE=""
}
TYPEOF PARAMETER (HEADING)
{
KIND="USER"
VALUE="0"
OWNER_FILE=""
}
}
}
}
</script>
<scriptLanguage>mice</scriptLanguage>
<scriptName>Main</scriptName>
</ScenarioScript>
</Scenario>
</sce>
|
cd0aedcf0324052339a304583e4b3ce0f714735e | 449d555969bfd7befe906877abab098c6e63a0e8 | /199/CH6/EX6.15/Example_6_15.sce | 07ccbb059efa65d466f3cea8a82bb83e1cac781b | [] | 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 | 451 | sce | Example_6_15.sce | // Chapter6
// Page.No-230, Figure.No-6.23
// Example_6_15
// Output voltage of an integrator
// Given
clear;clc;
Vin=2; // Input voltage in volt
Vo0=0;
Vo1=-integrate('2','t',0,1);
disp(Vo1)
Vo2=-integrate('2','t',1,2)+Vo1;
disp(Vo2)
Vo3=-integrate('2','t',2,3)+Vo2;
disp(Vo3)
Vo4=-integrate('2','t',3,4)+Vo3;
disp(Vo4)
Vo=[Vo0 Vo1 Vo2 Vo3 Vo4];
t=[0 1 2 3 4];
plot(t,Vo);
title('Output Voltage');
xlabel('t');
ylabel('Vo');
|
6ebcdac6731417dd205c87a60d491bc4436f911b | 449d555969bfd7befe906877abab098c6e63a0e8 | /1271/CH8/EX8.2/example8_2.sce | 3c91cb151098c725a5305fdfc79ca616c2c3e212 | [] | 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 | example8_2.sce | clc
// Given that
T = 373 // temperature in kelvin
d = 1.293e-3 // density of air at S.T.P. in gm/cm^3
d_ = 13.6 // density of mercury in gm/cm^3
s = 0.2417 // specific heat of air at constant pressure
s_ = 0.1715 // specific heat of air at constant volume
g = 980 // gravitational constant i dynes/cm^3
// Sample Problem 2 on page no. 8.18
printf("\n # PROBLEM 2 # \n")
printf(" Standard formula used \n")
printf(" nu = (gamma*p/rho)^1/2 \n gamma = C_p/C_v \n p =rho*g*h \n" )
p = 76 * d_ * g
gama = s / s_
v = sqrt(gama * (p / d))
v_ = v * sqrt(T / 273)
printf("\n Velocity of sound in the air in %f cm/sec.",v_)
|
d31991ecd7aeda50d95335dd6cb41359b2806588 | 0fe450b52908c4de1f70576ebfbce8d2b98ec427 | /src/test_ods_1_b.tst | b4e97ab48b1e70fde48be6e4f44df7f1ea8f6ba5 | [
"MIT",
"Zlib",
"BSD-3-Clause",
"OML"
] | permissive | technologiespro/ciyam | 41c75cce77fed8db16439b10698c6fd0db10d4d5 | 5a63b84251132b393221500edb0e285cc4f38a7d | refs/heads/master | 2020-12-02T10:05:46.529201 | 2017-07-09T08:55:53 | 2017-07-09T08:55:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 367 | tst | test_ods_1_b.tst | ** File Info
Version Id = 65536
Num Trans = 0
Num Writers = 0
Init Tranlog = 0
Total Entries = 14
Tranlog Offset = 0
Transaction Id = 17
Index Free List = 13
Total Size of Data = 428
Data Transformation Id = 16
Index Transformation Id = 58
** Freelist Info
First freelist entry = 12
Iterating over freelist...(OK)
Last freelist entry = 13
Total freelist entries = 2
|
84de475a3a2963d7132315ffc2dbc11cc772f3a9 | f75b5e931e4dd0edfbd407f79ebdfff53b8ad95e | /Matlab codes/bandstop_IIR.sce | 7ac31c08dbb613cf5564caa0b9fc0a822b061eb5 | [] | no_license | debarnab-mitra/Filter-Design | 6885c4d181f7042c00a641f390a5f9681f3a9d34 | a45ad042d2f0f80b82493cde3a07be4d72912673 | refs/heads/master | 2020-03-31T02:26:11.902775 | 2018-10-06T09:18:19 | 2018-10-06T09:18:19 | 151,823,602 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,927 | sce | bandstop_IIR.sce |
m = 47;
q_m = 4;
r_m = 7;
B_l = 2 + 0.6*q_m + 1.5*r_m;
B_h = B_l + 3;
transition_width = 1;
f_s = 90;
un_ws1 = B_l;
un_ws2 = B_h;
un_wp1 = un_ws1 - transition_width;
un_wp2 = un_ws2 + transition_width;
w_p1 = 2*%pi*un_wp1/f_s;
w_p2 = 2*%pi*un_wp2/f_s;
w_s1 = 2*%pi*un_ws1/f_s;
w_s2 = 2*%pi*un_ws2/f_s;
//analog filter specifications
W_p1 = tan(w_p1/2);
W_p2 = tan(w_p2/2);
W_s1 = tan(w_s1/2);
W_s2 = tan(w_s2/2);
W_o = sqrt(W_p1*W_p2);
B = W_p2 - W_p1
//low pass
Wl_p1 = -1;
Wl_p2 = 1;
Wl_s1 = (B*W_s1)/(-1*W_s1^2 + W_o^2);
Wl_s2 = (B*W_s2)/(-1*W_s2^2 + W_o^2);
Wl_s = min(abs(Wl_s1),abs(Wl_s2));
Wl_p = 1;
//chebyschev
delta = 0.1
D1 = (1/((1-delta)^2)) - 1;
D2 = (1/delta^2) - 1;
//N>= Ns
Ns = (acosh(sqrt(D2/D1)))/(acosh((Wl_s/Wl_p)));
epsilon = sqrt(D1);
N = ceil(Ns);
// hanalog(s)
k_o = 1/sqrt(1+ epsilon^2);
B_k = (asinh(1/epsilon))/N;
// we get N = 4
// finding poles
k = linspace(N,(2*N-1),N);
A_k = ((2.*k +1)*%pi)/(2*N);
S_7_k = Wl_p*(sin(A_k).*sinh(B_k)+ complex(0,1).*cos(A_k).*cosh(B_k));
// defining the polynominal
s= poly(0,'s');
a = k_o*((-1)^N)*(real(prod(S_7_k)));
b = real(poly(S_7_k,'s'));
HanalogLPF = syslin('c', a/b);
// converting back to analog bandpass
HanalogBPF = syslin('c',horner(HanalogLPF,((B*s)/(s^2+ W_o^2))));
// converting to digital domain
z= poly(0, 'z');
p = (z-1)/(z+1);
q = (B*p)/(p^2+ W_o^2);
Hdiscrete = syslin('c',horner(HanalogLPF,q));
k = linspace(0,1023,1024);
k1 = linspace(0,1,2);
w = (%pi*k)/1024;
y1 = horner(Hdiscrete,complex(cos(w),sin(w)));
y2 = 1*ones(1024,1);
y3 = 0.9*ones(1024,1);
y4 = 0.1*ones(1024,1);
y_wp1 = w_p1*ones(2,1);
y_wp2 = w_p2*ones(2,1);
y_ws1 = w_s1*ones(2,1);
y_ws2 = w_s2*ones(2,1);
plot(w,abs(y1),'g');
plot(w,y2);
plot(w,y3);
plot(w,y4);
plot(y_wp1,k1);
plot(y_wp2,k1);
plot(y_ws1,k1);
plot(y_ws2,k1);
|
0780cc589651bc9df44de7507c5419f59d795692 | 449d555969bfd7befe906877abab098c6e63a0e8 | /98/CH5/EX5.5/example5_5.sce | 7e9847d43ad7363f9073e86959e2054073ec9c02 | [] | 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 | 636 | sce | example5_5.sce | //Chapter 5
//Example 5_5
//PAge 92
clear;clc;
md=50;
u=18*1e7;
ad=75;
fc=9000000;
fcg=2800000;
fctnd=3200000;
l=0.15;
rc=0.9;
printf("Annual fixed charges\n");
fuel=(1-rc)*fc;
tac=fcg+fctnd+fuel;
printf("Total annual charges = Rs. %.0f \n", tac);
cmd=tac/ad/1000;
printf("Cost per kW of maximum demand = Rs. %.0f \n\n", cmd);
printf("Annual running charges\n");
cf=rc*fc;
udc=(1-l)*u;
c=cf/udc;
printf("Cost of fuel = Rs. %.0f \n", cf);
printf("Units deliivered to consumers = %.0f kWh \n", udc);
printf("Cost per kWh = Rs. %.3f \n\n", c);
printf("Tariff is Rs. %.0f of maximum demand plus %.3f rupess per kWh \n\n", cmd, c);
|
8503a05bdf74122c25e1ed685f799c98722b4a19 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1088/CH1/EX1.5/Example5.sce | 529f9ee59ca142db55890a5e63bec68b18d9da7b | [] | 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 | 421 | sce | Example5.sce | clear
clc
disp("Example 5: Display all the current working processes in the current session")
printf("\n*******************************************************************\n")
disp('Answer : ')
disp('')
halt('Press Enter to display the processes')
if (getos()=='Windows') then
clc(1)
powershell('ps')
else
clc(1)
unix_w('ps')
end
printf("\n*******************************************************************\n")
|
cbb0e036d999e07d2c8a9dcef1675eafb5289dcf | 449d555969bfd7befe906877abab098c6e63a0e8 | /2288/CH4/EX4.16.4/ex4_16_4.sce | f477618e5b3a1b5a1ed1547a666069e5aaeab826 | [] | 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 | 363 | sce | ex4_16_4.sce | //Exa 4.16.4
clc;
clear;
close;
// Given data
// Part (i)
T1= 25;// in °C
T2= 80;// in °C
// Formula Io2= Io1*2^((T2-T1)/10)
AntiFactor= 2^((T2-T1)/10);
disp(round(AntiFactor),"Anticipated factor for Ge is : ")
// Part (ii)
T1= 25;// in °C
T2= 150;// in °C
AntiFactor= 2^((T2-T1)/10);
disp(round(AntiFactor),"Anticipated factor for Si is : ")
|
1ec89990f1910e88677056cc9f74e2fcc0236d53 | 8217f7986187902617ad1bf89cb789618a90dd0a | /browsable_source/2.4.1/Unix-Windows/scilab-2.4.1/tests/examples.tst | 7d78032c52394930e1b0700bed76d7c668f916de | [
"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 | 309,051 | tst | examples.tst | // Fri Oct 30 14:40:47 MET 1998
//====================================================
// ../man/arma/arma.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/armac.man
//====================================================
clear;lines(0);
a=[1,-2.851,2.717,-0.865].*.eye(2,2)
b=[0,1,1,1].*.[1;1];
d=[1,0.7,0.2].*.eye(2,2);
sig=eye(2,2);
ar=armac(a,b,d,2,1,sig)
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/armax.man
//====================================================
clear;lines(0);
[arc,a,b,sig,resid]=armax(); // will gives an example in dimension 1
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/armax1.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/arsimul.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/narsimul.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/noisegen.man
//====================================================
clear;lines(0);
noisegen(0.5,30,1.0);
x=-5:0.01:35;
y=feval(x,Noise);
plot(x,y);
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/odedi.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/prbs_a.man
//====================================================
clear;lines(0);
u=prbs_a(50,10);
plot2d2("onn",(1:50)',u',1,"151",' ',[0,-1.5,50,1.5]);
for k=winsid(),xdel(k);end
//====================================================
// ../man/arma/reglin.man
//====================================================
clear;lines(0);
// simulation of data for a(3,5) and b(3,1)
x=rand(5,100);
aa=testmatrix('magi',5);aa=aa(1:3,:);
bb=[9;10;11]
y=aa*x +bb*ones(1,100)+ 0.1*rand(3,100);
// identification
[a,b,sig]=reglin(x,y);
maxi(abs(aa-a))
maxi(abs(bb-b))
// an other example : fitting a polynom
f=1:100; x=[f.*f; f];
y= [ 2,3]*x+ 10*ones(f) + 0.1*rand(f);
[a,b]=reglin(x,y)
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/Communications.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/CreateLink.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/DestroyLink.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/ExecAppli.man
//====================================================
clear;lines(0);
h=unix_g("hostname")
ExecAppli(SCI+"/bin/scilex",h,"Scilab2")
CreateLink("SELF","Scilab2")
ExecAppli(SCI+"/bin/scilex -ns",h,"Scilab3")
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/ExecScilab.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/ExeclScilab.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/GetMsg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/SendMsg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/comm/WaitMsg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/abcd.man
//====================================================
clear;lines(0);
A=diag([1,2,3]);B=[1;1;1];C=[2,2,2];
sys=syslin('c',A,B,C);
sys("A")
sys("C")
[A1,B1,C1,D1]=abcd(sys);
A1
systf=ss2tf(sys);
[a,b,c,d]=abcd(systf)
spec(a)
c*b-C*B
c*a*b-C*A*B
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/abinv.man
//====================================================
clear;lines(0);
nu=3;ny=4;nx=7;
nrt=2;ngt=3;ng0=3;nvt=5;rk=2;
flag=list('on',nrt,ngt,ng0,nvt,rk);
Sl=ssrand(ny,nu,nx,flag);alfa=-1;beta=-2;
[X,dims,F,U,k,Z]=abinv(Sl,alfa,beta);
[A,B,C,D]=abcd(Sl);dimV=dims(3);dimR=dims(1);
V=X(:,1:dimV);X2=X(:,dimV+1:nx);
X2'*(A+B*F)*V
(C+D*F)*V
X0=X(:,dimR+1:dimV); spec(X0'*(A+B*F)*X0)
trzeros(Sl)
spec(A+B*F) //nr=2 evals at -1 and noc-dimV=2 evals at -2.
clean(ss2tf(Sl*Z))
A=diag(1:6);A(2,2)=-7;A(5,5)=-9;B=[1,2;0,3;0,4;0,5;0,0;0,0];C=[zeros(3,3),eye(3,3)];
sl=syslin('c',A,B,C);sl=ss2ss(sl,rand(6,6));
[X,dims,F,U,k,Z]=abinv(sl,alfa,beta);
[A,B,C,D]=abcd(sl);clean(X'*(A+B*F)*X)
clean(X'*B*U)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/arhnk.man
//====================================================
clear;lines(0);
A=diag([-1,-2,-3,-4,-5]);B=rand(5,1);C=rand(1,5);
sl=syslin('c',A,B,C);
slapprox=arhnk(sl,2);
[nk,W]=hankelsv(sl);nk
[nkred,Wred]=hankelsv(slapprox);nkred
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/arl2.man
//====================================================
clear;lines(0);
v=ones(1,20);
xbasc();
plot2d1('enn',0,[v';zeros(80,1)],2,'051',' ',[1,-0.5,100,1.5])
[d,n,e]=arl2(v,poly(1,'z','c'),1)
plot2d1('enn',0,ldiv(n,d,100),2,'000')
[d,n,e]=arl2(v,d,3)
plot2d1('enn',0,ldiv(n,d,100),3,'000')
[d,n,e]=arl2(v,d,8)
plot2d1('enn',0,ldiv(n,d,100),5,'000')
[d,n,e]=arl2(v,poly(1,'z','c'),4,'all')
plot2d1('enn',0,ldiv(n(1),d(1),100),10,'000')
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/balreal.man
//====================================================
clear;lines(0);
A=diag([-1,-2,-3,-4,-5]);B=rand(5,2);C=rand(1,5);
sl=syslin('c',A,B,C);
[slb,U]=balreal(sl);
Wc=clean(ctr_gram(slb))
W0=clean(obs_gram(slb))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/bilin.man
//====================================================
clear;lines(0);
s=poly(0,'s');z=poly(0,'z');
w=ssrand(1,1,3);
wtf=ss2tf(w);v=[2,3,-1,4];a=v(1);b=v(2);c=v(3);d=v(4);
[horner(wtf,(a*z+b)/(c*z+d)),ss2tf(bilin(w,[a,b,c,d]))]
clean(ss2tf(bilin(bilin(w,[a,b,c,d]),[d,-b,-c,a]))-wtf)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/cainv.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/calfrq.man
//====================================================
clear;lines(0);
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
[f1,spl]=calfrq(h1,0.01,1000);
rf=repfreq(h1,f1);
plot2d(real(rf)',imag(rf)')
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/canon.man
//====================================================
clear;lines(0);
A=[1,2,3,4,5;
1,0,0,0,0;
0,1,0,0,0;
6,7,8,9,0;
0,0,0,1,0];
B=[1,2;
0,0;
0,0;
2,1;
0,0];
X=rand(5,5);A=X*A*inv(X);B=X*B; //Controllable pair
[Ac,Bc,U,ind]=canon(A,B); //Two indices --> ind=[3.2];
index=1;for k=1:size(ind,'*')-1,index=[index,1+sum(ind(1:k))];end
Acstar=Ac(index,:);Bcstar=Bc(index,:);
s=poly(0,'s');
p1=s^3+2*s^2-5*s+3;p2=(s-5)*(s-3);
//p1 and p2 are desired closed-loop polynomials with degrees 3,2
c1=coeff(p1);c1=c1($-1:-1:1);c2=coeff(p2);c2=c2($-1:-1:1);
Acstardesired=[-c1,0,0;0,0,0,-c2];
//Acstardesired(index,:) is companion matrix with char. pol=p1*p2
F=Bcstar\(Acstardesired-Acstar); //Feedbak gain
Ac+Bc*F // Companion form
spec(A+B*F/U) // F/U is the gain matrix in original basis.
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/cls2dls.man
//====================================================
clear;lines(0);
s=poly(0,'s');z=poly(0,'z');
sl=syslin('c',(s+1)/(s^2-5*s+2)); //Continuous-time system in transfer form
slss=tf2ss(sl); //Now in state-space form
sl1=cls2dls(slss,0.2); //sl1= output of cls2dls
sl1t=ss2tf(sl1) // Converts in transfer form
sl2=horner(sl,(2/0.2)*(z-1)/(z+1)) //Compare sl2 and sl1
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/colregul.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/cont_frm.man
//====================================================
clear;lines(0);
s=poly(0,'s');NUM=[1+s,s];den=s^2-5*s+1;
sl=cont_frm(NUM,den);
slss=ss2tf(sl); //Compare with NUM/den
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/cont_mat.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/contr.man
//====================================================
clear;lines(0);
W=ssrand(2,3,5,list('co',3)); //cont. subspace has dim 3.
A=W("A");B=W("B");
[n,U]=contr(A,B);n
A1=U'*A*U;
spec(A1(n+1:$,n+1:$)) //uncontrollable modes
spec(A+B*rand(3,5))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/contrss.man
//====================================================
clear;lines(0);
A=[1,1;0,2];B=[1;0];C=[1,1];sl=syslin('c',A,B,C); //Non minimal
slc=contrss(sl);
sl1=ss2tf(sl);sl2=ss2tf(slc); //Compare sl1 and sl2
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/csim.man
//====================================================
clear;lines(0);
s=poly(0,'s');rand('seed',0);w=ssrand(1,1,3);w('A')=w('A')-2*eye();
t=0:0.05:5;
//impulse(w) = step (s * w)
xbasc(0);xset("window",0);xselect();
plot2d([t',t'],[(csim('step',t,tf2ss(s)*w))',0*t'])
xbasc(1);xset("window",1);xselect();
plot2d([t',t'],[(csim('impulse',t,w))',0*t'])
//step(w) = impulse (s^-1 * w)
xbasc(3);xset("window",3);xselect();
plot2d([t',t'],[(csim('step',t,w))',0*t'])
xbasc(4);xset("window",4);xselect();
plot2d([t',t'],[(csim('impulse',t,tf2ss(1/s)*w))',0*t'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ctr_gram.man
//====================================================
clear;lines(0);
A=diag([-1,-2,-3]);B=rand(3,2);
Wc=ctr_gram(A,B)
U=rand(3,3);A1=U*A/U;B1=U*B;
Wc1=ctr_gram(A1,B1) //Not invariant!
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/dbphi.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/des2tf.man
//====================================================
clear;lines(0);
s=poly(0,'s');
G=[1/(s+1),s;1+s^2,3*s^3];
Descrip=tf2des(G);Tf1=des2tf(Descrip)
Descrip2=tf2des(G,"withD");Tf2=des2tf(Descrip2)
[A,B,C,D,E]=Descrip2(2:6);Tf3=C*inv(s*E-A)*B+D
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/dscr.man
//====================================================
clear;lines(0);
s=poly(0,'s');
Sys=syslin('c',[1,1/(s+1);2*s/(s^2+2),1/s])
ss2tf(dscr(tf2ss(Sys),0.1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/dsimul.man
//====================================================
clear;lines(0);
z=poly(0,'z');
h=(1-2*z)/(z^2-0.2*z+1);
sl=tf2ss(h);
u=zeros(1,20);u(1)=1;
x1=dsimul(sl,u) //Impulse response
u=ones(20,1);
x2=dsimul(sl,u); //Step response
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/dt_ility.man
//====================================================
clear;lines(0);
A=[2,1,1;0,-2,1;0,0,3];
C=[0,0,1];
X=rand(3,3);A=inv(X)*A*X;C=C*X;
W=syslin('c',A,[],C);
[k,n,U,W1]=dt_ility(W);
W1("A")
W1("C")
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/equil.man
//====================================================
clear;lines(0);
P=rand(4,4);P=P*P';
Q=rand(4,4);Q=Q*Q';
T=equil(P,Q)
clean(T*P*T')
clean(inv(T)'*Q*inv(T))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/equil1.man
//====================================================
clear;lines(0);
S1=rand(2,2);S1=S1*S1';
S2=rand(2,2);S2=S2*S2';
S3=rand(2,2);S3=S3*S3';
P=sysdiag(S1,S2,zeros(4,4));
Q=sysdiag(S1,zeros(2,2),S3,zeros(2,2));
X=rand(8,8);
P=X*P*X';Q=inv(X)'*Q*inv(X);
[T,siz]=equil1(P,Q);
P1=clean(T*P*T')
Q1=clean(inv(T)'*Q*inv(T))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/feedback.man
//====================================================
clear;lines(0);
S1=ssrand(2,2,3);S2=ssrand(2,2,2);
W=S1/.S2;
ss2tf(S1/.S2)
//Same operation by LFT:
ss2tf(lft([zeros(2,2),eye(2,2);eye(2,2),-S2],S1))
//Other approach: with constant feedback
BigS=sysdiag(S1,S2); F=[zeros(2,2),eye(2,2);-eye(2,2),zeros(2,2)];
Bigclosed=BigS/.F;
W1=Bigclosed(1:2,1:2); //W1=W (in state-space).
ss2tf(W1)
//Inverting
ss2tf(S1*inv(eye()+S2*S1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/flts.man
//====================================================
clear;lines(0);
sl=syslin('d',1,1,1);u=1:10;
y=flts(u,sl);
plot2d2("onn",(1:size(u,'c'))',y')
[y1,x1]=flts(u(1:5),sl);y2=flts(u(6:10),sl,x1);
y-[y1,y2]
//With polynomial D:
z=poly(0,'z');
D=1+z+z^2; p =degree(D);
sl=syslin('d',1,1,1,D);
y=flts(u,sl);[y1,x1]=flts(u(1:5),sl);
y2=flts(u(5-p+1:10),sl,x1); // (update)
y-[y1,y2]
//Delay (transfer form): flts(u,1/z)
// Usual responses
z=poly(0,'z');
h=(1-2*z)/(z^2+0.3*z+1)
u=zeros(1,20);u(1)=1;
imprep=flts(u,tf2ss(h)); //Impulse response
plot2d2("onn",(1:size(u,'c'))',imprep')
u=ones(1,20);
stprep=flts(u,tf2ss(h)); //Step response
plot2d2("onn",(1:size(u,'c'))',stprep')
//
// Other examples
A=[1 2 3;0 2 4;0 0 1];B=[1 0;0 0;0 1];C=eye(3,3);Sys=syslin('d',A,B,C);
H=ss2tf(Sys); u=[1;-1]*(1:10);
//
yh=flts(u,H); ys=flts(u,Sys);
norm(yh-ys,1)
//hot restart
[ys1,x]=flts(u(:,1:4),Sys);ys2=flts(u(:,5:10),Sys,x);
norm([ys1,ys2]-ys,1)
//
yh1=flts(u(:,1:4),H);yh2=flts(u(:,5:10),H,[u(:,2:4);yh(:,2:4)]);
norm([yh1,yh2]-yh,1)
//with D<>0
D=[-3 8;4 -0.5;2.2 0.9];
Sys=syslin('d',A,B,C,D);
H=ss2tf(Sys); u=[1;-1]*(1:10);
rh=flts(u,H); rs=flts(u,Sys);
norm(rh-rs,1)
//hot restart
[ys1,x]=flts(u(:,1:4),Sys);ys2=flts(u(:,5:10),Sys,x);
norm([ys1,ys2]-rs,1)
//With H:
yh1=flts(u(:,1:4),H);yh2=flts(u(:,5:10),H,[u(:,2:4); yh1(:,2:4)]);
norm([yh1,yh2]-rh)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/frep2tf.man
//====================================================
clear;lines(0);
s=poly(0,'s');
h=syslin('c',(s-1)/(s^3+5*s+20))
frq=0:0.05:3;repf=repfreq(h,frq);
clean(frep2tf(frq,repf,3))
Sys=ssrand(1,1,10);
frq=logspace(-3,2,200);
[frq,rep]=repfreq(Sys,frq); //Frequency response of Sys
[Sys2,err]=frep2tf(frq,rep,10);Sys2=clean(Sys2)//Sys2 obtained from freq. resp of Sys
[frq,rep2]=repfreq(Sys2,frq); //Frequency response of Sys2
xbasc();bode(frq,[rep;rep2]) //Responses of Sys and Sys2
[sort(trzeros(Sys)),sort(roots(Sys2('num')))] //zeros
[sort(spec(Sys('A'))),sort(roots(Sys2('den')))] //poles
dom=1/1000; // Sampling time
z=poly(0,'z');
h=syslin(dom,(z^2+0.5)/(z^3+0.1*z^2-0.5*z+0.08))
frq=(0:0.01:0.5)/dom;repf=repfreq(h,frq);
[Sys2,err]=frep2tf(frq,repf,3,dom);
[frq,rep2]=repfreq(Sys2,frq); //Frequency response of Sys2
xbasc();plot2d1("onn",frq',abs([repf;rep2])');
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/freq.man
//====================================================
clear;lines(0);
s=poly(0,'s');
sys=(s+1)/(s^3-5*s+4)
rep=freq(sys("num"),sys("den"),[0,0.9,1.1,2,3,10,20])
[horner(sys,0),horner(sys,20)]
//
Sys=tf2ss(sys);
[A,B,C,D]=abcd(Sys);
freq(A,B,C,[0,0.9,1.1,2,3,10,20])
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/freson.man
//====================================================
clear;lines(0);
h=syslin('c',-1+%s,(3+2*%s+%s^2)*(50+0.1*%s+%s^2))
fr=freson(h)
bode(h)
g=20*log(abs(repfreq(h,fr)))/log(10)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/g_margin.man
//====================================================
clear;lines(0);
h=syslin('c',-1+%s,3+2*%s+%s^2)
[g,fr]=g_margin(h)
[g,fr]=g_margin(h-10)
nyquist(h-10)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/gfrancis.man
//====================================================
clear;lines(0);
Plant=ssrand(1,3,5);
[F,G,H,J]=abcd(Plant);
nw=4;nuu=2;A=rand(nw,nw);
st=maxi(real(spec(A)));A=A-st*eye(A);
B=rand(nw,nuu);C=2*rand(1,nw);D=0*rand(C*B);
Model=syslin('c',A,B,C,D);
[L,M,T]=gfrancis(Plant,Model);
norm(F*T+G*L-T*A,1)
norm(H*T+J*L-C,1)
norm(G*M-T*B,1)
norm(J*M-D,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/imrep2ss.man
//====================================================
clear;lines(0);
s=poly(0,'s');
H=[1/(s+0.5);2/(s-0.4)] //strictly proper
np=20;w=ldiv(H('num'),H('den'),np);
rep=[w(1:np)';w(np+1:2*np)']; //The impulse response
H1=ss2tf(imrep2ss(rep))
z=poly(0,'z');
H=(2*z^2-3.4*z+1.5)/(z^2-1.6*z+0.8) //Proper transfer function
u=zeros(1,20);u(1)=1;
rep=rtitr(H('num'),H('den'),u); //Impulse rep.
// <=> rep=ldiv(H('num'),H('den'),20)
w=z*imrep2ss(rep) //Realization with shifted impulse response
// i.e strictly proper to proper
H2=ss2tf(w);
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/invsyslin.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/kpure.man
//====================================================
clear;lines(0);
s=poly(0,'s');
h=syslin('c',(s-1)/(1+5*s+s^2+s^3))
xbasc();evans(h)
g=kpure(h)
hf=h/.g(1)
roots(denom(hf))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/krac2.man
//====================================================
clear;lines(0);
h=syslin('c',352*poly(-5,'s')/poly([0,0,2000,200,25,1],'s','c'));
xbasc();evans(h,100)
g=krac2(h)
hf1=h/.g(1);roots(denom(hf1))
hf2=h/.g(2);roots(denom(hf2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/lin.man
//====================================================
clear;lines(0);
deff('[y,xdot]=sim(x,u)','xdot=[u*sin(x);-u*x^2];y=xdot(1)+xdot(2)')
sl=lin(sim,1,2);
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/lqe.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/lqg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/lqg2stan.man
//====================================================
clear;lines(0);
ny=2;nu=3;nx=4;
P22=ssrand(ny,nu,nx);
bigQ=rand(nx+nu,nx+nu);bigQ=bigQ*bigQ';
bigR=rand(nx+ny,nx+ny);bigR=bigR*bigR';
[P,r]=lqg2stan(P22,bigQ,bigR);K=lqg(P,r); //K=LQG-controller
spec(h_cl(P,r,K)) //Closed loop should be stable
//Same as Cl=P22/.K; spec(Cl('A'))
s=poly(0,'s')
lqg2stan(1/(s+2),eye(2,2),eye(2,2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/lqr.man
//====================================================
clear;lines(0);
A=rand(2,2);B=rand(2,1); //two states, one input
Q=diag([2,5]);R=2; //Usual notations x'Qx + u'Ru
Big=sysdiag(Q,R); //Now we calculate C1 and D12
[w,wp]=fullrf(Big);C1=w(:,1:2);D12=w(:,3); //[C1,D12]'*[C1,D12]=Big
P=syslin('c',A,B,C1,D12); //The plant (continuous-time)
[K,X]=lqr(P)
spec(A+B*K) //check stability
norm(A'*X+X*A-X*B*inv(R)*B'*X+Q,1) //Riccati check
P=syslin('d',A,B,C1,D12); // Discrete time plant
[K,X]=lqr(P)
spec(A+B*K) //check stability
norm(A'*X*A-(A'*X*B)*pinv(B'*X*B+R)*(B'*X*A)+Q-X,1) //Riccati check
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ltitr.man
//====================================================
clear;lines(0);
A=eye(2,2);B=[1;1];
x0=[-1;-2];
u=[1,2,3,4,5];
x=ltitr(A,B,u,x0)
x1=A*x0+B*u(1)
x2=A*x1+B*u(2)
x3=A*x2+B*u(3) //....
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/markp2ss.man
//====================================================
clear;lines(0);
W=ssrand(2,3,4); //random system with 2 outputs and 3 inputs
[a,b,c,d]=abcd(W);
markpar=[c*b,c*a*b,c*a^2*b,c*a^3*b,c*a^4*b];
S=markp2ss(markpar,5,2,3);
[A,B,C,D]=abcd(S);
Markpar=[C*B,C*A*B,C*A^2*B,C*A^3*B,C*A^4*B];
norm(markpar-Markpar,1)
//Caution... c*a^5*b is not C*A^5*B !
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/minreal.man
//====================================================
clear;lines(0);
A=[-eye(2,2),rand(2,2);zeros(2,2),-2*eye(2,2)];
B=[rand(2,2);zeros(2,2)];C=rand(2,4);
sl=syslin('c',A,B,C);
slb=minreal(sl);
ss2tf(sl)
ss2tf(slb)
ctr_gram(sl)
clean(ctr_gram(slb))
clean(obs_gram(slb))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/minss.man
//====================================================
clear;lines(0);
sl=syslin('c',[1 0;0 2],[1;0],[2 1]);
ssprint(sl);
ssprint(minss(sl))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/obs_gram.man
//====================================================
clear;lines(0);
A=-diag(1:3);C=rand(2,3);
Go=obs_gram(A,C,'c'); // <=> w=syslin('c',A,[],C); Go=obs_gram(w);
norm(Go*A+A'*Go+C'*C,1)
norm(lyap(A,-C'*C,'c')-Go,1)
A=A/4; Go=obs_gram(A,C,'d'); //discrete time case
norm(lyap(A,-C'*C,'d')-Go,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/obscont.man
//====================================================
clear;lines(0);
ny=2;nu=3;nx=4;P=ssrand(ny,nu,nx);[A,B,C,D]=abcd(P);
Kc=-ppol(A,B,[-1,-1,-1,-1]); //Controller gain
Kf=-ppol(A',C',[-2,-2,-2,-2]);Kf=Kf'; //Observer gain
cl=P/.(-obscont(P,Kc,Kf));spec(cl('A')) //closed loop system
[J,r]=obscont(P,Kc,Kf);
Q=ssrand(nu,ny,3);Q('A')=Q('A')-(maxi(real(spec(Q('A'))))+0.5)*eye(Q('A'))
//Q is a stable parameter
K=lft(J,r,Q);
spec(h_cl(P,K)) // closed-loop A matrix (should be stable);
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/observer.man
//====================================================
clear;lines(0);
nx=5;nu=1;ny=1;un=3;us=2;Sys=ssrand(ny,nu,nx,list('dt',us,us,un));
//nx=5 states, nu=1 input, ny=1 output,
//un=3 unobservable states, us=2 of them unstable.
[Obs,U,m]=observer(Sys); //Stable observer (default)
W=U';H=W(m+1:nx,:);[A,B,C,D]=abcd(Sys); //H*U=[0,eye(no,no)];
Sys2=ss2tf(syslin('c',A,B,H)) //Transfer u-->z
Idu=eye(nu,nu);Sys3=ss2tf(H*U(:,m+1:$)*Obs*[Idu;Sys])
//Transfer u-->[u;y=Sys*u]-->Obs-->xhat-->HUxhat=zhat i.e. u-->output of Obs
//this transfer must equal Sys2, the u-->z transfer (H2=eye).
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/obsv_mat.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/obsvss.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/p_margin.man
//====================================================
clear;lines(0);
h=syslin('c',-1+%s,3+2*%s+%s^2)
[p,fr]=p_margin(h)
[p,fr]=p_margin(h+0.7)
nyquist(h+0.7)
t=(0:0.1:2*%pi)';plot2d(sin(t),cos(t),-3,'000')
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/pfss.man
//====================================================
clear;lines(0);
W=ssrand(1,1,6);
elts=pfss(W);
W1=0;for k=1:size(elts), W1=W1+ss2tf(elts(k));end
clean(ss2tf(W)-W1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/phasemag.man
//====================================================
clear;lines(0);
s=poly(0,'s');
h=syslin('c',1/((s+5)*(s+10)*(100+6*s+s*s)*(s+.3)));
[frq,rf]=repfreq(h,0.1,20,0.005);
xbasc(0);
plot2d(frq',phasemag(rf,'c')');
xbasc(1);
plot2d(frq',phasemag(rf,'m')');
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ppol.man
//====================================================
clear;lines(0);
A=rand(3,3);B=rand(3,2);
F=ppol(A,B,[-1,-2,-3]);
spec(A-B*F)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/projsl.man
//====================================================
clear;lines(0);
rand('seed',0);sl=ssrand(2,2,5);[A,B,C,D]=abcd(sl);poles=spec(A)
[Q,M]=pbig(A,0,'c'); //keeping unstable poles
slred=projsl(sl,Q,M);spec(slred('A'))
sl('D')=rand(2,2); //making proper system
trzeros(sl) //zeros of sl
wi=inv(sl); //wi=inverse in state-space
[q,m]=psmall(wi('A'),2,'d'); //keeping small zeros (poles of wi) i.e. abs(z)<2
slred2=projsl(sl,q,m);
trzeros(slred2) //zeros of slred2 = small zeros of sl
// Example keeping second order modes
A=diag([-1,-2,-3]);
sl=syslin('c',A,rand(3,2),rand(2,3));[nk2,W]=hankelsv(sl)
[Q,M]=pbig(W,nk2(2)-%eps,'c'); //keeping 2 eigenvalues of W
slr=projsl(sl,Q,M); //reduced model
hankelsv(slr)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/repfreq.man
//====================================================
clear;lines(0);
A=diag([-1,-2]);B=[1;1];C=[1,1];
Sys=syslin('c',A,B,C);
frq=0:0.02:5;w=frq*2*%pi; //frq=frequencies in Hz ;w=frequencies in rad/sec;
[frq1,rep] =repfreq(Sys,frq);
[db,phi]=dbphi(rep);
Systf=ss2tf(Sys) //Transfer function of Sys
x=horner(Systf,w(2)*sqrt(-1)) // x is Systf(s) evaluated at s = i w(2)
rep=20*log(abs(x))/log(10) //magnitude of x in dB
db(2) // same as rep
ang=atan(imag(x),real(x)); //in rad.
ang=ang*180/%pi //in degrees
phi(2)
repf=repfreq(Sys,frq);
repf(2)-x
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ricc.man
//====================================================
clear;lines(0);
//Standard formulas to compute Riccati solutions
A=rand(3,3);B=rand(3,2);C=rand(3,3);C=C*C';R=rand(2,2);R=R*R'+eye();
B=B*inv(R)*B';
X=ricc(A,B,C,'cont');
norm(A'*X+X*A-X*B*X+C,1)
H=[A -B;-C -A'];
[T,d]=gschur(eye(H),H,'cont');T=T(:,1:d);
X1=T(4:6,:)/T(1:3,:);
norm(X1-X,1)
[T,d]=schur(H,'cont');T=T(:,1:d);
X2=T(4:6,:)/T(1:3,:);
norm(X2-X,1)
// Discrete time case
F=A;B=rand(3,2);G1=B;G2=R;G=G1/G2*G1';H=C;
X=ricc(F,G,H,'disc');
norm(F'*X*F-(F'*X*G1/(G2+G1'*X*G1))*(G1'*X*F)+H-X)
H1=[eye(3,3) G;zeros(3,3) F'];
H2=[F zeros(3,3);-H eye(3,3)];
[T,d]=gschur(H2,H1,'disc');T=T(:,1:d);X1=T(4:6,:)/T(1:3,:);
norm(X1-X,1)
Fi=inv(F);
Hami=[Fi Fi*G;H*Fi F'+H*Fi*G];
[T,d]=schur(Hami,'d');T=T(:,1:d);
Fit=inv(F');
Ham=[F+G*Fit*H -G*Fit;-Fit*H Fit];
[T,d]=schur(Ham,'d');T=T(:,1:d);X2=T(4:6,:)/T(1:3,:);
norm(X2-X,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/rowregul.man
//====================================================
clear;lines(0);
s=%s;
w=[1/s,0;s/(s^3+2),2/s];
Sl=tf2ss(w);
[Stmp,Ws]=rowregul(Sl,-1,-2);
Stmp('D') // D matrix of Stmp
clean(ss2tf(Stmp))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/rtitr.man
//====================================================
clear;lines(0);
z=poly(0,'z');
Num=1+z;Den=1+z;u=[1,2,3,4,5];
rtitr(Num,Den,u)-u
//Other examples
//siso
//causal
n1=1;d1=poly([1 1],'z','coeff'); // y(j)=-y(j-1)+u(j-1)
r1=[0 1 0 1 0 1 0 1 0 1 0];
r=rtitr(n1,d1,ones(1,10));norm(r1-r,1)
//hot restart
r=rtitr(n1,d1,ones(1,9),1,0);norm(r1(2:11)-r)
//non causal
n2=poly([1 1 1],'z','coeff');d2=d1; // y(j)=-y(j-1)+u(j-1)+u(j)+u(j+1)
r2=[2 1 2 1 2 1 2 1 2];
r=rtitr(n2,d2,ones(1,10));norm(r-r2,1)
//hot restart
r=rtitr(n2,d2,ones(1,9),1,2);norm(r2(2:9)-r,1)
//
//MIMO example
//causal
d1=d1*diag([1 0.5]);n1=[1 3 1;2 4 1];r1=[5;14]*r1;
r=rtitr(n1,d1,ones(3,10));norm(r1-r,1)
//
r=rtitr(n1,d1,ones(3,9),[1;1;1],[0;0]);
norm(r1(:,2:11)-r,1)
//polynomial n1 (same ex.)
n1(1,1)=poly(1,'z','c');r=rtitr(n1,d1,ones(3,10));norm(r1-r,1)
//
r=rtitr(n1,d1,ones(3,9),[1;1;1],[0;0]);
norm(r1(:,2:11)-r,1)
//non causal
d2=d1;n2=n2*n1;r2=[5;14]*r2;
r=rtitr(n2,d2,ones(3,10));norm(r2-r)
//
r=rtitr(n2,d2,ones(3,9),[1;1;1],[10;28]);
norm(r2(:,2:9)-r,1)
//
// State-space or transfer
a = [0.21 , 0.63 , 0.56 , 0.23 , 0.31
0.76 , 0.85 , 0.66 , 0.23 , 0.93
0 , 0.69 , 0.73 , 0.22 , 0.21
0.33 , 0.88 , 0.2 , 0.88 , 0.31
0.67 , 0.07 , 0.54 , 0.65 , 0.36];
b = [0.29 , 0.5 , 0.92
0.57 , 0.44 , 0.04
0.48 , 0.27 , 0.48
0.33 , 0.63 , 0.26
0.59 , 0.41 , 0.41];
c = [0.28 , 0.78 , 0.11 , 0.15 , 0.84
0.13 , 0.21 , 0.69 , 0.7 , 0.41];
d = [0.41 , 0.11 , 0.56
0.88 , 0.2 , 0.59];
s=syslin('d',a,b,c,d);
h=ss2tf(s);num=h('num');den=h('den');den=den(1,1)*eye(2,2);
u=1;u(3,10)=0;r3=flts(u,s);
r=rtitr(num,den,u);norm(r3-r,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/sm2des.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/sm2ss.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/specfact.man
//====================================================
clear;lines(0);
A=diag([-1,-2]);B=[1;1];C=[1,1];D=1;s=poly(0,'s');
W1=syslin('c',A,B,C,D);
phi=gtild(W1,'c')+W1;
phis=clean(ss2tf(phi))
clean(phis-horner(phis,-s)'); //check this is 0...
[A,B,C,D]=abcd(W1);
[W0,L]=specfact(A,B,C,D);
W=syslin('c',A,B,L,W0)
Ws=ss2tf(W);
horner(Ws,-s)*Ws
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ss2des.man
//====================================================
clear;lines(0);
s=poly(0,'s');
G=[1/(s+1),s;1+s^2,3*s^3];Sl=tf2ss(G);
S=ss2des(Sl)
S1=ss2des(Sl,"withD")
Des=des2ss(S);Des(5)=clean(Des(5))
Des1=des2ss(S1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ss2ss.man
//====================================================
clear;lines(0);
Sl=ssrand(2,2,5); trzeros(Sl) // zeros are invariant:
Sl1=ss2ss(Sl,rand(5,5),rand(2,5),rand(5,2));
trzeros(Sl1), trzeros(rand(2,2)*Sl1*rand(2,2))
// output injection [ A + GC, (B+GD,-G)]
// [ C , (D , 0)]
p=1,m=2,n=2; sys=ssrand(p,m,n);
// feedback (m,n) first and then output injection.
F1=rand(m,n);
G=rand(n,p);
[sys1,right,left]=ss2ss(sys,rand(n,n),F1,G,2);
// Sl1 equiv left*sysdiag(sys*right,eye(p,p)))
res=clean(ss2tf(sys1) - ss2tf(left*sysdiag(sys*right,eye(p,p))))
// output injection then feedback (m+p,n)
F2=rand(p,n); F=[F1;F2];
[sys2,right,left]=ss2ss(sys,rand(n,n),F,G,1);
// Sl1 equiv left*sysdiag(sys,eye(p,p))*right
res=clean(ss2tf(sys2)-ss2tf(left*sysdiag(sys,eye(p,p))*right))
// when F2= 0; sys1 and sys2 are the same
F2=0*rand(p,n);F=[F1;F2];
[sys2,right,left]=ss2ss(sys,rand(n,n),F,G,1);
res=clean(ss2tf(sys2)-ss2tf(sys1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/ss2tf.man
//====================================================
clear;lines(0);
s=poly(0,'s');
h=[1,1/s;1/(s^2+1),s/(s^2-2)]
sl=tf2ss(h);
h=clean(ss2tf(sl))
[Ds,NUM,chi]=ss2tf(sl)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/st_ility.man
//====================================================
clear;lines(0);
A=diag([0.9,-2,3]);B=[0;0;1];Sl=syslin('c',A,B,[]);
[ns,nc,U]=st_ility(Sl);
U'*A*U
U'*B
[ns,nc,U]=st_ility(syslin('d',A,B,[]));
U'*A*U
U'*B
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/stabil.man
//====================================================
clear;lines(0);
// Gain:
Sys=ssrand(0,2,5,list('st',2,3,3));
A=Sys('A');B=Sys('B');F=stabil(A,B);
spec(A) //2 controllable modes 2 unstable uncontrollable modes
//and one stable uncontrollable mode
spec(A+B*F) //the two controllable modes are set to -1.
// Compensator:
Sys=ssrand(3,2,5,list('st',2,3,3)); //3 outputs, 2 inputs, 5 states
//2 controllables modes, 3 controllable or stabilizable modes.
K=stabil(Sys,-2,-3); //Compensator for Sys.
spec(Sys('A'))
spec(h_cl(Sys,K)) //K Stabilizes what can be stabilized.
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/svplot.man
//====================================================
clear;lines(0);
x=logspace(-3,3);
y=svplot(ssrand(2,2,4));
xbasc();plot2d1("oln",x',20*log(y')/log(10));
xgrid(12)
xtitle("Singular values plot","(Rd/sec)", "Db");
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/syssize.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/tf2ss.man
//====================================================
clear;lines(0);
s=poly(0,'s');
H=[2/s,(s+1)/(s^2-5)];
Sys=tf2ss(H)
clean(ss2tf(Sys))
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/time_id.man
//====================================================
clear;lines(0);
z=poly(0,'z');
h=(1-2*z)/(z^2-0.5*z+5)
rep=[0;ldiv(h('num'),h('den'),20)]; //impulse response
H=time_id(2,'impuls',rep)
// Same example with flts and u
u=zeros(1,20);u(1)=1;
rep=flts(u,tf2ss(h)); //impulse response
H=time_id(2,u,rep)
// step response
u=ones(1,20);
rep=flts(u,tf2ss(h)); //step response.
H=time_id(2,'step',rep)
H=time_id(3,u,rep) //with u as input and too high order required
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/trzeros.man
//====================================================
clear;lines(0);
W1=ssrand(2,2,5);trzeros(W1) //call trzeros
roots(det(systmat(W1))) //roots of det(system matrix)
s=poly(0,'s');W=[1/(s+1);1/(s-2)];W2=(s-3)*W*W';[nt,dt,rk]=trzeros(W2);
St=systmat(tf2ss(W2));[Q,Z,Qd,Zd,numbeps,numbeta]=kroneck(St);
St1=Q*St*Z;rowf=(Qd(1)+Qd(2)+1):(Qd(1)+Qd(2)+Qd(3));
colf=(Zd(1)+Zd(2)+1):(Zd(1)+Zd(2)+Zd(3));
roots(St1(rowf,colf)), nt./dt //By Kronecker form
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/unobs.man
//====================================================
clear;lines(0);
A=diag([1,2,3]);C=[1,0,0];
unobs(A,C)
for k=winsid(),xdel(k);end
//====================================================
// ../man/control/zeropen.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfbet.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfbin.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfchi.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfchn.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdff.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdffnc.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfgam.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfnbn.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfnor.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdfpoi.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/cdft.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/dcd/grand.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/G_make.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/abs.man
//====================================================
clear;lines(0);
abs([1,%i,-1,-%i,1+%i])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/acos.man
//====================================================
clear;lines(0);
x=[1,%i,-1,-%i]
cos(acos(x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/acosh.man
//====================================================
clear;lines(0);
x=[0,1,%i];
cosh(acosh(x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/acoshm.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
coshm(acoshm(A))
A(1,1)=A(1,1)+%i;
coshm(acoshm(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/acosm.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
cosm(acosm(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/addf.man
//====================================================
clear;lines(0);
addf('0','1')
addf('1','a')
addf('1','2')
'a'+'b'
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/addmenu.man
//====================================================
clear;lines(0);
addmenu('foo')
foo='disp(''hello'')'
addmenu('Hello',['Franck';'Peter'])
Hello=['disp(''hello Franck'')';'disp(''hello Peter'')']
addmenu(0,'Hello',['Franck';'Peter'])
Hello_0=['disp(''hello Franck'')';'disp(''hello Peter'')']
addmenu('Bye',list(0,'French_Bye'))
French_Bye='disp(''Au revoir'')'
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/adj2sp.man
//====================================================
clear;lines(0);
A = sprand(100,50,.05);
[xadj,adjncy,anz]= sp2adj(A);
[n,m]=size(A);
p = adj2sp(xadj,adjncy,anz,[n,m]);
A-p,
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/amell.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/asin.man
//====================================================
clear;lines(0);
A=[1,2;3,4]
sin(asin(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/asinh.man
//====================================================
clear;lines(0);
A=[1,2;2,3]
sinh(asinh(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/asinhm.man
//====================================================
clear;lines(0);
A=[1,2;2,3]
sinhm(asinhm(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/asinm.man
//====================================================
clear;lines(0);
A=[1,2;3,4]
sinm(asinm(A))
asinm(A)+%i*logm(%i*A+sqrtm(eye()-A*A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/atan.man
//====================================================
clear;lines(0);
x=[1,%i,-1,%i]
phasex=atan(imag(x),real(x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/atanh.man
//====================================================
clear;lines(0);
x=[0,%i,-%i]
tanh(atanh(x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/atanhm.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
tanhm(atanhm(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/atanm.man
//====================================================
clear;lines(0);
tanm(atanm([1,2;3,4]))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/besseli.man
//====================================================
clear;lines(0);
besseli(0.5:3,1:4)
besseli(0.5:3,1:4,2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/besselj.man
//====================================================
clear;lines(0);
besselj(0.5:3,1:4)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/besselk.man
//====================================================
clear;lines(0);
besselk(0.5:3,1:4)
besselk(0.5:3,1:4,2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/bessely.man
//====================================================
clear;lines(0);
bessely(0.5:3,1:4)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/bloc2exp.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/bloc2ss.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/c_link.man
//====================================================
clear;lines(0);
if c_link('foo') then link('foo.o','foo');end
// to unlink all the shared libarries which contain foo
a=%t; while a ;[a,b]=c_link('foo'); ulink(b);end
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/calerf.man
//====================================================
clear;lines(0);
deff('y=f(t)','y=exp(-t^2)');
calerf(1,0)
2/sqrt(%pi)*intg(0,1,f)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cmb_lin.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/conj.man
//====================================================
clear;lines(0);
x=[1+%i,-%i;%i,2*%i];
conj(x)
x'-conj(x) //x' is conjugate transpose
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/convstr.man
//====================================================
clear;lines(0);
A=['this','is';'my','matrix'];
convstr(A,'u')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cos.man
//====================================================
clear;lines(0);
x=[0,1,%i]
acos(cos(x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cosh.man
//====================================================
clear;lines(0);
x=[0,1,%i]
acosh(cosh(x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/coshm.man
//====================================================
clear;lines(0);
A=[1,2;2,4]
acoshm(coshm(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cosm.man
//====================================================
clear;lines(0);
A=[1,2;3,4]
cosm(A)-0.5*(expm(%i*A)+expm(-%i*A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cotg.man
//====================================================
clear;lines(0);
x=[1,%i];
cotg(x)-cos(x)./sin(x)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/coth.man
//====================================================
clear;lines(0);
x=[1,2*%i]
t=exp(x);
(t-ones(x)./t).\(t+ones(x)./t)
coth(x)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cothm.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
cothm(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cumprod.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
cumprod(A)
cumprod(A,'r')
cumprod(A,'c')
rand('seed',0);
a=rand(3,4);
[m,n]=size(a);
w=zeros(a);
w(1,:)=a(1,:);
for k=2:m;w(k,:)=w(k-1,:).*a(k,:);end;w-cumprod(a,'r')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/cumsum.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
cumsum(A)
cumsum(A,'r')
cumsum(A,'c')
a=rand(3,4)+%i;
[m,n]=size(a);
w=zeros(a);
w(1,:)=a(1,:);
for k=2:m;w(k,:)=w(k-1,:)+a(k,:);end;w-cumsum(a,'r')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/debug.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/dec2hex.man
//====================================================
clear;lines(0);
dec2hex([2748 10;11 3])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/delip.man
//====================================================
clear;lines(0);
ck=0.5;
delip([1,2],ck)
deff('y=f(t)','y=1/sqrt((1-t^2)*(1-ck^2*t^2))')
intg(0,1,f) //OK since real solution!
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/delmenu.man
//====================================================
clear;lines(0);
addmenu('foo')
delmenu('foo')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/demos.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/diag.man
//====================================================
clear;lines(0);
diag([1,2])
A=[1,2;3,4];
diag(A)
diag(A,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/dlgamma.man
//====================================================
clear;lines(0);
dlgamma(0.5)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/edit.man
//====================================================
clear;lines(0);
//newedit=edit('edit') //opens editor with text of this function
//myfunction=edit('myfunction') //opens editor for a new function
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/emptystr.man
//====================================================
clear;lines(0);
x=emptystr();for k=1:10, x=x+','+string(k);end
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/erf.man
//====================================================
clear;lines(0);
deff('y=f(t)','y=exp(-t^2)');
erf(0.5)-2/sqrt(%pi)*intg(0,0.5,f)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/erfc.man
//====================================================
clear;lines(0);
erf([0.5,0.2])+erfc([0.5,0.2])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/erfcx.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/eval.man
//====================================================
clear;lines(0);
a=1; b=2; Z=['a','sin(b)'] ; eval(Z) //returns the matrix [1,0.909];
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/execstr.man
//====================================================
clear;lines(0);
execstr('a=1') // sets a=1.
execstr('1+1') // does nothing (while evstr('1+1') returns 2)
execstr(['if %t then';
' a=1';
' b=a+1';
'else'
' b=0'
'end'])
execstr('a=zzzzzzz','errcatch')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/full.man
//====================================================
clear;lines(0);
sp=sparse([1,2;5,4;3,1],[1,2,3]);
A=full(sp)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/gamma.man
//====================================================
clear;lines(0);
gamma(0.5)
gamma(6)-prod(1:5)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/gammaln.man
//====================================================
clear;lines(0);
gammaln(0.5)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/getvalue.man
//====================================================
clear;lines(0);
labels=["magnitude";"frequency";"phase "];
[ok,mag,freq,ph]=getvalue("define sine signal",labels,...
list("vec",1,"vec",1,"vec",1),["0.85";"10^2";"%pi/3"])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/gsort.man
//====================================================
clear;lines(0);
alr=[1,2,2;
1,2,1;
1,1,2;
1,1,1];
[alr1,k]=gsort(alr,'lr','i')
[alr1,k]=gsort(alr,'lc','i')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/halt.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/havewindow.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/hex2dec.man
//====================================================
clear;lines(0);
hex2dec(['ABC','0','A'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/input.man
//====================================================
clear;lines(0);
//x=input("How many iterations?")
//x=input("What is your name?","string")
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/integrate.man
//====================================================
clear;lines(0);
integrate('sin(x)','x',0,%pi)
integrate(['if x==0 then 1,';
'else sin(x)/x,end'],'x',0,%pi)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/interp.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/interpln.man
//====================================================
clear;lines(0);
x=[1 10 20 30 40];
y=[1 30 -10 20 40];
plot2d(x',y',[-3],"011"," ",[-10,-40,50,50]);
yi=interpln([x;y],-4:45);
plot2d((-4:45)',yi',[3],"000");
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/intsplin.man
//====================================================
clear;lines(0);
t=0:0.1:%pi
intsplin(t,sin(t))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/inttrap.man
//====================================================
clear;lines(0);
t=0:0.1:%pi
inttrap(t,sin(t))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/isdef.man
//====================================================
clear;lines(0);
A=1;
isdef('A')
clear A
isdef('A')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/isinf.man
//====================================================
clear;lines(0);
isinf([1 0.01 -%inf %inf])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/isnan.man
//====================================================
clear;lines(0);
isnan([1 0.01 -%nan %inf-%inf])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/isreal.man
//====================================================
clear;lines(0);
isreal([1 2])
isreal(1+0*%i)
isreal(1+0*%i,0)
isreal(1+%s)
isreal(sprand(3,3,0.1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/kron.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
kron(A,A)
A.*.A
A(1,1)=%i;
kron(A,A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/ldivf.man
//====================================================
clear;lines(0);
ldivf('1','1')
ldivf('a','0')
ldivf('a','x')
ldivf('2','4')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/linspace.man
//====================================================
clear;lines(0);
linspace(1,2,10)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/log.man
//====================================================
clear;lines(0);
exp(log([1,%i,-1,-%i]))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/log10.man
//====================================================
clear;lines(0);
10.^log10([1,%i,-1,-%i])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/logm.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
logm(A)
expm(logm(A))
A1=A*A';
logm(A1)
expm(logm(A1))
A1(1,1)=%i;
expm(logm(A1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/logspace.man
//====================================================
clear;lines(0);
logspace(1,2,10)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/macr2lst.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/macrovar.man
//====================================================
clear;lines(0);
deff('y=f(x1,x2)','loc=1;y=a*x1+x2-loc')
vars=macrovar(f)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/manedit.man
//====================================================
clear;lines(0);
//manedit('lqg')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/mean.man
//====================================================
clear;lines(0);
A=[1,2,10;7,7.1,7.01];
mean(A)
mean(A,'r')
mean(A,'c')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/median.man
//====================================================
clear;lines(0);
A=[1,2,10;7,7.1,7.01];
median(A)
median(A,'r')
median(A,'c')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/modulo.man
//====================================================
clear;lines(0);
n=[1,2,10,15];m=[2,2,3,5];
modulo(n,m)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/mulf.man
//====================================================
clear;lines(0);
mulf('1','a')
mulf('0','a')
'a'+'b' //Caution...
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/nnz.man
//====================================================
clear;lines(0);
sp=sparse([1,2;4,5;3,10],[1,2,3]);
nnz(sp)
a=[1 0 0 0 2];
nnz(a)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/norm.man
//====================================================
clear;lines(0);
A=[1,2,3];
norm(A,1)
norm(A,'inf')
A=[1,2;3,4]
max(svd(A))-norm(A)
A=sparse([1 0 0 33 -1])
norm(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/pen2ea.man
//====================================================
clear;lines(0);
E=[1,0];A=[1,2];s=poly(0,'s');
[E,A]=pen2ea(s*E-A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/pertrans.man
//====================================================
clear;lines(0);
A=[1,2;3,4]
pertrans(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/prod.man
//====================================================
clear;lines(0);
A=[1,2;0,100];
prod(A)
prod(A,'c')
prod(A,'r')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/rdivf.man
//====================================================
clear;lines(0);
ldivf('c','d')
ldivf('1','2')
ldivf('a','0')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/readc_.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/readmps.man
//====================================================
clear;lines(0);
//File : test.mps (uncomment)
//NAME TESTPROB
//ROWS
// N COST
// L LIM1
// G LIM2
// E MYEQN
//COLUMNS
// XONE COST 1 LIM1 1
// XONE LIM2 1
// YTWO COST 4 LIM1 1
// YTWO MYEQN -1
// ZTHREE COST 9 LIM2 1
// ZTHREE MYEQN 1
//RHS
// RHS1 LIM1 5 LIM2 10
// RHS1 MYEQN 7
//BOUNDS
// UP BND1 XONE 4
// LO BND1 YTWO -1
// UP BND1 YTWO 1
//ENDATA
//// objective:
// min XONE + 4 YTWO + 9 ZTHREE
//// constraints:
// LIM1: XONE + YTWO < = 5
// LIM2: XONE + ZTHREE > = 10
// MYEQN: - YTWO + ZTHREE = 7
//// Bounds
// 0 < = XONE < = 4
// -1 < = YTWO < = 1
//// End
maxm = 5;
maxn = 4;
maxnza = 9;
big = 10^30;
dlobnd = 0;
dupbnd = 10^30;
//
//[m,n,nza,irobj,namec,nameb,namran,nambnd,name,stavar,rwstat,hdrwcd,...
//lnkrw,hdclcd,lnkcl,rwnmbs,clpnts,acoeff,rhs,ranges,ubounds,lbounds] = ...
//readmps ('test',maxm,maxn,maxnza,big,dlobnd,dupbnd);
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sci2exp.man
//====================================================
clear;lines(0);
a=[1 2;3 4]
sci2exp(a,'aa')
sci2exp(a,'aa',0)
sci2exp(ssrand(2,2,2))
sci2exp(poly([1 0 3 4],'s'),'fi')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sci2map.man
//====================================================
clear;lines(0);
txt=[sci2map([1 2;3 4],'a');
sci2map(%s^2+3*%s+4,'p')]
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/setmenu.man
//====================================================
clear;lines(0);
addmenu('foo') //New button made in main scilab window
unsetmenu('foo') //button foo cannot be activated (grey string)
setmenu('foo') //button foo can be activated (black string)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sin.man
//====================================================
clear;lines(0);
asin(sin([1,0,%i]))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sinh.man
//====================================================
clear;lines(0);
asinh(sinh([0,1,%i]))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sinhm.man
//====================================================
clear;lines(0);
A=[1,2;2,3]
asinhm(sinhm(A))
A(1,1)=%i;sinhm(A)-(expm(A)-expm(-A))/2 //Complex case
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sinm.man
//====================================================
clear;lines(0);
A=[1,2;2,4];
sinm(A)+0.5*%i*(expm(%i*A)-expm(-%i*A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/smooth.man
//====================================================
clear;lines(0);
x=[1 10 20 30 40];
y=[1 30 -10 20 40];
plot2d(x',y',[3],"011"," ",[-10,-40,50,50]);
yi=smooth([x;y],0.1);
plot2d(yi(1,:)',yi(2,:)',[1],"000");
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/solve.man
//====================================================
clear;lines(0);
A=['1','a';'0','2']; //Upper triangular
b=['x';'y'];
w=solve(A,b)
a=1;x=2;y=5;
evstr(w)
inv([1,1;0,2])*[2;5]
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sort.man
//====================================================
clear;lines(0);
[s,p]=sort(rand(1,10));
//p is a random permutation of 1:10
A=[1,2,5;3,4,2];
[Asorted,q]=sort(A);A(q(:))-Asorted(:)
v=1:10;
sort(v)
sort(v')
sort(v,'r') //Does nothing for row vectors
sort(v,'c')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sp2adj.man
//====================================================
clear;lines(0);
A = sprand(100,50,.05);
[xadj,adjncy,anz]= sp2adj(A);
[n,m]=size(A);
p = adj2sp(xadj,adjncy,anz,[n,m]);
A-p,
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sparse.man
//====================================================
clear;lines(0);
sp=sparse([1,2;4,5;3,10],[1,2,3])
size(sp)
x=rand(2,2);abs(x)-full(abs(sparse(x)))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/spcompack.man
//====================================================
clear;lines(0);
// A is the sparse matrix:
A=[1,0,0,0,0,0,0;
0,1,0,0,0,0,0;
0,0,1,0,0,0,0;
0,0,1,1,0,0,0;
0,0,1,1,1,0,0;
0,0,1,1,0,1,0;
0,0,1,1,0,1,1];
A=sparse(A);
//For this matrix, the standard adjacency representation is given by:
xadj=[1,2,3,8,12,13,15,16];
adjncy=[1, 2, 3,4,5,6,7, 4,5,6,7, 5, 6,7, 7];
//(see sp2adj).
// increments in vector xadj give the number of non zero entries in each column
// ie there is 2-1=1 entry in the column 1
// there is 3-2=1 entry in the column 2
// there are 8-3=5 entries in the column 3
// 12-8=4 4
//etc
//The row index of these entries is given by the adjncy vector
// for instance,
// adjncy (3:7)=adjncy(xadj(3):xadj(4)-1)=[3,4,5,6,7]
// says that the 5=xadj(4)-xadj(3) entries in column 3 have row
// indices 3,4,5,6,7.
//In the compact representation, the repeated sequences in adjncy
//are eliminated.
//Here in adjncy the sequences 4,5,6,7 and 7 are eliminated.
//The standard structure (xadj,adjncy) takes the compressed form (lindx,xlindx)
lindx=[1, 2, 3,4,5,6,7, 5, 6,7];
xlindx=[1,2,3,8,9,11];
//(Columns 4 and 7 of A are eliminated).
//A can be reconstructed from (xadj,xlindx,lindx).
[xadj,adjncy,anz]= sp2adj(A);
adjncy - spcompack(xadj,xlindx,lindx)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/speye.man
//====================================================
clear;lines(0);
eye(3,3)-full(speye(3,3))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/spget.man
//====================================================
clear;lines(0);
sp=sparse([1,2;4,5;3,10],[1,2,3])
[ij,v,mn]=spget(sp);
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/splin.man
//====================================================
clear;lines(0);
x=0:0.5:10;f=sin(x);
d=splin(x,f);
S=interp(0:0.1:10,x,f,d);
plot2d(x',f',-1);
plot2d((0:0.1:10)',S',2,'000')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/spones.man
//====================================================
clear;lines(0);
A=sprand(10,12,0.1);
sp=spones(A)
B = A~=0
bool2s(B)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sprand.man
//====================================================
clear;lines(0);
W=sprand(100,1000,0.001);
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/spzeros.man
//====================================================
clear;lines(0);
sum(spzeros(1000,1000))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sqrt.man
//====================================================
clear;lines(0);
sqrt([2,4])
sqrt(-1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sqrtm.man
//====================================================
clear;lines(0);
x=[0 1;2 4]
w=sqrtm(x);
norm(w*w-x)
x(1,2)=%i;
w=sqrtm(x);norm(w*w-x,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/ssprint.man
//====================================================
clear;lines(0);
a=[1 1;0 1];b=[0 1;1 0];c=[1,1];d=[3,2];
ssprint(syslin('c',a,b,c,d))
ssprint(syslin('d',a,b,c,d))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/ssrand.man
//====================================================
clear;lines(0);
//flag=list('st',dim_cont_subs,dim_stab_subs,dim_stab0)
//dim_cont_subs<=dim_stab_subs<=dim_stab0
//pair (A,B) U-similar to:
// [*,*,*,*; [*;
// [0,s,*,*; [0;
//A= [0,0,i,*; B=[0;
// [0,0,0,u] [0]
//
// (A11,B1) controllable s=stable matrix i=neutral matrix u=unstable matrix
[Sl,U]=ssrand(2,3,8,list('st',2,5,5));
w=ss2ss(Sl,inv(U)); //undo the random change of basis => form as above
[n,nc,u,sl]=st_ility(Sl);n,nc
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/st_deviation.man
//====================================================
clear;lines(0);
A=[1,2,10;7,7.1,7.01];
st_deviation(A)
st_deviation(A,'r')
st_deviation(A,'c')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/strcat.man
//====================================================
clear;lines(0);
strcat(string(1:10),',')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/strindex.man
//====================================================
clear;lines(0);
k=strindex('SCI/demos/scicos','/')
k=strindex('SCI/demos/scicos','SCI/')
k=strindex('SCI/demos/scicos','!')
k=strindex('aaaaa','aa')
k=strindex('SCI/demos/scicos',['SCI','sci'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/stripblanks.man
//====================================================
clear;lines(0);
a=' 123 ';
'!'+a+'!'
'!'+stripblanks(a)+'!'
a=[' 123 ',' xyz']
strcat(stripblanks(a))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/strsubst.man
//====================================================
clear;lines(0);
strsubst('SCI/demos/scicos','SCI','.')
strsubst('SCI/demos/scicos','/',' ')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/subf.man
//====================================================
clear;lines(0);
subf('0','a')
subf('2','1')
subf('a','0')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sum.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
trace(A)-sum(diag(A))
sum(A,'c')-A*ones(2,1)
sum(A+%i)
A=sparse(A);sum(A,'c')-A*ones(2,1)
s=poly(0,'s');
M=[s,%i+s;s^2,1];
sum(M),sum(M,2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sysconv.man
//====================================================
clear;lines(0);
s1=ssrand(1,1,2);
s2=ss2tf(s1);
[s1,s2]=sysconv(s1,s2);
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/sysdiag.man
//====================================================
clear;lines(0);
s=poly(0,'s')
sysdiag(rand(2,2),1/(s+1),[1/(s-1);1/((s-2)*(s-3))])
sysdiag(tf2ss(1/s),1/(s+1),[1/(s-1);1/((s-2)*(s-3))])
s=poly(0,'s')
sysdiag(rand(2,2),1/(s+1),[1/(s-1);1/((s-2)*(s-3))])
sysdiag(tf2ss(1/s),1/(s+1),[1/(s-1);1/((s-2)*(s-3))])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/syslin.man
//====================================================
clear;lines(0);
A=[0,1;0,0];B=[1;1];C=[1,1];
S1=syslin('c',A,B,C) //Linear system definition
S1("A") //Display of A-matrix
S1("X0"), S1("dt") // Display of X0 and time domain
s=poly(0,'s');
D=s;
S2=syslin('c',A,B,C,D)
H1=(1+2*s)/s^2, S1bis=syslin('c',H1)
H2=(1+2*s+s^3)/s^2, S2bis=syslin('c',H2)
S1+S2
[S1,S2]
ss2tf(S1)-S1bis
S1bis+S2bis
S1*S2bis
size(S1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/tan.man
//====================================================
clear;lines(0);
x=[1,%i,-1,-%i]
tan(x)
sin(x)./cos(x)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/tanh.man
//====================================================
clear;lines(0);
x=[1,%i,-1,-%i]
tanh(x)
sinh(x)./cosh(x)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/tanhm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/tanm.man
//====================================================
clear;lines(0);
A=[1,2;3,4];
tanm(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/timer.man
//====================================================
clear;lines(0);
timer();A=rand(100,100);timer()
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/toeplitz.man
//====================================================
clear;lines(0);
A=toeplitz(1:5);
//
T=toeplitz(1:5,1:2:7);T1=[1 3 5 7;2 1 3 5;3 2 1 3;4 3 2 1;5 4 3 2];
T-T1
//
s=poly(0,'s');
t=toeplitz([s,s+1,s^2,1-s]);
t1=[s,1+s,s*s,1-s;1+s,s,1+s,s*s;s*s,1+s,s,1+s;1-s,s*s,1+s,s]
t-t1
//
t=toeplitz(['1','2','3','4']);
t1=['1','2','3','4';'2','1','2','3';'3','2','1','2';'4','3','2','1']
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/trfmod.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/trianfml.man
//====================================================
clear;lines(0);
A=['1','2';'a','b']
W=trianfml([A,string(eye(2,2))])
U=W(:,3:4)
a=5;b=6;
A=evstr(A)
U=evstr(U)
U*A
evstr(W(:,1:2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/tril.man
//====================================================
clear;lines(0);
s=poly(0,'s');
tril([s,s;s,1])
tril([1/s,1/s;1/s,1])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/trisolve.man
//====================================================
clear;lines(0);
A=['x','y';'0','z'];b=['0';'1'];
w=trisolve(A,b)
x=5;y=2;z=4;
evstr(w)
inv(evstr(A))*evstr(b)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/triu.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/typeof.man
//====================================================
clear;lines(0);
typeof(1)
typeof(poly(0,'x'))
typeof(1/poly(0,'x'))
typeof(%t)
w=sprand(100,100,0.001);
typeof(w)
typeof(w==w)
deff('y=f(x)','y=2*x');
typeof(f)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/unsetmenu.man
//====================================================
clear;lines(0);
//addmenu('foo')
//unsetmenu('foo')
//unsetmenu('File',2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/x_choices.man
//====================================================
clear;lines(0);
l1=list('choice 1',1,['toggle c1','toggle c2','toggle c3']);
l2=list('choice 2',2,['toggle d1','toggle d2','toggle d3']);
l3=list('choice 3',3,['toggle e1','toggle e2']);
rep=x_choices('Toggle Menu',list(l1,l2,l3));
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/x_choose.man
//====================================================
clear;lines(0);
n=x_choose(['item1';'item2';'item3'],['that is a comment';'for the dialog'])
n=x_choose(['item1';'item2';'item3'],['that is a comment'],'Return')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/x_dialog.man
//====================================================
clear;lines(0);
//gain=evstr(x_dialog('value of gain ?','0.235'))
//x_dialog(['Method';'enter sampling period'],'1')
//m=evstr(x_dialog('enter a 3x3 matrix ',['[0 0 0';'0 0 0';'0 0 0]']))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/x_matrix.man
//====================================================
clear;lines(0);
//m=evstr(x_matrix('enter a 3x3 matrix ',rand(3,3)))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/x_mdialog.man
//====================================================
clear;lines(0);
txt=['magnitude';'frequency';'phase '];
sig=x_mdialog('enter sine signal',txt,['1';'10';'0'])
mag=evstr(sig(1))
frq=evstr(sig(2))
ph=evstr(sig(3))
rep=x_mdialog(['System Simulation';'with PI regulator'],...
['P gain';'I gain '],[' ';' '])
n=5;m=4;mat=rand(n,m);
row='row';labelv=row(ones(1,n))+string(1:n)
col='col';labelh=col(ones(1,m))+string(1:m)
new=evstr(x_mdialog('Matrix to edit',labelv,labelh,string(mat)))
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/x_message.man
//====================================================
clear;lines(0);
gain=0.235;x_message('value of gain is :'+string(gain))
x_message(['singular matrix';'use least squares'])
r=x_message(['Your problem is ill conditioned';
'continue ?'],['Yes','No'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/xgetfile.man
//====================================================
clear;lines(0);
xgetfile()
xgetfile('*.sci','SCI/macros/xdess')
xgetfile(title='Choose a file name ')
for k=winsid(),xdel(k);end
//====================================================
// ../man/elementary/zeros.man
//====================================================
clear;lines(0);
zeros(3)
zeros(3,3)
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/Graphics.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/Matplot.man
//====================================================
clear;lines(0);
Matplot([1,2,3;4,5,6])
// draw the colormap
Matplot((1:xget("lastpattern")))
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/Sfgrayplot.man
//====================================================
clear;lines(0);
Sfgrayplot()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/Sgrayplot.man
//====================================================
clear;lines(0);
Sgrayplot()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/addcolor.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/black.man
//====================================================
clear;lines(0);
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
chart();
sstr='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';
black(h,0.01,100,sstr);
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
xbasc()
black([h1;h],0.01,100,['h1';'h'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/bode.man
//====================================================
clear;lines(0);
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
title='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';
bode(h,0.01,100,title);
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
xbasc()
bode([h1;h],0.01,100,['h1';'h'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/champ.man
//====================================================
clear;lines(0);
// using rect has graphic boundaries
champ(-5:5,-5:5,rand(11,11),rand(11,11),1,[-10,-10,10,10],"011");
xgrid();
xbasc();
// using (x,y) to get boundaries
champ(-5:5,-5:5,rand(11,11),rand(11,11),2,[-10,-10,10,10],"021");
// using coloured arrows
xset("use color",1)
champ1(-5:5,-5:5,rand(11,11),rand(11,11),2,[-10,-10,10,10],"021");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/champ1.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/chart.man
//====================================================
clear;lines(0);
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
black(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
chart(list(1,0,2,3));
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/colormap.man
//====================================================
clear;lines(0);
m=228;
n = fix(3/8*m);
r = [(1:n)'/n; ones(m-n,1)];
g = [zeros(n,1); (1:n)'/n; ones(m-2*n,1)];
b = [zeros(2*n,1); (1:m-2*n)'/(m-2*n)];
h = [r g b];
xset('colormap',h);
plot3d1()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/contour.man
//====================================================
clear;lines(0);
contour2d(1:10,1:10,rand(10,10),5,1:5,"011"," ",[0,0,11,11]);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/contour2d.man
//====================================================
clear;lines(0);
contour2d(1:10,1:10,rand(10,10),5,1:5,"011"," ",[0,0,11,11]);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/driver.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/edit_curv.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/errbar.man
//====================================================
clear;lines(0);
x=0:0.1:2*%pi;
y=[sin(x);cos(x)]';x=[x;x]';plot2d(x,y);
errbar(x,y,0.05*ones(x),0.03*ones(x));
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/eval3d.man
//====================================================
clear;lines(0);
x=-5:5;y=x;
deff('[z]=f(x,y)',['z= x.*y']);
z=eval3d(f,x,y);
plot3d(x,y,z);
//
deff('[z]=f(x,y)',['z= x*y']);
z=feval(x,y,f);
plot3d(x,y,z);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/eval3dp.man
//====================================================
clear;lines(0);
p1=linspace(0,2*%pi,10);
p2=linspace(0,2*%pi,10);
deff('[x,y,z]=scp(p1,p2)',['x=p1.*sin(p1).*cos(p2)';
'y=p1.*cos(p1).*cos(p2)';
'z=p1.*sin(p2)'])
[x,y,z]=eval3dp(scp,p1,p2);
plot3d(x,y,z)
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/evans.man
//====================================================
clear;lines(0);
H=syslin('c',352*poly(-5,'s')/poly([0,0,2000,200,25,1],'s','c'));
evans(H,100)
P=3.0548543 - 8.8491842*%i; //P=selected point
k=-1/real(horner(H,P));
Ns=H('num');Ds=H('den');
roots(Ds+k*Ns) //contains P as particular root
// Another one
xbasc();s=poly(0,'s');n=1+s;
d=real(poly([-1 -2 -%i %i],'s'));
evans(n,d,100);
//
xbasc();n=real(poly([0.1-%i 0.1+%i,-10],'s'));
evans(n,d,80);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fac3d.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fchamp.man
//====================================================
clear;lines(0);
deff('[xdot] = derpol(t,x)',['xd1 = x(2)';
"xd2 = -x(1) + (1 - x(1)**2)*x(2)";
"xdot = [ xd1 ; xd2 ]"]);
xf= -1:0.1:1;
yf= -1:0.1:1;
fchamp(derpol,0,xf,yf);
xbasc();
fchamp(derpol,0,xf,yf,1,[-2,-2,2,2],"011");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fcontour.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fcontour2d.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fec.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fgrayplot.man
//====================================================
clear;lines(0);
deff('[z]=surf(x,y)','z=x**2+y**2');
fgrayplot(-1:0.1:1,-1:0.1:1,surf,"111",[-2,-2,2,2]);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fplot2d.man
//====================================================
clear;lines(0);
deff("[y]=f(x)","y=sin(x)+cos(x)");
fplot2d((0:0.1:10)*%pi/10,f);
fplot2d((0:0.1:10)*%pi/10,f,5);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fplot3d.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/fplot3d1.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/gainplot.man
//====================================================
clear;lines(0);
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
gainplot(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
xbasc()
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
gainplot([h1;h],0.01,100,['h1';'h'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/genfac3d.man
//====================================================
clear;lines(0);
t = linspace(0,2*%pi,10);
zmat=sin(t')*cos(t);
plot3d(t,t,zmat)
[xx,yy,zz]=genfac3d(t,t,zmat);
plot3d(xx,yy,zz)
plot3d([xx xx],[yy yy],[zz 4+zz])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/geom3d.man
//====================================================
clear;lines(0);
deff("[z]=surf(x,y)","z=sin(x)*cos(y)");
t=%pi*(-10:10)/10;
fplot3d(t,t,surf,35,45,"X@Y@Z");
//Gives a plot3d
//now (t,t,sin(t).*cos(t) ) is a curve on the surface
//which can be drawn using param3d or the following code
[x,y]=geom3d(t,t,sin(t).*cos(t));
xpoly(x,y,"lines")
//adding a comment
[x,y]=geom3d([0,0],[0,0],[5,0]);
xsegs(x,y);
xstring(x(1),y(1)," The point (0,0,0)");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/getcolor.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/getsymbol.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/gr_menu.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/graduate.man
//====================================================
clear;lines(0);
y=(0:0.33:145.78)';
xbasc();plot2d1('enn',0,y)
[ymn,ymx,np]=graduate(mini(y),maxi(y))
rect=[1,ymn,prod(size(y)),ymx];
xbasc();plot2d1('enn',0,y,1,'011',' ',rect,[10,3,10,np])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/graycolormap.man
//====================================================
clear;lines(0);
xset('colormap',graycolormap(32))
plot3d1()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/grayplot.man
//====================================================
clear;lines(0);
x=-10:10;y=-10:10;m=rand(21,21);
grayplot(x,y,m,"111",[-20,-20,20,20]);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/hist3d.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/histplot.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/hotcolormap.man
//====================================================
clear;lines(0);
xset('colormap',hotcolormap(32))
plot3d1()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/isoview.man
//====================================================
clear;lines(0);
xbasc();
t=(0:0.1:2*%pi)';
isoview(-1,1,-1,1);
plot2d(sin(t),cos(t),1,'001')
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/locate.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/m_circle.man
//====================================================
clear;lines(0);
//Example 1 :
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
nyquist(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
m_circle();
//Example 2:
xbasc();
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
nyquist([h1;h],0.01,100,['h1';'h'])
m_circle([-8 -6 -4]);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/milk_drop.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/nyquist.man
//====================================================
clear;lines(0);
xbasc();
s=poly(0,'s');
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01));
comm='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';
nyquist(h,0.01,100,comm);
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
xbasc();
nyquist([h1;h],0.01,100,['h1';'h'])
xbasc();nyquist([h1;h])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/param3d.man
//====================================================
clear;lines(0);
t=0:0.1:5*%pi;
param3d(sin(t),cos(t),t/10,35,45,"X@Y@Z",[2,3])
xbasc();
xset("dashes",3)
param3d(rand(1,100),rand(1,100),rand(1,100),35,45,"X@Y@Z",[2,3])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/param3d1.man
//====================================================
clear;lines(0);
t=0:0.1:5*%pi; t=t';
param3d1([sin(t),sin(2*t)],[cos(t),cos(2*t)],...
list([t/10,sin(t)],[3,2]),35,45,"X@Y@Z",[2,3])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/param3di.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot2d.man
//====================================================
clear;lines(0);
x=0:0.1:2*%pi;
//simple plot
plot2d(sin(x));
//multiple plot
xbasc();
plot2d([x;x;x]',[sin(x);sin(2*x);sin(3*x)]');
//multiple plot with captions
xbasc();
plot2d([x;x;x]',[sin(x);sin(2*x);sin(3*x)]',...
[1,2,3],"111","L1@L2@L3",[0,-2,2*%pi,2],[2,10,2,10]);
// isoview
xbasc();
plot2d(x',sin(x)',1,'041')
// auto scale
xbasc();
plot2d(x',sin(x)',1,'061')
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot2d1.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot2d2.man
//====================================================
clear;lines(0);
plot2d2("gnn",(1:4)',(1:4)',1,'111','step function',[0,0,5,5])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot2d3.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot2d4.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot3d.man
//====================================================
clear;lines(0);
plot3d(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[2,2,3])
xbasc();
t=(0:0.3:2*%pi)';zmat=sin(t)*cos(t');
[xx,yy,zz]=genfac3d(t,t,zmat);
plot3d([xx xx],[yy yy],[zz 4+zz]);
xbasc();
plot3d([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plot3d1.man
//====================================================
clear;lines(0);
plot3d1(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[2,2,3]);
xbasc();
plot3d1(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[-2,2,3]);
xbasc();
t=(0:0.3:2*%pi)';zmat=sin(t)*cos(t');
[xx,yy,zz]=genfac3d(t,t,zmat);
plot3d1([xx xx],[yy yy],[zz 4+zz]);
xbasc();
plot3d1([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plotframe.man
//====================================================
clear;lines(0);
x=[-0.3:0.8:27.3]';
y=rand(x);
rect=[min(x),min(y),max(x),max(y)];
tics=[4,10,2,5]; //4 x-intervals and 2 y-intervals
plotframe(rect,tics,[%f,%f],['My plot','x','y'],[0,0,0.5,0.5]);
plot2d(x,y,2,'000')
plotframe(rect,tics,[%t,%f],['My plot with grids','x','y'],[0.5,0,0.5,0.5]);
plot2d(x,y,3,'000')
plotframe(rect,tics,[%t,%t],...
['My plot with grids and automatic bounds','x','y'],[0,0.5,0.5,0.5]);
plot2d(x,y,4,'000')
plotframe(rect,tics,[%f,%t],...
['My plot without grids but with automatic bounds','x','y'],...
[0.5,0.5,0.5,0.5]);
plot2d(x,y,5,'000');
xset('default');
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/plzr.man
//====================================================
clear;lines(0);
s=poly(0,'s');
n=[1+s 2+3*s+4*s^2 5; 0 1-s s];
d=[1+3*s 5-s^3 s+1;1+s 1+s+s^2 3*s-1];
h=syslin('c',n./d);
plzr(h);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/printing.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/rotate.man
//====================================================
clear;lines(0);
xsetech([0,0,1,1],[-1,-1,1,1])
xy=[(0:0.1:10);sin(0:0.1:10)]/10;
for i=2*%pi*(0:10)/10,[xy1]=rotate(xy,i);
xpoly(xy1(1,:),xy1(2,:),"lines")
end
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/scaling.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/sd2sci.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/secto3d.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/sgrid.man
//====================================================
clear;lines(0);
H=syslin('c',352*poly(-5,'s')/poly([0,0,2000,200,25,1],'s','c'));
evans(H,100)
sgrid()
sgrid(0.6,2,7)
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/square.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/titlepage.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/winsid.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xarc.man
//====================================================
clear;lines(0);
// isoview scaling
plot2d(0,0,-1,"031"," ",[-2,-2,2,2])
xset("dashes",3);
xarc(-1,1,2,2,0,90*64)
xarc(-1.5,1.5,3,3,0,360*64)
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xarcs.man
//====================================================
clear;lines(0);
plot2d(0,0,-1,"031",' ',[-1,-1,1,1])
set_arcs=[ -1.0 0.0 0.5 // upper left x
1.0 0.0 0.5 // upper left y
0.5 0.5 0.5 // widths
0.5 0.5 0.5 // height
0.0 0.0 0.0 // angle 1
360*64 360*64 360*64] // angle 2
xarcs(set_arcs,[1,2,3])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xarrows.man
//====================================================
clear;lines(0);
x=2*%pi*(0:9)/8;
x1=[sin(x);9*sin(x)];
y1=[cos(x);9*cos(x)];
plot2d([-10,10],[-10,10],[-1,-1],"022");
xset('clipgrf')
xarrows(x1,y1,1,1:10);
xset('clipoff')
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xaxis.man
//====================================================
clear;lines(0);
plot2d((1:0.1:10),sin(1:0.1:10))
xaxis(-90,[2,5],[0.1,0.1,2],[8,0])
xaxis(0,[2,3],[0.5,0.1,2],[5,0])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xbasc.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xbasimp.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xbasr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xchange.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xclea.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xclear.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xclick.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xclip.man
//====================================================
clear;lines(0);
x=0:0.2:2*%pi;
x1=[sin(x);100*sin(x)];
y1=[cos(x);100*cos(x)];
y1=y1+20*ones(y1);
// No clip
plot2d([-100,500],[-100,600],[-1,-1],"022");
xsegs(10*x1+200*ones(x1),10*y1+200*ones(y1));
xbasc()
//
// Rect clip
xbasc();plot2d([-100,500],[-100,600],[-1,-1],"022");
xrect(150,460,100,150);
xclip(150,460,100,150);
xsegs(10*x1+200*ones(x1),10*y1+200*ones(y1));
//
// usual graphic rectangle clip
xbasc();plot2d([-100,500],[-100,600],[-1,-1],"022");
xclip("clipgrf");
xsegs(10*x1+200*ones(x1),10*y1+200*ones(y1));
// clipping off
xclip()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xdel.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xend.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xfarc.man
//====================================================
clear;lines(0);
// isoview scaling
plot2d(0,0,-1,"031"," ",[-2,-2,2,2])
xfarc(-0.5,0.5,1,1,0,90*64)
xset("pattern",2)
xfarc(0.5,0.5,1,1,0,360*64)
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xfarcs.man
//====================================================
clear;lines(0);
plot2d(0,0,-1,"031",' ',[-1,-1,1,1])
set_arcs=[ -1.0 0.0 0.5 // upper left x
1.0 0.0 0.5 // upper left y
0.5 0.5 0.5 // widths
0.5 0.5 0.5 // height
0.0 0.0 0.0 // angle 1
360*64 360*64 360*64] // angle 2
xfarcs(set_arcs,[1,2,3])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xfpoly.man
//====================================================
clear;lines(0);
x=sin(2*%pi*(0:5)/5);
y=cos(2*%pi*(0:5)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("pattern",5);
xfpoly(x,y)
xset("default");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xfpolys.man
//====================================================
clear;lines(0);
plot2d(0,0,[-1],"012"," ",[0,-10,210,40]);
x1=[0,10,20,30,20,10,0];
y1=[15,30,30,15,0,0,15];
xpols=[x1;x1;x1;x1]';xpols=xpols + [0,60,120,180].*.ones(x1)';
ypols=[y1;y1;y1;y1]';
lpat=xget("lastpattern");
// setting the current dash (or line color)
xset("dashes",5);
xfpolys(xpols,ypols,[-1,0,1,2]);
xset("default");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xfrect.man
//====================================================
clear;lines(0);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("pattern",5);
xfrect(-1,1,2,2)
xset("default");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xget.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xgetech.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xgetmouse.man
//====================================================
clear;lines(0);
xselect();xbasc(); xsetech([0 0 1 1],[0 0 100 100])
xset('alufunction',6)
xtitle(' drawing a rectangle ');
[b,x0,y0]=xclick();rep=[x0,y0,-1];x=x0;y=y0
xrect(x0,y0,x-x0,y-y0);
while rep(3)==-1 then
rep=xgetmouse(0);
xrect(x0,y0,x-x0,y0-y);
x=rep(1);y=rep(2);
xrect(x0,y0,x-x0,y0-y);
end
xset('alufunction',3)
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xgrid.man
//====================================================
clear;lines(0);
plot2d()
xgrid()
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xinfo.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xinit.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xlfont.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xload.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xnumb.man
//====================================================
clear;lines(0);
plot2d([-100,500],[-100,600],[-1,-1],"022");
x=0:100:200;
xnumb(x,500*ones(x),[10,20,35],1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xpause.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xpoly.man
//====================================================
clear;lines(0);
x=sin(2*%pi*(0:5)/5);
y=cos(2*%pi*(0:5)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("dashes",5);
xpoly(x,y,"lines",1);
xset("default");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xpolys.man
//====================================================
clear;lines(0);
plot2d(0,0,[-1],"012"," ",[0,0,1,1]);
rand('uniform');
xset('pattern',3)
xpolys(rand(3,5),rand(3,5),[-1,-2,0,1,2])
xset('default')
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xrect.man
//====================================================
clear;lines(0);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("pattern",5);
xrect(-1,1,2,2)
xset("default");
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xrects.man
//====================================================
clear;lines(0);
plot2d([-100,500],[-50,50],[-1,-1],"022");
cols=[-34,-33,-32,-20:5:20,32,33,34];
step=20;
x=400*(0:14)/14
step = (x(2)-x(1))/2
rects=[x;10*ones(x);step*ones(x);30*ones(x)];
xrects(rects,cols);
xnumb(x,15*ones(x),cols);
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xrpoly.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xs2fig.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xsave.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xsegs.man
//====================================================
clear;lines(0);
x=2*%pi*(0:9)/8;
x1=[sin(x);9*sin(x)];
y1=[cos(x);9*cos(x)];
plot2d([-10,10],[-10,10],[-1,-1],"022");
xset('clipgrf')
xsegs(x1,y1,1:10);
xset('clipoff')
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xselect.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xset.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xsetech.man
//====================================================
clear;lines(0);
//In this first example xsetech is used to split the graphic window
//in two parts
// xsetech is used to fix the first sub window
// and the graphic scale
xsetech([0,0,1.0,0.5],[-5,-3,5,3]);
// then we call plot2d with the "001" option to use the graphic scale
// set by xsetech
plot2d((1:10)',(1:10)',1,"001",' ');
// xsetech is used to fix the second sub window
xsetech([0,0.5,1.0,0.5]);
// the graphic scale is set by xsetech to [0,0,1,1] by default
// and we change it with the use of the rect argument in plot2d
plot2d((1:10)',(1:10)',1,"011",' ',[-6,-6,6,6]);
//A second example with four graphics on a single graphic window
xset("font',2,0);
xsetech([0,0,0.5,0.5]);plot3d();
xsetech([0.5,0,0.5,0.5]);plot2d();
xsetech([0.5,0.5,0.5,0.5]);grayplot();
xsetech([0,0.5,0.5,0.5]);histplot();
// back to default values for the sub window
xsetech([0,0,1,1]);
xset("default');
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xsetm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xstring.man
//====================================================
clear;lines(0);
plot2d([0;1],[0;1],0)
xstring(0.5,0.5,["Scilab","is" ; "Not","Basilc"])
//Other example
alphabet=['a ','b ','c ','d ','e ','f ','g ',...
'h ','i ','j ','k ','l ','m ','n ',...
'o ','p ','q ','r ','s ','t ','u ',...
'v ', 'w ','x ','y ','z '];
xset('default'); //default graphic parameters
xset("window",1); //set window number to 1
xclear();
plot2d([0;1],[0;2],0);
xstring(0.1,1.8,alphabet) //alphabet
xstring(0.1,1.6,alphabet,20) //angle
xset("font",1,1) //symbol fonts
xstring(0.1,0.1,alphabet)
xset('font',1,3) //change size font
xstring(0.1,0.3,alphabet)
xset('font',1,24);xstring(0.1,0.6,'a'); //big alpha
xset('default')
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xstringb.man
//====================================================
clear;lines(0);
mat=['Scilab','is';'not','balicS'];
plot2d(0,0,[-1,1],'010',' ',[0,0,1,1]);
r=[0,0,1,0.5];
xstringb(r(1),r(2),mat,r(3),r(4),'fill');
xrect(r(1),r(2)+r(4),r(3),r(4))
r=[r(1),r(2)+r(4)+0.01,r(3),r(4)/2];
xrect(r(1),r(2)+r(4),r(3),r(4))
xstringb(r(1),r(2),mat,r(3),r(4),'fill');
r=[r(1),r(2)+r(4)+0.01,r(3),r(4)/2];
xrect(r(1),r(2)+r(4),r(3),r(4))
xstringb(r(1),r(2),mat,r(3),r(4),'fill');
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xstringl.man
//====================================================
clear;lines(0);
plot2d([0;1],[0;1])
rect=xstringl(0.5,0.5,["Scilab","is" ; "not","balicS"])
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xtape.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/xtitle.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/graphics/zgrid.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/aff2ab.man
//====================================================
clear;lines(0);
// Lyapunov equation solver (one unknown variable, one constraint)
deff('Y=lyapunov(X,D)','[A,Q]=D(:);Xm=X(:); Y=list(A''*Xm+Xm*A-Q)')
A=rand(3,3);Q=rand(3,3);Q=Q+Q';D=list(A,Q);dimX=[3,3];
[Aly,bly]=aff2ab(lyapunov,dimX,D);
[Xl,kerA]=linsolve(Aly,bly); Xv=vec2list(Xl,dimX); lyapunov(Xv,D)
Xm=Xv(:); A'*Xm+Xm*A-Q
// Lyapunov equation solver with redundant constraint X=X'
// (one variable, two constraints) D is global variable
deff('Y=ly2(X,D)','[A,Q]=D(:);Xm=X(:); Y=list(A''*Xm+Xm*A-Q,Xm''-Xm)')
A=rand(3,3);Q=rand(3,3);Q=Q+Q';D=list(A,Q);dimX=[3,3];
[Aly,bly]=aff2ab(ly2,dimX,D);
[Xl,kerA]=linsolve(Aly,bly); Xv=vec2list(Xl,dimX); ly2(Xv,D)
// Francis equations
// Find matrices X1 and X2 such that:
// A1*X1 - X1*A2 + B*X2 -A3 = 0
// D1*X1 -D2 = 0
deff('Y=bruce(X,D)','[A1,A2,A3,B,D1,D2]=D(:),...
[X1,X2]=X(:);Y=list(A1*X1-X1*A2+B*X2-A3,D1*X1-D2)')
A1=[-4,10;-1,2];A3=[1;2];B=[0;1];A2=1;D1=[0,1];D2=1;
D=list(A1,A2,A3,B,D1,D2);
[n1,m1]=size(A1);[n2,m2]=size(A2);[n3,m3]=size(B);
dimX=[[m1,n2];[m3,m2]];
[Af,bf]=aff2ab(bruce,dimX,D);
[Xf,KerAf]=linsolve(Af,bf);Xsol=vec2list(Xf,dimX)
bruce(Xsol,D)
// Find all X which commute with A
deff('y=f(X,D)','y=list(D(:)*X(:)-X(:)*D(:))')
A=rand(3,3);dimX=[3,3];[Af,bf]=aff2ab(f,dimX,list(A));
[Xf,KerAf]=linsolve(Af,bf);[p,q]=size(KerAf);
Xsol=vec2list(Xf+KerAf*rand(q,1),dimX);
C=Xsol(:); A*C-C*A
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/balanc.man
//====================================================
clear;lines(0);
A=[1/2^10,1/2^10;2^10,2^10];
[Ab,X]=balanc(A);
norm(A(1,:))/norm(A(2,:))
norm(Ab(1,:))/norm(Ab(2,:))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/bdiag.man
//====================================================
clear;lines(0);
//Real case: 1x1 and 2x2 blocks
a=rand(5,5);[ab,x,bs]=bdiag(a);ab
//Complex case: complex 1x1 blocks
[ab,x,bs]=bdiag(a+%i*0);ab
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/chfact.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/chol.man
//====================================================
clear;lines(0);
W=rand(5,5)+%i*rand(5,5);
X=W*W';
R=chol(X);
norm(R'*R-X)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/chsolve.man
//====================================================
clear;lines(0);
A=sprand(20,20,0.1);
A=A*A'+eye();
spcho=chfact(A);
sol=(1:20)';rhs=A*sol;
spcho=chfact(A);
chsolve(spcho,rhs)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/coff.man
//====================================================
clear;lines(0);
M=[1,2;0,3];
[N,d]=coff(M)
N/d
inv(%s*eye()-M)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/colcomp.man
//====================================================
clear;lines(0);
A=rand(5,2)*rand(2,5);
[X,r]=colcomp(A);
norm(A*X(:,1:$-r),1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/companion.man
//====================================================
clear;lines(0);
s=poly(0,'s');
p=poly([1,2,3,4,1],'s','c')
det(s*eye()-companion(p))
roots(p)
spec(companion(p))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/cond.man
//====================================================
clear;lines(0);
A=testmatrix('hilb',6);
cond(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/det.man
//====================================================
clear;lines(0);
x=poly(0,'x');
det([x,1+x;2-x,x^2])
w=ssrand(2,2,4);roots(det(systmat(w))),trzeros(w) //zeros of linear system
A=rand(3,3);
det(A), prod(spec(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/ereduc.man
//====================================================
clear;lines(0);
X=[1 2 3;4 5 6]
[E,Q,Z ,stair ,rk]=ereduc(X,1.d-15)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/exp.man
//====================================================
clear;lines(0);
x=[1,2,3+%i];
log(exp(x)) //element-wise
2^x
exp(x*log(2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/expm.man
//====================================================
clear;lines(0);
X=[1 2;3 4]
expm(X)
logm(expm(X))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/fstair.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/fullrf.man
//====================================================
clear;lines(0);
A=rand(5,2)*rand(2,5);
[Q,M]=fullrf(A);
norm(Q*M-A,1)
[X,d]=rowcomp(A);Y=X';
svd([A,Y(:,1:d),Q]) //span(Q) = span(A) = span(Y(:,1:2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/fullrfk.man
//====================================================
clear;lines(0);
A=rand(5,2)*rand(2,5);[Bk,Ck]=fullrfk(A,3);
norm(Bk*Ck-A^3,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/givens.man
//====================================================
clear;lines(0);
A=[3,4;5,6];
U=givens(A(:,1));
U*A
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/glever.man
//====================================================
clear;lines(0);
s=%s;F=[-1,s,0,0;0,-1,0,0;0,0,s-2,0;0,0,0,s-1];
[Bfs,Bis,chis]=glever(F)
inv(F)-((Bfs/chis) - Bis)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/gschur.man
//====================================================
clear;lines(0);
s=%s;
F=[-1,s,0,0;0,-1,0,0;0,0,2+s,0;0,0,0,-2+s];
roots(det(F))
[E,A]=pen2ea(F);
[As,Es,Z,dim] = gschur(A,E,'c')
// Other example
a=rand(4,4);b=rand(4,4);[as,bs,qs,zs]=gschur(a,b);
norm(qs*a*zs-as)
norm(qs*b*zs-bs )
clear a;
a(8,8)=2;a(1,8)=1;a(2,[2,3,4,5])=[0.3,0.2,4,6];a(3,[2,3])=[-0.2,.3];
a(3,7)=.5;
a(4,4)=.5;a(4,6)=2;a(5,5)=1;a(6,6)=4;a(6,7)=2.5;a(7,6)=-10;a(7,7)=4;
b=eye(8,8);b(5,5)=0;
[al,be]=gspec(a,b);
[bs,as,q,n]=gschur(b,a,'disc');n-4
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/gspec.man
//====================================================
clear;lines(0);
A=rand(3,3);
[al,be,Z] = gspec(A,eye(A));al./be
clean(inv(Z)*A*Z) //displaying the eigenvalues (generic matrix)
A=A+%i*rand(A);E=rand(A);
roots(det(%s*E-A)) //complex case
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/hess.man
//====================================================
clear;lines(0);
A=rand(3,3);[U,H]=hess(A);
and( abs(U*H*U'-A)<1.d-10 )
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/householder.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/im_inv.man
//====================================================
clear;lines(0);
A=[rand(2,5);[zeros(3,4),rand(3,1)]];B=[[1,1;1,1];zeros(3,2)];
W=rand(5,5);A=W*A;B=W*B;
[X,dim]=im_inv(A,B)
svd([A*X(:,1:dim),B]) //vectors A*X(:,1:dim) belong to range(B)
[X,dim,Y]=im_inv(A,B);[Y*A*X,Y*B]
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/inv.man
//====================================================
clear;lines(0);
A=rand(3,3);inv(A)*A
//
x=poly(0,'x');
A=[x,1,x;x^2,2,1+x;1,2,3];inv(A)*A
//
A=[1/x,2;2+x,2/(1+x)]
inv(A)*A
//
A=ssrand(2,2,3);
W=inv(A)*A
clean(ss2tf(W))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/kernel.man
//====================================================
clear;lines(0);
A=rand(3,1)*rand(1,3);
A*kernel(A)
A=sparse(A);
clean(A*kernel(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/kroneck.man
//====================================================
clear;lines(0);
F=randpencil([1,1,2],[2,3],[-1,3,1],[0,3]);
Q=rand(17,17);Z=rand(18,18);F=Q*F*Z;
//random pencil with eps1=1,eps2=1,eps3=1; 2 J-blocks @ infty
//with dimensions 2 and 3
//3 finite eigenvalues at -1,3,1 and eta1=0,eta2=3
[Q,Z,Qd,Zd,numbeps,numbeta]=kroneck(F);
[Qd(1),Zd(1)] //eps. part is sum(epsi) x (sum(epsi) + number of epsi)
[Qd(2),Zd(2)] //infinity part
[Qd(3),Zd(3)] //finite part
[Qd(4),Zd(4)] //eta part is (sum(etai) + number(eta1)) x sum(etai)
numbeps
numbeta
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/linsolve.man
//====================================================
clear;lines(0);
A=rand(5,3)*rand(3,8);
b=A*ones(8,1);[x,kerA]=linsolve(A,b);A*x+b //compatible b
b=ones(5,1);[x,kerA]=linsolve(A,b);A*x+b //uncompatible b
A=rand(5,5);[x,kerA]=linsolve(A,b), -inv(A)*b //x is unique
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/lu.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/ludel.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/lufact.man
//====================================================
clear;lines(0);
a=rand(5,5);b=rand(5,1);A=sparse(a);
[h,rk]=lufact(A);
x=lusolve(h,b);a*x-b
ludel(h)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/luget.man
//====================================================
clear;lines(0);
a=rand(5,2)*rand(2,5);A=sparse(a);
[ptr,rk]=lufact(A);[P,L,U,Q]=luget(ptr);
full(L), P*L*U*Q-A
clean(P*L*U*Q-A)
ludel(ptr)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/lusolve.man
//====================================================
clear;lines(0);
non_zeros=[1,2,3,4];rows_cols=[1,1;2,2;3,3;4,4];
sp=sparse(rows_cols,non_zeros);
[h,rk]=lufact(sp);x=lusolve(h,[1;1;1;1]);ludel(h)
rk,sp*x
non_zeros=[1,2,3,4];rows_cols=[1,1;2,2;3,3;4,4];
sp=sparse(rows_cols,non_zeros);
x=lusolve(sp,-ones(4,1));
sp*x
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/lyap.man
//====================================================
clear;lines(0);
A=rand(4,4);C=rand(A);C=C+C';
X=lyap(A,C,'c');
A'*X + X*A -C
X=lyap(A,C,'d');
A'*X*A - X -C
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/nlev.man
//====================================================
clear;lines(0);
A=rand(3,3);x=poly(0,'x');
[NUM,den]=nlev(A,'x')
clean(den-poly(A,'x'))
clean(NUM/den-inv(x*eye()-A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/orth.man
//====================================================
clear;lines(0);
A=rand(5,3)*rand(3,4);
[X,dim]=rowcomp(A);X=X';
svd([orth(A),X(:,1:dim)])
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/pbig.man
//====================================================
clear;lines(0);
A=diag([1,2,3]);X=rand(A);A=inv(X)*A*X;
[Q,M]=pbig(A,1.5,'d');
spec(M*A*Q)
[Q1,M1]=fullrf(eye()-Q*M);
spec(M1*A*Q1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/pencan.man
//====================================================
clear;lines(0);
F=randpencil([],[1,2],[1,2,3],[]);
F=rand(6,6)*F*rand(6,6);
[Q,M,i1]=pencan(F);
W=clean(M*F*Q)
roots(det(W(1:i1,1:i1)))
det(W($-2:$,$-2:$))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/penlaur.man
//====================================================
clear;lines(0);
F=randpencil([],[1,2],[1,2,3],[]);
F=rand(6,6)*F*rand(6,6);[E,A]=pen2ea(F);
[Si,Pi,Di]=penlaur(F);
[Bfs,Bis,chis]=glever(F);
norm(coeff(Bis,1)-Di,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/pinv.man
//====================================================
clear;lines(0);
A=rand(5,2)*rand(2,4);
norm(A*pinv(A)*A-A,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/polar.man
//====================================================
clear;lines(0);
A=rand(5,5);
[Ro,Theta]=polar(A);
norm(A-Ro*expm(%i*Theta),1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/proj.man
//====================================================
clear;lines(0);
X1=rand(5,2);X2=rand(5,3);
P=proj(X1,X2);
norm(P^2-P,1)
trace(P) // This is dim(X2)
[Q,M]=fullrf(P);
svd([Q,X2]) // span(Q) = span(X2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/projspec.man
//====================================================
clear;lines(0);
deff('j=jdrn(n)','j=zeros(n,n);for k=1:n-1;j(k,k+1)=1;end')
A=sysdiag(jdrn(3),jdrn(2),rand(2,2));X=rand(7,7);
A=X*A*inv(X);
[S,P,D,index]=projspec(A);
index //size of J-block
trace(P) //sum of dimensions of J-blocks
A*S-(eye()-P)
norm(D^index,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/psmall.man
//====================================================
clear;lines(0);
A=diag([1,2,3]);X=rand(A);A=inv(X)*A*X;
[Q,M]=psmall(A,2.5,'d');
spec(M*A*Q)
[Q1,M1]=fullrf(eye()-Q*M);
spec(M1*A*Q1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/qr.man
//====================================================
clear;lines(0);
A=rand(5,2)*rand(2,5);
[Q,R,rk,E] = qr(A,1.d-10);
norm(Q'*A-R)
svd([A,Q(:,1:rk)]) //span(A) =span(Q(:,1:rk))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/quaskro.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/randpencil.man
//====================================================
clear;lines(0);
F=randpencil([0,1],[2],[-1,0,1],[3]);
[Q,Z,Qd,Zd,numbeps,numbeta]=kroneck(F);
Qd, Zd
s=poly(0,'s');
F=randpencil([],[1,2],s^3-2,[]); //regular pencil
det(F)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/range.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/rank.man
//====================================================
clear;lines(0);
rank([1.d-80,0;0,1.d-80])
rank([1,0;0,1.d-80])
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/rcond.man
//====================================================
clear;lines(0);
A=diag([1:10]);
rcond(A)
A(1,1)=0.000001;
rcond(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/rowcomp.man
//====================================================
clear;lines(0);
A=rand(5,2)*rand(2,4); // 4 col. vectors, 2 independent.
[X,dim]=rowcomp(A);Xp=X';
svd([Xp(:,1:dim),A]) //span(A) = span(Xp(:,1:dim)
x=A*rand(4,1); //x belongs to span(A)
y=X*x
norm(y(dim+1:$))/norm(y(1:dim)) // small
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/rowshuff.man
//====================================================
clear;lines(0);
F=randpencil([],[2],[1,2,3],[]);
F=rand(5,5)*F*rand(5,5); // 5 x 5 regular pencil with 3 evals at 1,2,3
[Ws,F1]=rowshuff(F,-1);
[E1,A1]=pen2ea(F1);
svd(E1) //E1 non singular
roots(det(Ws))
clean(inv(F)-inv(F1)*Ws,1.d-7)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/rref.man
//====================================================
clear;lines(0);
A=[1 2;3 4;5 6];
X=rref([A,eye(3,3)]);
R=X(:,1:2)
L=X(:,3:5);L*A
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/schur.man
//====================================================
clear;lines(0);
A=diag([-0.9,-2,2,0.9]);X=rand(A);A=inv(X)*A*X;
[U,d]=schur(A,'c');
A1=U'*A*U;
spec(A1(1:d,1:d)) //stable cont. eigenvalues
[U,d]=schur(A,'c');
A1=U'*A*U;
spec(A1(1:d,1:d)) //stable disc. eigenvalues
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/spaninter.man
//====================================================
clear;lines(0);
A=rand(5,3)*rand(3,4); // A is 5 x 4, rank=3
B=[A(:,2),rand(5,1)]*rand(2,2);
[X,dim]=spaninter(A,B);
X1=X(:,1:dim); //The intersection
svd(A),svd([X1,A]) // X1 in span(A)
svd(B),svd([B,X1]) // X1 in span(B)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/spanplus.man
//====================================================
clear;lines(0);
A=rand(6,2)*rand(2,5); // rank(A)=2
B=[A(:,1),rand(6,2)]*rand(3,3); //two additional independent vectors
[X,dim,dimA]=spanplus(A,B);
dimA
dim
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/spantwo.man
//====================================================
clear;lines(0);
A=[1,0,0,4;
5,6,7,8;
0,0,11,12;
0,0,0,16];
B=[1,2,0,0]';C=[4,0,0,1];
Sl=ss2ss(syslin('c',A,B,C),rand(A));
[no,X]=contr(Sl('A'),Sl('B'));CO=X(:,1:no); //Controllable part
[uo,Y]=unobs(Sl('A'),Sl('C'));UO=Y(:,1:uo); //Unobservable part
[Xp,dimc,dimu,dim]=spantwo(CO,UO); //Kalman decomposition
Slcan=ss2ss(Sl,inv(Xp));
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/spchol.man
//====================================================
clear;lines(0);
X=[
3., 0., 0., 2., 0., 0., 2., 0., 2., 0., 0. ;
0., 5., 4., 0., 0., 0., 0., 0., 0., 0., 0. ;
0., 4., 5., 0., 0., 0., 0., 0., 0., 0., 0. ;
2., 0., 0., 3., 0., 0., 2., 0., 2., 0., 0. ;
0., 0., 0., 0. , 5., 0., 0., 0., 0., 0., 4. ;
0., 0., 0., 0., 0., 4., 0., 3., 0., 3., 0. ;
2., 0., 0., 2., 0., 0., 3., 0., 2., 0., 0. ;
0., 0., 0., 0., 0., 3., 0., 4., 0., 3., 0. ;
2., 0., 0., 2., 0., 0., 2., 0., 3., 0., 0. ;
0., 0., 0., 0., 0., 3., 0., 3., 0., 4., 0. ;
0., 0., 0., 0., 4., 0., 0., 0., 0., 0., 5.];
X=sparse(X);[R,P] = spchol(X);
max(P*R*R'*P'-X)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/spec.man
//====================================================
clear;lines(0);
A=diag([1,2,3]);X=rand(3,3);A=inv(X)*A*X;
spec(A)
//
x=poly(0,'x');
pol=det(x*eye()-A)
roots(pol)
//
[Ab,X,bs]=bdiag(A);
Ab
clean(inv(X)*A*X)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/sqroot.man
//====================================================
clear;lines(0);
X=rand(5,2)*rand(2,5);X=X*X';
W=sqroot(X)
norm(W*W'-X,1)
//
X=rand(5,2)+%i*rand(5,2);X=X*X';
W=sqroot(X)
norm(W*W'-X,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/sva.man
//====================================================
clear;lines(0);
A=rand(5,4)*rand(4,5);
[U,s,V]=sva(A,2);
B=U*s*V';
svd(A)
svd(B)
clean(svd(A-B))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/svd.man
//====================================================
clear;lines(0);
X=rand(4,2)*rand(2,4)
svd(X)
sqrt(spec(X*X'))
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/sylv.man
//====================================================
clear;lines(0);
A=rand(4,4);C=rand(4,3);B=rand(3,3);
X = sylv(A,B,C,'c');
norm(A*X+X*B-C)
X=sylv(A,B,C,'d')
norm(A*X*B-X-C)
for k=winsid(),xdel(k);end
//====================================================
// ../man/linear/trace.man
//====================================================
clear;lines(0);
A=rand(3,3);
trace(A)-sum(spec(A))
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/add_edge.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
g=add_edge(1,7,g);
g('edge_color')=[ones(ta) 11];
show_graph(g);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/add_node.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
n=g('node_number');
g1=add_node(g,[270 140]);
g1('node_color')=[ones(1,n) 11];
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/adj_lists.man
//====================================================
clear;lines(0);
ta=[2 3 3 5 3 4 4 5 8];
he=[1 2 4 2 6 6 7 7 4];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[129 200 283 281 128 366 122 333];
g('node_y')=[61 125 129 189 173 135 236 249];
show_graph(g);
[lp,la,ls]=adj_lists(g)
[lp,la,ls]=adj_lists(1,g('node_number'),ta,he)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/arc_graph.man
//====================================================
clear;lines(0);
ta=[1 1 2 4 4 5 6 7 2 3 5 1];
he=[2 6 3 6 7 8 8 8 4 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[281 284 360 185 405 182 118 45];
g('node_y')=[262 179 130 154 368 248 64 309];
show_graph(g);
g1=arc_graph(g);
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/arc_number.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/articul.man
//====================================================
clear;lines(0);
ta=[2 1 3 2 2 4 4 5 6 7 8 8 9 10 10 10 10 11 12 13 14 15 16 17 17];
he=[1 10 2 5 7 3 2 4 5 8 6 9 7 7 11 13 15 12 13 14 11 16 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
nart = articul(g)
show_nodes(nart);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/bandwr.man
//====================================================
clear;lines(0);
ta=[2 1 3 2 2 4 4 5 6 7 8 8 9 10 10 10 10 11 12 13 13 14 15 16 16 17 17];
he=[1 10 2 5 7 3 2 4 5 8 6 9 7 7 11 13 15 12 13 9 14 11 16 1 17 14 15];
g=make_graph('foo',0,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
// THE GRAPH
show_graph(g);
a=graph_2_mat(g,'node-node');
ww=tril(a)'+eye();
ww1=full(ww);
xset('window',0)
hist3d((ww1+tril(ww1',-1)+tril(ww1,-1)'),52,85);
// BANDWIDTH REDUCTION FOR THE MATRIX
[iperm,mrepi,profile,ierr]=bandwr(ww);
max(profile(2:$)-profile(1:($-1)))
// GRAPH WITH THE NEW NUMBERING
g2=g;g2('node_name')=string(iperm);
show_graph(g2,'new')
// NEW MATRIX
n=g('node_number');
yy=ww1(mrepi,mrepi);
xset('window',1)
hist3d((yy+tril(yy',-1)+tril(yy,-1)'),52,85);
// STARTING WITH THE SAME MATRIX
[ij,v,mn]=spget(ww);
g1=make_graph('foo',0,n,ij(:,1)',ij(:,2)');
g1('node_x')=g('node_x');g1('node_y')=g('node_y');
// GRAPH
//show_graph(g1,'rep');
[lp,la,ls] = adj_lists(1,n,g1('tail'),g1('head'));
[iperm,mrepi,profile,ierr]=bandwr(lp,ls,n,0);
g2=g;g2('node_name')=string(iperm);
show_graph(g2,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/best_match.man
//====================================================
clear;lines(0);
ta=[27 27 3 12 11 12 27 26 26 25 25 24 23 23 21 22 21 20 19 18 18];
ta=[ta 16 15 15 14 12 9 10 6 9 17 8 17 10 20 11 23 23 12 18 28];
he=[ 1 2 2 4 5 11 13 1 25 22 24 22 22 19 13 13 14 16 16 9 16];
he=[he 10 10 11 12 2 6 5 5 7 8 7 9 6 11 4 18 13 3 28 17];
n=28;
g=make_graph('foo',0,n,ta,he);
xx=[46 120 207 286 366 453 543 544 473 387 300 206 136 250 346 408];
g('node_x')=[xx 527 443 306 326 196 139 264 55 58 46 118 513];
yy=[36 34 37 40 38 40 35 102 102 98 93 96 167 172 101 179];
g('node_y')=[yy 198 252 183 148 172 256 259 258 167 109 104 253];
show_graph(g);
[card,match] = best_match(g);
sp=sparse([ta' he'],[1:size(ta,2)]',[n,n]);
sp1=sparse([[1:n]' match'],ones(1,size(match,2))',[n,n]);
[ij,v,mn]=spget(sp.*sp1);
show_arcs(v');
//
// WITH A LARGER GRAPH
g=load_graph(SCI+'/demos/metanet/mesh1000');
g('directed')=0;
ta=g('tail');he=g('head');n=node_number(g);
show_graph(g,'new',[3000,1000]);
[card,match] = best_match(g);
sp=sparse([ta' he'],[1:size(ta,2)]',[n,n]);
sp1=sparse([[1:n]' match'],ones(1,size(match,2))',[n,n]);
[ij,v,mn]=spget(sp.*sp1);
show_arcs(v');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/chain_struct.man
//====================================================
clear;lines(0);
ta=[1 1 2 3 5 4 6 7 7 3 3 8 8 5];
he=[2 3 5 4 6 6 7 4 3 2 8 1 7 4];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[116 231 192 323 354 454 305 155];
g('node_y')=[118 116 212 219 117 185 334 316];
show_graph(g);
[fe,che,fn,chn] = chain_struct(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/check_graph.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/circuit.man
//====================================================
clear;lines(0);
// graph with circuit
ta=[1 1 2 3 5 4 6 7 7 3 3 8 8 5];
he=[2 3 5 4 6 6 7 4 3 2 8 1 7 4];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[116 231 192 323 354 454 305 155];
g('node_y')=[ 118 116 212 219 117 185 334 316];
show_graph(g);
p=circuit(g)
show_arcs(p)
// graph without circuit
g=make_graph('foo',1,4,[1 2 2 3],[2 3 4 4]);
[p,r]=circuit(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/con_nodes.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 7 7 9 10 12 12 13 13 14 15];
he=[2 6 3 4 5 1 3 5 1 8 9 8 11 10 11 11 15 13 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[197 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[76 181 276 278 276 83 174 281 177 86 175 90 290 397 399];
show_graph(g);
con_nodes(2,g)
x_message('Displaying the nodes of component #2');
n=g('node_number');
nodecolor=0*ones(1,n);
nodecolor(1,con_nodes(2,g))=11*ones(con_nodes(2,g));
g('node_color')=nodecolor;
nodediam=20.*ones(1,n);
nodediam(1,con_nodes(2,g))=30*ones(con_nodes(2,g));
g('node_diam')=nodediam;
show_graph(g);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/connex.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 7 7 7 8 9 10 12 12 13 13 14 15];
he=[2 6 3 4 5 1 3 5 1 7 5 8 9 5 8 11 10 11 11 15 13 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[197 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[76 181 276 278 276 83 174 281 177 86 175 90 290 397 399];
show_graph(g);
[nc,ncomp]=connex(g)
g('node_color')=10+ncomp;
g('node_diam')=10+10*ncomp;
x_message('Displaying the connected components of this graph');
show_graph(g);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/contract_edge.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
g1=contract_edge(10,13,g);
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/convex_hull.man
//====================================================
clear;lines(0);
ta=[27 27 3 12 11 12 27 26 26 25 25 24 23 23 21 22 21 20 19 18 18];
ta=[ta 16 15 15 14 12 9 10 6 9 17 8 17 10 20 11 23 23 12 18 28];
he=[ 1 2 2 4 5 11 13 1 25 22 24 22 22 19 13 13 14 16 16 9 16];
he=[he 10 10 11 12 2 6 5 5 7 8 7 9 6 11 4 18 13 3 28 17];
g=make_graph('foo',0,28,ta,he);
xx=[46 120 207 286 366 453 543 544 473 387 300 206 136 250 346 408];
g('node_x')=[xx 527 443 306 326 196 139 264 55 58 46 118 513];
yy=[36 34 37 40 38 40 35 102 102 98 93 96 167 172 101 179];
g('node_y')=[yy 198 252 183 148 172 256 259 258 167 109 104 253];
show_graph(g);
xy=[g('node_x');g('node_y')];
[nhull,ind] = convex_hull(xy)
show_nodes(ind);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/cycle_basis.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
gt=make_graph('foo',1,17,ta,he);
gt('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
gt('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
gt('edge_color')=modulo([1:(edge_number(gt))],15)+1;
gt('node_diam')=[1:(gt('node_number'))]+20;
show_graph(gt);
g=graph_simp(gt);
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
g('node_diam')=gt('node_diam');
g('default_edge_hi_width')=12;
show_graph(g);
spc=cycle_basis(g);
for kk=1:(size(spc,1)),
aaa=spc(kk,:);aaa=full(aaa);aaa(aaa==0)=[];
show_arcs(aaa);
end;
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/delete_arcs.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
ij=[13 10;8 6;5 4;4 2];
gt=delete_arcs(ij,g);
show_graph(gt,'new');
g('directed')=0;
gt=delete_arcs(ij,g);
show_graph(gt,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/delete_nodes.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
v=[10 13 4];
gt=delete_nodes(v,g);
show_graph(gt,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/edge_number.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/find_path.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
p=find_path(1,14,g);
edgecolor=1*ones(ta); edgecolor(p)=11*ones(p); g('edge_color')=edgecolor;
show_graph(g); show_arcs(p);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/gen_net.man
//====================================================
clear;lines(0);
v=[1,10,2,1,0,10,100,100,0,100,50,50];
g=gen_net('foo',1,v);
show_graph(g)
// generating using dialogs
g=gen_net();
show_graph(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/girth.man
//====================================================
clear;lines(0);
ta=[1 6 2 4 7 5 6 8 4 3 5 1];
he=[2 1 3 6 4 8 8 7 2 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[285 284 335 160 405 189 118 45];
g('node_y')=[266 179 83 176 368 252 64 309];
show_graph(g);
d=girth(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/glist.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph-list.man
//====================================================
clear;lines(0);
g=load_graph(SCI+'/demos/metanet/mesh100');
g('node_color')=int(rand(1:g('node_number'))*16);
g('edge_color')=int(rand(1:edge_number(g))*16);
show_graph(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_2_mat.man
//====================================================
clear;lines(0);
g=load_graph(SCI+'/demos/metanet/colored');
a=graph_2_mat(g)
a=graph_2_mat(g,'node-node')
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_center.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 11 12 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 15 12 13 9 14 11 16 1 17 14 15];
g=make_graph('foo',0,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
[no,rad] = graph_center(g)
show_nodes(no);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_complement.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 11 12 13 13 13 14 15 17 17 16 16];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 15 12 13 9 10 14 11 16 14 15 1 17];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
g1=graph_complement(g);
show_graph(g1,'new');
g=graph_complement(g1);
show_graph(g);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_diameter.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 11 12 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 15 12 13 9 14 11 16 1 17 14 15];
g=make_graph('foo',0,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
[d,p] = graph_diameter(g)
show_arcs(p);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_power.man
//====================================================
clear;lines(0);
ta=[1 1 2 4 4 5 6 7 2 3 5 1];
he=[2 6 3 6 7 8 8 8 4 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[285 284 335 160 405 189 118 45];
g('node_y')=[266 179 83 176 368 252 64 309];
show_graph(g);
g1=graph_power(g,2);
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_simp.man
//====================================================
clear;lines(0);
ta=[1 1 1 2 2 2 3 4 4 4 5 5 6 7 7 8 8 9 9 10 10 10 10 10 11 12 12 13 13 13 14 15 16 16 17 17];
he=[1 2 10 3 5 7 4 2 9 9 4 6 6 8 2 6 9 7 4 7 11 13 13 15 12 11 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 98 164 162 273 235 267 384 504 493 409 573 601 627 642];
g('node_y')=[ 59 133 223 311 227 299 221 288 384 141 209 299 398 383 187 121 301];
show_graph(g);
g1=graph_simp(g);
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_sum.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
g('edge_width')=ones(1,(edge_number(g)));
g('node_diam')=[1:(g('node_number'))]+20;
g('node_name')=['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q'];
show_graph(g);
ta=[2 3 4 5 11 12 1];
he=[10 5 6 7 15 17 7];
g1=make_graph('foo',1,17,ta,he);
g1('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g1('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g1('edge_color')=modulo([1:(edge_number(g1))],15)+1;
g1('edge_width')=10*ones(1,(edge_number(g1)));
g1('node_diam')=[1:(g1('node_number'))]+20;
g1('node_name')=['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q'];
show_graph(g1,'new');
g2=graph_sum(g,g1);
show_graph(g2,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/graph_union.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
g('node_diam')=[1:(g('node_number'))]+20;
g('node_name')=['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q'];
show_graph(g);
l=netwindows(); nw=l(2);
v=[7 8 9 10 11 12 13];
show_nodes(v);
g1=subgraph(v,'nodes',g);
show_graph(g1,'new');
v=[1 2 5 6 7 8 9 10];
netwindow(nw);
show_nodes(v);
g2=subgraph(v,'nodes',g);
show_graph(g2,'new');
g=graph_union(g1,g2);
show_graph(g,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/hamilton.man
//====================================================
clear;lines(0);
ta=[2 1 3 2 2 4 4 5 6 7 8 8 9 10 10 10 10 11 12 13 13 14 15 16 16 17 17];
he=[1 10 2 5 7 3 2 4 5 8 6 9 7 7 11 13 15 12 13 9 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
cir=hamilton(g)
show_arcs(cir);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/is_connex.man
//====================================================
clear;lines(0);
g=make_graph('foo',1,3,[1,2,3,1],[2,3,1,3]);
is_connex(g)
g=make_graph('foo',1,4,[1,2,3,1],[2,3,1,3]);
is_connex(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/knapsack.man
//====================================================
clear;lines(0);
weight=ones(1,15).*.[1:4];
profit=ones(1,60);
capa=[15 45 30 60];
[earn,ind]=knapsack(profit,weight,capa)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/line_graph.man
//====================================================
clear;lines(0);
ta=[1 1 2 4 4 5 6 7 2 3 5 1];
he=[2 6 3 6 7 8 8 8 4 7 3 5];
g=make_graph('foo',0,8,ta,he);
g('node_x')=[281 284 360 185 405 182 118 45];
g('node_y')=[262 179 130 154 368 248 64 309];
show_graph(g);
g1=line_graph(g);
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/load_graph.man
//====================================================
clear;lines(0);
g=load_graph(SCI+'/demos/metanet/mesh100.graph');
show_graph(g);
g=load_graph(SCI+'/demos/metanet/colored');
show_graph(g,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/make_graph.man
//====================================================
clear;lines(0);
// creating a directed graph with 3 nodes and 4 arcs.
g=make_graph('foo',1,3,[1,2,3,1],[2,3,1,3]);
// creating a directed graph with 13 nodes and 14 arcs.
ta=[1 1 2 7 8 9 10 10 10 10 11 12 13 13];
he=[2 10 7 8 9 7 7 11 13 13 12 13 9 10];
g=make_graph('foo',1,13,ta,he);
g('node_x')=[120 98 87 188 439 698 226 127 342 467 711 779 477];
g('node_y')=[ 21 184 308 426 435 428 129 360 435 55 109 320 321];
show_graph(g)
// creating same graph without isolated node and 14 arcs.
g=make_graph('foo',1,0,ta,he);
g('node_x')=[120 98 226 127 342 467 711 779 477];
g('node_y')=[ 21 184 129 360 435 55 109 320 321];
show_graph(g,'new')
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/mat_2_graph.man
//====================================================
clear;lines(0);
g=load_graph(SCI+'/demos/metanet/colored');
show_graph(g);
a=graph_2_mat(g);
g1=mat_2_graph(a,1);
g1('node_x')=g('node_x'); g1('node_y')=g('node_y');
show_graph(g1,'new');
a=graph_2_mat(g,'node-node');
g1=mat_2_graph(a,1,'node-node');
g1('node_x')=g('node_x'); g1('node_y')=g('node_y');
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/max_cap_path.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
ma=edge_number(g);
g('edge_max_cap')=int(rand(1,ma)*16)+5;
[p,cap]=max_cap_path(1,14,g);
edgecolor=1*ones(1,ma); edgecolor(p)=11*ones(p); g('edge_color')=edgecolor;
x_message(['The maximum capacity is: '+string(cap);
'Showing the corresponding path']);
show_graph(g); show_arcs(p);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/max_clique.man
//====================================================
clear;lines(0);
ta=[1 2 3 4 5 6 6 7 8 9 10 16 16 10 11 11 12 12 11 14 15 15 13 7 13 13];
he=[2 3 4 5 6 7 8 8 9 10 16 2 3 11 12 13 1 14 14 15 5 9 12 4 14 15];
g=make_graph('foo',0,16,ta,he);
g('node_x')=[106 199 369 467 470 403 399 347 308 269 184 108 199 268 345 272];
g('node_y')=[341 420 422 321 180 212 286 246 193 244 243 209 59 134 51 348];
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
[ns,no] = max_clique(g);
show_nodes(no);
g1=graph_complement(g);
[ns,no] = max_clique(g1);
show_nodes(no);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/max_flow.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 3 3 4 4 5 5 5 5 6 6 6 7 7 15 15 15 15 15 15];
ta=[ta, 15 8 9 10 11 12 13 14];
he=[10 13 9 14 8 11 9 11 8 10 12 13 8 9 12 8 11 1 2 3 4];
he=[he, 5 6 7 16 16 16 16 16 16 16];
n=16;
g=make_graph('foo',1,n,ta,he);
g('node_x')=[42 615 231 505 145 312 403 233 506 34 400 312 142 614 260 257];
g('node_y')=[143 145 154 154 147 152 157 270 273 279 269 273 273 274 50 376];
ma=edge_number(g);
g('edge_max_cap')=ones(1,ma);
g('edge_min_cap')=zeros(1,ma);
source=15; sink=16;
nodetype=0*ones(1,n); nodetype(source)=2; nodetype(sink)=1;
g('node_type')=nodetype;
nodecolor=0*ones(1,n); nodecolor(source)=11; nodecolor(sink)=11;
g('node_color')=nodecolor;
show_graph(g);
[v,phi,ierr]=max_flow(source,sink,g);
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
g('edge_color')=edgecolor;
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
g('edge_font_size')=edgefontsize;
g('edge_label')=string(phi);
show_graph(g);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/mesh2d.man
//====================================================
clear;lines(0);
// FIRST CASE
theta=0.025*[1:40]*2.*%pi;
x=1+cos(theta);
y=1.+sin(theta);
theta=0.05*[1:20]*2.*%pi;
x1=1.3+0.4*cos(theta);
y1=1.+0.4*sin(theta);
theta=0.1*[1:10]*2.*%pi;
x2=0.5+0.2*cos(theta);
y2=1.+0.2*sin(theta);
x=[x x1 x2];
y=[y y1 y2];
//
nu=mesh2d(x,y);
nbt=size(nu,2);
jj=[nu(1,:)' nu(2,:)';nu(2,:)' nu(3,:)';nu(3,:)' nu(1,:)'];
as=sparse(jj,ones(size(jj,1),1));
ast=tril(as+abs(as'-as));
[jj,v,mn]=spget(ast);
n=size(x,2);
g=make_graph('foo',0,n,jj(:,1)',jj(:,2)');
g('node_x')=300*x;
g('node_y')=300*y;
g('default_node_diam')=10;
show_graph(g)
// SECOND CASE !!! NEEDS x,y FROM FIRST CASE
x3=2.*rand(1:200);
y3=2.*rand(1:200);
wai=((x3-1).*(x3-1)+(y3-1).*(y3-1));
ii=find(wai >= .94);
x3(ii)=[];y3(ii)=[];
wai=((x3-0.5).*(x3-0.5)+(y3-1).*(y3-1));
ii=find(wai <= 0.055);
x3(ii)=[];y3(ii)=[];
wai=((x3-1.3).*(x3-1.3)+(y3-1).*(y3-1));
ii=find(wai <= 0.21);
x3(ii)=[];y3(ii)=[];
xnew=[x x3];ynew=[y y3];
fr1=[[1:40] 1];fr2=[[41:60] 41];fr2=fr2($:-1:1);
fr3=[[61:70] 61];fr3=fr3($:-1:1);
front=[fr1 fr2 fr3];
//
nu=mesh2d(xnew,ynew,front);
nbt=size(nu,2);
jj=[nu(1,:)' nu(2,:)';nu(2,:)' nu(3,:)';nu(3,:)' nu(1,:)'];
as=sparse(jj,ones(size(jj,1),1));
ast=tril(as+abs(as'-as));
[jj,v,mn]=spget(ast);
n=size(xnew,2);
g=make_graph('foo',0,n,jj(:,1)',jj(:,2)');
g('node_x')=300*xnew;
g('node_y')=300*ynew;
g('default_node_diam')=10;
show_graph(g)
// REGULAR CASE !!! NEEDS PREVIOUS CASES FOR x,y,front
xx=0.1*[1:20];
yy=xx.*.ones(1,20);
zz= ones(1,20).*.xx;
x3=yy;y3=zz;
wai=((x3-1).*(x3-1)+(y3-1).*(y3-1));
ii=find(wai >= .94);
x3(ii)=[];y3(ii)=[];
wai=((x3-0.5).*(x3-0.5)+(y3-1).*(y3-1));
ii=find(wai <= 0.055);
x3(ii)=[];y3(ii)=[];
wai=((x3-1.3).*(x3-1.3)+(y3-1).*(y3-1));
ii=find(wai <= 0.21);
x3(ii)=[];y3(ii)=[];
xnew=[x x3];ynew=[y y3];
nu=mesh2d(xnew,ynew,front);
nbt=size(nu,2);
jj=[nu(1,:)' nu(2,:)';nu(2,:)' nu(3,:)';nu(3,:)' nu(1,:)'];
as=sparse(jj,ones(size(jj,1),1));
ast=tril(as+abs(as'-as));
[jj,v,mn]=spget(ast);
n=size(xnew,2);
g=make_graph('foo',0,n,jj(:,1)',jj(:,2)');
g('node_x')=300*xnew;
g('node_y')=300*ynew;
g('default_node_diam')=3;
show_graph(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/metanet.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/metanet_sync.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/min_lcost_cflow.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15 14 9 11 10];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14 4 6 9 1];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[194 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[56 181 276 278 276 103 174 281 177 86 175 90 290 397 399];
show_graph(g);
g1=g; ma=arc_number(g1); n=g1('node_number');
g1('edge_min_cap')=0*ones(1,ma);
rand('uniform');
g1('edge_max_cap')=round(20*rand(1,ma))+ones(1,ma);
g1('edge_cost')=10*rand(1,ma)+ones(1,ma);
source=15; sink=1; cv=5;
[c,phi,v]=min_lcost_cflow(source,sink,cv,g1);
x_message(['The cost is: '+string(c);
'Showing the flow on the arcs']);
nodetype=0*ones(1,n); nodetype(source)=2; nodetype(sink)=1;
g1('node_type')=nodetype;
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
g1('edge_color')=edgecolor;
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
nodecolor=0*ones(1,n); nodecolor(source)=11; nodecolor(sink)=11;
g1('node_color')=nodecolor;
g1('edge_font_size')=edgefontsize;
g1('edge_label')=string(phi);
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/min_lcost_flow1.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15 14 9 11 10 1 8];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14 4 6 9 1 12 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[194 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[56 221 316 318 316 143 214 321 217 126 215 80 330 437 439];
show_graph(g);
g1=g;ma=arc_number(g1);
rand('uniform');
while %T then
g1('edge_min_cap')=round(20*rand(1,ma));
g1('edge_max_cap')=round(20*rand(1,ma))+g1('edge_min_cap')+33*ones(1,ma);
g1('edge_cost')=round(10*rand(1,ma))+ones(1,ma);
[c,phi,flag]=min_lcost_flow1(g1);
if flag==1 then break; end;
end;
x_message(['The cost is: '+string(c);
'Showing the flow on the arcs ']);
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
g1('edge_color')=edgecolor;
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
g1('edge_font_size')=edgefontsize;
g1('edge_label')=string(phi);
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/min_lcost_flow2.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15 14 9 11 10 1 8];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14 4 6 9 1 12 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[194 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[56 221 316 318 316 143 214 321 217 126 215 80 330 437 439];
show_graph(g);
g1=g; ma=arc_number(g1); n=g1('node_number');
g1('edge_min_cap')=0.*ones(1,ma);
x_message(['Random generation of data';
'The first(s) generated problem(s) may be unfeasible']);
while %T then
rand('uniform');
g1('edge_max_cap')=round(20*rand(1,ma))+20*ones(1,ma);
g1('edge_cost')=round(10*rand(1,ma)+ones(1,ma));
rand('normal');
dd=20.*rand(1,n)-10*ones(1,n);
dd=round(dd-sum(dd)/n*ones(1,n));
dd(n)=dd(n)-sum(dd);
g1('node_demand')=dd;
[c,phi,flag]=min_lcost_flow2(g1);
if flag==1 then break; end;
end;
x_message(['The cost is: '+string(c);
'Showing the flow on the arcs and the demand on the nodes']);
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
g1('edge_color')=edgecolor;
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
g1('edge_font_size')=edgefontsize;
g1('edge_label')=string(phi);
g1('node_label')=string(g1('node_demand'));
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/min_qcost_flow.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15 14 9 11 10 1 8];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14 4 6 9 1 12 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[194 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[56 221 316 318 316 143 214 321 217 126 215 80 330 437 439];
show_graph(g);
g1=g; ma=arc_number(g1);
rand('uniform');
while %T then
g1('edge_min_cap')=round(5*rand(1,ma));
g1('edge_max_cap')=round(20*rand(1,ma))+30*ones(1,ma);
g1('edge_q_orig')=0*ones(1,ma);
g1('edge_q_weight')=ones(1,ma);
[c,phi,flag]=min_qcost_flow(0.001,g1);
if flag==1 then break; end;
end;
x_message(['The cost is: '+string(c);
'Showing the flow on the arcs']);
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
g1('edge_color')=edgecolor;
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
g1('edge_font_size')=edgefontsize;
g1('edge_label')=string(phi);
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/min_weight_tree.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
t=min_weight_tree(1,g);
g1=g; ma=arc_number(g1); n=g1('node_number');
nodetype=0*ones(1,n); nodetype(1)=2; g1('node_type')=nodetype;
edgecolor=1*ones(1,ma); edgecolor(t)=11*ones(t); g1('edge_color')=edgecolor;
edgewidth=1*ones(1,ma); edgewidth(t)=4*ones(t); g1('edge_width')=edgewidth;
x_message('Minimum weight tree from node 1');
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/neighbors.man
//====================================================
clear;lines(0);
ta=[1 6 2 4 7 5 6 8 4 3 5 1];
he=[2 1 3 6 4 8 8 7 2 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[285 284 335 160 405 189 118 45];
g('node_y')=[266 179 83 176 368 252 64 309];
show_graph(g);
a=neighbors(6,g)
show_nodes(a);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/netclose.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/netwindow.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/netwindows.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/node_number.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/nodes_2_path.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
ns=[1 10 15 16 17 14 11 12 13 9 7 8 6];
g1=g; nodecolor=1*ones(g('node_x')); nodecolor(ns)=11*ones(ns);
g1('node_color')=nodecolor;
show_graph(g1); show_nodes(ns);
p=nodes_2_path(ns,g);
g1=g; edgecolor=1*ones(ta); edgecolor(p)=11*ones(p);
g1('edge_color')=edgecolor;
show_graph(g1); show_arcs(p);
show_nodes(ns,'sup');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/nodes_degrees.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
[outdegree,indegree]=nodes_degrees(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/path_2_nodes.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
p=[2 16 23 25 26 22 17 18 19 13 10 11];
g1=g; edgecolor=1*ones(ta); edgecolor(p)=11*ones(p);
g1('edge_color')=edgecolor;
show_graph(g1); show_arcs(p);
ns=path_2_nodes(p,g);
g1=g; nodecolor=1*ones(g1('node_number')); nodecolor(ns)=11*ones(ns);
g1('node_color')=nodecolor;
show_graph(g1);show_nodes(ns);
show_arcs(p,'sup');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/perfect_match.man
//====================================================
clear;lines(0);
ta=[27 27 3 12 11 12 27 26 26 25 25 24 23 23 21 22 21 20 19 18 18];
ta=[ta 16 15 15 14 12 9 10 6 9 17 8 17 10 20 11 23 23 12 18 28];
he=[ 1 2 2 4 5 11 13 1 25 22 24 22 22 19 13 13 14 16 16 9 16];
he=[he 10 10 11 12 2 6 5 5 7 8 7 9 6 11 4 18 13 3 28 17];
n=28;
g=make_graph('foo',0,n,ta,he);
xx=[46 120 207 286 366 453 543 544 473 387 300 206 136 250 346 408];
g('node_x')=[xx 527 443 306 326 196 139 264 55 58 46 118 513];
yy=[36 34 37 40 38 40 35 102 102 98 93 96 167 172 101 179];
g('node_y')=[yy 198 252 183 148 172 256 259 258 167 109 104 253];
show_graph(g);m2=2*size(ta,2);
arcost=round(100.*rand(1,m2));
[cst,nmatch] = perfect_match(g,arcost);
sp=sparse([ta' he'],[1:size(ta,2)]',[n,n]);
sp1=sparse([[1:n]' nmatch'],ones(1,size(nmatch,2))',[n,n]);
[ij,v,mn]=spget(sp.*sp1);
show_arcs(v');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/pipe_network.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 3 3 4 4 5 5 5 5 6 6 6 7 7 15 15 15 15 15 15];
ta=[ta, 15 8 9 10 11 12 13 14];
he=[10 13 9 14 8 11 9 11 8 10 12 13 8 9 12 8 11 1 2 3 4];
he=[he, 5 6 7 16 16 16 16 16 16 16];
n=16;
g=make_graph('foo',1,n,ta,he);
g('node_x')=[42 615 231 505 145 312 403 233 506 34 400 312 142 614 260 257];
g('node_y')=[143 145 154 154 147 152 157 270 273 279 269 273 273 274 50 376];
show_graph(g);
g('node_demand')=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100 100];
w = [1 3 2 6 4 7 8 1 2 2 2 4 7 8 9 2 3 5 7 3 2 5 8 2 5 8];
g('edge_weight')=[w, 6 4 3 5 6];
[x,pi] = pipe_network(g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/plot_graph.man
//====================================================
clear;lines(0);
// simple graph with different choices for the plot
ta=[2 2 1 1 2 4 3 3 4];
he=[2 2 3 2 3 2 1 2 1];
g=make_graph('foo',1,4,ta,he);
g('node_type')=[1 1 1 2];g('node_name')=string([1:4]);
g('node_x')=[73 737 381 391]; g('node_y')=[283 337 458 142];
g('node_color')=[3 3 3 11];
g('node_diam')=[30 30 30 60];
g('edge_color')=[10 0 2 6 11 11 0 0 11];
rep=[2 2 1 1 2 2 2 2 2 2 2 2 2];
rep1=[100 -400 650 300];
xbasc(); plot_graph(g,rep,rep1);
rep=[2 1 1 1 2 2 2 2 2 2 2 2 2];
x_message('plot the graph with different parameters');
xbasc(); plot_graph(g,rep,rep1);
// plotting using dialogs
xbasc(); plot_graph(g);
xset("thickness",4);
xbasc();
plot_graph(g);
xset('default');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/predecessors.man
//====================================================
clear;lines(0);
ta=[1 6 2 4 7 5 6 8 4 3 5 1];
he=[2 1 3 6 4 8 8 7 2 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[285 284 335 160 405 189 118 45];
g('node_y')=[266 179 83 176 368 252 64 309];
show_graph(g);
a=predecessors(8,g)
show_nodes(a);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/qassign.man
//====================================================
clear;lines(0);
n=15;
d=100*rand(15,15);
d=d-diag(diag(d));
c=zeros(n,n);f=c;
f(2:n,1)=ones(1:n-1)';
[crit,order]=qassign(c,f,d)
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/salesman.man
//====================================================
clear;lines(0);
ta=[2 1 3 2 2 4 4 5 6 7 8 8 9 10 10 10 10 11 12 13 13 14 15 16 16 17 17];
he=[1 10 2 5 7 3 2 4 5 8 6 9 7 7 11 13 15 12 13 9 14 11 16 1 17 14 15];
g=make_graph('foo',0,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
g1=make_graph('foo1',1,17,[ta he],[he ta]);
m=arc_number(g1);
g1('edge_length')=5+round(30*rand(1,m));
cir = salesman(g1);
ii=find(cir > edge_number(g));
if(ii <> []) then cir(ii)=cir(ii)-edge_number(g);end;
show_arcs(cir);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/save_graph.man
//====================================================
clear;lines(0);
g=load_graph(SCI+'/demos/metanet/mesh100');
show_graph(g);
unix('rm mymesh100.graph')
save_graph(g,'mymesh100.graph');
g=load_graph('mymesh100');
show_graph(g,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/shortest_path.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15 14 9 11 10];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14 4 6 9 1];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[194 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[56 181 276 278 276 103 174 281 177 86 175 90 290 397 399];
show_graph(g);
g1=g;ma=prod(size(g1('head')));
rand('uniform');
g1('edge_length')=int(20*rand(1,ma));
[p,lp]=shortest_path(13,1,g1,'length');
p
x_message(['Showing the arcs of the shortest path ';
'Choose ""Display arc names"" in the Graph menu to see arc names']);
g1('edge_name')=string(g1('edge_length'));
edgecolor=ones(1:ma);edgecolor(p)=11*ones(p);
g1('edge_color')=edgecolor;
edgefontsize=12*ones(1,ma);edgefontsize(p)=18*ones(p);
g1('edge_font_size')=edgefontsize;
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/show_arcs.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
t=min_weight_tree(1,g); g1=g; ma=edge_number(g1);
edgecolor=1*ones(1,ma); g1('edge_color')=edgecolor;
edgewidth=1*ones(1,ma); edgewidth(t)=4*ones(t); g1('edge_width')=edgewidth;
for i=8:12,
edgecolor(t)=i*ones(t); g1('edge_color')=edgecolor;
unix('sleep 2'); show_graph(g1);
show_arcs(t);
end;
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/show_graph.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g,2);
show_graph(g,0.5);
show_graph(g,1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/show_nodes.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
for i=2:3:g('node_number'), show_nodes([i]); end;
for i=1:3:g('node_number'), show_nodes([i],'sup'); end;
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/split_edge.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
show_graph(g);
gt=split_edge(1,2,g);
show_graph(gt,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/strong_con_nodes.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[197 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[76 181 276 278 276 83 174 281 177 86 175 90 290 397 399];
show_graph(g);
ncomp=strong_con_nodes(3,g);
n=g('node_number');
nodecolor=0*ones(1,n); nodecolor(ncomp)=11*ones(ncomp);
g('node_color')=nodecolor;
nodediam=20*ones(1,n); nodediam(ncomp)=40*ones(ncomp);
g('node_diam')=nodediam;
x_message('Set of nodes of the strong connected component #3');
show_graph(g);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/strong_connex.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15];
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14];
g=make_graph('foo',1,15,ta,he);
g('node_x')=[197 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
g('node_y')=[76 181 276 278 276 83 174 281 177 86 175 90 290 397 399];
show_graph(g);
[nc,ncomp]=strong_connex(g);
g1=g; g1('node_color')=8+ncomp; g1('node_diam')=10+5*ncomp;
x_message('Connected components of the graph');
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/subgraph.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
metanet_sync(1);
v=[2 3 4 5 17 13 10];
show_nodes(v);
g1=subgraph(v,'nodes',g);
show_graph(g1);
v=[10 13 12 16 20 19];
show_graph(g);
show_arcs(v);
g1=subgraph(v,'edges',g);
show_graph(g1);
metanet_sync(0);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/successors.man
//====================================================
clear;lines(0);
ta=[1 6 2 4 7 5 6 8 4 3 5 1];
he=[2 1 3 6 4 8 8 7 2 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[285 284 335 160 405 189 118 45];
g('node_y')=[266 179 83 176 368 252 64 309];
show_graph(g);
a=successors(6,g)
show_nodes(a);
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/supernode.man
//====================================================
clear;lines(0);
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
g=make_graph('foo',1,17,ta,he);
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
g('node_diam')=[1:(g('node_number'))]+20;
show_graph(g);
v=[7 10 13 9];
show_nodes(v);
g1=supernode(v,g);
show_graph(g1,'new');
for k=winsid(),xdel(k);end
//====================================================
// ../man/metanet/trans_closure.man
//====================================================
clear;lines(0);
ta=[2 3 3 5 3 4 4 5 8];
he=[1 2 4 2 6 6 7 7 4];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[129 200 283 281 128 366 122 333];
g('node_y')=[61 125 129 189 173 135 236 249];
show_graph(g);
g1=trans_closure(g);
vv=1*ones(ta); aa=sparse([ta' he'],vv');
ta1=g1('tail'); he1=g1('head');
ww=1*ones(ta1); bb=sparse([ta1' he1'],ww');
dif=bb-aa; lim=size(ta1); edgecolor=0*ones(ta1);
for i=1:lim(2)
if dif(ta1(i),he1(i))==1 then edgecolor(i)=11; end;
end;
g1('edge_color')=edgecolor;
x_message('Transitive closure of the graph');
show_graph(g1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/bvode.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/colnew.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/dasrt.man
//====================================================
clear;lines(0);
//dy/dt = ((2*log(y)+8)/t -5)*y, y(1) = 1, 1<=t<=6
//g1 = ((2*log(y)+8)/t - 5)*y
//g2 = log(y) - 2.2491
y0=1;t=2:6;t0=1;y0d=3;
info=list([],0,[],[],[],0,0);
atol=1.d-6;rtol=0;ng=2;
deff('[delta,ires]=res1(t,y,ydot)','ires=0;delta=ydot-((2*log(y)+8)/t-5)*y')
deff('[rts]=gr1(t,y)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
[yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
//(Should return nn=[2.4698972 2])
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/dassl.man
//====================================================
clear;lines(0);
deff('[r,ires]=chemres(t,y,yd)',[
'r(1)=-0.04*y(1)+1d4*y(2)*y(3)-yd(1);';
'r(2)=0.04*y(1)-1d4*y(2)*y(3)-3d7*y(2)*y(2)-yd(2);'
'r(3)=y(1)+y(2)+y(3)-1;'
'ires=0']);
deff('[pd]=chemjac(x,y,yd,cj)',[
'pd=[-0.04-cj , 1d4*y(3) , 1d4*y(2);';
'0.04 ,-1d4*y(3)-2*3d7*y(2)-cj ,-1d4*y(2);';
'1 , 1 , 1 ]'])
y0=[1;0;0];
yd0=[-0.04;0.04;0];
t=[1.d-5:0.02:.4,0.41:.1:4,40,400,4000,40000,4d5,4d6,4d7,4d8,4d9,4d10];
info=list([],0,[],[],[],0,0);
y=dassl([y0,yd0],0,t,chemres,info);
info(2)=1;
y=dassl([y0,yd0],0,4d10,chemres,info);
y=dassl([y0,yd0],0,4d10,chemres,chemjac,info);
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/fit_dat.man
//====================================================
clear;lines(0);
deff('y=FF(x)','y=a*(x-b)+c*x.*x')
X=[];Y=[];
a=34;b=12;c=14;for x=0:.1:3, Y=[Y,FF(x)+100*(rand()-.5)];X=[X,x];end
Z=[Y;X];
deff('e=G(p,z)','a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),e=y-FF(x)')
[p,err]=fit_dat(G,[3;5;10],Z)
xset('window',0)
xbasc();
plot2d(X',Y',-1)
plot2d(X',FF(X)',5,'002')
a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
a=34;b=12;c=14;
deff('s=DG(p,z)','y=z(1),x=z(2),s=-[x-p(2),-p(1),x*x]')
[p,err]=fit_dat(G,[3;5;10],Z,DG)
xset('window',1)
xbasc();
plot2d(X',Y',-1)
plot2d(X',FF(X)',5,'002')
a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/fsolve.man
//====================================================
clear;lines(0);
// A simple example with fsolve
a=[1,7;2,8];b=[10;11];
deff('[y]=fsol1(x)','y=a*x+b');
deff('[y]=fsolj1(x)','y=a');
[xres]=fsolve([100;100],fsol1);
a*xres+b
[xres]=fsolve([100;100],fsol1,fsolj1);
a*xres+b
// See routines/default/Ex-fsolve.f
[xres]=fsolve([100;100],'fsol1','fsolj1',1.e-7);
a*xres+b
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/impl.man
//====================================================
clear;lines(0);
y=impl([1;0;0],[-0.04;0.04;0],0,0.4,'resid','aplusp');
// Using hot restart
//[x1,w,iw]=impl([1;0;0],[-0.04;0.04;0],0,0.2,'resid','aplusp');
// hot start from previous call
//[x1]=impl([1;0;0],[-0.04;0.04;0],0.2,0.4,'resid','aplusp',w,iw);
//maxi(abs(x1-x))
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/int2d.man
//====================================================
clear;lines(0);
X=[0,0;1,1;1,0];
Y=[0,0;0,1;1,1];
deff('z=f(x,y)','z=cos(x+y)')
[I,e]=int2d(X,Y,f)
// computes the integrand over the square [0 1]x[0 1]
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/int3d.man
//====================================================
clear;lines(0);
X=[0;1;0;0];
Y=[0;0;1;0];
Z=[0;0;0;1];
deff('v=f(xyz,numfun)','v=exp(xyz''*xyz)')
[RESULT,ERROR]=int3d(X,Y,Z,'int3dex')
// computes the integrand exp(x*x+y*y+z*z) over the
//tetrahedron (0.,0.,0.),(1.,0.,0.),(0.,1.,0.),(0.,0.,1.)
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/intc.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/intg.man
//====================================================
clear;lines(0);
deff('[y]=f(x)','y=x*sin(30*x)/sqrt(1-((x/(2*%pi))^2))')
exact=-2.5432596188;
abs(exact-intg(0,2*%pi,f))
// See file routines/default/Ex-intg.f
abs(exact-intg(0,2*%pi,'intgex'))
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/intl.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/karmarkar.man
//====================================================
clear;lines(0);
// n=10;p=20;
// a=rand(n,p);c=rand(p,1);x0=abs(rand(p,1));b=a*x0;x1=karmarkar(a,b,c,x0);
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/linpro.man
//====================================================
clear;lines(0);
//Find x in R^6 such that:
//C1*x = b1 (3 equality constraints i.e mi=3)
C1= [1,-1,1,0,3,1;
-1,0,-3,-4,5,6;
2,5,3,0,1,0];
b1=[1;2;3];
//C2*x <= b2 (2 inequality constraints)
C2=[0,1,0,1,2,-1;
-1,0,2,1,1,0];
b2=[-1;2.5];
//with x between ci and cs:
ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
//and minimize p'*x with
p=[1;2;3;4;5;6]
//No initial point is given: x0='v';
C=[C1;C2]; b=[b1;b2] ; mi=3; x0='v';
[x,lagr,f]=linpro(p,C,b,ci,cs,mi,x0)
// Lower bound constraints 3 and 4 are active and upper bound
// constraint 5 is active --> lagr(3:4) < 0 and lagr(5) > 0.
// Linear (equality) constraints 1 to 3 are active --> lagr(7:9) <> 0
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/lmisolver.man
//====================================================
clear;lines(0);
//Find diagonal matrix X (i.e. X=diag(diag(X), p=1) such that
//A1'*X+X*A1+Q1 < 0, A2'*X+X*A2+Q2 < 0 (q=2) and trace(X) is maximized
n=2;A1=rand(n,n);A2=rand(n,n);
Xs=diag(1:n);Q1=-(A1'*Xs+Xs*A1+0.1*eye());
Q2=-(A2'*Xs+Xs*A2+0.2*eye());
deff('[LME,LMI,OBJ]=evalf(Xlist)','X=Xlist(1),LME=X-diag(diag(X));...
LMI=list(-(A1''*X+X*A1+Q1),-(A2''*X+X*A2+Q2)),OBJ= -sum(diag(X)) ');
X=lmisolver(list(zeros(A1)),evalf);X=X(1)
[Y,Z,c]=evalf(X)
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/lmitool.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/ode.man
//====================================================
clear;lines(0);
// Simple one dimension ODE
// dy/dt=y^2-y sin(t)+cos(t), y(0)=0
deff('[ydot]=f(t,y)','ydot=y^2-y*sin(t)+cos(t)')
y0=0;t0=0;t=0:0.1:%pi;
y=ode(y0,t0,t,f)
plot(t,y)
// Simulation of dx/dt = A x(t) + B u(t) with u(t)=sin(omega*t),
// x0=[1;0] ;
// solution x(t) desired at t=0.1, 0.2, 0.5 ,1.
// A and u function are passed to RHS function in a list.
// B and omega are passed as global variables
deff('[xdot]=linear(t,x,A,u)','xdot=A*x+B*u(t)')
deff('[ut]=u(t)','ut=sin(omega*t)')
A=[1 1;0 2];B=[1;1];omega=5;
ode([1;0],0,[0.1,0.2,0.5,1],list(linear,A,u))
//
// Matrix notation
// Integration of the Riccati differential equation
// Xdot=A'*X + X*A - X'*B*X + C , X(0)=Identity
// Solution at t=[1,2]
deff('[Xdot]=ric(t,X)','Xdot=A''*X+X*A-X''*B*X+C')
A=[1,1;0,2]; B=[1,0;0,1]; C=[1,0;0,1];
X=ode(eye(A),0,t,ric)
//
// Computation of exp(A)
A=[1,1;0,2];
deff('[xdot]=f(t,x)','xdot=A*x');
ode(eye(A),0,1,f)
ode('adams',eye(A),0,1,f)
// with stiff matrix, Jacobian given
A=[10,0;0,-1];
deff('[J]=Jacobian(t,y)','J=A')
ode('stiff',[0;1],0,1,f,Jacobian)
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/ode_discrete.man
//====================================================
clear;lines(0);
y1=[1;2;3];deff('yp=a_function(k,y)','yp=A*y+B*u(k)')
A=diag([0.2,0.5,0.9]);B=[1;1;1];u=1:10;n=5;
y=ode('discrete',y1,1,1:n,a_function);
y(:,2)-(A*y1+B*u(1))
// Now y evaluates at [y3,y5,y7,y9]
y=ode('discrete',y1,1,3:2:9,a_function);
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/ode_root.man
//====================================================
clear;lines(0);
// Integration of the differential equation
// dy/dt=y , y(0)=1, and finds the minimum time t such that y(t)=2
deff('[ydot]=f(t,y)','ydot=y')
deff('[z]=g(t,y)','z=y-2')
y0=1;ng=1;
[y,rd]=ode('roots',y0,0,2,f,ng,g)
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/odedc.man
//====================================================
clear;lines(0);
//Linear system with switching input
deff('xdu=phis(t,x,u,flag)','if flag==0 then xdu=A*x+B*u; else xdu=1-u;end');
x0=[1;1];A=[-1,2;-2,-1];B=[1;2];u=0;nu=1;stdel=[1,0];u0=0;t=0:0.05:10;
xu=odedc([x0;u0],nu,stdel,0,t,phis);x=xu(1:2,:);u=xu(3,:);
nx=2;
plot2d1('onn',t',x',[1:nx],'161');
plot2d2('onn',t',u',[nx+1:nx+nu],'000');
//Fortran external( see fydot2.f):
norm(xu-odedc([x0;u0],nu,stdel,0,t,'phis'),1)
//Sampled feedback
//
// | xcdot=fc(t,xc,u)
// (system) |
// | y=hc(t,xc)
//
//
// | xd+=fd(xd,y)
// (feedback) |
// | u=hd(t,xd)
//
deff('xcd=f(t,xc,xd,iflag)',...
['if iflag==0 then '
' xcd=fc(t,xc,e(t)-hd(t,xd));'
'else '
' xcd=fd(xd,hc(t,xc));'
'end']);
A=[-10,2,3;4,-10,6;7,8,-10];B=[1;1;1];C=[1,1,1];
Ad=[1/2,1;0,1/20];Bd=[1;1];Cd=[1,1];
deff('st=e(t)','st=sin(3*t)')
deff('xdot=fc(t,x,u)','xdot=A*x+B*u')
deff('y=hc(t,x)','y=C*x')
deff('xp=fd(x,y)','xp=Ad*x + Bd*y')
deff('u=hd(t,x)','u=Cd*x')
h=0.1;t0=0;t=0:0.1:2;
x0c=[0;0;0];x0d=[0;0];nd=2;
xcd=odedc([x0c;x0d],nd,h,t0,t,f);
norm(xcd-odedc([x0c;x0d],nd,h,t0,t,'fcd1')) // Fast calculation (see fydot2.f)
plot2d([t',t',t'],xcd(1:3,:)');
xset("window",2);plot2d2("gnn",[t',t'],xcd(4:5,:)');
xset("window",0);
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/odeoptions.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/optim.man
//====================================================
clear;lines(0);
xref=[1;2;3];x0=[1;-1;1]
deff('[f,g,ind]=cost(x,ind)','f=0.5*norm(x-xref)^2,g=x-xref');
[f,xopt]=optim(cost,x0) //Simplest call
[f,xopt,gopt]=optim(cost,x0,'gc') // By conjugate gradient
[f,xopt,gopt]=optim(cost,x0,'nd') //Seen as non differentiable
[f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0) // Bounds on x
[f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0,'gc') // Bounds on x
[f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0,'gc','ar',3)
// Here, 3 calls to cost are allowed.
// Now calling the Fortran subroutine "genros" in SCIDIR/default/Ex-optim.f
// See also the link function for dynamically linking an objective function
[f,xopt,gopt]=optim('genros',[1;2;3]) //Rosenbrock's function
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/quapro.man
//====================================================
clear;lines(0);
//Find x in R^6 such that:
//C1*x = b1 (3 equality constraints i.e mi=3)
C1= [1,-1,1,0,3,1;
-1,0,-3,-4,5,6;
2,5,3,0,1,0];
b1=[1;2;3];
//C2*x <= b2 (2 inequality constraints)
C2=[0,1,0,1,2,-1;
-1,0,2,1,1,0];
b2=[-1;2.5];
//with x between ci and cs:
ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
//and minimize 0.5*x'*Q*x + p'*x with
p=[1;2;3;4;5;6]; Q=eye(6,6);
//No initial point is given;
C=[C1;C2] ; //
b=[b1;b2] ; //
mi=3;
[x,lagr,f]=quapro(Q,p,C,b,ci,cs,mi)
//Only linear constraints (1 to 4) are active (lagr(1:6)=0):
[x,lagr,f]=quapro(Q,p,C,b,[],[],mi) //Same result as above
for k=winsid(),xdel(k);end
//====================================================
// ../man/nonlinear/semidef.man
//====================================================
clear;lines(0);
F0=[2,1,0,0;
1,2,0,0;
0,0,3,1
0,0,1,3];
F1=[1,2,0,0;
2,1,0,0;
0,0,1,3;
0,0,3,1]
F2=[2,2,0,0;
2,2,0,0;
0,0,3,4;
0,0,4,4];
blck_szs=[2,2];
F01=F0(1:2,1:2);F02=F0(3:4,3:4);
F11=F1(1:2,1:2);F12=F1(3:4,3:4);
F21=F2(1:2,1:2);F22=F2(3:4,3:4);
x0=[0;0]
Z0=2*F0;
Z01=Z0(1:2,1:2);Z02=Z0(3:4,3:4);
FF=[[F01(:);F02(:)],[F11(:);F12(:)],[F21(:);F22(:)]]
ZZ0=[[Z01(:);Z02(:)]];
c=[trace(F1*Z0);trace(F2*Z0)];
options=[10,1.d-10,1.d-10,0,50];
[x,Z,ul,info]=semidef(x0,pack(ZZ0),pack(FF),blck_szs,c,options)
w=vec2list(unpack(Z,blck_szs),[blck_szs;blck_szs]);Z=sysdiag(w(1),w(2))
c'*x+trace(F0*Z)
spec(F0+F1*x(1)+F2*x(2))
trace(F1*Z)-c(1)
trace(F2*Z)-c(2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/bezout.man
//====================================================
clear;lines(0);
x=poly(0,'x');
p1=(x+1)*(x-3)^5;p2=(x-2)*(x-3)^3;
[thegcd,U]=bezout(p1,p2)
det(U)
clean([p1,p2]*U)
thelcm=p1*U(1,2)
lcm([p1,p2])
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/clean.man
//====================================================
clear;lines(0);
x=poly(0,'x');
w=[x,1,2+x;3+x,2-x,x^2;1,2,3+x]/3;
w*inv(w)
clean(w*inv(w))
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/cmndred.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/coffg.man
//====================================================
clear;lines(0);
s=poly(0,'s')
a=[ s, s^2+1; s s^2-1];
[a1,d]=coffg(a);
(a1/d)-inv(a)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/colcompr.man
//====================================================
clear;lines(0);
s=poly(0,'s');
p=[s;s*(s+1)^2;2*s^2+s^3];
[Y,rk,ac]=colcompr(p*p');
p*p'*Y
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/denom.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/derivat.man
//====================================================
clear;lines(0);
s=poly(0,'s');
derivat(1/s) // -1/s^2;
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/determ.man
//====================================================
clear;lines(0);
s=poly(0,'s');
w=s*rand(10,10);
determ(w)
det(coeff(w,1))*s^10
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/detr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/diophant.man
//====================================================
clear;lines(0);
s=poly(0,'s');p1=(s+3)^2;p2=(1+s);
x1=s;x2=(2+s);
[x,err]=diophant([p1,p2],p1*x1+p2*x2);
p1*x1+p2*x2-p1*x(1)-p2*x(2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/factors.man
//====================================================
clear;lines(0);
n=poly([0.2,2,5],'z');
d=poly([0.1,0.3,7],'z');
R=syslin('d',n,d);
R1=factors(R,'d')
roots(R1('num'))
roots(R1('den'))
w=exp(2*%i*%pi*[0:0.1:1]);
norm(abs(horner(R1,w))-abs(horner(R,w)))
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/gcd.man
//====================================================
clear;lines(0);
s=poly(0,'s');
p=[s,s*(s+1)^2,2*s^2+s^3];
[pgcd,u]=gcd(p);
p*u
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/hermit.man
//====================================================
clear;lines(0);
s=poly(0,'s');
p=[s, s*(s+1)^2, 2*s^2+s^3];
[Ar,U]=hermit(p'*p);
clean(p'*p*U), det(U)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/horner.man
//====================================================
clear;lines(0);
s=poly(0,'s');M=[s,1/s];
horner(M,1)
horner(M,%i)
horner(M,1/s)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/hrmt.man
//====================================================
clear;lines(0);
x=poly(0,'x');
v=[x*(x+1),x^2*(x+1),(x-2)*(x+1),(3*x^2+2)*(x+1)];
[pg,U]=hrmt(v);U=clean(U)
det(U)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/htrianr.man
//====================================================
clear;lines(0);
x=poly(0,'x');
M=[x;x^2;2+x^3]*[1,x-2,x^4];
[Mu,U,rk]=htrianr(M)
det(U)
M*U(:,1:2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/invr.man
//====================================================
clear;lines(0);
s=poly(0,'s')
H=[s,s*s+2;1-s,1+s]; invr(H)
[Num,den]=coffg(H);Num/den
H=[1/s,(s+1);1/(s+2),(s+3)/s];invr(H)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/lcm.man
//====================================================
clear;lines(0);
s=poly(0,'s');
p=[s,s*(s+1)^2,s^2*(s+2)];
[pp,fact]=lcm(p);
p.*fact, pp
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/lcmdiag.man
//====================================================
clear;lines(0);
s=poly(0,'s');
H=[1/s,(s+2)/s/(s+1)^2;1/(s^2*(s+2)),2/(s+2)];
[N,D]=lcmdiag(H);
N/D-H
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/ldiv.man
//====================================================
clear;lines(0);
wss=ssrand(1,1,3);[a,b,c,d]=abcd(wss);
wtf=ss2tf(wss);
x1=ldiv(numer(wtf),denom(wtf),5)
x2=[c*b;c*a*b;c*a^2*b;c*a^3*b;c*a^4*b]
wssbis=markp2ss(x1',5,1,1);
wtfbis=clean(ss2tf(wssbis))
x3=ldiv(numer(wtfbis),denom(wtfbis),5)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/numer.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/pdiv.man
//====================================================
clear;lines(0);
x=poly(0,'x');
p1=(1+x^2)*(1-x);p2=1-x;
[r,q]=pdiv(p1,p2)
p2*q-p1
p2=1+x;
[r,q]=pdiv(p1,p2)
p2*q+r-p1
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/pol2des.man
//====================================================
clear;lines(0);
s=poly(0,'s');
G=[1,s;1+s^2,3*s^3];[N,B,C]=pol2des(G);
G1=clean(C*inv(s*N-eye())*B),G2=numer(G1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/pol2str.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/polfact.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/residu.man
//====================================================
clear;lines(0);
s=poly(0,'s');
H=[s/(s+1)^2,1/(s+2)];N=numer(H);D=denom(H);
w=residu(N.*horner(N,-s),D,horner(D,-s)); //N(s) N(-s) / D(s) D(-s)
sqrt(sum(w)) //This is H2 norm
h2norm(tf2ss(H))
//
p=(s-1)*(s+1)*(s+2)*(s+10);a=(s-5)*(s-1)*(s*s)*((s+1/2)**2);
b=(s-3)*(s+2/5)*(s+3);
residu(p,a,b)+531863/4410 //Exact
z=poly(0,'z');a=z^3+0.7*z^2+0.5*z-0.3;b=z^3+0.3*z^2+0.2*z+0.1;
atild=gtild(a,'d');btild=gtild(b,'d');
residu(b*btild,z*a,atild)-2.9488038 //Exact
a=a+0*%i;b=b+0*%i;
real(residu(b*btild,z*a,atild)-2.9488038) //Complex case
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/roots.man
//====================================================
clear;lines(0);
p=poly([0,10,1+%i,1-%i],'x');
roots(p)
A=rand(3,3);roots(poly(A,'x')) // Evals by characteristic polynomial
spec(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/routh_t.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/rowcompr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/sfact.man
//====================================================
clear;lines(0);
//Simple polynomial example
z=poly(0,'z');
p=(z-1/2)*(2-z)
w=sfact(p);
w*numer(horner(w,1/z))
//matrix example
F1=[z-1/2,z+1/2,z^2+2;1,z,-z;z^3+2*z,z,1/2-z];
P=F1*gtild(F1,'d'); //P is symmetric
F=sfact(P)
roots(det(P))
roots(det(gtild(F,'d'))) //The stable roots
roots(det(F)) //The antistable roots
clean(P-F*gtild(F,'d'))
//Example of continuous time use
s=poly(0,'s');
p=-3*(s+(1+%i))*(s+(1-%i))*(s+0.5)*(s-0.5)*(s-(1+%i))*(s-(1-%i));p=real(p);
//p(s) = polynomial in s^2 , looks for stable f such that p=f(s)*f(-s)
w=horner(p,(1-s)/(1+s)); // bilinear transform w=p((1-s)/(1+s))
wn=numer(w); //take the numerator
fn=sfact(wn);f=numer(horner(fn,(1-s)/(s+1))); //Factor and back transform
f=f/sqrt(horner(f*gtild(f,'c'),0));f=f*sqrt(horner(p,0)); //normalization
roots(f) //f is stable
clean(f*gtild(f,'c')-p) //f(s)*f(-s) is p(s)
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/simp.man
//====================================================
clear;lines(0);
s=poly(0,'s');
[n,d]=simp((s+1)*(s+2),(s+1)*(s-2))
simp_mode(%F);hns=s/s
simp_mode(%T);hns=s/s
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/simp_mode.man
//====================================================
clear;lines(0);
s=poly(0,'s');
mod=simp_mode()
simp_mode(%f);hns=s/s
simp_mode(%t);hns=s/s
simp_mode(mod);
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/sylm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/polynomials/systmat.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/abort.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/addinter.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/and.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/ans.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/apropos.man
//====================================================
clear;lines(0);
apropos '+'
apropos ode
apropos 'list of'
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/argn.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/backslash.man
//====================================================
clear;lines(0);
A=rand(3,2);b=[1;1;1]; x=A\b; y=pinv(A)*b; x-y
A=rand(2,3);b=[1;1]; x=A\b; y=pinv(A)*b; x-y, A*x-b, A*y-b
A=rand(3,1)*rand(1,2); b=[1;1;1]; x=A\b; y=pinv(A)*b; A*x-b, A*y-b
A=rand(2,1)*rand(1,3); b=[1;1]; x=A\b; y=pinv(A)*b; A*x-b, A*y-b
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/binary.man
//====================================================
clear;lines(0);
filen = 'test.bin'
mopen(filen,'wb');
mput(1996,'ull');mput(1996,'uls');mput(1996,'ubl');mput(1996,'ubs');
mput(1996,'l');mput(1996,'s');mput(98,'uc');mput(98,'c');
mput(1996,'d');mput(1996,'f');mput(1996,'ul');mput(1996,'us');
mclose();
mopen(filen,'rb')
if 1996<>mget(1,'ull') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'uls') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'ubl') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'ubs') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'l') ;write(%io(2),'BUG');end;
if 1996<>mget(1,'s') ;write(%io(2),'Bug');end;
if 98<>mget(1,'uc') ;write(%io(2),'Bug');end;
if 98<>mget(1,'c') ;write(%io(2),'Bug');end;
// with eventuel swap
if 1996<>mget(1,'d') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'f') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'ul') ;write(%io(2),'Bug');end;
if 1996<>mget(1,'us') ;write(%io(2),'Bug');end;
mclose();
// an example with two files
file1 = 'test1.bin';
file2 = 'test2.bin';
fd1=mopen(file1,'wb');
fd2=mopen(file2,'wb');
mput(1996,'ull',fd1);
mput(1996,'ull',fd2);
mclose(fd1);
mclose(fd2);
fd1=mopen(file1,'rb');
if 1996<>mget(1,'ull',fd1) ;write(%io(2),'Bug');end;
fd2=mopen(file2,'rb');
if 1996<>mget(1,'ull',fd2) ;write(%io(2),'Bug');end;
mclose(fd1);
mclose(fd2);
// and example with mseek
file3='test3.bin'
fd1= mopen(file3,'wb');
for i=1:10, mput(i,'d'); end
mseek(0);
mput(678,'d');
mseek(0,fd1,'end');
mput(932,'d');
mclose(fd1)
fd1= mopen(file3,'rb');
res=mget(11,'d')
res1=[1:11]; res1(1)=678;res1($)=932;
if res1<>res ;write(%io(2),'Bug');end;
mseek(0,fd1,'set');
// trying to read more than stored data
res1=mget(100,'d',fd1);
if res1<>res ;write(%io(2),'Bug');end;
meof(fd1)
mclearerr(fd1)
mclose(fd1);
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/bool2s.man
//====================================================
clear;lines(0);
bool2s([%t %t %f %t])
bool2s([2.3 0 10 -1])
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/boolean.man
//====================================================
clear;lines(0);
[1,2]==[1,3]
[1,2]==1
a=1:5; a(a>2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/brackets.man
//====================================================
clear;lines(0);
[6.9,9.64; sqrt(-1) 0]
[1 +%i 2 -%i 3]
[]
['this is';'a string';'vector']
s=poly(0,'s');[1/s,2/s]
[tf2ss(1/s),tf2ss(2/s)]
[u,s]=schur(rand(3,3))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/break.man
//====================================================
clear;lines(0);
k=0; while 1==1, k=k+1; if k > 100 then break,end; end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/call.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/case.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/ceil.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/chdir.man
//====================================================
clear;lines(0);
chdir(TMPDIR);
if MSDOS then
unix_w("dir");
else
unix_w("ls");
end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/clear.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/clearfun.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/code2str.man
//====================================================
clear;lines(0);
code2str([-28 12 18 21 10 11])
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/coeff.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/colon.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/comma.man
//====================================================
clear;lines(0);
a=[1,2,3;4,5,6];
a=1,b=1;c=2
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/comments.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/comp.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/deff.man
//====================================================
clear;lines(0);
deff('[x]=myplus(y,z)','x=y+z')
//
deff('[x]=mymacro(y,z)',['a=3*y+1'; 'x=a*z+y'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/degree.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/delbpt.man
//====================================================
clear;lines(0);
setbpt('foo',1),setbpt('foo',10),delbpt('foo',10),dispbpt()
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/diary.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/disp.man
//====================================================
clear;lines(0);
disp([1 2],3)
deff('[]=%t_p(l)','disp(l(3),l(2))')
disp(tlist('t',1,2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/dispbpt.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/dot.man
//====================================================
clear;lines(0);
1.345
x=[1 2 3];x.^2 .*x // a space is required between 2 and dot
[123,..
456]
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/else.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/elseif.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/empty.man
//====================================================
clear;lines(0);
s=poly(0,'s'); A = [s, s+1];
A+[], A*[]
A=rand(2,2); AA=A([],1), size(AA)
svd([])
w=ssrand(2,2,2); wr=[]*w; size(wr), w1=ss2tf(wr), size(w1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/end.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/equal.man
//====================================================
clear;lines(0);
a=sin(3.2)
[u,s]=schur(rand(3,3))
[1:10]==4
1~=2
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/errcatch.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/errclear.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/error.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/evstr.man
//====================================================
clear;lines(0);
a=1; b=2; Z=['a','b'] ; evstr(Z)
a=1; b=2; Z =list(['%(1)','%(1)-%(2)'],['a+1','b+1']);
evstr(Z)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/exec.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/exists.man
//====================================================
clear;lines(0);
deff('foo(x)',..
['disp([exists(''a12''),exists(''a12'',''local'')])'
'disp([exists(''x''),exists(''x'',''local'')])'])
foo(1)
a12=[];foo(1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/exit.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/external.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/extraction.man
//====================================================
clear;lines(0);
// MATRIX CASE
a=[1 2 3;4 5 6]
a(1,2)
a([1 1],2)
a(:,1)
a(:,3:-1:1)
a(1)
a(6)
a(:)
a([%t %f %f %t])
a([%t %f],[2 3])
a(1:2,$-1)
a($:-1:1,2)
a($)
//
x='test'
x([1 1;1 1;1 1])
//
b=[1/%s,(%s+1)/(%s-1)]
b(1,1)
b(1,$)
b(2) // the numerator
// LIST OR TLIST CASE
l=list(1,'qwerw',%s)
l(1)
[a,b]=l([3 2])
l($)
x=tlist(l(2:3)) //form a tlist with the last 2 components of l
//
dts=list(1,tlist(['x';'a';'b'],10,[2 3]));
dts(2)('a')
dts(2)('b')(1,2)
[a,b]=dts(2)(['a','b'])
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/eye.man
//====================================================
clear;lines(0);
eye(2,3)
A=rand(2,3);eye(A)
s=poly(0,'s');A=[s,1;s,s+1];eye(A)
A=[1/s,1;s,2];eye(A);
A=ssrand(2,2,3);eye(A)
[1 2;3 4]+2*eye()
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/feval.man
//====================================================
clear;lines(0);
deff('[z]=f(x,y)','z=x^2+y^2');
feval(1:10,1:5,f)
deff('[z]=f(x,y)','z=x+%i*y');
feval(1:10,1:5,f)
feval(1:10,1:5,'parab') //See ffeval.f file
feval(1:10,'parab')
// For dynamic link (see example ftest in ffeval.f)
// you can use the link command (the parameters depend on the machine):
// unix('make ftest.o');link('ftest.o','ftest); feval(1:10,1:5,'ftest')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/file.man
//====================================================
clear;lines(0);
u=file('open',TMPDIR+'/foo','unknown')
for k=1:4
a=rand(1,4)
write(u,a)
end
file('rewind',u)
x=read(u,2,4)
file('close',u)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/find.man
//====================================================
clear;lines(0);
A=rand(1,20);
w=find(A<0.5);
A(w)
w=find(A>100);
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/fix.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/floor.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/for.man
//====================================================
clear;lines(0);
n=5;
for i = 1:n, for j = 1:n, a(i,j) = 1/(i+j-1);end;end
for j = 2:n-1, a(j,j) = j; end; a
for e=eye(3,3),e,end
for v=a, write(6,v),end
for j=1:n,v=a(:,j), write(6,v),end
for l=list(1,2,'example'); l,end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/format.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/fort.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/fprintf.man
//====================================================
clear;lines(0);
u=file('open','results','unknown') //open the result file
t=0:0.1:2*%pi;
for tk=t
fprintf(u,'time = %6.3f value = %6.3f',tk,sin(tk)) // write a line
end
file('close',u) //close the result file
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/fscanf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/funcprot.man
//====================================================
clear;lines(0);
deff('[x]=foo(a)','x=a')
deff('[x]=foo(a)','x=a+1')
foo=33
funcprot(0)
deff('[x]=foo(a)','x=a')
deff('[x]=foo(a)','x=a+1')
foo=33
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/function.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/funptr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/getcwd.man
//====================================================
clear;lines(0);
p=getcwd();
pwd
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/getd.man
//====================================================
clear;lines(0);
getd('SCI/macros/auto')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/getenv.man
//====================================================
clear;lines(0);
getenv('SCI')
getenv('FOO','foo')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/getf.man
//====================================================
clear;lines(0);
getf('SCI/macros/xdess/plot.sci')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/getpid.man
//====================================================
clear;lines(0);
d='SD_'+string(getpid())+'_'
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/hat.man
//====================================================
clear;lines(0);
2^4
[1 2;2 4]^(1+%i)
s=poly(0,"s");
[1 2 s]^4
[s 1;1 s]^(-1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/help.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/host.man
//====================================================
clear;lines(0);
host("ls $SCI/demos");
host("emacs $SCI/demos/wheel2/Makefile");
deff('wd=pwd()','if MSDOS then host(''cd>''+TMPDIR+''\path'');..
else host(''pwd>''+TMPDIR+''/path'');end..
wd=read(TMPDIR+''/path'',1,1,''(a)'')')
wd=pwd()
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/hypermat.man
//====================================================
clear;lines(0);
M=hypermat([2 3 2 2],1:24)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/hypermatrices.man
//====================================================
clear;lines(0);
a(1,1,1,1:2)=[1 2]
a=[1 2;3 4];a(:,:,2)=rand(2,2)
a(1,1,:)
[a a]
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/ieee.man
//====================================================
clear;lines(0);
ieee(1);1/0
ieee(2);1/0,log(0)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/if.man
//====================================================
clear;lines(0);
i=2
for j = 1:3,
if i == j then
a(i,j) = 2;
elseif abs(i-j) == 1 then
a(i,j) = -1;
else a(i,j) = 0;
end,
end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/imag.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/insertion.man
//====================================================
clear;lines(0);
// MATRIX CASE
a=[1 2 3;4 5 6]
a(1,2)=10
a([1 1],2)=[-1;-2]
a(:,1)=[8;5]
a(1,3:-1:1)=[77 44 99]
a(1)=%s
a(6)=%s+1
a(:)=1:6
a([%t %f],1)=33
a(1:2,$-1)=[2;4]
a($:-1:1,1)=[8;7]
a($)=123
//
x='test'
x([4 5])=['4','5']
//
b=[1/%s,(%s+1)/(%s-1)]
b(1,1)=0
b(1,$)=b(1,$)+1
b(2)=[1 2] // the numerator
// LIST OR TLIST CASE
l=list(1,'qwerw',%s)
l(1)='Changed'
l(0)='Added'
l(6)=['one more';'added']
//
//
dts=list(1,tlist(['x';'a';'b'],10,[2 3]));
dts(2)('a')=33
dts(2)('b')(1,2)=-100
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/int.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/intersci.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/iserror.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/keyboard.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/left.man
//====================================================
clear;lines(0);
[6.9,9.64; sqrt(-1) 0]
[1 +%i 2 -%i 3]
[]
['this is';'a string';'vector']
[u,s]=schur(rand(3,3))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/length.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/less.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/lib.man
//====================================================
clear;lines(0);
deff('[z]=myplus(x,y)','z=x+y')
deff('[z]=yourplus(x,y)','x=x-y')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/lines.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/link.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/list.man
//====================================================
clear;lines(0);
x=list(1,2,3);
x(4)=10;
x(10)='a'
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/load.man
//====================================================
clear;lines(0);
a=eye(2,2);b=ones(a);
save('vals.dat',a,b);
clear a
clear b
load('vals.dat','a','b');
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/lsslist.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/lstcat.man
//====================================================
clear;lines(0);
lstcat(list(1,2,3),33,list('foo',%s))
lstcat(1,2,3)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/macro.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/matrices.man
//====================================================
clear;lines(0);
E=[1,2;3,4]
E=[%T,%F;1==1,1~=1]
s=poly(0,'s');E=[s,s^2;1,1+s]
E=[1/s,0;s,1/(s+1)]
E=['A11','A12';'A21','A22']
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/matrix.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/max.man
//====================================================
clear;lines(0);
[m,n]=max([1,3,1])
[m,n]=max([3,1,1],[1,3,1],[1,1,3])
[m,n]=max([3,-2,1],1)
[m,n]=max(list([3,1,1],[1,3,1],[1,1,3]))
[m,n]=max(list(1,3,1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/maxi.man
//====================================================
clear;lines(0);
[m,n]=maxi([1,3,1])
[m,n]=maxi([3,1,1],[1,3,1],[1,1,3])
[m,n]=maxi([3,-2,1],1)
[m,n]=maxi(list([3,1,1],[1,3,1],[1,1,3]))
[m,n]=maxi(list(1,3,1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/min.man
//====================================================
clear;lines(0);
[m,n]=min([1,3,1])
[m,n]=min([3,1,1],[1,3,1],[1,1,3])
[m,n]=min(list([3,1,1],[1,3,1],[1,1,3]))
[m,n]=min(list(1,3,1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/mini.man
//====================================================
clear;lines(0);
[m,n]=mini([1,3,1])
[m,n]=mini([3,1,1],[1,3,1],[1,1,3])
[m,n]=mini(list([3,1,1],[1,3,1],[1,1,3]))
[m,n]=mini(list(1,3,1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/minus.man
//====================================================
clear;lines(0);
[1,2]-1
[]-2
%s-2
1/%s-2
"cat"+"enate"
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/mode.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/mtlb_mode.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/names.man
//====================================================
clear;lines(0);
//Valid names
%eps
A1=123
#Color=8
My_Special_Color_Table=rand(10,3)
//Non valid names
//1A , b%, .C
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/newfun.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/not.man
//====================================================
clear;lines(0);
~[%t %t %f]
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/null.man
//====================================================
clear;lines(0);
l=list(1,2,3);
l(2)=null() // get list(1,3)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/ones.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/or.man
//====================================================
clear;lines(0);
or([%t %t %f])
[%t %t %f]|[%f %t %t]
[%t %t %f]|%f
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/overloading.man
//====================================================
clear;lines(0);
//DISPLAY
deff('[]=%tab_p(l)','disp([['' '';l(3)] [l(2);string(l(4))]])')
tlist('tab',['a','b'],['x';'y'],rand(2,2))
//OPERATOR
deff('x=%c_a_s(a,b)','x=a+string(b)')
's'+1
//FUNCTION
deff('x=%c_sin(a)','x=''sin(''+a+'')''')
sin('2*x')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/parents.man
//====================================================
clear;lines(0);
3^(-1)
x=poly(0,"x");
//
(x+10)/2
i3=eye(3,3)
//
a=[1 2 3;4 5 6;7 8 9],a(1,3),a([1 3],:),a(:,3)
a(:,3)=[]
a(1,$)=33
a(2,[$ $-1])
a(:,$+1)=[10;11;12]
//
w=ssrand(2,2,2);ssprint(w)
ssprint(w(:,1))
ss2tf(w(:,1))
//
l=list(1,2,3,4)
[a,b,c,d]=l(:)
l($+1)='new'
//
v=%t([1 1 1 1 1])
//
[x,y,z]=(1,2,3)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/part.man
//====================================================
clear;lines(0);
c=part(['a','abc','abcd'],[1,1,2])
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/pause.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/percent.man
//====================================================
clear;lines(0);
x1=tlist('x',1,2);
x2=tlist('x',2,3);
deff('x=%xmx(x1,x2)','x=list(''x'',x1(2)*x2(2),x2(3)*x2(3))');
x1*x2
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/plus.man
//====================================================
clear;lines(0);
[1,2]+1
[]+2
s=poly(0,"s");
s+2
1/s+2
"cat"+"enate"
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/poly.man
//====================================================
clear;lines(0);
s=poly(0,"s");p=1+s+2*s^2;
A=rand(2,2);poly(A,"x")
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/power.man
//====================================================
clear;lines(0);
A=[1 2;3 4];
A^2.5,
A.^2.5
(1:10)^2
(1:10).^2
s=poly(0,'s')
s^(1:10)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/predef.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/print.man
//====================================================
clear;lines(0);
a=rand(3,3);p=poly([1,2,3],'s');l=list(1,'asdf',[1 2 3]);
print(%io(2),a,p,l)
write(%io(2),a)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/printf.man
//====================================================
clear;lines(0);
printf('Result is:\nalpha=%f",0.535)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/printf_conversion.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/pwd.man
//====================================================
clear;lines(0);
pwd
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/quit.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/quote.man
//====================================================
clear;lines(0);
[1+%i, 2]'
[1+%i, 2].'
x='This is a character string'
'He said:''Good'''
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/rand.man
//====================================================
clear;lines(0);
x=rand(10,10,'uniform')
rand('normal')
rand('info')
y=rand(x,'normal');
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/rat.man
//====================================================
clear;lines(0);
[n,d]=rat(%pi)
[n,d]=rat(%pi,1.d-12)
n/d-%pi
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/rational.man
//====================================================
clear;lines(0);
s=poly(0,'s');
W=[1/s,1/(s+1)]
W'*W
Num=[s,s+2;1,s];Den=[s*s,s;s,s*s];
tlist(['r','num','den','dt'],Num,Den,[])
H=Num./Den
syslin('c',Num,Den)
syslin('c',H)
[Num1,Den1]=simp(Num,Den)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/read.man
//====================================================
clear;lines(0);
if MSDOS then unix('del foo');
else unix('rm -f foo'); end
A=rand(3,5); write('foo',A);
B=read('foo',3,5)
B=read('foo',-1,5)
read(%io(1),1,1,'(a)') // waits for user's input
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/read4b.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/readb.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/real.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/resume.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/return.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/rlist.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/round.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/save.man
//====================================================
clear;lines(0);
a=eye(2,2);b=ones(a);
save('val.dat',a,b);
clear a
clear b
load('val.dat','a','b');
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/scanf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/scanf_conversion.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/sciargs.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/scilab.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/scilink.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/select.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/semicolumn.man
//====================================================
clear;lines(0);
sin(%pi);
a=[1,2;3 4]
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/setbpt.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/sign.man
//====================================================
clear;lines(0);
sign(rand(2,3))
sign(1+%i)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/signm.man
//====================================================
clear;lines(0);
A=rand(4,4);B=A+A';X=sign(B);spec(X)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/size.man
//====================================================
clear;lines(0);
[n,m]=size(rand(3,2))
[n,m]=size(['a','b';'c','d'])
x=ssrand(3,2,4);[ny,nu]=size(x)
[ny,nu]=size(ss2tf(x))
[ny,nu,nx]=size(x)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/slash.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/sprintf.man
//====================================================
clear;lines(0);
fahr=120
sprintf('%3d Fahrenheit = %6.1f Celsius',fahr,(5/9)*(fahr-32))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/sscanf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/stacksize.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/star.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/startup.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/str2code.man
//====================================================
clear;lines(0);
str2code('Scilab')
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/string.man
//====================================================
clear;lines(0);
string(rand(2,2))
deff('y=mymacro(x)','y=x+1')
[out,in,text]=string(mymacro)
x=123.356; 'Result is '+string(x)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/strings.man
//====================================================
clear;lines(0);
['this','is'; 'a 2x2','matrix']
"matrix"=="mat"+"rix"
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/symbols.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/testmatrix.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/then.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/tilda.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/tlist.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/type.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/ulink.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/unix.man
//====================================================
clear;lines(0);
unix("ls $SCI/demos");
unix("emacs $SCI/demos/wheel2/Makefile");
deff('wd=pwd()','if MSDOS then unix(''cd>''+TMPDIR+''\path'');..
else unix(''pwd>''+TMPDIR+''/path'');end..
wd=read(TMPDIR+''/path'',1,1,''(a)'')')
wd=pwd()
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/unix_g.man
//====================================================
clear;lines(0);
if MSDOS then unix_g('dir '+WSCI+'\demos');
else unix_g("ls $SCI/demos"); end
deff('wd=pwd()','if MSDOS then wd=unix_g(''cd'');..
else wd=unix_g(''pwd''); end')
wd=pwd()
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/unix_s.man
//====================================================
clear;lines(0);
if MSDOS then unix_s("del foo");
else unix_s("rm foo"); end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/unix_w.man
//====================================================
clear;lines(0);
if MSDOS then unix_w("dir "+WSCI+"\demos");
else unix_w("ls $SCI/demos"); end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/unix_x.man
//====================================================
clear;lines(0);
if MSDOS then unix_x("dir "+WSCI+"\demos");
else unix_x("ls $SCI/demos"); end
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/user.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/varargin.man
//====================================================
clear;lines(0);
deff('exampl(a,varargin)',['[lhs,rhs]=argn(0)'
'if rhs>=1 then disp(varargin),end'])
exampl(1)
exampl()
exampl(1,2,3)
l=list('a',%s,%t);
exampl(1,l(2:3))
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/varargout.man
//====================================================
clear;lines(0);
deff('varargout=exampl()','varargout=list(1,2,3,4)')
x=exampl()
[x,y]=exampl()
[x,y,z]=exampl()
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/varn.man
//====================================================
clear;lines(0);
s=poly(0,'s');p=[s^2+1,s];
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/warning.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/what.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/where.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/whereami.man
//====================================================
clear;lines(0);
deff('y=test(a)',['y=sin(a)+1';
'y=t1(y)';
'y=y+1'])
deff('y=t1(y)',['y=y^2';'whereami()'])
test(1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/whereis.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/while.man
//====================================================
clear;lines(0);
e=1; a=1; k=1;
while norm(a-(a+e),1) > %eps, e=e/2; k=k+1; end
e,k
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/who.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/whos.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/writb.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/write.man
//====================================================
clear;lines(0);
if MSDOS then unix('del asave');
else unix('rm -f asave'); end
A=rand(5,3); write('asave',A); A=read('asave',5,3);
write(%io(2),A,'('' | '',3(f10.3,'' | ''))')
write(%io(2),string(1:10))
write(%io(2),strcat(string(1:10),','))
write(%io(2),1:10,'(10(i2,3x))')
if MSDOS then unix('del foo');
else unix('rm -f foo'); end
write('foo',A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/programming/write4b.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/augment.man
//====================================================
clear;lines(0);
G=ssrand(2,3,2); //Plant
K=ssrand(3,2,2); //Compensator
[P,r]=augment(G,'T');
T=lft(P,r,K); //Complementary sensitivity function
Ktf=ss2tf(K);Gtf=ss2tf(G);
Ttf=ss2tf(T);T11=Ttf(1,1);
Oloop=Gtf*Ktf;
Tn=Oloop*inv(eye(Oloop)+Oloop);
clean(T11-Tn(1,1));
//
[Pi,r]=augment(G,'T','i');
T1=lft(Pi,r,K);T1tf=ss2tf(T1); //Input Complementary sensitivity function
Oloop=Ktf*Gtf;
T1n=Oloop*inv(eye(Oloop)+Oloop);
clean(T1tf(1,1)-T1n(1,1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/bstap.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/ccontrg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/colinout.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/copfac.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/dcf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/des2ss.man
//====================================================
clear;lines(0);
s=poly(0,'s');G=[1/(s-1),s;1,2/s^3];
S1=tf2des(G);S2=tf2des(G,"withD");
W1=des2ss(S1);W2=des2ss(S2);
clean(ss2tf(W1))
clean(ss2tf(W2))
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/dhnorm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/dtsi.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/fourplan.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/fspecg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/fstabst.man
//====================================================
clear;lines(0);
ny=2;nu=3;nx=4;
P22=ssrand(ny,nu,nx);
bigQ=rand(nx+nu,nx+nu);bigQ=bigQ*bigQ';
bigR=rand(nx+ny,nx+ny);bigR=bigR*bigR';
[P,r]=lqg2stan(P22,bigQ,bigR);
J=fstabst(P,r);
Q=ssrand(nu,ny,1);Q('A')=-1; //Stable Q
K=lft(J,r,Q);
A=h_cl(P,r,K); spec(A)
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/gamitg.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/gcare.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/gfare.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/gtild.man
//====================================================
clear;lines(0);
//Continuous time
s=poly(0,'s');G=[s,s^3;2+s^3,s^2-5]
Gt=gtild(G,'c')
Gt-horner(G,-s)' //continuous-time interpretation
Gt=gtild(G,'d');
Gt-horner(G,1/s)'*s^3 //discrete-time interpretation
G=ssrand(2,2,3);Gt=gtild(G); //State-space (G is cont. time by default)
clean((horner(ss2tf(G),-s))'-ss2tf(Gt)) //Check
// Discrete-time
z=poly(0,'z');
Gss=ssrand(2,2,3);Gss('dt')='d'; //discrete-time
Gss(5)=[1,2;0,1]; //With a constant D matrix
G=ss2tf(Gss);Gt1=horner(G,1/z)';
Gt=gtild(Gss);
Gt2=clean(ss2tf(Gt)); clean(Gt1-Gt2) //Check
//Improper systems
z=poly(0,'z');
Gss=ssrand(2,2,3);Gss(7)='d'; //discrete-time
Gss(5)=[z,z^2;1+z,3]; //D(z) is polynomial
G=ss2tf(Gss);Gt1=horner(G,1/z)'; //Calculation in transfer form
Gt=gtild(Gss); //..in state-space
Gt2=clean(ss2tf(Gt));clean(Gt1-Gt2) //Check
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/h2norm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/h_cl.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/h_inf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/h_inf_st.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/h_norm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/hankelsv.man
//====================================================
clear;lines(0);
A=diag([-1,-2,-3]);
sl=syslin('c',A,rand(3,2),rand(2,3));[nk2,W]=hankelsv(sl)
[Q,M]=pbig(W,nk2(2)-%eps,'c');
slr=projsl(sl,Q,M);hankelsv(slr)
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/lcf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/leqr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/lft.man
//====================================================
clear;lines(0);
s=poly(0,'s');
P=[1/s, 1/(s+1); 1/(s+2),2/s]; K= 1/(s-1);
lft(P,K)
lft(P,[1,1],K)
P(1,1)+P(1,2)*K*inv(1-P(2,2)*K)*P(2,1) //Numerically dangerous!
ss2tf(lft(tf2ss(P),tf2ss(K)))
lft(P,-1)
f=[0,0;0,1];w=P/.f; w(1,1)
//Improper plant (PID control)
W=[1,1;1,1/(s^2+0.1*s)];K=1+1/s+s
lft(W,[1,1],K); ss2tf(lft(tf2ss(W),[1,1],tf2ss(K)))
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/linf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/linfn.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/lqg_ltr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/macglov.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/nehari.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/parrot.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/ric_desc.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/riccati.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/rowinout.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/sensi.man
//====================================================
clear;lines(0);
G=ssrand(1,1,3);K=ssrand(1,1,3);
[Se,Re,Te]=sensi(G,K);
Se1=inv(eye()+G*K); //Other way to compute
ss2tf(Se) //Se seen in transfer form
ss2tf(Se1)
ss2tf(Te)
ss2tf(G*K*Se1)
[Si,Ri,Ti]=sensi(G,K,'i');
w1=[ss2tf(Si);ss2tf(Ri);ss2tf(Ti)]
w2=[ss2tf(inv(eye()+K*G));ss2tf(G*inv(eye()+K*G));ss2tf(K*G*inv(eye()+K*G))];
clean(w1-w2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/robust/tf2des.man
//====================================================
clear;lines(0);
s=poly(0,'s');
G=[1/(s-1),s;1,2/s^3];
S1=tf2des(G);des2tf(S1)
S2=tf2des(G,"withD");des2tf(S2)
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/ABSBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/AFFICH_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/ANDLOG_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/ANIMXY_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/BIGSOM_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLINDUMMY_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKINV_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKIN_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKOUTV_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKOUT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKSOMV_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKSOM_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLKSPLIT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLOCK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLR_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CLSS_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CONST_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/COSBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/CURV_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/DELAYV_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/DELAY_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/DEMUX_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/DLRADAPT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/DLR_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/DLSS_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/EVENTSCOPE_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/EVTDLY_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/EVTGEN_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/EXPBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/GAINBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/GAIN_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/GENERAL_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/GENERIC_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/GENSIN_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/GENSQR_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/HALT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/IFTHEL_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/INTEGRAL_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/INTRP2BLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/INTRPLBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/INVBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/IN_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/LOGBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/LOOKUP_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/MAX_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/MCLOCK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/MFCLCK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/MIN_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/MUX_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/NEGTOPOS_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/OUT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/POSTONEG_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/POWBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/PROD_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/QUANT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/RAND_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/REGISTER_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/RELAY_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/RFILE_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SAMPLEHOLD_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SAT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SAWTOOTH_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SCOPE_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SCOPXY_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SELECT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SINBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SOM_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SPLIT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/STOP_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/SUPER_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/TANBLK_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/TCLSS_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/TEXT_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/TIME_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/TRASH_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/WFILE_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/ZCROSS_f.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/check_io.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/curblock.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/getblocklabel.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/getcurblock.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/getscicosvars.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/icon_edit.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_block.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_cpr.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_graphics.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_link.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_main.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_menus.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicos_model.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicosblock.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scicosim.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/scifunc_block.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/setscicosvars.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/standard_define.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/standard_draw.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/standard_input.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/standard_origin.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/scicos/standard_output.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/%asn.man
//====================================================
clear;lines(0);
m=0.8;z=%asn(1/sqrt(m),m);K=real(z);Ktilde=imag(z);
x2max=1/sqrt(m);
x1=0:0.05:1;x2=1:((x2max-1)/20):x2max;x3=x2max:0.05:10;
x=[x1,x2,x3];
y=%asn(x,m);
rect=[0,-Ktilde,1.1*K,2*Ktilde];
plot2d(real(y)',imag(y)',1,'011',' ',rect)
//
deff('y=f(t)','y=1/sqrt((1-t^2)*(1-m*t^2))');
intg(0,0.9,f)-%asn(0.9,m) //Works for real case only!
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/%k.man
//====================================================
clear;lines(0);
m=0.4;
%asn(1,m)
%k(m)
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/%sn.man
//====================================================
clear;lines(0);
m=0.36;
K=%k(m);
P=4*K; //Real period
real_val=0:(P/50):P;
plot(real_val,real(%sn(real_val,m)))
xbasc();
KK=%k(1-m);
Ip=2*KK;
ima_val1=0:(Ip/50):KK-0.001;
ima_val2=(KK+0.05):(Ip/25):(Ip+KK);
z1=%sn(%i*ima_val1,m);z2=%sn(%i*ima_val2,m);
plot2d([ima_val1',ima_val2'],[imag(z1)',imag(z2)']);
xgrid(3)
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/Signal.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/analpf.man
//====================================================
clear;lines(0);
//Evaluate magnitude response of continuous-time system
hs=analpf(4,'cheb1',[.1 0],5)
fr=0:.1:15;
hf=freq(hs(2),hs(3),%i*fr);
hm=abs(hf);
plot(fr,hm)
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/buttmag.man
//====================================================
clear;lines(0);
//squared magnitude response of Butterworth filter
h=buttmag(13,300,1:1000);
mag=20*log(h)'/log(10);
plot2d((1:1000)',mag,[2],"011"," ",[0,-180,1000,20])
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/casc.man
//====================================================
clear;lines(0);
x=[1,2,3;4,5,6;7,8,9;10,11,12]
cels=casc(x,'z')
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/cepstrum.man
//====================================================
clear;lines(0);
w=0.1:0.1:5;mag=1+abs(sin(w));
fresp=cepstrum(w,mag);
plot2d([w',w'],[mag(:),abs(fresp)])
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/cheb1mag.man
//====================================================
clear;lines(0);
//Chebyshev; ripple in the passband
n=13;epsilon=0.2;omegac=3;sample=0:0.05:10;
h=cheb1mag(n,omegac,epsilon,sample);
plot(sample,h,'frequencies','magnitude')
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/cheb2mag.man
//====================================================
clear;lines(0);
//Chebyshev; ripple in the stopband
n=10;omegar=6;A=1/0.2;sample=0.0001:0.05:10;
h2=cheb2mag(n,omegar,A,sample);
plot(sample,log(h2)/log(10),'frequencies','magnitude in dB')
//Plotting of frequency edges
minval=(-maxi(-log(h2)))/log(10);
plot2d([omegar;omegar],[minval;0],[2],"000");
//Computation of the attenuation in dB at the stopband edge
attenuation=-log(A*A)/log(10);
plot2d(sample',attenuation*ones(sample)',[5],"000")
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/chepol.man
//====================================================
clear;lines(0);
chepol(4,'x')
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/convol.man
//====================================================
clear;lines(0);
x=1:3;
h1=[1,0,0,0,0];h2=[0,1,0,0,0];h3=[0,0,1,0,0];
x1=convol(h1,x),x2=convol(h2,x),x3=convol(h3,x),
convol(h1+h2+h3,x)
p1=poly(x,'x','coeff')
p2=poly(h1+h2+h3,'x','coeff')
p1*p2
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/corr.man
//====================================================
clear;lines(0);
x=%pi/10:%pi/10:102.4*%pi;
rand('seed');rand('normal');
y=[.8*sin(x)+.8*sin(2*x)+rand(x);.8*sin(x)+.8*sin(1.99*x)+rand(x)];
c=[];
for j=1:2,for k=1:2,c=[c;corr(y(k,:),y(j,:),64)];end;end;
c=matrix(c,2,128);cov=[];
for j=1:64,cov=[cov;c(:,(j-1)*2+1:2*j)];end;
rand('unif')
//
rand('normal');x=rand(1,256);y=-x;
deff('[z]=xx(inc,is)','z=x(is:is+inc-1)');
deff('[z]=yy(inc,is)','z=y(is:is+inc-1)');
[c,mxy]=corr(x,y,32);
x=x-mxy(1)*ones(x);y=y-mxy(2)*ones(y); //centring
c1=corr(x,y,32);c2=corr(x,32);
norm(c1+c2,1)
[c3,m3]=corr('fft',xx,yy,256,32);
norm(c1-c3,1)
[c4,m4]=corr('fft',xx,256,32);
norm(m3,1),norm(m4,1)
norm(c3-c1,1),norm(c4-c2,1)
x1=x(1:128);x2=x(129:256);
y1=y(1:128);y2=y(129:256);
w0=0*ones(1:64); //32 coeffs
[w1,xu]=corr('u',x1,y1,w0);w2=corr('u',x2,y2,w1,xu);
zz=real(fft(w2,1))/256;c5=zz(1:32);
norm(c5-c1,1)
[w1,xu]=corr('u',x1,w0);w2=corr('u',x2,w1,xu);
zz=real(fft(w2,1))/256;c6=zz(1:32);
norm(c6-c2,1)
rand('unif')
// test for Fortran or C external
//
deff('[y]=xmacro(sec,ist)','y=sin(ist:(ist+sec-1))');
x=xmacro(100,1);
[cc1,mm1]=corr(x,2^3);
[cc,mm]=corr('fft',xmacro,100,2^3);
[cc2,mm2]=corr('fft','corexx',100,2^3);
[maxi(abs(cc-cc1)),maxi(abs(mm-mm1)),maxi(abs(cc-cc2)),maxi(abs(mm-mm2))]
deff('[y]=ymacro(sec,ist)','y=cos(ist:(ist+sec-1))');
y=ymacro(100,1);
[cc1,mm1]=corr(x,y,2^3);
[cc,mm]=corr('fft',xmacro,ymacro,100,2^3);
[cc2,mm2]=corr('fft','corexx','corexy',100,2^3);
[maxi(abs(cc-cc1)),maxi(abs(mm-mm1)),maxi(abs(cc-cc2)),maxi(abs(mm-mm2))]
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/cspect.man
//====================================================
clear;lines(0);
rand('normal');rand('seed',0);
x=rand(1:1024-33+1);
//make low-pass filter with eqfir
nf=33;bedge=[0 .1;.125 .5];des=[1 0];wate=[1 1];
h=eqfir(nf,bedge,des,wate);
//filter white data to obtain colored data
h1=[h 0*ones(1:maxi(size(x))-1)];
x1=[x 0*ones(1:maxi(size(h))-1)];
hf=fft(h1,-1); xf=fft(x1,-1);yf=hf.*xf;y=real(fft(yf,1));
sm=cspect(100,200,'tr',y);
smsize=maxi(size(sm));fr=(1:smsize)/smsize;
plot(fr,log(sm))
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/czt.man
//====================================================
clear;lines(0);
a=.7*exp(%i*%pi/6);
[ffr,bds]=xgetech(); //preserve current context
rect=[-1.2,-1.2*sqrt(2),1.2,1.2*sqrt(2)];
t=2*%pi*(0:179)/179;xsetech([0,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect)
plot2d([0 real(a)]',[0 imag(a)]',[3],"000")
xsegs([-1.0,0;1.0,0],[0,-1.0;0,1.0])
w0=.93*exp(-%i*%pi/15);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000")
xsetech([0.5,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect)
plot2d([0 real(a)]',[0 imag(a)]',[-1],"000")
xsegs([-1.0,0;1.0,0],[0,-1.0;0,1.0])
w0=w0/(.93*.93);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000")
xsetech(ffr,bds); //restore context
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/dft.man
//====================================================
clear;lines(0);
n=8;omega = exp(-2*%pi*%i/n);
j=0:n-1;F=omega.^(j'*j); //Fourier matrix
x=1:8;x=x(:);
F*x
fft(x,-1)
dft(x,-1)
inv(F)*x
fft(x,1)
dft(x,1)
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/ell1mag.man
//====================================================
clear;lines(0);
deff('[alpha,beta]=alpha_beta(n,m,m1)',...
'if 2*int(n/2)=n then, beta=K1; else, beta=0;end;...
alpha=%k(1-m1)/%k(1-m);')
epsilon=0.1;A=10; //ripple parameters
m1=(epsilon*epsilon)/(A*A-1);n=5;omegac=6;
m=find_freq(epsilon,A,n);omegar = omegac/sqrt(m)
%k(1-m1)*%k(m)/(%k(m1)*%k(1-m))-n //Check...
[alpha,beta]=alpha_beta(n,m,m1)
alpha*%asn(1,m)-n*%k(m1) //Check
sample=0:0.01:20;
//Now we map the positive real axis into the contour...
z=alpha*%asn(sample/omegac,m)+beta*ones(sample);
plot(sample,ell1mag(epsilon,m1,z))
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/eqfir.man
//====================================================
clear;lines(0);
hn=eqfir(33,[0 .2;.25 .35;.4 .5],[0 1 0],[1 1 1]);
[hm,fr]=frmag(hn,256);
plot(fr,hm),
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/eqiir.man
//====================================================
clear;lines(0);
[cells,fact,zzeros,zpoles]=...
eqiir('lp','ellip',[2*%pi/10,4*%pi/10],0.02,0.001)
transfer=fact*poly(zzeros,'z')/poly(zpoles,'z')
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/faurre.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/ffilt.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/fft.man
//====================================================
clear;lines(0);
a=[1;2;3];n=size(a,'*');
norm(1/n*exp(2*%i*%pi*(0:n-1)'.*.(0:n-1)/n)*a -fft(a,1))
norm(exp(-2*%i*%pi*(0:n-1)'.*.(0:n-1)/n)*a -fft(a,-1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/filter.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/find_freq.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/findm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/frfit.man
//====================================================
clear;lines(0);
w=0.01:0.01:2;s=poly(0,'s');
G=syslin('c',2*(s^2+0.1*s+2), (s^2+s+1)*(s^2+0.3*s+1));
fresp=repfreq(G,w);
Gid=frfit(w,fresp,4);
frespfit=repfreq(Gid,w);
bode(w,[fresp;frespfit])
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/frmag.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/fsfirlin.man
//====================================================
clear;lines(0);
//
//Example of how to use the fsfirlin macro for the design
//of an FIR filter by a frequency sampling technique.
//
//Two filters are designed : the first (response hst1) with
//abrupt transitions from 0 to 1 between passbands and stop
//bands; the second (response hst2) with one sample in each
//transition band (amplitude 0.5) for smoothing.
//
hd=[zeros(1,15) ones(1,10) zeros(1,39)];//desired samples
hst1=fsfirlin(hd,1);//filter with no sample in the transition
hd(15)=.5;hd(26)=.5;//samples in the transition bands
hst2=fsfirlin(hd,1);//corresponding filter
pas=1/prod(size(hst1))*.5;
fg=0:pas:.5;//normalized frequencies grid
plot2d([1 1].*.fg(1:257)',[hst1' hst2']);
// 2nd example
hd=[0*ones(1,15) ones(1,10) 0*ones(1,39)];//desired samples
hst1=fsfirlin(hd,1);//filter with no sample in the transition
hd(15)=.5;hd(26)=.5;//samples in the transition bands
hst2=fsfirlin(hd,1);//corresponding filter
pas=1/prod(size(hst1))*.5;
fg=0:pas:.5;//normalized frequencies grid
n=prod(size(hst1))
plot(fg(1:n),hst1);
plot2d(fg(1:n)',hst2',[3],"000");
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/group.man
//====================================================
clear;lines(0);
z=poly(0,'z');
h=z/(z-.5);
[tg,fr]=group(100,h);
plot(fr,tg)
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/hank.man
//====================================================
clear;lines(0);
//Example of how to use the hank macro for
//building a Hankel matrix from multidimensional
//data (covariance or Markov parameters e.g.)
//
//This is used e.g. in the solution of normal equations
//by classical identification methods (Instrumental Variables e.g.)
//
//1)let's generate the multidimensional data under the form :
// C=[c_0 c_1 c_2 .... c_n]
//where each bloc c_k is a d-dimensional matrix (e.g. the k-th correlation
//of a d-dimensional stochastic process X(t) [c_k = E(X(t) X'(t+k)], '
//being the transposition in scilab)
//
//we take here d=2 and n=64
//
c=rand(2,2*64)
//
//generate the hankel matrix H (with 4 bloc-rows and 5 bloc-columns)
//from the data in c
//
H=hank(4,5,c);
//
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/hilb.man
//====================================================
clear;lines(0);
plot(hilb(51))
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/iir.man
//====================================================
clear;lines(0);
hz=iir(3,'bp','ellip',[.15 .25],[.08 .03]);
[hzm,fr]=frmag(hz,256);
plot2d(fr',hzm')
xtitle('Discrete IIR filter band pass 0.15<fr<0.25 ',' ',' ');
q=poly(0,'q'); //to express the result in terms of the ...
hzd=horner(hz,1/q) //delay operator q=z^-1
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/iirgroup.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/iirlp.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/intdec.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/jmat.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/kalm.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/lattn.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/lattp.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/lev.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/levin.man
//====================================================
clear;lines(0);
//We use the 'levin' macro for solving the normal equations
//on two examples: a one-dimensional and a two-dimensional process.
//We need the covariance sequence of the stochastic process.
//This example may usefully be compared with the results from
//the 'phc' macro (see the corresponding help and example in it)
//
//
//1) A one-dimensional process
// -------------------------
//
//We generate the process defined by two sinusoids (1Hz and 2 Hz)
//in additive Gaussian noise (this is the observed process);
//the simulated process is sampled at 10 Hz (step 0.1 in t, underafter).
//
t1=0:.1:100;rand('normal');
y1=sin(2*%pi*t1)+sin(2*%pi*2*t1);y1=y1+rand(y1);plot(t1,y1);
//
//covariance of y1
//
nlag=128;
c1=corr(y1,nlag);
c1=c1';//c1 needs to be given columnwise (see the section PARAMETERS of this help)
//
//compute the filter for a maximum order of n=10
//la is a list-type variable each element of which
//containing the filters of order ranging from 1 to n; (try varying n)
//in the d-dimensional case this is a matrix polynomial (square, d X d)
//sig gives, the same way, the mean-square error
//
n=15;
[la1,sig1]=levin(n,c1);
//
//verify that the roots of 'la' contain the
//frequency spectrum of the observed process y
//(remember that y is sampled -in our example
//at 10Hz (T=0.1s) so that we need to retrieve
//the original frequencies (1Hz and 2 Hz) through
//the log and correct scaling by the frequency sampling)
//we verify this for each filter order
//
for i=1:n, s1=roots(la1(i));s1=log(s1)/2/%pi/.1;
//
//now we get the estimated poles (sorted, positive ones only !)
//
s1=sort(imag(s1));s1=s1(1:i/2);end;
//
//the last two frequencies are the ones really present in the observed
//process ---> the others are "artifacts" coming from the used model size.
//This is related to the rather difficult problem of order estimation.
//
//2) A 2-dimensional process
// -----------------------
//(4 frequencies 1, 2, 3, and 4 Hz, sampled at 0.1 Hz :
// |y_1| y_1=sin(2*Pi*t)+sin(2*Pi*2*t)+Gaussian noise
// y=| | with :
// |y_2| y_2=sin(2*Pi*3*t)+sin(2*Pi*4*t)+Gaussian noise
//
//
d=2;dt=0.1;
nlag=64;
t2=0:2*%pi*dt:100;
y2=[sin(t2)+sin(2*t2)+rand(t2);sin(3*t2)+sin(4*t2)+rand(t2)];
c2=[];
for j=1:2, for k=1:2, c2=[c2;corr(y2(k,:),y2(j,:),nlag)];end;end;
c2=matrix(c2,2,128);cov=[];
for j=1:64,cov=[cov;c2(:,(j-1)*d+1:j*d)];end;//covar. columnwise
c2=cov;
//
//in the multidimensional case, we have to compute the
//roots of the determinant of the matrix polynomial
//(easy in the 2-dimensional case but tricky if d>=3 !).
//We just do that here for the maximum desired
//filter order (n); mp is the matrix polynomial of degree n
//
[la2,sig2]=levin(n,c2);
mp=la2(n);determinant=mp(1,1)*mp(2,2)-mp(1,2)*mp(2,1);
s2=roots(determinant);s2=log(s2)/2/%pi/0.1;//same trick as above for 1D process
s2=sort(imag(s2));s2=s2(1:d*n/2);//just the positive ones !
//
//There the order estimation problem is seen to be much more difficult !
//many artifacts ! The 4 frequencies are in the estimated spectrum
//but beneath many non relevant others.
//
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/lgfft.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/lindquist.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/mese.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/mfft.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/mrfit.man
//====================================================
clear;lines(0);
w=0.01:0.01:2;s=poly(0,'s');
G=syslin('c',2*(s^2+0.1*s+2),(s^2+s+1)*(s^2+0.3*s+1)); // syslin('c',Num,Den);
fresp=repfreq(G,w);
mag=abs(fresp);
Gid=mrfit(w,mag,4);
frespfit=repfreq(Gid,w);
plot2d([w',w'],[mag(:),abs(frespfit(:))])
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/phc.man
//====================================================
clear;lines(0);
//
//This example may usefully be compared with the results from
//the 'levin' macro (see the corresponding help and example)
//
//We consider the process defined by two sinusoids (1Hz and 2 Hz)
//in additive Gaussian noise (this is the observation);
//the simulated process is sampled at 10 Hz.
//
t=0:.1:100;rand('normal');
y=sin(2*%pi*t)+sin(2*%pi*2*t);y=y+rand(y);plot(t,y)
//
//covariance of y
//
nlag=128;
c=corr(y,nlag);
//
//hankel matrix from the covariance sequence
//(we can choose to take more information from covariance
//by taking greater n and m; try it to compare the results !
//
n=20;m=20;
h=hank(n,m,c);
//
//compute the Markov representation (mh,mf,mg)
//We just take here a state dimension equal to 4 :
//this is the rather difficult problem of estimating the order !
//Try varying ns !
//(the observation dimension is here equal to one)
ns=4;
[mh,mf,mg]=phc(h,1,ns);
//
//verify that the spectrum of mf contains the
//frequency spectrum of the observed process y
//(remember that y is sampled -in our example
//at 10Hz (T=0.1s) so that we need
//to retrieve the original frequencies through the log
//and correct scaling by the frequency sampling)
//
s=spec(mf);s=log(s);
s=s/2/%pi/.1;
//
//now we get the estimated spectrum
imag(s),
//
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/pspect.man
//====================================================
clear;lines(0);
rand('normal');rand('seed',0);
x=rand(1:1024-33+1);
//make low-pass filter with eqfir
nf=33;bedge=[0 .1;.125 .5];des=[1 0];wate=[1 1];
h=eqfir(nf,bedge,des,wate);
//filter white data to obtain colored data
h1=[h 0*ones(1:maxi(size(x))-1)];
x1=[x 0*ones(1:maxi(size(h))-1)];
hf=fft(h1,-1); xf=fft(x1,-1);yf=hf.*xf;y=real(fft(yf,1));
//plot magnitude of filter
//h2=[h 0*ones(1:968)];hf2=fft(h2,-1);hf2=real(hf2.*conj(hf2));
//hsize=maxi(size(hf2));fr=(1:hsize)/hsize;plot(fr,log(hf2));
//pspect example
sm=pspect(100,200,'tr',y);smsize=maxi(size(sm));fr=(1:smsize)/smsize;
plot(fr,log(sm));
rand('unif');
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/remez.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/remezb.man
//====================================================
clear;lines(0);
// Choose the number of cosine functions and create a dense grid
// in [0,.24) and [.26,.5)
nc=21;ngrid=nc*16;
fg=.24*(0:ngrid/2-1)/(ngrid/2-1);
fg(ngrid/2+1:ngrid)=fg(1:ngrid/2)+.26*ones(1:ngrid/2);
// Specify a low pass filter magnitude for the desired response
ds(1:ngrid/2)=ones(1:ngrid/2);
ds(ngrid/2+1:ngrid)=zeros(1:ngrid/2);
// Specify a uniform weighting function
wt=ones(fg);
// Run remezb
an=remezb(nc,fg,ds,wt)
// Make a linear phase FIR filter
hn(1:nc-1)=an(nc:-1:2)/2;
hn(nc)=an(1);
hn(nc+1:2*nc-1)=an(2:nc)/2;
// Plot the filter's magnitude response
plot(.5*(0:255)/256,frmag(hn,256));
//////////////
// Choose the number of cosine functions and create a dense grid in [0,.5)
nc=21; ngrid=nc*16;
fg=.5*(0:(ngrid-1))/ngrid;
// Specify a triangular shaped magnitude for the desired response
ds(1:ngrid/2)=(0:ngrid/2-1)/(ngrid/2-1);
ds(ngrid/2+1:ngrid)=ds(ngrid/2:-1:1);
// Specify a uniform weighting function
wt=ones(fg);
// Run remezb
an=remezb(nc,fg,ds,wt)
// Make a linear phase FIR filter
hn(1:nc-1)=an(nc:-1:2)/2;
hn(nc)=an(1);
hn(nc+1:2*nc-1)=an(2:nc)/2;
// Plot the filter's magnitude response
plot(.5*(0:255)/256,frmag(hn,256));
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/rpem.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/sinc.man
//====================================================
clear;lines(0);
plot(sinc(100,0.1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/sincd.man
//====================================================
clear;lines(0);
plot(sincd(10,1))
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/srfaur.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/srkf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/sskf.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/system.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/trans.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/wfir.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/wiener.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/wigner.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/window.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/yulewalk.man
//====================================================
clear;lines(0);
f=[0,0.4,0.4,0.6,0.6,1];H=[0,0,1,1,0,0];Hz=yulewalk(8,f,H);
fs=1000;fhz = f*fs/2;
xbasc(0);xset('window',0);plot2d(fhz',H');
xtitle('Desired Frequency Response (Magnitude)')
[frq,repf]=repfreq(Hz,0:0.001:0.5);
xbasc(1);xset('window',1);plot2d(fs*frq',abs(repf'));
xtitle('Obtained Frequency Response (Magnitude)')
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/zpbutt.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/zpch1.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/zpch2.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/signal/zpell.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/sound/analyze.man
//====================================================
clear;lines(0);
// At first we create 0.5 seconds of sound parameters.
t=soundsec(0.5);
// Then we generate the sound.
s=sin(440*t)+sin(220*t)/2+sin(880*t)/2;
[nr,nc]=size(t);
s(nc/2:nc)=sin(330*t(nc/2:nc));
analyze(s);
for k=winsid(),xdel(k);end
//====================================================
// ../man/sound/loadwave.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/sound/mapsound.man
//====================================================
clear;lines(0);
// At first we create 0.5 seconds of sound parameters.
t=soundsec(0.5);
// Then we generate the sound.
s=sin(440*t)+sin(220*t)/2+sin(880*t)/2;
[nr,nc]=size(t);
s(nc/2:nc)=sin(330*t(nc/2:nc));
mapsound(s);
for k=winsid(),xdel(k);end
//====================================================
// ../man/sound/savewave.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/artest.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/bifish.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/boucle.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/chaintest.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/fishing.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/fusee.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/lotest.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/mine.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/obscont1.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/portr3d.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/portrait.man
//====================================================
clear;lines(0);
a=rand(2,2)
deff('[ydot]=l_s(t,y)','ydot=a*y')
portrait(l_s)
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/recur.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/systems.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/tangent.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tdcs/tdinit.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/ascii.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/excel2sci.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/mfile2sci.man
//====================================================
clear;lines(0);
//create a simple m_file
write(TMPDIR+'rot90.m',['function B = rot90(A,k)'
'[m,n] = size(A);'
'if nargin == 1'
' k = 1;'
'else'
' k = rem(k,4);'
' if k < 0'
' k = k + 4;'
' end'
'end'
'if k == 1'
' A = A.'';'
' B = A(n:-1:1,:);'
'elseif k == 2'
' B = A(m:-1:1,n:-1:1);'
'elseif k == 3'
' B = A(m:-1:1,:);'
' B = B.'';'
'else'
' B = A;'
'end']);
// translate it dor scilab
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/mtlb_load.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/mtlb_save.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/pol2tex.man
//====================================================
clear;lines(0);
s=poly(0,'s');
p=s^3+2*s-5;
pol2tex(p)
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/sci2for.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/texprint.man
//====================================================
clear;lines(0);
s=poly(0,'s');
texprint([1/s,s^2])
for k=winsid(),xdel(k);end
//====================================================
// ../man/translation/translatepaths.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/ScilabEval.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/TK_EvalFile.man
//====================================================
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/TK_EvalStr.man
//====================================================
clear;lines(0);
TK_EvalStr('toplevel .foo');
// creates a toplevel TK window.
TK_EvalStr('label .foo.l -text ""TK married Scilab !!!""');
// create a static label
TK_EvalStr('pack .foo.l');
// pack the label widget. It appears on the screen.
text='button .foo.b -text close -command {destroy .foo}';
TK_EvalStr(text);
TK_EvalStr('pack .foo.b');
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/TK_GetVar.man
//====================================================
clear;lines(0);
TK_EvalStr('toplevel .foo');
// creates a toplevel TK window.
TK_EvalStr('entry .foo.e -textvariable tvar');
// create an editable entry
TK_EvalStr('set tvar foobar');
// set the entry value
TK_EvalStr('pack .foo.e');
// pack the entry widget. It appears on the screen.
text=TK_GetVar('tvar')
// retrieve the variable value
// change the entry text and repeat the last command ...
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/TK_SetVar.man
//====================================================
clear;lines(0);
// creates a toplevel TK window. TK_EvalStr('label .foo.l -textvariable tvar');
// create a static label
TK_EvalStr('pack .foo.l');
// pack the label widget. It appears on the screen.
TK_SetVar('tvar','This text has been set directly within scilab');
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/close.man
//====================================================
clear;lines(0);
h=figure();
// creates figure number 1.
uicontrol( h, 'style','text', ...
'string','scilab is great', ...
'position',[50 70 100 100], ...
'fontsize',15);
// put a clever text in figure 1
figure();
// create figure 2
uicontrol( 'style','text', ...
'string','Really great', 'position',[50 70 100 100], 'fontsize',15);
// put a text in figure 2
close();
// close the current graphic window (ie fig. 2)
close(h);
// close figure 1
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/figure.man
//====================================================
clear;lines(0);
h=figure(3);
// creates figure number 1.
uicontrol( h, 'style','text', ...
'string','This is a figure', ...
'position',[50 70 100 100], ...
'fontsize',15);
// put a text in figure 3
figure();
// create figure 1
uicontrol( 'style','text', ...
'string','Another figure', ...
'position',[50 70 100 100], ...
'fontsize',15);
// put a text in figure 1
close();
// close the current graphic window (ie fig. 1)
close(h);
// close figure 3
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/findobj.man
//====================================================
clear;lines(0);
h=figure();
// creates figure number 1.
uicontrol( h, 'style','text', ...
'string','This is a figure', ...
'position',[50 70 100 100], ...
'fontsize',15, ...
'tag','Alabel');
// put a text in figure 1
lab=findobj('tag','Alabel');
// find the object which 'tag' value is 'Alabel'
disp('the handle of the label is '+string(lab));
close();
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/gcf.man
//====================================================
clear;lines(0);
figure(5);
figure();
figure();
gcf()
// returns 2
close(gcf());
// close figure 2
gcf()
// returns 1
close(1);
gcf()
// returns 5
close(5);
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/get.man
//====================================================
clear;lines(0);
h=uicontrol('string', 'Button');
// Opens a window with a button.
p=get(h,'position');
// get the geometric qspect of the button
disp('Button width: ' + string(p(3)));
// print the width of the button
close();
// close figure
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/set.man
//====================================================
clear;lines(0);
h=uicontrol('string', 'Button');
// Opens a window with a button.
set(h,'position',[ 50 50 100 100]);
// set the geometric aspect of the button
close();
// close figure
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/uicontrol.man
//====================================================
clear;lines(0);
f=figure();
// create a figure
h=uicontrol(f,'style','listbox', ...
'position', [10 10 150 160]);
// create a listbox
set(h, 'string', "item 1|item 2|item3");
// fill the list
set(h, 'value', [1 3]);
// select item 1 and 3 in the list
close();
// close the figure
f=figure();
// create a figure
h=uicontrol(f,'style','listbox', ...
'position', [10 10 150 160]);
// create a listbox
set(h, 'string', "item 1|item 2|item3");
// fill the list
set(h, 'value', [1 3]);
// select (highlight) the item 1 and 3 in the list
close();
//close the figure
for k=winsid(),xdel(k);end
//====================================================
// ../man/tksci/uimenu.man
//====================================================
clear;lines(0);
f=figure('position', [10 10 300 200]);
// create a figure
m=uimenu(f,'label', 'windows');
// create an item on the menu bar
m1=uimenu(m,'label', 'operations');
m2=uimenu(m,'label', 'quit scilab', 'callback', "exit");
//create two items in the menu "windows"
m11=uimenu(m1,'label', 'new window', 'callback',"xselect()");
m12=uimenu(m1,'label', 'clear window', 'callback',"xbasc()");
// create a submenu to the item "operations"
close(f);
// close the figure
for k=winsid(),xdel(k);end
|
885e09523547007fc2e1d3d7096edbb520425b09 | 449d555969bfd7befe906877abab098c6e63a0e8 | /479/CH3/EX3.9/Example_3_9.sce | 009a49e57c2d5620e601cd742bc1f66605b53265 | [] | 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 | 767 | sce | Example_3_9.sce | //Chemical Engineering Thermodynamics
//Chapter 3
//First Law of Thermodynamics
//Example 3.9
clear;
clc;
//To calculate the mass of steam required
//Given
m2 = 100;//mass of water to be heated
//From diagram,
//m3 = m1+m2;..(a)
//Hs = H1;..(b) since throttling is a constant enthalpy process
//m3*H3-(m1*H1+m2*H2)=0;..(c) since delH=0
//From steam tables,
Hs = 681.7//enthalpy of steam at 200 deg cel bleeded at the rate of 5Kgf/(cm^2) in Kcal/Kg
H2 = 5.03;//enthalpy of liquid water at 5 deg cel
H3 = 64.98;//enthalpy of liquid water at 65 deg cel
//from equn (a),(b)&(c);(page no 80)
m1 = ((H3-H2)/(Hs-H3))*m2;//mass of steam required in Kg (page no 80)
mprintf('The mass of steam required to heat 100 Kg of water is %f Kg',m1);
//end |
e7cc6e0ceb316940b5e64e75f786389cdd1cb0b6 | 1b969fbb81566edd3ef2887c98b61d98b380afd4 | /Rez/bivariate-lcmsr-post_mi/bfas_oi_bfa_mt_d/~BivLCM-SR-bfas_oi_bfa_mt_d-PLin-VLin.tst | 886e6bff8142d7c68f01e9577fb422e98d25f3b1 | [] | no_license | psdlab/life-in-time-values-and-personality | 35fbf5bbe4edd54b429a934caf289fbb0edfefee | 7f6f8e9a6c24f29faa02ee9baffbe8ae556e227e | refs/heads/master | 2020-03-24T22:08:27.964205 | 2019-03-04T17:03:26 | 2019-03-04T17:03:26 | 143,070,821 | 1 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 11,974 | tst | ~BivLCM-SR-bfas_oi_bfa_mt_d-PLin-VLin.tst |
THE OPTIMIZATION ALGORITHM HAS CHANGED TO THE EM ALGORITHM.
ESTIMATED COVARIANCE MATRIX FOR PARAMETER ESTIMATES
1 2 3 4 5
________ ________ ________ ________ ________
1 0.265391D+00
2 -0.164422D-02 0.213810D-02
3 -0.718585D-01 0.989034D-03 0.438802D+00
4 0.136690D-04 -0.486565D-03 -0.575194D-02 0.378751D-02
5 -0.119096D-02 -0.106610D-04 -0.122024D-02 0.158110D-03 0.376653D-02
6 0.712471D-03 -0.593536D-04 0.581430D-03 -0.162252D-03 0.353729D-03
7 0.342612D-03 -0.938724D-04 0.354137D-02 -0.357488D-03 0.498383D-03
8 -0.194962D-02 -0.781706D-04 0.475843D-03 0.440594D-04 0.279374D-03
9 -0.436217D+00 0.252947D-01 0.576473D-01 0.278798D-01 0.408832D-01
10 -0.371030D+00 -0.230661D-02 0.951870D-01 0.156675D-01 0.174138D+00
11 0.120653D-01 -0.405420D-02 -0.107847D-01 -0.130899D-01 -0.117777D+00
12 -0.472342D+00 0.343454D-01 0.763186D+00 0.298307D-01 -0.175127D-02
13 0.885836D-01 -0.170512D-01 0.219110D+00 -0.185497D-01 0.287350D-01
14 -0.304524D+00 -0.689290D-02 0.240824D+00 0.234190D-02 0.715463D-01
15 -0.228541D+01 -0.267781D-01 0.431990D+00 -0.136025D-01 -0.890459D-01
16 -0.200903D-01 -0.761477D-02 -0.568801D-02 0.844959D-03 0.863641D-04
17 0.543898D-02 0.668479D-04 0.359220D-04 0.219720D-04 -0.370214D-03
18 0.224938D+00 0.282062D-02 -0.179263D+00 -0.132899D-01 0.147649D-01
19 -0.621213D-01 0.107571D-01 0.480712D-01 0.836336D-02 0.202544D-01
20 0.606242D+00 0.626172D-02 0.151935D+01 0.135345D-01 -0.277678D-01
21 0.577406D-01 -0.705256D-02 -0.894347D-01 -0.427162D-02 -0.244107D-01
22 0.577561D-03 0.255157D-04 0.422063D-02 0.126999D-03 0.325360D-03
23 0.325642D-03 0.110604D-02 -0.166713D-01 0.116899D-01 -0.315734D-02
24 -0.391171D-03 -0.111767D-03 0.309996D-02 -0.397827D-03 0.312594D-03
ESTIMATED COVARIANCE MATRIX FOR PARAMETER ESTIMATES
6 7 8 9 10
________ ________ ________ ________ ________
6 0.683201D-03
7 0.116708D-02 0.587879D-02
8 0.161586D-03 0.834884D-03 0.323049D-02
9 -0.906357D-02 -0.523259D-01 0.625231D-02 0.336844D+02
10 0.254798D-03 0.138645D-01 0.190431D-01 0.182674D+01 0.169251D+02
11 0.381828D-02 0.134884D-01 -0.220727D-01 -0.114080D+02 -0.557707D+01
12 -0.732833D-01 -0.135542D+00 0.579281D-01 0.515829D+01 0.431764D+01
13 0.741345D-01 0.211540D+00 0.401252D-01 -0.697236D-01 -0.556220D+00
14 0.574339D-01 0.214207D+00 0.423841D+00 0.372019D+01 0.651524D+01
15 0.133778D-02 0.527335D-01 0.766945D-01 0.251501D+01 -0.370096D+01
16 0.608921D-03 0.431220D-03 0.837685D-03 0.519181D+00 -0.152759D-01
17 -0.464141D-04 -0.136547D-03 -0.222393D-03 -0.113397D+00 -0.364254D-01
18 -0.508210D-01 -0.279516D+00 -0.771634D-01 0.130512D+02 0.481351D-01
19 -0.107662D-01 -0.133304D-01 0.250382D-03 0.413497D+01 0.898387D+00
20 -0.518239D-01 -0.163849D+00 -0.381804D+00 0.398236D+01 0.110982D+01
21 0.105506D-01 0.120987D-01 -0.395575D-02 -0.421942D+01 -0.109737D+01
22 -0.545476D-04 0.472953D-03 0.617336D-03 -0.559641D-01 0.235135D-01
23 -0.257902D-02 -0.733139D-02 -0.173181D-02 0.262085D+00 -0.566263D-01
24 0.409601D-03 0.120242D-02 0.530285D-03 -0.366952D-01 0.237639D-02
ESTIMATED COVARIANCE MATRIX FOR PARAMETER ESTIMATES
11 12 13 14 15
________ ________ ________ ________ ________
11 0.380234D+02
12 -0.170748D+02 0.171367D+03
13 -0.298578D+01 -0.991272D+01 0.186738D+02
14 -0.815201D+01 0.522174D+01 0.108809D+02 0.118607D+03
15 0.820660D+01 0.463015D+01 -0.402938D+00 0.107579D+02 0.179397D+03
16 -0.903210D-01 -0.366087D+00 0.218085D+00 0.295251D+00 0.156478D+01
17 -0.112836D-01 -0.121852D-01 0.964928D-02 -0.416463D-01 -0.858711D+00
18 -0.983733D+01 0.336828D+01 -0.903916D+01 -0.525176D+01 -0.387074D+02
19 -0.204641D+01 0.242159D+01 -0.169776D+01 0.146968D+01 0.942785D+00
20 0.484619D+01 -0.236383D+02 -0.370958D+01 -0.796799D+02 -0.106616D+01
21 0.241706D+01 -0.371808D+01 0.170683D+01 -0.172945D+01 -0.890343D+00
22 -0.178260D-01 0.137151D+00 -0.121446D-01 0.682616D-01 0.793986D-01
23 -0.924799D-01 0.143679D+01 -0.463243D+00 -0.471899D+00 -0.858023D+00
24 0.565654D-02 -0.163986D+00 0.514042D-01 0.452452D-01 0.429019D-01
ESTIMATED COVARIANCE MATRIX FOR PARAMETER ESTIMATES
16 17 18 19 20
________ ________ ________ ________ ________
16 0.361169D+00
17 -0.213833D-01 0.112707D-01
18 0.326180D+00 0.284780D-01 0.191373D+03
19 -0.201934D+00 -0.239058D-02 0.404968D+01 0.627015D+01
20 -0.478336D+00 0.109782D-01 -0.493430D+02 -0.126741D+01 0.552843D+03
21 -0.171839D-01 0.160010D-01 -0.198421D+01 -0.587002D+01 0.105447D+01
22 0.479330D-02 -0.118623D-02 -0.836084D+00 -0.145283D-01 0.157734D+00
23 0.308875D-01 -0.369324D-02 0.751038D-01 0.577525D-02 0.565341D+01
24 -0.520530D-02 0.184115D-03 0.157130D+00 0.559821D-02 -0.248644D+01
ESTIMATED COVARIANCE MATRIX FOR PARAMETER ESTIMATES
21 22 23 24
________ ________ ________ ________
21 0.682378D+01
22 -0.446332D-01 0.962941D-02
23 -0.337572D+00 0.120874D-01 0.902491D+00
24 0.166020D-01 -0.338989D-02 -0.816383D-01 0.268793D-01
ESTIMATED CORRELATION MATRIX FOR PARAMETER ESTIMATES
1 2 3 4 5
________ ________ ________ ________ ________
1 1.000
2 -0.069 1.000
3 -0.211 0.032 1.000
4 0.000 -0.171 -0.141 1.000
5 -0.038 -0.004 -0.030 0.042 1.000
6 0.053 -0.049 0.034 -0.101 0.221
7 0.009 -0.026 0.070 -0.076 0.106
8 -0.067 -0.030 0.013 0.013 0.080
9 -0.146 0.094 0.015 0.078 0.115
10 -0.175 -0.012 0.035 0.062 0.690
11 0.004 -0.014 -0.003 -0.034 -0.311
12 -0.070 0.057 0.088 0.037 -0.002
13 0.040 -0.085 0.077 -0.070 0.108
14 -0.054 -0.014 0.033 0.003 0.107
15 -0.331 -0.043 0.049 -0.017 -0.108
16 -0.065 -0.274 -0.014 0.023 0.002
17 0.099 0.014 0.001 0.003 -0.057
18 0.032 0.004 -0.020 -0.016 0.017
19 -0.048 0.093 0.029 0.054 0.132
20 0.050 0.006 0.098 0.009 -0.019
21 0.043 -0.058 -0.052 -0.027 -0.152
22 0.011 0.006 0.065 0.021 0.054
23 0.001 0.025 -0.026 0.200 -0.054
24 -0.005 -0.015 0.029 -0.039 0.031
ESTIMATED CORRELATION MATRIX FOR PARAMETER ESTIMATES
6 7 8 9 10
________ ________ ________ ________ ________
6 1.000
7 0.582 1.000
8 0.109 0.192 1.000
9 -0.060 -0.118 0.019 1.000
10 0.002 0.044 0.081 0.077 1.000
11 0.024 0.029 -0.063 -0.319 -0.220
12 -0.214 -0.135 0.078 0.068 0.080
13 0.656 0.638 0.163 -0.003 -0.031
14 0.202 0.257 0.685 0.059 0.145
15 0.004 0.051 0.101 0.032 -0.067
16 0.039 0.009 0.025 0.149 -0.006
17 -0.017 -0.017 -0.037 -0.184 -0.083
18 -0.141 -0.264 -0.098 0.163 0.001
19 -0.164 -0.069 0.002 0.285 0.087
20 -0.084 -0.091 -0.286 0.029 0.011
21 0.155 0.060 -0.027 -0.278 -0.102
22 -0.021 0.063 0.111 -0.098 0.058
23 -0.104 -0.101 -0.032 0.048 -0.014
24 0.096 0.096 0.057 -0.039 0.004
ESTIMATED CORRELATION MATRIX FOR PARAMETER ESTIMATES
11 12 13 14 15
________ ________ ________ ________ ________
11 1.000
12 -0.212 1.000
13 -0.112 -0.175 1.000
14 -0.121 0.037 0.231 1.000
15 0.099 0.026 -0.007 0.074 1.000
16 -0.024 -0.047 0.084 0.045 0.194
17 -0.017 -0.009 0.021 -0.036 -0.604
18 -0.115 0.019 -0.151 -0.035 -0.209
19 -0.133 0.074 -0.157 0.054 0.028
20 0.033 -0.077 -0.037 -0.311 -0.003
21 0.150 -0.109 0.151 -0.061 -0.025
22 -0.029 0.107 -0.029 0.064 0.060
23 -0.016 0.116 -0.113 -0.046 -0.067
24 0.006 -0.076 0.073 0.025 0.020
ESTIMATED CORRELATION MATRIX FOR PARAMETER ESTIMATES
16 17 18 19 20
________ ________ ________ ________ ________
16 1.000
17 -0.335 1.000
18 0.039 0.019 1.000
19 -0.134 -0.009 0.117 1.000
20 -0.034 0.004 -0.152 -0.022 1.000
21 -0.011 0.058 -0.055 -0.897 0.017
22 0.081 -0.114 -0.616 -0.059 0.068
23 0.054 -0.037 0.006 0.002 0.253
24 -0.053 0.011 0.069 0.014 -0.645
ESTIMATED CORRELATION MATRIX FOR PARAMETER ESTIMATES
21 22 23 24
________ ________ ________ ________
21 1.000
22 -0.174 1.000
23 -0.136 0.130 1.000
24 0.039 -0.211 -0.524 1.000
|
cffb153059dd262a592fa8264304bf6ca41614d7 | 08e6015408a35a317d4d0b609af8ccae9b88a3bf | /src/03/a/Register.tst | 1d7b7143cfb16c67a0b79e3944bc0ae665c1482c | [
"MIT"
] | permissive | lekhacman/nand2teris | 38c7aa44b2329ccf102333af5dc1dd542869144b | 520ca48a492b6ac8966330ddaf5174c19e5a8f7f | refs/heads/master | 2023-01-06T18:36:35.660251 | 2020-12-27T09:08:39 | 2020-12-27T09:08:39 | 209,975,266 | 1 | 0 | MIT | 2022-12-10T03:13:50 | 2019-09-21T11:41:33 | Scilab | UTF-8 | Scilab | false | false | 4,403 | tst | Register.tst | // This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/03/a/Register.tst
load Register.hdl,
output-file Register.out,
compare-to Register.cmp,
output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 out%D1.6.1;
set in 0,
set load 0,
tick,
output;
tock,
output;
set in 0,
set load 1,
tick,
output;
tock,
output;
set in -32123,
set load 0,
tick,
output;
tock,
output;
set in 11111,
set load 0,
tick,
output;
tock,
output;
set in -32123,
set load 1,
tick,
output;
tock,
output;
set in -32123,
set load 1,
tick,
output;
tock,
output;
set in -32123,
set load 0,
tick,
output;
tock,
output;
set in 12345,
set load 1,
tick,
output;
tock,
output;
set in 0,
set load 0,
tick,
output;
tock,
output;
set in 0,
set load 1,
tick,
output;
tock,
output;
set in %B0000000000000001,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000000000010,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000000000100,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000000001000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000000010000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000000100000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000001000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000010000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000000100000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000001000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000010000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0000100000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0001000000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0010000000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0100000000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1000000000000000,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111111111110,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111111111101,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111111111011,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111111110111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111111101111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111111011111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111110111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111101111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111111011111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111110111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111101111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1111011111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1110111111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1101111111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B1011111111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
set in %B0111111111111111,
set load 0,
tick,
output;
tock,
output;
set load 1,
tick,
output;
tock,
output;
|
b89d4fe8b5e63ba5d612e334f41a03db0bb9d17b | 449d555969bfd7befe906877abab098c6e63a0e8 | /2705/CH11/EX11.1/Ex11_1.sce | 973fd235ef095a11b73f38b41042a447588e1b2b | [] | 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,269 | sce | Ex11_1.sce | clear;
clc;
disp('Example 11.1')
// aim : To determine the
// (a) bore of the cylinder
// (b) piston stroke
// (c) speed of the engine
// Given values
P_req = 60;// power required to develop, [kW]
P = 1.25;// boiler pressure, [MN/m^2]
Pb = .13;// back pressure, [MN/m^2]
cut_off = .3;// [stroke]
k = .82;// diagram factor
n = .78;// mechanical efficiency
LN = 3;// mean piston speed, [m/s]
// solution
// (a)
r = 1/cut_off;// expansion ratio
Pm = P/r*(1+log(r))-Pb;// mean effective pressure, [MN/m^2]
P_ind = P_req/n;// Actual indicated power developed, [kW]
P_the = P_ind/k;// Theoretical indicated power developed, [kW]
// using indicated_power=Pm*LN*A
// Hence
A = P_the/(Pm*LN)*10^-3;// piston area,[m^2]
d = sqrt(4*A/%pi)*10^3;// bore ,[mm]
mprintf('\n (a) The bore of the cylinder is = %f mm\n',d);
// (b)
// given that stroke is 1.25 times bore
L = 1.25*d;// [mm]
mprintf('\n (b) The piston stroke is = %f mm\n',L);
// (c)
// LN=mean piston speed, where L is stroke in meter and N is 2*rev/s,(since engine is double_acting)
// hence
rev_per_sec = LN/(2*L*10^-3);// [rev/s]
rev_per_min = rev_per_sec*60;// [rev/min]
mprintf('\n (c) The speed of the engine is = %f rev/min\n',rev_per_min);
// End
|
e1965d135ce0b1d8476ebc053a4ed6a303eeb8d9 | 126e42e47d2a7c93a771a9dc0b035c46fbe68dcb | /gui.sce | 5db50a64cbef1ef62dbfb26e2380abe0d8f95ab7 | [
"MIT"
] | permissive | bk211/Scilab-projet | 9ec9e228a7d16d58ed98660d2048afce1dc0ca59 | 1dfffd97ebdf6eeca14989f82c79ff87c00cedbd | refs/heads/master | 2021-05-21T14:06:12.147465 | 2020-04-08T11:53:50 | 2020-04-08T11:53:50 | 252,675,308 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 10,885 | sce | gui.sce | // This GUI file is generated by guibuilder version 4.2.1
//////////
f=figure('figure_position',[451,378],'figure_size',[756,480],'auto_resize','on','background',[33],'figure_name','Figure n°%d','dockable','off','infobar_visible','off','toolbar_visible','off','menubar_visible','off','default_axes','on','visible','off');
//////////
handles.dummy = 0;
handles.Pbutton_Image_Load=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.8877273,0.1360256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','Load image','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_Image_Load','Callback','ImageLoad_callback(handles)')
handles.PButton_Save_Button=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.7429798,0.1360256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','Image save','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','PButton_Save_Button','Callback','SaveButton_callback(handles)')
handles.windows= newaxes();handles.windows.margins = [ 0 0 0 0];handles.windows.axes_bounds = [0.0176282,0.0318182,0.6050641,0.9204545];
handles.Pbutton_apply_contour=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.6706061,0.1060256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','contour','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_apply_contour','Callback','Pbutton_apply_contour_callback(handles)')
handles.edit=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6346154,0.0759091,0.1828205,0.0631818],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','edit','Callback','')
handles.Pbutton_bruiter=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.5982323,0.0960256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','bruiter','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_bruiter','Callback','Pbutton_bruiter_callback(handles)')
handles.Pbutton_reset=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.8153536,0.0860256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','Reset','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_reset','Callback','Pbutton_reset_callback(handles)')
handles.Pbutton_bruite_imp=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.5258586,0.1860256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','bruiter impulsionnel','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_bruite_imp','Callback','Pbutton_bruite_imp_callback(handles)')
handles.Pbutton_im_moyenne=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.4534848,0.1560256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','filtre moyenne','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_im_moyenne','Callback','Pbutton_im_moyenne_callback(handles)')
handles.Pbutton_im_median=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.3811111,0.1360256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','filtre median','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_im_median','Callback','Pbutton_im_median_callback(handles)')
handles.Pbutton_extension_lineaire=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.3087373,0.1760256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','extension lineaire','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_extension_lineaire','Callback','Pbutton_extension_lineaire_callback(handles)')
handles.Pbutton_seuillage=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6340541,0.2363636,0.1060256,0.0622727],'Relief','default','SliderStep',[0.01,0.1],'String','seuillage','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_seuillage','Callback','Pbutton_seuillage_callback(handles)')
handles.Pbutton_changement_echelle=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.7898179,0.894797,0.2024934,0.0463636],'Relief','default','SliderStep',[0.01,0.1],'String','changement echelle ','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_changement_echelle','Callback','Pbutton_changement_echelle_callback(handles)')
handles.Pbutton_histogramme=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.7945946,0.8204545,0.1837838,0.0454545],'Relief','default','SliderStep',[0.01,0.1],'String','histogramme','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','Pbutton_histogramme','Callback','Pbutton_histogramme_callback(handles)')
f.visible = "on";
//////////
// Callbacks are defined as below. Please do not delete the comments as it will be used in coming version
//////////
exec("traitement.sce");
function ImageLoad_callback(handles)
//Write your callback for ImageLoad here
fn = uigetfile('*');
S = imread(fn);
imshow(S);
//Save image to pass to another function
handles.S = S;
handles.fn = fn;
handles = resume(handles);
endfunction
function Pbutton_reset_callback(handles)
//Write your callback for Pbutton_reset here
S = imread(handles.fn);
imshow(S);
//Save image to pass to another function
handles.S = S;
handles = resume(handles);
endfunction
function SaveButton_callback(handles)
//Write your callback for SaveButton here
fn = uiputfile('*');
imwrite(handles.S, fn);
endfunction
function Pbutton_apply_contour_callback(handles)
//Write your callback for Pbutton_apply_traitement here
val = 0.5;
S = im_contour(double(handles.S), val)/255;
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_bruiter_callback(handles)
//Write your callback for Pbutton_bruiter here
val = strtod(handles.edit.string);
S = bruite(double(handles.S), val)/255;
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_bruite_imp_callback(handles)
//Write your callback for Pbutton_bruite_imp here
val = strtod(handles.edit.string);
S = bruite_imp(double(handles.S), val)/255;
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_im_moyenne_callback(handles)
//Write your callback for Pbutton_im_moyenne here
f = strtod(handles.edit.string);
S = im_moyenne(double(handles.S), f);
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_im_median_callback(handles)
//Write your callback for Pbutton_im_median here
f = strtod(handles.edit.string);
S = im_median(double(handles.S), f);
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_extension_lineaire_callback(handles)
//Write your callback for Pbutton_extension_lineaire here
S = extension_lineaire(double(handles.S))/255;
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_seuillage_callback(handles)
//Write your callback for Pbutton_seuillage here
seuil = strtod(handles.edit.string);
S = seuillage(double(handles.S), seuil)/255;
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_changement_echelle_callback(handles)
//Write your callback for Pbutton_changement_echelle here
seuil = strtod(handles.edit.string);
S = changement_echelle(double(handles.S), seuil, seuil)/255;
imshow(S);
handles.S = S;
handles = resume(handles);
endfunction
function Pbutton_histogramme_callback(handles)
//Write your callback for Pbutton_histogramme here
P = histogramme(double(handles.S));
clf();
if(size(P,3)) == 3 then
plot(P(:,:,1),'ro-');
plot(P(:,:,2),'cya+');
plot(P(:,:,3),'--mo');
else
plot(P);
end
endfunction
|
0fdaf8facf18262c56a523842371903934fe14d2 | 449d555969bfd7befe906877abab098c6e63a0e8 | /869/CH7/EX7.3/7_3.sce | b3cb04975b7f403fd764875d29e981251fc3b1ef | [] | 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 | 267 | sce | 7_3.sce | clc
//initialisation of variables
L= 5 //in
B= 12 //in
Ix= 227 //in^4
Iy= 10 //in^4
A= 10.2 //sq in
//CALCULATIONS
Kx= sqrt(Ix/A)
Ky= sqrt(Iy/A)
//RESULTS
printf ('Radius of gyration wrt x= %.2f in',Kx)
printf (' \n Radius of gyration wrt y=%.2f in',Ky)
|
18c42dfdc86196f71482ff2590e5d2f1f88bd5a1 | 95fa7c277bdd4fbcc0c5d9ef86fc4f36fe494b57 | /singu.sci | d83de2d1442427848a7fdde6c5e0061114718369 | [] | no_license | GitSRealpe/Proyecto-RM | 7e2952fb3772a1592d8afa84dc53080462159e59 | 18bc8445c6370fcf2bb3ea7f60a606fdd08e154a | refs/heads/master | 2021-01-20T13:27:13.221561 | 2017-05-16T23:57:44 | 2017-05-16T23:57:44 | 90,495,663 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 6,379 | sci | singu.sci | clear
close();
//funciones de singularidad
function c=singu0(x,a)
c=x>=a;
endfunction
function c=singu1(x,a)
c=(x-a).*(x>=a);
endfunction
function c=singu2(x,a)
c=((x-a).^2).*(x>=a);
endfunction
function c=singu3(x,a)
c=((x-a).^3).*(x>=a);
endfunction
function c=singu4(x,a)
c=((x-a).^4).*(x>=a);
endfunction
//funciones de singularidad
function dibujar()
subplot(2,2,1)
plot2d(x,Vx);
a=gca(); // Handle on axes entity
a.x_location = "origin";
a.y_location = "origin";
e = gce();
e.children.thickness = 3;
xtitle("Fuerza cortante");
xlabel("x (m)")
ylabel("V(x) (N)")
t=a.title;
t.foreground=9;
t.font_size=4;
t.font_style=6;
t=a.y_label;
t.font_size=3;
//momento flector
subplot(2,2,3)
plot(x,Mx);
a=gca(); // Handle on axes entity
a.x_location = "origin";
a.y_location = "origin";
e = gce();
e.children.thickness = 3;
p=e.children(1);
[m,k]=max(abs(Mx))
//t=datatipCreate(p,k);
xtitle("Momento flector");
xlabel("x (m)");
ylabel("M(x) (N*m)")
t=a.title;
t.foreground=9;
t.font_size=4;
t.font_style=6;
t=a.y_label;
t.font_size=3;
//angulo deflexion
subplot(2,2,2);
plot(x,theta);
a=gca(); // Handle on axes entity
a.x_location = "origin";
a.y_location = "origin";
e = gce();
e.children.thickness = 3;
xtitle("Angulo de pendiente");
xlabel("x (m)");
ylabel("Theta(x) (grados)")
subplot(2,2,4);
t=a.title;
t.foreground=9;
t.font_size=4;
t.font_style=6;
t=a.y_label;
t.font_size=3;
//deflexion
plot(x,y*1000);
a=gca(); // Handle on axes entity
a.x_location = "origin";
a.y_location = "origin";
e = gce();
e.children.thickness = 3;
xtitle("Deflexion");
xlabel("x (m)");
ylabel("y(x) (mm)")
t=a.title;
t.foreground=9;
t.font_size=4;
t.font_style=6;
t=a.y_label;
t.font_size=3;
endfunction
//PARAMETROS DE ENTRADA
L=10; //metros
F=(91/3)*10^3; //Newtons
W=24375; //Newtons por metro
M=2.75; //metros
S=3.8; //metros
//Parametros de sección especificos
// tf=19.3*10^(-3);
// bf=261*10^(-3);
d=420*10^(-3);
// tw=11.6*10^(-3);
// I=2*((1/12*bf*tf^3)+bf*tf*(d/2-tf/2)^2)+(1/12*tw*(d-2*tf)^3)
//Parametros de sección especificos
I=462*10^-6; //metros^4
E=200*10^9; //Pascales
K1=1*10^6; //Newtons/metro %inf para valor infinito
K2=1*10^6; //Newtons/metro %inf para valor infinito
sadm=250*10^6; //Pascales
thetadm=3; //grados
yadm=10*10^(-3); //milimetros
//PARAMETROS DE ENTRADA
x=0:0.001:L;
if K1==0 then
C1=1;
else
C1=K1;
end
if K2==0 then
C2=1;
else
C2=K2;
end
A=[1,0,1,1;
0,1,L,S;
(S^3)/6,-(S^2)/2,0,((E*I)/C1);
(L^3)/6,-(L^2)/2,((E*I)/C2),((L-S)^3)/6];
b=[-F-W*(L-S);
F*(-1-M)-W*(L-S)*(((L-S)/2)+S);
F*(((S-M)^2/2)-(S-M)^3/6);
F*(((L-M)^2/2)-(L-M)^3/6)-W*(L-S)^4/24];
if K1==0 then
A(3,:)=0
A(:,4)=0
b(3)=0
end
if K2==0 then
A(4,:)=0
A(:,3)=0
b(4)=0
end
[x0,nsA]=linsolve(A,b);
Fa=x0(1,1);
Fc=x0(4,1);
Fd=x0(3,1);
Mr=x0(2,1);
Vx=Fa*singu0(x,0)-F*singu0(x,M)+Fc*singu0(x,S)-W*singu1(x,S)+W*singu1(x,L)+Fd*singu0(x,L);
Mx=Fa*singu1(x,0)-F*singu1(x,M)+Fc*singu1(x,S)-(W/2)*singu2(x,S)+(W/2)*singu2(x,L)+Fd*singu1(x,L)-Mr*singu0(x,0)+F*singu0(x,M);
function theta=angulo(x)
theta=(((Fa/2)*singu2(x,0)-(F/2)*singu2(x,M)+(Fc/2)*singu2(x,S)-(W/6)*singu3(x,S)+(W/6)*singu3(x,L)+(Fd/2)*singu2(x,L)-Mr*singu1(x,0)+F*singu1(x,M))/(E*I))*180/%pi;
endfunction
theta=angulo(x);
function y=deflex(x)
y=((Fa/6)*singu3(x,0)-(F/6)*singu3(x,M)+(Fc/6)*singu3(x,S)-(W/24)*singu4(x,S)+(W/24)*singu4(x,L)+(Fd/6)*singu3(x,L)-(Mr/2)*singu2(x,0)+(F/2)*singu2(x,M))/(E*I);
endfunction
y=deflex(x);
resp=zeros(2,3);
resp(1,1)=angulo(M); resp(1,2)=angulo(S); resp(1,3)=angulo(L);
resp(2,1)=deflex(M); resp(2,2)=deflex(S); resp(2,3)=deflex(L);
mprintf('\n Para las variables de entrada el analisis resultante es el siguiente:')
mprintf('\n')
mprintf('\n Las reacciones en los apoyos son: \n Fa=%1.3f kN \n Fc=%1.3f kN \n Fd=%1.3f kN \n Mr=%1.3f kN*m',Fa/1000,Fc/1000,Fd/1000,Mr/1000)
sigmax=(max(abs(Mx))*d/2)/I;
Fs=sadm/sigmax;
if sigmax>sadm then
mprintf('\n')
mprintf('\n -_-_-_-_-_-¡ALERTA!-_-_-_-_-_-')
mprintf('\n Se ha sobrepasado el esfuerzo normal admisible en la viga')
mprintf('\n Esfuerzo admisible [Õ]=%1.3f MPa',sadm/1000000)
mprintf('\n Esfuerzo maximo en la viga Õ=%1.3f MPa',sigmax/1000000)
end
[thetamax,k]=max(abs(theta));
if thetamax>thetadm then
mprintf('\n')
mprintf('\n -_-_-_-_-_-¡ALERTA!-_-_-_-_-_-')
mprintf('\n Se ha sobrepasado el angulo de deflexión admisible en la viga')
mprintf('\n Angulo admisible [Theta]=%f Grados',thetadm)
mprintf('\n Angulo maximo de la viga Theta=%f grados que se da en x=%1.2f metros',thetamax,(k-1)*0.001)
end
[ymax,k]=max(abs(y));
if ymax>yadm then
mprintf('\n')
mprintf('\n -_-_-_-_-_-¡ALERTA!-_-_-_-_-_-')
mprintf('\n Se ha sobrepasado la deflexión admisible en la viga')
mprintf('\n Deflexión admisible [y]=%1.3f mm',yadm*1000)
mprintf('\n La deflexion maxima de la viga es y=%f mm y se da en x=%1.2f metros',ymax*1000,(k-1)*0.001)
end
mprintf('\n')
mprintf('\n Angulo de pendiente en el punto B=%1.2f metros es Theta=%f grados',M,(resp(1,1)))
mprintf('\n Angulo de pendiente en el punto C=%1.2f metros es Theta=%f grados',S,resp(1,2))
mprintf('\n Angulo de pendiente en el punto D=%1.2f metros es Theta=%f grados',L,resp(1,3))
mprintf('\n')
mprintf('\n Deflexión en el punto B=%1.2f metros es y=%1.3f mm',M,(resp(2,1)*1000))
mprintf('\n Deflexión en el punto C=%1.2f metros es y=%1.3f mm',S,(resp(2,2)*1000))
mprintf('\n Deflexión en el punto D=%1.2f metros es y=%1.3f mm',L,(resp(2,3)*1000))
[Mmax,k]=max(abs(Mx));
mprintf('\n')
mprintf('\n Con un momento máximo de M=%1.3f kN*m, presente en x=%1.3f m, \n y con la caracteristicas de la seccion de la viga se presenta un esfuerzo \n normal maximo de Õ=%1.3f MPa en ese punto',Mmax/1000,(k-1)*0.001,sigmax/1000000 )
mprintf('\n De esta manera la viga presenta un factor de seguridad Fs=%1.3f',Fs)
dibujar;
|
242cf53f5d707b0116d0bf55b30270db23c55a77 | 449d555969bfd7befe906877abab098c6e63a0e8 | /293/CH20/EX20.2/eg20_2.sce | 396cacaf6a8e78c32e5718bca095e5e8cab60268 | [] | 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 | 924 | sce | eg20_2.sce | //a
Vt = 230; //(in volts)
Ia = 73; //armature current (in amps)
If = 1.6; //feild current (in amps)
Ra = 0.188; //armature circuit resistance(in ohms)
n = 1150; //rated speed of the rotor(in rpm)
Po = 20*746; //output power (in watts)
Ea = Vt - (Ia*Ra); //armature voltage
wm = 2*%pi*n/60; //rated speed of the rotor (in rad/sec)
T = Ea*Ia/wm ; //electromagnetic torque
disp("a")
disp(T,"electromagnetic torque = ")
//b
a = 4; //no. of parallel armature paths
p = 4; //no. of poles
z = 882; //no. of armature conductors
flux = Ea*60*a/(p*z*n); //flux per pole (in Wb)
disp("b")
disp(flux,"flux per pole = ")
//c
Prot = (Ea*Ia) - Po; //rotational loss (in watt)
disp("c")
disp(Prot,"rotational losses = ")
//d
losses = Prot + (Ia^2 * Ra) + (Vt * If) ;
Pi = (Ea*Ia) + (Ia^2 * Ra) + (Vt * If); //input power
efficiency = 1 - (losses/Pi);
disp("d")
disp(efficiency,"efficiency = ") |
5de49e36b24c22cd62ec7b8db0684f19912bc8aa | 449d555969bfd7befe906877abab098c6e63a0e8 | /2339/CH6/EX6.13.1/Ex6_13.sce | bd69f831866e071484944bcd3a66f99d1d9dbaea | [] | 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 | 926 | sce | Ex6_13.sce | clc
clear
D=0.1; //Diameter
L=0.12; //Length
V=(22/7)*(1/4)*D*D*L;
T1=19+273;
r=6.5; //Compression ratio
P1=1; //in bar
G=1.4; //Gamma
Vs=9.425*(10^-4);
Vc=Vs/(r-1);
V1=Vc+Vs;
printf('V1= %3.5f m^3',V1);
printf('\n');
V2=Vc;
V3=Vc;
P2=P1*(r^G);
printf('P2= %3.1f bar',P2);
printf('\n');
T2=T1*(r^(G-1));
printf('T2= %3.1f K',T2);
printf('\n');
//For process 2-3
Qs=1900;
Cv=0.718;
T3=(Qs/Cv)+T2;
printf('T3= %3.1f K',T3);
printf('\n');
P3=P2*(T3/T2);
printf('P3= %3.1f bar',P3);
printf('\n');
//For process 4-1
V4=V1;
P4=P3*((V3/V4)^G);
printf('P4= %3.1f bar',P4);
printf('\n');
T4=T1*(P4/P1);
printf('T4= %3.1f K',T4);
printf('\n');
Eff=100*(1-(1/(r^(G-1))));
printf('Efficiency= %3.1f Percent',Eff);
printf('\n');
R=0.287;
m=(P1*100*V1)/(R*T1);
Pm=(Eff*Qs*m)/(10000*Vs);
printf('Mean Effective Pressure= %3.1f bar',Pm);
printf('\n');
|
82982e996d0ae20ad5139486da951ddd818d6318 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1862/CH8/EX8.6/C8P6.sce | 481c234d22cfc6f356ace9062caa9bc0a7617565 | [] | 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 | 602 | sce | C8P6.sce | clear
clc
//to find tangential speed of point on the equator of pulsar
// GIVEN:
//rotational period of pulsar
T = 0.033//in seconds
//radius of pulsar
r = 15//in km
// SOLUTION:
//using kinematic equation of motion for rotational motion
//angular speed
w = (2*3.14)/T//in rad/s
//tangential speed of point on the equator of pulsar
vT = w*r//in km/s
printf ("\n\n Angular speed w = \n\n %3i rad/s",w);
//answer of vT is slightly varying.But answer of scilab program and calculator is same
printf ("\n\n Tangential speed of point on the equator of pulsar vT = \n\n %4i km/s",vT);
|
779de261e4b2942b5928ca7639ea4e7a858d24de | 449d555969bfd7befe906877abab098c6e63a0e8 | /821/CH5/EX5.10/5_10.sce | b0e2ae9789efff64fb4aaa5a74d1f36e3499211b | [] | 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 | 315 | sce | 5_10.sce | dHfH2O=-68.32;//dHf value of H2O in kcal per mol//
dHfCO2=-94.05;//dHf value of CO2 in kcal per mol//
dH298=-208.34;//enthalphy change at 298K in Kcal//
dHfCH3COOH=(2*dHfH2O+2*dHfCO2-dH298);//dHf value of CH3COOH in Kcal per mol//
printf('Standard enthalpy of formation of CH3COOH=%fKcal per mol',dHfCH3COOH);
|
2dc73b3addbf84110de35bfb144f16f926cc3dd6 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2417/CH11/EX11.9/Ex11_9.sce | 1889703c650154159e663aa35066e73a822da525 | [] | 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 | 647 | sce | Ex11_9.sce | //scilab 5.4.1
clear;
clc;
printf("\t\t\tProblem Number 11.9\n\n\n");
// Chapter 11 : Heat Transfer
// Problem 11.9 (page no. 565)
// Solution
//A bare steel pipe
ro=3.50; //Outside diameter //Unit:in.
ri=3.00; //inside diameter //Unit:in.
Ti=240; //Inside temperature //unit:fahrenheit
To=120; //Outside temperature //unit:fahrenheit
L=5; //Length //Unit:ft
deltaT=Ti-To; //Change in temperature //unit:fahrenheit
k=26 //Unit:Btu/(hr*ft*F) //k=proportionality constant //k=thermal conductivity
Q=(2*%pi*k*L*deltaT)/log(ro/ri); //The heat loss from the pipe //unit:Btu/hr
printf("The heat loss from the pipe is %f Btu/hr",Q);
|
826b27b1a77a6ef0b58009f6dc904afdaa8f3415 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3204/CH5/EX5.2/Ex5_2.sce | 921cdc9d85fb7aaa605b26c347905f6043340a50 | [] | 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 | 449 | sce | Ex5_2.sce | //Inilization of variables
W=2000 //N
Lab=2 //m //length of the member from the vertical to the 1st load of 2000 N
Lac=5 //m //length of the member from the vertical to the 2nd load of 2000 N
Lpq=3.5 //m
//Calculations
Rq=((W*Lab)+(W*Lac))/Lpq //N //take moment abt. pt P
Xp=Rq //N //sum Fx=0
Yp=2*W //N //sum Fy=0
Rp=sqrt(Xp^2+Yp^2) //N
//Resuts
clc
printf('The reaction at P is %f N \n',Rp)
printf('The reaction at Q is %f N \n',Rq)
|
18d292f3c531636c1c85a466833de9fa5e88b67b | 449d555969bfd7befe906877abab098c6e63a0e8 | /1208/CH4/EX4.11/Exa11.sce | ceb9ce1b6140bf6ce5a4c861b95f7f890f011b2b | [] | 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,643 | sce | Exa11.sce | //Exa 11
clc;
clear;
close;
//given data :
//initial cash outflows
ICO=10000;//in Rs.
//cash in flows of 1st,2nd and 3rd years
CIF1=5000;//in Rs.
CIF2=4000;//in Rs.
CIF3=3000;//in Rs.
//average annual CIF
CIF=(CIF1+CIF2+CIF3)/3;//in Rs
//step 1 : calculate first trial rate
PV=ICO/CIF;//unitless
disp(PV,"Trial PV factor is : ")
disp("The rate of return at this PV is approximately 10%")
//P.V factor at 10% rate of discount
PV1=0.909;
PV2=0.826;
PV3=0.751;
//Present value for all cash in flows
P1=CIF1*PV1;// in Rs
P2=CIF2*PV2;// in Rs
P3=CIF3*PV3;// in Rs
//Total Present Value
P=P1+P2+P3;// in Rs
disp(P,"total present value of cash inflows at 10% rate is : ")
disp("As the total present value of cash inflows at 10% rate is 10102 RS. is more than the cost of investment.")
disp("The next trial rate can be taken as 12%.")
//P.V factor at 12% rate of discount
PV1=0.893;
PV2=0.797;
PV3=0.712;
//Present value for all cash in flows
P1=CIF1*PV1;// in Rs
P2=CIF2*PV2;// in Rs
P3=CIF3*PV3;// in Rs
//Total Present Value
P=P1+P2+P3;// in Rs
disp(P,"total present value of cash inflows at 12% rate is : ")
disp("As the total present value of cash inflows at 12% rate is 9789 RS. is less than the cost of investment.")
//IRR will be calculated by interpolation of these two rates
LDR=10;//in % ;Lower discount rate
HDR=12;//in % ;Higher discount rate
P1=10102;//in Rs; Present value at lower rate of interest
P2=9789;//in Rs; Present value at higher rate of interest
IRR=LDR+((P1-ICO)/(P1-P2))*(HDR-LDR);//in % : Internal rate of return
disp(IRR,"Internal rate of return of the project(in %) : ")
|
0ccd92c8699309d9b539477717d36c23e45caf85 | 7b040f1a7bbc570e36aab9b2ccf77a9e59d3e5c2 | /Scilab/virtual/2dof_controller/dc/mpc/scilab/gpc_ex12.sce | ccd031535999e3f051d94c072a4cc150eb55d8f2 | [] | no_license | advait23/sbhs-manual | e2c380051117e3a36398bb5ad046781f7b379cb9 | d65043acd98334c44a0f0dbf480473c4c4451834 | refs/heads/master | 2021-01-16T19:50:40.218314 | 2012-11-16T04:11:12 | 2012-11-16T04:11:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 316 | sce | gpc_ex12.sce | // Updated(19-7-07)
// 12.3
// Camacho and Bordon's GPC example; Control law
A=[1 -0.8]; dA=1; B=[0.4 0.6]; dB=1; N=3; k=1; rho=0.8;
getf gpc_bas.sci;
[K,KH1,KH2,Tc,dTc,Sc,dSc,R1,dR1] = ...
gpc_bas(A,dA,B,dB,N,k,rho)
// C=1; dC=0; [K,KH1,KH2,Tc,dTc,Sc,dSc,R1,dR1] = ...
// gpc_col(A,dA,B,dB,C,dC,N,k,rho)
|
b47b2145f395de5df81e4130fa166678ded0ca26 | 449d555969bfd7befe906877abab098c6e63a0e8 | /443/CH17/EX17.21/17_21.sce | 6143ce9ca94b602a53c8651d1737b8b4d84a0c34 | [] | 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 | 17_21.sce | pathname=get_absolute_file_path('17_21.sce')
filename=pathname+filesep()+'17_21_data.sci'
exec(filename)
//Net indicated mean effective pressure(in bar)
imepn=wlep-plep
//Dead cycles per minute
Dc=(N/2)-Wc
//Frictional power(in kW)
fp=((imepn*10^5*0.25*%pi*D^2*L*Wc)-(pfm*10^5*0.25*%pi*D^2*L*Dc))/60000
//Indicated power(in kW)
ip=(imepn*10^5*0.25*%pi*D^2*L*0.5*N)/60000
//Brake power(in kW)
bp=ip-fp
//Mechanical efficiency
nm=bp/ip*100
printf("\n\nRESULTS\n\n")
printf("\nBrake power:%f\n",bp)
printf("\nMechanical efficiency:%f\n",nm) |
cfa603d336fb7d83145fcbcebcd4a514a7730e95 | 449d555969bfd7befe906877abab098c6e63a0e8 | /52/CH1/EX1.2/Example1_2.sce | 73f5a4492181830f28320da17be3dc2ec50914d8 | [] | 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 | 434 | sce | Example1_2.sce | //Example 1.2
//Sketch the continuous time signal x=sin(7*t)+sin(10*t) and also its discrete time equivalent signal with a sampling period T = 0.2sec
clear;
clc ;
close ;
t=0:0.01:2;
x1=sin(7*t)+sin(10*t);
subplot(1,2,1);
plot(t,x1);
xlabel('t');
ylabel('x(t)');
title('CONTINUOUS TIME PLOT');
n=0:0.2:2;
x2=sin(7*n)+sin(10*n);
subplot(1,2,2);
plot2d3(n,x2);
xlabel('n');
ylabel('x(n)');
title('DISCRETE TIME PLOT'); |
b19eaf3b34dab7bcf9c641cfa44b21faecf26c89 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1586/CH4/EX4.8/EXP4_8.sce | 3eeac93e6b002c609f9f82bc0950938a0cd22b57 | [] | 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 | 959 | sce | EXP4_8.sce | clc;funcprot(0);//EXAMPLE 4.8
// Initialisation of Variables
U=[0 0 1];.......//Tensile stree direction in [001] plane
V1=[0 -1 1];......//Tensile stree direction of slip direction in [0-11] plane
V2=[1 1 1];......//Tensile stree direction of slip plane normal to[011] plane
rho1=3000;.......//Tensile stress of crystal in psi
lam=acos((U*V1')/(norm(U)*norm(V1)));.......//The angle between the tensile stress direction [001] and the slip direction [0-11] from the dot product
phy=acos((U*V2')/(norm(U)*norm(V2)));......//The angle between the tensile stress direction [001] and normal to the slip plane [111]
rho=rho1*(cos(lam)*cos(phy));....//The resolved Shear stess in psi
disp(lam*(180/%pi),"The angle between the tensile stress direction [001] and the slip direction [0-11]:")
disp(phy*(180/%pi),"The angle between the tensile stress direction [001] and normal to the slip plane [111]:")
disp(rho,"The resolved Shear stess in psi:")
|
918f557f6e9ddea2a2c8dd14f01500baa063079a | 449d555969bfd7befe906877abab098c6e63a0e8 | /287/CH14/EX14.2/Exa14_2.sci | 50ac4ff92e5b1cf01539b3021331bc27295d9a8c | [] | 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 | 450 | sci | Exa14_2.sci | //Determine the following parameters.
t = 120;
d = 24;
BH = 5;
BW = 5000;
RFw = 200;
S = 60000;
A = 500;
E = t/(d*BH*60);
Nrf = BW/RFw;
Srf = Nrf/(4*3);
TCH = Srf*8;
Tbts = 9.82*3; //Using Erlang B table
Sbts = (Tbts*1000)/TCH;
BTSn = S/Sbts;
R = sqrt(A/(BTSn*Srf));
disp(E, 'Erlangs per subscriber')
disp(TCH, 'Traffic Channels per sector')
disp(BTSn, 'No. of BTS in a zone')
disp(R, 'Avg. Hexagonal cell radius (in Km)')
|
c05a3072daf50c2cc9e4f21f1fd908d8addefa22 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3840/CH8/EX8.10/Ex8_10.sce | 9a2fdd5088e3487a748b8642c3c5c6aca90d34d6 | [] | 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 | 588 | sce | Ex8_10.sce | clear
//
//
//
//Variable declaration
e=1.6*10**-19 //charge(c)
ni=1.5*10**16 //particle density(per m**3)
mew_e=0.14 //electron mobility(m**2/Vs)
mew_h=0.05 //hole mobility(m**2/Vs)
D=2.33*10**3 //density(kg/m**3)
A=28.09 //atomic weight(kg)
NA=6.025*10**26 //avagadro number
//Calculation
N=NA*D/A //number of atoms
n=N/10**8 //electron concentration(per m**3)
p=ni**2/n //hole concentration(per m**3)
sigma=e*((n*mew_e)+(p*mew_h)) //conductivity(per ohm m)
//Result
printf("\n conductivity is %0.1f per ohm m",sigma)
|
6bbf6ec997cfb49bf092eddc12b08b9b2dab7afe | 449d555969bfd7befe906877abab098c6e63a0e8 | /1919/CH6/EX6.15/Ex6_15.sce | 1a21e191f67cac539f1f41ad4c81062643a66cd9 | [] | 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,203 | sce | Ex6_15.sce |
// Theory and Problems of Thermodynamics
// Chapter 6
// Thermodynamic Potentials and Availability
// Example 15
clear ;clc;
//Given data
P1 = 3 // pressure of superheated steam in MPa
T1 = 573.15 // temperature of superheated steam in K
P2 = 0.2 // pressure of dry saturated steam in MPa
P0 = 0.1 // ambient pressure in MPa
T0 = 300 // ambient temperature in K
// Data from Steam Tables
h1 = 2993.5 // in kJ/kg
v1 = 0.08114 // in m^3/kg
s1 = 6.539 // in kJ/kg K
h2 = 2706.7 // in kJ/kg
v2 = 0.8857 // in m^3/kg
s2 = 7.1271 // in kJ/kg K
P1 = P1*1e3 // Units conversion from MPa to kPa
P2 = P2*1e3 // Units conversion from MPa to kPa
P0 = P0*1e3 // Units conversion from MPa to kPa
// Calculations for maximum useful work
// phi_12 = phi_1 - phi_2
// phi_12 = (u1+P0*v1-T0*s1)-(u2+P0*v2-T0*s2)
// phi_12 = (h1-P1*v1+P0*v1-T0*s1)-(h2-P2*v2+P0*v2-T0*s2)
phi_12 = (h1-h2) - v1*(P1-P0) + v2*(P2-P0) - T0*(s1-s2)
// Output Results
mprintf('Maximum useful work = %4.2f kJ' ,phi_12);
|
456159e5bd347ad9f0621d443f6f15b171a0d4e4 | a62e0da056102916ac0fe63d8475e3c4114f86b1 | /set8/s_Elements_Of_Physical_Chemistry_P._Atkins_1448.zip/Elements_Of_Physical_Chemistry_P._Atkins_1448/CH3/EX3.4.e/E3_4.sce | 1860c8875717e042fac2066bac3980ed78e4afeb | [] | 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 | 231 | sce | E3_4.sce | errcatch(-1,"stop");mode(2);
//Initialization of variables
Hf=-124 //kJ
Hoxi=-2220 //kJ
Hwater=286 //kJ
//Calculations
H=Hf+Hoxi+Hwater
//results
printf('Standard enthalpy of combustion of propene = %d kJ/mol',H)
exit();
|
f011321277ca60293fb2c7aeb6a9b7bad63f42dd | 449d555969bfd7befe906877abab098c6e63a0e8 | /2175/CH16/EX16.12/16_12.sce | 2fb55524ffc2dbcb52d8eace5bc0b2eb8d0adff4 | [] | 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 | 234 | sce | 16_12.sce | clc;
delta_p=0.0002;//bar
d=25;
rho=7600;//assumed to run program
c=1.13;
C=24;
tou=delta_p*10^5*d/(4*10^3);
f=tou/(rho*C^2/2);
alpha=0.125*rho*c*C/(rho*C^2);
disp("heat transfer coefficient is:");;
disp("kW/m^2 K",alpha);
|
0b197593985171365a08aeefdb79f1638feefb3b | 4bbc2bd7e905b75d38d36d8eefdf3e34ba805727 | /ee/contrib/dspic/macros/misc/onetime_switch.sci | f7bcdd1159f9037908ee4e8036aa6566f9cdea3c | [] | no_license | mannychang/erika2_Scicos-FLEX | 397be88001bdef59c0515652a365dbd645d60240 | 12bb5aa162fa6b6fd6601e0dacc972d7b5f508ba | refs/heads/master | 2021-02-08T17:01:20.857172 | 2012-07-10T12:18:28 | 2012-07-10T12:18:28 | 244,174,890 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 1,563 | sci | onetime_switch.sci | function [x,y,typ] = onetime_switch(job,arg1,arg2)
x=[];y=[];typ=[];
select job
case 'plot' then
exprs=arg1.graphics.exprs;
cmpr=exprs(1)
delay=exprs(3)
standard_draw(arg1)
case 'getinputs' then
[x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
[x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
[x,y]=standard_origin(arg1)
case 'set' then
x=arg1
model=arg1.model;graphics=arg1.graphics;
exprs=graphics.exprs;
while %t do
[ok,cmpr,lim,delay,exprs]=..
getvalue('Edit block parameters',..
['0 (greater) or 1 (less)';
'Switch value';
'Delay time:'],..
list('vec',-1,'vec',-1,'vec',-1),exprs)
if ~ok then break,end
in=[1;1;1]
out=1
flg=0;
[model,graphics,ok]=check_io(model,graphics,in,out,1,[])
if ok then
graphics.exprs=exprs;
model.rpar=[lim;delay];
model.ipar=[cmpr;flg];
model.dstate=[];
x.graphics=graphics;x.model=model
break
end
end
case 'define' then
cmpr=0
lim=0.5
delay=1
flg=0;
model=scicos_model()
model.sim=list('rt_switch',4)
model.in=[1;1;1]
model.out=1
model.evtin=1
model.rpar=[lim;delay]
model.ipar=[cmpr;flg]
model.dstate=[];
model.blocktype='d'
model.dep_ut=[%t %f]
exprs=[sci2exp(cmpr),sci2exp(lim),sci2exp(delay)]
gr_i=['xstringb(orig(1),orig(2),[''Switch'' ; string(cmpr) ; string(delay)],sz(1),sz(2),''fill'');']
x=standard_define([3 2],model,exprs,gr_i)
end
endfunction
|
9900cb52f11c8c36e0fbc38b9153d058e727fff8 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1850/CH3/EX3.16/Exa3_16.sce | 54600aced3fae0aceda35c93023e673d7bc3012e | [] | 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 | 353 | sce | Exa3_16.sce | // Exa 3.16
clear;
clc;
close;
//Part (a) is a derivation not a numerical problem
//Part (b) is a plot, and can be plotteed with any assumed value of R
R=5;//in ohm(assumed)
V=0:12;//in volt
I=-V/R//in Ampere
disp("V-I characteristics is shown in figure.")
plot(V,I);
title("V-I characteristics");
xlabel("V(volt)");
ylabel("I(Ampere)");
|
6a12cb8b2d89265989860db40f8f970f2036a112 | b829a470efb851fdd8700559c2092711adaa42e0 | /Data/OVI-CV-03-Facenet/CV-Groups/cv-group-114528472704/OVI-Test/cv-group-114528472704-run-00.tst | a82668734e5365211820681f2e001160d418f600 | [] | no_license | achbogga/FaceRecognition | 6f9d50bd1f32f2eb7f23c7ae56f9e7b225d32325 | 165ebc7658228d2cceaee4619e129e248665c49a | refs/heads/master | 2021-07-04T21:47:57.252016 | 2017-08-01T18:53:12 | 2017-08-01T18:53:12 | 96,568,452 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 512 | tst | cv-group-114528472704-run-00.tst | Huiping\Huiping_014.jpg
Huiping\Huiping_008.jpg
Don\Don_003.jpg
Don\Don_004.jpg
Shirley\Shirley_001.jpg
Shirley\Shirley_002.jpg
Ahmad\Ahmad_008.jpg
Ahmad\Ahmad_006.jpg
Sima\Sima_006.jpg
Sima\Sima_005.jpg
SungChun\SungChun_013.jpg
SungChun\SungChun_008.jpg
Kiran\Kiran_010.jpg
Kiran\Kiran_008.jpg
Allison\Allison_007.jpg
Allison\Allison_004.jpg
Amit\Amit_007.jpg
Amit\Amit_011.jpg
Gang\Gang_011.jpg
Gang\Gang_010.jpg
Ethan\Ethan_009.jpg
Ethan\Ethan_012.jpg
Rob\Rob_007.jpg
Rob\Rob_012.jpg
|
7b535d6c5390d5dee6a2961e421bd3908870a3b3 | b73e9d989ebb6c74535238e10eede063a5d7e66b | /EccenToMeanAnomaly.sci | 122b5bc8a889b8df7888bc49d71b8743e0c5ed0c | [] | no_license | ParthaSurve/CODES_SEM_VI | 930a520ccdbc7cb389dac6b6f03900674b5e1a6b | 1f6afa9b92ad8263d0773ce0f90f9ffa5943b8e4 | refs/heads/master | 2021-01-21T05:13:44.089655 | 2017-02-25T17:46:44 | 2017-02-25T17:46:44 | 83,149,933 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 3,270 | sci | EccenToMeanAnomaly.sci | //
// SPACE FLIGHT MECHANICS
// Assignment 1
//==================================================================//
// Created : 4-02-2017
//
// Ref: Notes
// Author: Partha Surve (SC14B036, Aerospace Engineering 3rd Year, IIST)
// parthasurve1@gmail.com
//
clc
clear
clf
//-------------------------------------------------//
// Constants //
H_p = 500 //Perigee Altitude
H_a = 25000 //Apogee Altitude
R_e = 6378 //Radius of earth
R_p = H_p + R_e // Perigee radius
R_a = H_a + R_e //Apogee Radius
a = (R_p + R_a)/2 //Semi-Major Axis
G_earth = 398600 //gravitational constant of Earth (mu)
e=(R_a-R_p)/(R_a+R_p)//eccentricity of the orbit
pi = 3.14
p=2*pi*(a^1.5)/(G_earth^0.5);//time period
n=(G_earth/(a^3))^0.5;
tolerance = 1.e-2
//--------------------------------------------------//
//Mean Anomaly Vs Time
t= 1:1:p
M=n.*t
//Evaluating Eccentric anomaly based on Mean Anomaly using Newton Rhapson
Residue = 1
for t = 1:1:p
E(t)=M(t)
while abs(Residue) > tolerance
E(t) = E(t)- (E(t) - e.*sin(E(t)) - M(t))/(1 - e.*cos(E(t)))
Residue = E(t)-e.*sin(E(t))-M(t)
end
Residue=1
//Evaluating True Anomaly from Eccentric Anomaly
v(t)=atan(((1-e*e)^.5)*sin(E(t))/(1-e*cos(E(t))),(cos(E(t))-e)/(1-e*cos(E(t))));
if(v(t)<=0)
v(t)=v(t)+2*pi;
end
end
//plotting the anomalies vs time
t= 1:1:p
figure(1)
plot(t,M,'b')
plot(t,E,'r')
plot(t,v,'g')
xlabel('Time ', "fontsize", 5)
ylabel('Anomaly(Degs)', "fontsize", 5)
title('True anomaly, Eccentric anomaly, Mean anomaly over one revolution', "fontsize", 3)
hl=legend(['Mean Anomaly';'Eccentric Anomaly';'True Anomaly'],2);
//--------------------------------------------------//
//plotting radial distance
r=zeros(360,1) //radial distance
for V = 1:1:360 // V is true anomaly
r(V)=(a*(1-e^2)./(1+e.*cos(V*pi/180))); //Evaluating Radial Distance
end
V= 0:0.01:2*%pi;
figure(2)
polarplot(V,(a*(1-e^2)./(1+e.*cos(V)))); // Orbit of the Space craft
title('Polar plot of the Orbit ', "fontsize", 5)
//PLotting the Variation of radial distance with the true anomaly
V = 1:1:360
figure(3)
plot(V,r,'r')
xlabel('True Anomaly(degree)', "fontsize", 5)
ylabel('Radial Distance(km)', "fontsize", 5)
title('Radial distance evolution over one revolution', "fontsize", 5)
//--------------------------------------------------------------//
// tangential Velocity
V_t = zeros(360,1)
for V = 1:1:360 // V is true anomaly
V_t(V) = sqrt(G_earth*(2*(1+e.*cos(V*pi/180))./(a*(1-e*e)) - 1/a))
end
V = 1:1:360
figure(4)
plot(V,V_t,'r')
xlabel('True Anomaly(degree)', "fontsize", 5)
ylabel('Tangential Velocity(km/s)', "fontsize", 5)
title('Tangential Velocity evolution over one revolution', "fontsize", 5)
//--------------------------------------------------------------//
//Flight Angle
E = zeros(360,1)
flight_angle = zeros(360,1)
for V = 1:1:360
A = sin(V*pi/180).*sqrt(1 - e^2)./(1 + e * cos(V*pi/180));
B = (e + cos(V*pi/180))./(1 + e .* cos(V*pi/180));
E(V) = atan(A/B);
flight_angle(V) = atan((e.*sin(V*pi/180))/(1+e.*cos(V*pi/180)))
end
V = 1:1:360
figure(5)
plot(V,flight_angle,'r')
xlabel('True Anomaly(degree)', "fontsize", 5)
ylabel('Flight angle', "fontsize", 5)
title('', "fontsize", 5)
//==========================================================//
|
9c59298e9f08cb38c2dbe3dc7806092dc29ee08b | 449d555969bfd7befe906877abab098c6e63a0e8 | /401/CH2/EX2.10/Example2_10.sce | d8e0bad40716454f9355f8fd6d5b8e45fd5228e6 | [] | 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 | 478 | sce | Example2_10.sce | //Example 2.10
//Program to estimate the fiber core diameter for a single mode
//step index fiber
clear;
clc ;
close ;
//Given data
V=2.2; //NORMALIZED FREQUENCY
MFD=11.6*10^(-6); //metre - MODE FIELD DIAMETER
W0=5.8*10^(-6);
// The fiber core radius
a=W0/(0.65+1.619*V^(-1.5)+2.879*V^(-6));
//Displaying the Result in Command Window
printf("\n\n\t The fiber core diameter for a single mode step index fiber is %0.1f um.",2*a*10^6); |
8347f6e9d700b8cc067a702e96970620c4a41942 | 449d555969bfd7befe906877abab098c6e63a0e8 | /226/CH10/EX10.6/example6_sce.sce | 202cd24cf7ab9ff132a4c81e3565119807898cce | [] | 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 | example6_sce.sce | //chapter 10
//example 10.6
//page 393
printf("\n")
printf("given")
Vdd=25;R2=1*10^6;R1=3.8*10^6;Rs=2.5*10^3;Rd=2.5*10^3;
Vg=(Vdd*R2)/(R1+R2)
disp("when Id=0")
Id=0;
Vgs=Vg-Id*Rs
disp(" plot point A at Id=0 and Vgs=5.2")
Vgs=0;
Id=Vg/Rs
disp(" plot point B at Id=2.08mA and Vgs=0")
disp(" where the base line intersect the transfer characteristics ")
Idmax=3*10^-3;Idmin=2.3*10^-3;
Vdsmin=Vdd-Idmax*(Rd+Rs)
Vdsmax=Vdd-Idmin*(Rd+Rs) |
b4403a97e1c49b7c04dd6080106a178bca61782c | 449d555969bfd7befe906877abab098c6e63a0e8 | /551/CH4/EX4.60/60.sce | 4301463181ac184b3ccaa0b85bcda63b6038a2ed | [] | 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 | 244 | sce | 60.sce | clc
p1=10; //bar
t1=200; //0C
C1=60; //m/s^2
c2=650; //m/s
p2=1.5; //bar
h1=2827.9; //kJ/kg
h_f2=467.1; //kJ/kg
h2=2618.45; //kJ/kg
h_g2=2693.4; //kJ/kg
x2=(h2-h_f2)/(h_g2-h_f2);
disp("quality of steam leaving the nozzle=")
disp(x2) |
a63b5e4c627a12ccce6c524f6132f0f4a5cdbe11 | 449d555969bfd7befe906877abab098c6e63a0e8 | /1760/CH2/EX2.82/EX2_82.sce | da8c9ce5d93d884503a44b5ffd22ec3625066933 | [] | 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 | 581 | sce | EX2_82.sce | //EXAMPLE 2-82 PG NO-117
Z1=4+%i*314.16; //Impedance
I1=1/Z1; //CURRENT
disp('i) Current (I1) is = '+string (I1) +' A ');
I2=I1+%i*90; //CURRENT
disp('ii) Current (I2) is = '+string (I2) +' A ');
Z2=1/I2; //IMPEDANCE
disp('i) Impedance (Z2) is = '+string (Z2) +' ohm ');
R=310.16; //RESISTANCE
Xc=310.16;
F=50;
C=1/(2*%pi*F*Xc);
disp('i) Capacitor (C) is = '+string (C) +' F ');
|
bdce26743b5cc5de614c321a03eec84a54653ee6 | 449d555969bfd7befe906877abab098c6e63a0e8 | /2150/CH7/EX7.2/ex7_2.sce | f079f4094908ae2e8440cbf0d55d3e09642862bf | [] | 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 | 230 | sce | ex7_2.sce | //Exa 7.2
clc;
clear;
close;
// Given data
V1 = 20;// in V
V2 = 2;// in V
V = V1-V2;// in V
R = 1;// in kohm
R = R * 10^3;// in ohm
I_D = V/R;// in A
I_D = I_D * 10^3;// in mA
disp(I_D,"The drain current in mA is");
|
9e3110b17f1cc1b502bc87adf43ec02b7af87f4f | 449d555969bfd7befe906877abab098c6e63a0e8 | /1427/CH15/EX15.2/15_2.sce | b0d6e48d58990a818126ec30666f3e9a227cede3 | [] | 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 | 325 | sce | 15_2.sce | //ques-15.2
//Calculating equilibrium constant for a dissociation reaction
clc
x=22;//percentage of dissociation
a=2;//moles of HI
c1=(x/100)/2;//content of H2
c2=(x/100)/2;//content of I2
c3=(2-(2*x/100))/2;//content of HI
Kc=(c1*c2)/c3^2//equilibrium constant
printf("Equilibrium constant required is %.4f.",Kc);
|
19969cadc9e99d530668031a58c367bbceb5f3c6 | 449d555969bfd7befe906877abab098c6e63a0e8 | /243/CH4/EX4.3/4_03.sce | 74c85ffca9a82dfa9266f1b22f613cc32348348d | [] | 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 | 805 | sce | 4_03.sce | //Example No. 4_03
//Pg No. 64
clear ; close ; clc ;
a = 0.1
b = 0.4
for i = 1:8
afrac(i) = floor(a*2)
a = a*2 - floor(a*2)
bfrac(i) = floor(b*2)
b = b*2 - floor(b*2)
end
afrac_s = '0' + '.' + strcat(string(afrac)) //string form binary equivalent of a i.e 0.1
bfrac_s = '0' + '.' + strcat(string(bfrac))
mprintf('\n 0.1_10 = %s \n 0.4_10 = %s \n ', afrac_s , bfrac_s)
for j = 8:-1:1
summ(j) = afrac(j) + bfrac(j)
if summ(j) > 1 then
summ(j) = summ(j)-2
afrac(j-1) = afrac(j-1) + 1
end
end
summ_dec = 0
for k = 8:-1:1
summ_dec = summ_dec + summ(k)
summ_dec = summ_dec*1/2
end
disp(summ_dec,'sum =')
disp('Note : The answer should be 0.5, but it is not so.This is due to the error in conversion from decimal to binary form.') |
1866367ea70586a5a4149b6bb8a7f54232980a64 | 8ea401b354e99fe129b2961e8ee6f780dedb12bd | /macros/iloc.sci | db3849b3b3e69581973b8de8d75c789f90ba21b4 | [
"BSD-2-Clause"
] | permissive | adityadhinavahi/SciPandas | 91340ca30e7b4a0d76102a6622c97733a28923eb | b78b7571652acf527f877d9f1ce18115f327fa18 | refs/heads/master | 2022-12-20T04:04:35.984747 | 2020-08-19T16:10:51 | 2020-08-19T16:10:51 | 288,765,541 | 0 | 1 | null | 2020-08-19T15:35:04 | 2020-08-19T15:14:46 | Python | UTF-8 | Scilab | false | false | 595 | sci | iloc.sci | function iloc()
// Purely integer-location based indexing for selection by position.
//
// Syntax
// dfr.iloc(input_string)
//
// Parameters
// input_string : String containing the input integers/slices/lists of integers
// Returns : DataFrame
//
// Description
// .iloc[] is primarily integer position based (from 0 to length-1 of the axis), but may also be used with a boolean array.
//
// Examples
// // Getting the data of the first passenger
// dfr.iloc("0,:")
//
// Authors
// Aditya Dhinavahi
// Sundeep Akella
endfunction |
a2781f09a572f925a5392b622e01ea05389fa032 | 449d555969bfd7befe906877abab098c6e63a0e8 | /3769/CH5/EX5.31/Ex5_31.sce | 010ce40ccf00e046aaf53d7aa048103e33a5bccf | [] | 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 | 310 | sce | Ex5_31.sce | clear
//Given
R1=5 //ohm
R2=9 //ohm
R3=14 //ohm
R4=11
R5=7
R6=18
R7=13
R8=22
V=22
//Calculation
Rec=(R1+R2)*R3/(R1+R2+R3)
Rbe=(R4+R5)*R6/(R4+R5+R6)
Rae=(R7+R2)*R8/(R7+R2+R8)
I=V/Rae
//Result
printf("\n The value of current in the branch AF is %0.3f A", I)
|
6bde854da874893e019f716265e6a2e898f22774 | 520d91294d0a82e781c43ae549ea90539d0f8fe9 | /Scripts/test org.tst | 6807d9bf72fcb6a9c462f835f65e601520e28898 | [] | no_license | diegoazh/PetsFinder | 12127cf15676ddee1fdbf999ec94a9dd1f717cf1 | 9eaaa09885c6b1f59fd02381ec30af7ed2da4df0 | refs/heads/master | 2020-04-04T17:47:52.076978 | 2014-12-10T01:56:01 | 2014-12-10T01:56:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 576 | tst | test org.tst | PL/SQL Developer Test script 3.0
15
-- Created on 13/11/2014 by LUIS G
declare
-- Local variables here
i integer;
begin
insertions.set_organizacion(nombre_org => 'ASODEC',
tel => '25501478',
email => 'asodec@itcr.com',
pais1 => 'Costa Rica',
provincia1 => 'Cartago',
canton1 => 'Cartago',
distrito1 => 'Central',
direc_exact => 'contiguo al tec');
end;
0
0
|
35aeafdd9ba9e597c4c34671afbc51919116564f | 449d555969bfd7befe906877abab098c6e63a0e8 | /476/CH4/EX4.10/Example_4_10.sce | 05e91d4318ba674618d6bdb7b84f680a4eff5085 | [] | 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 | 449 | sce | Example_4_10.sce | //A Textbook of Chemical Engineering Thermodynamics
//Chapter 4
//Second Law of Thermodynamics
//Example 10
clear;
clc;
//Given:
n1 = 0.21; //volume % of oxygen in air
n2 = 0.79; //volume % of nitrogen in air
R = 8.314; //ideal gas constant
//To calculate entropy of 1 kmol of air
//Using equation 4.35 (Page no. 96)
S = (-R*(n1*log(n1)+n2*log(n2))); //[kJ/kmol K]
mprintf('The total entropy change is %f kJ/kmol K',S);
//end |
147f5eb5ce22ca37dcbd984afa6b79ca654f3661 | f04d3d47f893de08cd99a31b4870112915b80d5b | /Datasets/australian/data2.tst | b78bc54d6eb9adb462257debf8fae189ea45531a | [] | no_license | MesumRaza/MyWorkInPython | f5364b8514943e44c7200123653da9f4551251b1 | bd8c9b3ca2fb02ae6d2b626054fa3cd32c28b330 | refs/heads/master | 2021-08-19T21:46:41.412995 | 2017-11-27T13:37:52 | 2017-11-27T13:37:52 | 111,728,604 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 5,310 | tst | data2.tst | 1 0.203008 0.0566071 0.5 0.923077 0.875 0.064386 1 1 0.179104 1 0.5 0.2915 0.00713 class1
1 0.526316 0.940536 0 0 0 0 1 0 0 1 0.5 0 0 class0
0 0.250677 0.0491071 0.5 0.615385 0.875 0.00140351 0 1 0.0447761 0 0.5 0 0.00033 class0
1 0.235639 0.0446429 0.5 0.615385 0.375 0.0614035 0 0 0 0 0.5 0.1 0 class0
1 0.218045 0.18 0 0.538462 0.5 0.0526316 1 1 0.119403 1 0.5 0.072 7e-05 class1
1 0.398496 0.767857 0.5 0.692308 1 0.701754 1 1 0.164179 0 0.5 0 0.012 class1
1 0.342105 0.151786 0.5 0.769231 0.375 0.122807 0 0 0 0 0.5 0.227 0.0005 class0
1 0.177895 0.0119643 0.5 0.230769 0.875 0.122807 0 0 0 1 0.5 0.17 0 class0
1 0.241805 0.125 0.5 0.538462 0.375 0.00578947 0 0 0 0 0.5 0.108 0 class0
1 0.140301 0 0.5 0.230769 0.375 0.0350877 0 1 0.164179 0 0 0 0 class0
0 0.276992 0.0521429 0.5 0.615385 0.375 0.0380702 1 1 0.238806 0 0.5 0.06 0.02079 class1
1 0.171729 0.125 0.5 0.923077 0.375 0.0219298 1 1 0.104478 0 0.5 0 0.07059 class1
0 0.322105 0.133929 0.5 0 0 0 0 1 0.0895522 0 0.5 0 0.002 class0
0 0.0726316 0.357143 0.5 0.0769231 0.375 0.0145614 0 0 0 0 0.5 0.04 0.00042 class0
1 0.393534 0.178571 0.5 0.153846 0.5 0.00736842 0 0 0 0 0.5 0.275 0 class0
1 0.145414 0.0357143 0.5 0.538462 0.375 0.0175439 0 0 0 1 0 0.14 0 class0
1 0.358346 0 0.5 0.538462 0.375 0 0 0 0 0 1 0.092 0 class1
0 0.165414 0.488036 0.5 0.769231 0.875 0.0526316 0 0 0 0 0.5 0.14 1e-05 class0
0 0.5 0.464286 0.5 0.153846 0.5 0.181228 1 1 0.134328 1 0.5 0 0 class1
1 0.307068 0.1875 0.5 0.615385 0.375 0.00298246 0 0 0 1 0.5 0.145 6e-05 class1
1 0.126617 0.0208929 0 0 0 0 0 0 0 0 0.5 0.05 0 class0
1 0.210526 0.0460714 0.5 0.230769 0.875 0.00877193 0 0 0 1 0 0.07 0 class0
1 0.43609 0.145893 0.5 0.384615 0.375 0.00140351 0 0 0 0 0.5 0.054 0.001 class0
1 0.224361 0.517857 0.5 0.0769231 0.375 0.00438596 0 0 0 0 0.5 0 0.00286 class0
1 0.338346 0.178571 0.5 0.538462 0.5 0.0877193 1 1 0.0895522 0 0.5 0 0.00367 class1
0 0.0664662 0.357143 0 0.769231 0.875 0.00578947 0 0 0 0 0.5 0.17 0 class0
1 0.112782 0.0535714 0.5 0.615385 0.375 0.0526316 0 0 0 0 0.5 0.075 8e-05 class1
0 0.378496 0.0594643 0.5 0.384615 0.375 0.00877193 0 0 0 0 0.5 0 0.0039 class0
1 0.27188 0.00142857 0 0.461538 0.375 0.00140351 0 0 0 0 0.5 0 0 class0
0 0.0538346 0.339286 0.5 0.384615 0.375 0.0614035 0 1 0.149254 1 0.5 0 0.0001 class0
0 0.100301 0.0298214 0.5 0.769231 0.375 0.055614 1 1 0.0149254 0 0.5 0 0 class1
0 0.380902 0.142857 0.5 0.538462 0.375 0.105263 0 0 0 0 0.5 0.24 0 class0
1 0.374737 0.0075 0.5 0.230769 0.375 0.00298246 1 0 0 1 0.5 0.14 0 class1
1 0.209323 0.491071 0.5 0.615385 0.375 0.201754 1 0 0 1 0.5 0.2435 0.005 class1
1 0.210526 0.0208929 0 0.923077 0.375 0.00877193 1 1 0.0298507 0 0.5 0.13 0.005 class1
1 0.0789474 0 0 0 0 0 0 1 0.0597015 0 0.5 0.0225 1e-05 class0
0 0.169173 0.03125 0.5 1 0.875 0.0364912 1 0 0 1 0.5 0.08 0.0586 class1
1 0.209323 0.0714286 0.5 1 0.875 0.0350877 1 1 0.0597015 0 0.5 0.07 0.07544 class1
1 0.12782 0.321429 0.5 0.384615 0.375 0.00298246 0 0 0 0 0.5 0 0 class0
0 0.542556 0.485179 0.5 0.230769 0.875 0.298246 1 0 0 1 0.5 0 0 class1
1 0.279398 0.0892857 0.5 0.538462 0.375 0.0438596 0 0 0 1 0.5 0.14 0 class0
1 0.368421 0.361607 0 0.230769 0.375 0.00438596 0 0 0 0 0.5 0.08 0 class0
1 0.504962 0.232143 0.5 0.538462 0.375 0.0350877 0 0 0 1 0.5 0 0.00228 class0
1 0.211729 0.142857 0 0.153846 0.875 0.201754 1 1 0.0298507 1 0.5 0.0375 0 class0
0 0.330827 0.0326786 0.5 0.384615 0.375 0.0263158 1 1 0.0597015 0 0.5 0 0.01583 class1
1 0.298195 0.00892857 0.5 0.153846 0.5 0.140351 0 0 0 1 0 0.21 0 class0
1 0.305714 0.00285714 0 0.461538 0.5 0.00140351 1 1 0.0149254 1 0.5 0.14 0.02 class1
0 0.105263 0.369107 0.5 0.923077 0.875 0.0117544 1 1 0.0149254 1 0.5 0.04 0.0005 class1
1 0.29203 0.0357143 0.5 1 0.375 0.0263158 1 1 0.104478 1 0.5 0.17 0.04071 class1
1 0.135338 0.392857 0.5 0.769231 0.375 0.0877193 1 1 0.104478 1 0.5 0.05 0.00809 class1
1 0.526316 0.303571 0.5 0.538462 0.875 0.438596 1 1 0.134328 0 0.5 0.0905 0.01655 class1
1 0.403459 0.178571 0.5 0.538462 0.375 0.175439 1 1 0.104478 0 0.5 0 0.03065 class1
1 0.10406 0.0298214 0 0.538462 0.375 0.0701754 0 0 0 1 0 0.12 0 class0
0 0.37594 0.0535714 0.5 0 0 0 0 0 0 0 0.5 0.038 0 class0
0 0.651579 0.696429 0.5 0.538462 0.375 0.192982 1 1 0.104478 0 0.5 0 0.03 class1
0 0.263158 0.133929 0.5 0.923077 0.875 0.0219298 1 1 0.134328 1 0.5 0.0905 0 class1
1 0.12406 0.0282143 0.5 0.615385 0.375 0.0101754 0 1 0.0149254 0 0.5 0.21 0.00283 class0
0 0.670376 0.357143 0.5 0.769231 0.375 0.140351 1 1 0.208955 0 0.5 0 0.01602 class1
1 0.22812 0.0133929 0.5 0.538462 0.375 0.0101754 0 0 0 0 0.5 0.11 0.0014 class0
0 0.484962 0.142857 0.5 0.307692 0.25 0 1 0 0 0 0.5 0.05 0.0096 class1
1 0.109023 0.107143 0 0.0769231 0.375 0.0380702 1 1 0.119403 1 0.5 0.08 1e-05 class1
0 0.165414 0.446429 0.5 0.384615 0.375 0.0526316 1 1 0.179104 1 0.5 0.06 0.00567 class1
0 0.106466 0.0178571 0 0.692308 0.125 0.0350877 0 0 0 0 0.5 0.13 0 class0
1 0.162857 0.482143 0 0 0 0 0 0 0 0 0.5 0.092 0 class0
0 0.191729 0.0967857 0 0.538462 0.375 0.00298246 0 0 0 0 0 0.04 0 class0
1 0.408571 0.0298214 0.5 0 0 0 1 0 0 0 0.5 0.065 1e-05 class0
0 0.369624 0.157679 0.5 0.538462 0.375 0.00438596 0 0 0 0 0.5 0.08 0 class0
1 0.0876692 0.0208929 0.5 0 0 0 0 1 0.0447761 0 0.5 0.175 0.00769 class0
1 0.383459 0.339286 0.5 0.461538 0.375 0.22807 1 1 0.208955 0 0.5 0.12 0.04607 class1
|
bddba235ff6cdeb6e787c151d17eb0cb91fae7da | 4a1effb7ec08302914dbd9c5e560c61936c1bb99 | /Project 2/Experiments/FURIA-C/results/FURIA-C.abalone-10-1tra/result2s0.tst | cbce4308f95fafa1388a8c399af8a3dd09b6de19 | [] | no_license | nickgreenquist/Intro_To_Intelligent_Systems | 964cad20de7099b8e5808ddee199e3e3343cf7d5 | 7ad43577b3cbbc0b620740205a14c406d96a2517 | refs/heads/master | 2021-01-20T13:23:23.931062 | 2017-05-04T20:08:05 | 2017-05-04T20:08:05 | 90,484,366 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 2,406 | tst | result2s0.tst | @relation abalone
@attribute Sex{M,F,I}
@attribute Length real[0.075,0.815]
@attribute Diameter real[0.055,0.65]
@attribute Height real[0.0,1.13]
@attribute Whole_weight real[0.002,2.8255]
@attribute Shucked_weight real[0.001,1.488]
@attribute Viscera_weight real[5.0E-4,0.76]
@attribute Shell_weight real[0.0015,1.005]
@attribute Rings{15,7,9,10,8,20,16,19,14,11,12,18,13,5,4,6,21,17,22,1,3,26,23,29,2,27,25,24}
@inputs Sex,Length,Diameter,Height,Whole_weight,Shucked_weight,Viscera_weight,Shell_weight
@outputs Rings
@data
12 9
10 9
15 9
5 4
4 5
8 8
20 9
11 9
16 9
12 9
8 8
12 8
11 8
9 9
18 9
7 6
9 6
16 9
13 9
13 9
12 9
8 8
13 9
7 6
11 8
15 9
11 8
9 8
10 8
16 9
8 6
19 9
19 9
10 8
10 8
10 8
12 8
14 9
11 8
11 6
13 9
17 9
11 8
5 5
10 6
14 8
8 6
14 6
11 9
15 8
21 9
9 8
16 9
11 8
11 8
11 8
5 5
12 6
4 4
13 9
13 8
17 9
17 9
15 8
9 8
10 8
12 8
7 6
10 9
9 9
8 9
15 9
12 9
11 9
4 6
8 6
7 6
5 6
7 6
7 6
6 6
7 8
6 6
6 8
8 8
10 9
9 9
7 9
8 9
10 9
12 9
11 9
6 5
6 6
6 6
7 6
6 8
8 8
8 8
7 9
8 8
8 8
8 8
8 8
9 9
9 9
9 9
7 6
8 6
8 6
11 6
8 8
8 8
7 8
9 8
7 8
13 8
10 8
9 8
9 8
11 8
10 9
10 9
11 8
9 9
10 9
11 9
12 9
10 9
15 9
10 9
10 9
11 9
14 9
6 6
6 6
8 6
6 6
9 6
8 8
6 8
8 8
9 8
9 9
8 9
10 9
10 9
11 9
6 6
5 6
8 6
8 6
8 8
9 8
10 9
12 8
10 8
9 8
8 8
9 9
11 9
10 9
12 9
9 9
12 9
12 9
10 9
10 9
10 9
9 8
11 9
9 9
4 4
7 6
11 6
8 6
8 8
10 8
10 8
7 8
9 8
9 8
9 9
10 9
10 8
9 9
11 9
11 9
13 9
11 9
7 5
7 6
7 6
8 8
9 8
9 8
9 8
8 6
8 8
11 8
8 9
10 9
14 9
7 6
8 8
10 8
9 8
16 9
9 8
12 9
9 9
6 4
5 5
11 6
7 8
18 9
13 9
8 8
13 9
13 9
15 9
10 8
10 8
10 9
8 8
10 6
17 9
23 9
12 8
18 9
11 9
3 4
12 6
10 6
5 4
9 8
10 6
9 6
9 8
11 8
7 6
5 5
8 6
12 9
8 8
7 6
7 8
6 8
9 8
8 8
8 8
9 8
9 9
10 9
11 9
4 4
6 6
8 6
8 8
9 8
9 8
10 8
10 9
11 9
10 9
10 9
12 9
9 9
9 9
7 6
9 9
9 9
6 6
7 6
9 8
8 8
8 8
11 9
11 9
12 9
11 9
11 9
9 8
11 9
14 9
6 6
8 8
9 8
7 8
9 8
9 9
11 9
10 9
10 9
14 9
11 9
11 9
7 6
7 6
9 9
13 9
24 9
10 9
15 8
12 9
5 6
9 8
6 6
15 9
16 9
8 8
13 9
14 9
5 6
11 8
18 9
15 8
14 9
12 9
9 6
17 8
16 8
13 8
8 8
19 9
9 6
10 8
5 5
6 6
10 9
13 9
6 6
7 6
13 9
7 8
8 8
9 9
11 9
10 9
10 9
6 6
8 9
8 8
12 9
11 9
3 4
6 6
7 6
7 6
9 8
9 9
10 9
8 9
12 9
10 9
7 5
8 8
9 8
9 8
7 8
10 8
10 9
14 9
10 9
11 9
10 9
11 9
7 8
9 8
9 9
13 9
8 8
10 8
9 9
10 9
9 8
10 9
14 9
6 6
8 8
4 4
7 6
12 9
11 8
5 6
13 9
14 9
17 9
10 9
15 6
12 6
20 8
14 8
13 9
13 8
9 8
12 8
6 6
7 8
6 6
9 8
11 8
10 9
11 9
10 8
11 9
9 9
9 9
8 8
10 9
8 8
9 9
10 8
8 8
10 8
6 6
7 6
7 6
|
92be4ee218ff89a1dafe35856199ca11f26f48dc | 02427d9d608ef9018bc666d8532338ef5e008a07 | /PAL/4_permutations/tests/2.out | 9effba2fac758d4e6abc54c4b9c503bfff205d9c | [] | no_license | michalsustr/CTU | aebd874999ee53bc3bd3f07ef7b3461458c84826 | 00a1a152e1ce445427eb9e043b962387fb12ab64 | refs/heads/master | 2021-01-10T06:31:32.424103 | 2015-12-31T00:21:34 | 2015-12-31T00:21:34 | 48,609,906 | 0 | 0 | null | null | null | null | UTF-8 | Scilab | false | false | 13 | out | 2.out | 23
0 2 4 1 3
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.