r/scilab • u/Hagalz • Apr 21 '20
Pls help me
Hi, i'm on a course and i don't know what's bad with my code. I need help, pls
r/scilab • u/Hagalz • Apr 21 '20
Hi, i'm on a course and i don't know what's bad with my code. I need help, pls
r/scilab • u/ZurinArctus_ • Jan 27 '24
Hello
I know this sub might not be the best place to ask. But I was assigned task but I never used SciLab and sadly I'm not good in math as well. Is there anyone who could help me with this:
Propose a simulation model in SciLab-Xcos based on the following mathematical model:
x′′−m(1−b2sin2(x))+ν2sin(x)=0x′′−m(1−b2sin2(x))+ν2sin(x)=0
Where:
m=0.5m=0.5
ω=1ω=1
b=3b=3
Computation time = 20 [s]
Initial conditions: x(0)=0x(0)=0, x′(0)=0x′(0)=0The model should include:
Definition and use of parameters in blocks occurring in the mathematical model.
Presentation of plots for the function and its derivative, which are solutions to the equation, on two monitors.
Phase plot, i.e., the trajectory of x′x′ versus xx.r/scilab • u/mrhoa31103 • Dec 28 '25
Subject - Solving Simultaneous Equations via Lower Upper (LU) Decomposition and Partial Pivoting and row reduced echelon command).
============================================================
Note some extra stuff not part of the Numerical Analysis Course: I've added some determinate tracking calculation throughout the program just to show how the partial pivoting and decompositions affect the determinate value. I'm currently refreshing my Linear Algebra stuff and I'm on determinants and row operation influences.
I also added the use of the "lu" function in SciLab and how to get the solution vector using the lu function result and rref function techniques. I had some disappointment that the lusolve command is only for solving sparse matrices.
============================================================
As I mentioned that I would add some SciLab code I generated while doing a refresher on Numerical Computation (and gave me an opportunity to learn SciLab less the XCOS stuff).
The YouTube channel is referenced in the second line of the program just remember strip off the "//" (// is making it a comment line in SciLab) before the https://...
https:
//www.youtube.com/watch?v=smsE7iOlNj4&t=17s&ab_channel=MATLABProgrammingforNumericalComputationis the link to the sixteenth class.
Output:
"A = "
4. -2.
3.
"determinate of A ="
-4.0000000
"b = "
4.
9.
7.
"Augmented Matrix A:b ="
4.
4. -2. 9.
3. 7.
"Solution to Ax =b x1 ="
1.0000000
2.0000000
1.0000000
"Ac pivot ="
3. 4. -2. 9.
4.
3. 7.
"number of row swaps ="
"determinate of the pivoted A ="
-4.0000000
"L ="
0. 0.0.3333333 1. 0.
0.6666667 5. 1.
"U ="
3. 4. -2.
0. -0.3333333 1.6666667
0. 0. -4.
"determinant of L ="
"determinant of U ="
4.
"determinant of L*U"
-4.0000000
"which is the same as determinate A"
"l ="
0.3333333 0.2 1.
0. 0.0.6666667 1. 0.
"u ="
3. 4. -2.
0. -1.6666667 4.3333333
0. 0. 0.8
"determinant of l ="
"determinant of u ="
-4.0000000
"determinant of l*u"
-4.0000000
"which is the same as determinate A"
"Ac = "
3. 4. -2. 9.
0. -0.3333333 1.6666667 1.
0. 0. -4. -4.
"Solution from back substitution in L and U x3 = "
"Solution from the l-u decomposition ="
1.0000000
2.0000000
1.0000000
//Lecture 4.3: LU Decomposition and Partial Pivoting
//https://www.youtube.com/watch?v=smsE7iOlNj4&t=17s&ab_channel=MATLABProgrammingforNumericalComputation
//
// x1+ x2+ x3 = 4
//2*x1+ x2+3*x3 = 7
//3*x1+4*x2-2*x3 = 9
//Using Matlab's powerful Linear Algebra:
clc
A = [1,1,1;3,4,-2;2,1,3];
//A = [3,4,-2;1,1,1;2,1,3]; //Already "pivoted" matrix form
//A=[-3 2 6;5 -1 5;10 -7 0]; //Just another matrix to play with...
disp("A = ", A);
disp("determinate of A =", det(A));
//We show how the determinant is
// affected with these calculations too.
b = [4;9;7];
//b = [9;4;7]; //goes along with the already "pivoted" A matrix
disp("b = ", b);
Ac=[A,b];
disp("Augmented Matrix A:b =",Ac)
[n,m]=size(Ac);
//disp("n,m "+string(n)+" and "+string(m));
L=eye(A);
//disp("L =",L);
x1 = A\b;
disp("Solution to Ax =b x1 =",x1);
//Calculate L matrix using Gauss Elimination
// We're going to add Partial Pivoting where
// we select the largest element in row 1 and exchange
// that equation with the 1st row.
nswaps = 0;
for k = 1:1:n
// number of row swaps
for i = k:1:n
if (abs(Ac(i,k))>abs(Ac(k,k))) then
temp = 0
nswaps = nswaps + 1
for j=1:1:m
temp = Ac(k,j)
Ac(k,j)=Ac(i,j)
Ac(i,j)=temp
end
// disp("Ac =",Ac);
end
end
end
disp("Ac pivot =",Ac);
Ad = Ac(1:3,1:3);
disp("number of row swaps =", nswaps)
disp("determinate of the pivoted A =", (-1)^nswaps*det(Ad));
//We did 'nswaps' row swaps and everytime we do a row swap, it changes
//the sign of the determinant. We are doing LU decomposition on the
//partial pivoted matrix not the original matrix. We've coded in the
//sign change so it should show no difference in the determinant on
//the final determinant calculation.
//Calculate L matrix
for i = 1:1:n
for j = i+1:1:n
alpha = Ac(j,i)/Ac(i,i);
L(j,i)=alpha;
// disp("alpha ="+string(alpha));
//Rj = Rj-alphai,j*Ri where alphai,j = A(j,i)/A(i,i)
Ac(j,:)=Ac(j,:)-alpha.*Ac(i,:);
// disp("Ac = ",Ac);
end
end
U = Ac(1:n,1:n);
disp("L =",L,"U =",U);
disp("determinant of L =" ,det(L));
disp("determinant of U =", det(U));
disp("determinant of L*U", (-1)^nswaps*det(L*U),"which is the same as determinate A");
//should show no change in determinant since we've only added or subtracted
//row operations with nswaps row swaps but no multiplication)
//LU decomposition
[l,u]=lu(A)
//note we're doing the lu decomposition on the original
//matrix
disp("l =",l);
disp("u =",u);
disp("determinant of l =" ,det(l));
disp("determinant of u =", det(u));
disp("determinant of l*u", det(l*u),"which is the same as determinate A");
//note: lu command doesn't change determinant when done on the original
//matrix
//Backsubstitution
x3 =zeros(m,1);
//need 1 longer in vector so formula works
for i = n:-1:1
x3(i)= (Ac(i,$)-(Ac(i,i+1:$)*x3(i+1:$)))/Ac(i,i);
end
disp("Solution from back substitution in L and U x3 = ",x3(1:n))
//Solve using the lu decomposition results
//l*y = b and u*x4 = y and we're going to use the function rref()
//solve the system equations
Af =
rref
([l b])
//row reduce until we get the y vector in the last column
y = Af(1:$,$)
// pick off the last column
Ag =
rref
([u y])
//row reduce until we get the x4 solution in the last column
x4 = Ag(1:$,$)
// pick off the last column
disp("Solution from the l-u decomposition =", x4)
//One more note - there is a Scilab function lusolve - this is for sparse
//matrices - it chokes on these non-sparse matrices. Do not attempt to use.
//r/scilab • u/mrhoa31103 • Dec 08 '25
Subject - More on Numerical Integration Techniques
I mentioned that I would add some SciLab code I generated while doing a refresher on Numerical Computation (and gave me an opportunity to learn SciLab less the XCOS stuff).
The YouTube channel is referenced in the second line of the program just remember strip off the "//" (// is making it a comment line in SciLab) before the https://...
For example: //https://www.youtube.com/watch?v=tByDeErG0Ic&t=13s&ab_channel=MATLABProgrammingforNumericalComputation is the link for the 12th class session depicted here.
Output:
Startup execution:
loading initial environment
"The integral of 2-x+ln(x) from 1 to 2 with step size 0.025 is ... "
"True Value = 0.8862944"
"Trap Value = 0.8862683 with Error = 0.000026"
"Simp Value = 0.8862944 with Error = 3.794D-09"
"Execution done."
Code:
//Numerical Integration
//Lec 3.4 Newton-Cotes Integration Formulae
//https://www.youtube.com/watch?v=tByDeErG0Ic&t=13s&ab_channel=MATLABProgrammingforNumericalComputation
//
// Integration is area under a curve
// Single Variable application
// Trapezoid Rule -> Area = h*(f(x+h)+f(x))/2 = 2 points
// Truncation Error - Order h^3
// Simpson's 1/3rd Rule -> 3 point fit
// area for "x to x+2h" = h/3*(f(x)+4*f(x+h)+f(x+2h))
// Truncation Error - Order h^5
// Simpson's 3/8th Rule -> 4 point fit
// area for "x to x+3h" = 3h/8*(f(x)+3*f(x+h)+3*f(x+2h)+f(x+3h))
// Truncation Error - Order h^5
// Let's do an example
// integrate f(x)= 2 - x + ln(x)
// true value = 2*x - 0.5*x^2 + (x*ln(x)-x)
// simplifying = x - x^2/2 + x*ln(x)
// compare Trap and 1/3 Simpson rules
function result =f(x)
result = 2-x+log(x);
endfunction
a = 1;
b = 2;
//number of steps
n = 40;
//n needs to be even!
h = (b-a)/n;
disp("The integral of 2-x+ln(x) from "+ string(a)+" to "+string(b)+" with step size "+string(h)+" is ... ")
TruVal = (b-b^2/2+b*log(b))-(a-a^2/2+a*log(a));
disp("True Value = "+string(TruVal));
Trap_area = 0.;
Simp_area = 0.;
for i = 1:1:n;
x = a + h.*(i-1);
f1 = f(x);
f2 = f(x+h);
areaT = h*(f2+f1)/2;
Trap_area = Trap_area + areaT;
end
errT = abs(TruVal - Trap_area);
disp("Trap Value = "+string(Trap_area)+" with Error = "+string(errT));
for i = 1:1:n/2;
x = a + (2*h).*(i-1);
f1 = f(x);
f2 = f(x+h);
f3 = f(x+(2*h));
areaS = h/3*(f1+4*f2+f3);
Simp_area = Simp_area + areaS;
end
errS = abs(TruVal - Simp_area);
disp("Simp Value = "+string(Simp_area)+" with Error = "+string(errS));r/scilab • u/mrhoa31103 • Apr 08 '26
If you look at their examples, quote
// integration over a cube -1<=x<=1;-1<=y<=1;-1<=z<=1
function v=f(xyz, numfun), v=xyz'*xyz, endfunction
[result, err] = int3d(-1,1,-1,1,-1,1, f, 1, [0,100000,1.d-5,1.d-7])
but you have to integrate "v = 3*x*y^3*z^2" over xrange (-1,3), yrange(1,4) and zrange(0,2)...
here's what you have to do...
// Define the function f(x, y, z)...nope,nope,nope!!! Get crazy
// error codes like unknown z variable
// Define this function
function v= f(xyz, numfun)
//Note: x = xyz(1), y = xyz(2), z = xyz(3)
//have no idea what "numfun" is but you cannot drop it.
v=3*xyz(1)*xyz(2)^3*xyz(3)^2
endfunction
// Triple integration in one go
// computes the intergral of 3xy^3z^2 over the
// integration over a cube -1<=x<=3;1<=y<=4;0<=z<=2
// Correct Answer is 2040
[result, err] = int3d(-1,3,1,4,0,2, f, 1, [0,100000,1.d-5,1.d-7])
outputString = strcat(['3d result = ', string(result)]);
disp(outputString);
I understood that v had to be a single number how to get it was the trick. It would have been really nice to have an example like this one in their documentation.
Go ahead and roast me if you thought was blatantly obvious!
r/scilab • u/mrhoa31103 • Nov 13 '25
Ladies and Gentlemen,
This subreddit is back open to the public. You can post your Scilab queries here. It may take a while to breathe life back into the subreddit so get the word out. I'll will be working on the wiki to get some Scilab support information out there and some links to the discord site.
Hope to see a growing community here soon.
r/scilab • u/Money-Engineer6927 • Oct 06 '24
Hi,
I'd love a version of Scilab for my Snapdragon X plus with Windows 11.
Is there any ongoing work with making it compatible?
r/scilab • u/mrhoa31103 • Nov 23 '25
Here's the course outline - I have files for every one except for those that didn't have any coding that session. The dropped in the 17th one as an example of the files (totally random selection).
(43) MATLAB Programming for Numerical Computation NPTEL - YouTube
Any requests for the next file to drop in. You can also tell me to stop spamming you but my intent is to show how to do practical things in SciLab without having to spend hours upon hours looking up the syntax (which is definitely different than MATLAB in places).
//NPTEL Computer Numerical Analysis Course
//1 = "Array Operations"
//2 = "Loops and Execution Control"
//3 = "Scripts and Functions in SciLab"
//4 = "Plotting and Output in SciLab"
//5 = "Ball Travel Example -with Plotting added"
//6 = "none"
//7 = "Round-Off Errors and Iterative Methods"
//8 = "Errors and Approximations: Step-Wise & Error Propagation"
//9 = "Differentiation in a Single Variable"
//10= "Higher Order Differentiation Formulae"
//11= "Numerical Differentiation:Partial Derivatives - MultiVariable Equations"
//12= "Numerical Integration: Newton-Cotes Integration Formulae"
//13= "Numerical Integration: Matlab Functions and Application"
//14= "Basics of Linear Algebra (Linear Equations)"
//15= "Linear Equations: Guassian Elimination"
//16= "LU Decomposition and Partial Pivoting"
//17= "Tri-Diagonal Matrix Algorithm"
//18= "Gauss Siedel Method - Iterative Methods for Solving Simultaneous Equations"
//19= "Nonlinear Equation in Single Variable Solving Nonlinear Equations - BiSection Method."
//20= "More on Non-Linear Algebraic Equations: Using Matlab Function fzero and fsolve"
//21= "Fixed Point Iteration in single variable functions"
//22= "Non-linear Algebraic Equations: Newton-Raphson (Single Variable)"
//23= "Non-linear Algebraic Equations: fsolve (Multi-Variable)"
//24 ="Non-linear Algebraic Equations: Newton-Raphson (Multi-Variable)"
//25 ="Introduction and Euler's Method of Integration: Ordinary Differential Equations- Initial Value Problems"
//26 ="Ordinary Differential Equations Initial Value Problems"
//27 ="Ordinary Differential Equations Initial Value Problems: MATLAB ODE45 Algorithm"
//28 = "Ordinary Differential Equations Initial Value Problems: Runge-Kutta Methods - higher order Algorithms"
//29 = "Ordinary Differential Equations Initial Value Problems: Solving Multi-Variable ODE Methods "
//30= "This file is the support file for "SolvingDiffEqwXcos1.xcos"
//31 ="Stiff Systems & Solution using Matlab ode15s"
//32 ="ODE-IVP in Multiple Variables"
//33 ="ODE-IVP in Multiple Variables"
//34= "Regression and Interpolation"
//35= "Functional and Non-linear Regression"
//36= "Interpolation Options in Matlab"
//37= "ODE-Boundary Value Problems" bvode in SciLab
//38= "ODE-BVD Shooting Method"
//39= "Extensions of ODE-BVP"
//40= "Introduction to Differential Algebraic Equations"
//41= "Partial Differential Equations (PDE's) Notes"
//42 = "Parabolic PDEs - Method of Lines"
//43 = "Hyperbolic PDEs - Method of Lines"
//44 ="Practical Applications and Course Wrap Up Elliptic PDEs - Finite Difference"
r/scilab • u/mrhoa31103 • Jun 29 '26
We're starting a new series off of the Steve Brunton's Data-Driven Science and Engineering Series. He's definitely one of my favorite instructors when it comes to numerical and data analysis. First topic of the first short course series is Singular Value Decomposition (SVD). For this first example, it will be using the Image compression as an applied example.
To follow the series,
(As a motivator, I wish I'd had this method in my "Engineering Toolbox" since this technique helps one "sort the wheat from the chaff" when it comes to data reduction. I just never came across it in this form. I've done "Design of Experiments", produced "Statistical Models" and used techniques to figure out "what was important and what was not" but this SVD technique is very scalable.)
2) I do suggest you download the book and read the pertinent sections.
3) Download the data used for the short course. See below for location of the data.
4) For the Scilab code below to work, you'll need to use the Atoms Module Manager, navigate to Image Processing and install the Image Processing and Computer Vision Toolbox (IPCV 4.5.0.2).
5) I'm using Scilab 26.1.0 but have run this successfully on version 26.0.0.
I'm not sure how much coverage SciLab provides for this course but we'll see as we go along.
====================================
These lectures (videos) follow Chapter 1 from the book (freely available in electronic form):
"Data-Driven Science and Engineering: Machine Learning, Dynamical Systems, and Control" by Brunton and Kutz
Data and Python and MATLAB Native Code at https://databookuw.com/
Note: links to Matlab Code.zip + Data.zip on Main Page
Amazon: https://www.amazon.com/Data-Driven-Sc... //If you want hardcopy book.
Book Website(s): http://databookuw.com //For Videos and such
X posting "FREE PDF for 2ND EDITION OF OUR BOOK!!!" databookV2.pdf //For Free Electronic Complete Textbook
Chapters available at: http://databookuw.com/databook.pdf //Free Electronic Version
========================================
Videos
Singular Value Decomposition Short Course Overview
https://www.youtube.com/watch?v=gXbThCXjZFM&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=1
Singular Value Decomposition: Mathematical Overview Short Lecture 2
https://www.youtube.com/watch?v=nbBvuuNVfco&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=2
Singular Value Decomposition: Matrix Approximation Short Lecture 3
https://www.youtube.com/watch?v=xy3QyyhiuY4&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=3
Singular Value Decomposition: Dominant Correlations Short Lecture 4
https://www.youtube.com/watch?v=xy3QyyhiuY4&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=4
He discusses getting code and data files in this fifth lecture
https://www.youtube.com/watch?v=QQ8vxj-9OfQ&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=5
Steve Brunton already has two other short courses on Fourier Transforms and Sparsity & Compression which might be material for future series.
Output: None - Graphical Only
Plots:


