SlideShare a Scribd company logo
1/3Smee
Matlab (TP1) 25%pt
1. Vectors and Matrices Initialize the following variables:
A=[
5 … 5
⋮ ⋱ ⋮
5 … 5
]
9×9
(use ones,zeros) ,B= (A 9x9 matrix of all 0 but with the values [1 2 3 4 5 4 3 2 1] on
diagonal, use zeros, diag) C= (A 3x4 matrix, use NaN) ,D=
2. Define the vector V = [0 1 2 ... 39 40]. What is the size of this vector? Define the vector W containing the first five and the last
five elements of V then define the vector Z = [0 2 4 ... 38 40] from V.
3. Define the matrix What are its dimensions m x n? Extract from this matrix
and .. Make a matrix Q obtained by taking the matrix M intersected between all the 3rd
rows
and one column out of 2. Calculate the matrix products NP = N x P, NtQ = N 'x Q and NQ = N x Q, then comment the results.
4. Define the variable 𝑥 = [
𝜋
6
,
𝜋
4
,
𝜋
3
] and calculate y1=sin(x) and y2=cos(x) Then calculate tan(x) using only the previous y1 and y2.
5. The following vectors are considered:
𝑢 = (
1
2
3
) , 𝑣 = (
−5
2
1
) 𝑎𝑛𝑑 𝑤 = (
−1
−3
7
)
a. Calculate t=u+3v-5w
b. Calculate ‖𝑢‖, ‖𝑣‖, ‖𝑤‖ and the cosine of the angle α formed by the vectors u and v, and α in degrees.
6. Application:This problem requires you to generate temperature conversion tables. Use the following equations, which describe
the relationships between tempera-tures in degrees Fahrenheit(TF) , degrees Celsius(TC), kelvins( TK ) , and degrees Rankine
(TR ) , respectively: 𝑇𝐹 = 𝑇𝑅 − 459.67 𝑜
𝑅, 𝑇𝐹 =
9
5
𝑇𝐶 + 32 𝑜
𝐹, 𝑇𝑅 =
9
5
𝑇𝑘 You will need to rearrange these expressions to solve
some of the problems.
(a) Generate a table of conversions from Fahrenheit to Kelvin for values from 0°F to 200°F. Allow the user to enter the
increments in degrees F between lines. Use disp and fprintf to create a table with a title, column headings, and appropriate
spacing.
(b) Generate a table of conversions from Celsius to Rankine. Allow the user to enter the starting temperature and the increment
between lines. Print 25 lines in the table. Use disp and fprintf to create a table with a title, column headings, and appropriate
spacing.
(c) Generate a table of conversions from Celsius to Fahrenheit. Allow the user to enter the starting temperature, the increment
between lines, and the number of lines for the table. Use disp and fprintf to create a table with a title, column headings, and
appropriate spacing.
7. Defined function Write in Matlab to find roots of quadratic equation 𝑦 = 𝑎𝑥2
+ 𝑏𝑥 + 𝑐 by contained the roots 𝑥 = [𝑥1 𝑥2].
Now, apply your program for the following cases:
a. a=1,b=7,c=12 b. a=1,b=-4,c=4 c. a=1,b=2,c=3
8. Using a function to calculate the volume of liquid (V) in a spherical tank,
given the depth of the liquid (h) and the radius (R).
V=SphereTank(R,h)
Now, apply your program for the following cases:
a. R=2,h=1 b. R=h=5 𝑉 =
𝜋ℎ2(3𝑅−ℎ)
3
2/3Smee
Solution
1.
A=5*ones(9) or A=5.+zeros(5,5)
B. a=[1:5,4:-1:1]
b=diag(a)
c=zeros(9,9)
D=b+c
or D=diag([1:5,4:-1:1])+zeros(9,9)
C=NaN(3,4)
D=([1:10;11:20;21:30;31:40;41:50;51:60;61:70;71:80;81:90;91:100])'
2.
V=[0:40]
size(V)
W=[V(:,1:5) V(:,37:41)]
Z=V(:,[1:2:40])
3.
M=[1:10;11:20;21:30]
size(M)
N=M(:,1:2)
P=M([1 3],[3 7])
Q=M(:,[1:2:10])
NP=N*P
NtQ=N'*Q
NQ=
%Error because both its size is not available for multiple matric
4.
x=[pi/6 pi/4 pi/3]
y1=sin(x)
y2=cos(x)
y=y1./y2
5.
u=[1;2;3]
v=[-5;2;1]
w=[-1;-3;7]
t=u+3*v-5*w
U=norm(u)
V=norm(v)
W=norm(w)
z=dot(u,v);
a=z/[U*V]
b=acosd(a)
6.
a.
incr=input('put the value of the incressing temperature')
F=0:incr:200;
K=(5.*(F+459.67)./9);
table=[F;K];
disp('Conversions from Fahrenheit to kelvin')
disp('In_F conversion to Kelvin')
fprintf('%3.4f %3.4frn',table);
b.
S=input('put the value of the starting temperature')
C=linspace(S,200,25);
R=(C+273.15).*1.8;
table=[C;R];
disp('Conversions from C to Rekin')
3/3Smee
disp('In_C conversion to Rekin')
fprintf('%3.4f %3.4frn',table);
c.
S=input('put the value of the starting temperature')
incr=input('put the value of the incressing temperature')
C=linspace(S,200,incr);
F=1.8.*C+32
table=[C;F];
disp('Conversions from C to F')
disp('In_C conversion to F')
fprintf('%3.4f %3.4frn',table);
7. Defined Function
function x = quadratic(a,b,c)
delta = 4*a*c;
denom = 2*a;
rootdisc = sqrt(b.^2 - delta); % Square root of the discriminant
x1 = (-b + rootdisc)./denom;
x2 = (-b - rootdisc)./denom;
x = [x1 x2];
end
Comment Window
quadratic(1,7,12)
quadratic(1,-4,4)
quadratic(1,2,3)
8.
function volume=SphereTank(radius,depth)
volume= pi*depth.^2*(3.*radius-depth)/3;
end
Comment Window
SphereTank(2,1)
SphereTank(5,5)
______________________________________________________________________________________________________________________
8/13/2017
5:32PM
Corrected by
Mr.Smee Kaem Chann
Tel : +885965235960

