WhatsApp-00963951432013 Admin
عدد المساهمات : 2429 نقاط : 302124 السٌّمعَة : 4 تاريخ التسجيل : 20/09/2008 العمر : 54 الموقع : www.aoua.123.st
| موضوع: Course Code: M106 Course Title: Introduction to MATLAB programming Tutor Marked Assignment Cut-Off Date: Dec 12th, 2015 Total Marks: 60 Contents Feedback form …………………..……….…..…………..…………………….…...…... 2 الجمعة ديسمبر 04, 2015 9:06 pm | |
| Course Code: M106 Course Title: Introduction to MATLAB programming Tutor Marked Assignment
Cut-Off Date: Dec 12th, 2015 Total Marks: 60 Contents Feedback form …………………..……….…..…………..…………………….…...…... 2 Question1 …………………………..…………………..………………………..….……3 Question2 …..………………………..……………..…..………..……………………….3 Question3 ..……………………………..…………………….……..…………….………4 Question4………………..………………………………………………..…………….…4 Question5……………………..……………………………….…………………..…….…5 Question6……………………………..……………………….…….……………….……6
Plagiarism Warning: As per AOU rules and regulations, all students are required to submit their own TMA work and avoid plagiarism. The AOU has implemented sophisticated techniques for plagiarism detection. You must provide all references in case you use and quote another person's work in your TMA. You will be penalized for any act of plagiarism as per the AOU's rules and regulations.
Declaration of No Plagiarism by Student (to be signed and submitted by student with TMA work): I hereby declare that this submitted TMA work is a result of my own efforts and I have not plagiarized any other person's work. I have provided all references of information that I have used and quoted in my TMA work. Name of Student: Signature: Date:
This TMA covers chapters 1, 2, 3, 4 and 5. It consists of six questions and each question is worth 10 marks. Please solve each question in the space provided. You should give the details of your solutions and not just the final results. You must submit your matlab code as a .m matlab function well commented. Also you must submit all figures and relevant plots as part of your work as a single file.
Question 1 : (10 Marks) The relation between temperature in degree C and temperature in degree F is: a) Create a MATLAB user defined function called Temperature to calculate T in C and F degree. b) Write a MATLAB program that: - prompt the user to enter T in degree F. - Calculate the T in degree C, using the function defined in part (a), and display it. - Test your program with this data: T=290° F
Answer:
Question 2: 10 Marks
Create a MATLAB user defined function that computes Y=cos(x).*sin(2*x*z) Write a MATLAB program that: -Fix the value of x in range from 0 to 15 with step 0.01. - Prompts the user to enter the value of z - Computes the value of y using the function you defined in part (a) Answer:
Question 3: The 4 sided shape shown in next figure consists of two triangles having a common side h. The law of cosines for the top triangle states that h^2= b_1^(2 )+ c_1^2 – 2b_1 c_1 cosα_1
A similar equation can be written for the bottom triangle.
Write a MATLAB user defined function that takes the 2 sides of a triangle and the angle between them (in degree) and returns the third side of the triangle. Write a MATLAB program that: Prompts the user to enter the sides b1, c1,b2 ,c2 and the angle α 1 between b1 and c1 Calculate the side ‘h’ using the user defined function created in part (a) of the question. Calculate the angle α2 in degree Display the value of h and α2. Answer:
Question 4: 10 Marks Write a MATLAB user defined function swapVector(x) that is used to swap the order of the elements of a vector. Thus, in a vector v of n elements, v1 is swapped with vn, v2 is swapped with vn-1, and so on. Note that: The general formula for swapping depends on whether the vector has an even or an odd number of elements. As example: Applications of the function, using first a vector of 10 elements and then a vector of 9 elements, is shown next: » u = [-10:1:-1] u = -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 » swapVector(u) ans = -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 » u = [1:9] u = 1 2 3 4 5 6 7 8 9 » swapVector(u) ans = 9 8 7 6 5 4 3 2 1 Search in MATLAB library for a MATLAB function for swap and Write a MATLAB script using MATLAB function to perform swap on the vector u, prompt the user to enter the vector u and display the results. Answer:
Question 5: 10 Marks Given that y = 3x2-5, for -5 ≤ x≤ 5 plot function use MATLAB then evaluate the following expressions as sub plots to be included in same graph. Plot each function with different line type and color. Add title, and labels to the graph. Hand checks your answers. |y| 2.5y y/6
Answer:
Question 6: 10 Marks The Function fprintf can be used to produce an output table, Using fprintf function and for loop, write a MATLAB user defined function create a table for the following data: a = sin(10j); b = acos(10j); c = a + b; d = a - b; Where j is in the range 1≤ j ≤ 10 As shown below: >> mytable ====================================== a b c d ====================================== -0.54402 +0.45647 -0.08755 -1.00049 +0.91295 +0.37256 +1.28550 +0.54039 -0.98803 -0.15241 -1.14044 -0.83563 +0.74511 -0.49694 +0.24817 +1.24206 -0.26237 -0.25318 -0.51556 -0.00919 -0.30481 +0.29031 -0.01451 -0.59512 +0.77389 +0.49012 +1.26401 +0.28377 -0.99389 +0.10971 -0.88418 -1.10360 +0.89400 -0.40058 +0.49342 +1.29457 -0.50637 -0.43665 -0.94301 -0.06972 ====================================== Answer :
| |
|