Scilab
Scilab
ENGINEERING COLLEGE
[An Autonomous Institution]
R.S.M Nagar, Kavaraipettai, Gummidipoondi Taluk, Thiruvallur District, Tamil Nadu- 601 206
Affiliated to Anna University, Chennai / Approved by AICTE, New Delhi/ Accredited by NAAC with A+ Grade
An ISO 9001:2015 Certified Institution / All the Eligible UG Programs are accredited by NBA, New Delhi.
20CB702
LAB MANUAL
VII Semester
20CB702
LAB MANUAL
VII Semester
Prepared by Approved by
i
VISION OF THE INSTITUTE
• To be the most preferred destination in the country for pursuing education in Engineering and
its allied fields, at the undergraduate and post graduate levels, and for undertaking doctoral
research.
• To transform learners into achievers at the global level with the right attitude towards changing
societal needs.
• To develop the needed resources and infrastructure, and to establish a conducive ambience for
the teaching-learning process.
• To nurture in the students, professional and ethical values, and to instill in them a spirit of
innovation and entrepreneurship.
• To encourage in the students a desire for higher learning and research, to equip them to face
the global challenges.
• To provide opportunities for students to get the needed additional skills to make them industry
ready.
• To interact with industries and other organizations to facilitate transfer of knowledge and
know-how.
ii
VISION OF THE DEPARTMENT
V1: To be the most preferred destination in the country for imparting education in Computer
Science and Business Systems, at the undergraduate level.
V2: To transform learners into industry ready professionals at the global level to provide solutions
for business problem and contribute to the society at large.
M1: To provide an infrastructure and adopt creative teaching techniques to promote participatory
learning.
M2: To develop high personal and professional values, business competence and a spirit of
innovation and entrepreneurship.
M3: To encourage the desire for higher learning and research, to address global challenges.
M4: To collaborate with industry to inculcate varied skill sets that meets industry standards and
to practice moral values.
M5: To provide opportunity for nurturing skills that leads to career excellence.
PEO 1: To ensure graduates will be proficient in utilizing the fundamental knowledge of basic
sciences, mathematics and computer science for the applications relevant to various business
requirements.
PEO 2: To enrich graduates with the core competencies necessary for solving the business
requirements of an enterprise.
PEO 3: To enable graduates to think logically, pursue lifelong learning and will have the capacity
to understand technical issues related to computing and business systems and to design optimal
solutions.
iii
PEO 5: To practice the profession with ethics, integrity, leadership and social responsibility with
a good understanding of the changing societal needs.
PSO 1: Apply the core aspects of computer science and business system principles such as
software design & development and data engineering for developing software products.
PSO 2: Identify and utilize the strengths of cutting-edge technologies and strong analytical skills
to develop quality software in scientific and business applications for the betterment of society and
Industry.
PSO 3: Decide on suitable career path immediately after graduating or after pursuing higher
degree that would place them in an esteemed organization or create one of their own.
iv
SYLLABUS
OBJECTIVES:
• To introduce the students with the basic features of MATLAB/Scilab for problem solving.
• To introduce the students about the Mathematical functions like matrix generation.
• To introduce the students about the Mathematical functions like Plotting with multiple data
sets, line styles and colors.
• To introduce the students about the Array operations and solving Linear equations in
MATLAB/Scilab.
• To introduce the students about the control flow and operators using if-end structures and
loops.
Lab Exercises (Implementation of various Image Processing Algorithms)
1. Programs using mathematical, relational expressions and the operators.
2. Vectors and Matrices: Programs using array operations and matrix operations (such as
matrix multiplication).
3. Programs on input and output of values.
4. Selection Statements: Experiments on if statements, with else and elseif clauses and switch
statements.
5. Loop Statements and Vectorizing Code: Programs based on the concepts of counted (for)
and conditional (while) loops.
6. Programs based on scripts and user-defined functions.
7. Programs on Built-in text manipulation functions and conversion between string and number
types.
8. Programs based on two main data structures: cell arrays and structures.
9. Programs based on Data Transfer.
10. Programs based on Advanced Functions.
11. Introduction to Object-Oriented Programming and Graphics.
12. Programs based on Advanced Plotting Techniques.
13. Programs based on sound files and image processing.
14. Programs based on Advanced Mathematics.
TOTAL: 60 PERIODS
v
PROGRAM OUTCOMES:
At the end of this course, the students will be able to:
CO1: Write fundamental programs in MATLAB/Scilab, creating variables and mathematical
functions.
CO2: Understand how to program matrix operations, array operations and how to solve the
system of linear equations.
CO3: Program the fundamentals concepts of basic Plotting consisting of simple and multiple
data sets in one plot.
CO4: Understand how to program M-file scripts, M- file functions, Input –output Arguments
and program control flow operators, loops, flow structures.
CO5: Use the debugging process and debugging M-files.
vi
LIST OF EXERCISES
vii
PROGRAMS USING MATHEMATICAL, RELATIONAL EXPRESSIONS AND THE
OPERATORS
EX.NO: 1.1 CHECK A GIVEN NUMBER IS ZERO, POSITIVE OR NEGATIVE
AIM:
To write a MATLAB program to check whether a given number is zero, positive or negative.
ALGORITHM:
STEP 1 : Start
STEP 3: If x ==0 print zero, x is greater than zero print “positive”, or print “negative”
STEP 4: Stop
PROGRAM:
x=input("Enter a number : ")
if x==0 then
disp("Zero")
elseif x>0 then
disp("Positive")
else
disp("Negative")
end
Page No: 1
EX.NO: 1.2 LARGEST OF THREE NUMBERS
AIM:
To write a MATLAB program to print greatest among three numbers.
ALGORITHM:
STEP 1: Read three numbers A,B & C.
STEP 2: If A>B,then go to step 6.
STEP 3: If B>C,then print B & go to step 8.
STEP 4: print C is greatest & go to step 8.
STEP 5: If A>C,then print A is greatest & go to step 8.
STEP 6: Print C is greatest.
PROGRAM
a=input("Enter a:")
b=input("Enter b:")
c=input("Enter c:")
if a>=b & a>=c then
disp(a)
break
elseif b>a & b>c then
disp(b)
break
else
disp(c)
end
Page No: 2
EX.NO: 1.3 SUM OF ALL EVEN NUMBERS UP TO N
AIM:
To write a MATLAB program to sum all even numbers up to N integers.
ALGORITHM:
STEP 1: Read N, initialize s=0
STEP 2: Run a loop from i=1 to i=n
STEP 3: perform modulo2 operation on each value of i until n.
STEP 4: if modulo(i,2)==0, return sum = sum + i.
PROGRAM
n=input("Enter n ")
s=0
for i=1:n
if modulo(i,2)==0 then
s=s+i
end
end
disp(s)
Enter n 10
30.
RESULT :
Thus, the MATLAB program to perform mathematical and relations operations have been
executed and verified.
Page No: 3
VECTORS AND MATRICES
AIM:
To write a MATLAB program to print largest element in a vector.
ALGORITHM:
STEP 1: Read vector of values in n
STEP 2: Initialize m=0,
STEP 3: Run for loop from i=1 to i= length(n)
STEP 4: if n(i) > m then m=n(i)
STEP 5: return m
PROGRAM
n=input("Enter vector :")
m=0
for i=1:length(n)
if n(i)>m then
m=n(i)
end
end
disp(m)
Page No: 4
EX.NO: 2.2 REVERSE ELEMENTS IN AN ARRAY
AIM:
To write a MATLAB program to print the elements of an array in reverse order.
ALGORITHM:
STEP 1: Read an array of values.
STEP 2: Find the length of an array
STEP 3: Iterate and print elements in while loop until i>0
PROGRAM
n=input("Enter array:")
i=length(n)
while i>0
printf("%d ",n(i))
i=i-1
end
Page No: 5
EX.NO: 2.3 MATRIX MULTIPLICATION
AIM:
To write a MATLAB program to perform matrix multiplication.
ALGORITHM:
STEP 1: Initialize Matrix A with (m*n) and Matrix B with (x*y) rows and columns.
STEP 2: if n is not same as y, then exit
STEP 3: Read the values of both matrices.
STEP 4: otherwise define C matrix as (m x q)
STEP 5: for i in range 1 to m, do
for j in range 1 to y, do
for k in range 1 to x, do
C(i, j) = C(i, j )+ (A(i, k) * B(k, j))
STEP 6: End the loops
STEP 7: Display C
PROGRAM
m=input("Enter matrix 1 row:")
n=input("Enter matrix 1 Col:")
x=input("Enter matrix 2 row:")
y=input("Enter matrix 2 col")
if m~=y then
disp("Cannot perform matrix multiplication")
else
disp("Matrix 1")
for i=1:m
for j=1:n
A(i,j)=input("\")
end
end
disp("Matrix 2")
for i=1:x
for j=1:y
B(i,j)=input("\")
end
end
for i=1:m
for j=1:y
C(i,j)=0
Page No: 6
for k=1:x
C(i,j)=C(i,j)+A(i,k)*B(k,j)
end
end
end
end
disp(C)
7. 10.
15. 22.
RESULT :
Thus, the MATLAB programs based on vectors and matrices are successfully executed and
verified.
Page No: 7
SELECTION STATEMENTS
AIM:
To write a MATLAB program to print smallest of three numbers using Nested if else statements.
ALGORITHM:
STEP 1: Read a, b, c.
STEP 2: Check if a is less than b
STEP 3: If above condition is true, go to step 4, else go to step 6.
STEP 4: Check if a is less than c
STEP 5: If above condition is true, a is the smallest, else Go to step 6.
STEP 6: Check if b is less than a.
STEP 7: If above condition is true, go to step 8, else go to step 9.
STEP 8: Check if b is less than c, then b is the smallest, else c is the smallest
STEP 9: Print c is the smallest
PROGRAM
a=input("Enter a:")
b=input("Enter b:")
c=input("Enter c:")
if a<b then
if a<c then
disp(a)
end
elseif b<a then
if b<c then
disp(b)
else
disp(c)
end
end
Page No: 8
EX.NO: 3.2 CHECK WHETHER A CHARACTER IS A VOWEL OR CONSONANTS
AIM:
To write a MATLAB program to check whether a character is a vowel or consonants.
ALGORITHM:
STEP 1: Read a character
STEP 2: Check if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch == 'o' || ch
== 'O' || ch == 'u' || ch == 'U'), then character is a vowel else, the character is a consonant
PROGRAM
s = input("Enter a character:")
s=char(s)
s=convstr(s)
select s
case "a" then disp('vowel')
case "e" then disp('vowel')
case "i" then disp('vowel')
case "o" then disp('vowel')
case "u" then disp('vowel')
else disp('Consonant')
end
RESULT :
Thus, the MATLAB programs based on selection statements have been executed and verified.
Page No: 9
LOOP STATEMENTS AND VECTORIZING CODE
*****
****
***
**
Page No: 10
EX.NO: 4.2 SUM OF FIRST AND LAST DIGIT OF NUMBER
AIM:
To write a MATLAB program to print sum of first and last digit of a number.
ALGORITHM
PROGRAM:
n=input("Enter a number:")
s=0
s=s+modulo(n,10)
while n~=0
a=modulo(n,10)
n=int(n/10)
if n==0 then
s=s+a
end
end
disp(s)
Page No: 11
EX.NO: 4.3 COUNT TOTAL NUMBER OF DIGITS OF AN INTEGER
AIM:
To write a MATLAB program to count total number of digits of a number.
ALGORITHM
STEP 1: Read the integer num and another integer variable count to keep track of the number of digits.
STEP 2: Loop until ‘n’ is greater than zero.
STEP 3: If ‘n’ is greater than zero, increment the value of ‘count’ by one and n=n/10
STEP 4: Display count
PROGRAM:
n=input("Enter a number:")
c=0
while n~=0
a=modulo(n,10)
c=c+1
n=int(n/10)
end
disp(c)
RESULT :
Thus, the MATLAB programs based on looping statements have been executed and verified.
Page No: 12
EX.NO: 5 PRIME NUMBER UP TO N INTEGER USING MATLAB SCRIPTS
AIM:
To write a MATLAB program to print prime number up to N integers.
ALGORITHM:
STEP 1: Read the value of N
STEP 2: Iterate the for loop until N and call a function isprime() inside the loop
STEP 3: Iterate “for” loop from i= 2 to i=num/2 inside isprime().
STEP 4: If num is divisible by i, increment to next i value continue until condition fails else go to step 6
STEP 5: Return “Num IS NOT PRIME”
STEP 6: Return “Num IS PRIME”
PROGRAM
N = input("Enter a number:");
fprintf('Prime numbers from 1 to %d:\n', N);
for i = 1:N
if isPrime(i)
fprintf('%d ', i);
end
end
fprintf('\n');
function is_prime = isPrime(n)
if n == 1 || n == 0
is_prime = false;
return;
end
for i = 2:n/2
if mod(n,i) == 0
is_prime = false;
return;
end
end
is_prime = true;
end
SAMPLE INPUT AND OUTPUT
Enter a number:
100
Prime numbers from 1 to 100:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
RESULT :
Thus, the MATLAB program to print prime number up to N has been executed and verified.
Page No: 13
STRINGS
EX.NO: 6.1 BUILT IN TEXT MANIPULATION FUNCTIONS
AIM:
To write a MATLAB program to perform various operations on strings.
ALGORITHM
STEP 1: Converting to Upper and Lower case:
Get the input string str.
Use the upper() function to convert str to uppercase and store it in upperString.
Use the lower() function to convert str to lowercase and store it in lowerString.
Print the converted strings.
STEP 2: Concatenating Two Strings:
Get two input strings, str2 and str3.
Use the strcat() function to concatenate str2 and str3 and store the result in concatenatedString.
Print the concatenated string.
STEP 3: String Comparison Before Copy:
Use the strcmp() function to compare str2 and str3.
Store the result in strcmpValue.
Print the result as either '1' (if the strings are the same) or '0' (if they are different).
STEP 4: Copying String1 to String2:
Copy the value of str3 to str2 using the assignment operator (=).
Print the values of str2 and str3 to show the change.
STEP 5: String Comparison After Copy:
Use the strcmp() function to compare str2 and str3 after the copy operation.
Store the result in strcmpValue.
Print the result as either '1' (if the strings are the same) or '0' (if they are different).
STEP 6: Checking for Palindrome:
Get an input string str4.
Use the reverse() function to create a reversed version of str4 and store it in str5.
Compare str4 and str5 to check if they are the same.
Print whether str4 is a palindrome based on the comparison result.
PROGRAM
str = input('Enter String (upper case conversion , lower case conversion) :','s');
% Converting to Upper case
upperString = upper(str);
fprintf('Upper case string : %s\n',upperString)
%Converting to lower case
lowerString = lower(str);
fprintf('Lower case string : %s\n\n',lowerString)
%Concatenate two string
str2 = input('Enter String 1 :','s');
str3 = input('Enter String 2 :','s');
Page No: 14
concatenatedString= strcat(str2,str3);
fprintf('Concatenated string : %s\n',concatenatedString)
%String comparison before copy
strcmpValue = strcmp(str2,str3);
fprintf('String comparsion result : %s\n', int2str(strcmpValue))
%Copy string1 to string2
str2 = str3;
fprintf('String after copy : %s and %s\n',str2,str3);
%String comparison after copy
strcmpValue = strcmp(str2,str3);
fprintf('String comparison result : %s\n', int2str(strcmpValue));
%Palindrom
str4 = input('Enter String to compare palindrome :','s');
str5 = reverse(str4);
if str4 == str5
fprintf('%s is Palindrome\n',str4);
else
fprintf("%s is not a Palindrome\n",str4);
end
Enter String 1 :
Welcome
Enter String 2 :
to CSBS
Concatenated string : Welcome to CSBS
String comparsion result : 0
String after copy : to CSBS and to CSBS
String comparison result : 1
Enter String to compare palindrome :
malayalam
malayalam is Palindrome
Page No: 15
EX.NO: 6.2 CONVERSION BETWEEN STRING AND NUMBER TYPES
AIM:
To write a MATLAB program to perform conversion between string and number types.
ALGORITHM
STEP 1: Intialize a num variable
STEP 2: Convert num to a string using the num2str() function and store the result in numAsString
STEP 3: Display the value.
STEP 4: Initialize a str variable
STEP 5: Convert str to a numeric value using the str2double() function and store the result in strAsNum
PROGRAM
num = 42;
numAsString = num2str(num);
disp('Number as String:');
disp(numAsString);
str = '123.45';
strAsNum = str2double(str);
disp('String as Number:');
disp(strAsNum);
if isnan(strAsNum)
disp('Conversion from string to number failed.');
else
disp('Conversion from string to number successful.');
end
SAMPLE INPUT AND OUTPUT
Conversion
Number as String:
42
String as Number:
123.4500
Conversion from string to number successful.
RESULT :
Thus, the MATLAB program to perform various operations on strings and conversion between
string and number types have been executed and verified.
Page No: 16
PROGRAMS ON DATA STRUCTURES
AIM:
To write a MATLAB program to create and print values of cell arrays.
ALGORITHM
STEP 1: Create cell arrays person1, person2, and person3 to store information about three persons.
STEP 2: Create a cell array people to store the information about all three people by populating it with
person1, person2, and person3.
STEP 3:Display a message indicating that it's the "Second Person."
STEP 4:Retrieve and print the name, age, and occupation of the second person (person2) using indexing p
PROGRAM
person1 = {'John Smith', 30, 'Engineer'};
person2 = {'Alice Johnson', 25, 'Designer'};
person3 = {'Bob Brown', 35, 'Manager'};
people = {person1, person2, person3};
fprintf('Second Person:\n');
fprintf('Name: %s\n', people{2}{1});
fprintf('Age: %d\n', people{2}{2});
fprintf('Occupation: %s\n', people{2}{3});
Page No: 17
EX.NO: 7.2 STRUCTURES
AIM:
To write a MATLAB program to create and print values of Structure.
ALGORITHM
STEP 1: Create book1 and book2 structures to store information about two books, including their title,
author, and publication year.
STEP 2: Create a structure array library to store the book information by populating it with book1 and
book2.
STEP 3: Display "Second Book Information."
STEP 4: Retrieve and print the title, author, and year of the second book
PROGRAMS
book1.title = 'The Great Gatsby';
book1.author = 'F. Scott Fitzgerald';
book1.year = 1925;
RESULT :
Thus, the MATLAB program to create cell arrays and structures have been executed and verified.
Page No: 18
EX.NO: 8 PROGRAMS BASED ON DATA TRANSFER
AIM:
To write a MATLAB program to move data from one file to another file.
ALGORITHM
STEP 1: Read the excel file name.
STEP 2: Read data from the input Excel file using the xlsread() function and store it in the variable
inputData.
STEP 3: Prompt the user for the name of the output Excel file.
STEP 4: Save the data stored in inputData to the output Excel file using the xlswrite() function.
STEP 5: Display output file was successful or if any errors occurred during the process.
PROGRAM
% Prompt the user for the input Excel file name
inputFileName = input('Enter the name of the input Excel file (e.g., "input.xlsx"): ', 's');
try
% Read data from the input Excel file
inputData = xlsread(inputFileName); % Example for reading an Excel file
% Process the data (you can add your data processing steps here if needed)
% Prompt the user for the name of the output Excel file
outputFileName = input('Enter the name of the output Excel file (e.g., "output.xlsx"): ', 's');
% Attempt to save the data to the output Excel file
try
xlswrite(outputFileName, inputData); % Example for saving to an Excel file
fprintf('Data transferred to %s successfully.\n', outputFileName);
catch
fprintf('Error saving data to %s.\n', outputFileName);
end
catch
fprintf('Error reading data from %s. Please make sure the file exists and is in the same directory.\n',
inputFileName);
end
SAMPLE INPUT AND OUTPUT:
Enter the name of the input Excel file (e.g., "input.xlsx"):
Student
Enter the name of the output Excel file (e.g., "output.xlsx"):
student_new
Data transferred to student_new successfully.
RESULT :
Thus, the MATLAB program to copy one file to another file has been executed and verified.
Page No: 19
EX.NO: 9 ADVANCED FUNCTIONS (MATRIX OPERATIONS)
AIM:
Page No: 20
disp(['Determinant of the Matrix: ', num2str(det_matrix)]);
else
disp('Matrix must be square for determinant calculation.');
end
case 3
zero_matrix = zeros(rows, cols);
disp('Matrix of Zeros:');
disp(zero_matrix);
case 4
if rows == cols
eye_matrix = eye(rows);
disp('Identity Matrix:');
disp(eye_matrix);
else
disp('Matrix must be square for identity matrix generation.');
end
otherwise
disp('Invalid operation choice.');
end
RESULT :
Thus, the MATLAB program to perform various matrix operations are executed and verified.
Page No: 22
EX.NO: 10 CREATION OF DATE CLASS AND ITS OPERATIONS
AIM:
d1=mydate(23,3,01,11,2023)
d1 =
minute: 23
hour: 3
day: 1
month: 11
year: 2023
d2=rollDay(d1,34)
d2 =
mydate with properties:
minute: 23
hour: 3
day: 35
month: 11
year: 2023
RESULT :
Thus, the MATLAB program to create classes and objects is executed and verified.
Page No: 24
EX.NO: 11 CREATE AND DISPLAY MATLAB LOGO
AIM:
STEP 2: Create a figure and an axes to display the logo. Then, create a surface for the logo using the points
from the membrane command. Turn off the lines in the surface.
f = figure;
ax = axes;
s = surface(L);
s.EdgeColor = 'none';
view(3)
STEP 3: Adjust the axes limits so that the axes are tight around the logo.
ax.XLim = [1 201];
ax.YLim = [1 201];
ax.ZLim = [-53.4 160];
STEP 4:Adjust the view of the logo using the camera properties of the axes. Camera properties control the
view of a three dimensional scene like a camera with a zoom lens.
Page No: 25
STEP 5: Change the position of the axes and the x, y, and z aspect ratio to fill the extra space in the figure
window.
ax.Position = [0 0 1 1];
ax.DataAspectRatio = [1 1 .9];
STEP 6: Create lights to illuminate the logo. The light itself is not visible but its properties can be set to
change the appearance of any patch or surface object in the axes.
l1 = light;
l1.Position = [160 400 80];
l1.Style = 'local';
l1.Color = [0 0.8 0.8];
l2 = light;
l2.Position = [.5 -1 .4];
l2.Color = [0.8 0.8 0];
Page No: 26
STEP 7: Change the color of the logo.
s.FaceColor = [0.9 0.2 0.2];
STEP 8 :Use the lighting and specular (reflectance) properties of the surface to control the lighting effects.
s.FaceLighting = 'gouraud';
s.AmbientStrength = 0.3;
s.DiffuseStrength = 0.6;
s.BackFaceLighting = 'lit';
s.SpecularStrength = 1;
s.SpecularColorReflectance = 1;
s.SpecularExponent = 7;
RESULT :
Thus, the MATLAB program to create MATLAB LOGO is executed and verified.
Page No: 27
CREATION OF SOUND FILES AND IMAGE PROCESSING
load gong.mat
sound(y)
load handel.mat
sound(y,2*Fs);
STEP 3: Play Audio data with specified bits per sample
load handel.mat
nBits = 16;
sound(y,Fs,nBits)
Page No: 28
EX.NO: 12.2 CONVERSION OF RGB IMAGE INTO GRAYSCALE IMAGE
AIM: To write a MATLAB program to convert RGB image into Grayscale Image and displays it.
PROCEDURE:
STEP 1: Read the Image
The sample file named peppers.png contains an RGB image. Read the image into the workspace using
the imread function.
RGB = imread('peppers.png');
Page No: 29
STEP 5: Create a Tiled Image from Multiple Images
Combine several individual images into a single tiled image and display the tiled image using
the imshow function.
out = imtile({'peppers.png', 'ngc6543a.jpg'});
imshow(out);
RESULT :
Thus, the MATLAB program to create sound file and process image is executed and verified.
Page No: 30
EX.NO: 13 ADVANCED MATHEMATICS (COMPLEX NUMBER OPERATIONS)
PROGRAM
function outc = compl(z1,z2)
n=input("Enter operation:");
switch n
case '+'
realpart = real(z1) + real(z2);
imagpart = imag(z1) + imag(z2);
outc= realpart + imagpart * 1i;
case '-'
realpart = real(z1) - real(z2);
imagpart = imag(z1) - imag(z2);
outc= realpart + imagpart * 1i;
case '*'
realpart = real(z1) * real(z2);
imagpart = imag(z1) * imag(z2);
outc= realpart + imagpart * 1i;
case '/'
realpart = real(z1) / real(z2);
imagpart = imag(z1) / imag(z2);
outc= realpart + imagpart * 1i;
end
compl(3+4i,2-3j)
Enter operation:
Page No: 31
'/'
ans =
1.5000 - 1.3333i
compl(3+4i,2-3j)
Enter operation:
'+'
ans =
5.0000 + 1.0000i
RESULT :
Thus, the MATLAB program to perform various mathematical operations on complex number is
executed and verified.
Page No: 32