Code:
/* Start Block Comment
//Singular Value Decomposition Overview
//https://www.youtube.com/watch?v=gXbThCXjZFM&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=1
//These lectures follow Chapter 1 from:
//"Data-Driven Science and Engineering: Machine Learning, Dynamical Systems, and Control" by Brunton and Kutz
//Amazon: https://www.amazon.com/Data-Driven-Sc... //If you want hardcopy book.
//Book Website: http://databookuw.com //Free Electronic Web-based Version
//Chapters available at: http://databookuw.com/databook.pdf //Free Electronic Version
//For Free Electronic Complete Textbook "FREE PDF for 2ND EDITION OF OUR BOOK!!!" https://x.com/eigensteve/status/1718004606901666063
//Brunton Website: http://eigensteve.com
//Singular Value Decomposition: Mathematical Overview Short Lecture 2
//https://www.youtube.com/watch?v=nbBvuuNVfco&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=2
//Singular Value Decomposition: Matrix Approximation Short Lecture 3
//https://www.youtube.com/watch?v=xy3QyyhiuY4&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=3
//Singular Value Decomposition: Dominant Correlations Short Lecture 4
//https://www.youtube.com/watch?v=xy3QyyhiuY4&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=4
//He discusses getting code and data files in this fifth lecture
//https://www.youtube.com/watch?v=QQ8vxj-9OfQ&list=PLMrJAkhIeNNSVjnsviglFoY2nXildDCcv&index=5
//Data and Python and MATLAB Native Code at https://databookuw.com/
//links to Code.zip + Data.zip on Main Page
*/ //End of Block Comment
clear, close, clc
disp("Data-Driven Science and Engineering - Singular Value Decomposition Image Processing Example ",string(datetime()))
//Need to load this atoms module into SciLab for imread, imshow, rgb2gray
atomsLoad("IPCV") //Once loaded into Scilab, this command line is unnecessary
//Use full file path to your unzipped data file...
A=imread('C:/Users/Matthew/Documents/eBooks/ScILabNotes/SVD_PCA_Course/DATA/dog.jpg');
X=double(rgb2gray(A)); // Convert RBG->gray, 256 bit->double.
nx = size(X,1); ny = size(X,2);
scf()
clf
subplot(2,2,1)
imshow(uint8(X));
title('Original in Gray Scale');
[U,S,V] = svd(X);
plotind=2;
for r=[5 20 100]; // Truncation value
Xapprox = U(:,1:r)*S(1:r,1:r)*V(:,1:r)';
// Approx. image
subplot(2,2,plotind)
plotind = plotind+1;
imshow(uint8(Xapprox))
title(['r=', msprintf('%d',r),', ',msprintf('%2.2f',100*r*(nx+ny)/(nx*ny)),' % storage']);
end
// f_ch01_ex02_2
scf();
clf;
subplot(1,2,1), semilogy(diag(S),'k')
xgrid
xlabel('r')
ylabel('Singular Value sigma_r')
subplot(1,2,2), plot(cumsum(diag(S))/sum(diag(S)),'k')
xgrid
xlabel('r')
ylabel('Cumulative Energy')
r/scilab • u/mrhoa31103 • Jan 11 '26
Subject: Solving Nonlinear Equations using Bisection method
-----------------------------------------------------------------------------------------
Link to the specific lecture (lecture 19).
Note: Even though x range was 0.1 to 4, the program only picks up the first solution since it is simply coded to find a solution, not all solutions.
Output:
"Bisection method solution for y=2-x+ln(x) ="
0.1585943
"equation value (theoretically should be 0 for the root)="
7.230D-11
To find the other solution to the problem, one must change the x range to eliminate the first solution to x = 1 to 4.
"Bisection method solution for y=2-x+ln(x) ="
3.1461932
"equation value (theoretically should be 0 for the root)="
-2.584D-11
To understand whether you have more solutions, the only easy way is to graph the function and look for x-axis crossing points.

