
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

% Plotting
x = [0 1 2 3 4]; % Basic plotting plot(x); % Plot x versus its index values pause % Wait for key press plot(x, 2x); % Plot 2x versus x axis([0 8 0 8]); % Adjust visible rectangle
figure; % Open new figure x = pi*[-24:24]/24; plot(x, sin(x)); xlabel('radians'); % Assign label for x-axis ylabel('sin value'); % Assign label for y-axis title('dummy'); % Assign plot title
figure; subplot(1, 2, 1); % Multiple functions in separate graphs plot(x, sin(x)); % (see "help subplot") axis square; % Make visible area square subplot(1, 2, 2); plot(x, 2*cos(x)); axis square;
figure; plot(x, sin(x)); hold on; % Multiple functions in single graph plot(x, 2*cos(x), '--'); % '--' chooses different line pattern
legend('sin', 'cos'); % Assigns names to each plot hold off; % Stop putting multiple figures in current % graph
figure; % Matrices vs. images
m = rand(64,64); imagesc(m) % Plot matrix as image colormap gray; % Choose gray level colormap axis image; % Show pixel coordinates as axes axis off; % Remove axes