MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
% Calculate and plot y = sin(x).
x = 0:1:6*pi;
y = sin(x);
plot(x,y)

%% Modify Plot Properties
title('Sine Wave')
xlabel('x')
ylabel('sin(x)')
fig = gcf;
fig.MenuBar = 'none';
3 Save the file.
4 Place your cursor in the section titled Calculate and Plot Sine Wave. On the

Editor tab, in the Run section, click Run Section.

A figure displaying a course plot of sin(x) appears.

5 Smooth the sine plot.

(^1) Highlight 1 in the statement: x = 0:1:6*pi;.
(^2) Right-click and select Increment Value and Run Section. A small dialog box
appears.
18 Scripts

Free download pdf