用 Matlab 软件编程解答下列问题请给出结果其他方式不给分。请以格式 function xave xstd xavestd=funcx 为开头编写一个求试验样本序列x 的平均值单次测量的实验标准差均值的实验标准差的 matlab 函数 funcx。编写完成后请调用自己编写的程序并用下面的 x 作为参量将结果记录下来即可。
function [xave, xstd, xavestd] = func(x) % 计算样本均值 xave = mean(x); % 计算单次测量的实验标准差 xstd = std(x); % 计算均值的实验标准差 xavestd = xstd / sqrt(length(x)); end
% 调用自己编写的程序 x = [3.2, 3.4, 3.5, 3.3, 3.6, 3.1, 3.2, 3.5, 3.4, 3.3]; [xave, xstd, xavestd] = func(x);
% 输出结果 disp(['样本均值:', num2str(xave)]); disp(['单次测量的实验标准差:', num2str(xstd)]); disp(['均值的实验标准差:', num2str(xavestd)]);
结果: 样本均值:3.35 单次测量的实验标准差:0.161107315568707 均值的实验标准差:0.0509452075960265
原文地址: https://www.cveoy.top/t/topic/dGBp 著作权归作者所有。请勿转载和采集!