SlideShare una empresa de Scribd logo
1 de 3
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

La actualidad más candente (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 a 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 15chingtony 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 .docxandreecapon
 
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.docxamrit47
 
Matlab practice
Matlab practiceMatlab practice
Matlab practiceZunAib Ali
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESNaveed Rehman
 
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).docxanhlodge
 
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.docxsmile790243
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3AhsanIrshad8
 
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-.docxsmile790243
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxDevaraj Chilakala
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptximman gwu
 
Matlab intro notes
Matlab intro notesMatlab intro notes
Matlab intro notespawanss
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentationManchireddy Reddy
 

Similar a 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
 

Más de Smee Kaem Chann

Más de 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
 

Último

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 FellowsMebane Rash
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
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Ữ Â...Nguyen Thanh Tu Collection
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
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 17Celine George
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
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...Poonam Aher Patil
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
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.pdfPoh-Sun Goh
 

Último (20)

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
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
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Ữ Â...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
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-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
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
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
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
 

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