SlideShare une entreprise Scribd logo
1  sur  2
1. Suppose you are given a variable X and you are asked to check whether its content is real or
complex. Based on what you have learnt in this lab, propose two different ways, using two
different MATLAB built-in functions, to perform the test. 2. Find the content of matrix B which
is the output of the following piece of code:
Solution
1.
>> X=input('Enter any number:');
t=isreal(X)
if t==1
disp('entered number is real')
else
disp('entered number is complex')
end
Enter any number:3+3i
t =
0
entered number is complex
>> X=input('Enter any number:');
t=isreal(X)
if t==1
disp('entered number is real')
else
disp('entered number is complex')
end
Enter any number:4
t =
1
entered number is real
2.
A=cos([pi/2, pi, 0; 2*pi,-pi, 3*pi/2]);
if A(1,3)==1 || A(3)>0
B=A+1
else
B=3*A
end
B =
1.0000Â Â Â Â Â Â Â Â 0Â Â Â 2.0000
2.0000Â Â Â Â Â Â Â Â 0Â Â Â 1.0000

Contenu connexe

Similaire à 1- Suppose you are given a variable X and you are asked to check wheth.docx

Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
fashioncollection2
 

Similaire à 1- Suppose you are given a variable X and you are asked to check wheth.docx (20)

III_Data Structure_Module_1.ppt
III_Data Structure_Module_1.pptIII_Data Structure_Module_1.ppt
III_Data Structure_Module_1.ppt
 
algorithm Unit 2
algorithm Unit 2 algorithm Unit 2
algorithm Unit 2
 
Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
 
III_Data Structure_Module_1.pptx
III_Data Structure_Module_1.pptxIII_Data Structure_Module_1.pptx
III_Data Structure_Module_1.pptx
 
Day2
Day2Day2
Day2
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Group p1
Group p1Group p1
Group p1
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
 
Introduction to biopython
Introduction to biopythonIntroduction to biopython
Introduction to biopython
 
Lecture2
Lecture2Lecture2
Lecture2
 
LeetCode April Coding Challenge
LeetCode April Coding ChallengeLeetCode April Coding Challenge
LeetCode April Coding Challenge
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
 
Array
ArrayArray
Array
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework Help
 
Hashing
HashingHashing
Hashing
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Jeop game-final-review
Jeop game-final-reviewJeop game-final-review
Jeop game-final-review
 
611+tutorial
611+tutorial611+tutorial
611+tutorial
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
 

Plus de tjames442

1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx
1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx
1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx
tjames442
 
1- What is a database- Give some examples- 2- What is a database manag.docx
1- What is a database- Give some examples- 2- What is a database manag.docx1- What is a database- Give some examples- 2- What is a database manag.docx
1- What is a database- Give some examples- 2- What is a database manag.docx
tjames442
 
1- What are phonons- What information can be obtained by studying the.docx
1- What are phonons- What information can be obtained by studying the.docx1- What are phonons- What information can be obtained by studying the.docx
1- What are phonons- What information can be obtained by studying the.docx
tjames442
 
1- Single convex lenses can be used to make images of far away objects.docx
1- Single convex lenses can be used to make images of far away objects.docx1- Single convex lenses can be used to make images of far away objects.docx
1- Single convex lenses can be used to make images of far away objects.docx
tjames442
 

Plus de tjames442 (20)

A star is 17-2 ly (light-years) from Earth- HINT (a) At what constant.docx
A star is 17-2 ly (light-years) from Earth- HINT (a) At what constant.docxA star is 17-2 ly (light-years) from Earth- HINT (a) At what constant.docx
A star is 17-2 ly (light-years) from Earth- HINT (a) At what constant.docx
 
A true statement about atoms is that they can emit radiation at freque.docx
A true statement about atoms is that they can emit radiation at freque.docxA true statement about atoms is that they can emit radiation at freque.docx
A true statement about atoms is that they can emit radiation at freque.docx
 
A TDR price of a length of 60 centimeters was installed vertically int.docx
A TDR price of a length of 60 centimeters was installed vertically int.docxA TDR price of a length of 60 centimeters was installed vertically int.docx
A TDR price of a length of 60 centimeters was installed vertically int.docx
 
1- The real interest rate is defined as- A- inflation minus the nomina.docx
1- The real interest rate is defined as- A- inflation minus the nomina.docx1- The real interest rate is defined as- A- inflation minus the nomina.docx
1- The real interest rate is defined as- A- inflation minus the nomina.docx
 
1- The intNumbers array is a one dimensional array- Write the statemen.docx
1- The intNumbers array is a one dimensional array- Write the statemen.docx1- The intNumbers array is a one dimensional array- Write the statemen.docx
1- The intNumbers array is a one dimensional array- Write the statemen.docx
 
1- The following data were reported by a corporation- Authorized share.docx
1- The following data were reported by a corporation- Authorized share.docx1- The following data were reported by a corporation- Authorized share.docx
1- The following data were reported by a corporation- Authorized share.docx
 
