1、学习了三种循环语句 for while switch
clc
clear all
f_abs = [130 ,138 ,145 ,150, 152 ,155 ,160 ,164 ,165 ,167 ,170 ,172 ,175];
f = [2 ;1;3;6 ;1 ;3 ;1;1 ;3 ;4 ;3 ;2 ;1];
raw = [];
for i = 1:length(f_abs)
if f_abs(i)>0
new = f_abs(i)*ones(1,f(i));
else
new = [];
end
raw = [raw ,new];
end
ave = mean(raw)
md = median(raw)
sigma =std(raw)
for index = start : increment : finish
statements
end
while condition
statements
end
switch expression
case 1
do these statements
case 2
do these statements
case n
do these statements
end
2、模仿编辑了一个计算圆柱体积的函数
function yuanzhudetiji
r=input('请输入圆柱体半径:');
h=input('请输入圆柱体的高:');
vol=pi*r^2*h;
disp('体积是:');
disp(vol)
end
3、学习了solve函数解简单方程以及使用ezplot