%plotfun.m
%plot a function

%Plot 3*cos(theta) between 0 and 3*pi

%Domain of function
startval=0;
inc=0.01;
endval=3*pi;
theta=[startval:inc:endval];

%Define function using theta
fun=3*cos(theta);

%Plot the function plot(xaxis variable, yaxis variable)
plot(theta,fun)
grid on
xlabel('\theta')
ylabel('3cos\theta')
title('Plot of function')
