0% found this document useful (0 votes)
36 views2 pages

Matlab - Functions & Graphs: Task A - Miscellaneous

fgeeeeeeeeeeeeeeeeeeeeeeeeeefdddddddddddddddddddfffffffgggggggggggggggggggggggggggggggggggggggggggggggggggggggggeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeegtttttttttttttttttttttttttttttgggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Matlab - Functions & Graphs: Task A - Miscellaneous

fgeeeeeeeeeeeeeeeeeeeeeeeeeefdddddddddddddddddddfffffffgggggggggggggggggggggggggggggggggggggggggggggggggggggggggeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeegtttttttttttttttttttttttttttttgggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MEC1012 Practical No.

Student No.:

Name:

Matlab Functions & Graphs


Task A Miscellaneous

[2]

Use Matlab to calculate the following expressions:


1. 101 99
2. 3 500
3. 3

( ( ))

;
;
;

( ( ))

4. cos 1 sin
7 sin cos 7

Find the roots of the following polynomials:


5. x 4 + 4
6. x 5 + x 4 + x 3 + x 2 + x + 1

;
.

Show how to create the following sequences in Matlab, and use the sum( ) command to find
the sum of elements in each of these:
7.

(1

i 1 i )
1 1 4 1 9 116 1 25

8.

Show how to create the following matrices in Matlab:

1 7
9.
3 4

2 1 0
10.
0 1 2

Task B Multiple Graph Plotting

[1]

In the following, two curves are plotted together. Use a suitable legend to keep track of which
curve is which.
Tasks
1. Use the fplot command to plot the graphs of sin(x+c) and cos(x), from -2 to 2, on
the same figure. Find the value of the phase angle c, to one decimal place only, such
that the graphs coincide. Then print sin(x+c) and cos(x) on the same graph.
[]
c=

2. Use the figure command to create a new figure window and plot the graphs of ln(x)
and ln(1/x) on the same graph between 0.2 and 5. Print the graph. What is their
relationship?
[]

Ask a tutor to check your PNG image.


Absolute final deadline: information is on blackboard.

MEC1012 Practical No. 5

Student No.:

Name:

Task C Torque Transducer

[2]

In an experiment to calibrate a torque transducer, the following data was obtained relating the
Voltage (V) to the Torque (T):
Signal Voltage (V)
Torque (Nm)

0.16
1.40

0.42
2.29

0.69
3.66

1.21
5.93

1.67
8.15

1.99
9.24

2.22 2.49
10.32 11.41

It is assumed that the relationship between these two quantities is linear and we want to find
coefficients a and b such that:
T=a*V+b
In order to plot out the above experimental data, you should first store the x-values (the
Voltage) and the y-values (the Torque) in separate variables. Use commands like:
>> V=[0.16,0.42,0.69];

to enter the data; you should end up with two arrays (row vectors) with 8 numbers in each.
Tasks
3. Use the plot command to plot the graph with the data points being displayed as small
red circles. Suitable labels should then be given to the axes and the figure given a
title. Print all the commands to produce the graph. No need to print graph.
[0.7]
4. The values of the coefficients a and b that determine the best-fitting straight line
[0.5]
through the data can then be determined by using the polyfit command.
The best fitting line is given by: T =

*V+

5. Using the fplot command you should add in the best-fitting line determined above as
a solid blue line. (Use a range for the Voltage on the x-axis of 0 V 3.). Print all the
[0.5]
commands to produce the graph.
Save this plot (using File Save As in the figures menu) as file type Portable
Network Graphics (PNG), which has file extension .png. Print this image.
[0.3]

Ask a tutor to check your PNG image.


Absolute final deadline: information is on blackboard.

You might also like