Plotting Function - Matlab Code, Study Guides, Projects, Research of Computer Programming

Its way easier to plot a graph and compare your required objects through matlab plotting function. How to use Plotting Function in Matlab? How to write axes names in Matlab graph? How to change setting of figure resulted by Plotting Function in Matlab? Every-thing is here in following described version of matlab code.

Typology: Study Guides, Projects, Research

2012/2013

Uploaded on 10/08/2013

vishv
vishv 🇮🇳

4.4

(8)

32 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plotting
x = [0 1 2 3 4]; % Basic plotting
plot(x); % Plot x versus its index values
pause % Wait for key press
plot(x, 2*x); % Plot 2*x 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
docsity.com

Partial preview of the text

Download Plotting Function - Matlab Code and more Study Guides, Projects, Research Computer Programming in PDF only on Docsity!

% 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

docsity.com