1- The following change is physical or chemical- Explain why- Water bo.docx
1- The following change is physical or chemical- Explain why- Water bo.docx1- The following change is physical or chemical- Explain why- Water bo.docx
1- The following change is physical or chemical- Explain why- Water bo.docx
 
1- Which of the following is a situation in which an involuntary trans.docx
1- Which of the following is a situation in which an involuntary trans.docx1- Which of the following is a situation in which an involuntary trans.docx
1- Which of the following is a situation in which an involuntary trans.docx
 
1- Which of the following is NOT a function of a firewall- a- Blocks o.docx
1- Which of the following is NOT a function of a firewall- a- Blocks o.docx1- Which of the following is NOT a function of a firewall- a- Blocks o.docx
1- Which of the following is NOT a function of a firewall- a- Blocks o.docx
 
1- What soil characteristics influence compressibility 2- Why is conso.docx
1- What soil characteristics influence compressibility 2- Why is conso.docx1- What soil characteristics influence compressibility 2- Why is conso.docx
1- What soil characteristics influence compressibility 2- Why is conso.docx
 
1- What type of encryption does PKI use- Symmetric Asymmetric DES AES.docx
1- What type of encryption does PKI use- Symmetric Asymmetric DES AES.docx1- What type of encryption does PKI use- Symmetric Asymmetric DES AES.docx
1- What type of encryption does PKI use- Symmetric Asymmetric DES AES.docx
 
1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx
1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx
1- What kind of contract did Lulene and Ellen have- What kinds of issu.docx
 
1- what is the net ionic equation for the neutralization of HBr with K.docx
1- what is the net ionic equation for the neutralization of HBr with K.docx1- what is the net ionic equation for the neutralization of HBr with K.docx
1- what is the net ionic equation for the neutralization of HBr with K.docx
 
1- What is outsourcing- What are advantages and disadvantages of outso.docx
1- What is outsourcing- What are advantages and disadvantages of outso.docx1- What is outsourcing- What are advantages and disadvantages of outso.docx
1- What is outsourcing- What are advantages and disadvantages of outso.docx
 
1- What is the difference between OSI and TCP-IP layered models-Soluti.docx
1- What is the difference between OSI and TCP-IP layered models-Soluti.docx1- What is the difference between OSI and TCP-IP layered models-Soluti.docx
1- What is the difference between OSI and TCP-IP layered models-Soluti.docx
 
1- What is a database- Give some examples- 2- What is a database manag.docx
1- What is a database- Give some examples- 2- What is a database manag.docx1- What is a database- Give some examples- 2- What is a database manag.docx
1- What is a database- Give some examples- 2- What is a database manag.docx
 
1- What are the functional sources of power- 2- Distinguish between pe.docx
1- What are the functional sources of power- 2- Distinguish between pe.docx1- What are the functional sources of power- 2- Distinguish between pe.docx
1- What are the functional sources of power- 2- Distinguish between pe.docx
 
1- What are phonons- What information can be obtained by studying the.docx
1- What are phonons- What information can be obtained by studying the.docx1- What are phonons- What information can be obtained by studying the.docx
1- What are phonons- What information can be obtained by studying the.docx
 
1- void fun(int &j) { j++- } int main() { int i - 20- fun(i)- printf(-.docx
1- void fun(int &j) { j++- } int main() { int i - 20- fun(i)- printf(-.docx1- void fun(int &j) { j++- } int main() { int i - 20- fun(i)- printf(-.docx
1- void fun(int &j) { j++- } int main() { int i - 20- fun(i)- printf(-.docx
 
1- Single convex lenses can be used to make images of far away objects.docx
1- Single convex lenses can be used to make images of far away objects.docx1- Single convex lenses can be used to make images of far away objects.docx
1- Single convex lenses can be used to make images of far away objects.docx
 

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

1- Suppose you are given a variable X and you are asked to check wheth.docx

  • 1. 1. Suppose you are given a variable X and you are asked to check whether its content is real or complex. Based on what you have learnt in this lab, propose two different ways, using two different MATLAB built-in functions, to perform the test. 2. Find the content of matrix B which is the output of the following piece of code: Solution 1. >> X=input('Enter any number:'); t=isreal(X) if t==1 disp('entered number is real') else disp('entered number is complex') end Enter any number:3+3i t = 0 entered number is complex >> X=input('Enter any number:'); t=isreal(X) if t==1 disp('entered number is real') else disp('entered number is complex') end Enter any number:4 t = 1
  • 2. entered number is real 2. A=cos([pi/2, pi, 0; 2*pi,-pi, 3*pi/2]); if A(1,3)==1 || A(3)>0 B=A+1 else B=3*A end B = 1.0000Â Â Â Â Â Â Â Â 0Â Â Â 2.0000 2.0000Â Â Â Â Â Â Â Â 0Â Â Â 1.0000