Graphics Programs Reference
In-Depth Information
Assistance on any MATLAB functionis available by typing
help function name
in the command window.
1.9
Plotting
MATLAB hasextensive plotting capabilities. Here we illustrate some basiccommands
for two-dimensional plots. The example belowplots sin x and cos x on the same plot.
>>x=0:0.2:pi; %Createx-array
>>y=sin(x); %Createy-array
>> plot(x,y,'k:o') % Plot x-y points with specified color
% and symbol ('k' = black, 'o' = circles)
>> hold on % Allow overwriting of current plot
>>z=cos(x); %Createz-array
>> plot(x,z,'k:x') % Plot x-z points ('x' = crosses)
>> grid on % Display coordinate grid
>> xlabel('x') % Display label for x-axis
>> ylabel('y') % Display label for y-axis
>> gtext('sin x') % Create mouse-movable text
>> gtext('cos x')
Search WWH ::




Custom Search