Description
EXAMPLE Question 1)
Given N=1, plot y=N sin(x) for 0 10 £ £x . Use 100 points for your graph. Apply a grid and
labels on the abscissa and ordinate of the graph.
In the regular MATLAB command window you would type:
x=linspace(0,10,100);
y=N*sin(x);
plot(x,y);
grid on;
xlabel(‘x’);
ylabel(‘y’);
However, for the purposes of this assignment you have to create a string that contains all the
plotting commands. Within this string all single quotes must become double quotes for it to
work:
graph=’plot(x,y);grid on;xlabel(”x”);ylabel(”y”)’;
See assign4.m to see how to do Question 1. Run test_assign4.m to see the plot.
Q2. Given N=5, plot the function 𝑦 𝑥 = $ %&’ (
()*+,../0 − 2(
3
for −5 ≤ 𝑥 ≤ 10. Use 1000 points for
your graph. Apply a grid and labels on the abscissa and ordinate of the graph.
Q3. Given N=1, an antenna has a radiation pattern given as 𝑦 𝜃 = %&’ $9:;
$9:; where q is the
azimuth angle. Assume that the formula is valid over the range of -£ £ pqp . Generate a polar
plot of the radiation pattern. Use 400 points for your graph.
Q4. Given N=3, the function 𝑦 𝑥 = (<)$()2
=.> ()? is given.
Plot the function for −4 ≤ 𝑥 ≤ 3. Label the axis, use a grid and place a title over your plot. Use
50 points for your graph. Limit the y axis of the graph from -12 to +10. Use red dots for the 50
data points and a black * on the last data point. Enlarge the marker size to ‘20’ pts.
ENEL101 Assignment 4 Page 3
Q5. Given N=3, a parametric equation is given by
𝑢 = 𝑁𝑡
1 + 𝑡2 , 𝑣 = 𝑁𝑡H
1 + 𝑡2
for a range of t given as 0 10 < <t . Use subplot() to produce the following two plots. Use
100 points for each graph.
A) In the first subplot 𝑢(𝑡) and 𝑣(𝑡) are superimposed.
B) In the second subplot assume 𝑢 along the abscissa and 𝑣 along the ordinate. Apply a grid
and labels on the abscissa and ordinate of the graphs.
Q6. An electric circuit that includes a voltage source 𝑣K with an internal resistance 𝑟K and a load
resistance 𝑅N is assumed. The power 𝑃 dissipated in the load is given by 𝑃 = PQ
<RS
RS)TQ <. Plot the
power as a function of 𝑅N for 1 ≤ 𝑅N ≤ 10 Ω given that 𝑣K = 12 V and 𝑟K = 2.5 Ω. Use 100
points for your graph. Apply a grid and labels on the abscissa and ordinate of the graphs.
Q7. An RLC circuit with an alternating voltage source is assumed. The source voltage 𝑣K is
given by 𝑣K = 𝑣Ysin (𝜔^𝑡), where 𝜔^ = 2𝜋𝑓^ in which 𝑓^ is the driving frequency. The
normalized amplitude of the current, 𝐼, in this circuit is given by
𝐼 = 1
𝑅H + 𝜔^𝐿 − 1
𝜔^𝐶
H
where 𝑅 (Ω), 𝐿 (H), and 𝐶 (F) are the resistance of the resistor, the capacitance of the capacitor,
and the inductance of the inductor, respectively. Write a function named that accepts 𝐿 (H) and 𝐶
(F) as input arguments and uses the mesh command to make a 3-D plot of 𝐼 (z-axis) for 0.5/
𝐿𝐶 ≤ 𝜔^ ≤ 1.5/ 𝐿𝐶 and for 10 ≤ 𝑅 ≤ 40 Ω. Label all the axes.
Q8. An elliptical staircase that decreases in size with height can be modeled by the parametric
equations
𝑥 = 𝑟cos 𝑡 , 𝑦 = 𝑟sin 𝑡 , 𝑧 = ℎ𝑡
2𝜋𝑛
where
𝑟 = 𝑎𝑏
𝑏H cosH 𝑡 + 𝑎HsinH 𝑡
𝑒m=.=9n
𝑎 and 𝑏 are the semi-major and semi-minor axes of the ellipse, ℎ is the staircase height, and 𝑛 is
the number of evolutions that the staircase makes. Write a function that accepts 𝑎, 𝑏, ℎ, 𝑛 as input
arguments and generates a 3-D plot of the staircase. Create a vector 𝑡 for the domain 0 to 2𝜋𝑛
and use the plot3 command.

