You are here

Example 8.2

20 January, 2016 - 09:21

Edit the script created in the example above to look like the code below:

    %% This file creates vectors, displays results and plots an x-y graph
x = [0:6];  % Create a row vector
y = 1.6*x;  % Compute y as a function of x
%% Tabulated data
[x',y']    % Transpose vectors x and y
%% Graph of y=f(x)
plot(x,y),title('Graph of y=f(x)'),xlabel('x'),ylabel('f(x)'),grid % Plot a graph

Save the script, a new HTML file is generated as shown in the figure below:

media/image5.png
Figure 8.4 An html file with sections