More Related Content

What's hot

Lecture 6
Lecture 6Lecture 6
Lecture 6
Chamila Fernando
 
Goldie chapter 4 function
Goldie chapter 4 functionGoldie chapter 4 function
Goldie chapter 4 function
Sarah Sue Calbio
 
Solution of matlab chapter 6
Solution of matlab chapter 6Solution of matlab chapter 6
Solution of matlab chapter 6
AhsanIrshad8
 
lecture 15
lecture 15lecture 15
lecture 15sajinsc
 
Matrices
MatricesMatrices
Matricesdaferro
 
Basic concepts. Systems of equations
Basic concepts. Systems of equationsBasic concepts. Systems of equations
Basic concepts. Systems of equationsjorgeduardooo
 
Trigonometric functions
Trigonometric functionsTrigonometric functions
Trigonometric functions
mstf mstf
 
Karnaugh maps
Karnaugh mapsKarnaugh maps
Karnaugh maps
AJAL A J
 
08 mtp11 applied mathematics - dec 2009,jan 2010
08 mtp11  applied mathematics - dec 2009,jan 201008 mtp11  applied mathematics - dec 2009,jan 2010
08 mtp11 applied mathematics - dec 2009,jan 2010
Dover Solutions India
 
Differential Equations Homework Help
Differential Equations Homework HelpDifferential Equations Homework Help
Differential Equations Homework Help
Math Homework Solver
 
Differential Equations Assignment Help
Differential Equations Assignment HelpDifferential Equations Assignment Help
Differential Equations Assignment Help
Maths Assignment Help
 
Matlab lecture 6 – newton raphson method@taj copy
Matlab lecture 6 – newton raphson method@taj   copyMatlab lecture 6 – newton raphson method@taj   copy
Matlab lecture 6 – newton raphson method@taj copy
Tajim Md. Niamat Ullah Akhund
 

What's hot (19)

Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Goldie chapter 4 function
Goldie chapter 4 functionGoldie chapter 4 function
Goldie chapter 4 function
 
Solution of matlab chapter 6
Solution of matlab chapter 6Solution of matlab chapter 6
Solution of matlab chapter 6
 