//Lec 5.1 Nonlinear Equation in Single Variable
//Solving Nonlinear Equations - BiSection Method.
//https://www.youtube.com/watch?v=5W46xcVInL8&t=51s&ab_channel=MATLABProgrammingforNumericalComputation
//
// Solve 2-x+ln(x)=0 using the bisection method
// Start with a segment where you think the solution exists
// Look for a sign change at the ends of the segment.
// Bisect the segment and keep the segment that contains the
// sign change. Do it until the accuracy is achieved.
//
//define the function
function [results]=
equation
(x)
results = 2.0-x+log(x);
// note log is natural log (aka ln)
//Theoretical roots are very complicated Inverse Lambert Function
//and Lambert Function solutions (approximately numerically)
// at .1585943, 3.1415926
endfunction
//Always graph your function to understand where the roots lie.
// Below is the code for a quick plot with some bells and
// whistles (title, labels, grid, and box frame) to make it
// look good.
//
x=linspace(0.1,4,1000);
results=
equation
(x);
plot2d(x',results');
title
("Y = 2 - X+ln(X)")
xlabel
("X")
ylabel
("Y")
xgrid;
gca
().box="on";
//define the segment where you think a solution lies
x = [0.1,3] //Grabs the first root
//x = [1,4] //Grabs the second root
//
while (x(2)-x(1))>1e-10;
y =
equation
(x);
// disp("y =", y);
xmid = (x(1)+x(2))/2
ymid =
equation
(xmid)
if (sign(ymid)==sign(y(1))) then
x(1)=xmid
else
x(2)=xmid
end
end
disp("Bisection method solution =" ,xmid)
z =
equation
(xmid);
disp("equation value (theoretically should be 0 for the root)=",z)r/scilab • u/mrhoa31103 • Apr 07 '26
Hey everyone! I'm u/mrhoa31103, the moderator of r/scilab a recovering subreddit from the great Apollo incident exodus.
This is our new home for all things related to Scilab. We're excited to have you join us!
What to Post
Post anything that you think the community would find interesting, helpful, or inspiring. Feel free to share your thoughts, photos, or questions about Scilab and its applications.
Community Vibe
We're all about being friendly, constructive, and inclusive. Let's build a space where everyone feels comfortable sharing and connecting. I'm running kind of a blog on Scilab programs so people can see full up working programs but do not feel your posts have to live up those formats. If you have a quick question, "how do you do this or that?" or found a neat application, share it.
Thanks for being part of the community. Together, let's make r/scilab amazing.
r/scilab • u/mrhoa31103 • Dec 22 '25
Subject - Simultaneous Equations via Several Methods (Matrix Inversion, the backslash command, Gaussian Elimination, and row reduced echelon command).
As I mentioned that I would add some SciLab code I generated while doing a refresher on Numerical Computation (and gave me an opportunity to learn SciLab less the XCOS stuff).
The YouTube channel is referenced in the second line of the program just remember strip off the "//" (// is making it a comment line in SciLab) before the https://...
//https://www.youtube.com/watch?v=JY99xfMgwnk&t=12s&ab_channel=MATLABProgrammingforNumericalComputation//https://www.youtube.com/watch?v=celUu5aY6_Q&ab_channel=MATLABProgrammingforNumericalComputation
is the link to the fifteenth class.
Output:
"A = "
3.
4. -2.
"b = "
4.
7.
9.
"x (via Ainverse*B) = "
1.0000000
2.
"x1 (via A\B) ="
1.0000000
2.0000000
1.0000000
"Ab (Augmented Matrix) ="
4.
3. 7.
4. -2. 9.
"Ab = "
4.
3. 7.
4. -2. 9.
"alpha =2"
"Ab = "
4.
-1. 1. -1.
4. -2. 9.
"alpha =3"
"Ab (row reduced Augmented Matrix) = "
4.
-1. 1. -1.
-5. -3.
"alpha =-1"
"Ab = "
4.
-1. 1. -1.
0. -4. -4.
"x2 (via Gaussian Elimination specific size matrix])="
"Ac = "
4.
3. 7.
4. -2. 9.
"alpha =2"
"Ac = "
4.
-1. 1. -1.
4. -2. 9.
"alpha =3"
"Ac = "
4.
-1. 1. -1.
-5. -3.
"alpha =-1"
"Ac = "
4.
-1. 1. -1.
0. -4. -4.
"x3 (via Gaussion Elimination generic size matrix) = "
"x4 (via reduced row echelon command) ="
Code:
//Linear Equations
//Lec 4.2 Guassian Elimination
//https://www.youtube.com/watch?v=JY99xfMgwnk&t=12s&ab_channel=MATLABProgrammingforNumericalComputation
// x1+ x2+ x3 = 4
//2*x1+ x2+3*x3 = 7
//3*x1+4*x2-2*x3 = 9
//Using Matlab's powerful Linear Algebra:
A = [1,1,1;2,1,3;3,4,-2];
b = [4;7;9];
disp(,,"A = ",A);
disp(,"b = ",b);
x = inv(A)*b;
disp(,"x (via Ainverse*B) = ",x);
x1 = A\b;
disp(,"x1 (via A\B) =",x1);
//doing it the hard way
//create an Augmented Matrix
Ab = [A b];
disp(,,"Ab (Augmented Matrix) =",Ab);
Ac = Ab
[n,m]=size(Ab);
disp("Ab = ",Ab)
//Rj = Rj-alphai,j*Ri where alphai,j = A(j,i)/A(i,i)
//R = row elements
//With A(1,1) as a pivot element
alpha = Ab(2,1)/Ab(1,1);
disp("alpha ="+string(alpha));
//R2 = R2-alpha*R1
Ab(2,:)=Ab(2,:)-alpha.*Ab(1,:);
disp("Ab = ",Ab);
alpha = Ab(3,1)/Ab(1,1);
disp("alpha ="+string(alpha));
Ab(3,:)=Ab(3,:)-alpha.*Ab(1,:);
disp(,,"Ab (row reduced Augmented Matrix) = ",Ab);
//With A(2,2) as a pivot element
alpha = Ab(3,2)/Ab(2,2);
disp("alpha ="+string(alpha));
Ab(3,:)= Ab(3,:)-alpha.*Ab(2,:);
disp("Ab = ",Ab)
//Back substitution
x2 =[0;0;0];
x2(3)= Ab(3,4)/Ab(3,3);
x2(2)= (Ab(2,4)- x2(3)*Ab(2,3))/Ab(2,2);
x2(1)= (Ab(1,4)- x2(3)*Ab(1,3)-x2(2)*Ab(1,2))/Ab(1,1);
disp(,"x2 (via Gaussian Elimination specific size matrix])=", x2);
//using for statements and array commands
//Rj = Rj-alphai,j*Ri where alphai,j = A(j,i)/A(i,i)
//R = row elements
disp(,,"Ac = ",Ac);
for i = 1:1:n
for j = i+1:1:n
alpha = Ac(j,i)/Ac(i,i);
disp("alpha ="+string(alpha));
//Rj = Rj-alphai,j*Ri where alphai,j = A(j,i)/A(i,i)
Ac(j,:)=Ac(j,:)-alpha.*Ac(i,:);
disp("Ac = ",Ac);
end
end
x3 =zeros(m,1); //need 1 longer in vector so formula works
for i = n:-1:1
x3(i)= (Ac(i,$)-(Ac(i,i+1:$)*x3(i+1:$)))/Ac(i,i);
end
disp(,,"x3 (via Gaussion Elimination generic size matrix) = ",x3(1:n))
// could do this solve another way to
x4 =
rref
(Ab)(1:n,m);
disp(,,"x4 (via reduced row echelon command) =", x4(1:n))r/scilab • u/JanGadsden • Apr 26 '20
I would like to use it inside my integrated Visual Studio Code terminal but I don't know how to start it inside the console
r/scilab • u/[deleted] • Apr 28 '20
Hi everyone, I'd really appreciate it if somebody well-versed with the NARVAL toolkit could help me out, considering the lack of documentation and tutorials.
The problem here is that I have to create a set of directed and undirected graphs in scilab, and check if they are Eulerian and/or Hamiltonian. I first tried using the MetaNet library, but I was not able to run the euler() function on undirected graphs. Now I'm trying to use NARVAL, but I can't seem to find how to create a directed graph.
Tried searching for "metanet" and "NARVAL" on this sub and didn't find anything, so I'd really appreciate the help. Thanks.
r/scilab • u/SangomaDB • May 01 '20
I have the following (s=784):
mgeti(s, 'uc', fd_r)
I get the error: mget: Wrong type for input argument #1: A positive integer value expected.
If I replace s with the actual value (784), it works.
What is wrong?
r/scilab • u/Gusthor • Apr 21 '20
Hello, I'm going through a Scilab course on Udemy, but it is too brief. I don't know where to go to continue learning about the program after I'm done with this course. Until now my only option would be searching the scilab manual, keyword for keyword.
Background: 3rd year engineering student, know basic principles of some very basic languages and Matlab.
r/scilab • u/bojlerelado • Apr 05 '20
Hi,
Is there a similar command in Scilab to regionprops from Matlab? I am trying to write a code for license plate detection and that would help in locating the plate. Or are there other ways to do that?
r/scilab • u/EternalSeekerX • Apr 23 '20
Hello friends,
I am relatively new to fedora (have used ubuntu/debian before for testing). I am trying to get Scilab to launch but I am having issues. Just to make sure, the fedora image in running inside a container and currently is in root (no users defined yet). I have installed all the requisite packages I need.
The output I get is as followed
[root@localhost ~]# scilab
Could not access to the Main Scilab Class:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.scilab.modules.localization.Messages.gettext(Unknown Source)
at org.scilab.modules.commons.xml.XConfiguration.<clinit>(Unknown Source)
at org.scilab.modules.core.Scilab.<clinit>(Unknown Source)
Caused by: java.lang.NullPointerException
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at org.scilab.modules.localization.MessagesJNI.<clinit>(Unknown Source)
... 3 more
Scilab cannot create Scilab Java Main-Class (we have not been able to find the main Scilab class. Check if the Scilab and thirdparty packages are available).
[root@localhost ~]# The output makes it seem JAVA is mising, but I have both openjdk1.8 and openjdk11 and latest openjdk installed. Switching between them doesn't change anything. whereis java and java -version all work as well as I checked premissions using ls -l dir and they all have the -xwrxr (makes sense since I am root atm). scilab-cli works fine. I cannot understand if its driver issue either, because I already have software 3D acceleration and FreeCAD, gmsh, paraview, blender and even octave work.
I don't know much about Java debugging so I am hoping I can get some pointers.
r/scilab • u/EitherReplacement3 • Apr 21 '20
"Input" function in SciLab **not executing correctly in sequence** for Scilab 6.1.0.
r/scilab • u/Belintrepide • Feb 19 '19
r/scilab • u/foadsf • Feb 22 '19
Lately I have been using SciLab - xcos / ScicosLab - scicos and have had several bugs and questions. Have tried the relevant StackOverFlow tag:
but it seems deserted, ended up answering my own questions. :) Also the Twitter account is not responsive. The forums I have found (here and here) are also not working properly. I have posted several questions, none published/answered. This subreddit is also almost empty :( the IRC channel on OFTC is also empty. There is also a LinkedIn group but not much for technical questions.
I was wondering if you could help me know where is the best place to ask questions and also report bugs? maybe you have a Slack/Discord/Gitter chat rooms?
P.S.1. This seems to be the active git repository of the Scilab project.
P.S.2. I have found a much nicer Scilab documentation here from Aakash Programming Lab(APL).
P.S.3. For some reason the forum developpez has been actively used by French Scilab users.
P.S.4. There is also the scilab.in/forum which belongs to the FOSSEE.in for Indian Institute of Technology of Bombai.
P.S.5. Sadly the Nabble forum has been down for a long while. Alternatively, the mailing list and the archive are still active.
P.S.6. We actually ended up creating channels for #scilab and #xcod on the Modelica server.
r/scilab • u/portirfer • Jan 11 '20
I want to create a 4d scatter plot, where one of the dimensions is color coded such that it could be plotted in 3D space, I know how to create a 3D scatter plot but how do I incorporate color?
r/scilab • u/Satuwell • Oct 22 '24
Hi all! How many of you use xcos and scilab for testing control strategies to be implemented in embedded systems? I mean real time discrete control simulations and even custom C code blocks for control validation.
I know there are Commercial solutions for power electronics, vehicle dynamics, robotics, etc. but a "free for commercial purposes" licensing makes scilab and xcos super interesting for small companies that can not afford expensive Simulink (Matlab) or Simba (Python) simulation environments.
Did I discovered the paradise of control engineers?
r/scilab • u/Desperate-Signal-497 • Feb 16 '25
I'm having an issue with Scilab where it wont let me open the script editor or any of my saved scripts. If i try to open a saved script nothing happens and if i try to open the editor from the console im getting the below pop-up:

No matter which option I pick I can't get the editor to open, does anyone know what might be going wrong? It's seems to have just happened by itself, was working fine earlier today. My saved scripts are still there anyway because I can open them with the notepad.
r/scilab • u/ezmamedes • Feb 12 '25
I would like to perform a closed loop simulation with PID control; but unfortunately it is not working, a graph of an infinite line appears, I probably configured something wrong. It was supposed to be like this other graph from colab. If anyone can help me, I thank you in advance.