0% found this document useful (0 votes)
100 views9 pages

About This Module: Scilab 6.1.0

This document provides an introduction to using the Scilab software package. It discusses that Scilab is a free numerical computation software similar to MATLAB. It can be used to compute differential equations and perform other engineering calculations. The document then demonstrates how to install Scilab and introduces some basic functions like working with complex numbers through definitions, operations and functions. It provides examples of scripts to define, operate on and transform complex numbers in Scilab.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views9 pages

About This Module: Scilab 6.1.0

This document provides an introduction to using the Scilab software package. It discusses that Scilab is a free numerical computation software similar to MATLAB. It can be used to compute differential equations and perform other engineering calculations. The document then demonstrates how to install Scilab and introduces some basic functions like working with complex numbers through definitions, operations and functions. It provides examples of scripts to define, operate on and transform complex numbers in Scilab.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction

ABOUT THIS MODULE

Mathematics is a tool to solve problems that inherits from engineering and


science. Mostly the tools like Transforms and Models like differential equations, partial
differential equations are often invoked for such problems. In the sequel Applications of
integral transforms, Applications of Fourier series, Applications of Laplace transforms &
Applications of Fourier Transforms are widely used.
The use of software like SCILAB and other open access software are always
helping for such problems and become essential in recent times.
This module intends to allow the students to familiarize themselves to the
various basic features of SCILAB and to be able to compute and/or program differential
equations using SCILAB.

WHAT IS SCILAB?

SCILAB is a numerical computation software that anybody can freely


download. It is similar in operation to MATLAB and other existing numerical or
graphic environments. It is available under Windows, Linux and Mac OS X.

INSTALL SCILAB

SCILAB can be downloaded at the following address: http://www.scilab.org/

Select on the version of your choice. On this module, we are going to use Scilab 6.1.0.

Download, run and install the program.

Page | 1
ACTIVITY NO.
ILOILO SCIENCE AND TECHNOLOGY
UNIVERSITY La Paz, Iloilo City

ECE 14 – ADVANCED ENGINEERING MATHEMATICS

NAME:Jason Ivan Gumana Year and Section: BSECE-2B 1

INTRODUCTION TO SCILAB: WORKING WITH COMPLEX NUMBERS

Scilab can be used for simple arithmetic operations as well as for some algebraic
operations, to generate graphs, to program functions, and to solve linear algebraic
problems and ordinary differential equations.

1. Objectives:
At the end of this activity, the learner should be able to:
Familiarize themselves with the workspace on
Scilab Solve complex numbers using Scilab.

2. SCILAB Environment and Features Overview


Scilab is a free and open-source software. It can be used to simulate
mathematical applications from basic to advanced engineering systems.
Simulations can be through set of commands entered in the interactive
command, through scripts written in the console.

For this activity, you will be introduced to the basic command line interface as
well as simple numerical calculations. Solving complex numbers will be
examined on this activity. Some useful tools will also be introduced.

Page | 2
2.1 The general environment and the console

After double clicking the icon to launch Scilab, Scilab environment by default consists of the
following docked windows – files, console, variable browsers and command history:

Fig 1.1

In the console after the prompt “-->”, just type a command and press the Enter key (Windows and Linux) or
Return key (Mac OS X) on the keyboard to obtain corresponding result (shown on Fig 1.2 below).

The result is displayed after “ans = ”

Fig 1.2

It is possible to come back at any moment with the keyboard’s arrow keys ←↑→↓ or with the
mouse. The left and right keys are used to change instructions and the up and down keys are
used to come back on a previously executed command.

Page | 3
2.2 Simple numerical calculations

All computations done with Scilab are numerical.


Operations are written: Example:
+ Addition
- Subtraction
* Multiplication
/ Division
^ Exponent

The case is sensitive. It is thus necessary to respect uppercase and lower case for the calculations
to be performed properly. For example, with the sqrt command (which calculates the square root):

Particular numbers
%e, %pi and %i represent , and complex j respectively.

For not displaying the results


In adding a semi colon “ ; “ at the end of a command line, the calculation is done but the
result is not displayed.

To remind the name of a function


the tab key →ⅼ on the keyboard can be used to complete the name of a function or a variable by
giving its first few letters. Just select the desired function by using a mouse or arrow keys.

Page | 4
2.3 The menu bar
Useful tools on menu bar (Fig 1.3)

Variable Browser
allows you to find all
the variables previously
used during the current
session.

Command History allows you to find all


the commands from the previous sessions
to the current session.

Fig 1.3
Control
To interrupt a running program, you can:
Type pause in the program or click on Control > Interrupt in the menu bar (Ctrl+X), if the
program is already running. In all cases, the prompt “ -->” will turn into “ -1->”, then into “
-2-> and so on, if the operation is repeated.
To return to the time prior to the program interruption, type resume in the console or
click on Control > Resume.
To quit a calculation for good without any possibility of return, type abort in the console
or click on Control > Abort in the menu bar.

3. Working with Complex Numbers


Scilab can handle complex numbers and operations with complex numbers.
There are several ways of defining complex numbers in Scilab (Figure 1.4).
First method uses the special variable %i , which is predefined in
Scilab for complex numbers.
Another method is to use the Scilab function complex ( ). The function expects
two arguments, the real part and imaginary part of the complex number.

Page | 5
Figure 1.4

We can perform various mathematical operations on complex numbers: addition,


subtraction, multiplication and division.

Figure 1.5

We can also use complex numbers as arguments for other functions such as: sqrt ( ), sin ( ), etc.

Figure 1.6

Page | 6
3.1 Predefined Scilab functions for complex numbers

A summary and a short description of the Scilab function related to complex numbers is given below.

complex ( ) : creates a complex number


conj ( ) : creates the complex conjugate of a complex number
imag ( ) : extracts the imaginary part of complex numbers, polynomials or rationals
imult ( ) : multiplication by i the imaginary unitary
isreal ( ) : checks if a variable is stored as a complex number
polar ( ) : return the polar form of a complex number
real ( ) : extracts the real part of complex numbers, polynomials, or rationals.

3.2 Compute Complex Numbers in Scilab

The following Scilab script:

defines the complex numbers z1 znd


z2 performs mathematical operations
calculates the polar form of the complex numbers

clc( ) // clear console

Page | 7
Exercise: Compute complex numbers using Scilab.
1. Design a script to solve the following complex numbers
2. Use your own student ID number to define the variables.
3. Paste a photo of your script on the box provided and submit in .pdf format or
convert the image of the script to pdf and submit on VLE.

2 0 1 9 - - A
a1 b1 a2 b2

Complex numbers:
1= 1+ 1
2= 2+ 2
3= 1+ 2
4 = 1[ ( 2)]

a. Solve:
1 2−

b. Calculate the polar form of your

answer. Insert your script here:

--> //Defining Complex Number


--> a1=0;
--> b1=2;
--> a2=4;
--> b2=6;
--> z1=complex(a1,b1);
--> z2=complex(a2,b2);
--> //Applying Mathematical Operations
--> z3=z1+z2;
--> z4=z1*conj(z2);
--> //Solving a
--> a=(z1*z2)-z3/z4
a =
-12.538462 + 7.6923077i
--> a3=real(a);
--> b3=imag(a);
--> //Solving for Polar Form
--> //Solving for Modulus(r)
--> r=sqrt(a3^2+b3^2)
r =
14.710018
--> //Solving the angle
--> phi=atan(b3/a3)*180/%pi
phi =
-31.528988
References:
https://www.scilab.org/tutorials
https://x-engineer.org/graduate-engineering/programming-languages/scilab

Page | 8

You might also like