lecture 15
lecture 15lecture 15
lecture 15
 
Matrices
MatricesMatrices
Matrices
 
Basic concepts. Systems of equations
Basic concepts. Systems of equationsBasic concepts. Systems of equations
Basic concepts. Systems of equations
 
4R2012 preTest12A
4R2012 preTest12A4R2012 preTest12A
4R2012 preTest12A
 
algo1
algo1algo1
algo1
 
Trigonometric functions
Trigonometric functionsTrigonometric functions
Trigonometric functions
 
Karnaugh maps
Karnaugh mapsKarnaugh maps
Karnaugh maps
 
Karnaugh maps
Karnaugh mapsKarnaugh maps
Karnaugh maps
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
4R2012 preTest11A
4R2012 preTest11A4R2012 preTest11A
4R2012 preTest11A
 
08 mtp11 applied mathematics - dec 2009,jan 2010
08 mtp11  applied mathematics - dec 2009,jan 201008 mtp11  applied mathematics - dec 2009,jan 2010
08 mtp11 applied mathematics - dec 2009,jan 2010
 
Differential Equations Homework Help
Differential Equations Homework HelpDifferential Equations Homework Help
Differential Equations Homework Help
 
Matrices
MatricesMatrices
Matrices
 
4R2012 preTest2A
4R2012 preTest2A4R2012 preTest2A
4R2012 preTest2A
 
Differential Equations Assignment Help
Differential Equations Assignment HelpDifferential Equations Assignment Help
Differential Equations Assignment Help
 
Matlab lecture 6 – newton raphson method@taj copy
Matlab lecture 6 – newton raphson method@taj   copyMatlab lecture 6 – newton raphson method@taj   copy
Matlab lecture 6 – newton raphson method@taj copy
 

Similar to Travaux Pratique Matlab + Corrige_Smee Kaem Chann

MATLAB review questions 2014 15
MATLAB review questions 2014 15MATLAB review questions 2014 15
MATLAB review questions 2014 15
chingtony mbuma
 
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docxMATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
andreecapon
 
Q1Perform the two basic operations of multiplication and divisio.docx
Q1Perform the two basic operations of multiplication and divisio.docxQ1Perform the two basic operations of multiplication and divisio.docx
Q1Perform the two basic operations of multiplication and divisio.docx
amrit47
 
Algorithm Homework Help
Algorithm Homework HelpAlgorithm Homework Help
Algorithm Homework Help
Programming Homework Help
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
ZunAib Ali
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EES
Naveed Rehman
 
A02
A02A02
A02
lksoo
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
anhlodge
 
Lab 5 template Lab 5 - Your Name - MAT 275 Lab The M.docx
Lab 5 template  Lab 5 - Your Name - MAT 275 Lab The M.docxLab 5 template  Lab 5 - Your Name - MAT 275 Lab The M.docx
Lab 5 template Lab 5 - Your Name - MAT 275 Lab The M.docx
smile790243
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
AhsanIrshad8
 
M210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docx
M210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docxM210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docx
M210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docx
smile790243
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
imman gwu
 
Matlab intro notes
Matlab intro notesMatlab intro notes
Matlab intro notes
pawanss
 
NCIT civil Syllabus 2013-2014
NCIT civil Syllabus 2013-2014NCIT civil Syllabus 2013-2014
NCIT civil Syllabus 2013-2014
LAKSHITHA RAJAPAKSHA
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
Linear Algebra Assignment help
Linear Algebra Assignment helpLinear Algebra Assignment help
Linear Algebra Assignment help
Maths Assignment Help
 
Calculus Assignment Help
 Calculus Assignment Help Calculus Assignment Help
Calculus Assignment Help
Math Homework Solver
 
Tarea1
Tarea1Tarea1
Tarea1
DULCECRUZ11
 

Similar to Travaux Pratique Matlab + Corrige_Smee Kaem Chann (20)

MATLAB review questions 2014 15
MATLAB review questions 2014 15MATLAB review questions 2014 15
MATLAB review questions 2014 15
 
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docxMATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
 
Q1Perform the two basic operations of multiplication and divisio.docx
Q1Perform the two basic operations of multiplication and divisio.docxQ1Perform the two basic operations of multiplication and divisio.docx
Q1Perform the two basic operations of multiplication and divisio.docx
 
