CSC215, Schedule, Syllabus,C++, Matlab,Guidelines,Evaluations

MATLAB PLOTTING Assignment

Try the following commands:

>> a = [5, 9, 4, 3,12, 2, 8]

>>b = [20:10:80]

>>disp(b)

>>plot(b,a)

>>c = 7

>>plot(a,c,'v')

>> d =sort(a)

>>plot(d,'o')

>>plot(d, 'o--')

>>help plot

>>%You try some of the other combinations between the single quotes.

>>c = [2, 5, 6, 7, 9, 10, 11]

>>plot(b, c, 'md-')
>>% Freeze the plot so new plots can be added to figure.
>>hold on

>> plot(b,c + 4, 'bp:')

>> plot(b,d-1,'dg--')

>>legend('line1', 'line2', 'line3')

>>xlabel('Vector Index')

>>ylabel('Vector Elements')

>>title('Graph of vectors')

>>hold off

>> %Stop the hold

>>%We can do the same thing with one plot statement.

>> plot(b,c-2,'hk--', b,c.*2, 'xr:', b,d+3, '+g-.')

>>xlabel('Vector Index')

>>ylabel('Vector Elements')

>>title('Graph of vectors')

%Select a textbox to label each plot. Examine how you can change the color of the text

%Let's look at some bar graphs and pie charts

>>bar(c)

>>barh(d)

>>bar3(d)

>>pie(c)

>>pie3(c)

Do this problem:

Plot the functions u = 2*log10(60*x +1) and v = 3*cos(6x) over the interval x from 0 to 2.

The variables u and v represent speed in mph and variable x represents time in minutes.

Place both curves on the same plot.
Properly label all aspects of the plot, ie: title, legend, axis, and each curve.
Label the maximum height attained by v.

Use different line types, data markers, and color.

Additionally, create a table of results x, u and v.

Use the disp(results) function to control the appearance of the output.