读取文件
data = xlsread('strain_stress.xlsx')
strain = data(:, 1);
stress = data(:, 2);
myplot(strain,stress)
函数文件
function myplot(strain,stress)
x_strain = [];
y_stress = [];
n = length(strain);
distance = 20;
for i = 1:distance
x_strain = [x_strain; strain(floor(n * i / distance))];
y_stress = [y_stress; stress(floor(n * i / distance))];
end
plot(strain, stress);
hold on
plot(x_strain,y_stress,'*');
end