Algorithm Homework Help
Algorithm Homework HelpAlgorithm Homework Help
Algorithm Homework Help
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EES
 
A02
A02A02
A02
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
Lab 5 template Lab 5 - Your Name - MAT 275 Lab The M.docx
Lab 5 template  Lab 5 - Your Name - MAT 275 Lab The M.docxLab 5 template  Lab 5 - Your Name - MAT 275 Lab The M.docx
Lab 5 template Lab 5 - Your Name - MAT 275 Lab The M.docx
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
 
M210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docx
M210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docxM210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docx
M210 Songyue.pages__MACOSX._M210 Songyue.pagesM210-S16-.docx
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
 
Matlab intro notes
Matlab intro notesMatlab intro notes
Matlab intro notes
 
NCIT civil Syllabus 2013-2014
NCIT civil Syllabus 2013-2014NCIT civil Syllabus 2013-2014
NCIT civil Syllabus 2013-2014
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Linear Algebra Assignment help
Linear Algebra Assignment helpLinear Algebra Assignment help
Linear Algebra Assignment help
 
Calculus Assignment Help
 Calculus Assignment Help Calculus Assignment Help
Calculus Assignment Help
 
Tarea1
Tarea1Tarea1
Tarea1
 

More from Smee Kaem Chann

stress-and-strain
stress-and-strainstress-and-strain
stress-and-strain
Smee Kaem Chann
 
Robot khmer engineer
Robot khmer engineerRobot khmer engineer
Robot khmer engineer
Smee Kaem Chann
 
15 poteau-2
15 poteau-215 poteau-2
15 poteau-2
Smee Kaem Chann
 
14 poteau-1
14 poteau-114 poteau-1
14 poteau-1
Smee Kaem Chann
 
12 plancher-Eurocode 2
12 plancher-Eurocode 212 plancher-Eurocode 2
12 plancher-Eurocode 2
Smee Kaem Chann
 
Matlab_Prof Pouv Keangsé
Matlab_Prof Pouv KeangséMatlab_Prof Pouv Keangsé
Matlab_Prof Pouv Keangsé
Smee Kaem Chann
 
Vocabuary
VocabuaryVocabuary
Vocabuary
Smee Kaem Chann
 
Journal de bord
Journal de bordJournal de bord
Journal de bord
Smee Kaem Chann
 
8.4 roof leader
8.4 roof leader8.4 roof leader
8.4 roof leader
Smee Kaem Chann
 
Rapport de stage
Rapport de stage Rapport de stage
Rapport de stage
Smee Kaem Chann
 
Td triphasé
Td triphaséTd triphasé
Td triphasé
Smee Kaem Chann
 
Tp2 Matlab
Tp2 MatlabTp2 Matlab
Tp2 Matlab
Smee Kaem Chann
 
Cover matlab
Cover matlabCover matlab
Cover matlab
Smee Kaem Chann
 
New Interchange 3ed edition Vocabulary unit 8
New Interchange 3ed edition Vocabulary unit 8 New Interchange 3ed edition Vocabulary unit 8
New Interchange 3ed edition Vocabulary unit 8
Smee Kaem Chann
 
Matlab Travaux Pratique
Matlab Travaux Pratique Matlab Travaux Pratique
Matlab Travaux Pratique
Smee Kaem Chann
 
The technologies of building resists the wind load and earthquake
The technologies of building resists the wind load and earthquakeThe technologies of building resists the wind load and earthquake
The technologies of building resists the wind load and earthquake
Smee Kaem Chann
 
Devoir d'électricite des bêtiment
Devoir d'électricite des bêtimentDevoir d'électricite des bêtiment
Devoir d'électricite des bêtiment
Smee Kaem Chann
 
Rapport topographie 2016-2017
Rapport topographie 2016-2017  Rapport topographie 2016-2017
Rapport topographie 2016-2017
Smee Kaem Chann
 
Case study: Probability and Statistic
Case study: Probability and StatisticCase study: Probability and Statistic
Case study: Probability and Statistic
Smee Kaem Chann
 
Hydrologie générale
Hydrologie générale Hydrologie générale
Hydrologie générale
Smee Kaem Chann
 

More from Smee Kaem Chann (20)

