函数调用
https://www.cnblogs.com/gshang/p/12763028.html
1.Write and test a MATLAB script file called lab1_plot.m to plot the function f(x) = (sinx)3 + 2cosx in the interval [-π, π]. Remember to include annotations (e.g. axis labels, title) to your plot.
fplot('sin(x).^3+2*cos(x)',[-pi,pi])
title('f(x) = sin^3x + 2cosx');
xlabel('x');
ylabel('y');
print -dpng figure.png
x = linspace(-pi,pi,30);
y = sin(x).^3+2*cos(x)
plot(x, y, '-o');
title('f(x) = sin^3x + 2cosx');
xlabel('x');
ylabel('y');
print -dpng figure.png
clear
sum = 0;
for i = 1:100
sum = sum +i^3;
end
sum
%%
clear
sum = 0;
n = 0;
while n <100
n=n+1;
sum =sum+ n^3;
end
sum