Course Code: M106 Course Title: Introduction To MATLAB Programming Tutor Marked Assignment Question 1: (12 Marks)

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 8

Course Code: M106

Course Title: Introduction to MATLAB programming


Tutor Marked Assignment

Question 1: [12 marks]

The i-v (current-voltage) relation of a non-linear electrical device is given by

where v(t) = sin3t


and the instantaneous power p(t) = v(t)i(t)

Create three graphs on one figure for the current, voltage, and power variation in this
.device from t0=0 to t1=10 s
Include appropriate labels, title, and gridlines

Question 2: [10 marks]


Write a program that prompts the user for endpoints (x 1, y1) and (x2, y2)
of five (5) line segments, and calculates the midpoint of each line
segment, which is the point (x m, ym). The coordinates of the midpoint
are found

and

The code should be organised as follows:

a) Write a getCoords() function that prompts the user for the x- and y-
coordinates for the two endpoints for the five line segments returns it
as 5-by-4 matrix of points. (Do NOT use loops)
(2 mark)

b) Write a findmid() function that calculates the x- and the y-coordinates


of the midpoints and returns it as 5-by-2 matrix of midpoints. (Do
NOT use loops)
(3 mark)

c) Write a print() function that prints the calculated midpoints. (Do NOT
use loops)
(2 marks)

d) Write a main script to do the following: (3


marks)

 Call getCoords() function to get the endpoints from the


user.
 Call findmid() function to find the midpoints.
 Call print() function to print the midpoints.

Question 3: [8 marks]
Write a Matlab program reads a sentence then prints each word on a separate line after
.converting its characters to uppercase
Hint: use the while... loop and read the Matlab documentation about the function)
(strtok

Question 4: [10 marks]


‫‪a) Write a nested for loops to print the following pattern.‬‬

‫‪1‬‬

‫‪121‬‬

‫‪12321‬‬

‫‪1234321‬‬

‫‪123454321‬‬
‫)‪(6 marks‬‬

‫‪b) Write a function that finds the comment elements two lists, e.g. [23, 11, 70],‬‬
‫‪[11, 2, 3] → [11]. (Do not use the ready Matlab function intersect, you can‬‬
‫)‪read the Matlab documentation about ismember() and unique() functions‬‬
‫)‪(4 marks‬‬

‫“‪”End of Questions‬‬

‫المهندس أحمد @ الجامعة العربية المفتوحة ‪ M106‬حل واجبات ‪M106 00966597837185 TMA‬‬
‫المهندس أحمد~ حلول‪,‬واجبات‪,‬الجامعة‪,‬العربية‪,‬المفتوحة~ ‪ M106 ** 00966597837185‬حل واجب ~‬
‫الجامعة العربية المفتوحة ‪ M106‬حل واجبات ‪ M106 00966597837185‬حل_واجب‪#‬‬
‫واجبات الجامعة العربية المفتوحة ‪ M106 ,‬المهندس أحمد‪ 00966597837185:‬حل واجب ‪M106‬‬
‫‪ M106 00966597837185‬حل واجب ‪M106 TMA Answers ENG:Ahmed‬‬
‫حلول واجبات الجامعـة العربية المفتوحة ~ ‪ , M106 00966597837185‬حل ‪ ,‬واجب‬
‫المهندس احمد لحلول الواجبات الجامعة العربية المفتوحة > ‪ M106 ? 00966597837185‬حل واجب‬
‫خل واجبات الجامعة ‪ M106‬حل واجب المهندس احمد ‪M106 00966597837185‬‬
‫‪ M106‬مهندس أحمد ‪ ,,,,‬حلول واجبات ‪ M106 << 00966597837185‬حل واجبات المتياز‬
‫حلول واجبات ‪ M106‬المفتوحة‪ ,‬حل واجب‪ M106,‬حل‪,‬واجبات‪,‬الجامعة‪,‬العربية‪00966597837185 ,‬‬
‫الجامعة العربية المفتوحة‬

‫حل واجبات جروب المتياز بقيادة المهندس أحمد ‪ 00966597837185‬تنبيه ‪ ,,‬رقمي الوحيد لعدم التعرض‬
‫للحتيال‬

‫حل واجبات الجامعة العربية المفتوحة ‪ << 00966597837185 - 0597837185‬مهندس أحمد‬

‫حلول واجبات الجامعة العربية المفتوحة >>> المهندس أحمد ‪00966597837185‬‬


‫حل واجبات الجامعة العربية المفتوحة لجميع المواد والتخصصات‪,‬مع نخبة من أفضل الساتذه والمهندسين‬
‫المتخصصين‬
‫‪ A_Al_SHORA@hotmail.com‬اميل المهندس أحمد‬

‫حل واجبات الجامعة العربية المفتوحة ‪ ,, 00966597837185‬حلو ل واجبات الجامعة العربية المفتوحة ‪,,‬‬
‫حلول الواجبات ‪ M106‬حل الواجب ‪ M106‬حلول واجبات ‪ M106‬جروب المتياز المهندس أحمد حل واجب‬
‫بدون تشابه حل واجبات الجامعة العربية المفتوحة ‪ ,, 00966597837185‬حلو ل واجبات ‪M106 TMA‬‬
‫حل ‪ M106‬حلول واجبات ‪ M106‬الجامعة العربية المفتوحة ‪ ,,‬جروب المتياز المهندس أحمد حل واجب‬
‫بدون تشابه ‪ M106 TMA‬حلول الواجبات ‪ M106‬الواجب‬

You might also like