stress-and-strain
stress-and-strainstress-and-strain
stress-and-strain
 
Robot khmer engineer
Robot khmer engineerRobot khmer engineer
Robot khmer engineer
 
15 poteau-2
15 poteau-215 poteau-2
15 poteau-2
 
14 poteau-1
14 poteau-114 poteau-1
14 poteau-1
 
12 plancher-Eurocode 2
12 plancher-Eurocode 212 plancher-Eurocode 2
12 plancher-Eurocode 2
 
Matlab_Prof Pouv Keangsé
Matlab_Prof Pouv KeangséMatlab_Prof Pouv Keangsé
Matlab_Prof Pouv Keangsé
 
Vocabuary
VocabuaryVocabuary
Vocabuary
 
Journal de bord
Journal de bordJournal de bord
Journal de bord
 
8.4 roof leader
8.4 roof leader8.4 roof leader
8.4 roof leader
 
Rapport de stage
Rapport de stage Rapport de stage
Rapport de stage
 
Td triphasé
Td triphaséTd triphasé
Td triphasé
 
Tp2 Matlab
Tp2 MatlabTp2 Matlab
Tp2 Matlab
 
Cover matlab
Cover matlabCover matlab
Cover matlab
 
New Interchange 3ed edition Vocabulary unit 8
New Interchange 3ed edition Vocabulary unit 8 New Interchange 3ed edition Vocabulary unit 8
New Interchange 3ed edition Vocabulary unit 8
 
Matlab Travaux Pratique
Matlab Travaux Pratique Matlab Travaux Pratique
Matlab Travaux Pratique
 
The technologies of building resists the wind load and earthquake
The technologies of building resists the wind load and earthquakeThe technologies of building resists the wind load and earthquake
The technologies of building resists the wind load and earthquake
 
Devoir d'électricite des bêtiment
Devoir d'électricite des bêtimentDevoir d'électricite des bêtiment
Devoir d'électricite des bêtiment
 
Rapport topographie 2016-2017
Rapport topographie 2016-2017  Rapport topographie 2016-2017
Rapport topographie 2016-2017
 
Case study: Probability and Statistic
Case study: Probability and StatisticCase study: Probability and Statistic
Case study: Probability and Statistic
 
Hydrologie générale
Hydrologie générale Hydrologie générale
Hydrologie générale
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

Travaux Pratique Matlab + Corrige_Smee Kaem Chann

  • 1. 1/3Smee Matlab (TP1) 25%pt 1. Vectors and Matrices Initialize the following variables: A=[ 5 … 5 ⋮ ⋱ ⋮ 5 … 5 ] 9×9 (use ones,zeros) ,B= (A 9x9 matrix of all 0 but with the values [1 2 3 4 5 4 3 2 1] on diagonal, use zeros, diag) C= (A 3x4 matrix, use NaN) ,D= 2. Define the vector V = [0 1 2 ... 39 40]. What is the size of this vector? Define the vector W containing the first five and the last five elements of V then define the vector Z = [0 2 4 ... 38 40] from V. 3. Define the matrix What are its dimensions m x n? Extract from this matrix and .. Make a matrix Q obtained by taking the matrix M intersected between all the 3rd rows and one column out of 2. Calculate the matrix products NP = N x P, NtQ = N 'x Q and NQ = N x Q, then comment the results. 4. Define the variable 𝑥 = [ 𝜋 6 , 𝜋 4 , 𝜋 3 ] and calculate y1=sin(x) and y2=cos(x) Then calculate tan(x) using only the previous y1 and y2. 5. The following vectors are considered: 𝑢 = ( 1 2 3 ) , 𝑣 = ( −5 2 1 ) 𝑎𝑛𝑑 𝑤 = ( −1 −3 7 ) a. Calculate t=u+3v-5w b. Calculate ‖𝑢‖, ‖𝑣‖, ‖𝑤‖ and the cosine of the angle α formed by the vectors u and v, and α in degrees. 6. Application:This problem requires you to generate temperature conversion tables. Use the following equations, which describe the relationships between tempera-tures in degrees Fahrenheit(TF) , degrees Celsius(TC), kelvins( TK ) , and degrees Rankine (TR ) , respectively: 𝑇𝐹 = 𝑇𝑅 − 459.67 𝑜 𝑅, 𝑇𝐹 = 9 5 𝑇𝐶 + 32 𝑜 𝐹, 𝑇𝑅 = 9 5 𝑇𝑘 You will need to rearrange these expressions to solve some of the problems. (a) Generate a table of conversions from Fahrenheit to Kelvin for values from 0°F to 200°F. Allow the user to enter the increments in degrees F between lines. Use disp and fprintf to create a table with a title, column headings, and appropriate spacing. (b) Generate a table of conversions from Celsius to Rankine. Allow the user to enter the starting temperature and the increment between lines. Print 25 lines in the table. Use disp and fprintf to create a table with a title, column headings, and appropriate spacing. (c) Generate a table of conversions from Celsius to Fahrenheit. Allow the user to enter the starting temperature, the increment between lines, and the number of lines for the table. Use disp and fprintf to create a table with a title, column headings, and appropriate spacing. 7. Defined function Write in Matlab to find roots of quadratic equation 𝑦 = 𝑎𝑥2 + 𝑏𝑥 + 𝑐 by contained the roots 𝑥 = [𝑥1 𝑥2]. Now, apply your program for the following cases: a. a=1,b=7,c=12 b. a=1,b=-4,c=4 c. a=1,b=2,c=3 8. Using a function to calculate the volume of liquid (V) in a spherical tank, given the depth of the liquid (h) and the radius (R). V=SphereTank(R,h) Now, apply your program for the following cases: a. R=2,h=1 b. R=h=5 𝑉 = 𝜋ℎ2(3𝑅−ℎ) 3
  • 2. 2/3Smee Solution 1. A=5*ones(9) or A=5.+zeros(5,5) B. a=[1:5,4:-1:1] b=diag(a) c=zeros(9,9) D=b+c or D=diag([1:5,4:-1:1])+zeros(9,9) C=NaN(3,4) D=([1:10;11:20;21:30;31:40;41:50;51:60;61:70;71:80;81:90;91:100])' 2. V=[0:40] size(V) W=[V(:,1:5) V(:,37:41)] Z=V(:,[1:2:40]) 3. M=[1:10;11:20;21:30] size(M) N=M(:,1:2) P=M([1 3],[3 7]) Q=M(:,[1:2:10]) NP=N*P NtQ=N'*Q NQ= %Error because both its size is not available for multiple matric 4. x=[pi/6 pi/4 pi/3] y1=sin(x) y2=cos(x) y=y1./y2 5. u=[1;2;3] v=[-5;2;1] w=[-1;-3;7] t=u+3*v-5*w U=norm(u) V=norm(v) W=norm(w) z=dot(u,v); a=z/[U*V] b=acosd(a) 6. a. incr=input('put the value of the incressing temperature') F=0:incr:200; K=(5.*(F+459.67)./9); table=[F;K]; disp('Conversions from Fahrenheit to kelvin') disp('In_F conversion to Kelvin') fprintf('%3.4f %3.4frn',table); b. S=input('put the value of the starting temperature') C=linspace(S,200,25); R=(C+273.15).*1.8; table=[C;R]; disp('Conversions from C to Rekin')
  • 3. 3/3Smee disp('In_C conversion to Rekin') fprintf('%3.4f %3.4frn',table); c. S=input('put the value of the starting temperature') incr=input('put the value of the incressing temperature') C=linspace(S,200,incr); F=1.8.*C+32 table=[C;F]; disp('Conversions from C to F') disp('In_C conversion to F') fprintf('%3.4f %3.4frn',table); 7. Defined Function function x = quadratic(a,b,c) delta = 4*a*c; denom = 2*a; rootdisc = sqrt(b.^2 - delta); % Square root of the discriminant x1 = (-b + rootdisc)./denom; x2 = (-b - rootdisc)./denom; x = [x1 x2]; end Comment Window quadratic(1,7,12) quadratic(1,-4,4) quadratic(1,2,3) 8. function volume=SphereTank(radius,depth) volume= pi*depth.^2*(3.*radius-depth)/3; end Comment Window SphereTank(2,1) SphereTank(5,5) ______________________________________________________________________________________________________________________ 8/13/2017 5:32PM Corrected by Mr.Smee Kaem Chann Tel : +885965235960